AFTD Auto-Formalizing Theoretical Domains

boolean_cube_dist_two_pairs

def

For a natural number d and a finite set X : Finset (Fin d → Fin 2) of vertices in the boolean cube, boolean_cube_dist_two_pairs X is the cardinality of the finset of ordered pairs (x, y) ∈ X ×ˢ X with hammingDist x y = 2.

Statement

def boolean_cube_dist_two_pairs {d : ℕ} (X : Finset (Fin d → Fin 2)) : ℕ
Defined in
arXiv:2611.04644, Section 1
Verified
04 Nov 2026
Axioms
none listed
Used by 1
  • boolean_cube_dist_two_pairs_emptyFor any natural number d, the number of ordered pairs at Hamming distance 2 in the empty set ∅ : Finset (Fin d → Fin 2) is 0, i.e.,…

Read back from the Lean

For a natural number d and a finite set X of functions from Fin d to Fin 2 (points in the d-dimensional Boolean cube), boolean_cube_dist_two_pairs X is the number of ordered pairs (x, y) ∈ X × X such that the Hamming distance between x and y is equal to 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 number of ordered pairs of vertices in X at Hamming distance 2. -/
def boolean_cube_dist_two_pairs {d : ℕ} (X : Finset (Fin d → Fin 2)) : ℕ := ((X ×ˢ X).filter (fun p => hammingDist p.1 p.2 = 2)).card
See it in the graphDiscuss this resultChallenge it