Skip to content

Commit 43b2b2b

Browse files
eric-wieserkim-em
authored andcommitted
feat(LinearAlgebra/CliffordAlgebra): support towers of algebras (#6074)
1 parent 254a39b commit 43b2b2b

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

Mathlib/LinearAlgebra/CliffordAlgebra/Basic.lean

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,33 @@ instance instInhabited : Inhabited (CliffordAlgebra Q) := RingQuot.instInhabited
7979
#align clifford_algebra.inhabited CliffordAlgebra.instInhabited
8080
instance instRing : Ring (CliffordAlgebra Q) := RingQuot.instRing _
8181
#align clifford_algebra.ring CliffordAlgebra.instRing
82-
instance instAlgebra: Algebra R (CliffordAlgebra Q) := RingQuot.instAlgebraRingQuotInstSemiring _
82+
83+
instance (priority := 900) instAlgebra' {R A M} [CommSemiring R] [AddCommGroup M] [CommRing A]
84+
[Algebra R A] [Module R M] [Module A M] (Q : QuadraticForm A M)
85+
[IsScalarTower R A M] :
86+
Algebra R (CliffordAlgebra Q) :=
87+
RingQuot.instAlgebraRingQuotInstSemiring _
88+
89+
-- verify there are no diamonds
90+
example : (algebraNat : Algebra ℕ (CliffordAlgebra Q)) = instAlgebra' _ := rfl
91+
example : (algebraInt _ : Algebra ℤ (CliffordAlgebra Q)) = instAlgebra' _ := rfl
92+
93+
-- shortcut instance, as the other instance is slow
94+
instance instAlgebra : Algebra R (CliffordAlgebra Q) := instAlgebra' _
8395
#align clifford_algebra.algebra CliffordAlgebra.instAlgebra
8496

97+
instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommGroup M] [CommRing A]
98+
[Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M] (Q : QuadraticForm A M)
99+
[IsScalarTower R A M] [IsScalarTower S A M] [SMulCommClass R S A] :
100+
SMulCommClass R S (CliffordAlgebra Q) :=
101+
RingQuot.instSMulCommClassRingQuotInstSMulRingQuotInstSMulRingQuot _
102+
103+
instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommGroup M] [CommRing A]
104+
[SMul R S] [Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
105+
[IsScalarTower R A M] [IsScalarTower S A M] [IsScalarTower R S A] (Q : QuadraticForm A M) :
106+
IsScalarTower R S (CliffordAlgebra Q) :=
107+
RingQuot.instIsScalarTowerRingQuotInstSMulRingQuotInstSMulRingQuot _
108+
85109
/-- The canonical linear map `M →ₗ[R] CliffordAlgebra Q`.
86110
-/
87111
def ι : M →ₗ[R] CliffordAlgebra Q :=

0 commit comments

Comments
 (0)