magic_rectangle_sos_term2
Let A be an ℝ-algebra and let D, C, B : Fin 3 → A satisfy D j ^ 2 = C j ^ 2 = B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1, pairwise commutativity within D and within C, and every D and C commuting with every B. Setting X j = D j + C j, Y j = D j - C j, V j = X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1), and S = ∑ j : Fin 3, X j * B j, then for any r : ℝ, ∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2).
Statement
theorem magic_rectangle_sos_term2 {A : Type*} [Ring A] [Algebra ℝ A] (D C B : Fin 3 → A) (hD_sq : ∀ j, D j ^ 2 = 1) (hC_sq : ∀ j, C j ^ 2 = 1) (hB_sq : ∀ j, B j ^ 2 = 1) (hD_prod : D 0 * D 1 * D 2 = 1) (hC_prod : C 0 * C 1 * C 2 = -1) (hD_comm : ∀ j k, D j * D k = D k * D j) (hC_comm : ∀ j k, C j * C k = C k * C j) (hDB_comm : ∀ j k, D j * B k = B k * D j) (hCB_comm : ∀ j k, C j * B k = B k * C j) (r : ℝ) : let X := fun j => D j + C j let Y := fun j => D j - C j let V := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1) let S := ∑ j : Fin 3, X j * B j ∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2)
- Source
- step towards magic_rectangle_algebraic_sos_identity
- Verified
- 18 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- magic_rectangle_anticommutator_identitiesLet A be a ring and let D, C, B : Fin 3 → A satisfy D j ^ 2 = C j ^ 2 = B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1,…
- Used by 1
- magic_rectangle_algebraic_sos_identityLet A be an ℝ-algebra and let D, C, B : Fin 3 → A satisfy D j ^ 2 = C j ^ 2 = B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2…
The proof, explained
The proof expands the sum of squares ∑ j, (Y j - (1 / r) • V j) ^ 2 into the sum of squares of Y j, the sum of squares of V j, and the anticommutator cross-term ∑ j, (Y j * V j + V j * Y j). It evaluates this cross-term as 4 * S using the previously established identity `magic_rectangle_anticommutator_identities`. Finally, converting the ring multiplication by 4 to scalar multiplication by 4 and simplifying (1 / r) * 4 = 4 / r yields the desired formula.
The local abbreviations X, Y, V, and S are defined and the goal is restated in terms of them.
The local `let` bindings from the theorem statement are introduced into the proof context, and `change` restates the target equality cleanly using these definitions.
dsimp let X := fun j => D j + C j let Y := fun j => D j - C j let V := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1) let S := ∑ j : Fin 3, X j * B j change ∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2)
The anticommutator cross-term satisfies ∑ j : Fin 3, (Y j * V j + V j * Y j) = 4 * S.
This identity is supplied directly by extracting the third component of the lemma `magic_rectangle_anticommutator_identities` applied to D, C, and B under the assumed algebraic relations.
uses
magic_rectangle_anticommutator_identitieshave hcross : (∑ j : Fin 3, (Y j * V j + V j * Y j)) = 4 * S := by exact (magic_rectangle_anticommutator_identities D C B hD_sq hC_sq hB_sq hD_prod hC_prod hD_comm hC_comm hDB_comm hCB_comm).2.2.1
The sum of squares expands algebraically: ∑ j, (Y j - (1 / r) • V j) ^ 2 = (∑ j, Y j ^ 2) - (1 / r) • (∑ j, (Y j * V j + V j * Y j)) + ((1 / r) ^ 2) • (∑ j, V j ^ 2).
Expanding the finite sum over Fin 3 into three explicit summands, rewriting squares as products, and distributing ring multiplication and scalar multiplication leaves an identity between linear combinations of elements in the ℝ-module A. The `module` decision procedure verifies that both sides are identical.
uses
Fin.sum_univ_three,pow_two,sub_mul,mul_sub,smul_mul_assoc,mul_smul_comm,smul_smul,smul_add,smul_subhave hexpand : (∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2) = (∑ j : Fin 3, Y j ^ 2) - (1 / r) • (∑ j : Fin 3, (Y j * V j + V j * Y j)) + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2) := by simp only [Fin.sum_univ_three, pow_two, sub_mul, mul_sub, smul_mul_assoc, mul_smul_comm, smul_smul, smul_add, smul_sub] module
Multiplication by the ring literal 4 equals scalar multiplication by the real number 4: (4 : A) * S = (4 : ℝ) • S.
By definition of the algebra structure (`Algebra.smul_def`), (4 : ℝ) • S = algebraMap ℝ A 4 * S. The algebra map preserves numeral literals (`map_ofNat`), which turns algebraMap ℝ A 4 into the ring element 4 : A.
uses
Algebra.smul_def,map_ofNathave hfour : (4 : A) * S = (4 : ℝ) • S := by rw [Algebra.smul_def, map_ofNat]
∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2).
Substituting the expansion `hexpand`, the cross-term identity `hcross`, and the scalar representation `hfour`, the cross term becomes (1 / r) • (4 • S) = ((1 / r) * 4) • S via `smul_smul`. Simplifying (1 / r) * 4 to 4 / r by real arithmetic (`ring`) closes the proof.
uses
smul_smulrw [hexpand, hcross, hfour, smul_smul] have hc : (1 / r) * 4 = 4 / r := by ring rw [hc]
magic_rectangle_anticommutator_identities- Under the magic rectangle hypotheses, four anticommutator identities hold, the third of which is ∑ j, (Y j * V j + V j * Y j) = 4 * S.
Fin.sum_univ_three- A sum of a function over Fin 3 equals f 0 + f 1 + f 2.
pow_two- Squaring an element a ^ 2 equals a * a.
sub_mul- Multiplication distributes over subtraction on the right: (a - b) * c = a * c - b * c.
mul_sub- Multiplication distributes over subtraction on the left: a * (b - c) = a * b - a * c.
smul_mul_assoc- Scalar multiplication associates with ring multiplication on the left: (r • x) * y = r • (x * y).
mul_smul_comm- Scalar multiplication commutes with ring multiplication on the right: x * (s • y) = s • (x * y).
smul_smul- Successive scalar multiplications compose by multiplying the scalars: a₁ • (a₂ • b) = (a₁ * a₂) • b.
smul_add- Scalar multiplication distributes over addition: a • (b₁ + b₂) = a • b₁ + a • b₂.
smul_sub- Scalar multiplication distributes over subtraction: r • (x - y) = r • x - r • y.
Algebra.smul_def- Scalar multiplication in an algebra is given by multiplication by the image under the algebra map: r • x = algebraMap R A r * x.
map_ofNat- A ring homomorphism preserves natural number numeral literals: f (OfNat.ofNat n) = OfNat.ofNat n.
- Step 3 uses Lean's `module` decision procedure to verify that the distributed terms in the ℝ-module A match the grouped expansion of the sum of squares.
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.
/-- Expansion of the second sum of squares T2 in the Magic Rectangle SOS identity. -/theorem magic_rectangle_sos_term2 {A : Type*} [Ring A] [Algebra ℝ A] (D C B : Fin 3 → A) (hD_sq : ∀ j, D j ^ 2 = 1) (hC_sq : ∀ j, C j ^ 2 = 1) (hB_sq : ∀ j, B j ^ 2 = 1) (hD_prod : D 0 * D 1 * D 2 = 1) (hC_prod : C 0 * C 1 * C 2 = -1) (hD_comm : ∀ j k, D j * D k = D k * D j) (hC_comm : ∀ j k, C j * C k = C k * C j) (hDB_comm : ∀ j k, D j * B k = B k * D j) (hCB_comm : ∀ j k, C j * B k = B k * C j) (r : ℝ) : let X := fun j => D j + C j let Y := fun j => D j - C j let V := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1) let S := ∑ j : Fin 3, X j * B j ∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2) := by dsimp let X := fun j => D j + C j let Y := fun j => D j - C j let V := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1) let S := ∑ j : Fin 3, X j * B j change ∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2) have hcross : (∑ j : Fin 3, (Y j * V j + V j * Y j)) = 4 * S := by exact (magic_rectangle_anticommutator_identities D C B hD_sq hC_sq hB_sq hD_prod hC_prod hD_comm hC_comm hDB_comm hCB_comm).2.2.1 have hexpand : (∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2) = (∑ j : Fin 3, Y j ^ 2) - (1 / r) • (∑ j : Fin 3, (Y j * V j + V j * Y j)) + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2) := by simp only [Fin.sum_univ_three, pow_two, sub_mul, mul_sub, smul_mul_assoc, mul_smul_comm, smul_smul, smul_add, smul_sub] module have hfour : (4 : A) * S = (4 : ℝ) • S := by rw [Algebra.smul_def, map_ofNat] rw [hexpand, hcross, hfour, smul_smul] have hc : (1 / r) * 4 = 4 / r := by ring rw [hc]