Skip to content

Commit 3bcc451

Browse files
committed
chore(LinearAlgebra): remove workarounds for compilation performance issues (#26786)
#7103 is resolved by the new compiler, at least for everything in this PR.
1 parent 656089c commit 3bcc451

File tree

7 files changed

+13
-33
lines changed

7 files changed

+13
-33
lines changed

Mathlib/Algebra/Category/ModuleCat/Monoidal/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ If you're happy using the bundled `ModuleCat R`, it may be possible to mostly
2727
use this as an interface and not need to interact much with the implementation details.
2828
-/
2929

30-
31-
suppress_compilation
32-
3330
universe v w x u
3431

3532
open CategoryTheory
@@ -230,7 +227,7 @@ variable (f : M₁ → M₂ → M₃) (h₁ : ∀ m₁ m₂ n, f (m₁ + m₂) n
230227
(h₄ : ∀ (a : R) m n, f m (a • n) = a • f m n)
231228

232229
/-- Construct for morphisms from the tensor product of two objects in `ModuleCat`. -/
233-
noncomputable def tensorLift : M₁ ⊗ M₂ ⟶ M₃ :=
230+
def tensorLift : M₁ ⊗ M₂ ⟶ M₃ :=
234231
ofHom <| TensorProduct.lift (LinearMap.mk₂ R f h₁ h₂ h₃ h₄)
235232

236233
@[simp]

Mathlib/Algebra/Category/ModuleCat/Monoidal/Closed.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import Mathlib.Algebra.Category.ModuleCat.Monoidal.Symmetric
1111
# The monoidal closed structure on `Module R`.
1212
-/
1313

14-
suppress_compilation
15-
1614
universe v w x u
1715

1816
open CategoryTheory Opposite

Mathlib/Algebra/Category/ModuleCat/Monoidal/Symmetric.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic
1010
# The symmetric monoidal structure on `Module R`.
1111
-/
1212

13-
suppress_compilation
14-
1513
universe v w x u
1614

1715
open CategoryTheory MonoidalCategory

Mathlib/LinearAlgebra/CliffordAlgebra/BaseChange.lean

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ namespace CliffordAlgebra
4242
variable (A)
4343

4444
/-- Auxiliary construction: note this is really just a heterobasic `CliffordAlgebra.map`. -/
45-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
46-
noncomputable def ofBaseChangeAux (Q : QuadraticForm R V) :
45+
def ofBaseChangeAux (Q : QuadraticForm R V) :
4746
CliffordAlgebra Q →ₐ[R] CliffordAlgebra (Q.baseChange A) :=
4847
CliffordAlgebra.lift Q <| by
4948
refine ⟨(ι (Q.baseChange A)).restrictScalars R ∘ₗ TensorProduct.mk R A V 1, fun v => ?_⟩
@@ -57,8 +56,7 @@ noncomputable def ofBaseChangeAux (Q : QuadraticForm R V) :
5756

5857
/-- Convert from the base-changed clifford algebra to the clifford algebra over a base-changed
5958
module. -/
60-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
61-
noncomputable def ofBaseChange (Q : QuadraticForm R V) :
59+
def ofBaseChange (Q : QuadraticForm R V) :
6260
A ⊗[R] CliffordAlgebra Q →ₐ[A] CliffordAlgebra (Q.baseChange A) :=
6361
Algebra.TensorProduct.lift (Algebra.ofId _ _) (ofBaseChangeAux A Q)
6462
fun _a _x => Algebra.commutes _ _
@@ -76,8 +74,7 @@ noncomputable def ofBaseChange (Q : QuadraticForm R V) :
7674

7775
/-- Convert from the clifford algebra over a base-changed module to the base-changed clifford
7876
algebra. -/
79-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
80-
noncomputable def toBaseChange (Q : QuadraticForm R V) :
77+
def toBaseChange (Q : QuadraticForm R V) :
8178
CliffordAlgebra (Q.baseChange A) →ₐ[A] A ⊗[R] CliffordAlgebra Q :=
8279
CliffordAlgebra.lift _ <| by
8380
refine ⟨TensorProduct.AlgebraTensorModule.map (LinearMap.id : A →ₗ[A] A) (ι Q), ?_⟩
@@ -179,8 +176,7 @@ base-changing the clifford algebra itself; <|Cℓ(A ⊗_R V, Q_A) ≅ A ⊗_R C
179176
180177
This is `CliffordAlgebra.toBaseChange` and `CliffordAlgebra.ofBaseChange` as an equivalence. -/
181178
@[simps!]
182-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
183-
noncomputable def equivBaseChange (Q : QuadraticForm R V) :
179+
def equivBaseChange (Q : QuadraticForm R V) :
184180
CliffordAlgebra (Q.baseChange A) ≃ₐ[A] A ⊗[R] CliffordAlgebra Q :=
185181
AlgEquiv.ofAlgHom (toBaseChange A Q) (ofBaseChange A Q)
186182
(toBaseChange_comp_ofBaseChange A Q)

Mathlib/LinearAlgebra/QuadraticForm/QuadraticModuleCat/Monoidal.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ For now, we simplify by insisting both universe levels are the same.
2424
This file essentially mirrors `Mathlib/Algebra/Category/AlgCat/Monoidal.lean`.
2525
-/
2626

27-
suppress_compilation
28-
2927
open CategoryTheory
3028
open scoped MonoidalCategory
3129

@@ -41,13 +39,13 @@ namespace instMonoidalCategory
4139

4240
/-- Auxiliary definition used to build `QuadraticModuleCat.instMonoidalCategory`. -/
4341
@[simps! form]
44-
noncomputable abbrev tensorObj (X Y : QuadraticModuleCat.{u} R) : QuadraticModuleCat.{u} R :=
42+
abbrev tensorObj (X Y : QuadraticModuleCat.{u} R) : QuadraticModuleCat.{u} R :=
4543
of (X.form.tmul Y.form)
4644

4745
/-- Auxiliary definition used to build `QuadraticModuleCat.instMonoidalCategory`.
4846
4947
We want this up front so that we can re-use it to define `whiskerLeft` and `whiskerRight`. -/
50-
noncomputable abbrev tensorHom {W X Y Z : QuadraticModuleCat.{u} R} (f : W ⟶ X) (g : Y ⟶ Z) :
48+
abbrev tensorHom {W X Y Z : QuadraticModuleCat.{u} R} (f : W ⟶ X) (g : Y ⟶ Z) :
5149
tensorObj W Y ⟶ tensorObj X Z :=
5250
⟨f.toIsometry.tmul g.toIsometry⟩
5351

@@ -79,7 +77,7 @@ theorem forget₂_map_associator_inv (X Y Z : QuadraticModuleCat.{u} R) :
7977
(forget₂ (QuadraticModuleCat R) (ModuleCat R)).map (α_ X Y Z).inv =
8078
(α_ X.toModuleCat Y.toModuleCat Z.toModuleCat).inv := rfl
8179

82-
noncomputable instance instMonoidalCategory : MonoidalCategory (QuadraticModuleCat.{u} R) :=
80+
instance instMonoidalCategory : MonoidalCategory (QuadraticModuleCat.{u} R) :=
8381
Monoidal.induced
8482
(forget₂ (QuadraticModuleCat R) (ModuleCat R))
8583
{ μIso := fun _ _ => Iso.refl _

Mathlib/LinearAlgebra/QuadraticForm/QuadraticModuleCat/Symmetric.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ In this file we show:
1818
This file essentially mirrors `Mathlib/Algebra/Category/AlgCat/Symmetric.lean`.
1919
-/
2020

21-
suppress_compilation
22-
2321
open CategoryTheory
2422

2523
universe v u

Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ variable (R A) in
4040
4141
Note this is heterobasic; the quadratic map on the left can take values in a module over a larger
4242
ring than the one on the right. -/
43-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
44-
noncomputable def tensorDistrib :
43+
def tensorDistrib :
4544
QuadraticMap A M₁ N₁ ⊗[R] QuadraticMap R M₂ N₂ →ₗ[A] QuadraticMap A (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂) :=
4645
letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm
4746
-- while `letI`s would produce a better term than `let`, they would make this already-slow
@@ -61,8 +60,7 @@ theorem tensorDistrib_tmul (Q₁ : QuadraticMap A M₁ N₁) (Q₂ : QuadraticMa
6160
(associated_eq_self_apply _ _ _) (associated_eq_self_apply _ _ _)
6261

6362
/-- The tensor product of two quadratic maps, a shorthand for dot notation. -/
64-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
65-
protected noncomputable abbrev tmul (Q₁ : QuadraticMap A M₁ N₁)
63+
protected abbrev tmul (Q₁ : QuadraticMap A M₁ N₁)
6664
(Q₂ : QuadraticMap R M₂ N₂) : QuadraticMap A (M₁ ⊗[R] M₂) (N₁ ⊗[R] N₂) :=
6765
tensorDistrib R A (Q₁ ⊗ₜ[R] Q₂)
6866

@@ -84,8 +82,7 @@ variable (R A) in
8482
8583
Note this is heterobasic; the quadratic form on the left can take values in a larger ring than
8684
the one on the right. -/
87-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
88-
noncomputable def tensorDistrib :
85+
def tensorDistrib :
8986
QuadraticForm A M₁ ⊗[R] QuadraticForm R M₂ →ₗ[A] QuadraticForm A (M₁ ⊗[R] M₂) :=
9087
(AlgebraTensorModule.rid R A A).congrQuadraticMap.toLinearMap ∘ₗ QuadraticMap.tensorDistrib R A
9188

@@ -99,8 +96,7 @@ theorem tensorDistrib_tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R
9996
(associated_eq_self_apply _ _ _) (associated_eq_self_apply _ _ _)
10097

10198
/-- The tensor product of two quadratic forms, a shorthand for dot notation. -/
102-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
103-
protected noncomputable abbrev tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
99+
protected abbrev tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
104100
QuadraticForm A (M₁ ⊗[R] M₂) :=
105101
tensorDistrib R A (Q₁ ⊗ₜ[R] Q₂)
106102

@@ -119,8 +115,7 @@ theorem polarBilin_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂
119115

120116
variable (A) in
121117
/-- The base change of a quadratic form. -/
122-
-- `noncomputable` is a performance workaround for https://github.com/leanprover-community/mathlib4/issues/7103
123-
protected noncomputable def baseChange (Q : QuadraticForm R M₂) : QuadraticForm A (A ⊗[R] M₂) :=
118+
protected def baseChange (Q : QuadraticForm R M₂) : QuadraticForm A (A ⊗[R] M₂) :=
124119
QuadraticForm.tmul (R := R) (A := A) (M₁ := A) (M₂ := M₂) (QuadraticMap.sq (R := A)) Q
125120

126121
@[simp]

0 commit comments

Comments
 (0)