/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import FormalConjecturesUtil

Wilf's Conjecture on Numerical Semigroups

An additive submonoid $S \le \mathbb{N}$ with finite complement $G(S) = \mathbb{N} \setminus S$ forms a numerical semigroup. Write $c(S) = \min{c \in \mathbb{N} : \forall m \ge c,, m \in S}$ for its conductor, $n(S) = |S \cap [0, c(S))| = c(S) - |G(S)|$ for the count of sporadic elements below $c(S)$, and $e(S) = |S_{>0} \setminus (S_{>0} + S_{>0})|$ for its embedding dimension (the size of its unique minimal generating set).

Herbert S. Wilf [Wi78] conjectured that $c(S) \le e(S) \cdot n(S)$ holds for all numerical semigroups $S$ (equivalently $e(S) \ge (F(S) + 1) / (F(S) + 1 - |G(S)|)$ when $S \subsetneq \mathbb{N}$ has largest gap $F(S) = c(S) - 1$, as stated on Wikipedia's Coin problem page). Fröberg, Gottlieb, and Häggkvist [FGH87, Theorem 20] proved the inequality whenever $e(S) \le 3$ (sourced directly from [FGH87]); the general case remains open.

References:

    [Wi78] H. S. Wilf, A circle-of-lights algorithm for the "money-changing problem", Amer. Math. Monthly 85 (1978), no. 7, 562–565, DOI: 10.1080/00029890.1978.11994639.

    [FGH87] R. Fröberg, C. Gottlieb, and R. Häggkvist, On numerical semigroups, Semigroup Forum 35 (1987), no. 1, 63–83, DOI: 10.1007/BF02573091.

    Wikipedia: Coin problem — Wilf's conjecture

@[expose] public sectionnamespace WilfNumericalSemigroupConjectureopen AddSubmonoid

Count $n(S)$ of elements in $S$ strictly below conductor S.

noncomputable def sporadicCount (S : AddSubmonoid ℕ) : ℕ := open scoped Classical in ((Finset.range (conductor S)).filter (fun x => x ∈ S)).card

On ⊤ : AddSubmonoid ℕ, conductor ⊤ = 0, sporadicCount ⊤ = 0, and embeddingDim ⊤ = 1, satisfying $0 \le 1 \cdot 0$.

@[category test, AMS 11 20] theorem top_numericalSemigroup_invariants : IsNumericalSemigroup ⊤ ∧ conductor ⊤ = 0 ∧ sporadicCount ⊤ = 0 ∧ embeddingDim ⊤ = 1 := ⊢ ⊤.IsNumericalSemigroup ∧ ⊤.conductor = 0 ∧ sporadicCount ⊤ = 0 ∧ ⊤.embeddingDim = 1 All goals completed! 🐙

On $S_{2,3} = \langle 2, 3 \rangle = \mathbb{N} \setminus {1}$, conductor = 2, sporadicCount = 1, and embeddingDim = 2, attaining equality $2 = 2 \cdot 1$.

All goals completed! 🐙

Wilf's Conjecture [Wi78]: Every numerical semigroup $S \le \mathbb{N}$ obeys $c(S) \le e(S) \cdot n(S)$.

@[category research open, AMS 11 20] theorem wilf_numerical_semigroup_conjecture {S : AddSubmonoid ℕ} (hS : IsNumericalSemigroup S) : conductor S ≤ embeddingDim S * sporadicCount S := S:AddSubmonoid ℕhS:S.IsNumericalSemigroup⊢ S.conductor ≤ S.embeddingDim * sporadicCount S All goals completed! 🐙

Fröberg–Gottlieb–Häggkvist Theorem [FGH87, Theorem 20]: Every numerical semigroup $S \le \mathbb{N}$ with embedding dimension $e(S) \le 3$ satisfies $c(S) \le e(S) \cdot n(S)$.

@[category research solved, AMS 11 20] theorem wilf_conjecture_embedding_dim_le_three {S : AddSubmonoid ℕ} (hS : IsNumericalSemigroup S) (he : embeddingDim S ≤ 3) : conductor S ≤ embeddingDim S * sporadicCount S := S:AddSubmonoid ℕhS:S.IsNumericalSemigrouphe:S.embeddingDim ≤ 3⊢ S.conductor ≤ S.embeddingDim * sporadicCount S All goals completed! 🐙end WilfNumericalSemigroupConjecture