Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions Mathlib/Algebra/Quaternion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ theorem mk_add_mk (a₁ a₂ a₃ a₄ b₁ b₂ b₃ b₄ : R) :
mk (a₁ + b₁) (a₂ + b₂) (a₃ + b₃) (a₄ + b₄) :=
rfl

/-- The additive equivalence between a quaternion algebra over `R` and `Fin 4 → R`. -/
def addEquivTuple (c₁ c₂ c₃ : R) : ℍ[R,c₁,c₂,c₃] ≃+ (Fin 4 → R) where
toEquiv := equivTuple ..
map_add' _ _ := by ext i; fin_cases i <;> rfl

@[simp]
lemma coe_addEquivTuple (c₁ c₂ c₃ : R) : ⇑(addEquivTuple c₁ c₂ c₃) = equivTuple c₁ c₂ c₃ := rfl

@[simp] lemma coe_symm_addEquivTuple (c₁ c₂ c₃ : R) :
⇑(addEquivTuple c₁ c₂ c₃).symm = (equivTuple c₁ c₂ c₃).symm := rfl

end Add

section AddZeroClass
Expand Down Expand Up @@ -486,10 +497,15 @@ lemma coe_ofNat {n : ℕ} [n.AtLeastTwo] :
((ofNat(n) : R) : ℍ[R,c₁,c₂,c₃]) = (ofNat(n) : ℍ[R,c₁,c₂,c₃]) :=
rfl

-- TODO: add weaker `MulAction`, `DistribMulAction`, and `Module` instances (and repeat them
-- for `ℍ[R]`)
instance [Monoid S] [MulAction S R] : MulAction S ℍ[R,c₁,c₂,c₃] := (equivTuple ..).mulAction _

instance [Semiring S] [DistribMulAction S R] : DistribMulAction S ℍ[R,c₁,c₂,c₃] :=
(equivTuple ..).distribMulAction _

instance [Semiring S] [Module S R] : Module S ℍ[R,c₁,c₂,c₃] := (equivTuple ..).module _

-- TODO: repeat weaker `MulAction`, `DistribMulAction`, and `Module` instances for `ℍ[R]`)
instance [CommSemiring S] [Algebra S R] : Algebra S ℍ[R,c₁,c₂,c₃] where
smul := (· • ·)
algebraMap :=
{ toFun s := coe (algebraMap S R s)
map_one' := by simp only [map_one, coe_one]
Expand Down Expand Up @@ -544,13 +560,7 @@ def imKₗ : ℍ[R,c₁,c₂,c₃] →ₗ[R] R where
map_smul' _ _ := rfl

/-- `QuaternionAlgebra.equivTuple` as a linear equivalence. -/
def linearEquivTuple : ℍ[R,c₁,c₂,c₃] ≃ₗ[R] Fin 4 → R :=
LinearEquiv.symm -- proofs are not `rfl` in the forward direction
{ (equivTuple c₁ c₂ c₃).symm with
toFun := (equivTuple c₁ c₂ c₃).symm
invFun := equivTuple c₁ c₂ c₃
map_add' := fun _ _ => rfl
map_smul' := fun _ _ => rfl }
def linearEquivTuple : ℍ[R,c₁,c₂,c₃] ≃ₗ[R] Fin 4 → R := (equivTuple ..).linearEquiv _

@[simp]
theorem coe_linearEquivTuple :
Expand Down