AFTD Auto-Formalizing Theoretical Domains

is_balanced

def

A Boolean function f on (Fin n → ZMod 2) is balanced if its Hamming weight (the cardinality of its support) is 2^(n-1).

Statement

def is_balanced {n : ℕ} (f : (Fin n → ZMod 2) → ZMod 2) : Prop
Defined in
arXiv:2610.32239 Section 2
Verified
26 Oct 2026
Axioms
none listed
Used by 1

Read back from the Lean

For a given natural number n and a function f : (Fin n → ZMod 2) → ZMod 2, is_balanced f asserts that the cardinality of the set of inputs x : Fin n → ZMod 2 such that f(x) = 1 is equal to 2^(n - 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

/-- A Boolean function is balanced if its support has size 2^(n-1). -/
def is_balanced {n : ℕ} (f : (Fin n → ZMod 2) → ZMod 2) : Prop := (Finset.filter (fun x => f x = 1) Finset.univ).card = 2 ^ (n - 1)
See it in the graphDiscuss this resultChallenge it