linear_algebra.tensor_algebra.basic
⟷
Mathlib.LinearAlgebra.TensorAlgebra.Basic
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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
@@ -168,7 +168,7 @@ theorem lift_comp_ι {A : Type _} [Semiring A] [Algebra R A] (g : TensorAlgebra
theorem hom_ext {A : Type _} [Semiring A] [Algebra R A] {f g : TensorAlgebra R M →ₐ[R] A}
(w : f.toLinearMap.comp (ι R) = g.toLinearMap.comp (ι R)) : f = g :=
by
- rw [← lift_symm_apply, ← lift_symm_apply] at w
+ rw [← lift_symm_apply, ← lift_symm_apply] at w
exact (lift R).symm.Injective w
#align tensor_algebra.hom_ext TensorAlgebra.hom_ext
-/
@@ -303,7 +303,7 @@ theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x =
· letI : Module Rᵐᵒᵖ M := Module.compHom _ ((RingHom.id R).fromOpposite mul_comm)
haveI : IsCentralScalar R M := ⟨fun r m => rfl⟩
have hf0 : to_triv_sq_zero_ext (ι R x) = (0, x) := lift_ι_apply _ _
- rw [h, AlgHom.commutes] at hf0
+ rw [h, AlgHom.commutes] at hf0
have : r = 0 ∧ 0 = x := Prod.ext_iff.1 hf0
exact this.symm.imp_left Eq.symm
· rintro ⟨rfl, rfl⟩
@@ -328,7 +328,7 @@ theorem ι_range_disjoint_one :
by
rw [Submodule.disjoint_def]
rintro _ ⟨x, hx⟩ ⟨r, rfl : algebraMap _ _ _ = _⟩
- rw [ι_eq_algebra_map_iff x] at hx
+ rw [ι_eq_algebra_map_iff x] at hx
rw [hx.2, RingHom.map_zero]
#align tensor_algebra.ι_range_disjoint_one TensorAlgebra.ι_range_disjoint_one
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2020 Adam Topaz. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
-/
-import Mathbin.Algebra.FreeAlgebra
-import Mathbin.Algebra.RingQuot
-import Mathbin.Algebra.TrivSqZeroExt
-import Mathbin.Algebra.Algebra.Operations
-import Mathbin.LinearAlgebra.Multilinear.Basic
+import Algebra.FreeAlgebra
+import Algebra.RingQuot
+import Algebra.TrivSqZeroExt
+import Algebra.Algebra.Operations
+import LinearAlgebra.Multilinear.Basic
#align_import linear_algebra.tensor_algebra.basic from "leanprover-community/mathlib"@"7e5137f579de09a059a5ce98f364a04e221aabf0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -187,7 +187,7 @@ theorem induction {C : TensorAlgebra R M → Prop}
-- the arguments are enough to construct a subalgebra, and a mapping into it from M
let s : Subalgebra R (TensorAlgebra R M) :=
{ carrier := C
- mul_mem' := h_mul
+ hMul_mem' := h_mul
add_mem' := h_add
algebraMap_mem' := h_grade0 }
let of : M →ₗ[R] s := (ι R).codRestrict s.to_submodule h_grade1
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2020 Adam Topaz. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
-
-! This file was ported from Lean 3 source module linear_algebra.tensor_algebra.basic
-! leanprover-community/mathlib commit 7e5137f579de09a059a5ce98f364a04e221aabf0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.FreeAlgebra
import Mathbin.Algebra.RingQuot
@@ -14,6 +9,8 @@ import Mathbin.Algebra.TrivSqZeroExt
import Mathbin.Algebra.Algebra.Operations
import Mathbin.LinearAlgebra.Multilinear.Basic
+#align_import linear_algebra.tensor_algebra.basic from "leanprover-community/mathlib"@"7e5137f579de09a059a5ce98f364a04e221aabf0"
+
/-!
# Tensor Algebras
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -85,6 +85,7 @@ instance {S : Type _} [CommRing S] [Module S M] : Ring (TensorAlgebra S M) :=
variable {M}
+#print TensorAlgebra.ι /-
/-- The canonical linear map `M →ₗ[R] tensor_algebra R M`.
-/
irreducible_def ι : M →ₗ[R] TensorAlgebra R M :=
@@ -92,11 +93,15 @@ irreducible_def ι : M →ₗ[R] TensorAlgebra R M :=
map_add' := fun x y => by rw [← AlgHom.map_add]; exact RingQuot.mkAlgHom_rel R rel.add
map_smul' := fun r x => by rw [← AlgHom.map_smul]; exact RingQuot.mkAlgHom_rel R rel.smul }
#align tensor_algebra.ι TensorAlgebra.ι
+-/
+#print TensorAlgebra.ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι /-
theorem ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι (m : M) :
RingQuot.mkAlgHom R (Rel R M) (FreeAlgebra.ι R m) = ι R m := by rw [ι]; rfl
#align tensor_algebra.ring_quot_mk_alg_hom_free_algebra_ι_eq_ι TensorAlgebra.ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι
+-/
+#print TensorAlgebra.lift /-
/-- Given a linear map `f : M → A` where `A` is an `R`-algebra, `lift R f` is the unique lift
of `f` to a morphism of `R`-algebras `tensor_algebra R M → A`.
-/
@@ -122,26 +127,34 @@ irreducible_def lift {A : Type _} [Semiring A] [Algebra R A] :
exact
(RingQuot.liftAlgHom_mkAlgHom_apply _ _ _ _).trans (FreeAlgebra.lift_ι_apply _ _) }
#align tensor_algebra.lift TensorAlgebra.lift
+-/
variable {R}
+#print TensorAlgebra.ι_comp_lift /-
@[simp]
theorem ι_comp_lift {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
(lift R f).toLinearMap.comp (ι R) = f := by convert (lift R).symm_apply_apply f;
simp only [lift, Equiv.coe_fn_symm_mk]
#align tensor_algebra.ι_comp_lift TensorAlgebra.ι_comp_lift
+-/
+#print TensorAlgebra.lift_ι_apply /-
@[simp]
theorem lift_ι_apply {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) (x) :
lift R f (ι R x) = f x := by conv_rhs => rw [← ι_comp_lift f]; rfl
#align tensor_algebra.lift_ι_apply TensorAlgebra.lift_ι_apply
+-/
+#print TensorAlgebra.lift_unique /-
@[simp]
theorem lift_unique {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A)
(g : TensorAlgebra R M →ₐ[R] A) : g.toLinearMap.comp (ι R) = f ↔ g = lift R f := by
rw [← (lift R).symm_apply_eq]; simp only [lift, Equiv.coe_fn_symm_mk]
#align tensor_algebra.lift_unique TensorAlgebra.lift_unique
+-/
+#print TensorAlgebra.lift_comp_ι /-
-- Marking `tensor_algebra` irreducible makes `ring` instances inaccessible on quotients.
-- https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/algebra.2Esemiring_to_ring.20breaks.20semimodule.20typeclass.20lookup/near/212580241
-- For now, we avoid this by not marking it irreducible.
@@ -150,7 +163,9 @@ theorem lift_comp_ι {A : Type _} [Semiring A] [Algebra R A] (g : TensorAlgebra
lift R (g.toLinearMap.comp (ι R)) = g := by rw [← lift_symm_apply];
exact (lift R).apply_symm_apply g
#align tensor_algebra.lift_comp_ι TensorAlgebra.lift_comp_ι
+-/
+#print TensorAlgebra.hom_ext /-
/-- See note [partially-applied ext lemmas]. -/
@[ext]
theorem hom_ext {A : Type _} [Semiring A] [Algebra R A] {f g : TensorAlgebra R M →ₐ[R] A}
@@ -159,7 +174,9 @@ theorem hom_ext {A : Type _} [Semiring A] [Algebra R A] {f g : TensorAlgebra R M
rw [← lift_symm_apply, ← lift_symm_apply] at w
exact (lift R).symm.Injective w
#align tensor_algebra.hom_ext TensorAlgebra.hom_ext
+-/
+#print TensorAlgebra.induction /-
-- This proof closely follows `free_algebra.induction`
/-- If `C` holds for the `algebra_map` of `r : R` into `tensor_algebra R M`, the `ι` of `x : M`,
and is preserved under addition and muliplication, then it holds for all of `tensor_algebra R M`.
@@ -186,50 +203,66 @@ theorem induction {C : TensorAlgebra R M → Prop}
convert Subtype.prop (lift R of a)
exact AlgHom.congr_fun of_id a
#align tensor_algebra.induction TensorAlgebra.induction
+-/
+#print TensorAlgebra.algebraMapInv /-
/-- The left-inverse of `algebra_map`. -/
def algebraMapInv : TensorAlgebra R M →ₐ[R] R :=
lift R (0 : M →ₗ[R] R)
#align tensor_algebra.algebra_map_inv TensorAlgebra.algebraMapInv
+-/
variable (M)
+#print TensorAlgebra.algebraMap_leftInverse /-
theorem algebraMap_leftInverse :
Function.LeftInverse algebraMapInv (algebraMap R <| TensorAlgebra R M) := fun x => by
simp [algebra_map_inv]
#align tensor_algebra.algebra_map_left_inverse TensorAlgebra.algebraMap_leftInverse
+-/
+#print TensorAlgebra.algebraMap_inj /-
@[simp]
theorem algebraMap_inj (x y : R) :
algebraMap R (TensorAlgebra R M) x = algebraMap R (TensorAlgebra R M) y ↔ x = y :=
(algebraMap_leftInverse M).Injective.eq_iff
#align tensor_algebra.algebra_map_inj TensorAlgebra.algebraMap_inj
+-/
+#print TensorAlgebra.algebraMap_eq_zero_iff /-
@[simp]
theorem algebraMap_eq_zero_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 0 ↔ x = 0 :=
map_eq_zero_iff (algebraMap _ _) (algebraMap_leftInverse _).Injective
#align tensor_algebra.algebra_map_eq_zero_iff TensorAlgebra.algebraMap_eq_zero_iff
+-/
+#print TensorAlgebra.algebraMap_eq_one_iff /-
@[simp]
theorem algebraMap_eq_one_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 1 ↔ x = 1 :=
map_eq_one_iff (algebraMap _ _) (algebraMap_leftInverse _).Injective
#align tensor_algebra.algebra_map_eq_one_iff TensorAlgebra.algebraMap_eq_one_iff
+-/
variable {M}
+#print TensorAlgebra.toTrivSqZeroExt /-
/-- The canonical map from `tensor_algebra R M` into `triv_sq_zero_ext R M` that sends
`tensor_algebra.ι` to `triv_sq_zero_ext.inr`. -/
def toTrivSqZeroExt [Module Rᵐᵒᵖ M] [IsCentralScalar R M] :
TensorAlgebra R M →ₐ[R] TrivSqZeroExt R M :=
lift R (TrivSqZeroExt.inrHom R M)
#align tensor_algebra.to_triv_sq_zero_ext TensorAlgebra.toTrivSqZeroExt
+-/
+#print TensorAlgebra.toTrivSqZeroExt_ι /-
@[simp]
theorem toTrivSqZeroExt_ι (x : M) [Module Rᵐᵒᵖ M] [IsCentralScalar R M] :
toTrivSqZeroExt (ι R x) = TrivSqZeroExt.inr x :=
lift_ι_apply _ _
#align tensor_algebra.to_triv_sq_zero_ext_ι TensorAlgebra.toTrivSqZeroExt_ι
+-/
+#print TensorAlgebra.ιInv /-
/-- The left-inverse of `ι`.
As an implementation detail, we implement this using `triv_sq_zero_ext` which has a suitable
@@ -240,24 +273,32 @@ def ιInv : TensorAlgebra R M →ₗ[R] M :=
haveI : IsCentralScalar R M := ⟨fun r m => rfl⟩
exact (TrivSqZeroExt.sndHom R M).comp to_triv_sq_zero_ext.to_linear_map
#align tensor_algebra.ι_inv TensorAlgebra.ιInv
+-/
+#print TensorAlgebra.ι_leftInverse /-
theorem ι_leftInverse : Function.LeftInverse ιInv (ι R : M → TensorAlgebra R M) := fun x => by
simp [ι_inv]
#align tensor_algebra.ι_left_inverse TensorAlgebra.ι_leftInverse
+-/
variable (R)
+#print TensorAlgebra.ι_inj /-
@[simp]
theorem ι_inj (x y : M) : ι R x = ι R y ↔ x = y :=
ι_leftInverse.Injective.eq_iff
#align tensor_algebra.ι_inj TensorAlgebra.ι_inj
+-/
+#print TensorAlgebra.ι_eq_zero_iff /-
@[simp]
theorem ι_eq_zero_iff (x : M) : ι R x = 0 ↔ x = 0 := by rw [← ι_inj R x 0, LinearMap.map_zero]
#align tensor_algebra.ι_eq_zero_iff TensorAlgebra.ι_eq_zero_iff
+-/
variable {R}
+#print TensorAlgebra.ι_eq_algebraMap_iff /-
@[simp]
theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x = 0 ∧ r = 0 :=
by
@@ -271,14 +312,18 @@ theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x =
· rintro ⟨rfl, rfl⟩
rw [LinearMap.map_zero, RingHom.map_zero]
#align tensor_algebra.ι_eq_algebra_map_iff TensorAlgebra.ι_eq_algebraMap_iff
+-/
+#print TensorAlgebra.ι_ne_one /-
@[simp]
theorem ι_ne_one [Nontrivial R] (x : M) : ι R x ≠ 1 :=
by
rw [← (algebraMap R (TensorAlgebra R M)).map_one, Ne.def, ι_eq_algebra_map_iff]
exact one_ne_zero ∘ And.right
#align tensor_algebra.ι_ne_one TensorAlgebra.ι_ne_one
+-/
+#print TensorAlgebra.ι_range_disjoint_one /-
/-- The generators of the tensor algebra are disjoint from its scalars. -/
theorem ι_range_disjoint_one :
Disjoint (LinearMap.range (ι R : M →ₗ[R] TensorAlgebra R M))
@@ -289,20 +334,25 @@ theorem ι_range_disjoint_one :
rw [ι_eq_algebra_map_iff x] at hx
rw [hx.2, RingHom.map_zero]
#align tensor_algebra.ι_range_disjoint_one TensorAlgebra.ι_range_disjoint_one
+-/
variable (R M)
+#print TensorAlgebra.tprod /-
/-- Construct a product of `n` elements of the module within the tensor algebra.
See also `pi_tensor_product.tprod`. -/
def tprod (n : ℕ) : MultilinearMap R (fun i : Fin n => M) (TensorAlgebra R M) :=
(MultilinearMap.mkPiAlgebraFin R n (TensorAlgebra R M)).compLinearMap fun _ => ι R
#align tensor_algebra.tprod TensorAlgebra.tprod
+-/
+#print TensorAlgebra.tprod_apply /-
@[simp]
theorem tprod_apply {n : ℕ} (x : Fin n → M) : tprod R M n x = (List.ofFn fun i => ι R (x i)).Prod :=
rfl
#align tensor_algebra.tprod_apply TensorAlgebra.tprod_apply
+-/
variable {R M}
@@ -312,16 +362,20 @@ namespace FreeAlgebra
variable {R M}
+#print FreeAlgebra.toTensor /-
/-- The canonical image of the `free_algebra` in the `tensor_algebra`, which maps
`free_algebra.ι R x` to `tensor_algebra.ι R x`. -/
def toTensor : FreeAlgebra R M →ₐ[R] TensorAlgebra R M :=
FreeAlgebra.lift R (TensorAlgebra.ι R)
#align free_algebra.to_tensor FreeAlgebra.toTensor
+-/
+#print FreeAlgebra.toTensor_ι /-
@[simp]
theorem toTensor_ι (m : M) : (FreeAlgebra.ι R m).toTensor = TensorAlgebra.ι R m := by
simp [to_tensor]
#align free_algebra.to_tensor_ι FreeAlgebra.toTensor_ι
+-/
end FreeAlgebra
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
! This file was ported from Lean 3 source module linear_algebra.tensor_algebra.basic
-! leanprover-community/mathlib commit b8d2eaa69d69ce8f03179a5cda774fc0cde984e4
+! leanprover-community/mathlib commit 7e5137f579de09a059a5ce98f364a04e221aabf0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -17,6 +17,9 @@ import Mathbin.LinearAlgebra.Multilinear.Basic
/-!
# Tensor Algebras
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
Given a commutative semiring `R`, and an `R`-module `M`, we construct the tensor algebra of `M`.
This is the free `R`-algebra generated (`R`-linearly) by the module `M`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/58a272265b5e05f258161260dd2c5d247213cbd3
@@ -49,6 +49,7 @@ variable (M : Type _) [AddCommMonoid M] [Module R M]
namespace TensorAlgebra
+#print TensorAlgebra.Rel /-
/-- An inductively defined relation on `pre R M` used to force the initial algebra structure on
the associated quotient.
-/
@@ -59,10 +60,12 @@ inductive Rel : FreeAlgebra R M → FreeAlgebra R M → Prop-- force `ι` to be
smul {r : R} {a : M} :
Rel (FreeAlgebra.ι R (r • a)) (algebraMap R (FreeAlgebra R M) r * FreeAlgebra.ι R a)
#align tensor_algebra.rel TensorAlgebra.Rel
+-/
end TensorAlgebra
/- ./././Mathport/Syntax/Translate/Command.lean:43:9: unsupported derive handler algebra[algebra] R -/
+#print TensorAlgebra /-
/-- The tensor algebra of the module `M` over the commutative semiring `R`.
-/
def TensorAlgebra :=
@@ -70,6 +73,7 @@ def TensorAlgebra :=
deriving Inhabited, Semiring,
«./././Mathport/Syntax/Translate/Command.lean:43:9: unsupported derive handler algebra[algebra] R»
#align tensor_algebra TensorAlgebra
+-/
namespace TensorAlgebra
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -62,13 +62,13 @@ inductive Rel : FreeAlgebra R M → FreeAlgebra R M → Prop-- force `ι` to be
end TensorAlgebra
-/- ./././Mathport/Syntax/Translate/Command.lean:42:9: unsupported derive handler algebra[algebra] R -/
+/- ./././Mathport/Syntax/Translate/Command.lean:43:9: unsupported derive handler algebra[algebra] R -/
/-- The tensor algebra of the module `M` over the commutative semiring `R`.
-/
def TensorAlgebra :=
RingQuot (TensorAlgebra.Rel R M)
deriving Inhabited, Semiring,
- «./././Mathport/Syntax/Translate/Command.lean:42:9: unsupported derive handler algebra[algebra] R»
+ «./././Mathport/Syntax/Translate/Command.lean:43:9: unsupported derive handler algebra[algebra] R»
#align tensor_algebra TensorAlgebra
namespace TensorAlgebra
@@ -95,7 +95,7 @@ of `f` to a morphism of `R`-algebras `tensor_algebra R M → A`.
-/
@[simps symm_apply]
irreducible_def lift {A : Type _} [Semiring A] [Algebra R A] :
- (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) :=
+ (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) :=
{ toFun :=
RingQuot.liftAlgHom R ∘ fun f =>
⟨FreeAlgebra.lift R ⇑f, fun x y (h : Rel R M x y) => by
@@ -120,7 +120,7 @@ variable {R}
@[simp]
theorem ι_comp_lift {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
- (lift R f).toLinearMap.comp (ι R) = f := by convert(lift R).symm_apply_apply f;
+ (lift R f).toLinearMap.comp (ι R) = f := by convert (lift R).symm_apply_apply f;
simp only [lift, Equiv.coe_fn_symm_mk]
#align tensor_algebra.ι_comp_lift TensorAlgebra.ι_comp_lift
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -66,7 +66,8 @@ end TensorAlgebra
/-- The tensor algebra of the module `M` over the commutative semiring `R`.
-/
def TensorAlgebra :=
- RingQuot (TensorAlgebra.Rel R M)deriving Inhabited, Semiring,
+ RingQuot (TensorAlgebra.Rel R M)
+deriving Inhabited, Semiring,
«./././Mathport/Syntax/Translate/Command.lean:42:9: unsupported derive handler algebra[algebra] R»
#align tensor_algebra TensorAlgebra
@@ -148,7 +149,7 @@ theorem lift_comp_ι {A : Type _} [Semiring A] [Algebra R A] (g : TensorAlgebra
theorem hom_ext {A : Type _} [Semiring A] [Algebra R A] {f g : TensorAlgebra R M →ₐ[R] A}
(w : f.toLinearMap.comp (ι R) = g.toLinearMap.comp (ι R)) : f = g :=
by
- rw [← lift_symm_apply, ← lift_symm_apply] at w
+ rw [← lift_symm_apply, ← lift_symm_apply] at w
exact (lift R).symm.Injective w
#align tensor_algebra.hom_ext TensorAlgebra.hom_ext
@@ -257,7 +258,7 @@ theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x =
· letI : Module Rᵐᵒᵖ M := Module.compHom _ ((RingHom.id R).fromOpposite mul_comm)
haveI : IsCentralScalar R M := ⟨fun r m => rfl⟩
have hf0 : to_triv_sq_zero_ext (ι R x) = (0, x) := lift_ι_apply _ _
- rw [h, AlgHom.commutes] at hf0
+ rw [h, AlgHom.commutes] at hf0
have : r = 0 ∧ 0 = x := Prod.ext_iff.1 hf0
exact this.symm.imp_left Eq.symm
· rintro ⟨rfl, rfl⟩
@@ -278,7 +279,7 @@ theorem ι_range_disjoint_one :
by
rw [Submodule.disjoint_def]
rintro _ ⟨x, hx⟩ ⟨r, rfl : algebraMap _ _ _ = _⟩
- rw [ι_eq_algebra_map_iff x] at hx
+ rw [ι_eq_algebra_map_iff x] at hx
rw [hx.2, RingHom.map_zero]
#align tensor_algebra.ι_range_disjoint_one TensorAlgebra.ι_range_disjoint_one
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -81,19 +81,12 @@ variable {M}
-/
irreducible_def ι : M →ₗ[R] TensorAlgebra R M :=
{ toFun := fun m => RingQuot.mkAlgHom R _ (FreeAlgebra.ι R m)
- map_add' := fun x y => by
- rw [← AlgHom.map_add]
- exact RingQuot.mkAlgHom_rel R rel.add
- map_smul' := fun r x => by
- rw [← AlgHom.map_smul]
- exact RingQuot.mkAlgHom_rel R rel.smul }
+ map_add' := fun x y => by rw [← AlgHom.map_add]; exact RingQuot.mkAlgHom_rel R rel.add
+ map_smul' := fun r x => by rw [← AlgHom.map_smul]; exact RingQuot.mkAlgHom_rel R rel.smul }
#align tensor_algebra.ι TensorAlgebra.ι
theorem ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι (m : M) :
- RingQuot.mkAlgHom R (Rel R M) (FreeAlgebra.ι R m) = ι R m :=
- by
- rw [ι]
- rfl
+ RingQuot.mkAlgHom R (Rel R M) (FreeAlgebra.ι R m) = ι R m := by rw [ι]; rfl
#align tensor_algebra.ring_quot_mk_alg_hom_free_algebra_ι_eq_ι TensorAlgebra.ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι
/-- Given a linear map `f : M → A` where `A` is an `R`-algebra, `lift R f` is the unique lift
@@ -126,25 +119,19 @@ variable {R}
@[simp]
theorem ι_comp_lift {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
- (lift R f).toLinearMap.comp (ι R) = f :=
- by
- convert(lift R).symm_apply_apply f
+ (lift R f).toLinearMap.comp (ι R) = f := by convert(lift R).symm_apply_apply f;
simp only [lift, Equiv.coe_fn_symm_mk]
#align tensor_algebra.ι_comp_lift TensorAlgebra.ι_comp_lift
@[simp]
theorem lift_ι_apply {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) (x) :
- lift R f (ι R x) = f x := by
- conv_rhs => rw [← ι_comp_lift f]
- rfl
+ lift R f (ι R x) = f x := by conv_rhs => rw [← ι_comp_lift f]; rfl
#align tensor_algebra.lift_ι_apply TensorAlgebra.lift_ι_apply
@[simp]
theorem lift_unique {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A)
- (g : TensorAlgebra R M →ₐ[R] A) : g.toLinearMap.comp (ι R) = f ↔ g = lift R f :=
- by
- rw [← (lift R).symm_apply_eq]
- simp only [lift, Equiv.coe_fn_symm_mk]
+ (g : TensorAlgebra R M →ₐ[R] A) : g.toLinearMap.comp (ι R) = f ↔ g = lift R f := by
+ rw [← (lift R).symm_apply_eq]; simp only [lift, Equiv.coe_fn_symm_mk]
#align tensor_algebra.lift_unique TensorAlgebra.lift_unique
-- Marking `tensor_algebra` irreducible makes `ring` instances inaccessible on quotients.
@@ -152,9 +139,7 @@ theorem lift_unique {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A)
-- For now, we avoid this by not marking it irreducible.
@[simp]
theorem lift_comp_ι {A : Type _} [Semiring A] [Algebra R A] (g : TensorAlgebra R M →ₐ[R] A) :
- lift R (g.toLinearMap.comp (ι R)) = g :=
- by
- rw [← lift_symm_apply]
+ lift R (g.toLinearMap.comp (ι R)) = g := by rw [← lift_symm_apply];
exact (lift R).apply_symm_apply g
#align tensor_algebra.lift_comp_ι TensorAlgebra.lift_comp_ι
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d
@@ -128,7 +128,7 @@ variable {R}
theorem ι_comp_lift {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
(lift R f).toLinearMap.comp (ι R) = f :=
by
- convert (lift R).symm_apply_apply f
+ convert(lift R).symm_apply_apply f
simp only [lift, Equiv.coe_fn_symm_mk]
#align tensor_algebra.ι_comp_lift TensorAlgebra.ι_comp_lift
mathlib commit https://github.com/leanprover-community/mathlib/commit/22131150f88a2d125713ffa0f4693e3355b1eb49
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
! This file was ported from Lean 3 source module linear_algebra.tensor_algebra.basic
-! leanprover-community/mathlib commit 565eb991e264d0db702722b4bde52ee5173c9950
+! leanprover-community/mathlib commit b8d2eaa69d69ce8f03179a5cda774fc0cde984e4
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -226,12 +226,14 @@ variable {M}
/-- The canonical map from `tensor_algebra R M` into `triv_sq_zero_ext R M` that sends
`tensor_algebra.ι` to `triv_sq_zero_ext.inr`. -/
-def toTrivSqZeroExt : TensorAlgebra R M →ₐ[R] TrivSqZeroExt R M :=
+def toTrivSqZeroExt [Module Rᵐᵒᵖ M] [IsCentralScalar R M] :
+ TensorAlgebra R M →ₐ[R] TrivSqZeroExt R M :=
lift R (TrivSqZeroExt.inrHom R M)
#align tensor_algebra.to_triv_sq_zero_ext TensorAlgebra.toTrivSqZeroExt
@[simp]
-theorem toTrivSqZeroExt_ι (x : M) : toTrivSqZeroExt (ι R x) = TrivSqZeroExt.inr x :=
+theorem toTrivSqZeroExt_ι (x : M) [Module Rᵐᵒᵖ M] [IsCentralScalar R M] :
+ toTrivSqZeroExt (ι R x) = TrivSqZeroExt.inr x :=
lift_ι_apply _ _
#align tensor_algebra.to_triv_sq_zero_ext_ι TensorAlgebra.toTrivSqZeroExt_ι
@@ -240,7 +242,10 @@ theorem toTrivSqZeroExt_ι (x : M) : toTrivSqZeroExt (ι R x) = TrivSqZeroExt.in
As an implementation detail, we implement this using `triv_sq_zero_ext` which has a suitable
algebra structure. -/
def ιInv : TensorAlgebra R M →ₗ[R] M :=
- (TrivSqZeroExt.sndHom R M).comp toTrivSqZeroExt.toLinearMap
+ by
+ letI : Module Rᵐᵒᵖ M := Module.compHom _ ((RingHom.id R).fromOpposite mul_comm)
+ haveI : IsCentralScalar R M := ⟨fun r m => rfl⟩
+ exact (TrivSqZeroExt.sndHom R M).comp to_triv_sq_zero_ext.to_linear_map
#align tensor_algebra.ι_inv TensorAlgebra.ιInv
theorem ι_leftInverse : Function.LeftInverse ιInv (ι R : M → TensorAlgebra R M) := fun x => by
@@ -264,7 +269,9 @@ variable {R}
theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x = 0 ∧ r = 0 :=
by
refine' ⟨fun h => _, _⟩
- · have hf0 : to_triv_sq_zero_ext (ι R x) = (0, x) := lift_ι_apply _ _
+ · letI : Module Rᵐᵒᵖ M := Module.compHom _ ((RingHom.id R).fromOpposite mul_comm)
+ haveI : IsCentralScalar R M := ⟨fun r m => rfl⟩
+ have hf0 : to_triv_sq_zero_ext (ι R x) = (0, x) := lift_ι_apply _ _
rw [h, AlgHom.commutes] at hf0
have : r = 0 ∧ 0 = x := Prod.ext_iff.1 hf0
exact this.symm.imp_left Eq.symm
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -305,7 +305,7 @@ theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x =
@[simp]
theorem ι_ne_one [Nontrivial R] (x : M) : ι R x ≠ 1 := by
- rw [← (algebraMap R (TensorAlgebra R M)).map_one, Ne.def, ι_eq_algebraMap_iff]
+ rw [← (algebraMap R (TensorAlgebra R M)).map_one, Ne, ι_eq_algebraMap_iff]
exact one_ne_zero ∘ And.right
#align tensor_algebra.ι_ne_one TensorAlgebra.ι_ne_one
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)
@@ -41,7 +41,6 @@ modulo the additional relations making the inclusion of `M` into an `R`-linear m
variable (R : Type*) [CommSemiring R]
-
variable (M : Type*) [AddCommMonoid M] [Module R M]
namespace TensorAlgebra
@@ -274,9 +274,8 @@ def ιInv : TensorAlgebra R M →ₗ[R] M := by
exact (TrivSqZeroExt.sndHom R M).comp toTrivSqZeroExt.toLinearMap
#align tensor_algebra.ι_inv TensorAlgebra.ιInv
-theorem ι_leftInverse : Function.LeftInverse ιInv (ι R : M → TensorAlgebra R M) := fun x => by
- -- Porting note: needs the last two `simp` lemmas explicitly in order to use them
- simp [ιInv, (AlgHom.toLinearMap_apply), toTrivSqZeroExt_ι _]
+theorem ι_leftInverse : Function.LeftInverse ιInv (ι R : M → TensorAlgebra R M) := fun x ↦ by
+ simp [ιInv]
#align tensor_algebra.ι_left_inverse TensorAlgebra.ι_leftInverse
variable (R)
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -202,7 +202,7 @@ theorem induction {C : TensorAlgebra R M → Prop}
mul_mem' := @mul
add_mem' := @add
algebraMap_mem' := algebraMap }
- -- porting note: Added `h`. `h` is needed for `of`.
+ -- Porting note: Added `h`. `h` is needed for `of`.
let h : AddCommMonoid s := inferInstanceAs (AddCommMonoid (Subalgebra.toSubmodule s))
let of : M →ₗ[R] s := (TensorAlgebra.ι R).codRestrict (Subalgebra.toSubmodule s) ι
-- the mapping through the subalgebra is the identity
@@ -275,7 +275,7 @@ def ιInv : TensorAlgebra R M →ₗ[R] M := by
#align tensor_algebra.ι_inv TensorAlgebra.ιInv
theorem ι_leftInverse : Function.LeftInverse ιInv (ι R : M → TensorAlgebra R M) := fun x => by
- -- porting note: needs the last two `simp` lemmas explicitly in order to use them
+ -- Porting note: needs the last two `simp` lemmas explicitly in order to use them
simp [ιInv, (AlgHom.toLinearMap_apply), toTrivSqZeroExt_ι _]
#align tensor_algebra.ι_left_inverse TensorAlgebra.ι_leftInverse
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 _
.
@@ -193,18 +193,18 @@ and is preserved under addition and muliplication, then it holds for all of `Ten
-/
@[elab_as_elim]
theorem induction {C : TensorAlgebra R M → Prop}
- (h_grade0 : ∀ r, C (algebraMap R (TensorAlgebra R M) r)) (h_grade1 : ∀ x, C (ι R x))
- (h_mul : ∀ a b, C a → C b → C (a * b)) (h_add : ∀ a b, C a → C b → C (a + b))
+ (algebraMap : ∀ r, C (algebraMap R (TensorAlgebra R M) r)) (ι : ∀ x, C (ι R x))
+ (mul : ∀ a b, C a → C b → C (a * b)) (add : ∀ a b, C a → C b → C (a + b))
(a : TensorAlgebra R M) : C a := by
-- the arguments are enough to construct a subalgebra, and a mapping into it from M
let s : Subalgebra R (TensorAlgebra R M) :=
{ carrier := C
- mul_mem' := @h_mul
- add_mem' := @h_add
- algebraMap_mem' := h_grade0 }
+ mul_mem' := @mul
+ add_mem' := @add
+ algebraMap_mem' := algebraMap }
-- porting note: Added `h`. `h` is needed for `of`.
let h : AddCommMonoid s := inferInstanceAs (AddCommMonoid (Subalgebra.toSubmodule s))
- let of : M →ₗ[R] s := (ι R).codRestrict (Subalgebra.toSubmodule s) h_grade1
+ let of : M →ₗ[R] s := (TensorAlgebra.ι R).codRestrict (Subalgebra.toSubmodule s) ι
-- the mapping through the subalgebra is the identity
have of_id : AlgHom.id R (TensorAlgebra R M) = s.val.comp (lift R of) := by
ext
Currently, we have multiple "no-diamond" tests of the form
example : x = y := rfl
where X
and Y
are instances of some class
. The problem is that since simp
and type class synthesis operate at reducible_and_instances
transparency this check means little.
We went through all the mentions of diamonds and either added with_reducible_and_instancse
or added a reference to the issue #10906.
Co-authored-by: Kevin Buzzard <k.buzzard@imperial.ac.uk>
@@ -77,6 +77,7 @@ instance instAlgebra {R A M} [CommSemiring R] [AddCommMonoid M] [CommSemiring A]
RingQuot.instAlgebra _
-- verify there is no diamond
+-- but doesn't work at `reducible_and_instances` #10906
example : (algebraNat : Algebra ℕ (TensorAlgebra R M)) = instAlgebra := rfl
instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemiring A]
@@ -97,6 +98,7 @@ instance {S : Type*} [CommRing S] [Module S M] : Ring (TensorAlgebra S M) :=
RingQuot.instRing (Rel S M)
-- verify there is no diamond
+-- but doesn't work at `reducible_and_instances` #10906
variable (S M : Type) [CommRing S] [AddCommGroup M] [Module S M] in
example : (algebraInt _ : Algebra ℤ (TensorAlgebra S M)) = instAlgebra := rfl
Provide instances
Nontrivial (TensorAlgebra R M)
when M
is a module over
a nontrivial semiring R
NoZeroDivisors (FreeAlgebra R X)
when R
is a commutative
semiring with no zero-divisors and X
any typeIsDomain (FreeAlgebra R X)
when R
is an integral domain
and X
is any typeTwoUniqueProds (FreeMonoid X)
where X
is any type
(this provides NoZeroDivisors (MonoidAlgebra R (FreeMonoid X))
when R
is a semiring and X
any type,
via TwoUniqueProds.toUniqueProds
and MonoidAlgebra.instNoZeroDivisorsOfUniqueProds
)NoZeroDivisors (TensorAlgebra R M)
when M
is a free module
over a commutative semiring R
with no zero-divisorsIsDomain (TensorAlgebra R M)
when M
is a free module over
an integral domain R
In Algebra.Group.UniqueProds:
UniqueProds.mulHom_image_of_injective
to
UniqueProds.of_injective_mulHom
.UniqueMul.of_mulHom_image
, UniqueProds.of_mulHom
,
TwoUniqueProds.of_mulHom
show the relevant property holds in the
domain of a multiplicative homomorphism if it holds in the codomain,
under a certain hypothesis on the homomorphism.Co-authored-by: Richard Copley <rcopley@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
@@ -243,6 +243,10 @@ theorem algebraMap_eq_one_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 1
map_eq_one_iff (algebraMap _ _) (algebraMap_leftInverse _).injective
#align tensor_algebra.algebra_map_eq_one_iff TensorAlgebra.algebraMap_eq_one_iff
+/-- A `TensorAlgebra` over a nontrivial semiring is nontrivial. -/
+instance [Nontrivial R] : Nontrivial (TensorAlgebra R M) :=
+ (algebraMap_leftInverse M).injective.nontrivial
+
variable {M}
/-- The canonical map from `TensorAlgebra R M` into `TrivSqZeroExt R M` that sends
@@ -107,10 +107,10 @@ variable {M}
irreducible_def ι : M →ₗ[R] TensorAlgebra R M :=
{ toFun := fun m => RingQuot.mkAlgHom R _ (FreeAlgebra.ι R m)
map_add' := fun x y => by
- rw [← AlgHom.map_add]
+ rw [← (RingQuot.mkAlgHom R (Rel R M)).map_add]
exact RingQuot.mkAlgHom_rel R Rel.add
map_smul' := fun r x => by
- rw [← AlgHom.map_smul]
+ rw [← (RingQuot.mkAlgHom R (Rel R M)).map_smul]
exact RingQuot.mkAlgHom_rel R Rel.smul }
#align tensor_algebra.ι TensorAlgebra.ι
SMulCommClass
argument (#8373)
SMulCommClass R S A
is always true when Algebra R A
and Algebra S A
and A
is commutative, since the two actions factor via multiplication in A
. I don't think mathlib actually knows this fact yet, but in this particular case it's also true by definition.
@@ -81,7 +81,7 @@ example : (algebraNat : Algebra ℕ (TensorAlgebra R M)) = instAlgebra := rfl
instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemiring A]
[Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
- [IsScalarTower R A M] [IsScalarTower S A M] [SMulCommClass R S A] :
+ [IsScalarTower R A M] [IsScalarTower S A M] :
SMulCommClass R S (TensorAlgebra A M) :=
RingQuot.instSMulCommClass _
@@ -206,7 +206,9 @@ theorem induction {C : TensorAlgebra R M → Prop}
-- the mapping through the subalgebra is the identity
have of_id : AlgHom.id R (TensorAlgebra R M) = s.val.comp (lift R of) := by
ext
- simp
+ simp only [AlgHom.toLinearMap_id, LinearMap.id_comp, AlgHom.comp_toLinearMap,
+ LinearMap.coe_comp, Function.comp_apply, AlgHom.toLinearMap_apply, lift_ι_apply,
+ Subalgebra.coe_val]
erw [LinearMap.codRestrict_apply]
-- finding a proof is finding an element of the subalgebra
rw [← AlgHom.id_apply (R := R) a, of_id]
@@ -65,7 +65,7 @@ def TensorAlgebra :=
#align tensor_algebra TensorAlgebra
-- Porting note: Expanded `deriving Inhabited, Semiring, Algebra`
-instance : Inhabited (TensorAlgebra R M) := RingQuot.instInhabitedRingQuot _
+instance : Inhabited (TensorAlgebra R M) := RingQuot.instInhabited _
instance : Semiring (TensorAlgebra R M) := RingQuot.instSemiring _
-- `IsScalarTower` is not needed, but the instance isn't really canonical without it.
@@ -74,7 +74,7 @@ instance instAlgebra {R A M} [CommSemiring R] [AddCommMonoid M] [CommSemiring A]
[Algebra R A] [Module R M] [Module A M]
[IsScalarTower R A M] :
Algebra R (TensorAlgebra A M) :=
- RingQuot.instAlgebraRingQuot _
+ RingQuot.instAlgebra _
-- verify there is no diamond
example : (algebraNat : Algebra ℕ (TensorAlgebra R M)) = instAlgebra := rfl
@@ -83,13 +83,13 @@ instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemi
[Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
[IsScalarTower R A M] [IsScalarTower S A M] [SMulCommClass R S A] :
SMulCommClass R S (TensorAlgebra A M) :=
- RingQuot.instSMulCommClassRingQuot _
+ RingQuot.instSMulCommClass _
instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemiring A]
[SMul R S] [Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
[IsScalarTower R A M] [IsScalarTower S A M] [IsScalarTower R S A] :
IsScalarTower R S (TensorAlgebra A M) :=
- RingQuot.instIsScalarTowerRingQuot _
+ RingQuot.instIsScalarTower _
namespace TensorAlgebra
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -40,9 +40,9 @@ modulo the additional relations making the inclusion of `M` into an `R`-linear m
-/
-variable (R : Type _) [CommSemiring R]
+variable (R : Type*) [CommSemiring R]
-variable (M : Type _) [AddCommMonoid M] [Module R M]
+variable (M : Type*) [AddCommMonoid M] [Module R M]
namespace TensorAlgebra
@@ -93,7 +93,7 @@ instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemi
namespace TensorAlgebra
-instance {S : Type _} [CommRing S] [Module S M] : Ring (TensorAlgebra S M) :=
+instance {S : Type*} [CommRing S] [Module S M] : Ring (TensorAlgebra S M) :=
RingQuot.instRing (Rel S M)
-- verify there is no diamond
@@ -125,7 +125,7 @@ theorem ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι (m : M) :
of `f` to a morphism of `R`-algebras `TensorAlgebra R M → A`.
-/
@[simps symm_apply]
-def lift {A : Type _} [Semiring A] [Algebra R A] : (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) :=
+def lift {A : Type*} [Semiring A] [Algebra R A] : (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) :=
{ toFun :=
RingQuot.liftAlgHom R ∘ fun f =>
⟨FreeAlgebra.lift R (⇑f), fun x y (h : Rel R M x y) => by
@@ -149,19 +149,19 @@ def lift {A : Type _} [Semiring A] [Algebra R A] : (M →ₗ[R] A) ≃ (TensorAl
variable {R}
@[simp]
-theorem ι_comp_lift {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
+theorem ι_comp_lift {A : Type*} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
(lift R f).toLinearMap.comp (ι R) = f := by
convert (lift R).symm_apply_apply f
#align tensor_algebra.ι_comp_lift TensorAlgebra.ι_comp_lift
@[simp]
-theorem lift_ι_apply {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) (x) :
+theorem lift_ι_apply {A : Type*} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) (x) :
lift R f (ι R x) = f x := by
conv_rhs => rw [← ι_comp_lift f]
#align tensor_algebra.lift_ι_apply TensorAlgebra.lift_ι_apply
@[simp]
-theorem lift_unique {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A)
+theorem lift_unique {A : Type*} [Semiring A] [Algebra R A] (f : M →ₗ[R] A)
(g : TensorAlgebra R M →ₐ[R] A) : g.toLinearMap.comp (ι R) = f ↔ g = lift R f := by
rw [← (lift R).symm_apply_eq]
simp only [lift, Equiv.coe_fn_symm_mk]
@@ -171,7 +171,7 @@ theorem lift_unique {A : Type _} [Semiring A] [Algebra R A] (f : M →ₗ[R] A)
-- https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/algebra.2Esemiring_to_ring.20breaks.20semimodule.20typeclass.20lookup/near/212580241
-- For now, we avoid this by not marking it irreducible.
@[simp]
-theorem lift_comp_ι {A : Type _} [Semiring A] [Algebra R A] (g : TensorAlgebra R M →ₐ[R] A) :
+theorem lift_comp_ι {A : Type*} [Semiring A] [Algebra R A] (g : TensorAlgebra R M →ₐ[R] A) :
lift R (g.toLinearMap.comp (ι R)) = g := by
rw [← lift_symm_apply]
exact (lift R).apply_symm_apply g
@@ -179,7 +179,7 @@ theorem lift_comp_ι {A : Type _} [Semiring A] [Algebra R A] (g : TensorAlgebra
/-- See note [partially-applied ext lemmas]. -/
@[ext]
-theorem hom_ext {A : Type _} [Semiring A] [Algebra R A] {f g : TensorAlgebra R M →ₐ[R] A}
+theorem hom_ext {A : Type*} [Semiring A] [Algebra R A] {f g : TensorAlgebra R M →ₐ[R] A}
(w : f.toLinearMap.comp (ι R) = g.toLinearMap.comp (ι R)) : f = g := by
rw [← lift_symm_apply, ← lift_symm_apply] at w
exact (lift R).symm.injective w
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -74,7 +74,7 @@ instance instAlgebra {R A M} [CommSemiring R] [AddCommMonoid M] [CommSemiring A]
[Algebra R A] [Module R M] [Module A M]
[IsScalarTower R A M] :
Algebra R (TensorAlgebra A M) :=
- RingQuot.instAlgebraRingQuotInstSemiring _
+ RingQuot.instAlgebraRingQuot _
-- verify there is no diamond
example : (algebraNat : Algebra ℕ (TensorAlgebra R M)) = instAlgebra := rfl
@@ -83,13 +83,13 @@ instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemi
[Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
[IsScalarTower R A M] [IsScalarTower S A M] [SMulCommClass R S A] :
SMulCommClass R S (TensorAlgebra A M) :=
- RingQuot.instSMulCommClassRingQuotInstSMulRingQuotInstSMulRingQuot _
+ RingQuot.instSMulCommClassRingQuot _
instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemiring A]
[SMul R S] [Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
[IsScalarTower R A M] [IsScalarTower S A M] [IsScalarTower R S A] :
IsScalarTower R S (TensorAlgebra A M) :=
- RingQuot.instIsScalarTowerRingQuotInstSMulRingQuotInstSMulRingQuot _
+ RingQuot.instIsScalarTowerRingQuot _
namespace TensorAlgebra
This is pre-work towards a base-change of clifford algebras.
The main result here is
@[nolint unusedArguments]
instance instAlgebra {R A M} [CommSemiring R] [AddCommMonoid M] [CommSemiring A]
[Algebra R A] [Module R M] [Module A M]
[IsScalarTower R A M] :
Algebra R (TensorAlgebra A M)
Note that strictly the IsScalarTower R A M
argument isn't needed, but I'd claim the instance doesn't make any sense without it.
In order to prevent diamonds in the algebraMap
fields of the Int
and Nat
algebra instances, we have stop having natCast
as an irreducible_def
, and we have to add a missing intCast
customization for RingQuot
. In order to prevent diamonds in the smul
fields there and elsewhere (such as a complex tensor algebra being a real algebra), we have to stop having the smul
definition as an irreducible_def
. We already had to make a similar refactor to prevent diamonds for Algebra R (Polynomial A)
.
If we backport any of this to mathlib3, we'd additionally have to change the smul
definition to not use pattern matching. Thankfully, structure eta in Lean 4 makes that unnecessary.
These diamonds are tested with inline examples
.
@@ -67,13 +67,39 @@ def TensorAlgebra :=
-- Porting note: Expanded `deriving Inhabited, Semiring, Algebra`
instance : Inhabited (TensorAlgebra R M) := RingQuot.instInhabitedRingQuot _
instance : Semiring (TensorAlgebra R M) := RingQuot.instSemiring _
-instance : Algebra R (TensorAlgebra R M) := RingQuot.instAlgebraRingQuotInstSemiring _
+
+-- `IsScalarTower` is not needed, but the instance isn't really canonical without it.
+@[nolint unusedArguments]
+instance instAlgebra {R A M} [CommSemiring R] [AddCommMonoid M] [CommSemiring A]
+ [Algebra R A] [Module R M] [Module A M]
+ [IsScalarTower R A M] :
+ Algebra R (TensorAlgebra A M) :=
+ RingQuot.instAlgebraRingQuotInstSemiring _
+
+-- verify there is no diamond
+example : (algebraNat : Algebra ℕ (TensorAlgebra R M)) = instAlgebra := rfl
+
+instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemiring A]
+ [Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
+ [IsScalarTower R A M] [IsScalarTower S A M] [SMulCommClass R S A] :
+ SMulCommClass R S (TensorAlgebra A M) :=
+ RingQuot.instSMulCommClassRingQuotInstSMulRingQuotInstSMulRingQuot _
+
+instance {R S A M} [CommSemiring R] [CommSemiring S] [AddCommMonoid M] [CommSemiring A]
+ [SMul R S] [Algebra R A] [Algebra S A] [Module R M] [Module S M] [Module A M]
+ [IsScalarTower R A M] [IsScalarTower S A M] [IsScalarTower R S A] :
+ IsScalarTower R S (TensorAlgebra A M) :=
+ RingQuot.instIsScalarTowerRingQuotInstSMulRingQuotInstSMulRingQuot _
namespace TensorAlgebra
instance {S : Type _} [CommRing S] [Module S M] : Ring (TensorAlgebra S M) :=
RingQuot.instRing (Rel S M)
+-- verify there is no diamond
+variable (S M : Type) [CommRing S] [AddCommGroup M] [Module S M] in
+example : (algebraInt _ : Algebra ℤ (TensorAlgebra S M)) = instAlgebra := rfl
+
variable {M}
/-- The canonical linear map `M →ₗ[R] TensorAlgebra R M`.
@@ -2,11 +2,6 @@
Copyright (c) 2020 Adam Topaz. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
-
-! This file was ported from Lean 3 source module linear_algebra.tensor_algebra.basic
-! leanprover-community/mathlib commit b8d2eaa69d69ce8f03179a5cda774fc0cde984e4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.FreeAlgebra
import Mathlib.Algebra.RingQuot
@@ -14,6 +9,8 @@ import Mathlib.Algebra.TrivSqZeroExt
import Mathlib.Algebra.Algebra.Operations
import Mathlib.LinearAlgebra.Multilinear.Basic
+#align_import linear_algebra.tensor_algebra.basic from "leanprover-community/mathlib"@"b8d2eaa69d69ce8f03179a5cda774fc0cde984e4"
+
/-!
# Tensor Algebras
The unported dependencies are