three_qubit_ghz_phase_compatibility
Four complex triple-correlation harmonics can all be made purely imaginary by three independent local transverse rotations exactly when the displayed gauge-invariant product is real, including vanishing harmonics.
Statement
theorem three_qubit_ghz_phase_compatibility (z0 z1 z2 z3 : ℂ) :
(∃ u v w : ℂ, ‖u‖ = 1 ∧ ‖v‖ = 1 ∧ ‖w‖ = 1 ∧
(u*v*w*z0).re = 0 ∧
(u*v*star w*z1).re = 0 ∧
(u*star v*w*z2).re = 0 ∧
(star u*v*w*z3).re = 0) ↔
(z0 * star (z1*z2*z3)).im = 0- Source
- Filed by the prover as a step towards another result
- Verified
- 17 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- unit_complex_three_phase_surjectiveEvery prescribed triple of unit complex phases can be realized by the three transverse phase combinations ++−, +−+, and −++.
The proof, explained
The theorem proves that four triple-correlation harmonics z₀, z₁, z₂, z₃ can be simultaneously transformed to purely imaginary numbers by local single-qubit phase rotations u, v, w if and only if the gauge-invariant product z₀ * (z₁ * z₂ * z₃)* is real. For the forward direction, local rotations act on the four harmonics through effective phases a*b*c, a, b, c; the invariant product is preserved under this action, and the product of four purely imaginary numbers is necessarily real. For the backward direction, if any harmonic vanishes, three phases can be chosen independently to align the remaining harmonics and the fourth phase adjusted to match the product. If all harmonics are non-zero, explicit phases proportional to I * star zⱼ align the last three harmonics, and the reality of the invariant product forces the first harmonic to be purely imaginary as well; in either case, these phases are lifted to local rotations via surjectivity of the three-phase parametrization.
Any complex number can be rotated to the imaginary axis by multiplying by a unit complex number.
We split into cases on whether z = 0. If z = 0, multiplying by 1 gives 0, which has real part 0. If z ≠ 0, we set a = I * star z / ‖z‖. Its norm is 1 by multiplicativity of the norm, and a * z = I * ‖z‖, which is purely imaginary.
uses
norm_div,norm_mul,norm_ne_zero_iff.mpr,Complex.star_def,Complex.normSq_eq_conj_mul_self,Complex.normSq_eq_norm_sqby_cases hz : z = 0 · exact ⟨1, by simp, by simp [hz]⟩ · refine ⟨Complex.I * star z / (‖z‖ : ℂ), ?_, ?_⟩ · simp [norm_div, norm_mul, norm_ne_zero_iff.mpr hz] · have hn : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast (norm_ne_zero_iff.mpr hz) have he : Complex.I * star z / (‖z‖ : ℂ) * z = Complex.I * (‖z‖ : ℂ) := by field_simp rw [Complex.star_def] rw [← Complex.normSq_eq_conj_mul_self, Complex.normSq_eq_norm_sq] push_cast ring rw [he] simp
The product of three unit complex numbers has unit norm.
By multiplicativity of the complex norm, ‖a * b * c‖ = ‖a‖ * ‖b‖ * ‖c‖ = 1 * 1 * 1 = 1.
uses
norm_mul‖a*b*c‖ = 1 := by simp [norm_mul, ha, hb, hc]
The harmonic product z₀ * (z₁ * z₂ * z₃)* is invariant under multiplying z₀, z₁, z₂, z₃ by a*b*c, a, b, c for any unit complex numbers a, b, c.
Because a, b, c have unit norm, their complex conjugates are their multiplicative inverses. The transformed product picks up factors (a * b * c) from the first term and (star a * star b * star c) = (a⁻¹ * b⁻¹ * c⁻¹) from the conjugated triple product, which cancel out completely.
uses
Complex.inv_eq_conj,norm_ne_zero_iff.mp,star_mulhave hsa : star a = a⁻¹ := (Complex.inv_eq_conj ha).symm have hsb : star b = b⁻¹ := (Complex.inv_eq_conj hb).symm have hsc : star c = c⁻¹ := (Complex.inv_eq_conj hc).symm have ha0 : a ≠ 0 := norm_ne_zero_iff.mp (by rw [ha]; norm_num) have hb0 : b ≠ 0 := norm_ne_zero_iff.mp (by rw [hb]; norm_num) have hc0 : c ≠ 0 := norm_ne_zero_iff.mp (by rw [hc]; norm_num) simp only [star_mul, hsa, hsb, hsc] field_simp <;> ring
If four complex numbers are all purely imaginary, their invariant product is real.
Each purely imaginary number is I times a real number. The product of three purely imaginary numbers has a factor of I³ = -I, whose conjugate has a factor of I. Multiplying by the first purely imaginary number gives a total factor of I * I = -1 times a product of real numbers, which is purely real (its imaginary part is zero).
uses
Complex.star_def,star_mul,Complex.mul_im,Complex.mul_re,Complex.conj_re,Complex.conj_imsimp only [Complex.star_def, star_mul, Complex.mul_im, Complex.mul_re, Complex.conj_re, Complex.conj_im, hw, hx, hy, hz] ring
Any three unit phases a, b, c can be lifted to single-qubit rotations u, v, w.
By unit_complex_three_phase_surjective, we can choose unit complex numbers u, v, w satisfying u * v * star w = a, u * star v * w = b, and star u * v * w = c. Their product satisfies u * v * w = a * b * c because the conjugates cancel pairwise. Therefore, the four harmonics transformed by u, v, w coincide with those transformed by a, b, c and are all purely imaginary.
uses
unit_complex_three_phase_surjective,Complex.inv_eq_conj,norm_ne_zero_iff.mpobtain ⟨u,v,w,hu,hv,hw,huv,huw,hvw⟩ := unit_complex_three_phase_surjective a b c ha hb hc have hsu : star u = u⁻¹ := (Complex.inv_eq_conj hu).symm have hsv : star v = v⁻¹ := (Complex.inv_eq_conj hv).symm have hsw : star w = w⁻¹ := (Complex.inv_eq_conj hw).symm have hu0 : u ≠ 0 := norm_ne_zero_iff.mp (by rw [hu]; norm_num) have hv0 : v ≠ 0 := norm_ne_zero_iff.mp (by rw [hv]; norm_num) have hw0 : w ≠ 0 := norm_ne_zero_iff.mp (by rw [hw]; norm_num) have habc : a*b*c = u*v*w := by rw [← huv, ← huw, ← hvw, hsu, hsv, hsw] field_simp <;> ring refine ⟨u,v,w,hu,hv,hw, ?_, ?_, ?_, ?_⟩ · rwa [habc] at h0 · rwa [huv] · rwa [huw] · rwa [hvw]
If z₁ = 0, there exist unit phases a, b, c making all four transformed harmonics purely imaginary.
We align z₀, z₂, z₃ to the imaginary axis by choosing unit phases d, b, c via in935_align. Setting a = d * star b * star c gives a unit phase such that a * b * c = d, making the transformed z₀ purely imaginary. Since z₁ = 0, a * z₁ = 0 is also purely imaginary.
uses
in935_align,norm_mul,Complex.inv_eq_conj,norm_ne_zero_iff.mpobtain ⟨d,hd,hdz⟩ := in935_align z0 obtain ⟨b,hb,hbz⟩ := in935_align z2 obtain ⟨c,hc,hcz⟩ := in935_align z3 let a := d * star b * star c have ha : ‖a‖ = 1 := by simp [a, norm_mul, hd, hb, hc] have hsb : star b = b⁻¹ := (Complex.inv_eq_conj hb).symm have hsc : star c = c⁻¹ := (Complex.inv_eq_conj hc).symm have hb0 : b ≠ 0 := norm_ne_zero_iff.mp (by rw [hb]; norm_num) have hc0 : c ≠ 0 := norm_ne_zero_iff.mp (by rw [hc]; norm_num) have habc : a*b*c = d := by dsimp [a] change d * star b * star c * b * c = d rw [hsb, hsc] field_simp refine ⟨a,b,c,ha,hb,hc, ?_, ?_, hbz, hcz⟩ · rwa [habc] · simp [hz]
If z₁, z₂, z₃ ≠ 0 and z₀ * (z₁ * z₂ * z₃)* is real, there exist unit phases a, b, c making all four transformed harmonics purely imaginary.
We define unit phases a = I * star z₁ / ‖z₁‖, b = I * star z₂ / ‖z₂‖, and c = I * star z₃ / ‖z₃‖, which align z₁, z₂, z₃ to the imaginary axis. Their product with z₀ evaluates to -(I * (z₀ * star (z₁ * z₂ * z₃))) divided by the positive real product ‖z₁‖ * ‖z₂‖ * ‖z₃‖. Taking the real part extracts the imaginary part of the invariant product, which is 0 by hypothesis.
uses
norm_ne_zero_iff.mpr,Complex.star_def,Complex.normSq_eq_conj_mul_self,Complex.normSq_eq_norm_sq,star_mul,ofReal_mul,Complex.I_sq,Complex.div_ofReal_re,neg_re,Complex.I_mul_re,neg_zero,zero_divlet a : ℂ := I * star z1 / (‖z1‖ : ℂ) let b : ℂ := I * star z2 / (‖z2‖ : ℂ) let c : ℂ := I * star z3 / (‖z3‖ : ℂ) have ha : ‖a‖ = 1 := by simp [a, norm_ne_zero_iff.mpr h1] have hb : ‖b‖ = 1 := by simp [b, norm_ne_zero_iff.mpr h2] have hc : ‖c‖ = 1 := by simp [c, norm_ne_zero_iff.mpr h3] have align : ∀ (z : ℂ) (_ : z ≠ 0), (I * star z / (‖z‖ : ℂ) * z).re = 0 := by intro z hz have hn : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast (norm_ne_zero_iff.mpr hz) have he : I * star z / (‖z‖ : ℂ) * z = I * (‖z‖ : ℂ) := by field_simp rw [Complex.star_def, ← Complex.normSq_eq_conj_mul_self, Complex.normSq_eq_norm_sq] push_cast ring rw [he] simp refine ⟨a,b,c,ha,hb,hc, ?_, align z1 h1, align z2 h2, align z3 h3⟩ have he : a*b*c*z0 = -(I * (z0 * star (z1*z2*z3))) / ((‖z1‖ * ‖z2‖ * ‖z3‖ : ℝ) : ℂ) := by dsimp [a,b,c] simp only [star_mul, ofReal_mul] field_simp <;> ring_nf <;> simp [Complex.I_sq] <;> ring rw [he] rw [Complex.div_ofReal_re] simp only [neg_re, Complex.I_mul_re, h, neg_zero, zero_div]
If local single-qubit rotations make all four harmonics purely imaginary, then the invariant product z₀ * (z₁ * z₂ * z₃)* is real.
Given unit rotations u, v, w, define effective phases a = u * v * star w, b = u * star v * w, and c = star u * v * w. They satisfy ‖a‖ = ‖b‖ = ‖c‖ = 1 and a * b * c = u * v * w. By gauge invariance (in935_invariant), the product z₀ * (z₁ * z₂ * z₃)* equals the product of the four transformed harmonics. Since all four are purely imaginary, in935_pure_im_product shows that the product is real.
uses
Complex.inv_eq_conj,norm_ne_zero_iff.mp,in935_invariant,in935_pure_im_productconstructor · rintro ⟨u,v,w,hu,hv,hw,h0,h1,h2,h3⟩ let a : ℂ := u*v*star w let b : ℂ := u*star v*w let c : ℂ := star u*v*w have ha : ‖a‖ = 1 := by simp [a, hu, hv, hw] have hb : ‖b‖ = 1 := by simp [b, hu, hv, hw] have hc : ‖c‖ = 1 := by simp [c, hu, hv, hw] have hsu : star u = u⁻¹ := (Complex.inv_eq_conj hu).symm have hsv : star v = v⁻¹ := (Complex.inv_eq_conj hv).symm have hsw : star w = w⁻¹ := (Complex.inv_eq_conj hw).symm have hu0 : u ≠ 0 := norm_ne_zero_iff.mp (by rw [hu]; norm_num) have hv0 : v ≠ 0 := norm_ne_zero_iff.mp (by rw [hv]; norm_num) have hw0 : w ≠ 0 := norm_ne_zero_iff.mp (by rw [hw]; norm_num) have habc : a*b*c = u*v*w := by dsimp [a,b,c] change (u*v*star w)*(u*star v*w)*(star u*v*w) = u*v*w rw [hsu, hsv, hsw] field_simp rw [in935_invariant a b c z0 z1 z2 z3 ha hb hc] apply in935_pure_im_product · simpa [habc] using h0 · exact h1 · exact h2 · exact h3
If the invariant product z₀ * (z₁ * z₂ * z₃)* is real, then local rotations u, v, w exist that make all four harmonics purely imaginary.
If any of z₁, z₂, z₃ vanishes, in935_zero_first (up to permutation of indices) provides unit phases a, b, c, which lift to local rotations u, v, w via in935_lift. If all three are non-zero, in935_nonzero_first_three provides the aligning phases a, b, c using the assumption that the invariant product is real, and in935_lift lifts them to u, v, w.
uses
in935_zero_first,in935_lift,mul_comm,mul_left_comm,mul_assoc,in935_nonzero_first_three· intro h by_cases h1 : z1 = 0 · obtain ⟨a,b,c,ha,hb,hc,h0,h1,h2,h3⟩ := in935_zero_first z0 z1 z2 z3 h1 exact in935_lift a b c z0 z1 z2 z3 ha hb hc h0 h1 h2 h3 by_cases h2 : z2 = 0 · obtain ⟨a,b,c,ha,hb,hc,h0,h2,h1,h3⟩ := in935_zero_first z0 z2 z1 z3 h2 apply in935_lift b a c z0 z1 z2 z3 hb ha hc · simpa [mul_comm, mul_left_comm, mul_assoc] using h0 · exact h1 · exact h2 · exact h3 by_cases h3 : z3 = 0 · obtain ⟨a,b,c,ha,hb,hc,h0,h3,h2,h1⟩ := in935_zero_first z0 z3 z2 z1 h3 apply in935_lift c b a z0 z1 z2 z3 hc hb ha · simpa [mul_comm, mul_left_comm, mul_assoc] using h0 · exact h1 · exact h2 · exact h3 obtain ⟨a,b,c,ha,hb,hc,h0,h1,h2,h3⟩ := in935_nonzero_first_three z0 z1 z2 z3 h h1 h2 h3 exact in935_lift a b c z0 z1 z2 z3 ha hb hc h0 h1 h2 h3
Complex.normSq_eq_norm_sq- The complex squared norm function equals the square of the usual norm.
Complex.normSq_eq_conj_mul_self- The squared norm of a complex number equals its complex conjugate times itself.
Complex.star_def- Complex conjugation coincides with the star involution on the complex numbers.
Complex.inv_eq_conj- For a unit complex number, its multiplicative inverse equals its complex conjugate.
Complex.mul_re- The real part of a product of complex numbers in terms of their components.
Complex.mul_im- The imaginary part of a product of complex numbers in terms of their components.
Complex.conj_re- Complex conjugation preserves the real part.
Complex.conj_im- Complex conjugation negates the imaginary part.
Complex.I_sq- The square of the imaginary unit I equals -1.
Complex.div_ofReal_re- Dividing a complex number by a real number divides its real part by that real number.
Complex.I_mul_re- The real part of I multiplied by z equals the negative of the imaginary part of z.
unit_complex_three_phase_surjective- Any triple of unit complex numbers can be factored as u*v*w*, u*v**w, u**v*w for unit complex numbers u, v, w.
norm_div- The norm of a quotient is the quotient of the norms.
norm_mul- The norm of a product is the product of the norms.
norm_ne_zero_iff.mpr- A non-zero element has non-zero norm.
norm_ne_zero_iff.mp- An element with non-zero norm is non-zero.
star_mul- The star involution distributes over multiplication in reversed order.
ofReal_mul- Coercion from the real numbers to the complex numbers distributes over multiplication.
neg_re- The real part of the negation of a complex number is the negation of its real part.
neg_zero- The negation of zero is zero.
zero_div- Zero divided by any element is zero.
mul_comm- Multiplication is commutative.
mul_left_comm- The first two factors in a three-factor product can be swapped.
mul_assoc- Multiplication is associative.
in935_align- Any complex number can be multiplied by a unit complex number to become purely imaginary.
in935_invariant- The product z₀ * (z₁ * z₂ * z₃)* is invariant under simultaneous phase rotations by unit numbers a, b, c.
in935_pure_im_product- If four complex numbers are purely imaginary, the product of the first with the conjugate of the triple product of the others is real.
in935_lift- Aligning unit phases a, b, c lift to single-qubit rotations u, v, w.
in935_zero_first- If the second harmonic is zero, there exist unit phases making all four harmonics purely imaginary.
in935_nonzero_first_three- If the gauge-invariant product is real and the last three harmonics are non-zero, there exist unit aligning phases.
- Several algebraic identities involving products, inverses, and conjugates of complex numbers are closed by automation (`ring` and `field_simp`).
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.
open Complexlemma in935_align (z : ℂ) : ∃ a : ℂ, ‖a‖ = 1 ∧ (a*z).re = 0 := by by_cases hz : z = 0 · exact ⟨1, by simp, by simp [hz]⟩ · refine ⟨Complex.I * star z / (‖z‖ : ℂ), ?_, ?_⟩ · simp [norm_div, norm_mul, norm_ne_zero_iff.mpr hz] · have hn : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast (norm_ne_zero_iff.mpr hz) have he : Complex.I * star z / (‖z‖ : ℂ) * z = Complex.I * (‖z‖ : ℂ) := by field_simp rw [Complex.star_def] rw [← Complex.normSq_eq_conj_mul_self, Complex.normSq_eq_norm_sq] push_cast ring rw [he] simplemma in935_product_unit (a b c : ℂ) (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hc : ‖c‖ = 1) : ‖a*b*c‖ = 1 := by simp [norm_mul, ha, hb, hc]lemma in935_invariant (a b c z0 z1 z2 z3 : ℂ) (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hc : ‖c‖ = 1) : z0 * star (z1*z2*z3) = (a*b*c*z0) * star ((a*z1)*(b*z2)*(c*z3)) := by have hsa : star a = a⁻¹ := (Complex.inv_eq_conj ha).symm have hsb : star b = b⁻¹ := (Complex.inv_eq_conj hb).symm have hsc : star c = c⁻¹ := (Complex.inv_eq_conj hc).symm have ha0 : a ≠ 0 := norm_ne_zero_iff.mp (by rw [ha]; norm_num) have hb0 : b ≠ 0 := norm_ne_zero_iff.mp (by rw [hb]; norm_num) have hc0 : c ≠ 0 := norm_ne_zero_iff.mp (by rw [hc]; norm_num) simp only [star_mul, hsa, hsb, hsc] field_simp <;> ringlemma in935_pure_im_product (w x y z : ℂ) (hw : w.re = 0) (hx : x.re = 0) (hy : y.re = 0) (hz : z.re = 0) : (w * star (x*y*z)).im = 0 := by simp only [Complex.star_def, star_mul, Complex.mul_im, Complex.mul_re, Complex.conj_re, Complex.conj_im, hw, hx, hy, hz] ringlemma in935_lift (a b c z0 z1 z2 z3 : ℂ) (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hc : ‖c‖ = 1) (h0 : (a*b*c*z0).re = 0) (h1 : (a*z1).re = 0) (h2 : (b*z2).re = 0) (h3 : (c*z3).re = 0) : ∃ u v w : ℂ, ‖u‖ = 1 ∧ ‖v‖ = 1 ∧ ‖w‖ = 1 ∧ (u*v*w*z0).re = 0 ∧ (u*v*star w*z1).re = 0 ∧ (u*star v*w*z2).re = 0 ∧ (star u*v*w*z3).re = 0 := by obtain ⟨u,v,w,hu,hv,hw,huv,huw,hvw⟩ := unit_complex_three_phase_surjective a b c ha hb hc have hsu : star u = u⁻¹ := (Complex.inv_eq_conj hu).symm have hsv : star v = v⁻¹ := (Complex.inv_eq_conj hv).symm have hsw : star w = w⁻¹ := (Complex.inv_eq_conj hw).symm have hu0 : u ≠ 0 := norm_ne_zero_iff.mp (by rw [hu]; norm_num) have hv0 : v ≠ 0 := norm_ne_zero_iff.mp (by rw [hv]; norm_num) have hw0 : w ≠ 0 := norm_ne_zero_iff.mp (by rw [hw]; norm_num) have habc : a*b*c = u*v*w := by rw [← huv, ← huw, ← hvw, hsu, hsv, hsw] field_simp <;> ring refine ⟨u,v,w,hu,hv,hw, ?_, ?_, ?_, ?_⟩ · rwa [habc] at h0 · rwa [huv] · rwa [huw] · rwa [hvw]lemma in935_zero_first (z0 z1 z2 z3 : ℂ) (hz : z1 = 0) : ∃ a b c : ℂ, ‖a‖ = 1 ∧ ‖b‖ = 1 ∧ ‖c‖ = 1 ∧ (a*b*c*z0).re = 0 ∧ (a*z1).re = 0 ∧ (b*z2).re = 0 ∧ (c*z3).re = 0 := by obtain ⟨d,hd,hdz⟩ := in935_align z0 obtain ⟨b,hb,hbz⟩ := in935_align z2 obtain ⟨c,hc,hcz⟩ := in935_align z3 let a := d * star b * star c have ha : ‖a‖ = 1 := by simp [a, norm_mul, hd, hb, hc] have hsb : star b = b⁻¹ := (Complex.inv_eq_conj hb).symm have hsc : star c = c⁻¹ := (Complex.inv_eq_conj hc).symm have hb0 : b ≠ 0 := norm_ne_zero_iff.mp (by rw [hb]; norm_num) have hc0 : c ≠ 0 := norm_ne_zero_iff.mp (by rw [hc]; norm_num) have habc : a*b*c = d := by dsimp [a] change d * star b * star c * b * c = d rw [hsb, hsc] field_simp refine ⟨a,b,c,ha,hb,hc, ?_, ?_, hbz, hcz⟩ · rwa [habc] · simp [hz]lemma in935_nonzero_first_three (z0 z1 z2 z3 : ℂ) (h : (z0 * star (z1*z2*z3)).im = 0) (h1 : z1 ≠ 0) (h2 : z2 ≠ 0) (h3 : z3 ≠ 0) : ∃ a b c : ℂ, ‖a‖ = 1 ∧ ‖b‖ = 1 ∧ ‖c‖ = 1 ∧ (a*b*c*z0).re = 0 ∧ (a*z1).re = 0 ∧ (b*z2).re = 0 ∧ (c*z3).re = 0 := by let a : ℂ := I * star z1 / (‖z1‖ : ℂ) let b : ℂ := I * star z2 / (‖z2‖ : ℂ) let c : ℂ := I * star z3 / (‖z3‖ : ℂ) have ha : ‖a‖ = 1 := by simp [a, norm_ne_zero_iff.mpr h1] have hb : ‖b‖ = 1 := by simp [b, norm_ne_zero_iff.mpr h2] have hc : ‖c‖ = 1 := by simp [c, norm_ne_zero_iff.mpr h3] have align : ∀ (z : ℂ) (_ : z ≠ 0), (I * star z / (‖z‖ : ℂ) * z).re = 0 := by intro z hz have hn : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast (norm_ne_zero_iff.mpr hz) have he : I * star z / (‖z‖ : ℂ) * z = I * (‖z‖ : ℂ) := by field_simp rw [Complex.star_def, ← Complex.normSq_eq_conj_mul_self, Complex.normSq_eq_norm_sq] push_cast ring rw [he] simp refine ⟨a,b,c,ha,hb,hc, ?_, align z1 h1, align z2 h2, align z3 h3⟩ have he : a*b*c*z0 = -(I * (z0 * star (z1*z2*z3))) / ((‖z1‖ * ‖z2‖ * ‖z3‖ : ℝ) : ℂ) := by dsimp [a,b,c] simp only [star_mul, ofReal_mul] field_simp <;> ring_nf <;> simp [Complex.I_sq] <;> ring rw [he] rw [Complex.div_ofReal_re] simp only [neg_re, Complex.I_mul_re, h, neg_zero, zero_div]theorem three_qubit_ghz_phase_compatibility (z0 z1 z2 z3 : ℂ) : (∃ u v w : ℂ, ‖u‖ = 1 ∧ ‖v‖ = 1 ∧ ‖w‖ = 1 ∧ (u*v*w*z0).re = 0 ∧ (u*v*star w*z1).re = 0 ∧ (u*star v*w*z2).re = 0 ∧ (star u*v*w*z3).re = 0) ↔ (z0 * star (z1*z2*z3)).im = 0 := by constructor · rintro ⟨u,v,w,hu,hv,hw,h0,h1,h2,h3⟩ let a : ℂ := u*v*star w let b : ℂ := u*star v*w let c : ℂ := star u*v*w have ha : ‖a‖ = 1 := by simp [a, hu, hv, hw] have hb : ‖b‖ = 1 := by simp [b, hu, hv, hw] have hc : ‖c‖ = 1 := by simp [c, hu, hv, hw] have hsu : star u = u⁻¹ := (Complex.inv_eq_conj hu).symm have hsv : star v = v⁻¹ := (Complex.inv_eq_conj hv).symm have hsw : star w = w⁻¹ := (Complex.inv_eq_conj hw).symm have hu0 : u ≠ 0 := norm_ne_zero_iff.mp (by rw [hu]; norm_num) have hv0 : v ≠ 0 := norm_ne_zero_iff.mp (by rw [hv]; norm_num) have hw0 : w ≠ 0 := norm_ne_zero_iff.mp (by rw [hw]; norm_num) have habc : a*b*c = u*v*w := by dsimp [a,b,c] change (u*v*star w)*(u*star v*w)*(star u*v*w) = u*v*w rw [hsu, hsv, hsw] field_simp rw [in935_invariant a b c z0 z1 z2 z3 ha hb hc] apply in935_pure_im_product · simpa [habc] using h0 · exact h1 · exact h2 · exact h3 · intro h by_cases h1 : z1 = 0 · obtain ⟨a,b,c,ha,hb,hc,h0,h1,h2,h3⟩ := in935_zero_first z0 z1 z2 z3 h1 exact in935_lift a b c z0 z1 z2 z3 ha hb hc h0 h1 h2 h3 by_cases h2 : z2 = 0 · obtain ⟨a,b,c,ha,hb,hc,h0,h2,h1,h3⟩ := in935_zero_first z0 z2 z1 z3 h2 apply in935_lift b a c z0 z1 z2 z3 hb ha hc · simpa [mul_comm, mul_left_comm, mul_assoc] using h0 · exact h1 · exact h2 · exact h3 by_cases h3 : z3 = 0 · obtain ⟨a,b,c,ha,hb,hc,h0,h3,h2,h1⟩ := in935_zero_first z0 z3 z2 z1 h3 apply in935_lift c b a z0 z1 z2 z3 hc hb ha · simpa [mul_comm, mul_left_comm, mul_assoc] using h0 · exact h1 · exact h2 · exact h3 obtain ⟨a,b,c,ha,hb,hc,h0,h1,h2,h3⟩ := in935_nonzero_first_three z0 z1 z2 z3 h h1 h2 h3 exact in935_lift a b c z0 z1 z2 z3 ha hb hc h0 h1 h2 h3