AFTD Auto-Formalizing Theoretical Domains

avg_pairwise_hamming_dist

def

For an implicit dimension $n$ and a finite subset $F : \mathrm{Finset} (\mathrm{Fin}\ n \to \mathrm{Bool})$, the average pairwise Hamming distance avg_pairwise_hamming_dist F is the real number given by the sum over all pairs $x, y \in F$ of Mathlib's Hamming distance hammingDist x y cast to $\mathbb{R}$, divided by $(|F| : \mathbb{R})^2$.

Statement

noncomputable def avg_pairwise_hamming_dist {n : ℕ} (F : Finset (Fin n → Bool)) : ℝ
Defined in
arXiv:2610.40486 Sec. 1
Verified
30 Oct 2026
Axioms
none listed
Used by 3

Read back from the Lean

A definition avg_pairwise_hamming_dist that takes an implicit natural number n and a finite set F of Boolean functions on Fin n (i.e., F : Finset (Fin n → Bool)), and returns the real number obtained by summing the Hamming distance between x and y (cast to ℝ) over all pairs x, y ∈ F, divided by (|F| : ℝ)².

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 average pairwise Hamming distance of a finite subset `F` of the Boolean hypercube `Fin n → Bool`. -/
noncomputable def avg_pairwise_hamming_dist {n : ℕ} (F : Finset (Fin n → Bool)) : ℝ := (∑ x ∈ F, ∑ y ∈ F, (hammingDist x y : ℝ)) / (F.card : ℝ)^2
See it in the graphDiscuss this resultChallenge it