AFTD Auto-Formalizing Theoretical Domains

finset_unordered_sum_rep_count

def

r_{A,2}(s): the number of unordered pairs {a, b} (a = b allowed) of elements of A with a + b = s.

Statement

def finset_unordered_sum_rep_count {G : Type*} [AddCommMonoid G] [DecidableEq G]
    (A : Finset G) (s : G) : ℕ
Defined in
arXiv:2610.09349 (A near-quadratic lower bound for sets with no unique sums), Sec. 1 (definition of r_{A,2}); defined in any additive commutative monoid, the paper works in F_p.
Verified
09 Oct 2026
Axioms
none listed
Used by 12

Lean source view module on GitHub

/-- The number of ways to write `s` as `a + b` with `{a, b}` an unordered pair from `A`, repetition allowed: `r_{A,2}(s)`. -/
def finset_unordered_sum_rep_count {G : Type*} [AddCommMonoid G] [DecidableEq G]
    (A : Finset G) (s : G) : ℕ :=
  (A.sym2.filter (fun z => Sym2.lift ⟨fun a b => a + b, fun a b => add_comm a b⟩ z = s)).card
See it in the graphDiscuss this resultChallenge it