state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
C : Type u_1 inst✝⁴ : Category.{?u.110309, u_1} C inst✝³ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K L M : HomologicalComplex C c φ✝ : K ⟶ L ψ : L ⟶ M i j✝ k✝ : ι inst✝² : HasHomology K i inst✝¹ : HasHomology L i inst✝ : HasHomology M i A : C k : A ⟶ X K i j : ι hj : ComplexShape.next c i = j hk : k ≫ d K i j = 0 φ : K ⟶ L ⊢ (k ≫ Hom.f φ i) ≫ d L i j = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by
rw [assoc, φ.comm, reassoc_of% hk, zero_comp]
@[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.391_0.3mDRYOmCgwAIyYF
@[reassoc (attr
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝⁴ : Category.{u_3, u_1} C inst✝³ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K L M : HomologicalComplex C c φ✝ : K ⟶ L ψ : L ⟶ M i j✝ k✝ : ι inst✝² : HasHomology K i inst✝¹ : HasHomology L i inst✝ : HasHomology M i A : C k : A ⟶ X K i j : ι hj : ComplexShape.next c i = j hk : k ≫ d K i j = 0 φ : K ⟶ L ⊢ liftCycles K k j hj hk ≫ cyclesMap φ i = liftCycles L (k ≫ Hom.f φ i) j hj (_ : (k ≫ Hom.f φ i) ≫ d L i j = 0)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by
simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i]
@[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.391_0.3mDRYOmCgwAIyYF
@[reassoc (attr
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι hj : ComplexShape.next c i = j h : d K i j = 0 inst✝ : HasHomology K i ⊢ IsIso (iCycles K i)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by
subst hj
lemma isIso_iCycles : IsIso (K.iCycles i) := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.473_0.3mDRYOmCgwAIyYF
lemma isIso_iCycles : IsIso (K.iCycles i)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i k : ι inst✝ : HasHomology K i h : d K i (ComplexShape.next c i) = 0 ⊢ IsIso (iCycles K i)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj
exact ShortComplex.isIso_iCycles _ h
lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.473_0.3mDRYOmCgwAIyYF
lemma isIso_iCycles : IsIso (K.iCycles i)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι hj : ComplexShape.next c i = j h : d K i j = 0 inst✝ : HasHomology K i ⊢ (sc K i).g = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by
aesop_cat
lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.493_0.3mDRYOmCgwAIyYF
lemma isIso_homologyι : IsIso (K.homologyι i)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι hi : ComplexShape.prev c j = i h : d K i j = 0 inst✝ : HasHomology K j ⊢ IsIso (pOpcycles K j)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by
obtain rfl := hi
lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.519_0.3mDRYOmCgwAIyYF
lemma isIso_pOpcycles : IsIso (K.pOpcycles j)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c j k : ι inst✝ : HasHomology K j h : d K (ComplexShape.prev c j) j = 0 ⊢ IsIso (pOpcycles K j)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi
exact ShortComplex.isIso_pOpcycles _ h
lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.519_0.3mDRYOmCgwAIyYF
lemma isIso_pOpcycles : IsIso (K.pOpcycles j)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι hi : ComplexShape.prev c j = i h : d K i j = 0 inst✝ : HasHomology K j ⊢ (sc K j).f = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by
aesop_cat
lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.539_0.3mDRYOmCgwAIyYF
lemma isIso_homologyπ : IsIso (K.homologyπ j)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝¹ : Category.{u_3, u_1} C inst✝ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι ⊢ ExactAt K i ↔ ShortComplex.Exact (sc K i)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by
rfl
lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.564_0.3mDRYOmCgwAIyYF
lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι inst✝ : HasHomology K i ⊢ ExactAt K i ↔ IsZero (homology K i)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by
dsimp [homology]
lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.571_0.3mDRYOmCgwAIyYF
lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_3, u_1} C inst✝¹ : HasZeroMorphisms C ι : Type u_2 c : ComplexShape ι K : HomologicalComplex C c i j k : ι inst✝ : HasHomology K i ⊢ ExactAt K i ↔ IsZero (ShortComplex.homology (sc K i))
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology]
rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology]
lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.571_0.3mDRYOmCgwAIyYF
lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{?u.155878, u_1} C inst✝¹ : HasZeroMorphisms C K L : ChainComplex C ℕ φ : K ⟶ L inst✝ : HomologicalComplex.HasHomology K 0 ⊢ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.down ℕ) 0) = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by
simp
instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.583_0.3mDRYOmCgwAIyYF
instance isIso_homologyι₀ : IsIso (K.homologyι 0)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{?u.157135, u_1} C inst✝¹ : HasZeroMorphisms C K L : ChainComplex C ℕ φ : K ⟶ L inst✝ : HomologicalComplex.HasHomology K 0 ⊢ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.down ℕ) 0) = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by
simp
/-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.587_0.3mDRYOmCgwAIyYF
/-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝³ : Category.{u_2, u_1} C inst✝² : HasZeroMorphisms C K L : ChainComplex C ℕ φ : K ⟶ L inst✝¹ : HomologicalComplex.HasHomology K 0 inst✝ : HomologicalComplex.HasHomology L 0 ⊢ (isoHomologyι₀ K).inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ (isoHomologyι₀ L).inv
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by
simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id]
@[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.594_0.3mDRYOmCgwAIyYF
@[reassoc (attr
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{?u.161113, u_1} C inst✝¹ : HasZeroMorphisms C K L : CochainComplex C ℕ φ : K ⟶ L inst✝ : HomologicalComplex.HasHomology K 0 ⊢ HomologicalComplex.d K (ComplexShape.prev (ComplexShape.up ℕ) 0) 0 = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by
simp
instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.609_0.3mDRYOmCgwAIyYF
instance isIso_homologyπ₀ : IsIso (K.homologyπ 0)
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{?u.162372, u_1} C inst✝¹ : HasZeroMorphisms C K L : CochainComplex C ℕ φ : K ⟶ L inst✝ : HomologicalComplex.HasHomology K 0 ⊢ HomologicalComplex.d K (ComplexShape.prev (ComplexShape.up ℕ) 0) 0 = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by
simp
/-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.613_0.3mDRYOmCgwAIyYF
/-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝³ : Category.{u_2, u_1} C inst✝² : HasZeroMorphisms C K L : CochainComplex C ℕ φ : K ⟶ L inst✝¹ : HomologicalComplex.HasHomology K 0 inst✝ : HomologicalComplex.HasHomology L 0 ⊢ HomologicalComplex.homologyMap φ 0 ≫ (isoHomologyπ₀ L).inv = (isoHomologyπ₀ K).inv ≫ HomologicalComplex.cyclesMap φ 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by
simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc]
@[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.620_0.3mDRYOmCgwAIyYF
@[reassoc (attr
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ homologyMap (-φ) i = -homologyMap φ i
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by
dsimp [homologyMap]
@[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.637_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ ShortComplex.homologyMap ((shortComplexFunctor C c i).map (-φ)) = -ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap]
rw [← ShortComplex.homologyMap_neg]
@[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.637_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ ShortComplex.homologyMap ((shortComplexFunctor C c i).map (-φ)) = ShortComplex.homologyMap (-(shortComplexFunctor C c i).map φ)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg]
rfl
@[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.637_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by
dsimp [homologyMap]
@[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.643_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ ShortComplex.homologyMap ((shortComplexFunctor C c i).map (φ + ψ)) = ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) + ShortComplex.homologyMap ((shortComplexFunctor C c i).map ψ)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap]
rw [← ShortComplex.homologyMap_add]
@[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.643_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ ShortComplex.homologyMap ((shortComplexFunctor C c i).map (φ + ψ)) = ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ + (shortComplexFunctor C c i).map ψ)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add]
rfl
@[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.643_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by
dsimp [homologyMap]
@[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.649_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ ShortComplex.homologyMap ((shortComplexFunctor C c i).map (φ - ψ)) = ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) - ShortComplex.homologyMap ((shortComplexFunctor C c i).map ψ)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap]
rw [← ShortComplex.homologyMap_sub]
@[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.649_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 ι : Type u_2 inst✝³ : Category.{u_3, u_1} C inst✝² : Preadditive C c : ComplexShape ι K L : HomologicalComplex C c f g φ ψ : K ⟶ L i : ι inst✝¹ : HasHomology K i inst✝ : HasHomology L i ⊢ ShortComplex.homologyMap ((shortComplexFunctor C c i).map (φ - ψ)) = ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ - (shortComplexFunctor C c i).map ψ)
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub]
rfl
@[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub]
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.649_0.3mDRYOmCgwAIyYF
@[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{?u.173930, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ : φ ≫ HomologicalComplex.d K 0 1 = 0 ⊢ ComplexShape.next (ComplexShape.up ℕ) 0 = 1
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by
simp
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ : φ ≫ HomologicalComplex.d K 0 1 = 0 ⊢ IsIso (HomologicalComplex.liftCycles K φ 1 (_ : ComplexShape.next (ComplexShape.up ℕ) 0 = 1) hφ) ↔ ShortComplex.Exact (ShortComplex.mk φ (HomologicalComplex.d K 0 1) hφ) ∧ Mono φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by
suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ : φ ≫ HomologicalComplex.d K 0 1 = 0 this : ∀ (i : ℕ) (hx : ComplexShape.next (ComplexShape.up ℕ) 0 = i) (hφ : φ ≫ HomologicalComplex.d K 0 i = 0), IsIso (HomologicalComplex.liftCycles K φ i hx hφ) ↔ ShortComplex.Exact (ShortComplex.mk φ (HomologicalComplex.d K 0 i) hφ) ∧ Mono φ ⊢ ComplexShape.next (ComplexShape.up ℕ) 0 = 1
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by
simp
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ : φ ≫ HomologicalComplex.d K 0 1 = 0 ⊢ ∀ (i : ℕ) (hx : ComplexShape.next (ComplexShape.up ℕ) 0 = i) (hφ : φ ≫ HomologicalComplex.d K 0 i = 0), IsIso (HomologicalComplex.liftCycles K φ i hx hφ) ↔ ShortComplex.Exact (ShortComplex.mk φ (HomologicalComplex.d K 0 i) hφ) ∧ Mono φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ
rintro _ rfl hφ
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : φ ≫ HomologicalComplex.d K 0 1 = 0 hφ : φ ≫ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0) = 0 ⊢ IsIso (HomologicalComplex.liftCycles K φ (ComplexShape.next (ComplexShape.up ℕ) 0) (_ : ComplexShape.next (ComplexShape.up ℕ) 0 = ComplexShape.next (ComplexShape.up ℕ) 0) hφ) ↔ ShortComplex.Exact (ShortComplex.mk φ (HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0)) hφ) ∧ Mono φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ
let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 }
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : φ ≫ HomologicalComplex.d K 0 1 = 0 hφ : φ ≫ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0) = 0 ⊢ 0 ≫ 0 = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by
simp
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : φ ≫ HomologicalComplex.d K 0 1 = 0 hφ : φ ≫ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0) = 0 α : ShortComplex.mk 0 0 (_ : 0 ≫ 0 = 0) ⟶ HomologicalComplex.sc K 0 := ShortComplex.Hom.mk 0 φ 0 ⊢ IsIso (HomologicalComplex.liftCycles K φ (ComplexShape.next (ComplexShape.up ℕ) 0) (_ : ComplexShape.next (ComplexShape.up ℕ) 0 = ComplexShape.next (ComplexShape.up ℕ) 0) hφ) ↔ ShortComplex.Exact (ShortComplex.mk φ (HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0)) hφ) ∧ Mono φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 }
exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp))
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 }
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : φ ≫ HomologicalComplex.d K 0 1 = 0 hφ : φ ≫ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0) = 0 α : ShortComplex.mk 0 0 (_ : 0 ≫ 0 = 0) ⟶ HomologicalComplex.sc K 0 := ShortComplex.Hom.mk 0 φ 0 ⊢ (HomologicalComplex.sc K 0).f = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by
simp
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : CochainComplex C ℕ X : C φ : X ⟶ HomologicalComplex.X K 0 inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : φ ≫ HomologicalComplex.d K 0 1 = 0 hφ : φ ≫ HomologicalComplex.d K 0 (ComplexShape.next (ComplexShape.up ℕ) 0) = 0 α : ShortComplex.mk 0 0 (_ : 0 ≫ 0 = 0) ⟶ HomologicalComplex.sc K 0 := ShortComplex.Hom.mk 0 φ 0 ⊢ (HomologicalComplex.sc K 0).f = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by
simp
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.663_0.3mDRYOmCgwAIyYF
lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{?u.181426, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ : HomologicalComplex.d K 1 0 ≫ φ = 0 ⊢ ComplexShape.prev (ComplexShape.down ℕ) 0 = 1
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by
simp
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ : HomologicalComplex.d K 1 0 ≫ φ = 0 ⊢ IsIso (HomologicalComplex.descOpcycles K φ 1 (_ : ComplexShape.prev (ComplexShape.down ℕ) 0 = 1) hφ) ↔ ShortComplex.Exact (ShortComplex.mk (HomologicalComplex.d K 1 0) φ hφ) ∧ Epi φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by
suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ : HomologicalComplex.d K 1 0 ≫ φ = 0 this : ∀ (i : ℕ) (hx : ComplexShape.prev (ComplexShape.down ℕ) 0 = i) (hφ : HomologicalComplex.d K i 0 ≫ φ = 0), IsIso (HomologicalComplex.descOpcycles K φ i hx hφ) ↔ ShortComplex.Exact (ShortComplex.mk (HomologicalComplex.d K i 0) φ hφ) ∧ Epi φ ⊢ ComplexShape.prev (ComplexShape.down ℕ) 0 = 1
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by
simp
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ : HomologicalComplex.d K 1 0 ≫ φ = 0 ⊢ ∀ (i : ℕ) (hx : ComplexShape.prev (ComplexShape.down ℕ) 0 = i) (hφ : HomologicalComplex.d K i 0 ≫ φ = 0), IsIso (HomologicalComplex.descOpcycles K φ i hx hφ) ↔ ShortComplex.Exact (ShortComplex.mk (HomologicalComplex.d K i 0) φ hφ) ∧ Epi φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ
rintro _ rfl hφ
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : HomologicalComplex.d K 1 0 ≫ φ = 0 hφ : HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0 ≫ φ = 0 ⊢ IsIso (HomologicalComplex.descOpcycles K φ (ComplexShape.prev (ComplexShape.down ℕ) 0) (_ : ComplexShape.prev (ComplexShape.down ℕ) 0 = ComplexShape.prev (ComplexShape.down ℕ) 0) hφ) ↔ ShortComplex.Exact (ShortComplex.mk (HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0) φ hφ) ∧ Epi φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ
let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 }
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : HomologicalComplex.d K 1 0 ≫ φ = 0 hφ : HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0 ≫ φ = 0 ⊢ 0 ≫ 0 = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by
simp
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : HomologicalComplex.d K 1 0 ≫ φ = 0 hφ : HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0 ≫ φ = 0 α : HomologicalComplex.sc K 0 ⟶ ShortComplex.mk 0 0 (_ : 0 ≫ 0 = 0) := ShortComplex.Hom.mk 0 φ 0 ⊢ IsIso (HomologicalComplex.descOpcycles K φ (ComplexShape.prev (ComplexShape.down ℕ) 0) (_ : ComplexShape.prev (ComplexShape.down ℕ) 0 = ComplexShape.prev (ComplexShape.down ℕ) 0) hφ) ↔ ShortComplex.Exact (ShortComplex.mk (HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0) φ hφ) ∧ Epi φ
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 }
exact (ShortComplex.quasiIso_iff_isIso_descOpcycles α (by simp) rfl rfl).symm.trans (ShortComplex.quasiIso_iff_of_zeros' α (by simp) rfl rfl)
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 }
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : HomologicalComplex.d K 1 0 ≫ φ = 0 hφ : HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0 ≫ φ = 0 α : HomologicalComplex.sc K 0 ⟶ ShortComplex.mk 0 0 (_ : 0 ≫ 0 = 0) := ShortComplex.Hom.mk 0 φ 0 ⊢ (HomologicalComplex.sc K 0).g = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_descOpcycles α (by
simp
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_descOpcycles α (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
C : Type u_1 inst✝² : Category.{u_2, u_1} C inst✝¹ : Abelian C K : ChainComplex C ℕ X : C φ : HomologicalComplex.X K 0 ⟶ X inst✝ : HomologicalComplex.HasHomology K 0 hφ✝ : HomologicalComplex.d K 1 0 ≫ φ = 0 hφ : HomologicalComplex.d K (ComplexShape.prev (ComplexShape.down ℕ) 0) 0 ≫ φ = 0 α : HomologicalComplex.sc K 0 ⟶ ShortComplex.mk 0 0 (_ : 0 ≫ 0 = 0) := ShortComplex.Hom.mk 0 φ 0 ⊢ (HomologicalComplex.sc K 0).g = 0
/- Copyright (c) 2023 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.Algebra.Homology.Additive import Mathlib.Algebra.Homology.ShortComplex.Exact import Mathlib.Algebra.Homology.ShortComplex.Preadditive import Mathlib.Tactic.Linarith /-! # The short complexes attached to homological complexes In this file, we define a functor `shortComplexFunctor C c i : HomologicalComplex C c ⥤ ShortComplex C`. By definition, the image of a homological complex `K` by this functor is the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. The homology `K.homology i` of a homological complex `K` in degree `i` is defined as the homology of the short complex `(shortComplexFunctor C c i).obj K`, which can be abbreviated as `K.sc i`. -/ open CategoryTheory Category Limits namespace HomologicalComplex variable (C : Type*) [Category C] [HasZeroMorphisms C] {ι : Type*} (c : ComplexShape ι) /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ @[simps] def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where obj K := ShortComplex.mk (K.d i j) (K.d j k) (K.d_comp_d i j k) map f := { τ₁ := f.f i τ₂ := f.f j τ₃ := f.f k } /-- The functor `HomologicalComplex C c ⥤ ShortComplex C` which sends a homological complex `K` to the short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ @[simps!] noncomputable def shortComplexFunctor (i : ι) := shortComplexFunctor' C c (c.prev i) i (c.next i) /-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k` when `c.prev j = i` and `c.next j = k`. -/ @[simps!] noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) : shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k := NatIso.ofComponents (fun K => ShortComplex.isoMk (K.XIsoOfEq hi) (Iso.refl _) (K.XIsoOfEq hk) (by aesop_cat) (by aesop_cat)) (by aesop_cat) variable {C c} section variable (K L M : HomologicalComplex C c) (φ : K ⟶ L) (ψ : L ⟶ M) (i j k : ι) /-- The short complex `K.X i ⟶ K.X j ⟶ K.X k` for arbitrary indices `i`, `j` and `k`. -/ abbrev sc' := (shortComplexFunctor' C c i j k).obj K /-- The short complex `K.X (c.prev i) ⟶ K.X i ⟶ K.X (c.next i)`. -/ noncomputable abbrev sc := (shortComplexFunctor C c i).obj K /-- The canonical isomorphism `K.sc j ≅ K.sc' i j k` when `c.prev j = i` and `c.next j = k`. -/ noncomputable abbrev isoSc' (hi : c.prev j = i) (hk : c.next j = k) : K.sc j ≅ K.sc' i j k := (natIsoSc' C c i j k hi hk).app K /-- A homological complex `K` has homology in degree `i` if the associated short complex `K.sc i` has. -/ abbrev HasHomology := (K.sc i).HasHomology variable [K.HasHomology i] /-- The homology in degree `i` of a homological complex. -/ noncomputable def homology := (K.sc i).homology /-- Comparison isomorphism between the homology for the two homology API. -/ noncomputable def homology'IsoHomology {A : Type*} [Category A] [Abelian A] (K : HomologicalComplex A c) (i : ι) : K.homology' i ≅ K.homology i := (K.sc i).homology'IsoHomology /-- The cycles in degree `i` of a homological complex. -/ noncomputable def cycles := (K.sc i).cycles /-- The inclusion of the cycles of a homological complex. -/ noncomputable def iCycles : K.cycles i ⟶ K.X i := (K.sc i).iCycles /-- The homology class map from cycles to the homology of a homological complex. -/ noncomputable def homologyπ : K.cycles i ⟶ K.homology i := (K.sc i).homologyπ variable {i} /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ noncomputable def liftCycles {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := (K.sc i).liftCycles k (by subst hj; exact hk) /-- The morphism to `K.cycles i` that is induced by a "cycle", i.e. a morphism to `K.X i` whose postcomposition with the differential is zero. -/ @[reducible] noncomputable def liftCycles' {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.Rel i j) (hk : k ≫ K.d i j = 0) : A ⟶ K.cycles i := K.liftCycles k j (c.next_eq' hj) hk @[reassoc (attr := simp)] lemma liftCycles_i {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) : K.liftCycles k j hj hk ≫ K.iCycles i = k := by dsimp [liftCycles, iCycles] simp variable (i) /-- The map `K.X i ⟶ K.cycles j` induced by the differential `K.d i j`. -/ noncomputable def toCycles [K.HasHomology j] : K.X i ⟶ K.cycles j := K.liftCycles (K.d i j) (c.next j) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma iCycles_d : K.iCycles i ≫ K.d i j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.next_eq' hij exact (K.sc i).iCycles_g · rw [K.shape _ _ hij, comp_zero] /-- `K.cycles i` is the kernel of `K.d i j` when `c.next i = j`. -/ noncomputable def cyclesIsKernel (hj : c.next i = j) : IsLimit (KernelFork.ofι (K.iCycles i) (K.iCycles_d i j)) := by obtain rfl := hj exact (K.sc i).cyclesIsKernel @[reassoc (attr := simp)] lemma toCycles_i [K.HasHomology j] : K.toCycles i j ≫ K.iCycles j = K.d i j := liftCycles_i _ _ _ _ _ instance : Mono (K.iCycles i) := by dsimp only [iCycles] infer_instance instance : Epi (K.homologyπ i) := by dsimp only [homologyπ] infer_instance @[reassoc (attr := simp)] lemma d_toCycles [K.HasHomology k] : K.d i j ≫ K.toCycles j k = 0 := by simp only [← cancel_mono (K.iCycles k), assoc, toCycles_i, d_comp_d, zero_comp] variable {i} @[reassoc] lemma comp_liftCycles {A' A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (α : A' ⟶ A) : α ≫ K.liftCycles k j hj hk = K.liftCycles (α ≫ k) j hj (by rw [assoc, hk, comp_zero]) := by simp only [← cancel_mono (K.iCycles i), assoc, liftCycles_i] @[reassoc] lemma liftCycles_homologyπ_eq_zero_of_boundary {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) {i' : ι} (x : A ⟶ K.X i') (hx : k = x ≫ K.d i' i) : K.liftCycles k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) ≫ K.homologyπ i = 0 := by by_cases h : c.Rel i' i · obtain rfl := c.prev_eq' h exact (K.sc i).liftCycles_homologyπ_eq_zero_of_boundary _ x hx · have : liftCycles K k j hj (by rw [hx, assoc, K.d_comp_d, comp_zero]) = 0 := by rw [K.shape _ _ h, comp_zero] at hx rw [← cancel_mono (K.iCycles i), zero_comp, liftCycles_i, hx] rw [this, zero_comp] variable (i) @[reassoc (attr := simp)] lemma toCycles_comp_homologyπ [K.HasHomology j] : K.toCycles i j ≫ K.homologyπ j = 0 := K.liftCycles_homologyπ_eq_zero_of_boundary (K.d i j) (c.next j) rfl (𝟙 _) (by simp) /-- `K.homology j` is the cokernel of `K.toCycles i j : K.X i ⟶ K.cycles j` when `c.prev j = i`. -/ noncomputable def homologyIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.homologyπ j) (K.toCycles_comp_homologyπ i j)) := by subst hi exact ((K.sc j).homologyIsCokernel) /-- The opcycles in degree `i` of a homological complex. -/ noncomputable def opcycles := (K.sc i).opcycles /-- The projection to the opcycles of a homological complex. -/ noncomputable def pOpcycles : K.X i ⟶ K.opcycles i := (K.sc i).pOpcycles /-- The inclusion map of the homology of a homological complex into its opcycles. -/ noncomputable def homologyι : K.homology i ⟶ K.opcycles i := (K.sc i).homologyι variable {i} /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ noncomputable def descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := (K.sc i).descOpcycles k (by subst hj; exact hk) /-- The morphism from `K.opcycles i` that is induced by an "opcycle", i.e. a morphism from `K.X i` whose precomposition with the differential is zero. -/ @[reducible] noncomputable def descOpcycles' {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.Rel j i) (hk : K.d j i ≫ k = 0) : K.opcycles i ⟶ A := K.descOpcycles k j (c.prev_eq' hj) hk @[reassoc (attr := simp)] lemma p_descOpcycles {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) : K.pOpcycles i ≫ K.descOpcycles k j hj hk = k := by dsimp [descOpcycles, pOpcycles] simp variable (i) /-- The map `K.opcycles i ⟶ K.X j` induced by the differential `K.d i j`. -/ noncomputable def fromOpcycles : K.opcycles i ⟶ K.X j := K.descOpcycles (K.d i j) (c.prev i) rfl (K.d_comp_d _ _ _) @[reassoc (attr := simp)] lemma d_pOpcycles [K.HasHomology j] : K.d i j ≫ K.pOpcycles j = 0 := by by_cases hij : c.Rel i j · obtain rfl := c.prev_eq' hij exact (K.sc j).f_pOpcycles · rw [K.shape _ _ hij, zero_comp] /-- `K.opcycles j` is the cokernel of `K.d i j` when `c.prev j = i`. -/ noncomputable def opcyclesIsCokernel (hi : c.prev j = i) [K.HasHomology j] : IsColimit (CokernelCofork.ofπ (K.pOpcycles j) (K.d_pOpcycles i j)) := by obtain rfl := hi exact (K.sc j).opcyclesIsCokernel @[reassoc (attr := simp)] lemma p_fromOpcycles : K.pOpcycles i ≫ K.fromOpcycles i j = K.d i j := p_descOpcycles _ _ _ _ _ instance : Epi (K.pOpcycles i) := by dsimp only [pOpcycles] infer_instance instance : Mono (K.homologyι i) := by dsimp only [homologyι] infer_instance @[reassoc (attr := simp)] lemma fromOpcycles_d : K.fromOpcycles i j ≫ K.d j k = 0 := by simp only [← cancel_epi (K.pOpcycles i), p_fromOpcycles_assoc, d_comp_d, comp_zero] variable {i} @[reassoc] lemma descOpcycles_comp {A A' : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : K.d j i ≫ k = 0) (α : A ⟶ A') : K.descOpcycles k j hj hk ≫ α = K.descOpcycles (k ≫ α) j hj (by rw [reassoc_of% hk, zero_comp]) := by simp only [← cancel_epi (K.pOpcycles i), p_descOpcycles_assoc, p_descOpcycles] @[reassoc] lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι) (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) : K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by by_cases h : c.Rel i i' · obtain rfl := c.next_eq' h exact (K.sc i).homologyι_descOpcycles_eq_zero_of_boundary _ x hx · have : K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0 := by rw [K.shape _ _ h, zero_comp] at hx rw [← cancel_epi (K.pOpcycles i), comp_zero, p_descOpcycles, hx] rw [this, comp_zero] variable (i) @[reassoc (attr := simp)] lemma homologyι_comp_fromOpcycles : K.homologyι i ≫ K.fromOpcycles i j = 0 := K.homologyι_descOpcycles_eq_zero_of_boundary (K.d i j) _ rfl (𝟙 _) (by simp) /-- `K.homology i` is the kernel of `K.fromOpcycles i j : K.opcycles i ⟶ K.X j` when `c.next i = j`. -/ noncomputable def homologyIsKernel (hi : c.next i = j) : IsLimit (KernelFork.ofι (K.homologyι i) (K.homologyι_comp_fromOpcycles i j)) := by subst hi exact (K.sc i).homologyIsKernel variable {K L M} variable [L.HasHomology i] [M.HasHomology i] /-- The map `K.homology i ⟶ L.homology i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def homologyMap : K.homology i ⟶ L.homology i := ShortComplex.homologyMap ((shortComplexFunctor C c i).map φ) /-- The map `K.cycles i ⟶ L.cycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def cyclesMap : K.cycles i ⟶ L.cycles i := ShortComplex.cyclesMap ((shortComplexFunctor C c i).map φ) /-- The map `K.opcycles i ⟶ L.opcycles i` induced by a morphism in `HomologicalComplex`. -/ noncomputable def opcyclesMap : K.opcycles i ⟶ L.opcycles i := ShortComplex.opcyclesMap ((shortComplexFunctor C c i).map φ) @[reassoc (attr := simp)] lemma cyclesMap_i : cyclesMap φ i ≫ L.iCycles i = K.iCycles i ≫ φ.f i := ShortComplex.cyclesMap_i _ @[reassoc (attr := simp)] lemma p_opcyclesMap : K.pOpcycles i ≫ opcyclesMap φ i = φ.f i ≫ L.pOpcycles i := ShortComplex.p_opcyclesMap _ instance [Mono (φ.f i)] : Mono (cyclesMap φ i) := mono_of_mono_fac (cyclesMap_i φ i) attribute [local instance] epi_comp instance [Epi (φ.f i)] : Epi (opcyclesMap φ i) := epi_of_epi_fac (p_opcyclesMap φ i) variable (K) @[simp] lemma homologyMap_id : homologyMap (𝟙 K) i = 𝟙 _ := ShortComplex.homologyMap_id _ @[simp] lemma cyclesMap_id : cyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.cyclesMap_id _ @[simp] lemma opcyclesMap_id : opcyclesMap (𝟙 K) i = 𝟙 _ := ShortComplex.opcyclesMap_id _ variable {K} @[reassoc] lemma homologyMap_comp : homologyMap (φ ≫ ψ) i = homologyMap φ i ≫ homologyMap ψ i := by dsimp [homologyMap] rw [Functor.map_comp, ShortComplex.homologyMap_comp] @[reassoc] lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i := by dsimp [cyclesMap] rw [Functor.map_comp, ShortComplex.cyclesMap_comp] @[reassoc] lemma opcyclesMap_comp : opcyclesMap (φ ≫ ψ) i = opcyclesMap φ i ≫ opcyclesMap ψ i := by dsimp [opcyclesMap] rw [Functor.map_comp, ShortComplex.opcyclesMap_comp] variable (K L) @[simp] lemma homologyMap_zero : homologyMap (0 : K ⟶ L) i = 0 := ShortComplex.homologyMap_zero _ _ @[simp] lemma cyclesMap_zero : cyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.cyclesMap_zero _ _ @[simp] lemma opcyclesMap_zero : opcyclesMap (0 : K ⟶ L) i = 0 := ShortComplex.opcyclesMap_zero _ _ variable {K L} @[reassoc (attr := simp)] lemma homologyπ_naturality : K.homologyπ i ≫ homologyMap φ i = cyclesMap φ i ≫ L.homologyπ i := ShortComplex.homologyπ_naturality _ @[reassoc (attr := simp)] lemma homologyι_naturality : homologyMap φ i ≫ L.homologyι i = K.homologyι i ≫ opcyclesMap φ i := ShortComplex.homologyι_naturality _ @[reassoc (attr := simp)] lemma homology_π_ι : K.homologyπ i ≫ K.homologyι i = K.iCycles i ≫ K.pOpcycles i := (K.sc i).homology_π_ι variable {i} @[reassoc (attr := simp)] lemma opcyclesMap_comp_descOpcycles {A : C} (k : L.X i ⟶ A) (j : ι) (hj : c.prev i = j) (hk : L.d j i ≫ k = 0) (φ : K ⟶ L) : opcyclesMap φ i ≫ L.descOpcycles k j hj hk = K.descOpcycles (φ.f i ≫ k) j hj (by rw [← φ.comm_assoc, hk, comp_zero]) := by simp only [← cancel_epi (K.pOpcycles i), p_opcyclesMap_assoc, p_descOpcycles] @[reassoc (attr := simp)] lemma liftCycles_comp_cyclesMap {A : C} (k : A ⟶ K.X i) (j : ι) (hj : c.next i = j) (hk : k ≫ K.d i j = 0) (φ : K ⟶ L) : K.liftCycles k j hj hk ≫ cyclesMap φ i = L.liftCycles (k ≫ φ.f i) j hj (by rw [assoc, φ.comm, reassoc_of% hk, zero_comp]) := by simp only [← cancel_mono (L.iCycles i), assoc, cyclesMap_i, liftCycles_i_assoc, liftCycles_i] section variable (C c i) attribute [local simp] homologyMap_comp cyclesMap_comp opcyclesMap_comp /-- The `i`th homology functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def homologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.homology i map f := homologyMap f i /-- The homology functor to graded objects. -/ @[simps] noncomputable def gradedHomologyFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ GradedObject ι C where obj K i := K.homology i map f i := homologyMap f i /-- The `i`th cycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def cyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.cycles i map f := cyclesMap f i /-- The `i`th opcycles functor `HomologicalComplex C c ⥤ C`. -/ @[simps] noncomputable def opcyclesFunctor [CategoryWithHomology C] : HomologicalComplex C c ⥤ C where obj K := K.opcycles i map f := opcyclesMap f i /-- The natural transformation `K.homologyπ i : K.cycles i ⟶ K.homology i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyπ [CategoryWithHomology C] : cyclesFunctor C c i ⟶ homologyFunctor C c i where app K := K.homologyπ i /-- The natural transformation `K.homologyι i : K.homology i ⟶ K.opcycles i` for all `K : HomologicalComplex C c`. -/ @[simps] noncomputable def natTransHomologyι [CategoryWithHomology C] : homologyFunctor C c i ⟶ opcyclesFunctor C c i where app K := K.homologyι i /-- The natural isomorphism `K.homology i ≅ (K.sc i).homology` for all homological complexes `K`. -/ @[simps!] noncomputable def homologyFunctorIso [CategoryWithHomology C] : homologyFunctor C c i ≅ shortComplexFunctor C c i ⋙ ShortComplex.homologyFunctor C := Iso.refl _ /-- The natural isomorphism `K.homology j ≅ (K.sc' i j k).homology` for all homological complexes `K` when `c.prev j = i` and `c.next j = k`. -/ noncomputable def homologyFunctorIso' [CategoryWithHomology C] (hi : c.prev j = i) (hk : c.next j = k) : homologyFunctor C c j ≅ shortComplexFunctor' C c i j k ⋙ ShortComplex.homologyFunctor C := homologyFunctorIso C c j ≪≫ isoWhiskerRight (natIsoSc' C c i j k hi hk) _ instance [CategoryWithHomology C] : (homologyFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (opcyclesFunctor C c i).PreservesZeroMorphisms where instance [CategoryWithHomology C] : (cyclesFunctor C c i).PreservesZeroMorphisms where end end variable (K : HomologicalComplex C c) (i j k : ι) section variable (hj : c.next i = j) (h : K.d i j = 0) [K.HasHomology i] lemma isIso_iCycles : IsIso (K.iCycles i) := by subst hj exact ShortComplex.isIso_iCycles _ h /-- The canonical isomorphism `K.cycles i ≅ K.X i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def iCyclesIso : K.cycles i ≅ K.X i := have := K.isIso_iCycles i j hj h asIso (K.iCycles i) @[reassoc (attr := simp)] lemma iCyclesIso_hom_inv_id : K.iCycles i ≫ (K.iCyclesIso i j hj h).inv = 𝟙 _ := (K.iCyclesIso i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma iCyclesIso_inv_hom_id : (K.iCyclesIso i j hj h).inv ≫ K.iCycles i = 𝟙 _ := (K.iCyclesIso i j hj h).inv_hom_id lemma isIso_homologyι : IsIso (K.homologyι i) := ShortComplex.isIso_homologyι _ (by aesop_cat) /-- The canonical isomorphism `K.homology i ≅ K.opcycles i` when the differential from `i` is zero. -/ @[simps! hom] noncomputable def isoHomologyι : K.homology i ≅ K.opcycles i := have := K.isIso_homologyι i j hj h asIso (K.homologyι i) @[reassoc (attr := simp)] lemma isoHomologyι_hom_inv_id : K.homologyι i ≫ (K.isoHomologyι i j hj h).inv = 𝟙 _ := (K.isoHomologyι i j hj h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyι_inv_hom_id : (K.isoHomologyι i j hj h).inv ≫ K.homologyι i = 𝟙 _ := (K.isoHomologyι i j hj h).inv_hom_id end section variable (hi : c.prev j = i) (h : K.d i j = 0) [K.HasHomology j] lemma isIso_pOpcycles : IsIso (K.pOpcycles j) := by obtain rfl := hi exact ShortComplex.isIso_pOpcycles _ h /-- The canonical isomorphism `K.X j ≅ K.opCycles j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def pOpcyclesIso : K.X j ≅ K.opcycles j := have := K.isIso_pOpcycles i j hi h asIso (K.pOpcycles j) @[reassoc (attr := simp)] lemma pOpcyclesIso_hom_inv_id : K.pOpcycles j ≫ (K.pOpcyclesIso i j hi h).inv = 𝟙 _ := (K.pOpcyclesIso i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma pOpcyclesIso_inv_hom_id : (K.pOpcyclesIso i j hi h).inv ≫ K.pOpcycles j = 𝟙 _ := (K.pOpcyclesIso i j hi h).inv_hom_id lemma isIso_homologyπ : IsIso (K.homologyπ j) := ShortComplex.isIso_homologyπ _ (by aesop_cat) /-- The canonical isomorphism `K.cycles j ≅ K.homology j` when the differential to `j` is zero. -/ @[simps! hom] noncomputable def isoHomologyπ : K.cycles j ≅ K.homology j := have := K.isIso_homologyπ i j hi h asIso (K.homologyπ j) @[reassoc (attr := simp)] lemma isoHomologyπ_hom_inv_id : K.homologyπ j ≫ (K.isoHomologyπ i j hi h).inv = 𝟙 _ := (K.isoHomologyπ i j hi h).hom_inv_id @[reassoc (attr := simp)] lemma isoHomologyπ_inv_hom_id : (K.isoHomologyπ i j hi h).inv ≫ K.homologyπ j = 𝟙 _ := (K.isoHomologyπ i j hi h).inv_hom_id end /-- A homological complex `K` is exact at `i` if the short complex `K.sc i` is exact. -/ def ExactAt := (K.sc i).Exact lemma exactAt_iff : K.ExactAt i ↔ (K.sc i).Exact := by rfl lemma exactAt_iff' (hi : c.prev j = i) (hk : c.next j = k) : K.ExactAt j ↔ (K.sc' i j k).Exact := ShortComplex.exact_iff_of_iso (K.isoSc' i j k hi hk) lemma exactAt_iff_isZero_homology [K.HasHomology i] : K.ExactAt i ↔ IsZero (K.homology i) := by dsimp [homology] rw [exactAt_iff, ShortComplex.exact_iff_isZero_homology] end HomologicalComplex namespace ChainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : ChainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyι₀ : IsIso (K.homologyι 0) := K.isIso_homologyι 0 _ rfl (by simp) /-- The canonical isomorphism `K.homology 0 ≅ K.opcycles 0` for a chain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyι₀ : K.homology 0 ≅ K.opcycles 0 := K.isoHomologyι 0 _ rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyι₀_inv_naturality [L.HasHomology 0] : K.isoHomologyι₀.inv ≫ HomologicalComplex.homologyMap φ 0 = HomologicalComplex.opcyclesMap φ 0 ≫ L.isoHomologyι₀.inv := by simp only [assoc, ← cancel_mono (L.homologyι 0), HomologicalComplex.homologyι_naturality, HomologicalComplex.isoHomologyι_inv_hom_id_assoc, HomologicalComplex.isoHomologyι_inv_hom_id, comp_id] end ChainComplex namespace CochainComplex variable {C : Type*} [Category C] [HasZeroMorphisms C] (K L : CochainComplex C ℕ) (φ : K ⟶ L) [K.HasHomology 0] instance isIso_homologyπ₀ : IsIso (K.homologyπ 0) := K.isIso_homologyπ _ 0 rfl (by simp) /-- The canonical isomorphism `K.cycles 0 ≅ K.homology 0` for a cochain complex `K` indexed by `ℕ`. -/ noncomputable abbrev isoHomologyπ₀ : K.cycles 0 ≅ K.homology 0 := K.isoHomologyπ _ 0 rfl (by simp) variable {K L} @[reassoc (attr := simp)] lemma isoHomologyπ₀_inv_naturality [L.HasHomology 0] : HomologicalComplex.homologyMap φ 0 ≫ L.isoHomologyπ₀.inv = K.isoHomologyπ₀.inv ≫ HomologicalComplex.cyclesMap φ 0 := by simp only [← cancel_epi (K.homologyπ 0), HomologicalComplex.homologyπ_naturality_assoc, HomologicalComplex.isoHomologyπ_hom_inv_id, comp_id, HomologicalComplex.isoHomologyπ_hom_inv_id_assoc] end CochainComplex namespace HomologicalComplex variable {C ι : Type*} [Category C] [Preadditive C] {c : ComplexShape ι} {K L : HomologicalComplex C c} {f g : K ⟶ L} variable (φ ψ : K ⟶ L) (i : ι) [K.HasHomology i] [L.HasHomology i] @[simp] lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_neg] rfl @[simp] lemma homologyMap_add : homologyMap (φ + ψ) i = homologyMap φ i + homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_add] rfl @[simp] lemma homologyMap_sub : homologyMap (φ - ψ) i = homologyMap φ i - homologyMap ψ i := by dsimp [homologyMap] rw [← ShortComplex.homologyMap_sub] rfl instance [CategoryWithHomology C] : (homologyFunctor C c i).Additive where end HomologicalComplex namespace CochainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_liftCycles_iff (K : CochainComplex C ℕ) {X : C} (φ : X ⟶ K.X 0) [K.HasHomology 0] (hφ : φ ≫ K.d 0 1 = 0) : IsIso (K.liftCycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.up ℕ).next 0 = i) (hφ : φ ≫ K.d 0 i = 0), IsIso (K.liftCycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Mono φ from this 1 (by simp) hφ rintro _ rfl hφ let α : ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) ⟶ K.sc 0 := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_liftCycles α rfl rfl (by simp)).symm.trans (ShortComplex.quasiIso_iff_of_zeros α rfl rfl (by simp)) end CochainComplex namespace ChainComplex variable {C : Type*} [Category C] [Abelian C] lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_descOpcycles α (by simp) rfl rfl).symm.trans (ShortComplex.quasiIso_iff_of_zeros' α (by
simp
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ := by suffices ∀ (i : ℕ) (hx : (ComplexShape.down ℕ).prev 0 = i) (hφ : K.d i 0 ≫ φ = 0), IsIso (K.descOpcycles φ i hx hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ from this 1 (by simp) hφ rintro _ rfl hφ let α : K.sc 0 ⟶ ShortComplex.mk (0 : X ⟶ X) (0 : X ⟶ X) (by simp) := { τ₁ := 0 τ₂ := φ τ₃ := 0 } exact (ShortComplex.quasiIso_iff_isIso_descOpcycles α (by simp) rfl rfl).symm.trans (ShortComplex.quasiIso_iff_of_zeros' α (by
Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.684_0.3mDRYOmCgwAIyYF
lemma isIso_descOpcycles_iff (K : ChainComplex C ℕ) {X : C} (φ : K.X 0 ⟶ X) [K.HasHomology 0] (hφ : K.d 1 0 ≫ φ = 0) : IsIso (K.descOpcycles φ 1 (by simp) hφ) ↔ (ShortComplex.mk _ _ hφ).Exact ∧ Epi φ
Mathlib_Algebra_Homology_ShortComplex_HomologicalComplex
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁴ : LE α inst✝³ : OrderTop α inst✝² : PartialOrder β inst✝¹ : OrderTop β inst✝ : OrderIsoClass F α β f : F a : α ⊢ f a = ⊤ ↔ a = ⊤
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by
letI : TopHomClass F α β := OrderIsoClass.toTopHomClass
@[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by
Mathlib.Order.Hom.Bounded.138_0.4FzgGE1bSNjCw87
@[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁴ : LE α inst✝³ : OrderTop α inst✝² : PartialOrder β inst✝¹ : OrderTop β inst✝ : OrderIsoClass F α β f : F a : α this : TopHomClass F α β := OrderIsoClass.toTopHomClass ⊢ f a = ⊤ ↔ a = ⊤
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass
rw [← map_top f, (EquivLike.injective f).eq_iff]
@[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass
Mathlib.Order.Hom.Bounded.138_0.4FzgGE1bSNjCw87
@[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁴ : LE α inst✝³ : OrderBot α inst✝² : PartialOrder β inst✝¹ : OrderBot β inst✝ : OrderIsoClass F α β f : F a : α ⊢ f a = ⊥ ↔ a = ⊥
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by
letI : BotHomClass F α β := OrderIsoClass.toBotHomClass
@[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by
Mathlib.Order.Hom.Bounded.148_0.4FzgGE1bSNjCw87
@[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁴ : LE α inst✝³ : OrderBot α inst✝² : PartialOrder β inst✝¹ : OrderBot β inst✝ : OrderIsoClass F α β f : F a : α this : BotHomClass F α β := OrderIsoClass.toBotHomClass ⊢ f a = ⊥ ↔ a = ⊥
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass
rw [← map_bot f, (EquivLike.injective f).eq_iff]
@[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass
Mathlib.Order.Hom.Bounded.148_0.4FzgGE1bSNjCw87
@[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Top α inst✝² : Top β inst✝¹ : Top γ inst✝ : Top δ f g : TopHom α β h : f.toFun = g.toFun ⊢ f = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by
cases f
instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by
Mathlib.Order.Hom.Bounded.195_0.4FzgGE1bSNjCw87
instance : TopHomClass (TopHom α β) α β where coe
Mathlib_Order_Hom_Bounded
case mk F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Top α inst✝² : Top β inst✝¹ : Top γ inst✝ : Top δ g : TopHom α β toFun✝ : α → β map_top'✝ : toFun✝ ⊤ = ⊤ h : { toFun := toFun✝, map_top' := map_top'✝ }.toFun = g.toFun ⊢ { toFun := toFun✝, map_top' := map_top'✝ } = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f;
cases g
instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f;
Mathlib.Order.Hom.Bounded.195_0.4FzgGE1bSNjCw87
instance : TopHomClass (TopHom α β) α β where coe
Mathlib_Order_Hom_Bounded
case mk.mk F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Top α inst✝² : Top β inst✝¹ : Top γ inst✝ : Top δ toFun✝¹ : α → β map_top'✝¹ : toFun✝¹ ⊤ = ⊤ toFun✝ : α → β map_top'✝ : toFun✝ ⊤ = ⊤ h : { toFun := toFun✝¹, map_top' := map_top'✝¹ }.toFun = { toFun := toFun✝, map_top' := map_top'✝ }.toFun ⊢ { toFun := toFun✝¹, map_top' := map_top'✝¹ } = { toFun := toFun✝, map_top' := map_top'✝ }
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g;
congr
instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g;
Mathlib.Order.Hom.Bounded.195_0.4FzgGE1bSNjCw87
instance : TopHomClass (TopHom α β) α β where coe
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Top α inst✝² : Top β inst✝¹ : Top γ inst✝ : Top δ f : TopHom β γ g : TopHom α β ⊢ (⇑f ∘ ⇑g) ⊤ = ⊤
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by
rw [comp_apply, map_top, map_top]
/-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by
Mathlib.Order.Hom.Bounded.250_0.4FzgGE1bSNjCw87
/-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Top α inst✝² : Top β inst✝¹ : Top γ inst✝ : Top δ g : TopHom β γ f₁ f₂ : TopHom α β hg : Injective ⇑g h : comp g f₁ = comp g f₂ a : α ⊢ g (f₁ a) = g (f₂ a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by
rw [← TopHom.comp_apply, h, TopHom.comp_apply]
@[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by
Mathlib.Order.Hom.Bounded.289_0.4FzgGE1bSNjCw87
@[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝² : Top α inst✝¹ : SemilatticeInf β inst✝ : OrderTop β f✝ g✝ f g : TopHom α β ⊢ (⇑f ⊓ ⇑g) ⊤ = ⊤
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by
rw [Pi.inf_apply, map_top, map_top, inf_top_eq]
instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by
Mathlib.Order.Hom.Bounded.328_0.4FzgGE1bSNjCw87
instance : Inf (TopHom α β)
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝² : Top α inst✝¹ : SemilatticeSup β inst✝ : OrderTop β f✝ g✝ f g : TopHom α β ⊢ (⇑f ⊔ ⇑g) ⊤ = ⊤
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by
rw [Pi.sup_apply, map_top, map_top, sup_top_eq]
instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by
Mathlib.Order.Hom.Bounded.350_0.4FzgGE1bSNjCw87
instance : Sup (TopHom α β)
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Bot α inst✝² : Bot β inst✝¹ : Bot γ inst✝ : Bot δ f g : BotHom α β h : f.toFun = g.toFun ⊢ f = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by
cases f
instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by
Mathlib.Order.Hom.Bounded.387_0.4FzgGE1bSNjCw87
instance : BotHomClass (BotHom α β) α β where coe
Mathlib_Order_Hom_Bounded
case mk F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Bot α inst✝² : Bot β inst✝¹ : Bot γ inst✝ : Bot δ g : BotHom α β toFun✝ : α → β map_bot'✝ : toFun✝ ⊥ = ⊥ h : { toFun := toFun✝, map_bot' := map_bot'✝ }.toFun = g.toFun ⊢ { toFun := toFun✝, map_bot' := map_bot'✝ } = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f;
cases g
instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f;
Mathlib.Order.Hom.Bounded.387_0.4FzgGE1bSNjCw87
instance : BotHomClass (BotHom α β) α β where coe
Mathlib_Order_Hom_Bounded
case mk.mk F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Bot α inst✝² : Bot β inst✝¹ : Bot γ inst✝ : Bot δ toFun✝¹ : α → β map_bot'✝¹ : toFun✝¹ ⊥ = ⊥ toFun✝ : α → β map_bot'✝ : toFun✝ ⊥ = ⊥ h : { toFun := toFun✝¹, map_bot' := map_bot'✝¹ }.toFun = { toFun := toFun✝, map_bot' := map_bot'✝ }.toFun ⊢ { toFun := toFun✝¹, map_bot' := map_bot'✝¹ } = { toFun := toFun✝, map_bot' := map_bot'✝ }
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g;
congr
instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g;
Mathlib.Order.Hom.Bounded.387_0.4FzgGE1bSNjCw87
instance : BotHomClass (BotHom α β) α β where coe
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Bot α inst✝² : Bot β inst✝¹ : Bot γ inst✝ : Bot δ f : BotHom β γ g : BotHom α β ⊢ (⇑f ∘ ⇑g) ⊥ = ⊥
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by
rw [comp_apply, map_bot, map_bot]
/-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by
Mathlib.Order.Hom.Bounded.442_0.4FzgGE1bSNjCw87
/-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝³ : Bot α inst✝² : Bot β inst✝¹ : Bot γ inst✝ : Bot δ g : BotHom β γ f₁ f₂ : BotHom α β hg : Injective ⇑g h : comp g f₁ = comp g f₂ a : α ⊢ g (f₁ a) = g (f₂ a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by
rw [← BotHom.comp_apply, h, BotHom.comp_apply]
@[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by
Mathlib.Order.Hom.Bounded.481_0.4FzgGE1bSNjCw87
@[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝² : Bot α inst✝¹ : SemilatticeInf β inst✝ : OrderBot β f✝ g✝ f g : BotHom α β ⊢ (⇑f ⊓ ⇑g) ⊥ = ⊥
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply], congr_arg _⟩ #align bot_hom.cancel_left BotHom.cancel_left end Bot instance [Preorder β] [Bot β] : Preorder (BotHom α β) := Preorder.lift (FunLike.coe : BotHom α β → α → β) instance [PartialOrder β] [Bot β] : PartialOrder (BotHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderBot variable [Preorder β] [OrderBot β] instance : OrderBot (BotHom α β) where bot := ⟨⊥, rfl⟩ bot_le := fun _ => @bot_le (α → β) _ _ _ @[simp] theorem coe_bot : ⇑(⊥ : BotHom α β) = ⊥ := rfl #align bot_hom.coe_bot BotHom.coe_bot @[simp] theorem bot_apply (a : α) : (⊥ : BotHom α β) a = ⊥ := rfl #align bot_hom.bot_apply BotHom.bot_apply end OrderBot section SemilatticeInf variable [SemilatticeInf β] [OrderBot β] (f g : BotHom α β) instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by
rw [Pi.inf_apply, map_bot, map_bot, inf_bot_eq]
instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by
Mathlib.Order.Hom.Bounded.520_0.4FzgGE1bSNjCw87
instance : Inf (BotHom α β)
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝² : Bot α inst✝¹ : SemilatticeSup β inst✝ : OrderBot β f✝ g✝ f g : BotHom α β ⊢ (⇑f ⊔ ⇑g) ⊥ = ⊥
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply], congr_arg _⟩ #align bot_hom.cancel_left BotHom.cancel_left end Bot instance [Preorder β] [Bot β] : Preorder (BotHom α β) := Preorder.lift (FunLike.coe : BotHom α β → α → β) instance [PartialOrder β] [Bot β] : PartialOrder (BotHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderBot variable [Preorder β] [OrderBot β] instance : OrderBot (BotHom α β) where bot := ⟨⊥, rfl⟩ bot_le := fun _ => @bot_le (α → β) _ _ _ @[simp] theorem coe_bot : ⇑(⊥ : BotHom α β) = ⊥ := rfl #align bot_hom.coe_bot BotHom.coe_bot @[simp] theorem bot_apply (a : α) : (⊥ : BotHom α β) a = ⊥ := rfl #align bot_hom.bot_apply BotHom.bot_apply end OrderBot section SemilatticeInf variable [SemilatticeInf β] [OrderBot β] (f g : BotHom α β) instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_bot, map_bot, inf_bot_eq]⟩⟩ instance : SemilatticeInf (BotHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align bot_hom.coe_inf BotHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align bot_hom.inf_apply BotHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderBot β] (f g : BotHom α β) instance : Sup (BotHom α β) := ⟨fun f g => ⟨f ⊔ g, by
rw [Pi.sup_apply, map_bot, map_bot, sup_bot_eq]
instance : Sup (BotHom α β) := ⟨fun f g => ⟨f ⊔ g, by
Mathlib.Order.Hom.Bounded.542_0.4FzgGE1bSNjCw87
instance : Sup (BotHom α β)
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁷ : Preorder α inst✝⁶ : Preorder β inst✝⁵ : Preorder γ inst✝⁴ : Preorder δ inst✝³ : BoundedOrder α inst✝² : BoundedOrder β inst✝¹ : BoundedOrder γ inst✝ : BoundedOrder δ f g : BoundedOrderHom α β h : (fun f => f.toFun) f = (fun f => f.toFun) g ⊢ f = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply], congr_arg _⟩ #align bot_hom.cancel_left BotHom.cancel_left end Bot instance [Preorder β] [Bot β] : Preorder (BotHom α β) := Preorder.lift (FunLike.coe : BotHom α β → α → β) instance [PartialOrder β] [Bot β] : PartialOrder (BotHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderBot variable [Preorder β] [OrderBot β] instance : OrderBot (BotHom α β) where bot := ⟨⊥, rfl⟩ bot_le := fun _ => @bot_le (α → β) _ _ _ @[simp] theorem coe_bot : ⇑(⊥ : BotHom α β) = ⊥ := rfl #align bot_hom.coe_bot BotHom.coe_bot @[simp] theorem bot_apply (a : α) : (⊥ : BotHom α β) a = ⊥ := rfl #align bot_hom.bot_apply BotHom.bot_apply end OrderBot section SemilatticeInf variable [SemilatticeInf β] [OrderBot β] (f g : BotHom α β) instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_bot, map_bot, inf_bot_eq]⟩⟩ instance : SemilatticeInf (BotHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align bot_hom.coe_inf BotHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align bot_hom.inf_apply BotHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderBot β] (f g : BotHom α β) instance : Sup (BotHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_bot, map_bot, sup_bot_eq]⟩⟩ instance : SemilatticeSup (BotHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align bot_hom.coe_sup BotHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align bot_hom.sup_apply BotHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderBot β] : Lattice (BotHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderBot β] : DistribLattice (BotHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end BotHom /-! ### Bounded order homomorphisms -/ -- Porting note: todo: remove this configuration and use the default configuration. -- We keep this to be consistent with Lean 3. initialize_simps_projections BoundedOrderHom (+toOrderHom, -toFun) namespace BoundedOrderHom variable [Preorder α] [Preorder β] [Preorder γ] [Preorder δ] [BoundedOrder α] [BoundedOrder β] [BoundedOrder γ] [BoundedOrder δ] /-- Reinterpret a `BoundedOrderHom` as a `TopHom`. -/ def toTopHom (f : BoundedOrderHom α β) : TopHom α β := { f with } #align bounded_order_hom.to_top_hom BoundedOrderHom.toTopHom /-- Reinterpret a `BoundedOrderHom` as a `BotHom`. -/ def toBotHom (f : BoundedOrderHom α β) : BotHom α β := { f with } #align bounded_order_hom.to_bot_hom BoundedOrderHom.toBotHom instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by
Mathlib.Order.Hom.Bounded.589_0.4FzgGE1bSNjCw87
instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f
Mathlib_Order_Hom_Bounded
case mk.mk F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁷ : Preorder α inst✝⁶ : Preorder β inst✝⁵ : Preorder γ inst✝⁴ : Preorder δ inst✝³ : BoundedOrder α inst✝² : BoundedOrder β inst✝¹ : BoundedOrder γ inst✝ : BoundedOrder δ g : BoundedOrderHom α β toFun✝ : α → β monotone'✝ : Monotone toFun✝ map_top'✝ : OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } ⊤ = ⊤ map_bot'✝ : OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } ⊥ = ⊥ h : (fun f => f.toFun) { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ }, map_top' := map_top'✝, map_bot' := map_bot'✝ } = (fun f => f.toFun) g ⊢ { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ }, map_top' := map_top'✝, map_bot' := map_bot'✝ } = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply], congr_arg _⟩ #align bot_hom.cancel_left BotHom.cancel_left end Bot instance [Preorder β] [Bot β] : Preorder (BotHom α β) := Preorder.lift (FunLike.coe : BotHom α β → α → β) instance [PartialOrder β] [Bot β] : PartialOrder (BotHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderBot variable [Preorder β] [OrderBot β] instance : OrderBot (BotHom α β) where bot := ⟨⊥, rfl⟩ bot_le := fun _ => @bot_le (α → β) _ _ _ @[simp] theorem coe_bot : ⇑(⊥ : BotHom α β) = ⊥ := rfl #align bot_hom.coe_bot BotHom.coe_bot @[simp] theorem bot_apply (a : α) : (⊥ : BotHom α β) a = ⊥ := rfl #align bot_hom.bot_apply BotHom.bot_apply end OrderBot section SemilatticeInf variable [SemilatticeInf β] [OrderBot β] (f g : BotHom α β) instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_bot, map_bot, inf_bot_eq]⟩⟩ instance : SemilatticeInf (BotHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align bot_hom.coe_inf BotHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align bot_hom.inf_apply BotHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderBot β] (f g : BotHom α β) instance : Sup (BotHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_bot, map_bot, sup_bot_eq]⟩⟩ instance : SemilatticeSup (BotHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align bot_hom.coe_sup BotHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align bot_hom.sup_apply BotHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderBot β] : Lattice (BotHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderBot β] : DistribLattice (BotHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end BotHom /-! ### Bounded order homomorphisms -/ -- Porting note: todo: remove this configuration and use the default configuration. -- We keep this to be consistent with Lean 3. initialize_simps_projections BoundedOrderHom (+toOrderHom, -toFun) namespace BoundedOrderHom variable [Preorder α] [Preorder β] [Preorder γ] [Preorder δ] [BoundedOrder α] [BoundedOrder β] [BoundedOrder γ] [BoundedOrder δ] /-- Reinterpret a `BoundedOrderHom` as a `TopHom`. -/ def toTopHom (f : BoundedOrderHom α β) : TopHom α β := { f with } #align bounded_order_hom.to_top_hom BoundedOrderHom.toTopHom /-- Reinterpret a `BoundedOrderHom` as a `BotHom`. -/ def toBotHom (f : BoundedOrderHom α β) : BotHom α β := { f with } #align bounded_order_hom.to_bot_hom BoundedOrderHom.toBotHom instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f;
obtain ⟨⟨_, _⟩, _⟩ := g
instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f;
Mathlib.Order.Hom.Bounded.589_0.4FzgGE1bSNjCw87
instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f
Mathlib_Order_Hom_Bounded
case mk.mk.mk.mk F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁷ : Preorder α inst✝⁶ : Preorder β inst✝⁵ : Preorder γ inst✝⁴ : Preorder δ inst✝³ : BoundedOrder α inst✝² : BoundedOrder β inst✝¹ : BoundedOrder γ inst✝ : BoundedOrder δ toFun✝¹ : α → β monotone'✝¹ : Monotone toFun✝¹ map_top'✝¹ : OrderHom.toFun { toFun := toFun✝¹, monotone' := monotone'✝¹ } ⊤ = ⊤ map_bot'✝¹ : OrderHom.toFun { toFun := toFun✝¹, monotone' := monotone'✝¹ } ⊥ = ⊥ toFun✝ : α → β monotone'✝ : Monotone toFun✝ map_top'✝ : OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } ⊤ = ⊤ map_bot'✝ : OrderHom.toFun { toFun := toFun✝, monotone' := monotone'✝ } ⊥ = ⊥ h : (fun f => f.toFun) { toOrderHom := { toFun := toFun✝¹, monotone' := monotone'✝¹ }, map_top' := map_top'✝¹, map_bot' := map_bot'✝¹ } = (fun f => f.toFun) { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ }, map_top' := map_top'✝, map_bot' := map_bot'✝ } ⊢ { toOrderHom := { toFun := toFun✝¹, monotone' := monotone'✝¹ }, map_top' := map_top'✝¹, map_bot' := map_bot'✝¹ } = { toOrderHom := { toFun := toFun✝, monotone' := monotone'✝ }, map_top' := map_top'✝, map_bot' := map_bot'✝ }
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply], congr_arg _⟩ #align bot_hom.cancel_left BotHom.cancel_left end Bot instance [Preorder β] [Bot β] : Preorder (BotHom α β) := Preorder.lift (FunLike.coe : BotHom α β → α → β) instance [PartialOrder β] [Bot β] : PartialOrder (BotHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderBot variable [Preorder β] [OrderBot β] instance : OrderBot (BotHom α β) where bot := ⟨⊥, rfl⟩ bot_le := fun _ => @bot_le (α → β) _ _ _ @[simp] theorem coe_bot : ⇑(⊥ : BotHom α β) = ⊥ := rfl #align bot_hom.coe_bot BotHom.coe_bot @[simp] theorem bot_apply (a : α) : (⊥ : BotHom α β) a = ⊥ := rfl #align bot_hom.bot_apply BotHom.bot_apply end OrderBot section SemilatticeInf variable [SemilatticeInf β] [OrderBot β] (f g : BotHom α β) instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_bot, map_bot, inf_bot_eq]⟩⟩ instance : SemilatticeInf (BotHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align bot_hom.coe_inf BotHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align bot_hom.inf_apply BotHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderBot β] (f g : BotHom α β) instance : Sup (BotHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_bot, map_bot, sup_bot_eq]⟩⟩ instance : SemilatticeSup (BotHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align bot_hom.coe_sup BotHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align bot_hom.sup_apply BotHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderBot β] : Lattice (BotHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderBot β] : DistribLattice (BotHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end BotHom /-! ### Bounded order homomorphisms -/ -- Porting note: todo: remove this configuration and use the default configuration. -- We keep this to be consistent with Lean 3. initialize_simps_projections BoundedOrderHom (+toOrderHom, -toFun) namespace BoundedOrderHom variable [Preorder α] [Preorder β] [Preorder γ] [Preorder δ] [BoundedOrder α] [BoundedOrder β] [BoundedOrder γ] [BoundedOrder δ] /-- Reinterpret a `BoundedOrderHom` as a `TopHom`. -/ def toTopHom (f : BoundedOrderHom α β) : TopHom α β := { f with } #align bounded_order_hom.to_top_hom BoundedOrderHom.toTopHom /-- Reinterpret a `BoundedOrderHom` as a `BotHom`. -/ def toBotHom (f : BoundedOrderHom α β) : BotHom α β := { f with } #align bounded_order_hom.to_bot_hom BoundedOrderHom.toBotHom instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f; obtain ⟨⟨_, _⟩, _⟩ := g;
congr
instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f; obtain ⟨⟨_, _⟩, _⟩ := g;
Mathlib.Order.Hom.Bounded.589_0.4FzgGE1bSNjCw87
instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f
Mathlib_Order_Hom_Bounded
F : Type u_1 α : Type u_2 β : Type u_3 γ : Type u_4 δ : Type u_5 inst✝⁷ : Preorder α inst✝⁶ : Preorder β inst✝⁵ : Preorder γ inst✝⁴ : Preorder δ inst✝³ : BoundedOrder α inst✝² : BoundedOrder β inst✝¹ : BoundedOrder γ inst✝ : BoundedOrder δ g : BoundedOrderHom β γ f₁ f₂ : BoundedOrderHom α β hg : Injective ⇑g h : comp g f₁ = comp g f₂ a : α ⊢ g (f₁ a) = g (f₂ a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Order.Hom.Basic import Mathlib.Order.BoundedOrder #align_import order.hom.bounded from "leanprover-community/mathlib"@"f1a2caaf51ef593799107fe9a8d5e411599f3996" /-! # Bounded order homomorphisms This file defines (bounded) order homomorphisms. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `TopHom`: Maps which preserve `⊤`. * `BotHom`: Maps which preserve `⊥`. * `BoundedOrderHom`: Bounded order homomorphisms. Monotone maps which preserve `⊤` and `⊥`. ## Typeclasses * `TopHomClass` * `BotHomClass` * `BoundedOrderHomClass` -/ open Function OrderDual variable {F α β γ δ : Type*} /-- The type of `⊤`-preserving functions from `α` to `β`. -/ structure TopHom (α β : Type*) [Top α] [Top β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ #align top_hom TopHom /-- The type of `⊥`-preserving functions from `α` to `β`. -/ structure BotHom (α β : Type*) [Bot α] [Bot β] where /-- The underlying function. The preferred spelling is `FunLike.coe`. -/ toFun : α → β /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bot_hom BotHom /-- The type of bounded order homomorphisms from `α` to `β`. -/ structure BoundedOrderHom (α β : Type*) [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] extends OrderHom α β where /-- The function preserves the top element. The preferred spelling is `map_top`. -/ map_top' : toFun ⊤ = ⊤ /-- The function preserves the bottom element. The preferred spelling is `map_bot`. -/ map_bot' : toFun ⊥ = ⊥ #align bounded_order_hom BoundedOrderHom section /-- `TopHomClass F α β` states that `F` is a type of `⊤`-preserving morphisms. You should extend this class when you extend `TopHom`. -/ class TopHomClass (F : Type*) (α β : outParam <| Type*) [Top α] [Top β] extends FunLike F α fun _ => β where /-- A `TopHomClass` morphism preserves the top element. -/ map_top (f : F) : f ⊤ = ⊤ #align top_hom_class TopHomClass /-- `BotHomClass F α β` states that `F` is a type of `⊥`-preserving morphisms. You should extend this class when you extend `BotHom`. -/ class BotHomClass (F : Type*) (α β : outParam <| Type*) [Bot α] [Bot β] extends FunLike F α fun _ => β where /-- A `BotHomClass` morphism preserves the bottom element. -/ map_bot (f : F) : f ⊥ = ⊥ #align bot_hom_class BotHomClass /-- `BoundedOrderHomClass F α β` states that `F` is a type of bounded order morphisms. You should extend this class when you extend `BoundedOrderHom`. -/ class BoundedOrderHomClass (F : Type*) (α β : outParam <| Type*) [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where /-- Morphisms preserve the top element. The preferred spelling is `_root_.map_top`. -/ map_top (f : F) : f ⊤ = ⊤ /-- Morphisms preserve the bottom element. The preferred spelling is `_root_.map_bot`. -/ map_bot (f : F) : f ⊥ = ⊥ #align bounded_order_hom_class BoundedOrderHomClass end export TopHomClass (map_top) export BotHomClass (map_bot) attribute [simp] map_top map_bot -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toTopHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : TopHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_top_hom_class BoundedOrderHomClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) BoundedOrderHomClass.toBotHomClass [LE α] [LE β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : BotHomClass F α β := { ‹BoundedOrderHomClass F α β› with } #align bounded_order_hom_class.to_bot_hom_class BoundedOrderHomClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toTopHomClass [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] : TopHomClass F α β := { show OrderHomClass F α β from inferInstance with map_top := fun f => top_le_iff.1 <| (map_inv_le_iff f).1 le_top } #align order_iso_class.to_top_hom_class OrderIsoClass.toTopHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBotHomClass [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] : BotHomClass F α β := { --⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩ show OrderHomClass F α β from inferInstance with map_bot := fun f => le_bot_iff.1 <| (le_map_inv_iff f).1 bot_le } #align order_iso_class.to_bot_hom_class OrderIsoClass.toBotHomClass -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toBoundedOrderHomClass [LE α] [BoundedOrder α] [PartialOrder β] [BoundedOrder β] [OrderIsoClass F α β] : BoundedOrderHomClass F α β := { show OrderHomClass F α β from inferInstance, OrderIsoClass.toTopHomClass, OrderIsoClass.toBotHomClass with } #align order_iso_class.to_bounded_order_hom_class OrderIsoClass.toBoundedOrderHomClass -- Porting note: the `letI` is needed because we can't make the -- `OrderTop` parameters instance implicit in `OrderIsoClass.toTopHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊤ ↔ a = ⊤ := by letI : TopHomClass F α β := OrderIsoClass.toTopHomClass rw [← map_top f, (EquivLike.injective f).eq_iff] #align map_eq_top_iff map_eq_top_iff -- Porting note: the `letI` is needed because we can't make the -- `OrderBot` parameters instance implicit in `OrderIsoClass.toBotHomClass`, -- and they apparently can't be figured out through unification. @[simp] theorem map_eq_bot_iff [LE α] [OrderBot α] [PartialOrder β] [OrderBot β] [OrderIsoClass F α β] (f : F) {a : α} : f a = ⊥ ↔ a = ⊥ := by letI : BotHomClass F α β := OrderIsoClass.toBotHomClass rw [← map_bot f, (EquivLike.injective f).eq_iff] #align map_eq_bot_iff map_eq_bot_iff /-- Turn an element of a type `F` satisfying `TopHomClass F α β` into an actual `TopHom`. This is declared as the default coercion from `F` to `TopHom α β`. -/ @[coe] def TopHomClass.toTopHom [Top α] [Top β] [TopHomClass F α β] (f : F) : TopHom α β := ⟨f, map_top f⟩ instance [Top α] [Top β] [TopHomClass F α β] : CoeTC F (TopHom α β) := ⟨TopHomClass.toTopHom⟩ /-- Turn an element of a type `F` satisfying `BotHomClass F α β` into an actual `BotHom`. This is declared as the default coercion from `F` to `BotHom α β`. -/ @[coe] def BotHomClass.toBotHom [Bot α] [Bot β] [BotHomClass F α β] (f : F) : BotHom α β := ⟨f, map_bot f⟩ instance [Bot α] [Bot β] [BotHomClass F α β] : CoeTC F (BotHom α β) := ⟨BotHomClass.toBotHom⟩ /-- Turn an element of a type `F` satisfying `BoundedOrderHomClass F α β` into an actual `BoundedOrderHom`. This is declared as the default coercion from `F` to `BoundedOrderHom α β`. -/ @[coe] def BoundedOrderHomClass.toBoundedOrderHom [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] (f : F) : BoundedOrderHom α β := { (f : α →o β) with toFun := f, map_top' := map_top f, map_bot' := map_bot f } instance [Preorder α] [Preorder β] [BoundedOrder α] [BoundedOrder β] [BoundedOrderHomClass F α β] : CoeTC F (BoundedOrderHom α β) := ⟨BoundedOrderHomClass.toBoundedOrderHom⟩ /-! ### Top homomorphisms -/ namespace TopHom variable [Top α] section Top variable [Top β] [Top γ] [Top δ] instance : TopHomClass (TopHom α β) α β where coe := TopHom.toFun coe_injective' f g h := by cases f; cases g; congr map_top := TopHom.map_top' #noalign top_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections TopHom (toFun → apply) @[ext] theorem ext {f g : TopHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align top_hom.ext TopHom.ext /-- Copy of a `TopHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : TopHom α β) (f' : α → β) (h : f' = f) : TopHom α β where toFun := f' map_top' := h.symm ▸ f.map_top' #align top_hom.copy TopHom.copy @[simp] theorem coe_copy (f : TopHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align top_hom.coe_copy TopHom.coe_copy theorem copy_eq (f : TopHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align top_hom.copy_eq TopHom.copy_eq instance : Inhabited (TopHom α β) := ⟨⟨fun _ => ⊤, rfl⟩⟩ variable (α) /-- `id` as a `TopHom`. -/ protected def id : TopHom α α := ⟨id, rfl⟩ #align top_hom.id TopHom.id @[simp] theorem coe_id : ⇑(TopHom.id α) = id := rfl #align top_hom.coe_id TopHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : TopHom.id α a = a := rfl #align top_hom.id_apply TopHom.id_apply /-- Composition of `TopHom`s as a `TopHom`. -/ def comp (f : TopHom β γ) (g : TopHom α β) : TopHom α γ where toFun := f ∘ g map_top' := by rw [comp_apply, map_top, map_top] #align top_hom.comp TopHom.comp @[simp] theorem coe_comp (f : TopHom β γ) (g : TopHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align top_hom.coe_comp TopHom.coe_comp @[simp] theorem comp_apply (f : TopHom β γ) (g : TopHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align top_hom.comp_apply TopHom.comp_apply @[simp] theorem comp_assoc (f : TopHom γ δ) (g : TopHom β γ) (h : TopHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align top_hom.comp_assoc TopHom.comp_assoc @[simp] theorem comp_id (f : TopHom α β) : f.comp (TopHom.id α) = f := TopHom.ext fun _ => rfl #align top_hom.comp_id TopHom.comp_id @[simp] theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f := TopHom.ext fun _ => rfl #align top_hom.id_comp TopHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align top_hom.cancel_right TopHom.cancel_right @[simp] theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply], congr_arg _⟩ #align top_hom.cancel_left TopHom.cancel_left end Top instance [Preorder β] [Top β] : Preorder (TopHom α β) := Preorder.lift (FunLike.coe : TopHom α β → α → β) instance [PartialOrder β] [Top β] : PartialOrder (TopHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderTop variable [Preorder β] [OrderTop β] instance : OrderTop (TopHom α β) where top := ⟨⊤, rfl⟩ le_top := fun _ => @le_top (α → β) _ _ _ @[simp] theorem coe_top : ⇑(⊤ : TopHom α β) = ⊤ := rfl #align top_hom.coe_top TopHom.coe_top @[simp] theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤ := rfl #align top_hom.top_apply TopHom.top_apply end OrderTop section SemilatticeInf variable [SemilatticeInf β] [OrderTop β] (f g : TopHom α β) instance : Inf (TopHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_top, map_top, inf_top_eq]⟩⟩ instance : SemilatticeInf (TopHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align top_hom.coe_inf TopHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align top_hom.inf_apply TopHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderTop β] (f g : TopHom α β) instance : Sup (TopHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_top, map_top, sup_top_eq]⟩⟩ instance : SemilatticeSup (TopHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align top_hom.coe_sup TopHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align top_hom.sup_apply TopHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderTop β] : Lattice (TopHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderTop β] : DistribLattice (TopHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end TopHom /-! ### Bot homomorphisms -/ namespace BotHom variable [Bot α] section Bot variable [Bot β] [Bot γ] [Bot δ] instance : BotHomClass (BotHom α β) α β where coe := BotHom.toFun coe_injective' f g h := by cases f; cases g; congr map_bot := BotHom.map_bot' #noalign bot_hom.to_fun_eq_coe -- this must come after the coe_to_fun definition initialize_simps_projections BotHom (toFun → apply) @[ext] theorem ext {f g : BotHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bot_hom.ext BotHom.ext /-- Copy of a `BotHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BotHom α β) (f' : α → β) (h : f' = f) : BotHom α β where toFun := f' map_bot' := h.symm ▸ f.map_bot' #align bot_hom.copy BotHom.copy @[simp] theorem coe_copy (f : BotHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bot_hom.coe_copy BotHom.coe_copy theorem copy_eq (f : BotHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bot_hom.copy_eq BotHom.copy_eq instance : Inhabited (BotHom α β) := ⟨⟨fun _ => ⊥, rfl⟩⟩ variable (α) /-- `id` as a `BotHom`. -/ protected def id : BotHom α α := ⟨id, rfl⟩ #align bot_hom.id BotHom.id @[simp] theorem coe_id : ⇑(BotHom.id α) = id := rfl #align bot_hom.coe_id BotHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BotHom.id α a = a := rfl #align bot_hom.id_apply BotHom.id_apply /-- Composition of `BotHom`s as a `BotHom`. -/ def comp (f : BotHom β γ) (g : BotHom α β) : BotHom α γ where toFun := f ∘ g map_bot' := by rw [comp_apply, map_bot, map_bot] #align bot_hom.comp BotHom.comp @[simp] theorem coe_comp (f : BotHom β γ) (g : BotHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bot_hom.coe_comp BotHom.coe_comp @[simp] theorem comp_apply (f : BotHom β γ) (g : BotHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bot_hom.comp_apply BotHom.comp_apply @[simp] theorem comp_assoc (f : BotHom γ δ) (g : BotHom β γ) (h : BotHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bot_hom.comp_assoc BotHom.comp_assoc @[simp] theorem comp_id (f : BotHom α β) : f.comp (BotHom.id α) = f := BotHom.ext fun _ => rfl #align bot_hom.comp_id BotHom.comp_id @[simp] theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f := BotHom.ext fun _ => rfl #align bot_hom.id_comp BotHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩ #align bot_hom.cancel_right BotHom.cancel_right @[simp] theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply], congr_arg _⟩ #align bot_hom.cancel_left BotHom.cancel_left end Bot instance [Preorder β] [Bot β] : Preorder (BotHom α β) := Preorder.lift (FunLike.coe : BotHom α β → α → β) instance [PartialOrder β] [Bot β] : PartialOrder (BotHom α β) := PartialOrder.lift _ FunLike.coe_injective section OrderBot variable [Preorder β] [OrderBot β] instance : OrderBot (BotHom α β) where bot := ⟨⊥, rfl⟩ bot_le := fun _ => @bot_le (α → β) _ _ _ @[simp] theorem coe_bot : ⇑(⊥ : BotHom α β) = ⊥ := rfl #align bot_hom.coe_bot BotHom.coe_bot @[simp] theorem bot_apply (a : α) : (⊥ : BotHom α β) a = ⊥ := rfl #align bot_hom.bot_apply BotHom.bot_apply end OrderBot section SemilatticeInf variable [SemilatticeInf β] [OrderBot β] (f g : BotHom α β) instance : Inf (BotHom α β) := ⟨fun f g => ⟨f ⊓ g, by rw [Pi.inf_apply, map_bot, map_bot, inf_bot_eq]⟩⟩ instance : SemilatticeInf (BotHom α β) := (FunLike.coe_injective.semilatticeInf _) fun _ _ => rfl @[simp] theorem coe_inf : ⇑(f ⊓ g) = ⇑f ⊓ ⇑g := rfl #align bot_hom.coe_inf BotHom.coe_inf @[simp] theorem inf_apply (a : α) : (f ⊓ g) a = f a ⊓ g a := rfl #align bot_hom.inf_apply BotHom.inf_apply end SemilatticeInf section SemilatticeSup variable [SemilatticeSup β] [OrderBot β] (f g : BotHom α β) instance : Sup (BotHom α β) := ⟨fun f g => ⟨f ⊔ g, by rw [Pi.sup_apply, map_bot, map_bot, sup_bot_eq]⟩⟩ instance : SemilatticeSup (BotHom α β) := (FunLike.coe_injective.semilatticeSup _) fun _ _ => rfl @[simp] theorem coe_sup : ⇑(f ⊔ g) = ⇑f ⊔ ⇑g := rfl #align bot_hom.coe_sup BotHom.coe_sup @[simp] theorem sup_apply (a : α) : (f ⊔ g) a = f a ⊔ g a := rfl #align bot_hom.sup_apply BotHom.sup_apply end SemilatticeSup instance [Lattice β] [OrderBot β] : Lattice (BotHom α β) := FunLike.coe_injective.lattice _ (fun _ _ => rfl) fun _ _ => rfl instance [DistribLattice β] [OrderBot β] : DistribLattice (BotHom α β) := FunLike.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl end BotHom /-! ### Bounded order homomorphisms -/ -- Porting note: todo: remove this configuration and use the default configuration. -- We keep this to be consistent with Lean 3. initialize_simps_projections BoundedOrderHom (+toOrderHom, -toFun) namespace BoundedOrderHom variable [Preorder α] [Preorder β] [Preorder γ] [Preorder δ] [BoundedOrder α] [BoundedOrder β] [BoundedOrder γ] [BoundedOrder δ] /-- Reinterpret a `BoundedOrderHom` as a `TopHom`. -/ def toTopHom (f : BoundedOrderHom α β) : TopHom α β := { f with } #align bounded_order_hom.to_top_hom BoundedOrderHom.toTopHom /-- Reinterpret a `BoundedOrderHom` as a `BotHom`. -/ def toBotHom (f : BoundedOrderHom α β) : BotHom α β := { f with } #align bounded_order_hom.to_bot_hom BoundedOrderHom.toBotHom instance : BoundedOrderHomClass (BoundedOrderHom α β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f; obtain ⟨⟨_, _⟩, _⟩ := g; congr map_rel f := @(f.monotone') map_top f := f.map_top' map_bot f := f.map_bot' #noalign bounded_order_hom.to_fun_eq_coe @[ext] theorem ext {f g : BoundedOrderHom α β} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align bounded_order_hom.ext BoundedOrderHom.ext /-- Copy of a `BoundedOrderHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : BoundedOrderHom α β) (f' : α → β) (h : f' = f) : BoundedOrderHom α β := { f.toOrderHom.copy f' h, f.toTopHom.copy f' h, f.toBotHom.copy f' h with } #align bounded_order_hom.copy BoundedOrderHom.copy @[simp] theorem coe_copy (f : BoundedOrderHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align bounded_order_hom.coe_copy BoundedOrderHom.coe_copy theorem copy_eq (f : BoundedOrderHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align bounded_order_hom.copy_eq BoundedOrderHom.copy_eq variable (α) /-- `id` as a `BoundedOrderHom`. -/ protected def id : BoundedOrderHom α α := { OrderHom.id, TopHom.id α, BotHom.id α with } #align bounded_order_hom.id BoundedOrderHom.id instance : Inhabited (BoundedOrderHom α α) := ⟨BoundedOrderHom.id α⟩ @[simp] theorem coe_id : ⇑(BoundedOrderHom.id α) = id := rfl #align bounded_order_hom.coe_id BoundedOrderHom.coe_id variable {α} @[simp] theorem id_apply (a : α) : BoundedOrderHom.id α a = a := rfl #align bounded_order_hom.id_apply BoundedOrderHom.id_apply /-- Composition of `BoundedOrderHom`s as a `BoundedOrderHom`. -/ def comp (f : BoundedOrderHom β γ) (g : BoundedOrderHom α β) : BoundedOrderHom α γ := { f.toOrderHom.comp g.toOrderHom, f.toTopHom.comp g.toTopHom, f.toBotHom.comp g.toBotHom with } #align bounded_order_hom.comp BoundedOrderHom.comp @[simp] theorem coe_comp (f : BoundedOrderHom β γ) (g : BoundedOrderHom α β) : (f.comp g : α → γ) = f ∘ g := rfl #align bounded_order_hom.coe_comp BoundedOrderHom.coe_comp @[simp] theorem comp_apply (f : BoundedOrderHom β γ) (g : BoundedOrderHom α β) (a : α) : (f.comp g) a = f (g a) := rfl #align bounded_order_hom.comp_apply BoundedOrderHom.comp_apply @[simp] theorem coe_comp_orderHom (f : BoundedOrderHom β γ) (g : BoundedOrderHom α β) : (f.comp g : OrderHom α γ) = (f : OrderHom β γ).comp g := rfl #align bounded_order_hom.coe_comp_order_hom BoundedOrderHom.coe_comp_orderHom @[simp] theorem coe_comp_topHom (f : BoundedOrderHom β γ) (g : BoundedOrderHom α β) : (f.comp g : TopHom α γ) = (f : TopHom β γ).comp g := rfl #align bounded_order_hom.coe_comp_top_hom BoundedOrderHom.coe_comp_topHom @[simp] theorem coe_comp_botHom (f : BoundedOrderHom β γ) (g : BoundedOrderHom α β) : (f.comp g : BotHom α γ) = (f : BotHom β γ).comp g := rfl #align bounded_order_hom.coe_comp_bot_hom BoundedOrderHom.coe_comp_botHom @[simp] theorem comp_assoc (f : BoundedOrderHom γ δ) (g : BoundedOrderHom β γ) (h : BoundedOrderHom α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align bounded_order_hom.comp_assoc BoundedOrderHom.comp_assoc @[simp] theorem comp_id (f : BoundedOrderHom α β) : f.comp (BoundedOrderHom.id α) = f := BoundedOrderHom.ext fun _ => rfl #align bounded_order_hom.comp_id BoundedOrderHom.comp_id @[simp] theorem id_comp (f : BoundedOrderHom α β) : (BoundedOrderHom.id β).comp f = f := BoundedOrderHom.ext fun _ => rfl #align bounded_order_hom.id_comp BoundedOrderHom.id_comp @[simp] theorem cancel_right {g₁ g₂ : BoundedOrderHom β γ} {f : BoundedOrderHom α β} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h => BoundedOrderHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩ #align bounded_order_hom.cancel_right BoundedOrderHom.cancel_right @[simp] theorem cancel_left {g : BoundedOrderHom β γ} {f₁ f₂ : BoundedOrderHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BoundedOrderHom.ext fun a => hg <| by
rw [← BoundedOrderHom.comp_apply, h, BoundedOrderHom.comp_apply]
@[simp] theorem cancel_left {g : BoundedOrderHom β γ} {f₁ f₂ : BoundedOrderHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h => BoundedOrderHom.ext fun a => hg <| by
Mathlib.Order.Hom.Bounded.698_0.4FzgGE1bSNjCw87
@[simp] theorem cancel_left {g : BoundedOrderHom β γ} {f₁ f₂ : BoundedOrderHom α β} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂
Mathlib_Order_Hom_Bounded
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : α ≃ₜ β s : Set α hs : IsOpen s t : Set β h : ⇑e '' s = t ⊢ IsOpen (Equiv.toPartialEquivOfImageEq e.toEquiv s t h).target
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by
simpa [← h]
/-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by
Mathlib.Topology.PartialHomeomorph.202_0.xRULiNOId4c9Kju
/-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : α ≃ₜ β ⊢ ⇑e '' univ = univ
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by
rw [image_univ, e.surjective.range_eq]
/-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by
Mathlib.Topology.PartialHomeomorph.214_0.xRULiNOId4c9Kju
/-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e'✝ : PartialHomeomorph β γ e : PartialHomeomorph α β e' : PartialEquiv α β h : e.toPartialEquiv = e' ⊢ replaceEquiv e e' h = e
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by
cases e
theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by
Mathlib.Topology.PartialHomeomorph.230_0.xRULiNOId4c9Kju
theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e
Mathlib_Topology_PartialHomeomorph
case mk α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e'✝ : PartialHomeomorph β γ e' toPartialEquiv✝ : PartialEquiv α β open_source✝ : IsOpen toPartialEquiv✝.source open_target✝ : IsOpen toPartialEquiv✝.target continuousOn_toFun✝ : ContinuousOn (↑toPartialEquiv✝) toPartialEquiv✝.source continuousOn_invFun✝ : ContinuousOn toPartialEquiv✝.invFun toPartialEquiv✝.target h : { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ }.toPartialEquiv = e' ⊢ replaceEquiv { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ } e' h = { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ }
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e
subst e'
theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e
Mathlib.Topology.PartialHomeomorph.230_0.xRULiNOId4c9Kju
theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e
Mathlib_Topology_PartialHomeomorph
case mk α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ toPartialEquiv✝ : PartialEquiv α β open_source✝ : IsOpen toPartialEquiv✝.source open_target✝ : IsOpen toPartialEquiv✝.target continuousOn_toFun✝ : ContinuousOn (↑toPartialEquiv✝) toPartialEquiv✝.source continuousOn_invFun✝ : ContinuousOn toPartialEquiv✝.invFun toPartialEquiv✝.target ⊢ replaceEquiv { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ } { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ }.toPartialEquiv (_ : { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ }.toPartialEquiv = { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ }.toPartialEquiv) = { toPartialEquiv := toPartialEquiv✝, open_source := open_source✝, open_target := open_target✝, continuousOn_toFun := continuousOn_toFun✝, continuousOn_invFun := continuousOn_invFun✝ }
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e'
rfl
theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e'
Mathlib.Topology.PartialHomeomorph.230_0.xRULiNOId4c9Kju
theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α hx : x ∈ e.source x' : α hx' : ↑(PartialHomeomorph.symm e) (↑e x') = x' h : ↑e x' = ↑e x ⊢ x' ∈ {x}
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by
rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx']
theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by
Mathlib.Topology.PartialHomeomorph.267_0.xRULiNOId4c9Kju
theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e'✝ : PartialHomeomorph β γ e e' : PartialHomeomorph α β ⊢ e = e' → (∀ (x : α), ↑e x = ↑e' x) ∧ (∀ (x : β), ↑(PartialHomeomorph.symm e) x = ↑(PartialHomeomorph.symm e') x) ∧ e.source = e'.source
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by
rintro rfl
protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by
Mathlib.Topology.PartialHomeomorph.339_0.xRULiNOId4c9Kju
protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β ⊢ (∀ (x : α), ↑e x = ↑e x) ∧ (∀ (x : β), ↑(PartialHomeomorph.symm e) x = ↑(PartialHomeomorph.symm e) x) ∧ e.source = e.source
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl
exact ⟨fun x => rfl, fun x => rfl, rfl⟩
protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl
Mathlib.Topology.PartialHomeomorph.339_0.xRULiNOId4c9Kju
protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ x : α hx : x ∈ e.source ⊢ Tendsto (↑(PartialHomeomorph.symm e)) (𝓝 (↑e x)) (𝓝 x)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by
simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx)
theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by
Mathlib.Topology.PartialHomeomorph.377_0.xRULiNOId4c9Kju
theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ x : α hx : x ∈ e.source ⊢ 𝓝 (↑(PartialHomeomorph.symm e) (↑e x)) = 𝓝 x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by
rw [e.left_inv hx]
theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by
Mathlib.Topology.PartialHomeomorph.386_0.xRULiNOId4c9Kju
theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α hx : x ∈ e.source s : Set β ⊢ map (↑e) (𝓝[↑e ⁻¹' s] x) = 𝓝[s] ↑e x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by
rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)]
theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by
Mathlib.Topology.PartialHomeomorph.405_0.xRULiNOId4c9Kju
theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : β → Prop hx : x ∈ e.source ⊢ (∀ᶠ (y : β) in 𝓝 (↑e x), p y) ↔ ∀ᶠ (b : β) in map (fun x => ↑e x) (𝓝 x), p b
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by
rw [e.map_nhds_eq hx]
theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by
Mathlib.Topology.PartialHomeomorph.411_0.xRULiNOId4c9Kju
theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : α → Prop hx : x ∈ e.source ⊢ (∀ᶠ (y : β) in 𝓝 (↑e x), p (↑(PartialHomeomorph.symm e) y)) ↔ ∀ᶠ (x : α) in 𝓝 x, p x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by
rw [e.eventually_nhds _ hx]
theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by
Mathlib.Topology.PartialHomeomorph.416_0.xRULiNOId4c9Kju
theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : α → Prop hx : x ∈ e.source ⊢ (∀ᶠ (x : α) in 𝓝 x, p (↑(PartialHomeomorph.symm e) (↑e x))) ↔ ∀ᶠ (x : α) in 𝓝 x, p x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx]
refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _)
theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx]
Mathlib.Topology.PartialHomeomorph.416_0.xRULiNOId4c9Kju
theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : α → Prop hx : x ∈ e.source y : α hy : ↑(PartialHomeomorph.symm e) (↑e y) = y ⊢ p (↑(PartialHomeomorph.symm e) (↑e y)) ↔ p y
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _)
rw [hy]
theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _)
Mathlib.Topology.PartialHomeomorph.416_0.xRULiNOId4c9Kju
theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : β → Prop s : Set α hx : x ∈ e.source ⊢ (∀ᶠ (y : β) in 𝓝[↑(PartialHomeomorph.symm e) ⁻¹' s] ↑e x, p y) ↔ ∀ᶠ (x : α) in 𝓝[s] x, p (↑e x)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by
refine' Iff.trans _ eventually_map
theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by
Mathlib.Topology.PartialHomeomorph.423_0.xRULiNOId4c9Kju
theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : β → Prop s : Set α hx : x ∈ e.source ⊢ (∀ᶠ (y : β) in 𝓝[↑(PartialHomeomorph.symm e) ⁻¹' s] ↑e x, p y) ↔ ∀ᶠ (b : β) in map (fun x => ↑e x) (𝓝[s] x), p b
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map
rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)]
theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map
Mathlib.Topology.PartialHomeomorph.423_0.xRULiNOId4c9Kju
theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : α → Prop s : Set α hx : x ∈ e.source ⊢ (∀ᶠ (y : β) in 𝓝[↑(PartialHomeomorph.symm e) ⁻¹' s] ↑e x, p (↑(PartialHomeomorph.symm e) y)) ↔ ∀ᶠ (x : α) in 𝓝[s] x, p x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by
rw [e.eventually_nhdsWithin _ hx]
theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by
Mathlib.Topology.PartialHomeomorph.429_0.xRULiNOId4c9Kju
theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : α → Prop s : Set α hx : x ∈ e.source ⊢ (∀ᶠ (x : α) in 𝓝[s] x, p (↑(PartialHomeomorph.symm e) (↑e x))) ↔ ∀ᶠ (x : α) in 𝓝[s] x, p x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx]
refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_
theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx]
Mathlib.Topology.PartialHomeomorph.429_0.xRULiNOId4c9Kju
theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β x : α p : α → Prop s : Set α hx : x ∈ e.source y : α hy : ↑(PartialHomeomorph.symm e) (↑e y) = y ⊢ p (↑(PartialHomeomorph.symm e) (↑e y)) ↔ p y
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_
rw [hy]
theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_
Mathlib.Topology.PartialHomeomorph.429_0.xRULiNOId4c9Kju
theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β s : Set α t : Set γ x : α f : α → γ hf : ContinuousWithinAt f s x hxe : x ∈ e.source ht : t ∈ 𝓝 (f x) ⊢ ↑(PartialHomeomorph.symm e) ⁻¹' s =ᶠ[𝓝 (↑e x)] e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (s ∩ f ⁻¹' t)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by
rw [eventuallyEq_set, e.eventually_nhds _ hxe]
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by
Mathlib.Topology.PartialHomeomorph.437_0.xRULiNOId4c9Kju
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β s : Set α t : Set γ x : α f : α → γ hf : ContinuousWithinAt f s x hxe : x ∈ e.source ht : t ∈ 𝓝 (f x) ⊢ ∀ᶠ (x : α) in 𝓝 x, ↑e x ∈ ↑(PartialHomeomorph.symm e) ⁻¹' s ↔ ↑e x ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (s ∩ f ⁻¹' t)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe]
filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)]
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe]
Mathlib.Topology.PartialHomeomorph.437_0.xRULiNOId4c9Kju
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β)
Mathlib_Topology_PartialHomeomorph
case h α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β s : Set α t : Set γ x : α f : α → γ hf : ContinuousWithinAt f s x hxe : x ∈ e.source ht : t ∈ 𝓝 (f x) ⊢ ∀ a ∈ e.source, (a ∈ s → a ∈ f ⁻¹' t) → (↑e a ∈ ↑(PartialHomeomorph.symm e) ⁻¹' s ↔ ↑e a ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (s ∩ f ⁻¹' t))
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)]
intro y hy hyu
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)]
Mathlib.Topology.PartialHomeomorph.437_0.xRULiNOId4c9Kju
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β)
Mathlib_Topology_PartialHomeomorph
case h α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialHomeomorph α β s : Set α t : Set γ x : α f : α → γ hf : ContinuousWithinAt f s x hxe : x ∈ e.source ht : t ∈ 𝓝 (f x) y : α hy : y ∈ e.source hyu : y ∈ s → y ∈ f ⁻¹' t ⊢ ↑e y ∈ ↑(PartialHomeomorph.symm e) ⁻¹' s ↔ ↑e y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (s ∩ f ⁻¹' t)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu
simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu]
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu
Mathlib.Topology.PartialHomeomorph.437_0.xRULiNOId4c9Kju
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α hs : IsOpen s hse : s ⊆ e.source ⊢ IsOpen (↑e '' s)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by
rw [(image_eq_target_inter_inv_preimage (e := e) hse)]
/-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by
Mathlib.Topology.PartialHomeomorph.456_0.xRULiNOId4c9Kju
/-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α hs : IsOpen s hse : s ⊆ e.source ⊢ IsOpen (e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)]
exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs
/-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)]
Mathlib.Topology.PartialHomeomorph.456_0.xRULiNOId4c9Kju
/-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α t : Set β x : α y : β ⊢ IsImage e s t ↔ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (e.source ∩ s) = e.target ∩ t
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by
rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq']
theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by
Mathlib.Topology.PartialHomeomorph.550_0.xRULiNOId4c9Kju
theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α t : Set β x : α y : β h : IsImage e s t hx : x ∈ e.source ⊢ map (↑e) (𝓝[s] x) = 𝓝[t] ↑e x
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by
rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)]
theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by
Mathlib.Topology.PartialHomeomorph.609_0.xRULiNOId4c9Kju
theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α t : Set β x✝ : α y : β h : IsImage e s t x : α hx : x ∈ e.source ⊢ ↑e x ∈ closure t ↔ x ∈ closure s
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by
simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff]
protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by
Mathlib.Topology.PartialHomeomorph.613_0.xRULiNOId4c9Kju
protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α t : Set β x : α y : β h : IsImage e s t ⊢ IsImage e (interior s) (interior t)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by
simpa only [closure_compl, compl_compl] using h.compl.closure.compl
protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by
Mathlib.Topology.PartialHomeomorph.617_0.xRULiNOId4c9Kju
protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α hs : IsOpen s h : s ⊆ e.source ⊢ IsOpen (↑e '' s)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by
have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h
/-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by
Mathlib.Topology.PartialHomeomorph.672_0.xRULiNOId4c9Kju
/-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α hs : IsOpen s h : s ⊆ e.source this : ↑e '' s = e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s ⊢ IsOpen (↑e '' s)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h
rw [this]
/-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h
Mathlib.Topology.PartialHomeomorph.672_0.xRULiNOId4c9Kju
/-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e : PartialHomeomorph α β e' : PartialHomeomorph β γ s : Set α hs : IsOpen s h : s ⊆ e.source this : ↑e '' s = e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s ⊢ IsOpen (e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s)
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this]
exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs
/-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this]
Mathlib.Topology.PartialHomeomorph.672_0.xRULiNOId4c9Kju
/-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s)
Mathlib_Topology_PartialHomeomorph
α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝³ : TopologicalSpace α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace δ e✝ : PartialHomeomorph α β e' : PartialHomeomorph β γ e : PartialEquiv α β hc : ContinuousOn (↑e) e.source ho : IsOpenMap (restrict e.source ↑e) hs : IsOpen e.source ⊢ IsOpen e.target
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by
simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range
/-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by
Mathlib.Topology.PartialHomeomorph.685_0.xRULiNOId4c9Kju
/-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv
Mathlib_Topology_PartialHomeomorph