AFTD Auto-Formalizing Theoretical Domains

boolean_weight

def

The Hamming weight of a Boolean function on (Fin s → ZMod 2) is the number of points at which it evaluates to 1.

Statement

open scoped Classical in
noncomputable def boolean_weight {s : ℕ} (c : (Fin s → ZMod 2) → ZMod 2) : ℕ
Defined in
arXiv:2610.09341, Section 4.1
Verified
25 Oct 2026
Axioms
none listed

Read back from the Lean

Given a natural number $s$ and a function $c : (\mathrm{Fin}\ s \to \mathbb{Z}/2\mathbb{Z}) \to \mathbb{Z}/2\mathbb{Z}$, boolean_weight c is defined as the number (cardinality) of inputs $\beta : \mathrm{Fin}\ s \to \mathbb{Z}/2\mathbb{Z}$ for which $c(\beta) = 1$.

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

open scoped Classical in
/-- The Hamming weight of a Boolean function c : (Fin s → ZMod 2) → ZMod 2. -/
noncomputable def boolean_weight {s : ℕ} (c : (Fin s → ZMod 2) → ZMod 2) : ℕ := (Finset.univ.filter (fun β => c β = 1)).card
See it in the graphDiscuss this resultChallenge it