l3lab/ntp-mathlib huggingface dataset:
/-- There is a natural equivalence when swapping the coefficients of a quaternion algebra. -/
@[simps]
def swapEquiv : ℍ[R,c₁,c₂] ≃ₐ[R] ℍ[R, c₂, c₁] where
  toFun t := ⟨t.1, t.3, t.2, -t.4⟩
  invFun t := ⟨t.1, t.3, t.2, -t.4⟩
  left_inv _ := by simp
  right_inv _ := by simp
  map_mul' _ _ := by
    ext
      <;> simp only [mul_re, mul_imJ, mul_imI, add_left_inj, mul_imK, neg_mul, neg_add_rev,
                     neg_sub, mk_mul_mk, mul_neg, neg_neg, sub_neg_eq_add]
      <;> ring
  map_add' _ _ := by ext <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c x✝¹ x✝ : ℍ[R,c₁,c₂]
⊢ (Equiv.toFun
        { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
          invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
          left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
          right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
        (x✝¹ + x✝)).imJ =
    (Equiv.toFun
          { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
            right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
          x✝¹ +
        Equiv.toFun
          { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
            right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
          x✝).imJ

Next tactic:
simp [add_comm]
/-- There is a natural equivalence when swapping the coefficients of a quaternion algebra. -/
@[simps]
def swapEquiv : ℍ[R,c₁,c₂] ≃ₐ[R] ℍ[R, c₂, c₁] where
  toFun t := ⟨t.1, t.3, t.2, -t.4⟩
  invFun t := ⟨t.1, t.3, t.2, -t.4⟩
  left_inv _ := by simp
  right_inv _ := by simp
  map_mul' _ _ := by
    ext
      <;> simp only [mul_re, mul_imJ, mul_imI, add_left_inj, mul_imK, neg_mul, neg_add_rev,
                     neg_sub, mk_mul_mk, mul_neg, neg_neg, sub_neg_eq_add]
      <;> ring
  map_add' _ _ := by ext <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c x✝¹ x✝ : ℍ[R,c₁,c₂]
⊢ (Equiv.toFun
        { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
          invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
          left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
          right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
        (x✝¹ + x✝)).imK =
    (Equiv.toFun
          { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
            right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
          x✝¹ +
        Equiv.toFun
          { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
            left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
            right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
          x✝).imK

Next tactic:
simp [add_comm]
/-- There is a natural equivalence when swapping the coefficients of a quaternion algebra. -/
@[simps]
def swapEquiv : ℍ[R,c₁,c₂] ≃ₐ[R] ℍ[R, c₂, c₁] where
  toFun t := ⟨t.1, t.3, t.2, -t.4⟩
  invFun t := ⟨t.1, t.3, t.2, -t.4⟩
  left_inv _ := by simp
  right_inv _ := by simp
  map_mul' _ _ := by
    ext
      <;> simp only [mul_re, mul_imJ, mul_imI, add_left_inj, mul_imK, neg_mul, neg_add_rev,
                     neg_sub, mk_mul_mk, mul_neg, neg_neg, sub_neg_eq_add]
      <;> ring
  map_add' _ _ := by ext <;> simp [add_comm]
  commutes' _ := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
x✝ : R
⊢ Equiv.toFun
      { toFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
        invFun := fun t => { re := t.re, imI := t.imJ, imJ := t.imI, imK := -t.imK },
        left_inv := (_ : ∀ (x : ℍ[R,c₁,c₂]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x),
        right_inv := (_ : ∀ (x : ℍ[R,c₂,c₁]), { re := x.re, imI := x.imI, imJ := x.imJ, imK := - -x.imK } = x) }
      ((algebraMap R ℍ[R,c₁,c₂]) x✝) =
    (algebraMap R ℍ[R,c₂,c₁]) x✝

Next tactic:
simp [algebraMap_eq]
theorem mul_coe_eq_smul : a * r = r • a := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a * ↑r = r • a

Next tactic:
rw [← coe_commutes, coe_mul_eq_smul]
theorem smul_coe : x • (y : ℍ[R,c₁,c₂]) = ↑(x * y) := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ x • ↑y = ↑(x * y)

Next tactic:
rw [coe_mul, coe_mul_eq_smul]
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x✝ y z : R
a b c x : ℍ[R,c₁,c₂]
⊢ star (star x) = x

Next tactic:
simp [Star.star]
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ star (a * b) = star b * star a

Next tactic:
ext
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> 

Proof state:
case re
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a * b)).re = (star b * star a).re

Next tactic:
simp
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a * b)).imI = (star b * star a).imI

Next tactic:
simp
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a * b)).imJ = (star b * star a).imJ

Next tactic:
simp
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a * b)).imK = (star b * star a).imK

Next tactic:
simp
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> simp <;> 

Proof state:
case re
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ a.re * b.re + c₁ * a.imI * b.imI + c₂ * a.imJ * b.imJ - c₁ * c₂ * a.imK * b.imK =
    b.re * a.re + c₁ * b.imI * a.imI + c₂ * b.imJ * a.imJ - c₁ * c₂ * b.imK * a.imK

Next tactic:
ring
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> simp <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ -(c₂ * a.imK * b.imJ) + (c₂ * a.imJ * b.imK - (a.re * b.imI + a.imI * b.re)) =
    -(b.re * a.imI) + -(b.imI * a.re) - c₂ * b.imJ * a.imK + c₂ * b.imK * a.imJ

Next tactic:
ring
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> simp <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ c₁ * a.imK * b.imI - (a.re * b.imJ + c₁ * a.imI * b.imK + a.imJ * b.re) =
    -(b.re * a.imJ) + c₁ * b.imI * a.imK + -(b.imJ * a.re) - c₁ * b.imK * a.imI

Next tactic:
ring
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> simp [add_comm]
  star_mul a b := by ext <;> simp <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ -(a.imK * b.re) + (a.imJ * b.imI - (a.re * b.imK + a.imI * b.imJ)) =
    -(b.re * a.imK) + b.imI * a.imJ - b.imJ * a.imI + -(b.imK * a.re)

Next tactic:
ring
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ star (a + b) = star a + star b

Next tactic:
ext
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> 

Proof state:
case re
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a + b)).re = (star a + star b).re

Next tactic:
simp [add_comm]
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a + b)).imI = (star a + star b).imI

Next tactic:
simp [add_comm]
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a + b)).imJ = (star a + star b).imJ

Next tactic:
simp [add_comm]
instance instStarRing : StarRing ℍ[R,c₁,c₂] where
  star_involutive x := by simp [Star.star]
  star_add a b := by ext <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a✝ b✝ c a b : ℍ[R,c₁,c₂]
⊢ (star (a + b)).imK = (star a + star b).imK

Next tactic:
simp [add_comm]
theorem self_add_star' : a + star a = ↑(2 * a.re) := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a + star a = ↑(2 * a.re)

Next tactic:
ext
theorem self_add_star' : a + star a = ↑(2 * a.re) := by ext <;> 

Proof state:
case re
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (a + star a).re = (↑(2 * a.re)).re

Next tactic:
simp [two_mul]
theorem self_add_star' : a + star a = ↑(2 * a.re) := by ext <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (a + star a).imI = (↑(2 * a.re)).imI

Next tactic:
simp [two_mul]
theorem self_add_star' : a + star a = ↑(2 * a.re) := by ext <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (a + star a).imJ = (↑(2 * a.re)).imJ

Next tactic:
simp [two_mul]
theorem self_add_star' : a + star a = ↑(2 * a.re) := by ext <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (a + star a).imK = (↑(2 * a.re)).imK

Next tactic:
simp [two_mul]
theorem self_add_star : a + star a = 2 * a.re := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a + star a = 2 * ↑a.re

Next tactic:
simp only [self_add_star', two_mul, coe_add]
theorem star_add_self' : star a + a = ↑(2 * a.re) := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ star a + a = ↑(2 * a.re)

Next tactic:
rw [add_comm, self_add_star']
theorem star_add_self : star a + a = 2 * a.re := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ star a + a = 2 * ↑a.re

Next tactic:
rw [add_comm, self_add_star]
instance : IsStarNormal a :=
  ⟨by
    

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ Commute (star a) a

Next tactic:
rw [a.star_eq_two_re_sub]
instance : IsStarNormal a :=
  ⟨by
    rw [a.star_eq_two_re_sub]
    

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ Commute (↑(2 * a.re) - a) a

Next tactic:
exact (coe_commute (2 * a.re) a).sub_left (Commute.refl a)
@[simp, norm_cast]
theorem star_coe : star (x : ℍ[R,c₁,c₂]) = x := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ star ↑x = ↑x

Next tactic:
ext
@[simp, norm_cast]
theorem star_coe : star (x : ℍ[R,c₁,c₂]) = x := by ext <;> 

Proof state:
case re
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star ↑x).re = (↑x).re

Next tactic:
simp
@[simp, norm_cast]
theorem star_coe : star (x : ℍ[R,c₁,c₂]) = x := by ext <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star ↑x).imI = (↑x).imI

Next tactic:
simp
@[simp, norm_cast]
theorem star_coe : star (x : ℍ[R,c₁,c₂]) = x := by ext <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star ↑x).imJ = (↑x).imJ

Next tactic:
simp
@[simp, norm_cast]
theorem star_coe : star (x : ℍ[R,c₁,c₂]) = x := by ext <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star ↑x).imK = (↑x).imK

Next tactic:
simp
theorem eq_re_of_eq_coe {a : ℍ[R,c₁,c₂]} {x : R} (h : a = x) : a = a.re := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x✝ y z : R
a✝ b c a : ℍ[R,c₁,c₂]
x : R
h : a = ↑x
⊢ a = ↑a.re

Next tactic:
rw [h, coe_re]
@[simp]
theorem star_eq_self {c₁ c₂ : R} {a : ℍ[R,c₁,c₂]} : star a = a ↔ a = a.re := by
  

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝² : CommRing R
c₁✝ c₂✝ r x y z : R
a✝ b c : ℍ[R,c₁✝,c₂✝]
inst✝¹ : NoZeroDivisors R
inst✝ : CharZero R
c₁ c₂ : R
a : ℍ[R,c₁,c₂]
⊢ star a = a ↔ a = ↑a.re

Next tactic:
simp [QuaternionAlgebra.ext_iff, neg_eq_iff_add_eq_zero, add_self_eq_zero]
theorem star_eq_neg {c₁ c₂ : R} {a : ℍ[R,c₁,c₂]} : star a = -a ↔ a.re = 0 := by
  

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝² : CommRing R
c₁✝ c₂✝ r x y z : R
a✝ b c : ℍ[R,c₁✝,c₂✝]
inst✝¹ : NoZeroDivisors R
inst✝ : CharZero R
c₁ c₂ : R
a : ℍ[R,c₁,c₂]
⊢ star a = -a ↔ a.re = 0

Next tactic:
simp [QuaternionAlgebra.ext_iff, eq_neg_iff_add_eq_zero]
theorem star_mul_eq_coe : star a * a = (star a * a).re := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ star a * a = ↑(star a * a).re

Next tactic:
ext
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> 

Proof state:
case re
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star a * a).re = (↑(star a * a).re).re

Next tactic:
simp
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star a * a).imI = (↑(star a * a).re).imI

Next tactic:
simp
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star a * a).imJ = (↑(star a * a).re).imJ

Next tactic:
simp
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ (star a * a).imK = (↑(star a * a).re).imK

Next tactic:
simp
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> simp <;> 

Proof state:
case imI
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a.re * a.imI + -(a.imI * a.re) + c₂ * a.imJ * a.imK + -(c₂ * a.imK * a.imJ) = 0

Next tactic:
ring
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> simp <;> 

Proof state:
case imJ
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a.re * a.imJ + -(c₁ * a.imI * a.imK) + -(a.imJ * a.re) + c₁ * a.imK * a.imI = 0

Next tactic:
ring
theorem star_mul_eq_coe : star a * a = (star a * a).re := by ext <;> simp <;> 

Proof state:
case imK
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a.re * a.imK + -(a.imI * a.imJ) + a.imJ * a.imI + -(a.imK * a.re) = 0

Next tactic:
ring
theorem mul_star_eq_coe : a * star a = (a * star a).re := by
  

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ a * star a = ↑(a * star a).re

Next tactic:
rw [← star_comm_self']
theorem mul_star_eq_coe : a * star a = (a * star a).re := by
  rw [← star_comm_self']
  

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x y z : R
a b c : ℍ[R,c₁,c₂]
⊢ star a * a = ↑(star a * a).re

Next tactic:
exact a.star_mul_eq_coe
/-- Quaternion conjugate as an `AlgEquiv` to the opposite ring. -/
def starAe : ℍ[R,c₁,c₂] ≃ₐ[R] ℍ[R,c₁,c₂]ᵐᵒᵖ :=
  { starAddEquiv.trans opAddEquiv with
    toFun := op ∘ star
    invFun := star ∘ unop
    map_mul' := fun x y => by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r x✝ y✝ z : R
a b c : ℍ[R,c₁,c₂]
src✝ : ℍ[R,c₁,c₂] ≃+ ℍ[R,c₁,c₂]ᵐᵒᵖ := AddEquiv.trans starAddEquiv opAddEquiv
x y : ℍ[R,c₁,c₂]
⊢ Equiv.toFun
      { toFun := op ∘ star, invFun := star ∘ unop, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
        right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
      (x * y) =
    Equiv.toFun
        { toFun := op ∘ star, invFun := star ∘ unop, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
          right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
        x *
      Equiv.toFun
        { toFun := op ∘ star, invFun := star ∘ unop, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
          right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
        y

Next tactic:
simp
/-- Quaternion conjugate as an `AlgEquiv` to the opposite ring. -/
def starAe : ℍ[R,c₁,c₂] ≃ₐ[R] ℍ[R,c₁,c₂]ᵐᵒᵖ :=
  { starAddEquiv.trans opAddEquiv with
    toFun := op ∘ star
    invFun := star ∘ unop
    map_mul' := fun x y => by simp
    commutes' := fun r => by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
c₁ c₂ r✝ x y z : R
a b c : ℍ[R,c₁,c₂]
src✝ : ℍ[R,c₁,c₂] ≃+ ℍ[R,c₁,c₂]ᵐᵒᵖ := AddEquiv.trans starAddEquiv opAddEquiv
r : R
⊢ Equiv.toFun
      { toFun := op ∘ star, invFun := star ∘ unop, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
        right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
      ((algebraMap R ℍ[R,c₁,c₂]) r) =
    (algebraMap R ℍ[R,c₁,c₂]ᵐᵒᵖ) r

Next tactic:
simp
@[simp]
theorem mul_re : (a * b).re = a.re * b.re - a.imI * b.imI - a.imJ * b.imJ - a.imK * b.imK :=
  (QuaternionAlgebra.mul_re a b).trans <| by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x y z : R
a b c : ℍ[R]
⊢ a.re * b.re + -1 * a.imI * b.imI + -1 * a.imJ * b.imJ - -1 * -1 * a.imK * b.imK =
    a.re * b.re - a.imI * b.imI - a.imJ * b.imJ - a.imK * b.imK

Next tactic:
simp only [one_mul, neg_mul, sub_eq_add_neg, neg_neg]
@[simp]
theorem mul_imI : (a * b).imI = a.re * b.imI + a.imI * b.re + a.imJ * b.imK - a.imK * b.imJ :=
  (QuaternionAlgebra.mul_imI a b).trans <| by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x y z : R
a b c : ℍ[R]
⊢ a.re * b.imI + a.imI * b.re - -1 * a.imJ * b.imK + -1 * a.imK * b.imJ =
    a.re * b.imI + a.imI * b.re + a.imJ * b.imK - a.imK * b.imJ

Next tactic:
simp only [one_mul, neg_mul, sub_eq_add_neg, neg_neg]
@[simp]
theorem mul_imJ : (a * b).imJ = a.re * b.imJ - a.imI * b.imK + a.imJ * b.re + a.imK * b.imI :=
  (QuaternionAlgebra.mul_imJ a b).trans <| by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x y z : R
a b c : ℍ[R]
⊢ a.re * b.imJ + -1 * a.imI * b.imK + a.imJ * b.re - -1 * a.imK * b.imI =
    a.re * b.imJ - a.imI * b.imK + a.imJ * b.re + a.imK * b.imI

Next tactic:
simp only [one_mul, neg_mul, sub_eq_add_neg, neg_neg]
@[simp]
theorem mul_imK : (a * b).imK = a.re * b.imK + a.imI * b.imJ - a.imJ * b.imI + a.imK * b.re :=
  (QuaternionAlgebra.mul_imK a b).trans <| by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x y z : R
a b c : ℍ[R]
⊢ a.re * b.imK + a.imI * b.imJ - a.imJ * b.imI + a.imK * b.re =
    a.re * b.imK + a.imI * b.imJ - a.imJ * b.imI + a.imK * b.re

Next tactic:
simp only [one_mul, neg_mul, sub_eq_add_neg, neg_neg]
/-- Square of the norm. -/
def normSq : ℍ[R] →*₀ R where
  toFun a := (a * star a).re
  map_zero' := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x y z : R
a b c : ℍ[R]
⊢ (fun a => (a * star a).re) 0 = 0

Next tactic:
simp only [star_zero, zero_mul, zero_re]
/-- Square of the norm. -/
def normSq : ℍ[R] →*₀ R where
  toFun a := (a * star a).re
  map_zero' := by simp only [star_zero, zero_mul, zero_re]
  map_one' := by 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x y z : R
a b c : ℍ[R]
⊢ ZeroHom.toFun { toFun := fun a => (a * star a).re, map_zero' := (_ : (0 * star 0).re = 0) } 1 = 1

Next tactic:
simp only [star_one, one_mul, one_re]
/-- Square of the norm. -/
def normSq : ℍ[R] →*₀ R where
  toFun a := (a * star a).re
  map_zero' := by simp only [star_zero, zero_mul, zero_re]
  map_one' := by simp only [star_one, one_mul, one_re]
  map_mul' x y := coe_injective <| by
    

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x✝ y✝ z : R
a b c x y : ℍ[R]
⊢ ↑(ZeroHom.toFun { toFun := fun a => (a * star a).re, map_zero' := (_ : (0 * star 0).re = 0) } (x * y)) =
    ↑(ZeroHom.toFun { toFun := fun a => (a * star a).re, map_zero' := (_ : (0 * star 0).re = 0) } x *
        ZeroHom.toFun { toFun := fun a => (a * star a).re, map_zero' := (_ : (0 * star 0).re = 0) } y)

Next tactic:
conv_lhs => rw [← mul_star_eq_coe, star_mul, mul_assoc, ← mul_assoc y, y.mul_star_eq_coe,
      coe_commutes, ← mul_assoc, x.mul_star_eq_coe, ← coe_mul]
/-- Square of the norm. -/
def normSq : ℍ[R] →*₀ R where
  toFun a := (a * star a).re
  map_zero' := by simp only [star_zero, zero_mul, zero_re]
  map_one' := by simp only [star_one, one_mul, one_re]
  map_mul' x y := coe_injective <| by
    conv_lhs => 

Proof state:
S : Type u_1
T : Type u_2
R : Type u_3
inst✝ : CommRing R
r x✝ y✝ z : R
a b c x y : ℍ[R]
| ↑(ZeroHom.toFun { toFun := fun a => (a * star a).re, map_zero' := (_ : (0 * star 0).re = 0) } (x * y))

Next tactic:
rw [← mul_star_eq_coe, star_mul, mul_assoc, ← mul_assoc y, y.mul_star_eq_coe,
      coe_commutes, ← mul_assoc, x.mul_star_eq_coe, ← coe_mul]