magic_square_even_sign_strings_card
Sanity check of the encoding of Alice's legal answers: exactly 4 of the 8 sign strings of length 3 have an even number of -1 signs (product +1).
Statement
theorem magic_square_even_sign_strings_card : (Finset.univ.filter (fun s : Fin 3 → Bool => xor (xor (s 0) (s 1)) (s 2) = false)).card = 4
- Source
- Sanity lemma for magic_square_strategy_valid (arXiv:2610.12001 (Exact value and rigidity of the 2x3 magic rectangle), Eq. (3): four even strings).
- Verified
- 02 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
The proof, explained
The theorem asserts that exactly 4 out of the 8 length-3 boolean sequences have an even parity (their XOR sum is false). Since the search space is finite and small, the proof proceeds by exhaustive computation via Lean's `decide` tactic.
The number of boolean vectors $s \in \mathrm{Fin}\ 3 \to \mathrm{Bool}$ with $s(0) \oplus s(1) \oplus s(2) = \mathrm{false}$ is exactly $4$. automation
The domain $\mathrm{Fin}\ 3 \to \mathrm{Bool}$ is finite, consisting of $2^3 = 8$ elements, and the parity condition is decidable. The `decide` tactic evaluates the condition on each of the 8 candidates by computation and counts that exactly 4 satisfy it.
decide
- The `decide` tactic proves this equality by direct computation, exhaustively evaluating the predicate over all $2^3 = 8$ functions from $\mathrm{Fin}\ 3$ to $\mathrm{Bool}$.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem magic_square_even_sign_strings_card : (Finset.univ.filter (fun s : Fin 3 → Bool => xor (xor (s 0) (s 1)) (s 2) = false)).card = 4 := by decide