roseking's picture
Add lean source and binary files (part 6)
2c7d975 verified
Raw History Blame Contribute Delete
10.7 kB
17
def FactorsThroughFiniteFree (f : M →ₗ[R] N) : Prop :=
body · 3 lines
  ∃ (P : Type u) (_ : AddCommGroup P) (_ : Module R P)
    (_ : Module.Free R P) (_ : Module.Finite R P)
    (i : M →ₗ[R] P) (p : P →ₗ[R] N), p.comp i = f
22
def FactorsThroughFiniteProjective (f : M →ₗ[R] N) : Prop :=
body · 3 lines
  ∃ (P : Type u) (_ : AddCommGroup P) (_ : Module R P)
    (_ : Module.Projective R P) (_ : Module.Finite R P)
    (i : M →ₗ[R] P) (p : P →ₗ[R] N), p.comp i = f
29
theorem factorsThroughFiniteFree_iff_projective (f : M →ₗ[R] N) :
    FactorsThroughFiniteFree R M N f ↔ FactorsThroughFiniteProjective R M N f := by
proof · 12 lines
  constructor
  · rintro ⟨P, hP, hRP, hfree, hfinite, i, p, h⟩
    exact ⟨P, hP, hRP, inferInstance, hfinite, i, p, h⟩
  · rintro ⟨P, hP, hRP, hprojective, hfinite, i, p, h⟩
    obtain ⟨n, π, hπ⟩ := Module.Finite.exists_fin' R P
    obtain ⟨s, hs⟩ := Module.projective_lifting_property π (LinearMap.id : P →ₗ[R] P) hπ
    refine ⟨Fin n → R, inferInstance, inferInstance, inferInstance, inferInstance,
      s.comp i, p.comp π, ?_⟩
    ext x
    calc
      p (π (s (i x))) = p (i x) := congrArg p (DFunLike.congr_fun hs (i x))
      _ = f x := DFunLike.congr_fun h x
44
theorem factorsThroughFiniteFree_zero :
    FactorsThroughFiniteFree R M N (0 : M →ₗ[R] N) := by
proof · 1 line
  exact ⟨R, inferInstance, inferInstance, inferInstance, inferInstance, 0, 0, rfl⟩
48
theorem FactorsThroughFiniteFree.add {f g : M →ₗ[R] N}
    (hf : FactorsThroughFiniteFree R M N f) (hg : FactorsThroughFiniteFree R M N g) :
    FactorsThroughFiniteFree R M N (f + g) := by
proof · 6 lines
  rcases hf with ⟨P, hP, hRP, hfreeP, hfiniteP, i, p, rfl⟩
  rcases hg with ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, j, q, rfl⟩
  refine ⟨P × Q, inferInstance, inferInstance, inferInstance, inferInstance,
    i.prod j, p.coprod q, ?_⟩
  ext x
  rfl
58
theorem FactorsThroughFiniteFree.neg {f : M →ₗ[R] N}
    (hf : FactorsThroughFiniteFree R M N f) :
    FactorsThroughFiniteFree R M N (-f) := by
proof · 4 lines
  rcases hf with ⟨P, hP, hRP, hfreeP, hfiniteP, i, p, rfl⟩
  refine ⟨P, hP, hRP, hfreeP, hfiniteP, i, -p, ?_⟩
  ext x
  rfl
68
theorem FactorsThroughFiniteFree.postcomp {f : M →ₗ[R] N}
    (hf : FactorsThroughFiniteFree R M N f) (g : N →ₗ[R] P) :
    FactorsThroughFiniteFree R M P (g.comp f) := by
proof · 2 lines
  rcases hf with ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, i, p, rfl⟩
  exact ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, i, g.comp p, LinearMap.comp_assoc ..⟩
74
theorem FactorsThroughFiniteFree.precomp {f : M →ₗ[R] N}
    (hf : FactorsThroughFiniteFree R M N f) (g : L →ₗ[R] M) :
    FactorsThroughFiniteFree R L N (f.comp g) := by
proof · 2 lines
  rcases hf with ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, i, p, rfl⟩
  exact ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, i.comp g, p, (LinearMap.comp_assoc ..).symm⟩
82
def projectiveMaps : AddSubgroup (M →ₗ[R] N) where
body · 4 lines
  carrier := FactorsThroughFiniteFree R M N
  zero_mem' := factorsThroughFiniteFree_zero
  add_mem' := FactorsThroughFiniteFree.add
  neg_mem' := FactorsThroughFiniteFree.neg
88
abbrev StableHom := (M →ₗ[R] N) ⧸ projectiveMaps R M N
92
def classOf : (M →ₗ[R] N) →+ StableHom R M N :=
body · 1 line
  QuotientAddGroup.mk' (projectiveMaps R M N)
97
theorem classOf_surjective : Function.Surjective (classOf R M N) :=
proof · 1 line
  QuotientAddGroup.mk'_surjective _
101
theorem classOf_eq_zero_iff (f : M →ₗ[R] N) :
    classOf R M N f = 0 ↔ FactorsThroughFiniteFree R M N f :=
proof · 1 line
  QuotientAddGroup.eq_zero_iff f
105
theorem classOf_eq_zero_iff_projective (f : M →ₗ[R] N) :
    classOf R M N f = 0 ↔ FactorsThroughFiniteProjective R M N f := by
proof · 1 line
  rw [classOf_eq_zero_iff, factorsThroughFiniteFree_iff_projective]
110
theorem classOf_eq_iff (f g : M →ₗ[R] N) :
    classOf R M N f = classOf R M N g ↔ FactorsThroughFiniteFree R M N (f - g) :=
proof · 1 line
  QuotientAddGroup.eq_iff_sub_mem
114
theorem identity_eq_zero_iff [Module.Finite R M] :
    classOf R M M LinearMap.id = 0 ↔ Module.Projective R M := by
proof · 7 lines
  rw [classOf_eq_zero_iff_projective]
  constructor
  · rintro ⟨P, hP, hRP, hprojective, hfinite, i, p, h⟩
    exact Module.Projective.of_split i p h
  · intro h
    exact ⟨M, inferInstance, inferInstance, h, inferInstance,
      LinearMap.id, LinearMap.id, rfl⟩
124
def postcomp (g : N →ₗ[R] P) : StableHom R M N →+ StableHom R M P :=
body · 5 lines
  QuotientAddGroup.map (projectiveMaps R M N) (projectiveMaps R M P)
    { toFun := fun f => g.comp f
      map_zero' := LinearMap.comp_zero g
      map_add' := by intros; ext x; simp }
    (fun _ hf => hf.postcomp g)
131
def precomp (g : L →ₗ[R] M) : StableHom R M N →+ StableHom R L N :=
body · 5 lines
  QuotientAddGroup.map (projectiveMaps R M N) (projectiveMaps R L N)
    { toFun := fun f => f.comp g
      map_zero' := LinearMap.zero_comp g
      map_add' := by intros; ext x; simp }
    (fun _ hf => hf.precomp g)
139
theorem postcomp_classOf (g : N →ₗ[R] P) (f : M →ₗ[R] N) :
    postcomp g (classOf R M N f) = classOf R M P (g.comp f) := by
proof · 1 line
  exact QuotientAddGroup.map_mk' _ _ _ _ _
144
theorem precomp_classOf (g : L →ₗ[R] M) (f : M →ₗ[R] N) :
    precomp g (classOf R M N f) = classOf R L N (f.comp g) := by
proof · 1 line
  exact QuotientAddGroup.map_mk' _ _ _ _ _
148
def postcompHom : (N →ₗ[R] P) →+ (StableHom R M N →+ StableHom R M P) where
body · 14 lines
  toFun := postcomp
  map_zero' := by
    apply AddMonoidHom.ext
    intro f
    obtain ⟨f, rfl⟩ := classOf_surjective f
    simp
  map_add' := by
    intro g h
    apply AddMonoidHom.ext
    intro f
    obtain ⟨f, rfl⟩ := classOf_surjective f
    simp only [AddMonoidHom.add_apply, postcomp_classOf]
    rw [show (g + h).comp f = g.comp f + h.comp f by ext x; rfl]
    exact map_add (classOf R M P) _ _
164
def comp : StableHom R N P →+ (StableHom R M N →+ StableHom R M P) :=
body · 7 lines
  QuotientAddGroup.lift (projectiveMaps R N P) postcompHom (by
    intro g hg
    change postcomp g = 0
    apply AddMonoidHom.ext
    intro f
    obtain ⟨f, rfl⟩ := classOf_surjective f
    exact (classOf_eq_zero_iff (g.comp f)).mpr (hg.precomp f))
174
theorem comp_classOf (g : N →ₗ[R] P) (f : M →ₗ[R] N) :
    comp (classOf R N P g) (classOf R M N f) = classOf R M P (g.comp f) := by
proof · 2 lines
  change postcomp g (classOf R M N f) = _
  exact postcomp_classOf g f
179
def identity : StableHom R M M := classOf R M M LinearMap.id
182
theorem identity_comp (f : StableHom R M N) : comp identity f = f := by
proof · 2 lines
  obtain ⟨f, rfl⟩ := classOf_surjective f
  simp [identity]
187
theorem comp_identity (f : StableHom R M N) : comp f identity = f := by
proof · 2 lines
  obtain ⟨f, rfl⟩ := classOf_surjective f
  simp [identity]
191
theorem comp_assoc {Q : Type u} [AddCommGroup Q] [Module R Q]
    (h : StableHom R P Q) (g : StableHom R N P) (f : StableHom R M N) :
    comp h (comp g f) = comp (comp h g) f := by
proof · 4 lines
  obtain ⟨h, rfl⟩ := classOf_surjective h
  obtain ⟨g, rfl⟩ := classOf_surjective g
  obtain ⟨f, rfl⟩ := classOf_surjective f
  simp only [comp_classOf, LinearMap.comp_assoc]
199
theorem eq_zero_of_projective_source [Module.Finite R M] [Module.Projective R M]
    (f : StableHom R M N) : f = 0 := by
proof · 4 lines
  obtain ⟨f, rfl⟩ := classOf_surjective f
  apply (classOf_eq_zero_iff_projective f).mpr
  exact ⟨M, inferInstance, inferInstance, inferInstance, inferInstance,
    LinearMap.id, f, LinearMap.comp_id _⟩
206
theorem eq_zero_of_projective_target [Module.Finite R N] [Module.Projective R N]
    (f : StableHom R M N) : f = 0 := by
proof · 4 lines
  obtain ⟨f, rfl⟩ := classOf_surjective f
  apply (classOf_eq_zero_iff_projective f).mpr
  exact ⟨N, inferInstance, inferInstance, inferInstance, inferInstance,
    f, LinearMap.id, LinearMap.id_comp _⟩
221
theorem FactorsThroughFiniteFree.smul {f : M →ₗ[R] N}
    (hf : FactorsThroughFiniteFree R M N f) (a : k) :
    FactorsThroughFiniteFree R M N (a • f) := by
proof · 4 lines
  rcases hf with ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, i, p, rfl⟩
  refine ⟨Q, hQ, hRQ, hfreeQ, hfiniteQ, i, a • p, ?_⟩
  ext x
  rfl
229
def projectiveMapsSubmodule : Submodule k (M →ₗ[R] N) where
body · 2 lines
  __ := projectiveMaps R M N
  smul_mem' := fun a _ hf => hf.smul k a
233
instance stableHomModule : Module k (StableHom R M N) :=
body · 1 line
  inferInstanceAs (Module k ((M →ₗ[R] N) ⧸ projectiveMapsSubmodule k))
238
def classOfLinear : (M →ₗ[R] N) →ₗ[k] StableHom R M N :=
body · 1 line
  (projectiveMapsSubmodule k).mkQ
242
theorem classOfLinear_apply (f : M →ₗ[R] N) :
    classOfLinear k f = classOf R M N f := rfl
246
theorem classOf_smul (a : k) (f : M →ₗ[R] N) :
    classOf R M N (a • f) = a • classOf R M N f :=
proof · 1 line
  (classOfLinear k).map_smul a f
252
theorem comp_smul (g : StableHom R N P) (a : k) (f : StableHom R M N) :
    comp g (a • f) = a • comp g f := by
proof · 4 lines
  obtain ⟨g, rfl⟩ := classOf_surjective g
  obtain ⟨f, rfl⟩ := classOf_surjective f
  rw [← classOf_smul k a f, comp_classOf, LinearMap.comp_smul,
    classOf_smul, comp_classOf]
260
theorem smul_comp (a : k) (g : StableHom R N P) (f : StableHom R M N) :
    comp (a • g) f = a • comp g f := by
proof · 4 lines
  obtain ⟨g, rfl⟩ := classOf_surjective g
  obtain ⟨f, rfl⟩ := classOf_surjective f
  rw [← classOf_smul k a g, comp_classOf, LinearMap.smul_comp,
    classOf_smul, comp_classOf]
267
def postcompLinear (g : StableHom R N P) :
    StableHom R M N →ₗ[k] StableHom R M P where
body · 3 lines
  toFun := comp g
  map_add' := map_add (comp g)
  map_smul' := comp_smul k g
273
def compLinear :
    StableHom R N P →ₗ[k] (StableHom R M N →ₗ[k] StableHom R M P) where
body · 12 lines
  toFun := postcompLinear k
  map_add' := by
    intro g h
    apply LinearMap.ext
    intro f
    change comp (g + h) f = comp g f + comp h f
    exact DFunLike.congr_fun (map_add comp g h) f
  map_smul' := by
    intro a g
    apply LinearMap.ext
    intro f
    exact smul_comp k a g f
289
theorem compLinear_apply (g : StableHom R N P) (f : StableHom R M N) :
    compLinear k g f = comp g f := rfl