l3lab/ntp-mathlib huggingface dataset:
/-- Baby version of the Whitney weak embedding theorem: if `M` admits a finite covering by
supports of bump functions, then for some `n` it can be embedded into the `n`-dimensional
Euclidean space. -/
theorem exists_embedding_euclidean_of_compact [T2Space M] [CompactSpace M] :
    ∃ (n : ℕ) (e : M → EuclideanSpace ℝ (Fin n)),
      Smooth I (𝓡 n) e ∧ ClosedEmbedding e ∧ ∀ x : M, Injective (mfderiv I (𝓡 n) e x) := by
  rcases SmoothBumpCovering.exists_isSubordinate I isClosed_univ fun (x : M) _ => univ_mem with
    ⟨ι, f, -⟩
  

Proof state:
case intro.intro
ι✝ : Type uι
E : Type uE
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : FiniteDimensional ℝ E
H : Type uH
inst✝⁵ : TopologicalSpace H
I : ModelWithCorners ℝ E H
M : Type uM
inst✝⁴ : TopologicalSpace M
inst✝³ : ChartedSpace H M
inst✝² : SmoothManifoldWithCorners I M
inst✝¹ : T2Space M
inst✝ : CompactSpace M
ι : Type uM
f : SmoothBumpCovering ι I M univ
⊢ ∃ n e,
    Smooth I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e ∧
      ClosedEmbedding e ∧ ∀ (x : M), Injective ⇑(mfderiv I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e x)

Next tactic:
haveI := f.fintype
/-- Baby version of the Whitney weak embedding theorem: if `M` admits a finite covering by
supports of bump functions, then for some `n` it can be embedded into the `n`-dimensional
Euclidean space. -/
theorem exists_embedding_euclidean_of_compact [T2Space M] [CompactSpace M] :
    ∃ (n : ℕ) (e : M → EuclideanSpace ℝ (Fin n)),
      Smooth I (𝓡 n) e ∧ ClosedEmbedding e ∧ ∀ x : M, Injective (mfderiv I (𝓡 n) e x) := by
  rcases SmoothBumpCovering.exists_isSubordinate I isClosed_univ fun (x : M) _ => univ_mem with
    ⟨ι, f, -⟩
  haveI := f.fintype
  

Proof state:
case intro.intro
ι✝ : Type uι
E : Type uE
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : FiniteDimensional ℝ E
H : Type uH
inst✝⁵ : TopologicalSpace H
I : ModelWithCorners ℝ E H
M : Type uM
inst✝⁴ : TopologicalSpace M
inst✝³ : ChartedSpace H M
inst✝² : SmoothManifoldWithCorners I M
inst✝¹ : T2Space M
inst✝ : CompactSpace M
ι : Type uM
f : SmoothBumpCovering ι I M univ
this : Fintype ι
⊢ ∃ n e,
    Smooth I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e ∧
      ClosedEmbedding e ∧ ∀ (x : M), Injective ⇑(mfderiv I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e x)

Next tactic:
rcases f.exists_immersion_euclidean with ⟨n, e, hsmooth, hinj, hinj_mfderiv⟩
/-- Baby version of the Whitney weak embedding theorem: if `M` admits a finite covering by
supports of bump functions, then for some `n` it can be embedded into the `n`-dimensional
Euclidean space. -/
theorem exists_embedding_euclidean_of_compact [T2Space M] [CompactSpace M] :
    ∃ (n : ℕ) (e : M → EuclideanSpace ℝ (Fin n)),
      Smooth I (𝓡 n) e ∧ ClosedEmbedding e ∧ ∀ x : M, Injective (mfderiv I (𝓡 n) e x) := by
  rcases SmoothBumpCovering.exists_isSubordinate I isClosed_univ fun (x : M) _ => univ_mem with
    ⟨ι, f, -⟩
  haveI := f.fintype
  rcases f.exists_immersion_euclidean with ⟨n, e, hsmooth, hinj, hinj_mfderiv⟩
  

Proof state:
case intro.intro.intro.intro.intro.intro
ι✝ : Type uι
E : Type uE
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : FiniteDimensional ℝ E
H : Type uH
inst✝⁵ : TopologicalSpace H
I : ModelWithCorners ℝ E H
M : Type uM
inst✝⁴ : TopologicalSpace M
inst✝³ : ChartedSpace H M
inst✝² : SmoothManifoldWithCorners I M
inst✝¹ : T2Space M
inst✝ : CompactSpace M
ι : Type uM
f : SmoothBumpCovering ι I M univ
this : Fintype ι
n : ℕ
e : M → EuclideanSpace ℝ (Fin n)
hsmooth : Smooth I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e
hinj : Injective e
hinj_mfderiv : ∀ (x : M), Injective ⇑(mfderiv I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e x)
⊢ ∃ n e,
    Smooth I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e ∧
      ClosedEmbedding e ∧ ∀ (x : M), Injective ⇑(mfderiv I 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) e x)

Next tactic:
exact ⟨n, e, hsmooth, hsmooth.continuous.closedEmbedding hinj, hinj_mfderiv⟩
theorem toTrivialization_apply {x : E} {I : Type*} [TopologicalSpace I]
    (h : IsEvenlyCovered f (f x) I) : (h.toTrivialization x).2 = ⟨x, rfl⟩ :=
  let e := Classical.choose h.2
  let h := Classical.choose_spec h.2
  let he := e.mk_proj_snd' h
  Subtype.ext
    ((e.toPartialEquiv.eq_symm_apply (e.mem_source.mpr h)
            (by 

Proof state:
E : Type u_1
X : Type u_2
inst✝² : TopologicalSpace E
inst✝¹ : TopologicalSpace X
f : E → X
s : Set X
x : E
I : Type u_3
inst✝ : TopologicalSpace I
h✝ : IsEvenlyCovered f (f x) I
e : Trivialization I f := Classical.choose (_ : ∃ t, f x ∈ t.baseSet)
h : f x ∈ (Classical.choose (_ : ∃ t, f x ∈ t.baseSet)).baseSet := Classical.choose_spec h✝.right
he : (f x, (↑e x).2) = ↑e x := Trivialization.mk_proj_snd' e h
⊢ (f x, (↑e x).2) ∈ e.target

Next tactic:
rwa [he, e.mem_target, e.coe_fst (e.mem_source.mpr h)]
protected theorem isLocalHomeomorphOn (hf : IsCoveringMapOn f s) :
    IsLocalHomeomorphOn f (f ⁻¹' s) := by
  

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMapOn f s
⊢ IsLocalHomeomorphOn f (f ⁻¹' s)

Next tactic:
refine' IsLocalHomeomorphOn.mk f (f ⁻¹' s) fun x hx => _
protected theorem isLocalHomeomorphOn (hf : IsCoveringMapOn f s) :
    IsLocalHomeomorphOn f (f ⁻¹' s) := by
  refine' IsLocalHomeomorphOn.mk f (f ⁻¹' s) fun x hx => _
  

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMapOn f s
x : E
hx : x ∈ f ⁻¹' s
⊢ ∃ e, x ∈ e.source ∧ Set.EqOn f (↑e) e.source

Next tactic:
let e := (hf (f x) hx).toTrivialization
protected theorem isLocalHomeomorphOn (hf : IsCoveringMapOn f s) :
    IsLocalHomeomorphOn f (f ⁻¹' s) := by
  refine' IsLocalHomeomorphOn.mk f (f ⁻¹' s) fun x hx => _
  let e := (hf (f x) hx).toTrivialization
  

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMapOn f s
x : E
hx : x ∈ f ⁻¹' s
e : Trivialization (↑(f ⁻¹' {f x})) f := IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))
⊢ ∃ e, x ∈ e.source ∧ Set.EqOn f (↑e) e.source

Next tactic:
have h := (hf (f x) hx).mem_toTrivialization_baseSet
protected theorem isLocalHomeomorphOn (hf : IsCoveringMapOn f s) :
    IsLocalHomeomorphOn f (f ⁻¹' s) := by
  refine' IsLocalHomeomorphOn.mk f (f ⁻¹' s) fun x hx => _
  let e := (hf (f x) hx).toTrivialization
  have h := (hf (f x) hx).mem_toTrivialization_baseSet
  

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMapOn f s
x : E
hx : x ∈ f ⁻¹' s
e : Trivialization (↑(f ⁻¹' {f x})) f := IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))
h : f x ∈ (IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))).baseSet
⊢ ∃ e, x ∈ e.source ∧ Set.EqOn f (↑e) e.source

Next tactic:
let he := e.mem_source.2 h
protected theorem isLocalHomeomorphOn (hf : IsCoveringMapOn f s) :
    IsLocalHomeomorphOn f (f ⁻¹' s) := by
  refine' IsLocalHomeomorphOn.mk f (f ⁻¹' s) fun x hx => _
  let e := (hf (f x) hx).toTrivialization
  have h := (hf (f x) hx).mem_toTrivialization_baseSet
  let he := e.mem_source.2 h
  

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMapOn f s
x : E
hx : x ∈ f ⁻¹' s
e : Trivialization (↑(f ⁻¹' {f x})) f := IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))
h : f x ∈ (IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))).baseSet
he : x ∈ e.source := (Trivialization.mem_source e).mpr h
⊢ ∃ e, x ∈ e.source ∧ Set.EqOn f (↑e) e.source

Next tactic:
refine'
    ⟨e.toPartialHomeomorph.trans
        { toFun := fun p => p.1
          invFun := fun p => ⟨p, x, rfl⟩
          source := e.baseSet ×ˢ ({⟨x, rfl⟩} : Set (f ⁻¹' {f x}))
          target := e.baseSet
          open_source :=
            e.open_baseSet.prod (singletons_open_iff_discrete.2 (hf (f x) hx).1 ⟨x, rfl⟩)
          open_target := e.open_baseSet
          map_source' := fun p => And.left
          map_target' := fun p hp => ⟨hp, rfl⟩
          left_inv' := fun p hp => Prod.ext rfl hp.2.symm
          right_inv' := fun p _ => rfl
          continuousOn_toFun := continuous_fst.continuousOn
          continuousOn_invFun := (continuous_id'.prod_mk continuous_const).continuousOn },
      ⟨he, by rwa [e.toPartialHomeomorph.symm_symm, e.proj_toFun x he],
        (hf (f x) hx).toTrivialization_apply⟩,
      fun p h => (e.proj_toFun p h.1).symm⟩
protected theorem isLocalHomeomorphOn (hf : IsCoveringMapOn f s) :
    IsLocalHomeomorphOn f (f ⁻¹' s) := by
  refine' IsLocalHomeomorphOn.mk f (f ⁻¹' s) fun x hx => _
  let e := (hf (f x) hx).toTrivialization
  have h := (hf (f x) hx).mem_toTrivialization_baseSet
  let he := e.mem_source.2 h
  refine'
    ⟨e.toPartialHomeomorph.trans
        { toFun := fun p => p.1
          invFun := fun p => ⟨p, x, rfl⟩
          source := e.baseSet ×ˢ ({⟨x, rfl⟩} : Set (f ⁻¹' {f x}))
          target := e.baseSet
          open_source :=
            e.open_baseSet.prod (singletons_open_iff_discrete.2 (hf (f x) hx).1 ⟨x, rfl⟩)
          open_target := e.open_baseSet
          map_source' := fun p => And.left
          map_target' := fun p hp => ⟨hp, rfl⟩
          left_inv' := fun p hp => Prod.ext rfl hp.2.symm
          right_inv' := fun p _ => rfl
          continuousOn_toFun := continuous_fst.continuousOn
          continuousOn_invFun := (continuous_id'.prod_mk continuous_const).continuousOn },
      ⟨he, by 

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMapOn f s
x : E
hx : x ∈ f ⁻¹' s
e : Trivialization (↑(f ⁻¹' {f x})) f := IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))
h : f x ∈ (IsEvenlyCovered.toTrivialization (_ : IsEvenlyCovered f (f x) ↑(f ⁻¹' {f x}))).baseSet
he : x ∈ e.source := (Trivialization.mem_source e).mpr h
⊢ (↑(PartialHomeomorph.symm (PartialHomeomorph.symm e.toPartialHomeomorph)) x).1 ∈ e.baseSet

Next tactic:
rwa [e.toPartialHomeomorph.symm_symm, e.proj_toFun x he]
theorem isCoveringMap_iff_isCoveringMapOn_univ : IsCoveringMap f ↔ IsCoveringMapOn f Set.univ := by
  

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
⊢ IsCoveringMap f ↔ IsCoveringMapOn f Set.univ

Next tactic:
simp only [IsCoveringMap, IsCoveringMapOn, Set.mem_univ, forall_true_left]
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    

Proof state:
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
⊢ ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ e₁ ∈ s₁ ∧ e₂ ∈ s₂ ∧ Disjoint s₁ s₂

Next tactic:
obtain ⟨_, t, he₁⟩ := hf (f e₁)
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    

Proof state:
case intro.intro
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : f e₁ ∈ t.baseSet
⊢ ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ e₁ ∈ s₁ ∧ e₂ ∈ s₂ ∧ Disjoint s₁ s₂

Next tactic:
have he₂ := he₁
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; 

Proof state:
case intro.intro
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ he₂ : f e₁ ∈ t.baseSet
⊢ ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ e₁ ∈ s₁ ∧ e₂ ∈ s₂ ∧ Disjoint s₁ s₂

Next tactic:
simp_rw [he] at he₂
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; 

Proof state:
case intro.intro
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : f e₁ ∈ t.baseSet
he₂ : f e₂ ∈ t.baseSet
⊢ ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ e₁ ∈ s₁ ∧ e₂ ∈ s₂ ∧ Disjoint s₁ s₂

Next tactic:
rw [← t.mem_source] at he₁ he₂
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂
    

Proof state:
case intro.intro
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
⊢ ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ e₁ ∈ s₁ ∧ e₂ ∈ s₂ ∧ Disjoint s₁ s₂

Next tactic:
refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2},
      ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂
    refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2},
      ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩
    

Proof state:
case intro.intro.refine_1
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
⊢ IsOpen (t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2})
case intro.intro.refine_2
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
⊢ IsOpen (t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2})
case intro.intro.refine_3
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
x : E
h₁ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2}
h₂ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2}
⊢ ↑t.toPartialHomeomorph e₁ = ↑t.toPartialHomeomorph e₂

Next tactic:
iterate 2
      exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source
        (continuous_snd.isOpen_preimage _ <| isOpen_discrete _)
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂
    refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2},
      ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩
    iterate 2
      

Proof state:
case intro.intro.refine_1
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
⊢ IsOpen (t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2})
case intro.intro.refine_2
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
⊢ IsOpen (t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2})
case intro.intro.refine_3
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
x : E
h₁ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2}
h₂ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2}
⊢ ↑t.toPartialHomeomorph e₁ = ↑t.toPartialHomeomorph e₂

Next tactic:
exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source
        (continuous_snd.isOpen_preimage _ <| isOpen_discrete _)
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂
    refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2},
      ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩
    iterate 2
      

Proof state:
case intro.intro.refine_2
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
⊢ IsOpen (t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2})
case intro.intro.refine_3
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
x : E
h₁ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2}
h₂ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2}
⊢ ↑t.toPartialHomeomorph e₁ = ↑t.toPartialHomeomorph e₂

Next tactic:
exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source
        (continuous_snd.isOpen_preimage _ <| isOpen_discrete _)
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂
    refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2},
      ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩
    iterate 2
      exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source
        (continuous_snd.isOpen_preimage _ <| isOpen_discrete _)
    

Proof state:
case intro.intro.refine_3
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
x : E
h₁ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2}
h₂ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2}
⊢ ↑t.toPartialHomeomorph e₁ = ↑t.toPartialHomeomorph e₂

Next tactic:
refine Prod.ext ?_ (h₁.2.symm.trans h₂.2)
protected theorem isSeparatedMap : IsSeparatedMap f :=
  fun e₁ e₂ he hne ↦ by
    obtain ⟨_, t, he₁⟩ := hf (f e₁)
    have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂
    refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2},
      ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩
    iterate 2
      exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source
        (continuous_snd.isOpen_preimage _ <| isOpen_discrete _)
    refine Prod.ext ?_ (h₁.2.symm.trans h₂.2)
    

Proof state:
case intro.intro.refine_3
E : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace E
inst✝ : TopologicalSpace X
f : E → X
s : Set X
hf : IsCoveringMap f
e₁ e₂ : E
he : f e₁ = f e₂
hne : e₁ ≠ e₂
left✝ : DiscreteTopology ↑(f ⁻¹' {f e₁})
t : Trivialization (↑(f ⁻¹' {f e₁})) f
he₁ : e₁ ∈ t.source
he₂ : e₂ ∈ t.source
x : E
h₁ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₁).2}
h₂ : x ∈ t.source ∩ Prod.snd ∘ ↑t ⁻¹' {(↑t e₂).2}
⊢ (↑t.toPartialHomeomorph e₁).1 = (↑t.toPartialHomeomorph e₂).1

Next tactic:
rwa [t.proj_toFun e₁ he₁, t.proj_toFun e₂ he₂]
/-- A continuous affine map between normed vector spaces is smooth. -/
theorem contDiff {n : ℕ∞} (f : V →A[𝕜] W) : ContDiff 𝕜 n f := by
  

Proof state:
𝕜 : Type u_1
V : Type u_2
W : Type u_3
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedAddCommGroup V
inst✝² : NormedSpace 𝕜 V
inst✝¹ : NormedAddCommGroup W
inst✝ : NormedSpace 𝕜 W
n : ℕ∞
f : V →A[𝕜] W
⊢ ContDiff 𝕜 n ⇑f

Next tactic:
rw [f.decomp]
/-- A continuous affine map between normed vector spaces is smooth. -/
theorem contDiff {n : ℕ∞} (f : V →A[𝕜] W) : ContDiff 𝕜 n f := by
  rw [f.decomp]
  

Proof state:
𝕜 : Type u_1
V : Type u_2
W : Type u_3
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedAddCommGroup V
inst✝² : NormedSpace 𝕜 V
inst✝¹ : NormedAddCommGroup W
inst✝ : NormedSpace 𝕜 W
n : ℕ∞
f : V →A[𝕜] W
⊢ ContDiff 𝕜 n (⇑(contLinear f) + Function.const V (f 0))

Next tactic:
apply f.contLinear.contDiff.add
/-- A continuous affine map between normed vector spaces is smooth. -/
theorem contDiff {n : ℕ∞} (f : V →A[𝕜] W) : ContDiff 𝕜 n f := by
  rw [f.decomp]
  apply f.contLinear.contDiff.add
  

Proof state:
𝕜 : Type u_1
V : Type u_2
W : Type u_3
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedAddCommGroup V
inst✝² : NormedSpace 𝕜 V
inst✝¹ : NormedAddCommGroup W
inst✝ : NormedSpace 𝕜 W
n : ℕ∞
f : V →A[𝕜] W
⊢ ContDiff 𝕜 n fun x => Function.const V (f 0) x

Next tactic:
exact contDiff_const
protected lemma partialSups (hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))) :
    Tendsto (partialSups f n) l (𝓝 (partialSups g n)) := by
  

Proof state:
L : Type u_1
inst✝² : SemilatticeSup L
inst✝¹ : TopologicalSpace L
inst✝ : ContinuousSup L
α : Type u_2
l : Filter α
f : ℕ → α → L
g : ℕ → L
n : ℕ
hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))
⊢ Tendsto ((partialSups f) n) l (𝓝 ((partialSups g) n))

Next tactic:
simp only [partialSups_eq_sup'_range]
protected lemma partialSups (hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))) :
    Tendsto (partialSups f n) l (𝓝 (partialSups g n)) := by
  simp only [partialSups_eq_sup'_range]
  

Proof state:
L : Type u_1
inst✝² : SemilatticeSup L
inst✝¹ : TopologicalSpace L
inst✝ : ContinuousSup L
α : Type u_2
l : Filter α
f : ℕ → α → L
g : ℕ → L
n : ℕ
hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))
⊢ Tendsto (Finset.sup' (Finset.range (n + 1)) (_ : ∃ x, x ∈ Finset.range (n + 1)) f) l
    (𝓝 (Finset.sup' (Finset.range (n + 1)) (_ : ∃ x, x ∈ Finset.range (n + 1)) g))

Next tactic:
refine finset_sup'_nhds _ ?_
protected lemma partialSups (hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))) :
    Tendsto (partialSups f n) l (𝓝 (partialSups g n)) := by
  simp only [partialSups_eq_sup'_range]
  refine finset_sup'_nhds _ ?_
  

Proof state:
L : Type u_1
inst✝² : SemilatticeSup L
inst✝¹ : TopologicalSpace L
inst✝ : ContinuousSup L
α : Type u_2
l : Filter α
f : ℕ → α → L
g : ℕ → L
n : ℕ
hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))
⊢ ∀ i ∈ Finset.range (n + 1), Tendsto (f i) l (𝓝 (g i))

Next tactic:
simpa [Nat.lt_succ_iff]
protected lemma partialSups_apply (hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))) :
    Tendsto (fun a ↦ partialSups (f · a) n) l (𝓝 (partialSups g n)) := by
  

Proof state:
L : Type u_1
inst✝² : SemilatticeSup L
inst✝¹ : TopologicalSpace L
inst✝ : ContinuousSup L
α : Type u_2
l : Filter α
f : ℕ → α → L
g : ℕ → L
n : ℕ
hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))
⊢ Tendsto (fun a => (partialSups fun x => f x a) n) l (𝓝 ((partialSups g) n))

Next tactic:
simpa only [← partialSups_apply] using Tendsto.partialSups hf
protected lemma ContinuousAt.partialSups (hf : ∀ k ≤ n, ContinuousAt (f k) x) :
    ContinuousAt (partialSups f n) x := by
  

Proof state:
L : Type u_1
inst✝³ : SemilatticeSup L
inst✝² : TopologicalSpace L
inst✝¹ : ContinuousSup L
X : Type u_2
inst✝ : TopologicalSpace X
f : ℕ → X → L
n : ℕ
s : Set X
x : X
hf : ∀ k ≤ n, ContinuousAt (f k) x
⊢ ContinuousAt ((partialSups f) n) x

Next tactic:
simpa only [← partialSups_apply] using ContinuousAt.partialSups_apply hf