l3lab/ntp-mathlib huggingface dataset:
theorem Set.OrdConnected.convex_of_chain [OrderedSemiring 𝕜] [OrderedAddCommMonoid E] [Module 𝕜 E]
    [OrderedSMul 𝕜 E] {s : Set E} (hs : s.OrdConnected) (h : IsChain (· ≤ ·) s) : Convex 𝕜 s := by
  refine' convex_iff_segment_subset.mpr fun x hx y hy => _
  obtain hxy | hyx := h.total hx hy
  · exact (segment_subset_Icc hxy).trans (hs.out hx hy)
  · 

Proof state:
case inr
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝³ : OrderedSemiring 𝕜
inst✝² : OrderedAddCommMonoid E
inst✝¹ : Module 𝕜 E
inst✝ : OrderedSMul 𝕜 E
s : Set E
hs : OrdConnected s
h : IsChain (fun x x_1 => x ≤ x_1) s
x : E
hx : x ∈ s
y : E
hy : y ∈ s
hyx : y ≤ x
⊢ [x-[𝕜]y] ⊆ s

Next tactic:
rw [segment_symm]
theorem Set.OrdConnected.convex_of_chain [OrderedSemiring 𝕜] [OrderedAddCommMonoid E] [Module 𝕜 E]
    [OrderedSMul 𝕜 E] {s : Set E} (hs : s.OrdConnected) (h : IsChain (· ≤ ·) s) : Convex 𝕜 s := by
  refine' convex_iff_segment_subset.mpr fun x hx y hy => _
  obtain hxy | hyx := h.total hx hy
  · exact (segment_subset_Icc hxy).trans (hs.out hx hy)
  · rw [segment_symm]
    

Proof state:
case inr
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝³ : OrderedSemiring 𝕜
inst✝² : OrderedAddCommMonoid E
inst✝¹ : Module 𝕜 E
inst✝ : OrderedSMul 𝕜 E
s : Set E
hs : OrdConnected s
h : IsChain (fun x x_1 => x ≤ x_1) s
x : E
hx : x ∈ s
y : E
hy : y ∈ s
hyx : y ≤ x
⊢ [y-[𝕜]x] ⊆ s

Next tactic:
exact (segment_subset_Icc hyx).trans (hs.out hy hx)
theorem convex_iff_ordConnected [LinearOrderedField 𝕜] {s : Set 𝕜} : Convex 𝕜 s ↔ s.OrdConnected :=
  by 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝ : LinearOrderedField 𝕜
s : Set 𝕜
⊢ Convex 𝕜 s ↔ OrdConnected s

Next tactic:
simp_rw [convex_iff_segment_subset, segment_eq_uIcc, ordConnected_iff_uIcc_subset]
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
⊢ Convex 𝕜 ↑K

Next tactic:
repeat' intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
⊢ Convex 𝕜 ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
⊢ x✝ ∈ ↑K → StarConvex 𝕜 x✝ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝ : x✝ ∈ ↑K
⊢ StarConvex 𝕜 x✝ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝ : x✝ ∈ ↑K
y✝ : E
⊢ y✝ ∈ ↑K → ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • x✝ + b • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝¹ : x✝ ∈ ↑K
y✝ : E
a✝ : y✝ ∈ ↑K
⊢ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • x✝ + b • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝² : x✝ ∈ ↑K
y✝ : E
a✝¹ : y✝ ∈ ↑K
a✝ : 𝕜
⊢ ∀ ⦃b : 𝕜⦄, 0 ≤ a✝ → 0 ≤ b → a✝ + b = 1 → a✝ • x✝ + b • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝² : x✝ ∈ ↑K
y✝ : E
a✝¹ : y✝ ∈ ↑K
a✝ b✝ : 𝕜
⊢ 0 ≤ a✝ → 0 ≤ b✝ → a✝ + b✝ = 1 → a✝ • x✝ + b✝ • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝³ : x✝ ∈ ↑K
y✝ : E
a✝² : y✝ ∈ ↑K
a✝¹ b✝ : 𝕜
a✝ : 0 ≤ a✝¹
⊢ 0 ≤ b✝ → a✝¹ + b✝ = 1 → a✝¹ • x✝ + b✝ • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝⁴ : x✝ ∈ ↑K
y✝ : E
a✝³ : y✝ ∈ ↑K
a✝² b✝ : 𝕜
a✝¹ : 0 ≤ a✝²
a✝ : 0 ≤ b✝
⊢ a✝² + b✝ = 1 → a✝² • x✝ + b✝ • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝⁵ : x✝ ∈ ↑K
y✝ : E
a✝⁴ : y✝ ∈ ↑K
a✝³ b✝ : 𝕜
a✝² : 0 ≤ a✝³
a✝¹ : 0 ≤ b✝
a✝ : a✝³ + b✝ = 1
⊢ a✝³ • x✝ + b✝ • y✝ ∈ ↑K

Next tactic:
intro
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' intro
  

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝⁵ : x✝ ∈ ↑K
y✝ : E
a✝⁴ : y✝ ∈ ↑K
a✝³ b✝ : 𝕜
a✝² : 0 ≤ a✝³
a✝¹ : 0 ≤ b✝
a✝ : a✝³ + b✝ = 1
⊢ a✝³ • x✝ + b✝ • y✝ ∈ ↑K

Next tactic:
refine' add_mem (smul_mem _ _ _) (smul_mem _ _ _)
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' intro
  refine' add_mem (smul_mem _ _ _) (smul_mem _ _ _) <;> 

Proof state:
case refine'_1
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝⁵ : x✝ ∈ ↑K
y✝ : E
a✝⁴ : y✝ ∈ ↑K
a✝³ b✝ : 𝕜
a✝² : 0 ≤ a✝³
a✝¹ : 0 ≤ b✝
a✝ : a✝³ + b✝ = 1
⊢ x✝ ∈ K

Next tactic:
assumption
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) := by
  repeat' intro
  refine' add_mem (smul_mem _ _ _) (smul_mem _ _ _) <;> 

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
inst✝² : OrderedSemiring 𝕜
inst✝¹ : AddCommMonoid E
inst✝ : Module 𝕜 E
K : Submodule 𝕜 E
x✝ : E
a✝⁵ : x✝ ∈ ↑K
y✝ : E
a✝⁴ : y✝ ∈ ↑K
a✝³ b✝ : 𝕜
a✝² : 0 ≤ a✝³
a✝¹ : 0 ≤ b✝
a✝ : a✝³ + b✝ = 1
⊢ y✝ ∈ K

Next tactic:
assumption
theorem stdSimplex_eq_inter : stdSimplex 𝕜 ι = (⋂ x, { f | 0 ≤ f x }) ∩ { f | ∑ x, f x = 1 } := by
  

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
⊢ stdSimplex 𝕜 ι = (⋂ x, {f | 0 ≤ f x}) ∩ {f | ∑ x : ι, f x = 1}

Next tactic:
ext f
theorem stdSimplex_eq_inter : stdSimplex 𝕜 ι = (⋂ x, { f | 0 ≤ f x }) ∩ { f | ∑ x, f x = 1 } := by
  ext f
  

Proof state:
case h
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
f : ι → 𝕜
⊢ f ∈ stdSimplex 𝕜 ι ↔ f ∈ (⋂ x, {f | 0 ≤ f x}) ∩ {f | ∑ x : ι, f x = 1}

Next tactic:
simp only [stdSimplex, Set.mem_inter_iff, Set.mem_iInter, Set.mem_setOf_eq]
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) := by
  

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
⊢ Convex 𝕜 (stdSimplex 𝕜 ι)

Next tactic:
refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) := by
  refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
  · 

Proof state:
case refine'_1
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
f : ι → 𝕜
hf : f ∈ stdSimplex 𝕜 ι
g : ι → 𝕜
hg : g ∈ stdSimplex 𝕜 ι
a b : 𝕜
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
x : ι
⊢ 0 ≤ (a • f + b • g) x

Next tactic:
apply_rules [add_nonneg, mul_nonneg, hf.1, hg.1]
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) := by
  refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
  · apply_rules [add_nonneg, mul_nonneg, hf.1, hg.1]
  · 

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
f : ι → 𝕜
hf : f ∈ stdSimplex 𝕜 ι
g : ι → 𝕜
hg : g ∈ stdSimplex 𝕜 ι
a b : 𝕜
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ ∑ x : ι, (a • f + b • g) x = 1

Next tactic:
erw [Finset.sum_add_distrib]
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) := by
  refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
  · apply_rules [add_nonneg, mul_nonneg, hf.1, hg.1]
  · erw [Finset.sum_add_distrib]
    

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
f : ι → 𝕜
hf : f ∈ stdSimplex 𝕜 ι
g : ι → 𝕜
hg : g ∈ stdSimplex 𝕜 ι
a b : 𝕜
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ ∑ x : ι, (a • f) x + ∑ x : ι, (b • g) x = 1

Next tactic:
simp only [Pi.smul_apply]
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) := by
  refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
  · apply_rules [add_nonneg, mul_nonneg, hf.1, hg.1]
  · erw [Finset.sum_add_distrib]
    simp only [Pi.smul_apply] -- Porting note: `erw` failed to rewrite with `← Finset.smul_sum`
    

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
f : ι → 𝕜
hf : f ∈ stdSimplex 𝕜 ι
g : ι → 𝕜
hg : g ∈ stdSimplex 𝕜 ι
a b : 𝕜
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ ∑ x : ι, a • f x + ∑ x : ι, b • g x = 1

Next tactic:
rw [← Finset.smul_sum, ← Finset.smul_sum, hf.2, hg.2, smul_eq_mul,
      smul_eq_mul, mul_one, mul_one]
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) := by
  refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
  · apply_rules [add_nonneg, mul_nonneg, hf.1, hg.1]
  · erw [Finset.sum_add_distrib]
    simp only [Pi.smul_apply] -- Porting note: `erw` failed to rewrite with `← Finset.smul_sum`
    rw [← Finset.smul_sum, ← Finset.smul_sum, hf.2, hg.2, smul_eq_mul,
      smul_eq_mul, mul_one, mul_one]
    

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
f : ι → 𝕜
hf : f ∈ stdSimplex 𝕜 ι
g : ι → 𝕜
hg : g ∈ stdSimplex 𝕜 ι
a b : 𝕜
ha : 0 ≤ a
hb : 0 ≤ b
hab : a + b = 1
⊢ a + b = 1

Next tactic:
exact hab
theorem ite_eq_mem_stdSimplex (i : ι) : (fun j => ite (i = j) (1 : 𝕜) 0) ∈ stdSimplex 𝕜 ι :=
  ⟨fun j => by 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
i j : ι
⊢ 0 ≤ (fun j => if i = j then 1 else 0) j

Next tactic:
simp only
theorem ite_eq_mem_stdSimplex (i : ι) : (fun j => ite (i = j) (1 : 𝕜) 0) ∈ stdSimplex 𝕜 ι :=
  ⟨fun j => by simp only; 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
i j : ι
⊢ 0 ≤ if i = j then 1 else 0

Next tactic:
split_ifs
theorem ite_eq_mem_stdSimplex (i : ι) : (fun j => ite (i = j) (1 : 𝕜) 0) ∈ stdSimplex 𝕜 ι :=
  ⟨fun j => by simp only; split_ifs <;> 

Proof state:
case pos
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
i j : ι
h✝ : i = j
⊢ 0 ≤ 1

Next tactic:
norm_num
theorem ite_eq_mem_stdSimplex (i : ι) : (fun j => ite (i = j) (1 : 𝕜) 0) ∈ stdSimplex 𝕜 ι :=
  ⟨fun j => by simp only; split_ifs <;> 

Proof state:
case neg
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
i j : ι
h✝ : ¬i = j
⊢ 0 ≤ 0

Next tactic:
norm_num
theorem ite_eq_mem_stdSimplex (i : ι) : (fun j => ite (i = j) (1 : 𝕜) 0) ∈ stdSimplex 𝕜 ι :=
  ⟨fun j => by simp only; split_ifs <;> norm_num, by
    

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
β : Type u_4
ι : Type u_5
inst✝¹ : OrderedSemiring 𝕜
inst✝ : Fintype ι
i : ι
⊢ ∑ x : ι, (fun j => if i = j then 1 else 0) x = 1

Next tactic:
rw [Finset.sum_ite_eq, if_pos (Finset.mem_univ _)]
theorem embedding_toPullbackDiag (f : X → Y) : Embedding (toPullbackDiag f) :=
  Embedding.mk' _ (injective_toPullbackDiag f) fun x ↦ by
    

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.29
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x : X
⊢ Filter.comap (toPullbackDiag f) (𝓝 (toPullbackDiag f x)) = 𝓝 x

Next tactic:
rw [toPullbackDiag, nhds_induced, Filter.comap_comap, nhds_prod_eq, Filter.comap_prod]
theorem embedding_toPullbackDiag (f : X → Y) : Embedding (toPullbackDiag f) :=
  Embedding.mk' _ (injective_toPullbackDiag f) fun x ↦ by
    rw [toPullbackDiag, nhds_induced, Filter.comap_comap, nhds_prod_eq, Filter.comap_prod]
    

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.29
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x : X
⊢ Filter.comap (Prod.fst ∘ Subtype.val ∘ toPullbackDiag f) (𝓝 x) ⊓
      Filter.comap (Prod.snd ∘ Subtype.val ∘ toPullbackDiag f) (𝓝 x) =
    𝓝 x

Next tactic:
erw [Filter.comap_id, inf_idem]
lemma Continuous.mapPullback {X₁ X₂ Y₁ Y₂ Z₁ Z₂}
    [TopologicalSpace X₁] [TopologicalSpace X₂] [TopologicalSpace Z₁] [TopologicalSpace Z₂]
    {f₁ : X₁ → Y₁} {g₁ : Z₁ → Y₁} {f₂ : X₂ → Y₂} {g₂ : Z₂ → Y₂}
    {mapX : X₁ → X₂} (contX : Continuous mapX) {mapY : Y₁ → Y₂}
    {mapZ : Z₁ → Z₂} (contZ : Continuous mapZ)
    {commX : f₂ ∘ mapX = mapY ∘ f₁} {commZ : g₂ ∘ mapZ = mapY ∘ g₁} :
    Continuous (Function.mapPullback mapX mapY mapZ commX commZ) := by
  

Proof state:
X : Type ?u.696
Y : ?m.690
A : Type ?u.699
inst✝⁵ : TopologicalSpace X
inst✝⁴ : TopologicalSpace A
X₁ : Type u_1
X₂ : Type u_2
Y₁ : Sort u_3
Y₂ : Sort u_4
Z₁ : Type u_5
Z₂ : Type u_6
inst✝³ : TopologicalSpace X₁
inst✝² : TopologicalSpace X₂
inst✝¹ : TopologicalSpace Z₁
inst✝ : TopologicalSpace Z₂
f₁ : X₁ → Y₁
g₁ : Z₁ → Y₁
f₂ : X₂ → Y₂
g₂ : Z₂ → Y₂
mapX : X₁ → X₂
contX : Continuous mapX
mapY : Y₁ → Y₂
mapZ : Z₁ → Z₂
contZ : Continuous mapZ
commX : f₂ ∘ mapX = mapY ∘ f₁
commZ : g₂ ∘ mapZ = mapY ∘ g₁
⊢ Continuous (Function.mapPullback mapX mapY mapZ commX commZ)

Next tactic:
refine continuous_induced_rng.mpr (continuous_prod_mk.mpr ⟨?_, ?_⟩)
lemma Continuous.mapPullback {X₁ X₂ Y₁ Y₂ Z₁ Z₂}
    [TopologicalSpace X₁] [TopologicalSpace X₂] [TopologicalSpace Z₁] [TopologicalSpace Z₂]
    {f₁ : X₁ → Y₁} {g₁ : Z₁ → Y₁} {f₂ : X₂ → Y₂} {g₂ : Z₂ → Y₂}
    {mapX : X₁ → X₂} (contX : Continuous mapX) {mapY : Y₁ → Y₂}
    {mapZ : Z₁ → Z₂} (contZ : Continuous mapZ)
    {commX : f₂ ∘ mapX = mapY ∘ f₁} {commZ : g₂ ∘ mapZ = mapY ∘ g₁} :
    Continuous (Function.mapPullback mapX mapY mapZ commX commZ) := by
  refine continuous_induced_rng.mpr (continuous_prod_mk.mpr ⟨?_, ?_⟩) <;>
  

Proof state:
case refine_1
X : Type ?u.696
Y : ?m.690
A : Type ?u.699
inst✝⁵ : TopologicalSpace X
inst✝⁴ : TopologicalSpace A
X₁ : Type u_1
X₂ : Type u_2
Y₁ : Sort u_3
Y₂ : Sort u_4
Z₁ : Type u_5
Z₂ : Type u_6
inst✝³ : TopologicalSpace X₁
inst✝² : TopologicalSpace X₂
inst✝¹ : TopologicalSpace Z₁
inst✝ : TopologicalSpace Z₂
f₁ : X₁ → Y₁
g₁ : Z₁ → Y₁
f₂ : X₂ → Y₂
g₂ : Z₂ → Y₂
mapX : X₁ → X₂
contX : Continuous mapX
mapY : Y₁ → Y₂
mapZ : Z₁ → Z₂
contZ : Continuous mapZ
commX : f₂ ∘ mapX = mapY ∘ f₁
commZ : g₂ ∘ mapZ = mapY ∘ g₁
⊢ Continuous fun x => mapX (Function.Pullback.fst x)

Next tactic:
apply_rules [continuous_fst, continuous_snd, continuous_subtype_val, Continuous.comp]
lemma Continuous.mapPullback {X₁ X₂ Y₁ Y₂ Z₁ Z₂}
    [TopologicalSpace X₁] [TopologicalSpace X₂] [TopologicalSpace Z₁] [TopologicalSpace Z₂]
    {f₁ : X₁ → Y₁} {g₁ : Z₁ → Y₁} {f₂ : X₂ → Y₂} {g₂ : Z₂ → Y₂}
    {mapX : X₁ → X₂} (contX : Continuous mapX) {mapY : Y₁ → Y₂}
    {mapZ : Z₁ → Z₂} (contZ : Continuous mapZ)
    {commX : f₂ ∘ mapX = mapY ∘ f₁} {commZ : g₂ ∘ mapZ = mapY ∘ g₁} :
    Continuous (Function.mapPullback mapX mapY mapZ commX commZ) := by
  refine continuous_induced_rng.mpr (continuous_prod_mk.mpr ⟨?_, ?_⟩) <;>
  

Proof state:
case refine_2
X : Type ?u.696
Y : ?m.690
A : Type ?u.699
inst✝⁵ : TopologicalSpace X
inst✝⁴ : TopologicalSpace A
X₁ : Type u_1
X₂ : Type u_2
Y₁ : Sort u_3
Y₂ : Sort u_4
Z₁ : Type u_5
Z₂ : Type u_6
inst✝³ : TopologicalSpace X₁
inst✝² : TopologicalSpace X₂
inst✝¹ : TopologicalSpace Z₁
inst✝ : TopologicalSpace Z₂
f₁ : X₁ → Y₁
g₁ : Z₁ → Y₁
f₂ : X₂ → Y₂
g₂ : Z₂ → Y₂
mapX : X₁ → X₂
contX : Continuous mapX
mapY : Y₁ → Y₂
mapZ : Z₁ → Z₂
contZ : Continuous mapZ
commX : f₂ ∘ mapX = mapY ∘ f₁
commZ : g₂ ∘ mapZ = mapY ∘ g₁
⊢ Continuous fun x => mapZ (Function.Pullback.snd x)

Next tactic:
apply_rules [continuous_fst, continuous_snd, continuous_subtype_val, Continuous.comp]
lemma isSeparatedMap_iff_disjoint_nhds {f : X → Y} : IsSeparatedMap f ↔
    ∀ x₁ x₂, f x₁ = f x₂ → x₁ ≠ x₂ → Disjoint (𝓝 x₁) (𝓝 x₂) :=
  forall₃_congr fun x x' _ ↦ by 

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.5639
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x x' : X
x✝ : f x = f x'
⊢ (x ≠ x' → ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ x ∈ s₁ ∧ x' ∈ s₂ ∧ Disjoint s₁ s₂) ↔ x ≠ x' → Disjoint (𝓝 x) (𝓝 x')

Next tactic:
simp only [(nhds_basis_opens x).disjoint_iff (nhds_basis_opens x'),
    exists_prop, ← exists_and_left, and_assoc, and_comm, and_left_comm]
lemma isSeparatedMap_iff_nhds {f : X → Y} : IsSeparatedMap f ↔
    ∀ x₁ x₂, f x₁ = f x₂ → x₁ ≠ x₂ → ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂ := by
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.6862
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
⊢ IsSeparatedMap f ↔ ∀ (x₁ x₂ : X), f x₁ = f x₂ → x₁ ≠ x₂ → ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂

Next tactic:
simp_rw [isSeparatedMap_iff_disjoint_nhds, Filter.disjoint_iff]
open Set Filter in
theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
    IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.8127
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
⊢ IsSeparatedMap f ↔ IsClosed (Function.pullbackDiagonal f)

Next tactic:
simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
    Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
open Set Filter in
theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
    IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by
  simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
    Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.8127
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
⊢ (∀ (x₁ x₂ : X), f x₁ = f x₂ → x₁ ≠ x₂ → ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂) ↔
    ∀ (a b : X) (b_1 : f a = f b),
      { val := (a, b), property := b_1 } ∈ (Function.pullbackDiagonal f)ᶜ →
        (Function.pullbackDiagonal f)ᶜ ∈ comap Subtype.val (𝓝 a ×ˢ 𝓝 b)

Next tactic:
refine forall₄_congr fun x₁ x₂ _ _ ↦ ⟨fun h ↦ ?_, fun ⟨t, ht, t_sub⟩ ↦ ?_⟩
open Set Filter in
theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
    IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by
  simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
    Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
  refine forall₄_congr fun x₁ x₂ _ _ ↦ ⟨fun h ↦ ?_, fun ⟨t, ht, t_sub⟩ ↦ ?_⟩
  · 

Proof state:
case refine_1
X : Type u_1
Y : Sort u_2
A : Type ?u.8127
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x₁ x₂ : X
x✝¹ : f x₁ = f x₂
x✝ : x₁ ≠ x₂
h : ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂
⊢ (Function.pullbackDiagonal f)ᶜ ∈ comap Subtype.val (𝓝 x₁ ×ˢ 𝓝 x₂)

Next tactic:
simp_rw [← Filter.disjoint_iff, ← compl_diagonal_mem_prod] at h
open Set Filter in
theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
    IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by
  simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
    Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
  refine forall₄_congr fun x₁ x₂ _ _ ↦ ⟨fun h ↦ ?_, fun ⟨t, ht, t_sub⟩ ↦ ?_⟩
  · simp_rw [← Filter.disjoint_iff, ← compl_diagonal_mem_prod] at h
    

Proof state:
case refine_1
X : Type u_1
Y : Sort u_2
A : Type ?u.8127
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x₁ x₂ : X
x✝¹ : f x₁ = f x₂
x✝ : x₁ ≠ x₂
h : (diagonal X)ᶜ ∈ 𝓝 x₁ ×ˢ 𝓝 x₂
⊢ (Function.pullbackDiagonal f)ᶜ ∈ comap Subtype.val (𝓝 x₁ ×ˢ 𝓝 x₂)

Next tactic:
exact ⟨_, h, subset_rfl⟩
open Set Filter in
theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
    IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by
  simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
    Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
  refine forall₄_congr fun x₁ x₂ _ _ ↦ ⟨fun h ↦ ?_, fun ⟨t, ht, t_sub⟩ ↦ ?_⟩
  · simp_rw [← Filter.disjoint_iff, ← compl_diagonal_mem_prod] at h
    exact ⟨_, h, subset_rfl⟩
  · 

Proof state:
case refine_2
X : Type u_1
Y : Sort u_2
A : Type ?u.8127
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x₁ x₂ : X
x✝² : f x₁ = f x₂
x✝¹ : x₁ ≠ x₂
x✝ : (Function.pullbackDiagonal f)ᶜ ∈ comap Subtype.val (𝓝 x₁ ×ˢ 𝓝 x₂)
t : Set (X × X)
ht : t ∈ 𝓝 x₁ ×ˢ 𝓝 x₂
t_sub : Subtype.val ⁻¹' t ⊆ (Function.pullbackDiagonal f)ᶜ
⊢ ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂

Next tactic:
obtain ⟨s₁, h₁, s₂, h₂, s_sub⟩ := mem_prod_iff.mp ht
open Set Filter in
theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
    IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by
  simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
    Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
  refine forall₄_congr fun x₁ x₂ _ _ ↦ ⟨fun h ↦ ?_, fun ⟨t, ht, t_sub⟩ ↦ ?_⟩
  · simp_rw [← Filter.disjoint_iff, ← compl_diagonal_mem_prod] at h
    exact ⟨_, h, subset_rfl⟩
  · obtain ⟨s₁, h₁, s₂, h₂, s_sub⟩ := mem_prod_iff.mp ht
    

Proof state:
case refine_2.intro.intro.intro.intro
X : Type u_1
Y : Sort u_2
A : Type ?u.8127
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
x₁ x₂ : X
x✝² : f x₁ = f x₂
x✝¹ : x₁ ≠ x₂
x✝ : (Function.pullbackDiagonal f)ᶜ ∈ comap Subtype.val (𝓝 x₁ ×ˢ 𝓝 x₂)
t : Set (X × X)
ht : t ∈ 𝓝 x₁ ×ˢ 𝓝 x₂
t_sub : Subtype.val ⁻¹' t ⊆ (Function.pullbackDiagonal f)ᶜ
s₁ : Set X
h₁ : s₁ ∈ 𝓝 x₁
s₂ : Set X
h₂ : s₂ ∈ 𝓝 x₂
s_sub : s₁ ×ˢ s₂ ⊆ t
⊢ ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂

Next tactic:
exact ⟨s₁, h₁, s₂, h₂, disjoint_left.2 fun x h₁ h₂ ↦ @t_sub ⟨(x, x), rfl⟩ (s_sub ⟨h₁, h₂⟩) rfl⟩
theorem isSeparatedMap_iff_closedEmbedding {f : X → Y} :
    IsSeparatedMap f ↔ ClosedEmbedding (toPullbackDiag f) := by
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.11484
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
⊢ IsSeparatedMap f ↔ ClosedEmbedding (toPullbackDiag f)

Next tactic:
rw [isSeparatedMap_iff_isClosed_diagonal, ← range_toPullbackDiag]
theorem isSeparatedMap_iff_closedEmbedding {f : X → Y} :
    IsSeparatedMap f ↔ ClosedEmbedding (toPullbackDiag f) := by
  rw [isSeparatedMap_iff_isClosed_diagonal, ← range_toPullbackDiag]
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type ?u.11484
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
⊢ IsClosed (Set.range (toPullbackDiag f)) ↔ ClosedEmbedding (toPullbackDiag f)

Next tactic:
exact ⟨fun h ↦ ⟨embedding_toPullbackDiag f, h⟩, fun h ↦ h.2⟩
open Function.Pullback in
theorem IsSeparatedMap.pullback {f : X → Y} (sep : IsSeparatedMap f) (g : A → Y) :
    IsSeparatedMap (@snd X Y A f g) := by
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type u_3
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
sep : IsSeparatedMap f
g : A → Y
⊢ IsSeparatedMap snd

Next tactic:
rw [isSeparatedMap_iff_isClosed_diagonal] at sep ⊢
open Function.Pullback in
theorem IsSeparatedMap.pullback {f : X → Y} (sep : IsSeparatedMap f) (g : A → Y) :
    IsSeparatedMap (@snd X Y A f g) := by
  rw [isSeparatedMap_iff_isClosed_diagonal] at sep ⊢
  

Proof state:
X : Type u_1
Y : Sort u_2
A : Type u_3
inst✝¹ : TopologicalSpace X
inst✝ : TopologicalSpace A
f : X → Y
sep : IsClosed (Function.pullbackDiagonal f)
g : A → Y
⊢ IsClosed (Function.pullbackDiagonal snd)

Next tactic:
rw [← preimage_map_fst_pullbackDiagonal]