Module docstring
{"# Bases of submodules "}
{"# Bases of submodules "}
Basis.mem_submodule_iff
theorem
{P : Submodule R M} (b : Basis ι R P) {x : M} : x ∈ P ↔ ∃ c : ι →₀ R, x = Finsupp.sum c fun i x => x • (b i : M)
/-- If the submodule `P` has a basis, `x ∈ P` iff it is a linear combination of basis vectors. -/
theorem mem_submodule_iff {P : Submodule R M} (b : Basis ι R P) {x : M} :
x ∈ Px ∈ P ↔ ∃ c : ι →₀ R, x = Finsupp.sum c fun i x => x • (b i : M) := by
conv_lhs =>
rw [← P.range_subtype, ← Submodule.map_top, ← b.span_eq, Submodule.map_span, ← Set.range_comp,
← Finsupp.range_linearCombination]
simp [@eq_comm _ x, Function.comp, Finsupp.linearCombination_apply]
Basis.mem_submodule_iff'
theorem
[Fintype ι] {P : Submodule R M} (b : Basis ι R P) {x : M} : x ∈ P ↔ ∃ c : ι → R, x = ∑ i, c i • (b i : M)
/-- If the submodule `P` has a finite basis,
`x ∈ P` iff it is a linear combination of basis vectors. -/
theorem mem_submodule_iff' [Fintype ι] {P : Submodule R M} (b : Basis ι R P) {x : M} :
x ∈ Px ∈ P ↔ ∃ c : ι → R, x = ∑ i, c i • (b i : M) :=
b.mem_submodule_iff.trans <|
Finsupp.equivFunOnFinite.exists_congr_left.trans <|
exists_congr fun c => by simp [Finsupp.sum_fintype, Finsupp.equivFunOnFinite]
Submodule.inductionOnRankAux
definition
(b : Basis ι R M) (P : Submodule R M → Sort*)
(ih : ∀ N : Submodule R M, (∀ N' ≤ N, ∀ x ∈ N, (∀ (c : R), ∀ y ∈ N', c • x + y = (0 : M) → c = 0) → P N') → P N)
(n : ℕ) (N : Submodule R M) (rank_le : ∀ {m : ℕ} (v : Fin m → N), LinearIndependent R ((↑) ∘ v : Fin m → M) → m ≤ n) :
P N
/-- If `N` is a submodule with finite rank, do induction on adjoining a linear independent
element to a submodule. -/
def Submodule.inductionOnRankAux (b : Basis ι R M) (P : Submodule R M → Sort*)
(ih : ∀ N : Submodule R M,
(∀ N' ≤ N, ∀ x ∈ N, (∀ (c : R), ∀ y ∈ N', c • x + y = (0 : M) → c = 0) → P N') → P N)
(n : ℕ) (N : Submodule R M)
(rank_le : ∀ {m : ℕ} (v : Fin m → N), LinearIndependent R ((↑) ∘ v : Fin m → M) → m ≤ n) :
P N := by
haveI : DecidableEq M := Classical.decEq M
have Pbot : P ⊥ := by
apply ih
intro N _ x x_mem x_ortho
exfalso
rw [mem_bot] at x_mem
simpa [x_mem] using x_ortho 1 0 N.zero_mem
induction n generalizing N with
| zero =>
suffices N = ⊥ by rwa [this]
apply Basis.eq_bot_of_rank_eq_zero b _ fun m hv => Nat.le_zero.mp (rank_le _ hv)
| succ n rank_ih =>
apply ih
intro N' N'_le x x_mem x_ortho
apply rank_ih
intro m v hli
refine Nat.succ_le_succ_iff.mp (rank_le (Fin.cons ⟨x, x_mem⟩ fun i => ⟨v i, N'_le (v i).2⟩) ?_)
convert hli.fin_cons' x _ ?_
· ext i
refine Fin.cases ?_ ?_ i <;> simp
· intro c y hcy
refine x_ortho c y (Submodule.span_le.mpr ?_ y.2) hcy
rintro _ ⟨z, rfl⟩
exact (v z).2
Basis.mem_center_iff
theorem
{A} [Semiring R] [NonUnitalNonAssocSemiring A] [Module R A] [SMulCommClass R A A] [SMulCommClass R R A]
[IsScalarTower R A A] (b : Basis ι R A) {z : A} :
z ∈ Set.center A ↔
(∀ i, Commute (b i) z) ∧
∀ i j, z * (b i * b j) = (z * b i) * b j ∧ (b i * z) * b j = b i * (z * b j) ∧ (b i * b j) * z = b i * (b j * z)
/-- An element of a non-unital-non-associative algebra is in the center exactly when it commutes
with the basis elements. -/
lemma Basis.mem_center_iff {A}
[Semiring R] [NonUnitalNonAssocSemiring A]
[Module R A] [SMulCommClass R A A] [SMulCommClass R R A] [IsScalarTower R A A]
(b : Basis ι R A) {z : A} :
z ∈ Set.center Az ∈ Set.center A ↔
(∀ i, Commute (b i) z) ∧ ∀ i j,
z * (b i * b j) = (z * b i) * b j
∧ (b i * z) * b j = b i * (z * b j)
∧ (b i * b j) * z = b i * (b j * z) := by
constructor
· intro h
constructor
· intro i
apply (h.1 (b i)).symm
· intros
exact ⟨h.2 _ _, ⟨h.3 _ _, h.4 _ _⟩⟩
· intro h
rw [center, mem_setOf_eq]
constructor
case comm =>
intro y
rw [← b.linearCombination_repr y, linearCombination_apply, sum, Finset.sum_mul,
Finset.mul_sum]
simp_rw [mul_smul_comm, smul_mul_assoc, (h.1 _).eq]
case left_assoc =>
intro c d
rw [← b.linearCombination_repr c, ← b.linearCombination_repr d, linearCombination_apply,
linearCombination_apply, sum, sum, Finset.sum_mul, Finset.mul_sum, Finset.mul_sum,
Finset.mul_sum]
simp_rw [smul_mul_assoc, Finset.mul_sum, Finset.sum_mul, mul_smul_comm, Finset.mul_sum,
Finset.smul_sum, smul_mul_assoc, mul_smul_comm, (h.2 _ _).1,
(@SMulCommClass.smul_comm R R A)]
rw [Finset.sum_comm]
case mid_assoc =>
intro c d
rw [← b.linearCombination_repr c, ← b.linearCombination_repr d, linearCombination_apply,
linearCombination_apply, sum, sum, Finset.sum_mul, Finset.mul_sum, Finset.mul_sum,
Finset.mul_sum]
simp_rw [smul_mul_assoc, Finset.sum_mul, mul_smul_comm, smul_mul_assoc, (h.2 _ _).2.1]
case right_assoc =>
intro c d
rw [← b.linearCombination_repr c, ← b.linearCombination_repr d, linearCombination_apply,
linearCombination_apply, sum, Finsupp.sum, Finset.sum_mul]
simp_rw [smul_mul_assoc, Finset.mul_sum, Finset.sum_mul, mul_smul_comm, Finset.mul_sum,
Finset.smul_sum, smul_mul_assoc, mul_smul_comm, Finset.sum_mul, smul_mul_assoc,
(h.2 _ _).2.2]
Basis.restrictScalars
definition
: Basis ι R (span R (Set.range b))
/-- Let `b` be an `S`-basis of `M`. Let `R` be a CommRing such that `Algebra R S` has no zero smul
divisors, then the submodule of `M` spanned by `b` over `R` admits `b` as an `R`-basis. -/
noncomputable def Basis.restrictScalars : Basis ι R (span R (Set.range b)) :=
Basis.span (b.linearIndependent.restrict_scalars (smul_left_injective R one_ne_zero))
Basis.restrictScalars_apply
theorem
(i : ι) : (b.restrictScalars R i : M) = b i
@[simp]
theorem Basis.restrictScalars_apply (i : ι) : (b.restrictScalars R i : M) = b i := by
simp only [Basis.restrictScalars, Basis.span_apply]
Basis.restrictScalars_repr_apply
theorem
(m : span R (Set.range b)) (i : ι) : algebraMap R S ((b.restrictScalars R).repr m i) = b.repr m i
@[simp]
theorem Basis.restrictScalars_repr_apply (m : span R (Set.range b)) (i : ι) :
algebraMap R S ((b.restrictScalars R).repr m i) = b.repr m i := by
suffices
Finsupp.mapRange.linearMapFinsupp.mapRange.linearMap (Algebra.linearMap R S) ∘ₗ (b.restrictScalars R).repr.toLinearMap =
((b.repr : M →ₗ[S] ι →₀ S).restrictScalars R).domRestrict _
by exact DFunLike.congr_fun (LinearMap.congr_fun this m) i
refine Basis.ext (b.restrictScalars R) fun _ => ?_
simp only [LinearMap.coe_comp, LinearEquiv.coe_toLinearMap, Function.comp_apply, map_one,
Basis.repr_self, Finsupp.mapRange.linearMap_apply, Finsupp.mapRange_single,
Algebra.linearMap_apply, LinearMap.domRestrict_apply, LinearEquiv.coe_coe,
Basis.restrictScalars_apply, LinearMap.coe_restrictScalars]
Basis.mem_span_iff_repr_mem
theorem
(m : M) : m ∈ span R (Set.range b) ↔ ∀ i, b.repr m i ∈ Set.range (algebraMap R S)
/-- Let `b` be an `S`-basis of `M`. Then `m : M` lies in the `R`-module spanned by `b` iff all the
coordinates of `m` on the basis `b` are in `R` (see `Basis.mem_span` for the case `R = S`). -/
theorem Basis.mem_span_iff_repr_mem (m : M) :
m ∈ span R (Set.range b)m ∈ span R (Set.range b) ↔ ∀ i, b.repr m i ∈ Set.range (algebraMap R S) := by
refine
⟨fun hm i => ⟨(b.restrictScalars R).repr ⟨m, hm⟩ i, b.restrictScalars_repr_apply R ⟨m, hm⟩ i⟩,
fun h => ?_⟩
rw [← b.linearCombination_repr m, Finsupp.linearCombination_apply S _]
refine sum_mem fun i _ => ?_
obtain ⟨_, h⟩ := h i
simp_rw [← h, algebraMap_smul]
exact smul_mem _ _ (subset_span (Set.mem_range_self i))
Basis.addSubgroupOfClosure
definition
(h : A = .closure (Set.range b)) : Basis ι ℤ A.toIntSubmodule
/--
Let `A` be an subgroup of an additive commutative group `M` that is also an `R`-module.
Construct a basis of `A` as a `ℤ`-basis from a `R`-basis of `E` that generates `A`.
-/
noncomputable def Basis.addSubgroupOfClosure (h : A = .closure (Set.range b)) :
Basis ι ℤ A.toIntSubmodule :=
(b.restrictScalars ℤ).map <|
LinearEquiv.ofEq _ _
(by rw [h, ← Submodule.span_int_eq_addSubgroup_closure, toAddSubgroup_toIntSubmodule])
Basis.addSubgroupOfClosure_apply
theorem
(h : A = .closure (Set.range b)) (i : ι) : b.addSubgroupOfClosure A h i = b i
@[simp]
theorem Basis.addSubgroupOfClosure_apply (h : A = .closure (Set.range b)) (i : ι) :
b.addSubgroupOfClosure A h i = b i := by
simp [addSubgroupOfClosure]
Basis.addSubgroupOfClosure_repr_apply
theorem
(h : A = .closure (Set.range b)) (x : A) (i : ι) : (b.addSubgroupOfClosure A h).repr x i = b.repr x i
@[simp]
theorem Basis.addSubgroupOfClosure_repr_apply (h : A = .closure (Set.range b)) (x : A) (i : ι) :
(b.addSubgroupOfClosure A h).repr x i = b.repr x i := by
suffices Finsupp.mapRange.linearMapFinsupp.mapRange.linearMap (Algebra.linearMap ℤ R) ∘ₗ
(b.addSubgroupOfClosure A h).repr.toLinearMap =
((b.repr : M →ₗ[R] ι →₀ R).restrictScalars ℤ).domRestrict A.toIntSubmodule by
exact DFunLike.congr_fun (LinearMap.congr_fun this x) i
exact (b.addSubgroupOfClosure A h).ext fun _ ↦ by simp