AFTD Auto-Formalizing Theoretical Domains

sumset_rep_count

def

For natural numbers h, k, q and integer s, sumset_rep_count h k q s is the number of pairs (x, A) in (sumset_sum_vectors_finset (h + 1) k) × (Finset.Icc 1 (q : ℤ)).powersetCard k such that dotProduct x (sumset_finset_sorted_vector k A) = s.

Statement

def sumset_rep_count (h k : ℕ) (q : ℕ) (s : ℤ) : ℕ
Defined in
arXiv:2611.07303 Proposition 5.7
Verified
06 Nov 2026
Axioms
none listed
Built on 4
  • sumset_sum_vectors_finsetFor natural numbers h and k, the finite set sumset_sum_vectors_finset h k is the finset of all vectors x : Fin k → ℤ with components in…
  • sumset_finset_sorted_vectorFor a natural number k and a finset A of integers, sumset_finset_sorted_vector k A is the vector in Fin k → ℤ whose entries are the…
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
Used by 4

Read back from the Lean

sumset_rep_count h k q s is defined as the number of pairs (x, A) such that: 1. x : Fin k → ℤ is a vector whose entries are integers in {0, 1, ..., h + 1} such that ∑ i, x i = h + 1. 2. A is a k-element subset of the integer interval {1, ..., q} (i.e., A ⊆ Finset.Icc 1 (q : ℤ) with |A| = k). 3. The dot product of x with the vector of elements of A sorted in strictly increasing order equals s (that is, ∑ i, x i * a_i = s, where a_0 < a_1 < ... < a_{k-1} are the sorted elements of A).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The representation count ν_q(s) of s as a dot product x · vec(A) for x ∈ X_{h+1,k} and A ∈ binom([q], k). -/
def sumset_rep_count (h k : ℕ) (q : ℕ) (s : ℤ) : ℕ := (((sumset_sum_vectors_finset (h + 1) k) ×ˢ ((Finset.Icc 1 (q : ℤ)).powersetCard k)).filter fun (x, A) => dotProduct x (sumset_finset_sorted_vector k A) = s).card
See it in the graphDiscuss this resultChallenge it