magic_rectangle_row_relations
Let A be a ring and let D, C : Fin 3 → A satisfy D j ^ 2 = 1 and C j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1, and pairwise commutativity D j * D k = D k * D j and C j * C k = C k * C j for all j, k. Setting X m = D m + C m and Y m = D m - C m, for every j : Fin 3 with i = j + 1 and k = j + 2, we have X j ^ 2 + Y j ^ 2 = 4, X i * X k + Y i * Y k = 2 * Y j, and X i * Y k + Y i * X k = 2 * X j.
Statement
theorem magic_rectangle_row_relations {A : Type*} [Ring A] (D C : Fin 3 → A) (hD_sq : ∀ j, D j ^ 2 = 1) (hC_sq : ∀ j, C 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) (j : Fin 3) : let X := fun m => D m + C m let Y := fun m => D m - C m let i := j + 1 let k := j + 2 X j ^ 2 + Y j ^ 2 = 4 ∧ X i * X k + Y i * Y k = 2 * Y j ∧ X i * Y k + Y i * X k = 2 * X j
- Source
- arXiv:2610.12001, Eq. (11)
- Verified
- 01 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 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,…
Read back from the Lean
Let $A$ be a ring, and let $D, C : \text{Fin } 3 \to A$ be families of three elements in $A$. Assume the following hypotheses: 1. For all $j \in \text{Fin } 3$, $D(j)^2 = 1$; 2. For all $j \in \text{Fin } 3$, $C(j)^2 = 1$; 3. $(D(0) \cdot D(1)) \cdot D(2) = 1$; 4. $(C(0) \cdot C(1)) \cdot C(2) = -1$; 5. For all $j, k \in \text{Fin } 3$, $D(j) \cdot D(k) = D(k) \cdot D(j)$; 6. For all $j, k \in \text{Fin } 3$, $C(j) \cdot C(k) = C(k) \cdot C(j)$. Then, for any $j \in \text{Fin } 3$, defining $X(m) = D(m) + C(m)$, $Y(m) = D(m) - C(m)$, $i = j + 1$, and $k = j + 2$ (with addition modulo 3 in $\text{Fin } 3$), the following three equalities hold: - $X(j)^2 + Y(j)^2 = 4$; - $X(i) \cdot X(k) + Y(i) \cdot Y(k) = 2 \cdot Y(j)$; - $X(i) \cdot Y(k) + Y(i) \cdot X(k) = 2 \cdot X(j)$.
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
The proof first establishes general ring lemmas showing that the sum of squares $(x+y)^2 + (x-y)^2$ equals 4 whenever $x^2 = y^2 = 1$, and that bilinear cross expressions in $(d_1 \pm c_1)$ and $(d_2 \pm c_2)$ reduce to $2(d_j \mp c_j)$ whenever $d_1 d_2 = d_j$ and $c_1 c_2 = -c_j$. Next, the row product constraints $D_0 D_1 D_2 = 1$ and $C_0 C_1 C_2 = -1$, combined with involution and pairwise commutativity, imply that each cyclic pair multiplies to the remaining element (up to a sign for $C$). Finally, the theorem is proved by case analysis over $j \in \text{Fin } 3$, instantiating the helper lemmas with the corresponding cyclic product identities in each case.
If $x^2 = 1$ in a ring, then $x \cdot x = 1$.
By definition of powers in a monoid, $x^2$ is $x \cdot x$. Rewriting the hypothesis $x^2 = 1$ using `sq` transforms it into $x \cdot x = 1$.
uses
sqlemma magic_rectangle_row_relations_sq_eq_mul {A : Type*} [Ring A] (x : A) (h : x ^ 2 = 1) : x * x = 1 := by rwa [sq] at h
If $x^2 = 1$ and $y^2 = 1$ in a ring, then $(x + y)^2 + (x - y)^2 = 4$.
Expanding the squares in a ring without assuming commutativity yields $(x + y)^2 + (x - y)^2 = 2 x^2 + 2 y^2$, because the cross-terms $x y + y x$ from the sum cancel with $- x y - y x$ from the difference. Substituting the hypotheses $x^2 = 1$ and $y^2 = 1$ gives $2 \cdot 1 + 2 \cdot 1 = 4$.
lemma magic_rectangle_row_relations_sq_add_sq {A : Type*} [Ring A] (x y : A) (hx : x ^ 2 = 1) (hy : y ^ 2 = 1) : (x + y) ^ 2 + (x - y) ^ 2 = 4 := by have h : (x + y) ^ 2 + (x - y) ^ 2 = 2 * x ^ 2 + 2 * y ^ 2 := by noncomm_ring rw [h, hx, hy] norm_num
If $d_1 d_2 = d_j$ and $c_1 c_2 = -c_j$ in a ring, then $(d_1 + c_1)(d_2 + c_2) + (d_1 - c_1)(d_2 - c_2) = 2(d_j - c_j)$.
Expanding the two products and adding them cancels the mixed cross-terms $d_1 c_2 + c_1 d_2$ and $- d_1 c_2 - c_1 d_2$, leaving $2(d_1 d_2 + c_1 c_2)$. Substituting $d_1 d_2 = d_j$ and $c_1 c_2 = - c_j$ evaluates this to $2(d_j - c_j)$.
lemma magic_rectangle_row_relations_cross_sum {A : Type*} [Ring A] (d1 d2 c1 c2 dj cj : A) (hd : d1 * d2 = dj) (hc : c1 * c2 = - cj) : (d1 + c1) * (d2 + c2) + (d1 - c1) * (d2 - c2) = 2 * (dj - cj) := by calc (d1 + c1) * (d2 + c2) + (d1 - c1) * (d2 - c2) _ = 2 * (d1 * d2 + c1 * c2) := by noncomm_ring _ = 2 * (dj + - cj) := by rw [hd, hc] _ = 2 * (dj - cj) := by noncomm_ring
If $d_1 d_2 = d_j$ and $c_1 c_2 = -c_j$ in a ring, then $(d_1 + c_1)(d_2 - c_2) + (d_1 - c_1)(d_2 + c_2) = 2(d_j + c_j)$.
Expanding the two products and adding them cancels the mixed terms $- d_1 c_2 + c_1 d_2$ and $d_1 c_2 - c_1 d_2$, leaving $2(d_1 d_2 - c_1 c_2)$. Substituting $d_1 d_2 = d_j$ and $c_1 c_2 = - c_j$ gives $2(d_j - (- c_j)) = 2(d_j + c_j)$.
lemma magic_rectangle_row_relations_cross_diff {A : Type*} [Ring A] (d1 d2 c1 c2 dj cj : A) (hd : d1 * d2 = dj) (hc : c1 * c2 = - cj) : (d1 + c1) * (d2 - c2) + (d1 - c1) * (d2 + c2) = 2 * (dj + cj) := by calc (d1 + c1) * (d2 - c2) + (d1 - c1) * (d2 + c2) _ = 2 * (d1 * d2 - c1 * c2) := by noncomm_ring _ = 2 * (dj - - cj) := by rw [hd, hc] _ = 2 * (dj + cj) := by noncomm_ring
For every index $m \in \{0, 1, 2\}$, $D_m \cdot D_m = 1$ and $C_m \cdot C_m = 1$.
Applying `magic_rectangle_row_relations_sq_eq_mul` to the squaring hypotheses $D_m^2 = 1$ (`hD_sq`) and $C_m^2 = 1$ (`hC_sq`) converts them into the explicit multiplication identities $D_m \cdot D_m = 1$ and $C_m \cdot C_m = 1$.
uses
magic_rectangle_row_relations_sq_eq_mul/-- Row parity relations and anticommutation identities for X_j and Y_j in a ring. -/ theorem magic_rectangle_row_relations {A : Type*} [Ring A] (D C : Fin 3 → A) (hD_sq : ∀ j, D j ^ 2 = 1) (hC_sq : ∀ j, C 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) (j : Fin 3) : let X := fun m => D m + C m let Y := fun m => D m - C m let i := j + 1 let k := j + 2 X j ^ 2 + Y j ^ 2 = 4 ∧ X i * X k + Y i * Y k = 2 * Y j ∧ X i * Y k + Y i * X k = 2 * X j := by have hD_sq_mul (m : Fin 3) : D m * D m = 1 := magic_rectangle_row_relations_sq_eq_mul (D m) (hD_sq m) have hC_sq_mul (m : Fin 3) : C m * C m = 1 := magic_rectangle_row_relations_sq_eq_mul (C m) (hC_sq m)
The pairwise cyclic products of $D$ satisfy $D_0 D_1 = D_2$, $D_1 D_2 = D_0$, and $D_2 D_0 = D_1$.
Each product is obtained by inserting an identity factor $D_m D_m = 1$ and applying the global product hypothesis $D_0 D_1 D_2 = 1$ (`hD_prod`). Specifically, $D_0 D_1 = (D_0 D_1)(D_2 D_2) = (D_0 D_1 D_2) D_2 = 1 \cdot D_2 = D_2$; similarly, $D_1 D_2 = (D_0 D_0)(D_1 D_2) = D_0 (D_0 D_1 D_2) = D_0 \cdot 1 = D_0$. For $D_2 D_0$, multiplying on the left by $D_1 D_1 = 1$ and using the pairwise commutativity of $D$ (`hD_comm`) allows reordering $D_1 (D_1 D_2 D_0) = D_1 (D_0 D_1 D_2) = D_1 \cdot 1 = D_1$.
have hD01 : D 0 * D 1 = D 2 := by calc D 0 * D 1 = (D 0 * D 1) * 1 := by noncomm_ring _ = (D 0 * D 1) * (D 2 * D 2) := by rw [hD_sq_mul 2] _ = (D 0 * D 1 * D 2) * D 2 := by noncomm_ring _ = 1 * D 2 := by rw [hD_prod] _ = D 2 := by noncomm_ring have hD12 : D 1 * D 2 = D 0 := by calc D 1 * D 2 = 1 * (D 1 * D 2) := by noncomm_ring _ = (D 0 * D 0) * (D 1 * D 2) := by rw [hD_sq_mul 0] _ = D 0 * (D 0 * D 1 * D 2) := by noncomm_ring _ = D 0 * 1 := by rw [hD_prod] _ = D 0 := by noncomm_ring have hD20 : D 2 * D 0 = D 1 := by calc D 2 * D 0 = 1 * (D 2 * D 0) := by noncomm_ring _ = (D 1 * D 1) * (D 2 * D 0) := by rw [hD_sq_mul 1] _ = D 1 * (D 1 * (D 2 * D 0)) := by noncomm_ring _ = D 1 * (D 1 * (D 0 * D 2)) := by rw [hD_comm 2 0] _ = D 1 * ((D 1 * D 0) * D 2) := by noncomm_ring _ = D 1 * ((D 0 * D 1) * D 2) := by rw [hD_comm 1 0] _ = D 1 * (D 0 * D 1 * D 2) := by noncomm_ring _ = D 1 * 1 := by rw [hD_prod] _ = D 1 := by noncomm_ring
The pairwise cyclic products of $C$ satisfy $C_0 C_1 = - C_2$, $C_1 C_2 = - C_0$, and $C_2 C_0 = - C_1$.
The derivations mirror those for $D$, but use $C_0 C_1 C_2 = -1$ (`hC_prod`). Thus, $C_0 C_1 = (C_0 C_1)(C_2 C_2) = (C_0 C_1 C_2) C_2 = -1 \cdot C_2 = - C_2$, and $C_1 C_2 = (C_0 C_0)(C_1 C_2) = C_0 (C_0 C_1 C_2) = C_0 (-1) = - C_0$. For $C_2 C_0$, inserting $C_1 C_1 = 1$ and using the pairwise commutativity of $C$ (`hC_comm`) reorders the product to $C_1 (C_0 C_1 C_2) = C_1 (-1) = - C_1$.
have hC01 : C 0 * C 1 = - C 2 := by calc C 0 * C 1 = (C 0 * C 1) * 1 := by noncomm_ring _ = (C 0 * C 1) * (C 2 * C 2) := by rw [hC_sq_mul 2] _ = (C 0 * C 1 * C 2) * C 2 := by noncomm_ring _ = -1 * C 2 := by rw [hC_prod] _ = - C 2 := by noncomm_ring have hC12 : C 1 * C 2 = - C 0 := by calc C 1 * C 2 = 1 * (C 1 * C 2) := by noncomm_ring _ = (C 0 * C 0) * (C 1 * C 2) := by rw [hC_sq_mul 0] _ = C 0 * (C 0 * C 1 * C 2) := by noncomm_ring _ = C 0 * (-1) := by rw [hC_prod] _ = - C 0 := by noncomm_ring have hC20 : C 2 * C 0 = - C 1 := by calc C 2 * C 0 = 1 * (C 2 * C 0) := by noncomm_ring _ = (C 1 * C 1) * (C 2 * C 0) := by rw [hC_sq_mul 1] _ = C 1 * (C 1 * (C 2 * C 0)) := by noncomm_ring _ = C 1 * (C 1 * (C 0 * C 2)) := by rw [hC_comm 2 0] _ = C 1 * ((C 1 * C 0) * C 2) := by noncomm_ring _ = C 1 * ((C 0 * C 1) * C 2) := by rw [hC_comm 1 0] _ = C 1 * (C 0 * C 1 * C 2) := by noncomm_ring _ = C 1 * (-1) := by rw [hC_prod] _ = - C 1 := by noncomm_ring
It suffices to establish the three identities for each value of $j \in \{0, 1, 2\}$.
We introduce the definitions of $X$, $Y$, $i = j + 1$, and $k = j + 2$, and perform exhaustive case analysis on the finite type `Fin 3` (`fin_cases j`), reducing the goal to the three cases $j = 0$, $j = 1$, and $j = 2$.
intro X Y i k fin_cases jThe three identities hold when $j = 0$ (where $i = 1$ and $k = 2$).
Specialising to $j = 0$, $i = 1$, and $k = 2$: the first identity $(D_0 + C_0)^2 + (D_0 - C_0)^2 = 4$ holds by `magic_rectangle_row_relations_sq_add_sq`. The second and third identities for the cross combinations of indices $1$ and $2$ evaluate to $2(D_0 - C_0) = 2 Y_0$ and $2(D_0 + C_0) = 2 X_0$ by `magic_rectangle_row_relations_cross_sum` and `magic_rectangle_row_relations_cross_diff`, using the relations $D_1 D_2 = D_0$ (`hD12`) and $C_1 C_2 = - C_0$ (`hC12`).
uses
magic_rectangle_row_relations_sq_add_sq,magic_rectangle_row_relations_cross_sum,magic_rectangle_row_relations_cross_diff· change (D 0 + C 0) ^ 2 + (D 0 - C 0) ^ 2 = 4 ∧ (D 1 + C 1) * (D 2 + C 2) + (D 1 - C 1) * (D 2 - C 2) = 2 * (D 0 - C 0) ∧ (D 1 + C 1) * (D 2 - C 2) + (D 1 - C 1) * (D 2 + C 2) = 2 * (D 0 + C 0) exact ⟨magic_rectangle_row_relations_sq_add_sq (D 0) (C 0) (hD_sq 0) (hC_sq 0), magic_rectangle_row_relations_cross_sum (D 1) (D 2) (C 1) (C 2) (D 0) (C 0) hD12 hC12, magic_rectangle_row_relations_cross_diff (D 1) (D 2) (C 1) (C 2) (D 0) (C 0) hD12 hC12⟩
The three identities hold when $j = 1$ (where $i = 2$ and $k = 0$).
Specialising to $j = 1$, $i = 2$, and $k = 0$ (modulo 3): $(D_1 + C_1)^2 + (D_1 - C_1)^2 = 4$ holds by `magic_rectangle_row_relations_sq_add_sq`. The cross combinations of indices $2$ and $0$ evaluate to $2(D_1 - C_1) = 2 Y_1$ and $2(D_1 + C_1) = 2 X_1$ by `magic_rectangle_row_relations_cross_sum` and `magic_rectangle_row_relations_cross_diff`, using $D_2 D_0 = D_1$ (`hD20`) and $C_2 C_0 = - C_1$ (`hC20`).
uses
magic_rectangle_row_relations_sq_add_sq,magic_rectangle_row_relations_cross_sum,magic_rectangle_row_relations_cross_diff· change (D 1 + C 1) ^ 2 + (D 1 - C 1) ^ 2 = 4 ∧ (D 2 + C 2) * (D 0 + C 0) + (D 2 - C 2) * (D 0 - C 0) = 2 * (D 1 - C 1) ∧ (D 2 + C 2) * (D 0 - C 0) + (D 2 - C 2) * (D 0 + C 0) = 2 * (D 1 + C 1) exact ⟨magic_rectangle_row_relations_sq_add_sq (D 1) (C 1) (hD_sq 1) (hC_sq 1), magic_rectangle_row_relations_cross_sum (D 2) (D 0) (C 2) (C 0) (D 1) (C 1) hD20 hC20, magic_rectangle_row_relations_cross_diff (D 2) (D 0) (C 2) (C 0) (D 1) (C 1) hD20 hC20⟩
The three identities hold when $j = 2$ (where $i = 0$ and $k = 1$).
Specialising to $j = 2$, $i = 0$, and $k = 1$ (modulo 3): $(D_2 + C_2)^2 + (D_2 - C_2)^2 = 4$ holds by `magic_rectangle_row_relations_sq_add_sq`. The cross combinations of indices $0$ and $1$ evaluate to $2(D_2 - C_2) = 2 Y_2$ and $2(D_2 + C_2) = 2 X_2$ by `magic_rectangle_row_relations_cross_sum` and `magic_rectangle_row_relations_cross_diff`, using $D_0 D_1 = D_2$ (`hD01`) and $C_0 C_1 = - C_2$ (`hC01`).
uses
magic_rectangle_row_relations_sq_add_sq,magic_rectangle_row_relations_cross_sum,magic_rectangle_row_relations_cross_diff· change (D 2 + C 2) ^ 2 + (D 2 - C 2) ^ 2 = 4 ∧ (D 0 + C 0) * (D 1 + C 1) + (D 0 - C 0) * (D 1 - C 1) = 2 * (D 2 - C 2) ∧ (D 0 + C 0) * (D 1 - C 1) + (D 0 - C 0) * (D 1 + C 1) = 2 * (D 2 + C 2) exact ⟨magic_rectangle_row_relations_sq_add_sq (D 2) (C 2) (hD_sq 2) (hC_sq 2), magic_rectangle_row_relations_cross_sum (D 0) (D 1) (C 0) (C 1) (D 2) (C 2) hD01 hC01, magic_rectangle_row_relations_cross_diff (D 0) (D 1) (C 0) (C 1) (D 2) (C 2) hD01 hC01⟩
sq- in any monoid, the square $a^2$ is definitionally the product $a \cdot a$
magic_rectangle_row_relations_sq_eq_mul- in a ring, if an element $x$ satisfies $x^2 = 1$, then $x \cdot x = 1$
magic_rectangle_row_relations_sq_add_sq- in a ring, if two elements $x$ and $y$ satisfy $x^2 = 1$ and $y^2 = 1$, then $(x + y)^2 + (x - y)^2 = 4$
magic_rectangle_row_relations_cross_sum- in a ring, if $d_1 d_2 = d_j$ and $c_1 c_2 = -c_j$, then $(d_1 + c_1)(d_2 + c_2) + (d_1 - c_1)(d_2 - c_2) = 2(d_j - c_j)$
magic_rectangle_row_relations_cross_diff- in a ring, if $d_1 d_2 = d_j$ and $c_1 c_2 = -c_j$, then $(d_1 + c_1)(d_2 - c_2) + (d_1 - c_1)(d_2 + c_2) = 2(d_j + c_j)$
- The tactic `noncomm_ring` is used throughout to automate polynomial expansion and algebraic simplification in arbitrary (possibly non-commutative) rings.
- Index arithmetic on `Fin 3` is cyclic modulo 3: when $j = 0$, $(i, k) = (1, 2)$; when $j = 1$, $(i, k) = (2, 0)$; and when $j = 2$, $(i, k) = (0, 1)$.
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.
lemma magic_rectangle_row_relations_sq_eq_mul {A : Type*} [Ring A] (x : A) (h : x ^ 2 = 1) : x * x = 1 := by rwa [sq] at hlemma magic_rectangle_row_relations_sq_add_sq {A : Type*} [Ring A] (x y : A) (hx : x ^ 2 = 1) (hy : y ^ 2 = 1) : (x + y) ^ 2 + (x - y) ^ 2 = 4 := by have h : (x + y) ^ 2 + (x - y) ^ 2 = 2 * x ^ 2 + 2 * y ^ 2 := by noncomm_ring rw [h, hx, hy] norm_numlemma magic_rectangle_row_relations_cross_sum {A : Type*} [Ring A] (d1 d2 c1 c2 dj cj : A) (hd : d1 * d2 = dj) (hc : c1 * c2 = - cj) : (d1 + c1) * (d2 + c2) + (d1 - c1) * (d2 - c2) = 2 * (dj - cj) := by calc (d1 + c1) * (d2 + c2) + (d1 - c1) * (d2 - c2) _ = 2 * (d1 * d2 + c1 * c2) := by noncomm_ring _ = 2 * (dj + - cj) := by rw [hd, hc] _ = 2 * (dj - cj) := by noncomm_ringlemma magic_rectangle_row_relations_cross_diff {A : Type*} [Ring A] (d1 d2 c1 c2 dj cj : A) (hd : d1 * d2 = dj) (hc : c1 * c2 = - cj) : (d1 + c1) * (d2 - c2) + (d1 - c1) * (d2 + c2) = 2 * (dj + cj) := by calc (d1 + c1) * (d2 - c2) + (d1 - c1) * (d2 + c2) _ = 2 * (d1 * d2 - c1 * c2) := by noncomm_ring _ = 2 * (dj - - cj) := by rw [hd, hc] _ = 2 * (dj + cj) := by noncomm_ring/-- Row parity relations and anticommutation identities for X_j and Y_j in a ring. -/theorem magic_rectangle_row_relations {A : Type*} [Ring A] (D C : Fin 3 → A) (hD_sq : ∀ j, D j ^ 2 = 1) (hC_sq : ∀ j, C 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) (j : Fin 3) : let X := fun m => D m + C m let Y := fun m => D m - C m let i := j + 1 let k := j + 2 X j ^ 2 + Y j ^ 2 = 4 ∧ X i * X k + Y i * Y k = 2 * Y j ∧ X i * Y k + Y i * X k = 2 * X j := by have hD_sq_mul (m : Fin 3) : D m * D m = 1 := magic_rectangle_row_relations_sq_eq_mul (D m) (hD_sq m) have hC_sq_mul (m : Fin 3) : C m * C m = 1 := magic_rectangle_row_relations_sq_eq_mul (C m) (hC_sq m) have hD01 : D 0 * D 1 = D 2 := by calc D 0 * D 1 = (D 0 * D 1) * 1 := by noncomm_ring _ = (D 0 * D 1) * (D 2 * D 2) := by rw [hD_sq_mul 2] _ = (D 0 * D 1 * D 2) * D 2 := by noncomm_ring _ = 1 * D 2 := by rw [hD_prod] _ = D 2 := by noncomm_ring have hD12 : D 1 * D 2 = D 0 := by calc D 1 * D 2 = 1 * (D 1 * D 2) := by noncomm_ring _ = (D 0 * D 0) * (D 1 * D 2) := by rw [hD_sq_mul 0] _ = D 0 * (D 0 * D 1 * D 2) := by noncomm_ring _ = D 0 * 1 := by rw [hD_prod] _ = D 0 := by noncomm_ring have hD20 : D 2 * D 0 = D 1 := by calc D 2 * D 0 = 1 * (D 2 * D 0) := by noncomm_ring _ = (D 1 * D 1) * (D 2 * D 0) := by rw [hD_sq_mul 1] _ = D 1 * (D 1 * (D 2 * D 0)) := by noncomm_ring _ = D 1 * (D 1 * (D 0 * D 2)) := by rw [hD_comm 2 0] _ = D 1 * ((D 1 * D 0) * D 2) := by noncomm_ring _ = D 1 * ((D 0 * D 1) * D 2) := by rw [hD_comm 1 0] _ = D 1 * (D 0 * D 1 * D 2) := by noncomm_ring _ = D 1 * 1 := by rw [hD_prod] _ = D 1 := by noncomm_ring have hC01 : C 0 * C 1 = - C 2 := by calc C 0 * C 1 = (C 0 * C 1) * 1 := by noncomm_ring _ = (C 0 * C 1) * (C 2 * C 2) := by rw [hC_sq_mul 2] _ = (C 0 * C 1 * C 2) * C 2 := by noncomm_ring _ = -1 * C 2 := by rw [hC_prod] _ = - C 2 := by noncomm_ring have hC12 : C 1 * C 2 = - C 0 := by calc C 1 * C 2 = 1 * (C 1 * C 2) := by noncomm_ring _ = (C 0 * C 0) * (C 1 * C 2) := by rw [hC_sq_mul 0] _ = C 0 * (C 0 * C 1 * C 2) := by noncomm_ring _ = C 0 * (-1) := by rw [hC_prod] _ = - C 0 := by noncomm_ring have hC20 : C 2 * C 0 = - C 1 := by calc C 2 * C 0 = 1 * (C 2 * C 0) := by noncomm_ring _ = (C 1 * C 1) * (C 2 * C 0) := by rw [hC_sq_mul 1] _ = C 1 * (C 1 * (C 2 * C 0)) := by noncomm_ring _ = C 1 * (C 1 * (C 0 * C 2)) := by rw [hC_comm 2 0] _ = C 1 * ((C 1 * C 0) * C 2) := by noncomm_ring _ = C 1 * ((C 0 * C 1) * C 2) := by rw [hC_comm 1 0] _ = C 1 * (C 0 * C 1 * C 2) := by noncomm_ring _ = C 1 * (-1) := by rw [hC_prod] _ = - C 1 := by noncomm_ring intro X Y i k fin_cases j · change (D 0 + C 0) ^ 2 + (D 0 - C 0) ^ 2 = 4 ∧ (D 1 + C 1) * (D 2 + C 2) + (D 1 - C 1) * (D 2 - C 2) = 2 * (D 0 - C 0) ∧ (D 1 + C 1) * (D 2 - C 2) + (D 1 - C 1) * (D 2 + C 2) = 2 * (D 0 + C 0) exact ⟨magic_rectangle_row_relations_sq_add_sq (D 0) (C 0) (hD_sq 0) (hC_sq 0), magic_rectangle_row_relations_cross_sum (D 1) (D 2) (C 1) (C 2) (D 0) (C 0) hD12 hC12, magic_rectangle_row_relations_cross_diff (D 1) (D 2) (C 1) (C 2) (D 0) (C 0) hD12 hC12⟩ · change (D 1 + C 1) ^ 2 + (D 1 - C 1) ^ 2 = 4 ∧ (D 2 + C 2) * (D 0 + C 0) + (D 2 - C 2) * (D 0 - C 0) = 2 * (D 1 - C 1) ∧ (D 2 + C 2) * (D 0 - C 0) + (D 2 - C 2) * (D 0 + C 0) = 2 * (D 1 + C 1) exact ⟨magic_rectangle_row_relations_sq_add_sq (D 1) (C 1) (hD_sq 1) (hC_sq 1), magic_rectangle_row_relations_cross_sum (D 2) (D 0) (C 2) (C 0) (D 1) (C 1) hD20 hC20, magic_rectangle_row_relations_cross_diff (D 2) (D 0) (C 2) (C 0) (D 1) (C 1) hD20 hC20⟩ · change (D 2 + C 2) ^ 2 + (D 2 - C 2) ^ 2 = 4 ∧ (D 0 + C 0) * (D 1 + C 1) + (D 0 - C 0) * (D 1 - C 1) = 2 * (D 2 - C 2) ∧ (D 0 + C 0) * (D 1 - C 1) + (D 0 - C 0) * (D 1 + C 1) = 2 * (D 2 + C 2) exact ⟨magic_rectangle_row_relations_sq_add_sq (D 2) (C 2) (hD_sq 2) (hC_sq 2), magic_rectangle_row_relations_cross_sum (D 0) (D 1) (C 0) (C 1) (D 2) (C 2) hD01 hC01, magic_rectangle_row_relations_cross_diff (D 0) (D 1) (C 0) (C 1) (D 2) (C 2) hD01 hC01⟩