Lean library · module TopologyByExample.Spaces.KnasterKuratowskiFan

The Knaster–Kuratowski fan

Source file

Let C ⊆ [0, 1] be the middle-thirds Cantor set, E ⊆ C the set of endpoints of the deleted open intervals (the ends 0 and 1 of [0, 1] are not among them) and p = (1 / 2, 1 / 2). Over each c ∈ C runs the segment from (c, 0) to p; its point at height y is (c (1 - 2y) + y, y). The Knaster–Kuratowski fan (Cantor's leaky tent) consists of p, the points at rational heights of the segments over E and the points at irrational heights of the segments over C ∖ E. The punctured fan is the fan without p.

Off the line y = 1 / 2 the map (x, y) ↦ ((x - y) / (1 - 2y), y) straightens the segments, so the punctured fan is homeomorphic to the set params of pairs (c, y) with c ∈ C, 0 ≤ y < 1 / 2, and y rational exactly when c ∈ E. Most of the work is done there.

The heart of the file is the Knaster–Kuratowski lemma KnasterKuratowski.mem_of_isClopen: a clopen set of parameters containing (c, y) contains every parameter (c, y'). Its proof is a Baire category argument in the Cantor set (KnasterKuratowski.exists_inter_interior_nonempty). It gives the connectedness of the fan (a clopen set containing p contains points of every segment, hence all of them) and shows that the quasi-components of the punctured fan are its segments, so that the punctured fan, though totally disconnected, is not totally separated.

Main definitions

Main statements

Tags

Knaster–Kuratowski fan, Cantor's leaky tent, Cantor's teepee, dispersion point, quasi-component

This file was written by Claude (Anthropic's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports

The Cantor set and the endpoints of its deleted intervals

definition endpoints

TopologyByExample.KnasterKuratowski.endpoints

The endpoints of the deleted intervals of the middle-thirds Cantor set C: the points c ∈ C at which an open interval of [0, 1] ∖ C ends, on the right (c, d) with d ≤ 1 or on the left (d, c) with 0 ≤ d. The ends 0 and 1 of the unit interval are not among them.

def endpoints : Set ℝ
:=
  {c | c ∈ cantorSet ∧ ((∃ d, c < d ∧ d ≤ 1 ∧ Disjoint (Ioo c d) cantorSet) ∨
    (∃ d, 0 ≤ d ∧ d < c ∧ Disjoint (Ioo d c) cantorSet))}

theorem endpoints_subset

TopologyByExample.KnasterKuratowski.endpoints_subset

The endpoints of the deleted intervals lie in the Cantor set.

theorem endpoints_subset : endpoints ⊆ cantorSet
Proof
:= fun _ h ↦ h.1

instance

The Cantor set, as a subspace of the line, is totally disconnected.

instance : TotallyDisconnectedSpace cantorSet
Proof
:=
  cantorSetHomeomorphNatToBool.symm.totallyDisconnectedSpace

instance

The Cantor set is compact.

instance : CompactSpace cantorSet
Proof
:= isCompact_iff_compactSpace.1 isCompact_cantorSet

theorem not_Icc_subset_cantorSet

TopologyByExample.KnasterKuratowski.not_Icc_subset_cantorSet

The Cantor set contains no interval with more than one point.

theorem not_Icc_subset_cantorSet {a b : ℝ} (hab : a < b) : ¬Icc a b ⊆ cantorSet
Proof
:= by
  intro h
  have hpre : IsPreconnected (((↑) : cantorSet → ℝ) ⁻¹' Icc a b) := by
    rw [← Topology.IsInducing.subtypeVal.isPreconnected_image, Subtype.image_preimage_coe,
      inter_eq_right.2 h]
    exact isPreconnected_Icc
  have hsub := isTotallyDisconnected_of_totallyDisconnectedSpace _ _ (subset_refl _) hpre
  have := hsub (x := ⟨a, h (left_mem_Icc.2 hab.le)⟩) (left_mem_Icc.2 hab.le)
    (y := ⟨b, h (right_mem_Icc.2 hab.le)⟩) (right_mem_Icc.2 hab.le)
  exact hab.ne (congrArg Subtype.val this)

theorem exists_mem_cantorSet_ne

TopologyByExample.KnasterKuratowski.exists_mem_cantorSet_ne

Every point of the Cantor set is a limit of other points of it.

theorem exists_mem_cantorSet_ne {c : ℝ} (hc : c ∈ cantorSet) {ε : ℝ} (hε : 0 < ε) :
    ∃ c' ∈ cantorSet, c' ≠ c ∧ |c' - c| < ε
Proof
:= by
  let h := cantorSetHomeomorphNatToBool
  set x := h ⟨c, hc⟩
  let s : ℕ → ℕ → Bool := fun n ↦ Function.update x n (!x n)
  have hs : Tendsto s atTop (𝓝 x) := by
    refine tendsto_pi_nhds.2 fun k ↦ tendsto_const_nhds.congr' ?_
    filter_upwards [eventually_gt_atTop k] with n hn
    simp [s, Function.update_of_ne hn.ne]
  have hlim : Tendsto (fun n ↦ (h.symm (s n) : ℝ)) atTop (𝓝 c) := by
    have := ((continuous_subtypeVal.comp h.symm.continuous).tendsto x).comp hs
    simpa [x, Function.comp_def] using this
  obtain ⟨n, hn⟩ := (Metric.tendsto_atTop.1 hlim ε hε)
  refine ⟨h.symm (s n), (h.symm (s n)).property, fun heq ↦ ?_,
    by simpa [Real.dist_eq] using hn n le_rfl⟩
  have : s n = x := by
    rw [← h.apply_symm_apply (s n)]
    exact congrArg h (Subtype.ext heq)
  have := congrFun this n
  simp [s] at this

theorem not_isOpen_singleton

TopologyByExample.KnasterKuratowski.not_isOpen_singleton

No point of the Cantor set is isolated in it.

theorem not_isOpen_singleton (x : cantorSet) : ¬IsOpen ({x} : Set cantorSet)
Proof
:= by
  intro h
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 h x rfl
  obtain ⟨c', hc', hne, hlt⟩ := exists_mem_cantorSet_ne x.property hε
  have : (⟨c', hc'⟩ : cantorSet) ∈ Metric.ball x ε := by
    rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq]
    exact hlt
  exact hne (congrArg Subtype.val (hball this))

theorem exists_mem_endpoints

TopologyByExample.KnasterKuratowski.exists_mem_endpoints

The endpoints of the deleted intervals are dense in the Cantor set.

theorem exists_mem_endpoints {c : ℝ} (hc : c ∈ cantorSet) {ε : ℝ} (hε : 0 < ε) :
    ∃ e ∈ endpoints, |e - c| < ε
Proof
:= by
  have hc1 : c ≤ 1 := (cantorSet_subset_unitInterval hc).2
  have hc0 : 0 ≤ c := (cantorSet_subset_unitInterval hc).1
  rcases hc1.lt_or_eq with hc1 | rfl
  · set b := min (c + ε) 1
    have hcb : c < b := lt_min (by linarith) hc1
    obtain ⟨u, hu, huC⟩ := not_subset.1 (not_Icc_subset_cantorSet
      (a := c + (b - c) / 3) (b := c + 2 * (b - c) / 3) (by linarith))
    have hcu : c < u := by linarith [hu.1]
    have hub : u < b := by linarith [hu.2]
    set S := cantorSet ∩ Icc c u
    have hSc : IsClosed S := isClosed_cantorSet.inter isClosed_Icc
    have hSne : S.Nonempty := ⟨c, hc, left_mem_Icc.2 hcu.le⟩
    have hSb : BddAbove S := ⟨u, fun x hx ↦ hx.2.2⟩
    have heS : sSup S ∈ S := hSc.csSup_mem hSne hSb
    have heu : sSup S < u := lt_of_le_of_ne heS.2.2 fun h ↦ huC (h ▸ heS.1)
    refine ⟨sSup S, ⟨heS.1, Or.inl ⟨u, heu, hub.le.trans (min_le_right _ _), ?_⟩⟩, ?_⟩
    · refine disjoint_left.2 fun x hx hxC ↦ ?_
      have : x ≤ sSup S := le_csSup hSb ⟨hxC, heS.2.1.trans hx.1.le, hx.2.le⟩
      exact absurd hx.1 this.not_gt
    · rw [abs_of_nonneg (by linarith [heS.2.1])]
      linarith [min_le_left (c + ε) 1]
  · set b := max (1 - ε) 0
    have hcb : b < 1 := max_lt (by linarith) one_pos
    obtain ⟨u, hu, huC⟩ := not_subset.1 (not_Icc_subset_cantorSet
      (a := b + (1 - b) / 3) (b := b + 2 * (1 - b) / 3) (by linarith))
    have hcu : u < 1 := by linarith [hu.2]
    have hub : b < u := by linarith [hu.1]
    set S := cantorSet ∩ Icc u 1
    have hSc : IsClosed S := isClosed_cantorSet.inter isClosed_Icc
    have hSne : S.Nonempty := ⟨1, hc, right_mem_Icc.2 hcu.le⟩
    have hSb : BddBelow S := ⟨u, fun x hx ↦ hx.2.1⟩
    have heS : sInf S ∈ S := hSc.csInf_mem hSne hSb
    have heu : u < sInf S := lt_of_le_of_ne heS.2.1 fun h ↦ huC (h ▸ heS.1)
    refine ⟨sInf S, ⟨heS.1, Or.inr ⟨u, (le_max_right _ _).trans hub.le, heu, ?_⟩⟩, ?_⟩
    · refine disjoint_left.2 fun x hx hxC ↦ ?_
      have : sInf S ≤ x := csInf_le hSb ⟨hxC, hx.1.le, hx.2.le.trans heS.2.2⟩
      exact absurd hx.2 this.not_gt
    · rw [abs_of_nonpos (by linarith [heS.2.2])]
      linarith [le_max_left (1 - ε) 0]

theorem countable_setOf_gap_right

TopologyByExample.KnasterKuratowski.countable_setOf_gap_right

The points of the Cantor set at which a deleted interval begins form a countable set.

theorem countable_setOf_gap_right :
    {c | c ∈ cantorSet ∧ ∃ d, c < d ∧ Disjoint (Ioo c d) cantorSet}.Countable
Proof
:= by
  set R := {c | c ∈ cantorSet ∧ ∃ d, c < d ∧ Disjoint (Ioo c d) cantorSet}
  have key : ∀ c ∈ R, ∃ q : ℚ, c < q ∧ Disjoint (Ioo c q) cantorSet := by
    rintro c ⟨-, d, hcd, hd⟩
    obtain ⟨q, hcq, hqd⟩ := exists_rat_btwn hcd
    exact ⟨q, hcq, hd.mono_left (Ioo_subset_Ioo_right hqd.le)⟩
  choose f hf using key
  refine Set.countable_coe_iff.1 (Function.Injective.countable (f := fun c : R ↦ f c c.property) ?_)
  rintro ⟨c, hc⟩ ⟨c', hc'⟩ h
  simp only at h
  by_contra hne
  rcases lt_or_gt_of_ne (fun h' ↦ hne (Subtype.ext h')) with hlt | hlt
  · exact disjoint_left.1 (hf c hc).2 ⟨hlt, h ▸ (hf c' hc').1⟩ hc'.1
  · exact disjoint_left.1 (hf c' hc').2 ⟨hlt, h ▸ (hf c hc).1⟩ hc.1

theorem countable_setOf_gap_left

TopologyByExample.KnasterKuratowski.countable_setOf_gap_left

The points of the Cantor set at which a deleted interval ends form a countable set.

theorem countable_setOf_gap_left :
    {c | c ∈ cantorSet ∧ ∃ d, d < c ∧ Disjoint (Ioo d c) cantorSet}.Countable
Proof
:= by
  set L := {c | c ∈ cantorSet ∧ ∃ d, d < c ∧ Disjoint (Ioo d c) cantorSet}
  have key : ∀ c ∈ L, ∃ q : ℚ, q < c ∧ Disjoint (Ioo (q : ℝ) c) cantorSet := by
    rintro c ⟨-, d, hcd, hd⟩
    obtain ⟨q, hdq, hqc⟩ := exists_rat_btwn hcd
    exact ⟨q, hqc, hd.mono_left (Ioo_subset_Ioo_left hdq.le)⟩
  choose f hf using key
  refine Set.countable_coe_iff.1 (Function.Injective.countable (f := fun c : L ↦ f c c.property) ?_)
  rintro ⟨c, hc⟩ ⟨c', hc'⟩ h
  simp only at h
  by_contra hne
  rcases lt_or_gt_of_ne (fun h' ↦ hne (Subtype.ext h')) with hlt | hlt
  · exact disjoint_left.1 (hf c' hc').2 ⟨h ▸ (hf c hc).1, hlt⟩ hc.1
  · exact disjoint_left.1 (hf c hc).2 ⟨h ▸ (hf c' hc').1, hlt⟩ hc'.1

theorem countable_endpoints

TopologyByExample.KnasterKuratowski.countable_endpoints

There are only countably many endpoints of deleted intervals.

theorem countable_endpoints : endpoints.Countable
Proof
:= by
  refine (countable_setOf_gap_right.union countable_setOf_gap_left).mono ?_
  rintro c ⟨hc, ⟨d, hcd, -, hd⟩ | ⟨d, -, hdc, hd⟩⟩
  · exact Or.inl ⟨hc, d, hcd, hd⟩
  · exact Or.inr ⟨hc, d, hdc, hd⟩

theorem exists_inter_interior_nonempty

TopologyByExample.KnasterKuratowski.exists_inter_interior_nonempty

Baire category in the Cantor set. If countably many closed sets cover the points of a nonempty open set W of the Cantor set that are not endpoints of deleted intervals, then one of them has interior meeting W.

theorem exists_inter_interior_nonempty {ι : Type*} [Countable ι] {f : ι → Set cantorSet}
    (hf : ∀ i, IsClosed (f i)) {W : Set cantorSet} (hW : IsOpen W) (hWne : W.Nonempty)
    (hcov : ∀ x ∈ W, (x : ℝ) ∉ endpoints → ∃ i, x ∈ f i) :
    ∃ i, (W ∩ interior (f i)).Nonempty
Proof
:= by
  set P : Set cantorSet := (↑) ⁻¹' endpoints
  have : Countable P := (countable_endpoints.preimage Subtype.val_injective).to_subtype
  let g : ι ⊕ P ⊕ Unit → Set cantorSet
    | .inl i => f i
    | .inr (.inl e) => {e.val}
    | .inr (.inr _) => Wᶜ
  have hg : ∀ j, IsClosed (g j)
    | .inl i => hf i
    | .inr (.inl _) => isClosed_singleton
    | .inr (.inr _) => hW.isClosed_compl
  have hcov' : ⋃ j, g j = univ := by
    refine eq_univ_of_forall fun x ↦ mem_iUnion.2 ?_
    by_cases hxW : x ∈ W
    · by_cases hx : (x : ℝ) ∈ endpoints
      · exact ⟨.inr (.inl ⟨x, hx⟩), rfl⟩
      · obtain ⟨i, hi⟩ := hcov x hxW hx
        exact ⟨.inl i, hi⟩
    · exact ⟨.inr (.inr ()), hxW⟩
  obtain ⟨x, hxW, hx⟩ := (dense_iUnion_interior_of_closed hg hcov').inter_open_nonempty W hW hWne
  obtain ⟨j, hj⟩ := mem_iUnion.1 hx
  match j, hj with
  | .inl i, hj => exact ⟨i, x, hxW, hj⟩
  | .inr (.inl e), hj =>
    refine absurd ?_ (not_isOpen_singleton e.val)
    have hsub := interior_subset hj
    rw [mem_singleton_iff] at hsub
    subst hsub
    rw [← subset_interior_iff_isOpen, singleton_subset_iff]
    exact hj
  | .inr (.inr _), hj => exact absurd hxW (interior_subset hj)

theorem exists_mem_endpoints_of_isOpen

TopologyByExample.KnasterKuratowski.exists_mem_endpoints_of_isOpen

Every nonempty open set of the Cantor set contains an endpoint of a deleted interval.

theorem exists_mem_endpoints_of_isOpen {W : Set cantorSet} (hW : IsOpen W) (hWne : W.Nonempty) :
    ∃ x ∈ W, (x : ℝ) ∈ endpoints
Proof
:= by
  obtain ⟨x, hx⟩ := hWne
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 hW x hx
  obtain ⟨e, he, hlt⟩ := exists_mem_endpoints x.property hε
  refine ⟨⟨e, he.1⟩, hball ?_, he⟩
  rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq]
  exact hlt

theorem exists_not_mem_endpoints_of_isOpen

TopologyByExample.KnasterKuratowski.exists_not_mem_endpoints_of_isOpen

Every nonempty open set of the Cantor set contains a point that is not an endpoint of a deleted interval.

theorem exists_not_mem_endpoints_of_isOpen {W : Set cantorSet} (hW : IsOpen W)
    (hWne : W.Nonempty) : ∃ x ∈ W, (x : ℝ) ∉ endpoints
Proof
:= by
  by_contra! h
  obtain ⟨i, -⟩ := exists_inter_interior_nonempty (ι := Empty) (f := fun _ ↦ ∅)
    (fun _ ↦ isClosed_empty) hW hWne fun x hx hxe ↦ absurd (h x hx) hxe
  exact i.elim

theorem exists_not_mem_endpoints

TopologyByExample.KnasterKuratowski.exists_not_mem_endpoints

Every point of the Cantor set is a limit of points that are not endpoints of deleted intervals.

theorem exists_not_mem_endpoints {c : ℝ} (hc : c ∈ cantorSet) {ε : ℝ} (hε : 0 < ε) :
    ∃ f ∈ cantorSet, f ∉ endpoints ∧ |f - c| < ε
Proof
:= by
  obtain ⟨x, hx, hxe⟩ := exists_not_mem_endpoints_of_isOpen (Metric.isOpen_ball (ε := ε))
    ⟨⟨c, hc⟩, Metric.mem_ball_self hε⟩
  refine ⟨x, x.property, hxe, ?_⟩
  rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] at hx
  exact hx

theorem cantorSet_endpoints_structure

TopologyByExample.KnasterKuratowski.cantorSet_endpoints_structure

The endpoints of the deleted intervals. The Cantor set contains no interval with more than one point and has no isolated point; the endpoints of its deleted intervals are countably many, and both they and the other points of the Cantor set come arbitrarily close to every point of it.

theorem cantorSet_endpoints_structure :
    (∀ a b : ℝ, a < b → ¬Icc a b ⊆ cantorSet) ∧
    (∀ c ∈ cantorSet, ∀ ε > 0, ∃ c' ∈ cantorSet, c' ≠ c ∧ |c' - c| < ε) ∧
    endpoints.Countable ∧
    (∀ c ∈ cantorSet, ∀ ε > 0, ∃ e ∈ endpoints, |e - c| < ε) ∧
    (∀ c ∈ cantorSet, ∀ ε > 0, ∃ f ∈ cantorSet, f ∉ endpoints ∧ |f - c| < ε)
Proof
:=
  ⟨fun _ _ h ↦ not_Icc_subset_cantorSet h, fun _ hc _ hε ↦ exists_mem_cantorSet_ne hc hε,
    countable_endpoints, fun _ hc _ hε ↦ exists_mem_endpoints hc hε,
    fun _ hc _ hε ↦ exists_not_mem_endpoints hc hε⟩

On this site: Knaster–Kuratowski fan: The endpoints of the deleted intervals

The fan

definition apex

TopologyByExample.KnasterKuratowski.apex

The apex p = (1 / 2, 1 / 2) of the fan.

noncomputable def apex : ℝ × ℝ
:= (1 / 2, 1 / 2)

definition params

TopologyByExample.KnasterKuratowski.params

The parameters (c, y) of the points of the punctured fan: c is a point of the Cantor set, 0 ≤ y < 1 / 2 is a height, and y is rational exactly when c is an endpoint of a deleted interval.

def params : Set (ℝ × ℝ)
:=
  {q | q.1 ∈ cantorSet ∧ q.2 ∈ Ico (0 : ℝ) (1 / 2) ∧
    (q.1 ∈ endpoints ↔ q.2 ∈ range ((↑) : ℚ → ℝ))}

definition legPoint

TopologyByExample.KnasterKuratowski.legPoint

The point at height y of the segment from (c, 0) to the apex: (c (1 - 2y) + y, y).

def legPoint (q : ℝ × ℝ) : ℝ × ℝ
:= (q.1 * (1 - 2 * q.2) + q.2, q.2)

definition legParam

TopologyByExample.KnasterKuratowski.legParam

The inverse of legPoint off the line y = 1 / 2: the foot c = (x - y) / (1 - 2y) of the segment through (x, y) and the apex, and the height y.

noncomputable def legParam (z : ℝ × ℝ) : ℝ × ℝ
:= ((z.1 - z.2) / (1 - 2 * z.2), z.2)

definition puncturedFan

TopologyByExample.KnasterKuratowski.puncturedFan

The punctured Knaster–Kuratowski fan: over each endpoint c of a deleted interval, the points of the segment from (c, 0) to the apex at rational heights below 1 / 2; over each other point c of the Cantor set, those at irrational heights.

def puncturedFan : Set (ℝ × ℝ)
:= legPoint '' params

definition fan

TopologyByExample.KnasterKuratowski.fan

The Knaster–Kuratowski fan: the punctured fan together with the apex.

noncomputable def fan : Set (ℝ × ℝ)
:= insert apex puncturedFan

theorem continuous_legPoint

TopologyByExample.KnasterKuratowski.continuous_legPoint

legPoint is continuous.

theorem continuous_legPoint : Continuous legPoint
Proof
:= by
  unfold legPoint
  fun_prop

theorem one_sub_two_mul_ne_zero

TopologyByExample.KnasterKuratowski.one_sub_two_mul_ne_zero

Off the line y = 1 / 2, the denominator 1 - 2y of legParam is nonzero.

theorem one_sub_two_mul_ne_zero {y : ℝ} (hy : y ≠ 1 / 2) : 1 - 2 * y ≠ 0
Proof
:= by
  intro h
  exact hy (by linarith)

theorem continuousOn_legParam

TopologyByExample.KnasterKuratowski.continuousOn_legParam

legParam is continuous off the line y = 1 / 2.

theorem continuousOn_legParam : ContinuousOn legParam {z | z.2 ≠ 1 / 2}
Proof
:= by
  unfold legParam
  refine ContinuousOn.prodMk ?_ continuous_snd.continuousOn
  exact (continuous_fst.sub continuous_snd).continuousOn.div (by fun_prop)
    fun z hz ↦ one_sub_two_mul_ne_zero hz

theorem legPoint_snd

TopologyByExample.KnasterKuratowski.legPoint_snd

legPoint keeps the height.

@[simp]
theorem legPoint_snd (q : ℝ × ℝ) : (legPoint q).2 = q.2
Proof
:= rfl

theorem legParam_snd

TopologyByExample.KnasterKuratowski.legParam_snd

legParam keeps the height.

@[simp]
theorem legParam_snd (z : ℝ × ℝ) : (legParam z).2 = z.2
Proof
:= rfl

theorem legParam_legPoint

TopologyByExample.KnasterKuratowski.legParam_legPoint

legParam inverts legPoint off the line y = 1 / 2.

theorem legParam_legPoint {q : ℝ × ℝ} (h : q.2 ≠ 1 / 2) : legParam (legPoint q) = q
Proof
:= by
  have := one_sub_two_mul_ne_zero h
  ext
  · simp only [legParam, legPoint]
    rw [add_sub_cancel_right, mul_div_assoc, div_self this, mul_one]
  · rfl

theorem legPoint_legParam

TopologyByExample.KnasterKuratowski.legPoint_legParam

legPoint inverts legParam off the line y = 1 / 2.

theorem legPoint_legParam {z : ℝ × ℝ} (h : z.2 ≠ 1 / 2) : legPoint (legParam z) = z
Proof
:= by
  have := one_sub_two_mul_ne_zero h
  ext
  · simp only [legParam, legPoint]
    rw [div_mul_cancel₀ _ this, sub_add_cancel]
  · rfl

theorem snd_lt_of_mem_params

TopologyByExample.KnasterKuratowski.snd_lt_of_mem_params

Parameters have height below 1 / 2.

theorem snd_lt_of_mem_params {q : ℝ × ℝ} (hq : q ∈ params) : q.2 < 1 / 2
Proof
:= hq.2.1.2

theorem snd_ne_of_mem_params

TopologyByExample.KnasterKuratowski.snd_ne_of_mem_params

Parameters are off the line y = 1 / 2.

theorem snd_ne_of_mem_params {q : ℝ × ℝ} (hq : q ∈ params) : q.2 ≠ 1 / 2
Proof
:=
  (snd_lt_of_mem_params hq).ne

theorem legPoint_injOn

TopologyByExample.KnasterKuratowski.legPoint_injOn

Distinct parameters give distinct points.

theorem legPoint_injOn : InjOn legPoint params
Proof
:= fun q hq q' hq' h ↦
  calc q = legParam (legPoint q) :=
        (legParam_legPoint (q := q) (snd_ne_of_mem_params hq)).symm
    _ = legParam (legPoint q') := by rw [h]
    _ = q' := legParam_legPoint (q := q') (snd_ne_of_mem_params hq')

theorem mem_puncturedFan_iff

TopologyByExample.KnasterKuratowski.mem_puncturedFan_iff

A point lies on the punctured fan exactly when it is off the line y = 1 / 2 and its parameters lie in params.

theorem mem_puncturedFan_iff {z : ℝ × ℝ} :
    z ∈ puncturedFan ↔ z.2 ≠ 1 / 2 ∧ legParam z ∈ params
Proof
:= by
  constructor
  · rintro ⟨q, hq, rfl⟩
    have h := snd_ne_of_mem_params hq
    refine ⟨h, ?_⟩
    rw [legParam_legPoint h]
    exact hq
  · rintro ⟨h, hz⟩
    exact ⟨_, hz, legPoint_legParam h⟩

theorem apex_not_mem_puncturedFan

TopologyByExample.KnasterKuratowski.apex_not_mem_puncturedFan

The apex is not a point of the punctured fan.

theorem apex_not_mem_puncturedFan : apex ∉ puncturedFan
Proof
:= fun h ↦
  (mem_puncturedFan_iff.1 h).1 (by simp [apex])

theorem exists_height_gt

TopologyByExample.KnasterKuratowski.exists_height_gt

Above any height y < 1 / 2 and within ε of it there are rational (if r) or irrational (if ¬r) heights below 1 / 2.

theorem exists_height_gt (r : Prop) {y : ℝ} (hy : y < 1 / 2) {ε : ℝ} (hε : 0 < ε) :
    ∃ y', (y' ∈ range ((↑) : ℚ → ℝ) ↔ r) ∧ y < y' ∧ y' < 1 / 2 ∧ y' - y < ε
Proof
:= by
  classical
  have hlt : y < min (y + ε) (1 / 2) := lt_min (by linarith) hy
  have hy' : ∃ y', (y' ∈ range ((↑) : ℚ → ℝ) ↔ r) ∧ y < y' ∧ y' < min (y + ε) (1 / 2) := by
    by_cases hr : r
    · obtain ⟨q, h1, h2⟩ := exists_rat_btwn hlt
      exact ⟨q, iff_of_true ⟨q, rfl⟩ hr, h1, h2⟩
    · obtain ⟨y', hirr, h1, h2⟩ := exists_irrational_btwn hlt
      exact ⟨y', iff_of_false hirr hr, h1, h2⟩
  obtain ⟨y', hr, h1, h2⟩ := hy'
  exact ⟨y', hr, h1, h2.trans_le (min_le_right _ _), by linarith [min_le_left (y + ε) (1 / 2)]⟩

theorem exists_near

TopologyByExample.KnasterKuratowski.exists_near

Near any point (c, y) with c in the Cantor set and 0 ≤ y ≤ 1 / 2 there are points (c', y') with c' an endpoint (if b) or not an endpoint (if ¬b) of a deleted interval and y' rational (if r) or irrational (if ¬r), with 0 < y' < 1 / 2.

theorem exists_near {c y : ℝ} (hc : c ∈ cantorSet) (hy : y ∈ Icc (0 : ℝ) (1 / 2)) (b r : Prop)
    {ε : ℝ} (hε : 0 < ε) :
    ∃ c' y', c' ∈ cantorSet ∧ (c' ∈ endpoints ↔ b) ∧ (y' ∈ range ((↑) : ℚ → ℝ) ↔ r) ∧
      y' ∈ Ioo (0 : ℝ) (1 / 2) ∧ |c' - c| < ε ∧ |y' - y| < ε
Proof
:= by
  classical
  obtain ⟨y', hr, h1, h2, h3⟩ := exists_height_gt r
    (y := max (y - ε / 2) 0) (max_lt (by linarith [hy.2]) (by norm_num)) (half_pos hε)
  have hc' : ∃ c', c' ∈ cantorSet ∧ (c' ∈ endpoints ↔ b) ∧ |c' - c| < ε := by
    by_cases hb : b
    · obtain ⟨e, he, hlt⟩ := exists_mem_endpoints hc hε
      exact ⟨e, he.1, iff_of_true he hb, hlt⟩
    · obtain ⟨f, hf, hfe, hlt⟩ := exists_not_mem_endpoints hc hε
      exact ⟨f, hf, iff_of_false hfe hb, hlt⟩
  obtain ⟨c', hc', hb, hcc⟩ := hc'
  refine ⟨c', y', hc', hb, hr, ⟨(le_max_right _ _).trans_lt h1, h2⟩, hcc, abs_lt.2 ⟨?_, ?_⟩⟩
  · linarith [le_max_left (y - ε / 2) 0]
  · rcases le_total (y - ε / 2) 0 with h | h
    · rw [max_eq_right h] at h3
      linarith [hy.1]
    · rw [max_eq_left h] at h3
      linarith

theorem subset_closure_params

TopologyByExample.KnasterKuratowski.subset_closure_params

The parameters are dense in C × [0, 1 / 2).

theorem subset_closure_params : cantorSet ×ˢ Ico (0 : ℝ) (1 / 2) ⊆ closure params
Proof
:= by
  rintro ⟨c, y⟩ ⟨hc, hy⟩
  refine Metric.mem_closure_iff.2 fun ε hε ↦ ?_
  obtain ⟨c', y', hc', hb, hr, hy', hcc, hyy⟩ :=
    exists_near hc (Ico_subset_Icc_self hy) True True hε
  refine ⟨(c', y'), ⟨hc', Ioo_subset_Ico_self hy', by simp_all⟩, ?_⟩
  rw [Prod.dist_eq, Real.dist_eq, Real.dist_eq, abs_sub_comm c, abs_sub_comm y]
  exact max_lt hcc hyy

definition KnasterKuratowskiFan

TopologyByExample.KnasterKuratowskiFan

The Knaster–Kuratowski fan, as a subspace of the plane.

abbrev KnasterKuratowskiFan : Type
:= KnasterKuratowski.fan

On this site: Space: Knaster–Kuratowski fan

definition PuncturedKnasterKuratowskiFan

TopologyByExample.PuncturedKnasterKuratowskiFan

The punctured Knaster–Kuratowski fan (the fan without its apex), as a subspace of the plane.

abbrev PuncturedKnasterKuratowskiFan : Type
:= KnasterKuratowski.puncturedFan

On this site: Space: Punctured Knaster–Kuratowski fan

definition paramsHomeomorph

TopologyByExample.KnasterKuratowski.paramsHomeomorph

The punctured fan is homeomorphic to its set of parameters: (x, y) ↦ legParam (x, y).

noncomputable def paramsHomeomorph : PuncturedKnasterKuratowskiFan ≃ₜ params
Definition
where
  toFun z := ⟨legParam z, (mem_puncturedFan_iff.1 z.property).2⟩
  invFun q := ⟨legPoint q, mem_image_of_mem _ q.property⟩
  left_inv z := Subtype.ext (legPoint_legParam (mem_puncturedFan_iff.1 z.property).1)
  right_inv q := Subtype.ext (legParam_legPoint (snd_ne_of_mem_params q.property))
  continuous_toFun := (continuousOn_legParam.comp_continuous continuous_subtypeVal
    fun z ↦ (mem_puncturedFan_iff.1 z.property).1).subtype_mk _
  continuous_invFun := (continuous_legPoint.comp continuous_subtypeVal).subtype_mk _

The Knaster–Kuratowski lemma

theorem mem_of_isClopen

TopologyByExample.KnasterKuratowski.mem_of_isClopen

The Knaster–Kuratowski lemma. A clopen set of parameters that contains a parameter (c, y) contains every parameter (c, y') over the same point c of the Cantor set.

Write A' and B' for the clopen set and its complement, and Z = cl A' ∩ cl B' (closures in the plane). No parameter lies in Z, but every point of C × [0, 1 / 2) lies in cl A' ∪ cl B', since the parameters are dense there. If (c, y₁) ∈ A' and (c, y₂) ∈ B', then for every c' of the Cantor set near c the segment from (c', y₁) to (c', y₂) meets both closures, so it meets Z, at a rational height r when c' is not an endpoint. By Baire category in the Cantor set some closed set {c' : (c', r) ∈ Z} has interior near c, and that interior contains an endpoint e; but then (e, r) is a parameter in Z.

theorem mem_of_isClopen {A : Set params} (hA : IsClopen A) {a b : params}
    (hab : a.val.1 = b.val.1) (ha : a ∈ A) : b ∈ A
Proof
:= by
  by_contra hb
  obtain ⟨U, hU, hUA⟩ := isOpen_induced_iff.1 hA.isOpen
  obtain ⟨V, hV, hVA⟩ := isOpen_induced_iff.1 hA.compl.isOpen
  set A' : Set (ℝ × ℝ) := (↑) '' A
  set B' : Set (ℝ × ℝ) := (↑) '' Aᶜ
  have hUsub : U ∩ params ⊆ A' := fun z ⟨hzU, hz⟩ ↦
    ⟨⟨z, hz⟩, by rw [← hUA]; exact hzU, rfl⟩
  have hVsub : V ∩ params ⊆ B' := fun z ⟨hzV, hz⟩ ↦
    ⟨⟨z, hz⟩, by rw [← hVA]; exact hzV, rfl⟩
  have hUB : ∀ z ∈ U, z ∉ closure B' := fun z hzU hz ↦ by
    obtain ⟨w, hwU, ⟨t, ht, rfl⟩⟩ := mem_closure_iff.1 hz U hU hzU
    exact ht (by rw [← hUA]; exact hwU)
  have hVA' : ∀ z ∈ V, z ∉ closure A' := fun z hzV hz ↦ by
    obtain ⟨w, hwV, ⟨t, ht, rfl⟩⟩ := mem_closure_iff.1 hz V hV hzV
    exact (by rw [← hVA]; exact hwV : t ∈ Aᶜ) ht
  have hS : ∀ z ∈ params, z ∈ closure A' → z ∈ closure B' → False := fun z hz hzA hzB ↦ by
    by_cases h : (⟨z, hz⟩ : params) ∈ A
    · exact hUB z (by rw [← hUA] at h; exact h) hzB
    · have h' : (⟨z, hz⟩ : params) ∈ Aᶜ := h
      rw [← hVA] at h'
      exact hVA' z h' hzA
  have hTU : ∀ z ∈ cantorSet ×ˢ Ico (0 : ℝ) (1 / 2), z ∈ U → z ∈ closure A' := fun z hz hzU ↦
    closure_mono hUsub (hU.inter_closure ⟨hzU, subset_closure_params hz⟩)
  have hTV : ∀ z ∈ cantorSet ×ˢ Ico (0 : ℝ) (1 / 2), z ∈ V → z ∈ closure B' := fun z hz hzV ↦
    closure_mono hVsub (hV.inter_closure ⟨hzV, subset_closure_params hz⟩)
  have hAB : A' ∪ B' = params := by
    rw [← image_union, union_compl_self, image_univ, Subtype.range_coe]
  have hT : ∀ z ∈ cantorSet ×ˢ Ico (0 : ℝ) (1 / 2), z ∈ closure A' ∪ closure B' := fun z hz ↦ by
    rw [← closure_union, hAB]
    exact subset_closure_params hz
  have haU : a.val ∈ U := by rw [← hUA] at ha; exact ha
  have hbV : b.val ∈ V := by
    have hb' : b ∈ Aᶜ := hb
    rw [← hVA] at hb'
    exact hb'
  obtain ⟨ε₁, hε₁, h₁⟩ := Metric.isOpen_iff.1 hU _ haU
  obtain ⟨ε₂, hε₂, h₂⟩ := Metric.isOpen_iff.1 hV _ hbV
  set c := a.val.1
  set y₁ := a.val.2
  set y₂ := b.val.2
  have hy₁ : y₁ ∈ Ico (0 : ℝ) (1 / 2) := a.property.2.1
  have hy₂ : y₂ ∈ Ico (0 : ℝ) (1 / 2) := b.property.2.1
  have hseg : uIcc y₁ y₂ ⊆ Ico (0 : ℝ) (1 / 2) := ordConnected_Ico.uIcc_subset hy₁ hy₂
  -- Near `c`, every segment from height `y₁` to height `y₂` meets `Z`.
  have key : ∀ c' ∈ cantorSet, |c' - c| < min ε₁ ε₂ →
      ∃ y ∈ uIcc y₁ y₂, (c', y) ∈ closure A' ∧ (c', y) ∈ closure B' := by
    intro c' hc' hcc
    have hA1 : (c', y₁) ∈ closure A' := by
      refine hTU _ ⟨hc', hy₁⟩ (h₁ ?_)
      rw [Metric.mem_ball, Prod.dist_eq, Real.dist_eq, Real.dist_eq, sub_self, abs_zero,
        max_eq_left (abs_nonneg _)]
      exact hcc.trans_le (min_le_left _ _)
    have hB2 : (c', y₂) ∈ closure B' := by
      refine hTV _ ⟨hc', hy₂⟩ (h₂ ?_)
      rw [Metric.mem_ball, Prod.dist_eq, Real.dist_eq, Real.dist_eq, sub_self, abs_zero,
        max_eq_left (abs_nonneg _), ← hab]
      exact hcc.trans_le (min_le_right _ _)
    have hpre : IsPreconnected ((fun y ↦ (c', y)) '' uIcc y₁ y₂) :=
      isPreconnected_uIcc.image _ (by fun_prop)
    obtain ⟨_, ⟨y, hy, rfl⟩, hz⟩ := isPreconnected_closed_iff.1 hpre _ _ isClosed_closure
      isClosed_closure (fun _ ⟨y, hy, hz⟩ ↦ hz ▸ hT _ ⟨hc', hseg hy⟩)
      ⟨_, ⟨y₁, left_mem_uIcc, rfl⟩, hA1⟩ ⟨_, ⟨y₂, right_mem_uIcc, rfl⟩, hB2⟩
    exact ⟨y, hy, hz⟩
  -- Baire category in the Cantor set.
  let Z : ℚ → Set cantorSet := fun r ↦ (fun x : cantorSet ↦ ((x : ℝ), (r : ℝ))) ⁻¹'
    (closure A' ∩ closure B' ∩ (univ ×ˢ uIcc y₁ y₂))
  have hZ : ∀ r, IsClosed (Z r) := fun r ↦
    ((isClosed_closure.inter isClosed_closure).inter (isClosed_univ.prod isClosed_uIcc)).preimage
      (by fun_prop)
  let W : Set cantorSet := (↑) ⁻¹' Metric.ball c (min ε₁ ε₂)
  have hW : IsOpen W := Metric.isOpen_ball.preimage continuous_subtypeVal
  have hcW : (⟨c, a.property.1⟩ : cantorSet) ∈ W := Metric.mem_ball_self (lt_min hε₁ hε₂)
  have hcov : ∀ x ∈ W, (x : ℝ) ∉ endpoints → ∃ r, x ∈ Z r := by
    intro x hx hxe
    have hx' : dist (x : ℝ) c < min ε₁ ε₂ := hx
    obtain ⟨y, hy, hA, hB⟩ := key x x.property (by rwa [Real.dist_eq] at hx')
    have hrat : y ∈ range ((↑) : ℚ → ℝ) := by
      by_contra hy'
      exact hS ((x : ℝ), y) ⟨x.property, hseg hy, iff_of_false hxe hy'⟩ hA hB
    obtain ⟨r, rfl⟩ := hrat
    exact ⟨r, ⟨hA, hB⟩, mem_univ _, hy⟩
  obtain ⟨r, hr⟩ := exists_inter_interior_nonempty hZ hW ⟨_, hcW⟩ hcov
  obtain ⟨x, ⟨-, hxZ⟩, hxe⟩ := exists_mem_endpoints_of_isOpen (hW.inter isOpen_interior) hr
  obtain ⟨⟨hA, hB⟩, -, hy⟩ := interior_subset hxZ
  exact hS _ ⟨x.property, hseg hy, iff_of_true hxe ⟨r, rfl⟩⟩ hA hB

Points of the fan

definition someEndpoint

TopologyByExample.KnasterKuratowski.someEndpoint

An endpoint of a deleted interval, fixed once and for all.

noncomputable def someEndpoint : ℝ
:= (exists_mem_endpoints zero_mem_cantorSet one_pos).choose

theorem someEndpoint_mem

TopologyByExample.KnasterKuratowski.someEndpoint_mem

someEndpoint is an endpoint of a deleted interval.

theorem someEndpoint_mem : someEndpoint ∈ endpoints
Proof
:=
  (exists_mem_endpoints zero_mem_cantorSet one_pos).choose_spec.1

definition baseParam

TopologyByExample.KnasterKuratowski.baseParam

The parameter (e, 0) at the foot of the segment over the endpoint someEndpoint.

noncomputable def baseParam : params
:=
  ⟨(someEndpoint, 0), someEndpoint_mem.1, ⟨le_rfl, by norm_num⟩,
    iff_of_true someEndpoint_mem ⟨0, by simp⟩⟩

instance

There are parameters.

instance : Nonempty params
Proof
:= ⟨baseParam⟩

theorem dist_legPoint_apex_le

TopologyByExample.KnasterKuratowski.dist_legPoint_apex_le

The point at height y over c ∈ [0, 1] is within 1 / 2 - y of the apex.

theorem dist_legPoint_apex_le {c y : ℝ} (hc : c ∈ Icc (0 : ℝ) 1) (hy : y ≤ 1 / 2) :
    dist (legPoint (c, y)) apex ≤ 1 / 2 - y
Proof
:= by
  rw [Prod.dist_eq, Real.dist_eq, Real.dist_eq]
  simp only [legPoint, apex]
  refine max_le ?_ ?_
  · have h : c * (1 - 2 * y) + y - 1 / 2 = (c - 1 / 2) * (1 - 2 * y) := by ring
    have hc' : |c - 1 / 2| ≤ 1 / 2 := abs_le.2 ⟨by linarith [hc.1], by linarith [hc.2]⟩
    rw [h, abs_mul, abs_of_nonneg (by linarith : (0 : ℝ) ≤ 1 - 2 * y)]
    nlinarith [abs_nonneg (c - 1 / 2)]
  · rw [abs_of_nonpos (by linarith)]
    linarith

theorem exists_mem_params_gt

TopologyByExample.KnasterKuratowski.exists_mem_params_gt

Above every parameter (c, y) there are parameters (c, y') with y < y' arbitrarily close to y.

theorem exists_mem_params_gt {q : ℝ × ℝ} (hq : q ∈ params) {ε : ℝ} (hε : 0 < ε) :
    ∃ y', (q.1, y') ∈ params ∧ q.2 < y' ∧ y' - q.2 < ε
Proof
:= by
  obtain ⟨y', hr, h1, h2, h3⟩ := exists_height_gt (q.1 ∈ endpoints) (snd_lt_of_mem_params hq) hε
  exact ⟨y', ⟨hq.1, ⟨hq.2.1.1.trans h1.le, h2⟩, hr.symm⟩, h1, h3⟩

theorem not_isOpen_singleton_params

TopologyByExample.KnasterKuratowski.not_isOpen_singleton_params

No parameter is isolated.

theorem not_isOpen_singleton_params (q : params) : ¬IsOpen ({q} : Set params)
Proof
:= by
  intro h
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 h q rfl
  obtain ⟨y', hy', h1, h2⟩ := exists_mem_params_gt q.property hε
  have hmem : (⟨(q.val.1, y'), hy'⟩ : params) ∈ Metric.ball q ε := by
    rw [Metric.mem_ball, Subtype.dist_eq, Prod.dist_eq, Real.dist_eq, Real.dist_eq, sub_self,
      abs_zero, max_eq_right (abs_nonneg _), abs_of_pos (by linarith)]
    exact h2
  have heq := congrArg (fun z : params ↦ z.val.2) (mem_singleton_iff.1 (hball hmem))
  exact h1.ne' heq

theorem not_discreteTopology_params

TopologyByExample.KnasterKuratowski.not_discreteTopology_params

The set of parameters is not discrete.

theorem not_discreteTopology_params : ¬DiscreteTopology params
Proof
:= fun _ ↦
  not_isOpen_singleton_params baseParam (isOpen_discrete _)

definition apexPt

TopologyByExample.KnasterKuratowski.apexPt

The apex, as a point of the fan.

noncomputable def apexPt : KnasterKuratowskiFan
:= ⟨apex, mem_insert _ _⟩

definition toFan

TopologyByExample.KnasterKuratowski.toFan

The point of the fan with given parameters.

def toFan (q : params) : KnasterKuratowskiFan
:=
  ⟨legPoint q, mem_insert_of_mem _ (mem_image_of_mem _ q.property)⟩

theorem continuous_toFan

TopologyByExample.KnasterKuratowski.continuous_toFan

toFan is continuous.

theorem continuous_toFan : Continuous toFan
Proof
:=
  (continuous_legPoint.comp continuous_subtypeVal).subtype_mk _

theorem isEmbedding_toFan

TopologyByExample.KnasterKuratowski.isEmbedding_toFan

toFan is an embedding: the punctured fan is a subspace of the fan.

theorem isEmbedding_toFan : IsEmbedding toFan
Proof
:= by
  have h : IsEmbedding (((↑) : PuncturedKnasterKuratowskiFan → ℝ × ℝ) ∘ paramsHomeomorph.symm) :=
    IsEmbedding.subtypeVal.comp paramsHomeomorph.symm.isEmbedding
  exact (IsEmbedding.subtypeVal.of_comp_iff (f := toFan)).1 h

theorem range_toFan

TopologyByExample.KnasterKuratowski.range_toFan

The points of the fan with parameters are those other than the apex.

theorem range_toFan : range toFan = {apexPt}ᶜ
Proof
:= by
  ext z
  constructor
  · rintro ⟨q, rfl⟩ h
    have h' : legPoint q.val = apex := congrArg Subtype.val h
    exact apex_not_mem_puncturedFan (h' ▸ mem_image_of_mem _ q.property)
  · intro hz
    rcases z.property with h | ⟨q, hq, h⟩
    · exact absurd (Subtype.ext h) hz
    · exact ⟨⟨q, hq⟩, Subtype.ext h⟩

theorem isOpen_range_toFan

TopologyByExample.KnasterKuratowski.isOpen_range_toFan

The fan without its apex is open in the fan.

theorem isOpen_range_toFan : IsOpen (range toFan)
Proof
:= by
  rw [range_toFan]
  exact isClosed_singleton.isOpen_compl

theorem exists_toFan_near_apex

TopologyByExample.KnasterKuratowski.exists_toFan_near_apex

Every parameter (c, y) has parameters (c, y') over the same point whose points are arbitrarily close to the apex.

theorem exists_toFan_near_apex (q : params) {ε : ℝ} (hε : 0 < ε) :
    ∃ q' : params, q'.val.1 = q.val.1 ∧ dist (toFan q') apexPt < ε
Proof
:= by
  have hy₀ : max q.val.2 (1 / 2 - ε / 2) < 1 / 2 :=
    max_lt (snd_lt_of_mem_params q.property) (by linarith)
  obtain ⟨y', hr, h1, h2, -⟩ := exists_height_gt (q.val.1 ∈ endpoints) hy₀ one_pos
  refine ⟨⟨(q.val.1, y'), q.property.1,
    ⟨q.property.2.1.1.trans ((le_max_left _ _).trans h1.le), h2⟩, hr.symm⟩, rfl, ?_⟩
  rw [Subtype.dist_eq]
  calc dist (legPoint (q.val.1, y')) apex ≤ 1 / 2 - y' :=
        dist_legPoint_apex_le (cantorSet_subset_unitInterval q.property.1) h2.le
    _ < ε := by linarith [le_max_right q.val.2 (1 / 2 - ε / 2)]

theorem denseRange_toFan

TopologyByExample.KnasterKuratowski.denseRange_toFan

The fan without its apex is dense in the fan.

theorem denseRange_toFan : DenseRange toFan
Proof
:= by
  refine Metric.denseRange_iff.2 fun z ε hε ↦ ?_
  by_cases hz : z = apexPt
  · obtain ⟨q, -, hq⟩ := exists_toFan_near_apex baseParam hε
    exact ⟨q, by rw [hz, dist_comm]; exact hq⟩
  · obtain ⟨q, rfl⟩ : z ∈ range toFan := by rw [range_toFan]; exact hz
    exact ⟨q, by rw [dist_self]; exact hε⟩

Connectedness

theorem eq_univ_of_isClopen

TopologyByExample.KnasterKuratowski.eq_univ_of_isClopen

A clopen set of the fan containing the apex is the whole fan.

theorem eq_univ_of_isClopen {s : Set KnasterKuratowskiFan} (hs : IsClopen s) (h : apexPt ∈ s) :
    s = univ
Proof
:= by
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 hs.isOpen apexPt h
  have hA : IsClopen (toFan ⁻¹' s) := hs.preimage continuous_toFan
  have hall : ∀ q, toFan q ∈ s := fun q ↦ by
    obtain ⟨q', hq', hd⟩ := exists_toFan_near_apex q hε
    exact mem_of_isClopen hA hq' (hball hd)
  refine eq_univ_of_forall fun z ↦ ?_
  by_cases hz : z = apexPt
  · exact hz ▸ h
  · obtain ⟨q, rfl⟩ : z ∈ range toFan := by rw [range_toFan]; exact hz
    exact hall q

Total disconnectedness

instance

The set of parameters is totally disconnected.

instance : TotallyDisconnectedSpace params
Proof
:= by
  refine ⟨fun t _ ht x hx y hy ↦ ?_⟩
  let f : params → cantorSet := fun q ↦ ⟨q.val.1, q.property.1⟩
  have hf : Continuous f := (continuous_fst.comp continuous_subtypeVal).subtype_mk _
  have hsub := isTotallyDisconnected_of_totallyDisconnectedSpace _ _ subset_rfl
    (ht.image f hf.continuousOn)
  have hc : ∀ z ∈ t, z.val.1 = x.val.1 := fun z hz ↦
    congrArg Subtype.val (hsub (mem_image_of_mem f hz) (mem_image_of_mem f hx))
  have hh : IsPreconnected ((fun z : params ↦ z.val.2) '' t) :=
    ht.image _ (continuous_snd.comp continuous_subtypeVal).continuousOn
  have key : ∀ u ∈ t, ∀ v ∈ t, ¬u.val.2 < v.val.2 := by
    intro u hu v hv hlt
    have hI := hh.Icc_subset (mem_image_of_mem _ hu) (mem_image_of_mem _ hv)
    obtain ⟨q, hq1, hq2⟩ := exists_rat_btwn hlt
    obtain ⟨w, hw, hw1, hw2⟩ := exists_irrational_btwn hlt
    obtain ⟨z₁, hz₁, hz₁e⟩ := hI ⟨hq1.le, hq2.le⟩
    obtain ⟨z₂, hz₂, hz₂e⟩ := hI ⟨hw1.le, hw2.le⟩
    have h₁ := z₁.property.2.2
    have h₂ := z₂.property.2.2
    have e₁ : z₁.val.2 = q := hz₁e
    have e₂ : z₂.val.2 = w := hz₂e
    rw [hc z₁ hz₁, e₁] at h₁
    rw [hc z₂ hz₂, e₂] at h₂
    exact hw (h₂.1 (h₁.2 ⟨q, rfl⟩))
  exact Subtype.ext (Prod.ext (hc y hy).symm
    (le_antisymm (not_lt.1 (key y hy x hx)) (not_lt.1 (key x hx y hy))))

theorem isTotallyDisconnected_compl_apexPt

TopologyByExample.KnasterKuratowski.isTotallyDisconnected_compl_apexPt

Removing the apex leaves a totally disconnected set.

theorem isTotallyDisconnected_compl_apexPt :
    IsTotallyDisconnected ({apexPt}ᶜ : Set KnasterKuratowskiFan)
Proof
:= by
  rw [← range_toFan, isEmbedding_toFan.isTotallyDisconnected_range]
  infer_instance

theorem not_totallySeparatedSpace_params

TopologyByExample.KnasterKuratowski.not_totallySeparatedSpace_params

The set of parameters is not totally separated: no clopen set separates (e, 0) from (e, 1 / 4).

theorem not_totallySeparatedSpace_params : ¬TotallySeparatedSpace params
Proof
:= by
  intro h
  have he := someEndpoint_mem
  let b : params := ⟨(someEndpoint, 1 / 4), he.1, ⟨by norm_num, by norm_num⟩,
    iff_of_true he ⟨1 / 4, by norm_num⟩⟩
  have hne : baseParam ≠ b := fun hab ↦ by
    have := congrArg (fun z : params ↦ z.val.2) hab
    norm_num [baseParam, b] at this
  obtain ⟨U, hU, ha, hb⟩ := totallySeparatedSpace_iff_exists_isClopen.1 h hne
  exact hb (mem_of_isClopen hU (a := baseParam) rfl ha)

Paths

theorem isPreconnected_ball_unitInterval

TopologyByExample.KnasterKuratowski.isPreconnected_ball_unitInterval

A ball of the unit interval is preconnected.

theorem isPreconnected_ball_unitInterval (t : unitInterval) (ε : ℝ) :
    IsPreconnected (Metric.ball t ε)
Proof
:= by
  have h : ((↑) : unitInterval → ℝ) '' Metric.ball t ε = Icc 0 1 ∩ Metric.ball (t : ℝ) ε := by
    ext x
    constructor
    · rintro ⟨s, hs, rfl⟩
      exact ⟨s.property, hs⟩
    · rintro ⟨hx, hx'⟩
      exact ⟨⟨x, hx⟩, hx', rfl⟩
  rw [← IsInducing.subtypeVal.isPreconnected_image, h, Real.ball_eq_Ioo]
  exact (ordConnected_Icc.inter ordConnected_Ioo).isPreconnected

theorem totallyPathDisconnectedSpace_of_isTotallyDisconnected_compl

TopologyByExample.totallyPathDisconnectedSpace_of_isTotallyDisconnected_compl

A T₁ space that becomes totally disconnected when one point is removed is totally path disconnected: along a path, the set of times at which it is at a point other than the removed one is open (near such a time the path stays in the totally disconnected part) and closed.

theorem totallyPathDisconnectedSpace_of_isTotallyDisconnected_compl {X : Type*}
    [TopologicalSpace X] [T1Space X] (p : X) (h : IsTotallyDisconnected ({p}ᶜ : Set X)) :
    TotallyPathDisconnectedSpace X
Proof
:= by
  have claim : ∀ {x y : X} (γ : Path x y) (t₀ : unitInterval), γ t₀ ≠ p → ∀ t, γ t = γ t₀ := by
    intro x y γ t₀ ht₀
    set S := γ ⁻¹' {γ t₀}
    have hSc : IsClosed S := isClosed_singleton.preimage γ.continuous
    have hSo : IsOpen S := by
      refine Metric.isOpen_iff.2 fun t ht ↦ ?_
      have ht' : γ t = γ t₀ := ht
      have hO : IsOpen (γ ⁻¹' {p}ᶜ) := isClosed_singleton.isOpen_compl.preimage γ.continuous
      obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 hO t (by rw [mem_preimage, ht']; exact ht₀)
      refine ⟨ε, hε, fun s hs ↦ ?_⟩
      have hsub := h (γ '' Metric.ball t ε) (image_subset_iff.2 hball)
        ((KnasterKuratowski.isPreconnected_ball_unitInterval t ε).image _
          γ.continuous.continuousOn)
      exact (hsub (mem_image_of_mem _ hs) (mem_image_of_mem _ (Metric.mem_ball_self hε))).trans ht'
    have hS := (isClopen_iff.1 ⟨hSc, hSo⟩).resolve_left (Nonempty.ne_empty ⟨t₀, rfl⟩)
    exact fun t ↦ (hS ▸ mem_univ t : t ∈ S)
  refine ⟨fun x y ⟨γ⟩ ↦ ?_⟩
  by_cases hx : x = p
  · by_cases hy : y = p
    · rw [hx, hy]
    · have := claim γ 1 (by simpa using hy) 0
      simpa using this
  · have := claim γ 0 (by simpa using hx) 1
    simpa using this.symm

On this site: Theorem: A T₁ space that is totally disconnected after removing one point is totally path disconnected

Baire category

definition generic

TopologyByExample.KnasterKuratowski.generic

The generic parameters: (c, y) with c in the Cantor set but not an endpoint and y an irrational in (0, 1 / 2).

def generic : Set (ℝ × ℝ)
:=
  {q | q.1 ∈ cantorSet ∧ q.1 ∉ endpoints ∧ Irrational q.2 ∧ q.2 ∈ Ioo (0 : ℝ) (1 / 2)}

definition missing

TopologyByExample.KnasterKuratowski.missing

The missing points (c, y) with c in the Cantor set but not an endpoint and y a rational in (0, 1 / 2): none of them is a parameter.

def missing : Set (ℝ × ℝ)
:=
  {q | q.1 ∈ cantorSet ∧ q.1 ∉ endpoints ∧ q.2 ∈ range ((↑) : ℚ → ℝ) ∧
    q.2 ∈ Ioo (0 : ℝ) (1 / 2)}

theorem generic_subset_params

TopologyByExample.KnasterKuratowski.generic_subset_params

Generic parameters are parameters.

theorem generic_subset_params : generic ⊆ params
Proof
:= by
  rintro q ⟨h1, h2, h3, h4⟩
  exact ⟨h1, Ioo_subset_Ico_self h4, iff_of_false h2 h3⟩

theorem disjoint_params_missing

TopologyByExample.KnasterKuratowski.disjoint_params_missing

No missing point is a parameter.

theorem disjoint_params_missing : Disjoint params missing
Proof
:= by
  refine disjoint_left.2 ?_
  rintro q ⟨-, -, h⟩ ⟨-, h2, h3, -⟩
  exact h2 (h.2 h3)

theorem isGδ_generic

TopologyByExample.KnasterKuratowski.isGδ_generic

The generic parameters form a G_δ set of the plane.

theorem isGδ_generic : IsGδ generic
Proof
:= by
  have h : generic = Prod.fst ⁻¹' (cantorSet ∩ endpointsᶜ) ∩
      Prod.snd ⁻¹' ({y | Irrational y} ∩ Ioo 0 (1 / 2)) := by
    ext q
    simp [generic, and_assoc]
  rw [h]
  exact ((isClosed_cantorSet.isGδ.inter countable_endpoints.isGδ_compl).preimage
    continuous_fst).inter ((IsGδ.setOfPred_irrational.inter isOpen_Ioo.isGδ).preimage
    continuous_snd)

theorem exists_near_mem

TopologyByExample.KnasterKuratowski.exists_near_mem

Near every point of C × [0, 1 / 2] there are generic parameters and missing points.

theorem exists_near_mem {k : ℝ × ℝ} (hk : k ∈ cantorSet ×ˢ Icc (0 : ℝ) (1 / 2)) (b r : Prop)
    {ε : ℝ} (hε : 0 < ε) :
    ∃ g : ℝ × ℝ, g.1 ∈ cantorSet ∧ (g.1 ∈ endpoints ↔ b) ∧ (g.2 ∈ range ((↑) : ℚ → ℝ) ↔ r) ∧
      g.2 ∈ Ioo (0 : ℝ) (1 / 2) ∧ dist g k < ε
Proof
:= by
  obtain ⟨c', y', hc', hb, hr, hy', hcc, hyy⟩ := exists_near hk.1 hk.2 b r hε
  refine ⟨(c', y'), hc', hb, hr, hy', ?_⟩
  rw [Prod.dist_eq, Real.dist_eq, Real.dist_eq]
  exact max_lt hcc hyy

instance

The set of parameters is a Baire space: the generic parameters form a dense subspace, a G_δ of the plane and so completely metrizable.

instance : BaireSpace params
Proof
:= by
  have : PolishSpace generic := isGδ_generic.polishSpace
  refine baireSpace_of_isInducing_of_denseRange
    (IsEmbedding.inclusion generic_subset_params).isInducing ?_
  refine Metric.denseRange_iff.2 fun x ε hε ↦ ?_
  obtain ⟨g, h1, h2, h3, h4, h5⟩ := exists_near_mem
    ⟨x.property.1, Ico_subset_Icc_self x.property.2.1⟩ False False hε
  refine ⟨⟨g, h1, fun h ↦ h2.1 h, fun h ↦ h3.1 h, h4⟩, ?_⟩
  rw [dist_comm]
  exact h5

theorem baireSpace

TopologyByExample.KnasterKuratowskiFan.baireSpace

The fan is a Baire space: the punctured fan is a dense open Baire subspace.

theorem _root_.TopologyByExample.KnasterKuratowskiFan.baireSpace :
    BaireSpace KnasterKuratowskiFan
Proof
:= by
  have : BaireSpace (range toFan) := isEmbedding_toFan.toHomeomorph.symm.isOpenEmbedding.baireSpace
  exact baireSpace_of_isOpen_of_dense isOpen_range_toFan denseRange_toFan

On this site: The Knaster–Kuratowski fan is a Baire space

σ-compactness

theorem not_exists_isClosed_cover

TopologyByExample.KnasterKuratowski.not_exists_isClosed_cover

No closed F_σ set lies between the generic parameters and the complement of the missing points. Within the compact set C × [0, 1 / 2], both the generic parameters and the complement of such an F_σ would be dense G_δ sets, and they are disjoint.

theorem not_exists_isClosed_cover :
    ¬∃ F : ℕ → Set (ℝ × ℝ), (∀ n, IsClosed (F n)) ∧ generic ⊆ ⋃ n, F n ∧
      Disjoint (⋃ n, F n) missing
Proof
:= by
  rintro ⟨F, hF, hG, hH⟩
  set K := cantorSet ×ˢ Icc (0 : ℝ) (1 / 2)
  have : CompactSpace K := isCompact_iff_compactSpace.1 (isCompact_cantorSet.prod isCompact_Icc)
  have : Nonempty K := ⟨⟨(0, 0), zero_mem_cantorSet, by norm_num⟩⟩
  have h₁ : IsGδ (((↑) : K → ℝ × ℝ) ⁻¹' generic) := isGδ_generic.preimage continuous_subtypeVal
  have h₂ : IsGδ (((↑) : K → ℝ × ℝ) ⁻¹' (⋃ n, F n)ᶜ) := by
    refine IsGδ.preimage continuous_subtypeVal ?_
    rw [compl_iUnion]
    exact .iInter_of_isOpen fun n ↦ (hF n).isOpen_compl
  have d₁ : Dense (((↑) : K → ℝ × ℝ) ⁻¹' generic) := by
    refine Metric.dense_iff.2 fun k ε hε ↦ ?_
    obtain ⟨g, h1, h2, h3, h4, h5⟩ := exists_near_mem k.property False False hε
    exact ⟨⟨g, h1, Ioo_subset_Icc_self h4⟩, h5, h1, fun h ↦ h2.1 h, fun h ↦ h3.1 h, h4⟩
  have d₂ : Dense (((↑) : K → ℝ × ℝ) ⁻¹' (⋃ n, F n)ᶜ) := by
    refine Metric.dense_iff.2 fun k ε hε ↦ ?_
    obtain ⟨g, h1, h2, h3, h4, h5⟩ := exists_near_mem k.property False True hε
    exact ⟨⟨g, h1, Ioo_subset_Icc_self h4⟩, h5,
      fun hg ↦ disjoint_left.1 hH hg ⟨h1, fun h ↦ h2.1 h, h3.2 trivial, h4⟩⟩
  obtain ⟨k, hk₁, hk₂⟩ := (d₁.inter_of_Gδ h₁ h₂ d₂).nonempty
  exact hk₂ (hG hk₁)

theorem not_sigmaCompactSpace_params

TopologyByExample.KnasterKuratowski.not_sigmaCompactSpace_params

The set of parameters is not σ-compact.

theorem not_sigmaCompactSpace_params : ¬SigmaCompactSpace params
Proof
:= by
  intro _
  refine not_exists_isClosed_cover ⟨fun n ↦ (↑) '' compactCovering params n,
    fun n ↦ ((isCompact_compactCovering params n).image continuous_subtypeVal).isClosed, ?_, ?_⟩
  · intro g hg
    obtain ⟨n, hn⟩ := mem_iUnion.1
      ((iUnion_compactCovering params).symm ▸ mem_univ (⟨g, generic_subset_params hg⟩ : params))
    exact mem_iUnion.2 ⟨n, _, hn, rfl⟩
  · refine disjoint_params_missing.mono_left (iUnion_subset fun n ↦ ?_)
    rintro _ ⟨q, -, rfl⟩
    exact q.property

Complete metrizability

theorem not_isCompletelyMetrizableSpace_params

TopologyByExample.KnasterKuratowski.not_isCompletelyMetrizableSpace_params

The set of parameters is not completely metrizable: the parameters over an endpoint e form a closed, countable subspace without isolated points.

theorem not_isCompletelyMetrizableSpace_params : ¬IsCompletelyMetrizableSpace params
Proof
:= by
  intro _
  set e := someEndpoint
  let L : Set params := {q | q.val.1 = e}
  have hL : IsClosed L := isClosed_eq (continuous_fst.comp continuous_subtypeVal) continuous_const
  have : IsCompletelyMetrizableSpace L := hL.isCompletelyMetrizableSpace
  have hrat : ∀ q : L, ∃ r : ℚ, (r : ℝ) = q.val.val.2 := fun q ↦
    (q.val.property.2.2).1 (q.property ▸ someEndpoint_mem)
  choose f hf using hrat
  have : Countable L := Function.Injective.countable (f := f) fun q q' h ↦ by
    refine Subtype.ext (Subtype.ext (Prod.ext (q.property.trans q'.property.symm) ?_))
    rw [← hf q, ← hf q', h]
  have : Nonempty L := ⟨⟨baseParam, rfl⟩⟩
  obtain ⟨x, hx⟩ :=
    (hasIsolatedPoint_of_countable_of_not_isMeagre_univ not_isMeagre_univ_of_baireSpace :
      HasIsolatedPoint L).exists_isOpen_singleton
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 hx x rfl
  obtain ⟨y', hy', h1, h2⟩ := exists_mem_params_gt x.val.property hε
  let z : L := ⟨⟨(x.val.val.1, y'), hy'⟩, x.property⟩
  have hz : z ∈ Metric.ball x ε := by
    rw [Metric.mem_ball, Subtype.dist_eq, Subtype.dist_eq, Prod.dist_eq, Real.dist_eq,
      Real.dist_eq, sub_self, abs_zero, max_eq_right (abs_nonneg _), abs_of_pos (by linarith)]
    exact h2
  have heq := congrArg (fun w : L ↦ w.val.val.2) (mem_singleton_iff.1 (hball hz))
  exact h1.ne' heq

instance

The fan is nonempty: it contains the apex.

instance : Nonempty KnasterKuratowskiFan
Proof
:= ⟨apexPt⟩

theorem preconnectedSpace

TopologyByExample.KnasterKuratowskiFan.preconnectedSpace

The Knaster–Kuratowski fan is connected.

theorem preconnectedSpace : PreconnectedSpace KnasterKuratowskiFan
Proof
:= by
  refine preconnectedSpace_iff_clopen.2 fun s hs ↦ ?_
  by_cases h : apexPt ∈ s
  · exact Or.inr (eq_univ_of_isClopen hs h)
  · exact Or.inl (compl_univ_iff.1 (eq_univ_of_isClopen hs.compl h))

On this site: The Knaster–Kuratowski fan is connected

theorem totallyDisconnectedSpace_compl_apex

TopologyByExample.KnasterKuratowskiFan.totallyDisconnectedSpace_compl_apex

The apex is a dispersion point: removing it leaves a totally disconnected space.

theorem totallyDisconnectedSpace_compl_apex :
    TotallyDisconnectedSpace ({apexPt}ᶜ : Set KnasterKuratowskiFan)
Proof
:=
  totallyDisconnectedSpace_subtype_iff.2 isTotallyDisconnected_compl_apexPt

On this site: Knaster–Kuratowski fan: The apex is a dispersion point

theorem totallyPathDisconnectedSpace

TopologyByExample.KnasterKuratowskiFan.totallyPathDisconnectedSpace

The Knaster–Kuratowski fan is totally path disconnected.

theorem totallyPathDisconnectedSpace : TotallyPathDisconnectedSpace KnasterKuratowskiFan
Proof
:=
  totallyPathDisconnectedSpace_of_isTotallyDisconnected_compl apexPt
    isTotallyDisconnected_compl_apexPt

On this site: The Knaster–Kuratowski fan is totally path disconnected

theorem not_locallyConnectedSpace

TopologyByExample.KnasterKuratowskiFan.not_locallyConnectedSpace

The Knaster–Kuratowski fan is not locally connected.

theorem not_locallyConnectedSpace : ¬LocallyConnectedSpace KnasterKuratowskiFan
Proof
:= by
  intro _
  have : LocallyConnectedSpace (range toFan) := isOpen_range_toFan.locallyConnectedSpace
  have : LocallyConnectedSpace params :=
    (Homeomorph.locallyConnectedSpace_iff isEmbedding_toFan.toHomeomorph).2 inferInstance
  exact not_locallyConnectedSpace_of_not_discreteTopology not_discreteTopology_params
    inferInstance

On this site: The Knaster–Kuratowski fan is not locally connected

theorem not_sigmaCompactSpace

TopologyByExample.KnasterKuratowskiFan.not_sigmaCompactSpace

The Knaster–Kuratowski fan is not σ-compact.

theorem not_sigmaCompactSpace : ¬SigmaCompactSpace KnasterKuratowskiFan
Proof
:= by
  intro _
  refine not_exists_isClosed_cover ⟨fun n ↦ legPoint ⁻¹'
      (((↑) : KnasterKuratowskiFan → ℝ × ℝ) '' compactCovering KnasterKuratowskiFan n),
    fun n ↦ ((isCompact_compactCovering _ n).image continuous_subtypeVal).isClosed.preimage
      continuous_legPoint, ?_, ?_⟩
  · intro g hg
    obtain ⟨n, hn⟩ := mem_iUnion.1 ((iUnion_compactCovering KnasterKuratowskiFan).symm ▸
      mem_univ (toFan ⟨g, generic_subset_params hg⟩))
    exact mem_iUnion.2 ⟨n, _, hn, rfl⟩
  · refine disjoint_left.2 fun h hh hm ↦ ?_
    obtain ⟨n, z, -, hz⟩ := mem_iUnion.1 hh
    have hy : h.2 ≠ 1 / 2 := hm.2.2.2.2.ne
    rcases z.property with h' | h'
    · exact hy (by rw [← legPoint_snd h, ← hz, h']; simp [apex])
    · rw [hz, mem_puncturedFan_iff, legParam_legPoint hy] at h'
      exact disjoint_left.1 disjoint_params_missing h'.2 hm

On this site: The Knaster–Kuratowski fan is not σ-compact

theorem not_isCompletelyMetrizableSpace

TopologyByExample.KnasterKuratowskiFan.not_isCompletelyMetrizableSpace

The Knaster–Kuratowski fan is not completely metrizable.

theorem not_isCompletelyMetrizableSpace : ¬IsCompletelyMetrizableSpace KnasterKuratowskiFan
Proof
:= by
  intro _
  have : IsCompletelyMetrizableSpace (range toFan) := isOpen_range_toFan.isCompletelyMetrizableSpace
  exact not_isCompletelyMetrizableSpace_params
    isEmbedding_toFan.toHomeomorph.isClosedEmbedding.IsCompletelyMetrizableSpace

On this site: The Knaster–Kuratowski fan is not completely metrizable

theorem not_isMeagre_univ

TopologyByExample.KnasterKuratowskiFan.not_isMeagre_univ

The Knaster–Kuratowski fan is of second category in itself.

theorem not_isMeagre_univ : ¬IsMeagre (univ : Set KnasterKuratowskiFan)
Proof
:=
  have := KnasterKuratowskiFan.baireSpace
  not_isMeagre_univ_of_baireSpace

instance

The punctured fan is nonempty.

instance : Nonempty PuncturedKnasterKuratowskiFan
Proof
:= ⟨paramsHomeomorph.symm baseParam⟩

theorem totallyDisconnectedSpace

TopologyByExample.PuncturedKnasterKuratowskiFan.totallyDisconnectedSpace

The punctured fan is totally disconnected.

theorem totallyDisconnectedSpace : TotallyDisconnectedSpace PuncturedKnasterKuratowskiFan
Proof
:=
  paramsHomeomorph.symm.totallyDisconnectedSpace

On this site: The punctured Knaster–Kuratowski fan is totally disconnected

theorem not_totallySeparatedSpace

TopologyByExample.PuncturedKnasterKuratowskiFan.not_totallySeparatedSpace

The punctured fan is not totally separated.

theorem not_totallySeparatedSpace : ¬TotallySeparatedSpace PuncturedKnasterKuratowskiFan
Proof
:=
  fun _ ↦ not_totallySeparatedSpace_params
    (totallySeparatedSpace_of_injective paramsHomeomorph.symm.continuous
      paramsHomeomorph.symm.injective)

On this site: The punctured Knaster–Kuratowski fan is not totally separated

theorem not_sigmaCompactSpace

TopologyByExample.PuncturedKnasterKuratowskiFan.not_sigmaCompactSpace

The punctured fan is not σ-compact.

theorem not_sigmaCompactSpace : ¬SigmaCompactSpace PuncturedKnasterKuratowskiFan
Proof
:= fun h ↦
  not_sigmaCompactSpace_params ((Homeomorph.sigmaCompactSpace_iff paramsHomeomorph).1 h)

On this site: The punctured Knaster–Kuratowski fan is not σ-compact

theorem not_isCompletelyMetrizableSpace

TopologyByExample.PuncturedKnasterKuratowskiFan.not_isCompletelyMetrizableSpace

The punctured fan is not completely metrizable.

theorem not_isCompletelyMetrizableSpace :
    ¬IsCompletelyMetrizableSpace PuncturedKnasterKuratowskiFan
Proof
:= fun _ ↦
  not_isCompletelyMetrizableSpace_params
    paramsHomeomorph.symm.isClosedEmbedding.IsCompletelyMetrizableSpace

On this site: The punctured Knaster–Kuratowski fan is not completely metrizable

theorem baireSpace

TopologyByExample.PuncturedKnasterKuratowskiFan.baireSpace

The punctured fan is a Baire space.

theorem baireSpace : BaireSpace PuncturedKnasterKuratowskiFan
Proof
:=
  paramsHomeomorph.isOpenEmbedding.baireSpace

On this site: The punctured Knaster–Kuratowski fan is a Baire space

theorem not_isMeagre_univ

TopologyByExample.PuncturedKnasterKuratowskiFan.not_isMeagre_univ

The punctured fan is of second category in itself.

theorem not_isMeagre_univ : ¬IsMeagre (univ : Set PuncturedKnasterKuratowskiFan)
Proof
:=
  have := baireSpace
  not_isMeagre_univ_of_baireSpace

theorem exists_isClopen_iff

TopologyByExample.PuncturedKnasterKuratowskiFan.exists_isClopen_iff

The quasi-components of the punctured fan are its legs. A clopen set of the punctured fan contains one point and not another exactly when the two points lie on different segments through the apex, that is, when the feet (x - y) / (1 - 2y) of those segments differ.

theorem exists_isClopen_iff {x y : PuncturedKnasterKuratowskiFan} :
    (∃ U : Set PuncturedKnasterKuratowskiFan, IsClopen U ∧ x ∈ U ∧ y ∉ U) ↔
      (legParam x).1 ≠ (legParam y).1
Proof
:= by
  constructor
  · rintro ⟨U, hU, hx, hy⟩ h
    have hU' : IsClopen (paramsHomeomorph.symm ⁻¹' U) :=
      hU.preimage paramsHomeomorph.symm.continuous
    have := mem_of_isClopen hU' (a := paramsHomeomorph x) (b := paramsHomeomorph y) h
      (by simpa using hx)
    exact hy (by simpa using this)
  · intro h
    have : TotallySeparatedSpace cantorSet := totallySeparatedSpace_of_injective
      cantorSetHomeomorphNatToBool.continuous cantorSetHomeomorphNatToBool.injective
    let f : PuncturedKnasterKuratowskiFan → cantorSet := fun z ↦
      ⟨(paramsHomeomorph z).val.1, (paramsHomeomorph z).property.1⟩
    have hf : Continuous f :=
      ((continuous_fst.comp continuous_subtypeVal).comp paramsHomeomorph.continuous).subtype_mk _
    have hne : f x ≠ f y := fun e ↦ h (congrArg Subtype.val e)
    obtain ⟨V, hV, hxV, hyV⟩ := totallySeparatedSpace_iff_exists_isClopen.1 this hne
    exact ⟨f ⁻¹' V, hV.preimage hf, hxV, hyV⟩

On this site: Punctured Knaster–Kuratowski fan: Open and closed sets contain whole segments