AlgebraicAnalysis/Module/TwoTermPageLength.lean

AlgebraicAnalysis library · bbbbf3fc358ca8100b158cec4cf47f336ab70163

1 module
2 public import Mathlib.RingTheory.Length
3 public import Mathlib.LinearAlgebra.Isomorphisms
4 public import Mathlib.Tactic
5 
6 @[expose] public section
7 
8 namespace AlgebraicAnalysis.TwoTermPageLength
9 
10 open scoped ENat
11 
12 theorem exists_boundary_eq_top_of_iSup_eq_top
13     {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M]
14     [IsNoetherian R M] (D : ℕ →o Submodule R M) (hD : ⨆ r, D r = ⊤) :
15     ∃ N, D N = ⊤ := by
16   obtain ⟨N, hN⟩ := (IsNoetherian.noetherian (⊤ : Submodule R M)).stabilizes_of_iSup_eq D hD
17   exact ⟨N, hN.symm⟩
18 
19 theorem twoTermPage_length_target_le_source
20     {R : Type*} [Ring R]
21     (A C : ℕ → Type*)
22     [∀ r, AddCommGroup (A r)] [∀ r, Module R (A r)]
23     [∀ r, AddCommGroup (C r)] [∀ r, Module R (C r)]
24     (hA0 : IsFiniteLength R (A 0))
25     (hC0 : IsFiniteLength R (C 0))
26     (d : ∀ r, A r →ₗ[R] C r)
27     (sourceSucc : ∀ r, A (r + 1) ≃ₗ[R] LinearMap.ker (d r))
28     (targetSucc : ∀ r, C (r + 1) ≃ₗ[R] C r ⧸ LinearMap.range (d r))
29     (N : ℕ) [Subsingleton (C N)] :
30     Module.length R (C 0) ≤ Module.length R (A 0) := by
31   have hA : ∀ r, IsFiniteLength R (A r) := by
32     intro r
33     induction r with
34     | zero => exact hA0
35     | succ r ihr =>
36         apply (sourceSucc r).symm.isFiniteLength
37         exact IsFiniteLength.of_injective ihr (Submodule.subtype_injective _)
38   have hC : ∀ r, IsFiniteLength R (C r) := by
39     intro r
40     induction r with
41     | zero => exact hC0
42     | succ r ihr =>
43         apply (targetSucc r).symm.isFiniteLength
44         exact IsFiniteLength.of_surjective ihr (Submodule.mkQ_surjective _)
45   let : ∀ r, IsNoetherian R (A r) := fun r =>
46     (isFiniteLength_iff_isNoetherian_isArtinian.mp (hA r)).1
47   let : ∀ r, IsArtinian R (A r) := fun r =>
48     (isFiniteLength_iff_isNoetherian_isArtinian.mp (hA r)).2
49   let : ∀ r, IsNoetherian R (C r) := fun r =>
50     (isFiniteLength_iff_isNoetherian_isArtinian.mp (hC r)).1
51   let : ∀ r, IsArtinian R (C r) := fun r =>
52     (isFiniteLength_iff_isNoetherian_isArtinian.mp (hC r)).2
53   have source_length (r : ℕ) :
54       Module.length R (A r) =
55         Module.length R (A (r + 1)) + Module.length R (LinearMap.range (d r)) := by
56     rw [(sourceSucc r).length_eq]
57     exact Module.length_eq_add_of_exact
58       (LinearMap.ker (d r)).subtype (d r).rangeRestrict
59       (Submodule.subtype_injective _)
60       (LinearMap.range_eq_top.mp (LinearMap.range_rangeRestrict (d r)))
61       (by
62         rw [LinearMap.exact_iff, Submodule.range_subtype, LinearMap.ker_rangeRestrict])
63   have target_length (r : ℕ) :
64       Module.length R (C r) =
65         Module.length R (LinearMap.range (d r)) + Module.length R (C (r + 1)) := by
66     rw [(targetSucc r).length_eq]
67     exact Module.length_eq_add_of_exact
68       (LinearMap.range (d r)).subtype (LinearMap.range (d r)).mkQ
69       (Submodule.subtype_injective _) (Submodule.mkQ_surjective _)
70       (LinearMap.exact_subtype_mkQ _)
71   have source_ne_top (r : ℕ) : Module.length R (A r) ≠ ⊤ := Module.length_ne_top
72   have target_ne_top (r : ℕ) : Module.length R (C r) ≠ ⊤ := Module.length_ne_top
73   have range_ne_top (r : ℕ) : Module.length R (LinearMap.range (d r)) ≠ ⊤ := by
74     exact Module.length_ne_top
75   have invariant : ∀ n,
76       ENat.toNat (Module.length R (C 0)) + ENat.toNat (Module.length R (A n)) =
77         ENat.toNat (Module.length R (A 0)) + ENat.toNat (Module.length R (C n)) := by
78     intro n
79     induction n with
80     | zero => simp [add_comm]
81     | succ n ih =>
82       have hs := congrArg ENat.toNat (source_length n)
83       have ht := congrArg ENat.toNat (target_length n)
84       rw [ENat.toNat_add (source_ne_top (n + 1)) (range_ne_top n)] at hs
85       rw [ENat.toNat_add (range_ne_top n) (target_ne_top (n + 1))] at ht
86       omega
87   have h := invariant N
88   have hCN : ENat.toNat (Module.length R (C N)) = 0 := by simp
89   rw [hCN, add_zero] at h
90   have hnat : ENat.toNat (Module.length R (C 0)) ≤
91       ENat.toNat (Module.length R (A 0)) := by omega
92   rw [← ENat.natCast_toNat (target_ne_top 0), ← ENat.natCast_toNat (source_ne_top 0)]
93   exact_mod_cast hnat
94 
95 #print axioms exists_boundary_eq_top_of_iSup_eq_top
96 #print axioms twoTermPage_length_target_le_source
97 
98 end AlgebraicAnalysis.TwoTermPageLength
99