l3lab/ntp-mathlib huggingface dataset:
/-- Summing the translates of `f` by `ℤ • p` gives a map which is periodic with period `p`.
(This is true without any convergence conditions, since if the sum doesn't converge it is taken to
be the zero map, which is periodic.) -/
theorem periodic_tsum_comp_add_zsmul [AddCommGroup X] [TopologicalAddGroup X] [AddCommMonoid Y]
    [ContinuousAdd Y] [T2Space Y] (f : C(X, Y)) (p : X) :
    Function.Periodic (⇑(∑' n : ℤ, f.comp (ContinuousMap.addRight (n • p)))) p := by
  intro x
  by_cases h : Summable fun n : ℤ => f.comp (ContinuousMap.addRight (n • p))
  · convert congr_arg (fun f : C(X, Y) => f x) ((Equiv.addRight (1 : ℤ)).tsum_eq _) using 1
    -- Porting note: in mathlib3 the proof from here was:
    -- simp_rw [← tsum_apply h, ← tsum_apply ((equiv.add_right (1 : ℤ)).summable_iff.mpr h),
    --   equiv.coe_add_right, comp_apply, coe_add_right, add_one_zsmul, add_comm (_ • p) p,
    --   ← add_assoc]
    -- However now the second `← tsum_apply` doesn't fire unless we use `erw`.
    simp_rw [← tsum_apply h]
    erw [← tsum_apply ((Equiv.addRight (1 : ℤ)).summable_iff.mpr h)]
    simp [coe_addRight, add_one_zsmul, add_comm (_ • p) p, ← add_assoc]
  · 

Proof state:
case neg
X : Type u_1
Y : Type u_2
inst✝⁶ : TopologicalSpace X
inst✝⁵ : TopologicalSpace Y
inst✝⁴ : AddCommGroup X
inst✝³ : TopologicalAddGroup X
inst✝² : AddCommMonoid Y
inst✝¹ : ContinuousAdd Y
inst✝ : T2Space Y
f : C(X, Y)
p x : X
h : ¬Summable fun n => comp f (ContinuousMap.addRight (n • p))
⊢ (∑' (n : ℤ), comp f (ContinuousMap.addRight (n • p))) (x + p) =
    (∑' (n : ℤ), comp f (ContinuousMap.addRight (n • p))) x

Next tactic:
rw [tsum_eq_zero_of_not_summable h]
/-- Summing the translates of `f` by `ℤ • p` gives a map which is periodic with period `p`.
(This is true without any convergence conditions, since if the sum doesn't converge it is taken to
be the zero map, which is periodic.) -/
theorem periodic_tsum_comp_add_zsmul [AddCommGroup X] [TopologicalAddGroup X] [AddCommMonoid Y]
    [ContinuousAdd Y] [T2Space Y] (f : C(X, Y)) (p : X) :
    Function.Periodic (⇑(∑' n : ℤ, f.comp (ContinuousMap.addRight (n • p)))) p := by
  intro x
  by_cases h : Summable fun n : ℤ => f.comp (ContinuousMap.addRight (n • p))
  · convert congr_arg (fun f : C(X, Y) => f x) ((Equiv.addRight (1 : ℤ)).tsum_eq _) using 1
    -- Porting note: in mathlib3 the proof from here was:
    -- simp_rw [← tsum_apply h, ← tsum_apply ((equiv.add_right (1 : ℤ)).summable_iff.mpr h),
    --   equiv.coe_add_right, comp_apply, coe_add_right, add_one_zsmul, add_comm (_ • p) p,
    --   ← add_assoc]
    -- However now the second `← tsum_apply` doesn't fire unless we use `erw`.
    simp_rw [← tsum_apply h]
    erw [← tsum_apply ((Equiv.addRight (1 : ℤ)).summable_iff.mpr h)]
    simp [coe_addRight, add_one_zsmul, add_comm (_ • p) p, ← add_assoc]
  · rw [tsum_eq_zero_of_not_summable h]
    

Proof state:
case neg
X : Type u_1
Y : Type u_2
inst✝⁶ : TopologicalSpace X
inst✝⁵ : TopologicalSpace Y
inst✝⁴ : AddCommGroup X
inst✝³ : TopologicalAddGroup X
inst✝² : AddCommMonoid Y
inst✝¹ : ContinuousAdd Y
inst✝ : T2Space Y
f : C(X, Y)
p x : X
h : ¬Summable fun n => comp f (ContinuousMap.addRight (n • p))
⊢ 0 (x + p) = 0 x

Next tactic:
simp only [coe_zero, Pi.zero_apply]
/-- `ContinuousMap.compStarAlgHom'` as a `StarAlgEquiv` when the continuous map `f` is
actually a homeomorphism. -/
@[simps]
def compStarAlgEquiv' (f : X ≃ₜ Y) : C(Y, A) ≃⋆ₐ[𝕜] C(X, A) :=
  { f.toContinuousMap.compStarAlgHom' 𝕜 A with
    toFun := (f : C(X, Y)).compStarAlgHom' 𝕜 A
    invFun := (f.symm : C(Y, X)).compStarAlgHom' 𝕜 A
    left_inv := fun g => by
      

Proof state:
X : Type u_1
Y : Type u_2
inst✝⁸ : TopologicalSpace X
inst✝⁷ : TopologicalSpace Y
𝕜 : Type u_3
inst✝⁶ : CommSemiring 𝕜
A : Type u_4
inst✝⁵ : TopologicalSpace A
inst✝⁴ : Semiring A
inst✝³ : TopologicalSemiring A
inst✝² : StarRing A
inst✝¹ : ContinuousStar A
inst✝ : Algebra 𝕜 A
f : X ≃ₜ Y
src✝ : C(Y, A) →⋆ₐ[𝕜] C(X, A) := ContinuousMap.compStarAlgHom' 𝕜 A (toContinuousMap f)
g : C(Y, A)
⊢ (ContinuousMap.compStarAlgHom' 𝕜 A (toContinuousMap (Homeomorph.symm f)))
      ((ContinuousMap.compStarAlgHom' 𝕜 A (toContinuousMap f)) g) =
    g

Next tactic:
simp only [ContinuousMap.compStarAlgHom'_apply, ContinuousMap.comp_assoc,
        toContinuousMap_comp_symm, ContinuousMap.comp_id]
/-- `ContinuousMap.compStarAlgHom'` as a `StarAlgEquiv` when the continuous map `f` is
actually a homeomorphism. -/
@[simps]
def compStarAlgEquiv' (f : X ≃ₜ Y) : C(Y, A) ≃⋆ₐ[𝕜] C(X, A) :=
  { f.toContinuousMap.compStarAlgHom' 𝕜 A with
    toFun := (f : C(X, Y)).compStarAlgHom' 𝕜 A
    invFun := (f.symm : C(Y, X)).compStarAlgHom' 𝕜 A
    left_inv := fun g => by
      simp only [ContinuousMap.compStarAlgHom'_apply, ContinuousMap.comp_assoc,
        toContinuousMap_comp_symm, ContinuousMap.comp_id]
    right_inv := fun g => by
      

Proof state:
X : Type u_1
Y : Type u_2
inst✝⁸ : TopologicalSpace X
inst✝⁷ : TopologicalSpace Y
𝕜 : Type u_3
inst✝⁶ : CommSemiring 𝕜
A : Type u_4
inst✝⁵ : TopologicalSpace A
inst✝⁴ : Semiring A
inst✝³ : TopologicalSemiring A
inst✝² : StarRing A
inst✝¹ : ContinuousStar A
inst✝ : Algebra 𝕜 A
f : X ≃ₜ Y
src✝ : C(Y, A) →⋆ₐ[𝕜] C(X, A) := ContinuousMap.compStarAlgHom' 𝕜 A (toContinuousMap f)
g : C(X, A)
⊢ (ContinuousMap.compStarAlgHom' 𝕜 A (toContinuousMap f))
      ((ContinuousMap.compStarAlgHom' 𝕜 A (toContinuousMap (Homeomorph.symm f))) g) =
    g

Next tactic:
simp only [ContinuousMap.compStarAlgHom'_apply, ContinuousMap.comp_assoc,
        symm_comp_toContinuousMap, ContinuousMap.comp_id]
/-- Definition of `ContinuousMap.compactOpen` in terms of `Set.image2`. -/
theorem compactOpen_eq : @compactOpen α β _ _ =
    .generateFrom (Set.image2 CompactOpen.gen {s | IsCompact s} {t | IsOpen t}) :=
  congr_arg TopologicalSpace.generateFrom <| Set.ext fun _ ↦ by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
x✝ : Set C(α, β)
⊢ x✝ ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u} ↔
    x✝ ∈ image2 CompactOpen.gen {s | IsCompact s} {t | IsOpen t}

Next tactic:
simp [eq_comm]
protected theorem isOpen_gen {s : Set α} (hs : IsCompact s) {u : Set β} (hu : IsOpen u) :
    IsOpen (CompactOpen.gen s u) :=
  TopologicalSpace.GenerateOpen.basic _ (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
s : Set α
hs : IsCompact s
u : Set β
hu : IsOpen u
⊢ CompactOpen.gen s u ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u}

Next tactic:
dsimp [mem_setOf_eq]
protected theorem isOpen_gen {s : Set α} (hs : IsCompact s) {u : Set β} (hu : IsOpen u) :
    IsOpen (CompactOpen.gen s u) :=
  TopologicalSpace.GenerateOpen.basic _ (by dsimp [mem_setOf_eq]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
s : Set α
hs : IsCompact s
u : Set β
hu : IsOpen u
⊢ ∃ s_1, ∃ (_ : IsCompact s_1), ∃ u_1, ∃ (_ : IsOpen u_1), CompactOpen.gen s u = CompactOpen.gen s_1 u_1

Next tactic:
tauto
private theorem preimage_gen {s : Set α} {u : Set γ} :
    ContinuousMap.comp g ⁻¹' CompactOpen.gen s u = CompactOpen.gen s (g ⁻¹' u) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
s : Set α
u : Set γ
⊢ comp g ⁻¹' CompactOpen.gen s u = CompactOpen.gen s (⇑g ⁻¹' u)

Next tactic:
ext ⟨f, _⟩
private theorem preimage_gen {s : Set α} {u : Set γ} :
    ContinuousMap.comp g ⁻¹' CompactOpen.gen s u = CompactOpen.gen s (g ⁻¹' u) := by
  ext ⟨f, _⟩
  

Proof state:
case h.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
s : Set α
u : Set γ
f : α → β
continuous_toFun✝ : Continuous f
⊢ mk f ∈ comp g ⁻¹' CompactOpen.gen s u ↔ mk f ∈ CompactOpen.gen s (⇑g ⁻¹' u)

Next tactic:
change g ∘ f '' s ⊆ u ↔ f '' s ⊆ g ⁻¹' u
private theorem preimage_gen {s : Set α} {u : Set γ} :
    ContinuousMap.comp g ⁻¹' CompactOpen.gen s u = CompactOpen.gen s (g ⁻¹' u) := by
  ext ⟨f, _⟩
  change g ∘ f '' s ⊆ u ↔ f '' s ⊆ g ⁻¹' u
  

Proof state:
case h.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
s : Set α
u : Set γ
f : α → β
continuous_toFun✝ : Continuous f
⊢ ⇑g ∘ f '' s ⊆ u ↔ f '' s ⊆ ⇑g ⁻¹' u

Next tactic:
rw [image_comp, image_subset_iff]
/-- C(α, -) is a functor. -/
theorem continuous_comp : Continuous (ContinuousMap.comp g : C(α, β) → C(α, γ)) :=
  continuous_generateFrom fun m ⟨s, hs, u, hu, hm⟩ => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
m : Set C(α, γ)
x✝ : m ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u}
s : Set α
hs : IsCompact s
u : Set γ
hu : IsOpen u
hm : m = CompactOpen.gen s u
⊢ IsOpen (comp g ⁻¹' m)

Next tactic:
rw [hm, preimage_gen g]
/-- C(α, -) is a functor. -/
theorem continuous_comp : Continuous (ContinuousMap.comp g : C(α, β) → C(α, γ)) :=
  continuous_generateFrom fun m ⟨s, hs, u, hu, hm⟩ => by
    rw [hm, preimage_gen g]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
m : Set C(α, γ)
x✝ : m ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u}
s : Set α
hs : IsCompact s
u : Set γ
hu : IsOpen u
hm : m = CompactOpen.gen s u
⊢ IsOpen (CompactOpen.gen s (⇑g ⁻¹' u))

Next tactic:
exact ContinuousMap.isOpen_gen hs (hu.preimage g.2)
/-- If `g : C(β, γ)` is a topology inducing map, then the composition
`ContinuousMap.comp g : C(α, β) → C(α, γ)` is a topology inducing map too. -/
theorem inducing_comp (hg : Inducing g) : Inducing (g.comp : C(α, β) → C(α, γ)) where
  induced := by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
hg : Inducing ⇑g
⊢ compactOpen = TopologicalSpace.induced (comp g) compactOpen

Next tactic:
simp only [compactOpen_eq, induced_generateFrom_eq, image_image2, preimage_gen,
      hg.setOf_isOpen, image2_image_right]
private theorem image_gen {s : Set α} (_ : IsCompact s) {u : Set γ} (_ : IsOpen u) :
    (fun g : C(β, γ) => g.comp f) ⁻¹' CompactOpen.gen s u = CompactOpen.gen (f '' s) u := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
s : Set α
x✝¹ : IsCompact s
u : Set γ
x✝ : IsOpen u
⊢ (fun g => comp g f) ⁻¹' CompactOpen.gen s u = CompactOpen.gen (⇑f '' s) u

Next tactic:
ext ⟨g, _⟩
private theorem image_gen {s : Set α} (_ : IsCompact s) {u : Set γ} (_ : IsOpen u) :
    (fun g : C(β, γ) => g.comp f) ⁻¹' CompactOpen.gen s u = CompactOpen.gen (f '' s) u := by
  ext ⟨g, _⟩
  

Proof state:
case h.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g✝ : C(β, γ)
f : C(α, β)
s : Set α
x✝¹ : IsCompact s
u : Set γ
x✝ : IsOpen u
g : β → γ
continuous_toFun✝ : Continuous g
⊢ mk g ∈ (fun g => comp g f) ⁻¹' CompactOpen.gen s u ↔ mk g ∈ CompactOpen.gen (⇑f '' s) u

Next tactic:
change g ∘ f '' s ⊆ u ↔ g '' (f '' s) ⊆ u
private theorem image_gen {s : Set α} (_ : IsCompact s) {u : Set γ} (_ : IsOpen u) :
    (fun g : C(β, γ) => g.comp f) ⁻¹' CompactOpen.gen s u = CompactOpen.gen (f '' s) u := by
  ext ⟨g, _⟩
  change g ∘ f '' s ⊆ u ↔ g '' (f '' s) ⊆ u
  

Proof state:
case h.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g✝ : C(β, γ)
f : C(α, β)
s : Set α
x✝¹ : IsCompact s
u : Set γ
x✝ : IsOpen u
g : β → γ
continuous_toFun✝ : Continuous g
⊢ g ∘ ⇑f '' s ⊆ u ↔ g '' (⇑f '' s) ⊆ u

Next tactic:
rw [Set.image_comp]
/-- C(-, γ) is a functor. -/
theorem continuous_comp_left : Continuous (fun g => g.comp f : C(β, γ) → C(α, γ)) :=
  continuous_generateFrom fun m ⟨s, hs, u, hu, hm⟩ => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
m : Set C(α, γ)
x✝ : m ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u}
s : Set α
hs : IsCompact s
u : Set γ
hu : IsOpen u
hm : m = CompactOpen.gen s u
⊢ IsOpen ((fun g => comp g f) ⁻¹' m)

Next tactic:
rw [hm, image_gen f hs hu]
/-- C(-, γ) is a functor. -/
theorem continuous_comp_left : Continuous (fun g => g.comp f : C(β, γ) → C(α, γ)) :=
  continuous_generateFrom fun m ⟨s, hs, u, hu, hm⟩ => by
    rw [hm, image_gen f hs hu]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
m : Set C(α, γ)
x✝ : m ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u}
s : Set α
hs : IsCompact s
u : Set γ
hu : IsOpen u
hm : m = CompactOpen.gen s u
⊢ IsOpen (CompactOpen.gen (⇑f '' s) u)

Next tactic:
exact ContinuousMap.isOpen_gen (hs.image f.2) hu
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
⊢ ∀ s ∈ {m | ∃ s, ∃ (_ : IsCompact s), ∃ u, ∃ (_ : IsOpen u), m = CompactOpen.gen s u},
    IsOpen ((fun x => comp x.2 x.1) ⁻¹' s)

Next tactic:
rintro M ⟨K, hK, U, hU, rfl⟩
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
⊢ IsOpen ((fun x => comp x.2 x.1) ⁻¹' CompactOpen.gen K U)

Next tactic:
conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        rw [image_comp, image_subset_iff]
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
| IsOpen ((fun x => comp x.2 x.1) ⁻¹' CompactOpen.gen K U)

Next tactic:
congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        rw [image_comp, image_subset_iff]
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
| IsOpen ((fun x => comp x.2 x.1) ⁻¹' CompactOpen.gen K U)

Next tactic:
congr
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
| (fun x => comp x.2 x.1) ⁻¹' CompactOpen.gen K U

Next tactic:
rw [CompactOpen.gen, preimage_setOf_eq]
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
| {a | ⇑(comp a.2 a.1) '' K ⊆ U}

Next tactic:
ext
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; 

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
x✝ : C(α, β) × C(β, γ)
| setOf (fun a => ⇑(comp a.2 a.1) '' K ⊆ U) x✝

Next tactic:
dsimp [setOf]
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
x✝ : C(α, β) × C(β, γ)
| ⇑x✝.2 ∘ ⇑x✝.1 '' K ⊆ U

Next tactic:
rw [image_comp, image_subset_iff]
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        rw [image_comp, image_subset_iff]
      

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
⊢ IsOpen fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U

Next tactic:
rw [isOpen_iff_forall_mem_open]
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        rw [image_comp, image_subset_iff]
      rw [isOpen_iff_forall_mem_open]
      

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
⊢ ∀ x ∈ fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U, ∃ t ⊆ fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U, IsOpen t ∧ x ∈ t

Next tactic:
rintro ⟨φ₀, ψ₀⟩ H
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        rw [image_comp, image_subset_iff]
      rw [isOpen_iff_forall_mem_open]
      rintro ⟨φ₀, ψ₀⟩ H
      

Proof state:
case intro.intro.intro.intro.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
φ₀ : C(α, β)
ψ₀ : C(β, γ)
H : (φ₀, ψ₀) ∈ fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U
⊢ ∃ t ⊆ fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U, IsOpen t ∧ (φ₀, ψ₀) ∈ t

Next tactic:
obtain ⟨L, hL, hKL, hLU⟩ := exists_compact_between (hK.image φ₀.2) (hU.preimage ψ₀.2) H
/-- Composition is a continuous map from `C(α, β) × C(β, γ)` to `C(α, γ)`, provided that `β` is
  locally compact. This is Prop. 9 of Chap. X, §3, №. 4 of Bourbaki's *Topologie Générale*. -/
theorem continuous_comp' [LocallyCompactSpace β] :
    Continuous fun x : C(α, β) × C(β, γ) => x.2.comp x.1 :=
  continuous_generateFrom
    (by
      rintro M ⟨K, hK, U, hU, rfl⟩
      conv =>
        congr
        rw [CompactOpen.gen, preimage_setOf_eq]
        --congr
        ext; dsimp [setOf]
        rw [image_comp, image_subset_iff]
      rw [isOpen_iff_forall_mem_open]
      rintro ⟨φ₀, ψ₀⟩ H
      obtain ⟨L, hL, hKL, hLU⟩ := exists_compact_between (hK.image φ₀.2) (hU.preimage ψ₀.2) H
      

Proof state:
case intro.intro.intro.intro.mk.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
g : C(β, γ)
f : C(α, β)
inst✝ : LocallyCompactSpace β
K : Set α
hK : IsCompact K
U : Set γ
hU : IsOpen U
φ₀ : C(α, β)
ψ₀ : C(β, γ)
H : (φ₀, ψ₀) ∈ fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U
L : Set β
hL : IsCompact L
hKL : φ₀.toFun '' K ⊆ interior L
hLU : L ⊆ ψ₀.toFun ⁻¹' U
⊢ ∃ t ⊆ fun x => ⇑x.1 '' K ⊆ ⇑x.2 ⁻¹' U, IsOpen t ∧ (φ₀, ψ₀) ∈ t

Next tactic:
use { φ : C(α, β) | φ '' K ⊆ interior L } ×ˢ { ψ : C(β, γ) | ψ '' L ⊆ U }