AFTD Auto-Formalizing Theoretical Domains

diff_squares

def

The set of squared differences of a finite subset $A$ in a commutative ring is $(A - A)^2 = \{(a - b)^2 : a, b \in A\}$.

Statement

def diff_squares {F : Type*} [CommRing F] [DecidableEq F] (A : Finset F) : Finset F
Defined in
arXiv:2610.34758, Section 1
Verified
28 Oct 2026
Axioms
none listed
Used by 1

Read back from the Lean

For a commutative ring F with decidable equality and a finite set A ⊆ F, diff_squares A is defined as the finite subset of F consisting of all elements of the form (a - b)^2 for a, b ∈ A, obtained as the image of the Cartesian product A ×ˢ A under the mapping (a, b) ↦ (a - b)^2.

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 set of squared differences of a finite subset in a commutative ring. -/
def diff_squares {F : Type*} [CommRing F] [DecidableEq F] (A : Finset F) : Finset F := (A ×ˢ A).image (fun (a, b) => (a - b) ^ 2)
See it in the graphDiscuss this resultChallenge it