Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 102ce30

Browse files
committed
feat(linear_algebra/direct_sum): submodule_is_internal_iff_independent_and_supr_eq_top (#9214)
This shows that a grade decomposition into submodules is bijective iff and only iff the submodules are independent and span the whole module. The key proofs are: * `complete_lattice.independent_of_dfinsupp_lsum_injective` * `complete_lattice.independent.dfinsupp_lsum_injective` Everything else is just glue. This replaces parts of #8246, and uses what is probably a similar proof strategy, but without unfolding down to finsets. Unlike the proof there, this requires only `add_comm_monoid` for the `complete_lattice.independent_of_dfinsupp_lsum_injective` direction of the proof. I was not able to find a proof of `complete_lattice.independent.dfinsupp_lsum_injective` with the same weak assumptions, as it is not true! A counter-example is included, Co-authored-by: Hanting Zhang <hantingzhang03@gmail.com>
1 parent 9be12dd commit 102ce30

File tree

3 files changed

+212
-2
lines changed

3 files changed

+212
-2
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/-
2+
Copyright (c) 2021 Eric Wieser. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Eric Wieser, Kevin Buzzard
5+
-/
6+
7+
import algebra.direct_sum.module
8+
import tactic.fin_cases
9+
10+
/-!
11+
# Not all complementary decompositions of a module over a semiring make up a direct sum
12+
13+
This shows that while `ℤ≤0` and `ℤ≥0` are complementary `ℕ`-submodules of `ℤ`, which in turn
14+
implies as a collection they are `complete_lattice.independent` and that they span all of `ℤ`, they
15+
do not form a decomposition into a direct sum.
16+
17+
This file demonstrates why `direct_sum.submodule_is_internal_of_independent_of_supr_eq_top` must
18+
take `ring R` and not `semiring R`.
19+
-/
20+
21+
lemma units_int.one_ne_neg_one : (1 : units ℤ) ≠ -1 := dec_trivial
22+
23+
/-- Submodules of positive and negative integers, keyed by sign. -/
24+
def with_sign (i : units ℤ) : submodule ℕ ℤ :=
25+
add_submonoid.to_nat_submodule $ show add_submonoid ℤ, from
26+
{ carrier := {z | 0 ≤ i • z},
27+
zero_mem' := show 0 ≤ i • (0 : ℤ), from (smul_zero _).ge,
28+
add_mem' := λ x y (hx : 0 ≤ i • x) (hy : 0 ≤ i • y), show _ ≤ _, begin
29+
rw smul_add,
30+
exact add_nonneg hx hy
31+
end }
32+
33+
local notation `ℤ0` := with_sign 1
34+
local notation `ℤ0` := with_sign (-1)
35+
36+
lemma mem_with_sign_one {x : ℤ} : x ∈ ℤ≥00 ≤ x :=
37+
show _ ≤ _ ↔ _, by rw one_smul
38+
39+
lemma mem_with_sign_neg_one {x : ℤ} : x ∈ ℤ≤0 ↔ x ≤ 0 :=
40+
show _ ≤ _ ↔ _, by rw [units.neg_smul, le_neg, one_smul, neg_zero]
41+
42+
/-- The two submodules are complements. -/
43+
lemma with_sign.is_compl : is_compl (ℤ≥0) (ℤ≤0) :=
44+
begin
45+
split,
46+
{ apply submodule.disjoint_def.2,
47+
intros x hx hx',
48+
exact le_antisymm (mem_with_sign_neg_one.mp hx') (mem_with_sign_one.mp hx), },
49+
{ intros x hx,
50+
obtain hp | hn := (le_refl (0 : ℤ)).le_or_le x,
51+
exact submodule.mem_sup_left (mem_with_sign_one.mpr hp),
52+
exact submodule.mem_sup_right (mem_with_sign_neg_one.mpr hn), }
53+
end
54+
55+
def with_sign.independent : complete_lattice.independent with_sign :=
56+
begin
57+
intros i,
58+
rw [←finset.sup_univ_eq_supr, units_int.univ, finset.sup_insert, finset.sup_singleton],
59+
fin_cases i,
60+
{ convert with_sign.is_compl.disjoint,
61+
convert bot_sup_eq,
62+
{ exact supr_neg (not_not_intro rfl), },
63+
{ rw supr_pos units_int.one_ne_neg_one.symm } },
64+
{ convert with_sign.is_compl.disjoint.symm,
65+
convert sup_bot_eq,
66+
{ exact supr_neg (not_not_intro rfl), },
67+
{ rw supr_pos units_int.one_ne_neg_one } },
68+
end
69+
70+
lemma with_sign.supr : supr with_sign = ⊤ :=
71+
begin
72+
rw [←finset.sup_univ_eq_supr, units_int.univ, finset.sup_insert, finset.sup_singleton],
73+
exact with_sign.is_compl.sup_eq_top,
74+
end
75+
76+
/-- But there is no embedding into `ℤ` from the direct sum. -/
77+
lemma with_sign.not_injective :
78+
¬function.injective (direct_sum.to_module ℕ (units ℤ) ℤ (λ i, (with_sign i).subtype)) :=
79+
begin
80+
intro hinj,
81+
let p1 : ℤ≥0 := ⟨1, mem_with_sign_one.2 zero_le_one⟩,
82+
let n1 : ℤ≤0 := ⟨-1, mem_with_sign_neg_one.2 $ neg_nonpos.2 zero_le_one⟩,
83+
let z := direct_sum.lof ℕ _ (λ i, with_sign i) 1 p1 +
84+
direct_sum.lof ℕ _ (λ i, with_sign i) (-1) n1,
85+
have : z ≠ 0,
86+
{ intro h,
87+
dsimp [z, direct_sum.lof_eq_of, direct_sum.of] at h,
88+
replace h := dfinsupp.ext_iff.mp h 1,
89+
rw [dfinsupp.zero_apply, dfinsupp.add_apply, dfinsupp.single_eq_same,
90+
dfinsupp.single_eq_of_ne (units_int.one_ne_neg_one.symm), add_zero, subtype.ext_iff,
91+
submodule.coe_zero] at h,
92+
apply zero_ne_one h.symm, },
93+
apply hinj.ne this,
94+
rw [linear_map.map_zero, linear_map.map_add, direct_sum.to_module_lof, direct_sum.to_module_lof],
95+
simp,
96+
end
97+
98+
/-- And so they do not represent an internal direct sum. -/
99+
lemma with_sign.not_internal : ¬direct_sum.submodule_is_internal with_sign :=
100+
with_sign.not_injective ∘ and.elim_left

src/algebra/direct_sum/module.lean

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ lemma component.of (i j : ι) (b : M j) :
162162
dfinsupp.single_apply
163163

164164
/-- The `direct_sum` formed by a collection of `submodule`s of `M` is said to be internal if the
165-
canonical map `(⨁ i, A i) →ₗ[R] M` is bijective. -/
165+
canonical map `(⨁ i, A i) →ₗ[R] M` is bijective.
166+
167+
For the alternate statement in terms of independence and spanning, see
168+
`direct_sum.submodule_is_internal_iff_independent_and_supr_eq_top`. -/
166169
def submodule_is_internal {R M : Type*}
167170
[semiring R] [add_comm_monoid M] [module R M]
168171
(A : ι → submodule R M) : Prop :=
@@ -178,12 +181,36 @@ lemma submodule_is_internal.to_add_subgroup {R M : Type*}
178181
submodule_is_internal A ↔ add_subgroup_is_internal (λ i, (A i).to_add_subgroup) :=
179182
iff.rfl
180183

184+
/-- If a direct sum of submodules is internal then the submodules span the module. -/
181185
lemma submodule_is_internal.supr_eq_top {R M : Type*}
182-
[semiring R] [add_comm_monoid M] [module R M] (A : ι → submodule R M)
186+
[semiring R] [add_comm_monoid M] [module R M] {A : ι → submodule R M}
183187
(h : submodule_is_internal A) : supr A = ⊤ :=
184188
begin
185189
rw [submodule.supr_eq_range_dfinsupp_lsum, linear_map.range_eq_top],
186190
exact function.bijective.surjective h,
187191
end
188192

193+
/-- If a direct sum of submodules is internal then the submodules are independent. -/
194+
lemma submodule_is_internal.independent {R M : Type*}
195+
[semiring R] [add_comm_monoid M] [module R M] {A : ι → submodule R M}
196+
(h : submodule_is_internal A) : complete_lattice.independent A :=
197+
complete_lattice.independent_of_dfinsupp_lsum_injective _ h.injective
198+
199+
/-- Note that this is not generally true for `[semiring R]`; see
200+
`complete_lattice.independent.dfinsupp_lsum_injective` for details. -/
201+
lemma submodule_is_internal_of_independent_of_supr_eq_top {R M : Type*}
202+
[ring R] [add_comm_group M] [module R M] {A : ι → submodule R M}
203+
(hi : complete_lattice.independent A) (hs : supr A = ⊤) : submodule_is_internal A :=
204+
⟨hi.dfinsupp_lsum_injective, linear_map.range_eq_top.1 $
205+
(submodule.supr_eq_range_dfinsupp_lsum _).symm.trans hs⟩
206+
207+
/-- `iff` version of `direct_sum.submodule_is_internal_of_independent_of_supr_eq_top`,
208+
`direct_sum.submodule_is_internal.independent`, and `direct_sum.submodule_is_internal.supr_eq_top`.
209+
-/
210+
lemma submodule_is_internal_iff_independent_and_supr_eq_top {R M : Type*}
211+
[ring R] [add_comm_group M] [module R M] (A : ι → submodule R M) :
212+
submodule_is_internal A ↔ complete_lattice.independent A ∧ supr A = ⊤ :=
213+
⟨λ i, ⟨i.independent, i.supr_eq_top⟩,
214+
and.rec submodule_is_internal_of_independent_of_supr_eq_top⟩
215+
189216
end direct_sum

src/linear_algebra/dfinsupp.lean

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ def lsum [semiring S] [module S N] [smul_comm_class R S N] :
128128
map_add' := λ F G, by { ext x y, simp },
129129
map_smul' := λ c F, by { ext, simp } }
130130

131+
/-- While `simp` can prove this, it is often convenient to avoid unfolding `lsum` into `sum_add_hom`
132+
with `dfinsupp.lsum_apply_apply`. -/
133+
lemma lsum_single [semiring S] [module S N] [smul_comm_class R S N]
134+
(F : Π i, M i →ₗ[R] N) (i) (x : M i) :
135+
lsum S F (single i x) = F i x :=
136+
sum_add_hom_single _ _ _
137+
131138
end lsum
132139

133140
/-! ### Bundled versions of `dfinsupp.map_range`
@@ -277,3 +284,79 @@ lemma mem_bsupr_iff_exists_dfinsupp (p : ι → Prop) [decidable_pred p] (S : ι
277284
set_like.ext_iff.mp (bsupr_eq_range_dfinsupp_lsum p S) x
278285

279286
end submodule
287+
288+
namespace complete_lattice
289+
290+
open dfinsupp
291+
292+
/-- Independence of a family of submodules can be expressed as a quantifier over `dfinsupp`s.
293+
294+
This is an intermediate result used to prove
295+
`complete_lattice.independent_of_dfinsupp_lsum_injective` and
296+
`complete_lattice.independent.dfinsupp_lsum_injective`. -/
297+
lemma independent_iff_forall_dfinsupp {R M : Type*}
298+
[semiring R] [add_comm_monoid M] [module R M] (p : ι → submodule R M) :
299+
independent p ↔
300+
∀ i (x : p i) (v : Π₀ (i : ι), ↥(p i)), lsum ℕ (λ i, (p i).subtype) (erase i v) = x → x = 0 :=
301+
begin
302+
simp_rw [complete_lattice.independent_def, submodule.disjoint_def,
303+
submodule.mem_bsupr_iff_exists_dfinsupp, exists_imp_distrib, filter_ne_eq_erase],
304+
apply forall_congr (λ i, _),
305+
refine subtype.forall'.trans _,
306+
simp_rw submodule.coe_eq_zero,
307+
refl,
308+
end
309+
310+
/- If `dfinsupp.lsum` applied with `submodule.subtype` is injective then the submodules are
311+
independent. -/
312+
lemma independent_of_dfinsupp_lsum_injective {R M : Type*}
313+
[semiring R] [add_comm_monoid M] [module R M] (p : ι → submodule R M)
314+
(h : function.injective (lsum ℕ (λ i, (p i).subtype))) :
315+
independent p :=
316+
begin
317+
rw independent_iff_forall_dfinsupp,
318+
intros i x v hv,
319+
replace hv : lsum ℕ (λ i, (p i).subtype) (erase i v) = lsum ℕ (λ i, (p i).subtype) (single i x),
320+
{ simpa only [lsum_single] using hv, },
321+
have := dfinsupp.ext_iff.mp (h hv) i,
322+
simpa [eq_comm] using this,
323+
end
324+
325+
/-- The canonical map out of a direct sum of a family of submodules is injective when the submodules
326+
are `complete_lattice.independent`.
327+
328+
Note that this is not generally true for `[semiring R]`, for instance when `A` is the
329+
`ℕ`-submodules of the positive and negative integers.
330+
331+
See `counterexamples/direct_sum_is_internal.lean` for a proof of this fact. -/
332+
lemma independent.dfinsupp_lsum_injective {R M : Type*}
333+
[ring R] [add_comm_group M] [module R M] {p : ι → submodule R M}
334+
(h : independent p) : function.injective (lsum ℕ (λ i, (p i).subtype)) :=
335+
begin
336+
-- simplify everything down to binders over equalities in `M`
337+
rw independent_iff_forall_dfinsupp at h,
338+
suffices : (lsum ℕ (λ i, (p i).subtype)).ker = ⊥,
339+
{ -- Lean can't find this without our help
340+
letI : add_comm_group (Π₀ i, p i) := @dfinsupp.add_comm_group _ (λ i, p i) _,
341+
rw linear_map.ker_eq_bot at this, exact this },
342+
rw linear_map.ker_eq_bot',
343+
intros m hm,
344+
ext i : 1,
345+
-- split `m` into the piece at `i` and the pieces elsewhere, to match `h`
346+
rw [dfinsupp.zero_apply, ←neg_eq_zero],
347+
refine h i (-m i) m _,
348+
rwa [←erase_add_single i m, linear_map.map_add, lsum_single, submodule.subtype_apply,
349+
add_eq_zero_iff_eq_neg, ←submodule.coe_neg] at hm,
350+
end
351+
352+
/-- A family of submodules over an additive group are independent if and only iff `dfinsupp.lsum`
353+
applied with `submodule.subtype` is injective.
354+
355+
Note that this is not generally true for `[semiring R]`; see
356+
`complete_lattice.independent.dfinsupp_lsum_injective` for details. -/
357+
lemma independent_iff_dfinsupp_lsum_injective {R M : Type*}
358+
[ring R] [add_comm_group M] [module R M] (p : ι → submodule R M) :
359+
independent p ↔ function.injective (lsum ℕ (λ i, (p i).subtype)) :=
360+
⟨independent.dfinsupp_lsum_injective, independent_of_dfinsupp_lsum_injective p⟩
361+
362+
end complete_lattice

0 commit comments

Comments
 (0)