linear_algebra.clifford_algebra.even_equiv
⟷
Mathlib.LinearAlgebra.CliffordAlgebra.EvenEquiv
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -101,7 +101,7 @@ theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q :=
refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
dsimp [QuadraticForm.polar]
simp only [add_zero, MulZeroClass.mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
- add_sub_cancel, sub_self, map_zero, zero_sub]
+ add_sub_cancel_right, sub_self, map_zero, zero_sub]
#align clifford_algebra.equiv_even.neg_e0_mul_v CliffordAlgebra.EquivEven.neg_e0_mul_v
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
-import Mathbin.LinearAlgebra.CliffordAlgebra.Conjugation
-import Mathbin.LinearAlgebra.CliffordAlgebra.Even
-import Mathbin.LinearAlgebra.QuadraticForm.Prod
+import LinearAlgebra.CliffordAlgebra.Conjugation
+import LinearAlgebra.CliffordAlgebra.Even
+import LinearAlgebra.QuadraticForm.Prod
#align_import linear_algebra.clifford_algebra.even_equiv from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module linear_algebra.clifford_algebra.even_equiv
-! leanprover-community/mathlib commit 2fe465deb81bcd7ccafa065bb686888a82f15372
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathbin.LinearAlgebra.CliffordAlgebra.Even
import Mathbin.LinearAlgebra.QuadraticForm.Prod
+#align_import linear_algebra.clifford_algebra.even_equiv from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
+
/-!
# Isomorphisms with the even subalgebra of a Clifford algebra
mathlib commit https://github.com/leanprover-community/mathlib/commit/2fe465deb81bcd7ccafa065bb686888a82f15372
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
! This file was ported from Lean 3 source module linear_algebra.clifford_algebra.even_equiv
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
+! leanprover-community/mathlib commit 2fe465deb81bcd7ccafa065bb686888a82f15372
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -15,6 +15,9 @@ import Mathbin.LinearAlgebra.QuadraticForm.Prod
/-!
# Isomorphisms with the even subalgebra of a Clifford algebra
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
This file provides some notable isomorphisms regarding the even subalgebra, `clifford_algebra.even`.
## Main definitions
mathlib commit https://github.com/leanprover-community/mathlib/commit/8905e5ed90859939681a725b00f6063e65096d95
@@ -48,39 +48,54 @@ variable (Q : QuadraticForm R M)
namespace EquivEven
+#print CliffordAlgebra.EquivEven.Q' /-
/-- The quadratic form on the augmented vector space `M × R` sending `v + r•e0` to `Q v - r^2`. -/
@[reducible]
-def q' : QuadraticForm R (M × R) :=
+def Q' : QuadraticForm R (M × R) :=
Q.Prod <| -@QuadraticForm.sq R _
-#align clifford_algebra.equiv_even.Q' CliffordAlgebra.EquivEven.q'
+#align clifford_algebra.equiv_even.Q' CliffordAlgebra.EquivEven.Q'
+-/
-theorem q'_apply (m : M × R) : q' Q m = Q m.1 - m.2 * m.2 :=
+#print CliffordAlgebra.EquivEven.Q'_apply /-
+theorem Q'_apply (m : M × R) : Q' Q m = Q m.1 - m.2 * m.2 :=
(sub_eq_add_neg _ _).symm
-#align clifford_algebra.equiv_even.Q'_apply CliffordAlgebra.EquivEven.q'_apply
+#align clifford_algebra.equiv_even.Q'_apply CliffordAlgebra.EquivEven.Q'_apply
+-/
+#print CliffordAlgebra.EquivEven.e0 /-
/-- The unit vector in the new dimension -/
-def e0 : CliffordAlgebra (q' Q) :=
- ι (q' Q) (0, 1)
+def e0 : CliffordAlgebra (Q' Q) :=
+ ι (Q' Q) (0, 1)
#align clifford_algebra.equiv_even.e0 CliffordAlgebra.EquivEven.e0
+-/
+#print CliffordAlgebra.EquivEven.v /-
/-- The embedding from the existing vector space -/
-def v : M →ₗ[R] CliffordAlgebra (q' Q) :=
- ι (q' Q) ∘ₗ LinearMap.inl _ _ _
+def v : M →ₗ[R] CliffordAlgebra (Q' Q) :=
+ ι (Q' Q) ∘ₗ LinearMap.inl _ _ _
#align clifford_algebra.equiv_even.v CliffordAlgebra.EquivEven.v
+-/
-theorem ι_eq_v_add_smul_e0 (m : M) (r : R) : ι (q' Q) (m, r) = v Q m + r • e0 Q := by
+#print CliffordAlgebra.EquivEven.ι_eq_v_add_smul_e0 /-
+theorem ι_eq_v_add_smul_e0 (m : M) (r : R) : ι (Q' Q) (m, r) = v Q m + r • e0 Q := by
rw [e0, v, LinearMap.comp_apply, LinearMap.inl_apply, ← LinearMap.map_smul, Prod.smul_mk,
smul_zero, smul_eq_mul, mul_one, ← LinearMap.map_add, Prod.mk_add_mk, zero_add, add_zero]
#align clifford_algebra.equiv_even.ι_eq_v_add_smul_e0 CliffordAlgebra.EquivEven.ι_eq_v_add_smul_e0
+-/
+#print CliffordAlgebra.EquivEven.e0_mul_e0 /-
theorem e0_mul_e0 : e0 Q * e0 Q = -1 :=
(ι_sq_scalar _ _).trans <| by simp
#align clifford_algebra.equiv_even.e0_mul_e0 CliffordAlgebra.EquivEven.e0_mul_e0
+-/
+#print CliffordAlgebra.EquivEven.v_sq_scalar /-
theorem v_sq_scalar (m : M) : v Q m * v Q m = algebraMap _ _ (Q m) :=
(ι_sq_scalar _ _).trans <| by simp
#align clifford_algebra.equiv_even.v_sq_scalar CliffordAlgebra.EquivEven.v_sq_scalar
+-/
+#print CliffordAlgebra.EquivEven.neg_e0_mul_v /-
theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q :=
by
refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
@@ -88,44 +103,58 @@ theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q :=
simp only [add_zero, MulZeroClass.mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
add_sub_cancel, sub_self, map_zero, zero_sub]
#align clifford_algebra.equiv_even.neg_e0_mul_v CliffordAlgebra.EquivEven.neg_e0_mul_v
+-/
+#print CliffordAlgebra.EquivEven.neg_v_mul_e0 /-
theorem neg_v_mul_e0 (m : M) : -(v Q m * e0 Q) = e0 Q * v Q m :=
by
rw [neg_eq_iff_eq_neg]
exact (neg_e0_mul_v _ m).symm
#align clifford_algebra.equiv_even.neg_v_mul_e0 CliffordAlgebra.EquivEven.neg_v_mul_e0
+-/
+#print CliffordAlgebra.EquivEven.e0_mul_v_mul_e0 /-
@[simp]
theorem e0_mul_v_mul_e0 (m : M) : e0 Q * v Q m * e0 Q = v Q m := by
rw [← neg_v_mul_e0, ← neg_mul, mul_assoc, e0_mul_e0, mul_neg_one, neg_neg]
#align clifford_algebra.equiv_even.e0_mul_v_mul_e0 CliffordAlgebra.EquivEven.e0_mul_v_mul_e0
+-/
+#print CliffordAlgebra.EquivEven.reverse_v /-
@[simp]
theorem reverse_v (m : M) : reverse (v Q m) = v Q m :=
reverse_ι _
#align clifford_algebra.equiv_even.reverse_v CliffordAlgebra.EquivEven.reverse_v
+-/
+#print CliffordAlgebra.EquivEven.involute_v /-
@[simp]
theorem involute_v (m : M) : involute (v Q m) = -v Q m :=
involute_ι _
#align clifford_algebra.equiv_even.involute_v CliffordAlgebra.EquivEven.involute_v
+-/
+#print CliffordAlgebra.EquivEven.reverse_e0 /-
@[simp]
theorem reverse_e0 : reverse (e0 Q) = e0 Q :=
reverse_ι _
#align clifford_algebra.equiv_even.reverse_e0 CliffordAlgebra.EquivEven.reverse_e0
+-/
+#print CliffordAlgebra.EquivEven.involute_e0 /-
@[simp]
theorem involute_e0 : involute (e0 Q) = -e0 Q :=
involute_ι _
#align clifford_algebra.equiv_even.involute_e0 CliffordAlgebra.EquivEven.involute_e0
+-/
end EquivEven
open EquivEven
+#print CliffordAlgebra.toEven /-
/-- The embedding from the smaller algebra into the new larger one. -/
-def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (q' Q) :=
+def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) :=
by
refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
· refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
@@ -137,16 +166,20 @@ def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (q' Q) :=
LinearMap.mulLeft_apply, LinearMap.inl_apply, Subalgebra.coe_algebraMap]
rw [← mul_assoc, e0_mul_v_mul_e0, v_sq_scalar]
#align clifford_algebra.to_even CliffordAlgebra.toEven
+-/
+#print CliffordAlgebra.toEven_ι /-
@[simp]
-theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (q' Q)) = e0 Q * v Q m :=
+theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q * v Q m :=
by
rw [to_even, CliffordAlgebra.lift_ι_apply, LinearMap.codRestrict_apply]
rfl
#align clifford_algebra.to_even_ι CliffordAlgebra.toEven_ι
+-/
+#print CliffordAlgebra.ofEven /-
/-- The embedding from the even subalgebra with an extra dimension into the original algebra. -/
-def ofEven : CliffordAlgebra.even (q' Q) →ₐ[R] CliffordAlgebra Q :=
+def ofEven : CliffordAlgebra.even (Q' Q) →ₐ[R] CliffordAlgebra Q :=
by
/-
Recall that we need:
@@ -176,15 +209,19 @@ def ofEven : CliffordAlgebra.even (q' Q) →ₐ[R] CliffordAlgebra Q :=
rw [← mul_smul_comm, ← mul_assoc, mul_assoc (_ + _), ← (hc _ _).symm.mul_self_sub_mul_self_eq',
Algebra.smul_def, ← mul_assoc, hm]
#align clifford_algebra.of_even CliffordAlgebra.ofEven
+-/
+#print CliffordAlgebra.ofEven_ι /-
theorem ofEven_ι (x y : M × R) :
ofEven Q ((even.ι _).bilin x y) =
(ι Q x.1 + algebraMap R _ x.2) * (ι Q y.1 - algebraMap R _ y.2) :=
even.lift_ι _ _ _ _
#align clifford_algebra.of_even_ι CliffordAlgebra.ofEven_ι
+-/
+#print CliffordAlgebra.toEven_comp_ofEven /-
theorem toEven_comp_ofEven : (toEven Q).comp (ofEven Q) = AlgHom.id R _ :=
- even.algHom_ext (q' Q) <|
+ even.algHom_ext (Q' Q) <|
EvenHom.ext _ _ <|
LinearMap.ext fun m₁ =>
LinearMap.ext fun m₂ =>
@@ -192,7 +229,7 @@ theorem toEven_comp_ofEven : (toEven Q).comp (ofEven Q) = AlgHom.id R _ :=
let ⟨m₁, r₁⟩ := m₁
let ⟨m₂, r₂⟩ := m₂
calc
- ↑(toEven Q (ofEven Q ((even.ι (q' Q)).bilin (m₁, r₁) (m₂, r₂)))) =
+ ↑(toEven Q (ofEven Q ((even.ι (Q' Q)).bilin (m₁, r₁) (m₂, r₂)))) =
(e0 Q * v Q m₁ + algebraMap R _ r₁) * (e0 Q * v Q m₂ - algebraMap R _ r₂) :=
by
rw [of_even_ι, AlgHom.map_mul, AlgHom.map_add, AlgHom.map_sub, AlgHom.commutes,
@@ -218,7 +255,9 @@ theorem toEven_comp_ofEven : (toEven Q).comp (ofEven Q) = AlgHom.id R _ :=
_ = ι _ (m₁, r₁) * ι _ (m₂, r₂) := by
rw [ι_eq_v_add_smul_e0, ι_eq_v_add_smul_e0, mul_add, add_mul, add_mul, add_assoc]
#align clifford_algebra.to_even_comp_of_even CliffordAlgebra.toEven_comp_ofEven
+-/
+#print CliffordAlgebra.ofEven_comp_toEven /-
theorem ofEven_comp_toEven : (ofEven Q).comp (toEven Q) = AlgHom.id R _ :=
CliffordAlgebra.hom_ext <|
LinearMap.ext fun m =>
@@ -231,19 +270,23 @@ theorem ofEven_comp_toEven : (ofEven Q).comp (toEven Q) = AlgHom.id R _ :=
exact of_even_ι Q _ _
_ = ι Q m := by rw [map_one, map_zero, map_zero, sub_zero, zero_add, one_mul]
#align clifford_algebra.of_even_comp_to_even CliffordAlgebra.ofEven_comp_toEven
+-/
+#print CliffordAlgebra.equivEven /-
/-- Any clifford algebra is isomorphic to the even subalgebra of a clifford algebra with an extra
dimension (that is, with vector space `M × R`), with a quadratic form evaluating to `-1` on that new
basis vector. -/
@[simps]
-def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (q' Q) :=
+def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (Q' Q) :=
AlgEquiv.ofAlgHom (toEven Q) (ofEven Q) (toEven_comp_ofEven Q) (ofEven_comp_toEven Q)
#align clifford_algebra.equiv_even CliffordAlgebra.equivEven
+-/
+#print CliffordAlgebra.coe_toEven_reverse_involute /-
/-- The representation of the clifford conjugate (i.e. the reverse of the involute) in the even
subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
- ↑(toEven Q (reverse (involute x))) = reverse (toEven Q x : CliffordAlgebra (q' Q)) :=
+ ↑(toEven Q (reverse (involute x))) = reverse (toEven Q x : CliffordAlgebra (Q' Q)) :=
by
induction x using CliffordAlgebra.induction
case h_grade0 r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
@@ -253,10 +296,12 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
case h_mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
case h_add x y hx hy => simp only [map_add, Subalgebra.coe_add, hx, hy]
#align clifford_algebra.coe_to_even_reverse_involute CliffordAlgebra.coe_toEven_reverse_involute
+-/
/-! ### Constructions needed for `clifford_algebra.even_equiv_even_neg` -/
+#print CliffordAlgebra.evenToNeg /-
/-- One direction of `clifford_algebra.even_equiv_even_neg` -/
def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
CliffordAlgebra.even Q →ₐ[R] CliffordAlgebra.even Q' :=
@@ -269,13 +314,17 @@ def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
simp_rw [LinearMap.neg_apply, neg_mul_neg, even_hom.contract_mid, h,
QuadraticForm.neg_apply, smul_neg, neg_smul] }
#align clifford_algebra.even_to_neg CliffordAlgebra.evenToNeg
+-/
+#print CliffordAlgebra.evenToNeg_ι /-
@[simp]
theorem evenToNeg_ι (Q' : QuadraticForm R M) (h : Q' = -Q) (m₁ m₂ : M) :
evenToNeg Q Q' h ((even.ι Q).bilin m₁ m₂) = -(even.ι Q').bilin m₁ m₂ :=
even.lift_ι _ _ m₁ m₂
#align clifford_algebra.even_to_neg_ι CliffordAlgebra.evenToNeg_ι
+-/
+#print CliffordAlgebra.evenToNeg_comp_evenToNeg /-
theorem evenToNeg_comp_evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) (h' : Q = -Q') :
(evenToNeg Q' Q h').comp (evenToNeg Q Q' h) = AlgHom.id R _ :=
by
@@ -284,7 +333,9 @@ theorem evenToNeg_comp_evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) (h' : Q
AlgHom.comp_apply, AlgHom.id_apply]
rw [even_to_neg_ι, map_neg, even_to_neg_ι, neg_neg]
#align clifford_algebra.even_to_neg_comp_even_to_neg CliffordAlgebra.evenToNeg_comp_evenToNeg
+-/
+#print CliffordAlgebra.evenEquivEvenNeg /-
/-- The even subalgebras of the algebras with quadratic form `Q` and `-Q` are isomorphic.
Stated another way, `𝒞ℓ⁺(p,q,r)` and `𝒞ℓ⁺(q,p,r)` are isomorphic. -/
@@ -293,6 +344,7 @@ def evenEquivEvenNeg : CliffordAlgebra.even Q ≃ₐ[R] CliffordAlgebra.even (-Q
AlgEquiv.ofAlgHom (evenToNeg Q _ rfl) (evenToNeg (-Q) _ (neg_neg _).symm)
(evenToNeg_comp_evenToNeg _ _ _ _) (evenToNeg_comp_evenToNeg _ _ _ _)
#align clifford_algebra.even_equiv_even_neg CliffordAlgebra.evenEquivEvenNeg
+-/
end CliffordAlgebra
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -279,7 +279,7 @@ theorem evenToNeg_ι (Q' : QuadraticForm R M) (h : Q' = -Q) (m₁ m₂ : M) :
theorem evenToNeg_comp_evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) (h' : Q = -Q') :
(evenToNeg Q' Q h').comp (evenToNeg Q Q' h) = AlgHom.id R _ :=
by
- ext (m₁ m₂) : 4
+ ext m₁ m₂ : 4
dsimp only [even_hom.compr₂_bilin, LinearMap.compr₂_apply, AlgHom.toLinearMap_apply,
AlgHom.comp_apply, AlgHom.id_apply]
rw [even_to_neg_ι, map_neg, even_to_neg_ι, neg_neg]
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -217,7 +217,6 @@ theorem toEven_comp_ofEven : (toEven Q).comp (ofEven Q) = AlgHom.id R _ :=
rw [sub_eq_add_neg, sub_eq_add_neg, h1, h2, h3]
_ = ι _ (m₁, r₁) * ι _ (m₂, r₂) := by
rw [ι_eq_v_add_smul_e0, ι_eq_v_add_smul_e0, mul_add, add_mul, add_mul, add_assoc]
-
#align clifford_algebra.to_even_comp_of_even CliffordAlgebra.toEven_comp_ofEven
theorem ofEven_comp_toEven : (ofEven Q).comp (toEven Q) = AlgHom.id R _ :=
@@ -231,7 +230,6 @@ theorem ofEven_comp_toEven : (ofEven Q).comp (toEven Q) = AlgHom.id R _ :=
simp_rw [to_even_ι]
exact of_even_ι Q _ _
_ = ι Q m := by rw [map_one, map_zero, map_zero, sub_zero, zero_add, one_mul]
-
#align clifford_algebra.of_even_comp_to_even CliffordAlgebra.ofEven_comp_toEven
/-- Any clifford algebra is isomorphic to the even subalgebra of a clifford algebra with an extra
mathlib commit https://github.com/leanprover-community/mathlib/commit/e3fb84046afd187b710170887195d50bada934ee
@@ -128,7 +128,7 @@ open EquivEven
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (q' Q) :=
by
refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
- · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_supᵢ_of_mem ⟨2, rfl⟩ _
+ · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
rw [Subtype.coe_mk, pow_two]
exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/2651125b48fc5c170ab1111afd0817c903b1fc6c
@@ -156,7 +156,7 @@ def ofEven : CliffordAlgebra.even (q' Q) →ₐ[R] CliffordAlgebra Q :=
* `f ⟨0,1⟩ ⟨0,1⟩ = -1`
-/
let f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
- ((LinearMap.Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
+ ((Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
(ι Q).comp (LinearMap.fst _ _ _) +
(Algebra.linearMap R _).comp (LinearMap.snd _ _ _)).compl₂
((ι Q).comp (LinearMap.fst _ _ _) - (Algebra.linearMap R _).comp (LinearMap.snd _ _ _))
mathlib commit https://github.com/leanprover-community/mathlib/commit/2196ab363eb097c008d4497125e0dde23fb36db2
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
! This file was ported from Lean 3 source module linear_algebra.clifford_algebra.even_equiv
-! leanprover-community/mathlib commit 9264b15ee696b7ca83f13c8ad67c83d6eb70b730
+! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -91,8 +91,8 @@ theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q :=
theorem neg_v_mul_e0 (m : M) : -(v Q m * e0 Q) = e0 Q * v Q m :=
by
- rw [neg_eq_iff_neg_eq]
- exact neg_e0_mul_v _ m
+ rw [neg_eq_iff_eq_neg]
+ exact (neg_e0_mul_v _ m).symm
#align clifford_algebra.equiv_even.neg_v_mul_e0 CliffordAlgebra.EquivEven.neg_v_mul_e0
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -85,7 +85,7 @@ theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q :=
by
refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
dsimp [QuadraticForm.polar]
- simp only [add_zero, mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
+ simp only [add_zero, MulZeroClass.mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
add_sub_cancel, sub_self, map_zero, zero_sub]
#align clifford_algebra.equiv_even.neg_e0_mul_v CliffordAlgebra.EquivEven.neg_e0_mul_v
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -156,7 +156,7 @@ def ofEven : CliffordAlgebra.even (q' Q) →ₐ[R] CliffordAlgebra Q :=
* `f ⟨0,1⟩ ⟨0,1⟩ = -1`
-/
let f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
- ((Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
+ ((LinearMap.Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
(ι Q).comp (LinearMap.fst _ _ _) +
(Algebra.linearMap R _).comp (LinearMap.snd _ _ _)).compl₂
((ι Q).comp (LinearMap.fst _ _ _) - (Algebra.linearMap R _).comp (LinearMap.snd _ _ _))
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
mul
-div
cancellation lemmas (#11530)
Lemma names around cancellation of multiplication and division are a mess.
This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero
lemma name, the Group
lemma, the AddGroup
lemma name).
| Statement | New name | Old name | |
@@ -84,7 +84,7 @@ theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by
refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
dsimp [QuadraticForm.polar]
simp only [add_zero, mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
- add_sub_cancel, sub_self, map_zero, zero_sub]
+ add_sub_cancel_right, sub_self, map_zero, zero_sub]
#align clifford_algebra.equiv_even.neg_e0_mul_v CliffordAlgebra.EquivEven.neg_e0_mul_v
theorem neg_v_mul_e0 (m : M) : -(v Q m * e0 Q) = e0 Q * v Q m := by
Empty lines were removed by executing the following Python script twice
import os
import re
# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
for filename in files:
if filename.endswith('.lean'):
file_path = os.path.join(dir_path, filename)
# Open the file and read its contents
with open(file_path, 'r') as file:
content = file.read()
# Use a regular expression to replace sequences of "variable" lines separated by empty lines
# with sequences without empty lines
modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)
# Write the modified content back to the file
with open(file_path, 'w') as file:
file.write(modified_content)
@@ -38,7 +38,6 @@ This file provides some notable isomorphisms regarding the even subalgebra, `Cli
namespace CliffordAlgebra
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
-
variable (Q : QuadraticForm R M)
/-! ### Constructions needed for `CliffordAlgebra.equivEven` -/
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -136,7 +136,6 @@ def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
rw [← mul_assoc, e0_mul_v_mul_e0, v_sq_scalar]
#align clifford_algebra.to_even CliffordAlgebra.toEven
-@[simp]
theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q * v Q m := by
rw [toEven, CliffordAlgebra.lift_ι_apply]
-- Porting note (#10691): was `rw`
@@ -233,14 +232,10 @@ theorem ofEven_comp_toEven : (ofEven Q).comp (toEven Q) = AlgHom.id R _ :=
/-- Any clifford algebra is isomorphic to the even subalgebra of a clifford algebra with an extra
dimension (that is, with vector space `M × R`), with a quadratic form evaluating to `-1` on that new
basis vector. -/
-@[simps!]
def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (Q' Q) :=
AlgEquiv.ofAlgHom (toEven Q) (ofEven Q) (toEven_comp_ofEven Q) (ofEven_comp_toEven Q)
#align clifford_algebra.equiv_even CliffordAlgebra.equivEven
--- Note: times out on linting CI
-attribute [nolint simpNF] equivEven_symm_apply
-
/-- The representation of the clifford conjugate (i.e. the reverse of the involute) in the even
subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -130,8 +130,8 @@ def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
rw [Subtype.coe_mk, pow_two]
exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
· ext1
- rw [Subalgebra.coe_mul] -- porting note: was part of the `dsimp only` below
- erw [LinearMap.codRestrict_apply] -- porting note: was part of the `dsimp only` below
+ rw [Subalgebra.coe_mul] -- Porting note: was part of the `dsimp only` below
+ erw [LinearMap.codRestrict_apply] -- Porting note: was part of the `dsimp only` below
dsimp only [LinearMap.comp_apply, LinearMap.mulLeft_apply, Subalgebra.coe_algebraMap]
rw [← mul_assoc, e0_mul_v_mul_e0, v_sq_scalar]
#align clifford_algebra.to_even CliffordAlgebra.toEven
@@ -177,7 +177,7 @@ def ofEven : CliffordAlgebra.even (Q' Q) →ₐ[R] CliffordAlgebra Q := by
theorem ofEven_ι (x y : M × R) :
ofEven Q ((even.ι (Q' Q)).bilin x y) =
(ι Q x.1 + algebraMap R _ x.2) * (ι Q y.1 - algebraMap R _ y.2) := by
- -- porting note: entire proof was the term-mode `even.lift_ι (Q' Q) _ x y`
+ -- Porting note: entire proof was the term-mode `even.lift_ι (Q' Q) _ x y`
unfold ofEven
lift_lets
intro f
@@ -249,7 +249,7 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
induction x using CliffordAlgebra.induction with
| algebraMap r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
| ι m =>
- -- porting note: added `letI`
+ -- Porting note: added `letI`
letI : SubtractionMonoid (even (Q' Q)) := AddGroup.toSubtractionMonoid
simp only [involute_ι, Subalgebra.coe_neg, toEven_ι, reverse.map_mul, reverse_v, reverse_e0,
reverse_ι, neg_e0_mul_v, map_neg]
@@ -270,7 +270,7 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
CliffordAlgebra.even Q →ₐ[R] CliffordAlgebra.even Q' :=
even.lift Q <|
- -- porting note: added `letI`s
+ -- Porting note: added `letI`s
letI : AddCommGroup (even Q') := AddSubgroupClass.toAddCommGroup _;
letI : HasDistribNeg (even Q') := NonUnitalNonAssocRing.toHasDistribNeg;
{ bilin := -(even.ι Q' : _).bilin
@@ -284,7 +284,7 @@ def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
QuadraticForm.neg_apply, smul_neg, neg_smul] }
#align clifford_algebra.even_to_neg CliffordAlgebra.evenToNeg
--- porting note: `simpNF` times out, but only in CI where all of `Mathlib` is imported
+-- Porting note: `simpNF` times out, but only in CI where all of `Mathlib` is imported
@[simp, nolint simpNF]
theorem evenToNeg_ι (Q' : QuadraticForm R M) (h : Q' = -Q) (m₁ m₂ : M) :
evenToNeg Q Q' h ((even.ι Q).bilin m₁ m₂) = -(even.ι Q').bilin m₁ m₂ :=
CliffordAlgebra
(#10908)
In order to improve the ergonomics of the induction
tactic, this renames the arguments of:
ExteriorAlgebra.induction
TensorAlgebra.induction
CliffordAlgebra.induction
CliffordAlgebra.left_induction
CliffordAlgebra.right_induction
CliffordAlgebra.even_induction
CliffordAlgebra.odd_induction
Submodule.iSup_induction'
Submodule.pow_induction_on_left'
Submodule.pow_induction_on_right'
This is slightly awkward for name-resolution within these induction principles, as the argument names end up clashing with the function they are about. Thankfully, this pain is not transferred to the caller using induction _ using _
.
@@ -247,14 +247,14 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
↑(toEven Q (reverse (involute x))) =
reverse (Q := Q' Q) (toEven Q x : CliffordAlgebra (Q' Q)) := by
induction x using CliffordAlgebra.induction with
- | h_grade0 r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
- | h_grade1 m =>
+ | algebraMap r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
+ | ι m =>
-- porting note: added `letI`
letI : SubtractionMonoid (even (Q' Q)) := AddGroup.toSubtractionMonoid
simp only [involute_ι, Subalgebra.coe_neg, toEven_ι, reverse.map_mul, reverse_v, reverse_e0,
reverse_ι, neg_e0_mul_v, map_neg]
- | h_mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
- | h_add x y hx hy =>
+ | mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
+ | add x y hx hy =>
-- TODO: The `()` around `map_add` are a regression from leanprover/lean4#2478
rw [map_add, map_add]
erw [RingHom.map_add, RingHom.map_add]
refine
s (#10762)
I replaced a few "terminal" refine/refine'
s with exact
.
The strategy was very simple-minded: essentially any refine
whose following line had smaller indentation got replaced by exact
and then I cleaned up the mess.
This PR certainly leaves some further terminal refine
s, but maybe the current change is beneficial.
@@ -182,7 +182,7 @@ theorem ofEven_ι (x y : M × R) :
lift_lets
intro f
-- TODO: replacing `?_` with `_` takes way longer?
- refine @even.lift_ι R (M × R) _ _ _ (Q' Q) _ _ _ ⟨f, ?_, ?_⟩ x y
+ exact @even.lift_ι R (M × R) _ _ _ (Q' Q) _ _ _ ⟨f, ?_, ?_⟩ x y
#align clifford_algebra.of_even_ι CliffordAlgebra.ofEven_ι
theorem toEven_comp_ofEven : (toEven Q).comp (ofEven Q) = AlgHom.id R _ :=
@@ -139,7 +139,7 @@ def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
@[simp]
theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q * v Q m := by
rw [toEven, CliffordAlgebra.lift_ι_apply]
- -- porting note: was `rw`
+ -- Porting note (#10691): was `rw`
erw [LinearMap.codRestrict_apply]
rw [LinearMap.coe_comp, Function.comp_apply, LinearMap.mulLeft_apply]
#align clifford_algebra.to_even_ι CliffordAlgebra.toEven_ι
The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun
instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike
is EquivLike
, since that has a custom coe_injective'
field that is easier to implement. All other classes should take FunLike
or EquivLike
as a parameter.
Previously, morphism classes would be Type
-valued and extend FunLike
:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
After this PR, they should be Prop
-valued and take FunLike
as a parameter:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
[FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
(Note that A B
stay marked as outParam
even though they are not purely required to be so due to the FunLike
parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam
is slightly faster.)
Similarly, MyEquivClass
should take EquivLike
as a parameter.
As a result, every mention of [MyHomClass F A B]
should become [FunLike F A B] [MyHomClass F A B]
.
While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul
is more expensive. This is due to suboptimal processing of arguments. For example:
variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)
theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y
example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _
Before this PR, applying map_mul f
gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Since M
and N
are out_param
s, [MulHomClass F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found.
After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Now [FunLike F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found, before trying MulHomClass F M N
which fails. Since the Mul
hierarchy is very big, this can be slow to fail, especially when there is no such Mul
instance.
A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul
to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N]
because MulHomClass
fails or succeeds much faster than the others.
As a consequence, the simpNF
linter is much slower since by design it tries and fails to apply many map_
lemmas. The same issue occurs a few times in existing calls to simp [map_mul]
, where map_mul
is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.
simp
not firing sometimesThis affects map_smulₛₗ
and related definitions. For simp
lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw
can find every argument to map_smulₛₗ
successfully but simp
can't: leanprover/lean4#3701.
Especially in the category theory library, we might sometimes have a type A
which is also accessible as a synonym (Bundled A hA).1
. Instance synthesis doesn't always work if we have f : A →* B
but x * y : (Bundled A hA).1
or vice versa. This seems to be mostly fixed by keeping A B
as outParam
s in MulHomClass F A B
. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1
instead of using the syntax in the discrimination tree.)
The timeouts can be worked around for now by specifying which map_mul
we mean, either as map_mul f
for some explicit f
, or as e.g. MonoidHomClass.map_mul
.
map_smulₛₗ
not firing as simp
lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ
a simp
lemma instead of the generic map_smulₛₗ
. Writing simp [map_smulₛₗ _]
also works.
Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -256,6 +256,11 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
| h_mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
| h_add x y hx hy =>
-- TODO: The `()` around `map_add` are a regression from leanprover/lean4#2478
+ rw [map_add, map_add]
+ erw [RingHom.map_add, RingHom.map_add]
+ dsimp
+ -- The line below used to be sufficient but we need to use `RingHom.map_add` to avoid a timeout
+ -- and it only unifies at `default` transparency #8386
simp only [(map_add), Subalgebra.coe_add, hx, hy]
#align clifford_algebra.coe_to_even_reverse_involute CliffordAlgebra.coe_toEven_reverse_involute
@@ -270,7 +275,9 @@ def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
letI : HasDistribNeg (even Q') := NonUnitalNonAssocRing.toHasDistribNeg;
{ bilin := -(even.ι Q' : _).bilin
contract := fun m => by
- simp_rw [LinearMap.neg_apply, EvenHom.contract, h, QuadraticForm.neg_apply, map_neg,
+ -- Not sure what causes the timeout with unqualified `map_neg`,
+ -- the synthInstance trace looks okay #8386
+ simp_rw [LinearMap.neg_apply, EvenHom.contract, h, QuadraticForm.neg_apply, RingHom.map_neg,
neg_neg]
contract_mid := fun m₁ m₂ m₃ => by
simp_rw [LinearMap.neg_apply, neg_mul_neg, EvenHom.contract_mid, h,
@@ -289,7 +296,9 @@ theorem evenToNeg_comp_evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) (h' : Q
ext m₁ m₂ : 4
dsimp only [EvenHom.compr₂_bilin, LinearMap.compr₂_apply, AlgHom.toLinearMap_apply,
AlgHom.comp_apply, AlgHom.id_apply]
- rw [evenToNeg_ι, map_neg, evenToNeg_ι, neg_neg]
+ rw [evenToNeg_ι]
+ -- Needed to use `RingHom.map_neg` to avoid a timeout and now `erw` #8386
+ erw [RingHom.map_neg, evenToNeg_ι, neg_neg]
#align clifford_algebra.even_to_neg_comp_even_to_neg CliffordAlgebra.evenToNeg_comp_evenToNeg
/-- The even subalgebras of the algebras with quadratic form `Q` and `-Q` are isomorphic.
With multiple changes, it is a good time to check if existing set_option maxHeartbeats
and set_option synthInstance.maxHeartbeats
remain necessary. This brings the number of files with such down from 23 to 9. Most are straight deletions though I did change one proof.
@@ -241,7 +241,6 @@ def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (Q' Q) :=
-- Note: times out on linting CI
attribute [nolint simpNF] equivEven_symm_apply
-set_option synthInstance.maxHeartbeats 30000 in
/-- The representation of the clifford conjugate (i.e. the reverse of the involute) in the even
subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
@@ -262,7 +261,6 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
/-! ### Constructions needed for `CliffordAlgebra.evenEquivEvenNeg` -/
-set_option synthInstance.maxHeartbeats 30000 in
/-- One direction of `CliffordAlgebra.evenEquivEvenNeg` -/
def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
CliffordAlgebra.even Q →ₐ[R] CliffordAlgebra.even Q' :=
@@ -286,7 +284,6 @@ theorem evenToNeg_ι (Q' : QuadraticForm R M) (h : Q' = -Q) (m₁ m₂ : M) :
even.lift_ι _ _ m₁ m₂
#align clifford_algebra.even_to_neg_ι CliffordAlgebra.evenToNeg_ι
-set_option synthInstance.maxHeartbeats 100000 in
theorem evenToNeg_comp_evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) (h' : Q = -Q') :
(evenToNeg Q' Q h').comp (evenToNeg Q Q' h) = AlgHom.id R _ := by
ext m₁ m₂ : 4
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
@@ -255,7 +255,9 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
simp only [involute_ι, Subalgebra.coe_neg, toEven_ι, reverse.map_mul, reverse_v, reverse_e0,
reverse_ι, neg_e0_mul_v, map_neg]
| h_mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
- | h_add x y hx hy => simp only [map_add, Subalgebra.coe_add, hx, hy]
+ | h_add x y hx hy =>
+ -- TODO: The `()` around `map_add` are a regression from leanprover/lean4#2478
+ simp only [(map_add), Subalgebra.coe_add, hx, hy]
#align clifford_algebra.coe_to_even_reverse_involute CliffordAlgebra.coe_toEven_reverse_involute
/-! ### Constructions needed for `CliffordAlgebra.evenEquivEvenNeg` -/
cases x with | ...
instead of cases x; case => ...
(#9321)
This converts usages of the pattern
cases h
case inl h' => ...
case inr h' => ...
which derive from mathported code, to the "structured cases
" syntax:
cases h with
| inl h' => ...
| inr h' => ...
The case where the subgoals are handled with ·
instead of case
is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases'
, induction
, induction'
, and rcases
. Furthermore, there is a similar transformation for by_cases
:
by_cases h : cond
case pos => ...
case neg => ...
is replaced by:
if h : cond then
...
else
...
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -247,15 +247,15 @@ subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
↑(toEven Q (reverse (involute x))) =
reverse (Q := Q' Q) (toEven Q x : CliffordAlgebra (Q' Q)) := by
- induction x using CliffordAlgebra.induction
- case h_grade0 r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
- case h_grade1 m =>
+ induction x using CliffordAlgebra.induction with
+ | h_grade0 r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
+ | h_grade1 m =>
-- porting note: added `letI`
letI : SubtractionMonoid (even (Q' Q)) := AddGroup.toSubtractionMonoid
simp only [involute_ι, Subalgebra.coe_neg, toEven_ι, reverse.map_mul, reverse_v, reverse_e0,
reverse_ι, neg_e0_mul_v, map_neg]
- case h_mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
- case h_add x y hx hy => simp only [map_add, Subalgebra.coe_add, hx, hy]
+ | h_mul x y hx hy => simp only [map_mul, Subalgebra.coe_mul, reverse.map_mul, hx, hy]
+ | h_add x y hx hy => simp only [map_add, Subalgebra.coe_add, hx, hy]
#align clifford_algebra.coe_to_even_reverse_involute CliffordAlgebra.coe_toEven_reverse_involute
/-! ### Constructions needed for `CliffordAlgebra.evenEquivEvenNeg` -/
Currently in Mathlib there is no class for magma that are commutative but not associative - Field
extends CommRing
and DivisionRing
, CommRing
extends Ring
and CommMonoid
, CommGroup
extends Group
and CommMonoid
and CommMonoid
extends CommSemigroup
and Monoid
. CommSemigroup
currently extends only Semigroup
and has mul_comm
as a property.
This PR moves mul_comm
into a new CommMagma
(AddCommMagma
) class which extends Mul
(Add
). CommSemigroup
now extends Semigroup
and CommMagma
.
The rest of Mathlib4 compiles as before, except with the need to increase synthInstance.maxHeartbeats
for lift_of_splits
.
(Update: The linter is objecting to an unused argument in what seems to be a completely unrelated bit of code (AddEquiv.lpPiLp
). Trying a nolint
for now.)
Also referenced in https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60add_comm.60.20without.20.60add_assoc.60
Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com> Co-authored-by: Christopher Hoskin <christopher.hoskin@overleaf.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -241,6 +241,7 @@ def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (Q' Q) :=
-- Note: times out on linting CI
attribute [nolint simpNF] equivEven_symm_apply
+set_option synthInstance.maxHeartbeats 30000 in
/-- The representation of the clifford conjugate (i.e. the reverse of the involute) in the even
subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
@@ -259,6 +260,7 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
/-! ### Constructions needed for `CliffordAlgebra.evenEquivEvenNeg` -/
+set_option synthInstance.maxHeartbeats 30000 in
/-- One direction of `CliffordAlgebra.evenEquivEvenNeg` -/
def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
CliffordAlgebra.even Q →ₐ[R] CliffordAlgebra.even Q' :=
This removes redundant field values of the form add := add
for smaller terms and less unfolding during unification.
A list of all files containing a structure instance of the form { a1, ... with x1 := val, ... }
where some xi
is a field of some aj
was generated by modifying the structure instance elaboration algorithm to print such overlaps to stdout in a custom toolchain.
Using that toolchain, I went through each file on the list and attempted to remove algebraic fields that overlapped and were redundant, eg add := add
and not toFun
(though some other ones did creep in). If things broke (which was the case in a couple of cases), I did not push further and reverted.
It is possible that pushing harder and trying to remove all redundant overlaps will yield further improvements.
@@ -238,6 +238,9 @@ def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (Q' Q) :=
AlgEquiv.ofAlgHom (toEven Q) (ofEven Q) (toEven_comp_ofEven Q) (ofEven_comp_toEven Q)
#align clifford_algebra.equiv_even CliffordAlgebra.equivEven
+-- Note: times out on linting CI
+attribute [nolint simpNF] equivEven_symm_apply
+
/-- The representation of the clifford conjugate (i.e. the reverse of the involute) in the even
subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
@@ -297,4 +300,7 @@ def evenEquivEvenNeg : CliffordAlgebra.even Q ≃ₐ[R] CliffordAlgebra.even (-Q
(evenToNeg_comp_evenToNeg _ _ _ _) (evenToNeg_comp_evenToNeg _ _ _ _)
#align clifford_algebra.even_equiv_even_neg CliffordAlgebra.evenEquivEvenNeg
+-- Note: times out on linting CI
+attribute [nolint simpNF] evenEquivEvenNeg_apply evenEquivEvenNeg_symm_apply
+
end CliffordAlgebra
@@ -19,7 +19,7 @@ This file provides some notable isomorphisms regarding the even subalgebra, `Cli
* `CliffordAlgebra.equivEven`: Every Clifford algebra is isomorphic as an algebra to the even
subalgebra of a Clifford algebra with one more dimension.
- * `clifford_algebra.even_equiv.Q'`: The quadratic form used by this "one-up" algebra.
+ * `CliffordAlgebra.EquivEven.Q'`: The quadratic form used by this "one-up" algebra.
* `CliffordAlgebra.toEven`: The simp-normal form of the forward direction of this isomorphism.
* `CliffordAlgebra.ofEven`: The simp-normal form of the reverse direction of this isomorphism.
@@ -126,7 +126,7 @@ open EquivEven
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
· refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
- exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
+ · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
rw [Subtype.coe_mk, pow_two]
exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
· ext1
@@ -141,7 +141,7 @@ theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q
rw [toEven, CliffordAlgebra.lift_ι_apply]
-- porting note: was `rw`
erw [LinearMap.codRestrict_apply]
- rfl
+ rw [LinearMap.coe_comp, Function.comp_apply, LinearMap.mulLeft_apply]
#align clifford_algebra.to_even_ι CliffordAlgebra.toEven_ι
/-- The embedding from the even subalgebra with an extra dimension into the original algebra. -/
@@ -256,7 +256,6 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
/-! ### Constructions needed for `CliffordAlgebra.evenEquivEvenNeg` -/
-set_option maxHeartbeats 300000 in
/-- One direction of `CliffordAlgebra.evenEquivEvenNeg` -/
def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
CliffordAlgebra.even Q →ₐ[R] CliffordAlgebra.even Q' :=
@@ -256,7 +256,7 @@ theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
/-! ### Constructions needed for `CliffordAlgebra.evenEquivEvenNeg` -/
-set_option maxHeartbeats 400000 in
+set_option maxHeartbeats 300000 in
/-- One direction of `CliffordAlgebra.evenEquivEvenNeg` -/
def evenToNeg (Q' : QuadraticForm R M) (h : Q' = -Q) :
CliffordAlgebra.even Q →ₐ[R] CliffordAlgebra.even Q' :=
Q := Q
(#6780)
The removal of a FunLike instance for Module.Dual
made these unnecessary.
@@ -241,7 +241,7 @@ def equivEven : CliffordAlgebra Q ≃ₐ[R] CliffordAlgebra.even (Q' Q) :=
/-- The representation of the clifford conjugate (i.e. the reverse of the involute) in the even
subalgebra is just the reverse of the representation. -/
theorem coe_toEven_reverse_involute (x : CliffordAlgebra Q) :
- ↑(toEven Q (reverse (Q := Q) (involute x))) =
+ ↑(toEven Q (reverse (involute x))) =
reverse (Q := Q' Q) (toEven Q x : CliffordAlgebra (Q' Q)) := by
induction x using CliffordAlgebra.induction
case h_grade0 r => simp only [AlgHom.commutes, Subalgebra.coe_algebraMap, reverse.commutes]
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -84,7 +84,7 @@ theorem v_sq_scalar (m : M) : v Q m * v Q m = algebraMap _ _ (Q m) :=
theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by
refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
dsimp [QuadraticForm.polar]
- simp only [add_zero, MulZeroClass.mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
+ simp only [add_zero, mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
add_sub_cancel, sub_self, map_zero, zero_sub]
#align clifford_algebra.equiv_even.neg_e0_mul_v CliffordAlgebra.EquivEven.neg_e0_mul_v
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -37,7 +37,7 @@ This file provides some notable isomorphisms regarding the even subalgebra, `Cli
namespace CliffordAlgebra
-variable {R M : Type _} [CommRing R] [AddCommGroup M] [Module R M]
+variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
variable (Q : QuadraticForm R M)
@@ -2,17 +2,14 @@
Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module linear_algebra.clifford_algebra.even_equiv
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathlib.LinearAlgebra.CliffordAlgebra.Even
import Mathlib.LinearAlgebra.QuadraticForm.Prod
import Mathlib.Tactic.LiftLets
+#align_import linear_algebra.clifford_algebra.even_equiv from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
+
/-!
# Isomorphisms with the even subalgebra of a Clifford algebra
lift_lets
not descend into proofs or let
-less subexpressions (#5772)
This helps keep lift_lets
from unnecessarily doing deep recursion on deep expressions. Whether to descend into proofs is put behind a configuration option.
@@ -182,12 +182,8 @@ theorem ofEven_ι (x y : M × R) :
(ι Q x.1 + algebraMap R _ x.2) * (ι Q y.1 - algebraMap R _ y.2) := by
-- porting note: entire proof was the term-mode `even.lift_ι (Q' Q) _ x y`
unfold ofEven
- -- TODO: `lift_lets` gives a deep recursion error if we try to use it here
- let f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
- ((Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
- (ι Q).comp (LinearMap.fst _ _ _) +
- (Algebra.linearMap R _).comp (LinearMap.snd _ _ _)).compl₂
- ((ι Q).comp (LinearMap.fst _ _ _) - (Algebra.linearMap R _).comp (LinearMap.snd _ _ _))
+ lift_lets
+ intro f
-- TODO: replacing `?_` with `_` takes way longer?
refine @even.lift_ι R (M × R) _ _ _ (Q' Q) _ _ _ ⟨f, ?_, ?_⟩ x y
#align clifford_algebra.of_even_ι CliffordAlgebra.ofEven_ι
The unported dependencies are