AFTD Auto-Formalizing Theoretical Domains

f2_add_eq_zero_iff

theoremverified

In the vector space of functions from Fin d to ZMod 2, the sum of two vectors b and b' equals zero if and only if b equals b'.

Statement

theorem f2_add_eq_zero_iff {d : ℕ} (b b' : Fin d → ZMod 2) :
    b + b' = 0 ↔ b = b'
Source
folklore
Verified
22 Oct 2026
Axioms
Classical.choiceQuot.soundpropext

Read back from the Lean

For any natural number $d$ and any functions $b, b' : \text{Fin } d \to \mathbb{Z}/2\mathbb{Z}$, their sum $b + b'$ is equal to $0$ if and only if $b = b'$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

In any additive group, two elements sum to zero if and only if one is the additive inverse of the other, reducing b + b' = 0 to b = -b'. Since the underlying field is ℤ/2ℤ, every element is its own additive inverse, meaning -b' = b' componentwise. Substituting this equality simplifies the condition b = -b' to b = b', establishing the equivalence.

  1. The condition b + b' = 0 is equivalent to b = -b'.

    In any additive group, two elements sum to zero if and only if one is the negation of the other. Rewriting with add_eq_zero_iff_eq_neg converts the goal from b + b' = 0 ↔ b = b' into b = -b' ↔ b = b'.

    line 4

    uses add_eq_zero_iff_eq_neg

      rw [add_eq_zero_iff_eq_neg]
  2. Because negation is the identity in (ℤ/2ℤ)^d, -b' = b', which completes the proof.

    In ℤ/2ℤ, every element satisfies -a = a (ZMod.neg_eq_self_mod_two). Applying this coordinate-wise via function extensionality (funext) shows that -b' = b'. Rewriting -b' with b' simplifies the goal b = -b' ↔ b = b' to b = b' ↔ b = b', which is closed by reflexivity.

    lines 5–6

    uses funext, ZMod.neg_eq_self_mod_two

      have h : -b' = b' := funext fun i => ZMod.neg_eq_self_mod_two (b' i)
      rw [h]
add_eq_zero_iff_eq_neg
In an additive group, the sum of two elements is zero if and only if the first is the additive inverse of the second: a + b = 0 ↔ a = -b.
funext
Two functions are equal if they agree on all inputs (function extensionality).
ZMod.neg_eq_self_mod_two
In ℤ/2ℤ, every element is its own additive inverse: -a = a.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- Two vectors in (ZMod 2)^d sum to zero if and only if they are equal. -/theorem f2_add_eq_zero_iff {d : ℕ} (b b' : Fin d → ZMod 2) :    b + b' = 0 ↔ b = b' := by  rw [add_eq_zero_iff_eq_neg]  have h : -b' = b' := funext fun i => ZMod.neg_eq_self_mod_two (b' i)  rw [h]
See it in the graphDiscuss this resultChallenge it