File: Mathlib/LinearAlgebra/TensorAlgebra/Basic.lean

full_name: TensorAlgebra.Rel.smul
code: /-- An inductively defined relation on `Pre R M` used to force the initial algebra structure on
the associated quotient.
-/
inductive Rel : FreeAlgebra R M → FreeAlgebra R M → Prop
  -- force `ι` to be linear
  | add {a b : M} : Rel (FreeAlgebra.ι R (a + b)) (FreeAlgebra.ι R a + FreeAlgebra.ι R b)
  | smul {r : R} {a : M} :
    Rel (FreeAlgebra.ι R (r • a)) (algebraMap R (FreeAlgebra R M) r * FreeAlgebra.ι R a)
goal: TensorAlgebra.Rel R M (FreeAlgebra.ι R (r • a)) ((algebraMap R (FreeAlgebra R M)) r * FreeAlgebra.ι R a)

full_name: TensorAlgebra.Rel.add
code: /-- An inductively defined relation on `Pre R M` used to force the initial algebra structure on
the associated quotient.
-/
inductive Rel : FreeAlgebra R M → FreeAlgebra R M → Prop
  -- force `ι` to be linear
  | add {a b : M} : Rel (FreeAlgebra.ι R (a + b)) (FreeAlgebra.ι R a + FreeAlgebra.ι R b)
  | smul {r : R} {a : M} :
    Rel (FreeAlgebra.ι R (r • a)) (algebraMap R (FreeAlgebra R M) r * FreeAlgebra.ι R a)
goal: TensorAlgebra.Rel R M (FreeAlgebra.ι R (a + b)) (FreeAlgebra.ι R a + FreeAlgebra.ι R b)

full_name: TensorAlgebra.Rel
code: /-- An inductively defined relation on `Pre R M` used to force the initial algebra structure on
the associated quotient.
-/
inductive Rel : FreeAlgebra R M → FreeAlgebra R M → Prop
  -- force `ι` to be linear
  | add {a b : M} : Rel (FreeAlgebra.ι R (a + b)) (FreeAlgebra.ι R a + FreeAlgebra.ι R b)
  | smul {r : R} {a : M} :
    Rel (FreeAlgebra.ι R (r • a)) (algebraMap R (FreeAlgebra R M) r * FreeAlgebra.ι R a)
goal: FreeAlgebra R M → FreeAlgebra R M → Prop

full_name: TensorAlgebra
code: /-- The tensor algebra of the module `M` over the commutative semiring `R`.
-/
def TensorAlgebra 
goal: Type (max u_1 u_2)

full_name: instInhabitedTensorAlgebra
code: instance : Inhabited (TensorAlgebra R M) 
goal: Inhabited (TensorAlgebra R M)

full_name: instSemiringTensorAlgebra
code: instance : Semiring (TensorAlgebra R M) 
goal: Semiring (TensorAlgebra R M)

full_name: instAlgebra
code: @[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) 
goal: Algebra R (TensorAlgebra A M)

full_name: instSMulCommClassTensorAlgebra
code: 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 (TensorAlgebra A M) 
goal: SMulCommClass R S (TensorAlgebra A M)

full_name: instIsScalarTowerTensorAlgebra
code: 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) 
goal: IsScalarTower R S (TensorAlgebra A M)

full_name: TensorAlgebra.instRing
code: instance {S : Type*} [CommRing S] [Module S M] : Ring (TensorAlgebra S M) 
goal: Ring (TensorAlgebra S M)

full_name: TensorAlgebra.wrapped._@.Mathlib.LinearAlgebra.TensorAlgebra.Basic._hyg.546
code: /-- The canonical linear map `M →ₗ[R] TensorAlgebra R M`.
-/
irreducible_def ι : M →ₗ[R] TensorAlgebra R M 
goal: Subtype (Eq TensorAlgebra.definition✝)

full_name: TensorAlgebra.ι
code: /-- The canonical linear map `M →ₗ[R] TensorAlgebra R M`.
-/
irreducible_def ι : M →ₗ[R] TensorAlgebra R M 
goal: M →ₗ[R] TensorAlgebra R M

full_name: TensorAlgebra.definition._@.Mathlib.LinearAlgebra.TensorAlgebra.Basic._hyg.546
code: /-- The canonical linear map `M →ₗ[R] TensorAlgebra R M`.
-/
irreducible_def ι : M →ₗ[R] TensorAlgebra R M 
goal: M →ₗ[R] TensorAlgebra R M

full_name: TensorAlgebra.ι_def
code: /-- The canonical linear map `M →ₗ[R] TensorAlgebra R M`.
-/
irreducible_def ι : M →ₗ[R] TensorAlgebra R M 
goal: TensorAlgebra.ι R =
  { toFun := fun m => (RingQuot.mkAlgHom R (TensorAlgebra.Rel R M)) (FreeAlgebra.ι R m), map_add' := ⋯, map_smul' := ⋯ }

full_name: TensorAlgebra.ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι
code: theorem ringQuot_mkAlgHom_freeAlgebra_ι_eq_ι (m : M) :
    RingQuot.mkAlgHom R (Rel R M) (FreeAlgebra.ι R m) = ι R m 
goal: (RingQuot.mkAlgHom R (TensorAlgebra.Rel R M)) (FreeAlgebra.ι R m) = (TensorAlgebra.ι R) m

full_name: TensorAlgebra.lift
code: /-- 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 `TensorAlgebra R M → A`.
-/
@[simps symm_apply]
def lift {A : Type*} [Semiring A] [Algebra R A] : (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) 
goal: (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A)

full_name: TensorAlgebra.lift_symm_apply
code: /-- 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 `TensorAlgebra R M → A`.
-/
@[simps symm_apply]
def lift {A : Type*} [Semiring A] [Algebra R A] : (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) 
goal: (TensorAlgebra.lift R).symm F = F.toLinearMap ∘ₗ TensorAlgebra.ι R

full_name: TensorAlgebra.ι_comp_lift
code: @[simp]
theorem ι_comp_lift {A : Type*} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) :
    (lift R f).toLinearMap.comp (ι R) = f 
goal: ((TensorAlgebra.lift R) f).toLinearMap ∘ₗ TensorAlgebra.ι R = f

full_name: TensorAlgebra.lift_ι_apply
code: @[simp]
theorem lift_ι_apply {A : Type*} [Semiring A] [Algebra R A] (f : M →ₗ[R] A) (x) :
    lift R f (ι R x) = f x 
goal: ((TensorAlgebra.lift R) f) ((TensorAlgebra.ι R) x) = f x

full_name: TensorAlgebra.lift_unique
code: @[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 
goal: g.toLinearMap ∘ₗ TensorAlgebra.ι R = f ↔ g = (TensorAlgebra.lift R) f

full_name: TensorAlgebra.lift_comp_ι
code: @[simp]
theorem lift_comp_ι {A : Type*} [Semiring A] [Algebra R A] (g : TensorAlgebra R M →ₐ[R] A) :
    lift R (g.toLinearMap.comp (ι R)) = g 
goal: (TensorAlgebra.lift R) (g.toLinearMap ∘ₗ TensorAlgebra.ι R) = g

full_name: TensorAlgebra.hom_ext
code: /-- See note [partially-applied ext lemmas]. -/
@[ext]
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 
goal: f = g

full_name: TensorAlgebra.induction
code: /-- If `C` holds for the `algebraMap` of `r : R` into `TensorAlgebra R M`, the `ι` of `x : M`,
and is preserved under addition and muliplication, then it holds for all of `TensorAlgebra R M`.
-/
@[elab_as_elim]
theorem induction {C : TensorAlgebra R M → Prop}
    (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 
goal: C a

full_name: TensorAlgebra.algebraMapInv
code: /-- The left-inverse of `algebraMap`. -/
def algebraMapInv : TensorAlgebra R M →ₐ[R] R 
goal: TensorAlgebra R M →ₐ[R] R

full_name: TensorAlgebra.algebraMap_leftInverse
code: theorem algebraMap_leftInverse :
    Function.LeftInverse algebraMapInv (algebraMap R <| TensorAlgebra R M) 
goal: Function.LeftInverse ⇑TensorAlgebra.algebraMapInv ⇑(algebraMap R (TensorAlgebra R M))

full_name: TensorAlgebra.algebraMap_inj
code: @[simp]
theorem algebraMap_inj (x y : R) :
    algebraMap R (TensorAlgebra R M) x = algebraMap R (TensorAlgebra R M) y ↔ x = y 
goal: (algebraMap R (TensorAlgebra R M)) x = (algebraMap R (TensorAlgebra R M)) y ↔ x = y

full_name: TensorAlgebra.algebraMap_eq_zero_iff
code: @[simp]
theorem algebraMap_eq_zero_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 0 ↔ x = 0 
goal: (algebraMap R (TensorAlgebra R M)) x = 0 ↔ x = 0

full_name: TensorAlgebra.algebraMap_eq_one_iff
code: @[simp]
theorem algebraMap_eq_one_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 1 ↔ x = 1 
goal: (algebraMap R (TensorAlgebra R M)) x = 1 ↔ x = 1

full_name: TensorAlgebra.instNontrivial
code: /-- A `TensorAlgebra` over a nontrivial semiring is nontrivial. -/
instance [Nontrivial R] : Nontrivial (TensorAlgebra R M) 
goal: Nontrivial (TensorAlgebra R M)

full_name: TensorAlgebra.toTrivSqZeroExt
code: /-- The canonical map from `TensorAlgebra R M` into `TrivSqZeroExt R M` that sends
`TensorAlgebra.ι` to `TrivSqZeroExt.inr`. -/
def toTrivSqZeroExt [Module Rᵐᵒᵖ M] [IsCentralScalar R M] :
    TensorAlgebra R M →ₐ[R] TrivSqZeroExt R M 
goal: TensorAlgebra R M →ₐ[R] TrivSqZeroExt R M

full_name: TensorAlgebra.toTrivSqZeroExt_ι
code: @[simp]
theorem toTrivSqZeroExt_ι (x : M) [Module Rᵐᵒᵖ M] [IsCentralScalar R M] :
    toTrivSqZeroExt (ι R x) = TrivSqZeroExt.inr x 
goal: TensorAlgebra.toTrivSqZeroExt ((TensorAlgebra.ι R) x) = TrivSqZeroExt.inr x

full_name: TensorAlgebra.ιInv
code: /-- The left-inverse of `ι`.

As an implementation detail, we implement this using `TrivSqZeroExt` which has a suitable
algebra structure. -/
def ιInv : TensorAlgebra R M →ₗ[R] M 
goal: TensorAlgebra R M →ₗ[R] M

full_name: TensorAlgebra.ι_leftInverse
code: theorem ι_leftInverse : Function.LeftInverse ιInv (ι R : M → TensorAlgebra R M) 
goal: Function.LeftInverse ⇑TensorAlgebra.ιInv ⇑(TensorAlgebra.ι R)

full_name: TensorAlgebra.ι_inj
code: @[simp]
theorem ι_inj (x y : M) : ι R x = ι R y ↔ x = y 
goal: (TensorAlgebra.ι R) x = (TensorAlgebra.ι R) y ↔ x = y

full_name: TensorAlgebra.ι_eq_zero_iff
code: @[simp]
theorem ι_eq_zero_iff (x : M) : ι R x = 0 ↔ x = 0 
goal: (TensorAlgebra.ι R) x = 0 ↔ x = 0

full_name: TensorAlgebra.ι_eq_algebraMap_iff
code: @[simp]
theorem ι_eq_algebraMap_iff (x : M) (r : R) : ι R x = algebraMap R _ r ↔ x = 0 ∧ r = 0 
goal: (TensorAlgebra.ι R) x = (algebraMap R (TensorAlgebra R M)) r ↔ x = 0 ∧ r = 0

full_name: TensorAlgebra.ι_ne_one
code: @[simp]
theorem ι_ne_one [Nontrivial R] (x : M) : ι R x ≠ 1 
goal: (TensorAlgebra.ι R) x ≠ 1

full_name: TensorAlgebra.ι_range_disjoint_one
code: /-- The generators of the tensor algebra are disjoint from its scalars. -/
theorem ι_range_disjoint_one :
    Disjoint (LinearMap.range (ι R : M →ₗ[R] TensorAlgebra R M))
      (1 : Submodule R (TensorAlgebra R M)) 
goal: Disjoint (LinearMap.range (TensorAlgebra.ι R)) 1

full_name: TensorAlgebra.tprod
code: /-- Construct a product of `n` elements of the module within the tensor algebra.

See also `PiTensorProduct.tprod`. -/
def tprod (n : ℕ) : MultilinearMap R (fun _ : Fin n => M) (TensorAlgebra R M) 
goal: MultilinearMap R (fun x => M) (TensorAlgebra R M)

full_name: TensorAlgebra.tprod_apply
code: @[simp]
theorem tprod_apply {n : ℕ} (x : Fin n → M) : tprod R M n x = (List.ofFn fun i => ι R (x i)).prod 
goal: (TensorAlgebra.tprod R M n) x = (List.ofFn fun i => (TensorAlgebra.ι R) (x i)).prod

full_name: FreeAlgebra.toTensor
code: /-- The canonical image of the `FreeAlgebra` in the `TensorAlgebra`, which maps
`FreeAlgebra.ι R x` to `TensorAlgebra.ι R x`. -/
def toTensor : FreeAlgebra R M →ₐ[R] TensorAlgebra R M 
goal: FreeAlgebra R M →ₐ[R] TensorAlgebra R M

full_name: FreeAlgebra.toTensor_ι
code: @[simp]
theorem toTensor_ι (m : M) : FreeAlgebra.toTensor (FreeAlgebra.ι R m) = TensorAlgebra.ι R m 
goal: FreeAlgebra.toTensor (FreeAlgebra.ι R m) = (TensorAlgebra.ι R) m