Lean library · module TopologyByExample.Spaces.BernsteinPlane

The exact plane construction of Bernstein's connected set

Source file

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

Imports

definition ClosedConnected

TopologyByExample.BernsteinPlane.ClosedConnected

Nondegenerate closed connected subsets of the Euclidean plane.

abbrev ClosedConnected
:=
  {C : Set (ℝ × ℝ) // IsClosed C ∧ IsPreconnected C ∧ C.Nontrivial}

theorem cardinal_member

TopologyByExample.BernsteinPlane.cardinal_member

Every member of the enumerated family has cardinality continuum.

theorem cardinal_member (C : ClosedConnected) : #C.val = continuum
Proof
:= by
  apply le_antisymm cardinal_mk_le_continuum_of_secondCountable_t0
  obtain ⟨x, hx, y, hy, hxy⟩ := C.property.2.2
  let : PreconnectedSpace C.val := Subtype.preconnectedSpace C.property.2.1
  let f : C.val → ℝ := fun z ↦ dist z.val x
  have hf : Continuous f := continuous_subtypeVal.dist continuous_const
  have hd : 0 < dist y x := dist_pos.mpr hxy.symm
  have hx' : 0 ∈ range f := ⟨⟨x, hx⟩, dist_self x⟩
  have hy' : dist y x ∈ range f := ⟨⟨y, hy⟩, rfl⟩
  have hi := (isPreconnected_range hf).Icc_subset hx' hy'
  have hc : continuum ≤ #(range f) :=
    (mk_Icc_real hd).symm ▸ mk_le_mk_of_subset hi
  exact hc.trans mk_range_le

theorem cardinal_family_le

TopologyByExample.BernsteinPlane.cardinal_family_le

Countable basis coding bounds the number of closed connected plane subsets.

theorem cardinal_family_le : #ClosedConnected ≤ continuum
Proof
:= by
  obtain ⟨B, hBc, _, hB⟩ := exists_countable_basis (ℝ × ℝ)
  let : Countable B := hBc.to_subtype
  let code : ClosedConnected → Set B := fun C ↦ {b | (b : Set (ℝ × ℝ)) ⊆ C.valᶜ}
  have hi : Function.Injective code := by
    intro C D he
    apply Subtype.ext
    apply compl_injective
    apply hB.eq_of_forall_subset_iff C.property.1.isOpen_compl D.property.1.isOpen_compl
    intro U hU
    exact Set.ext_iff.mp he ⟨U, hU⟩
  calc
    #ClosedConnected ≤ #(Set B) := mk_le_of_injective hi
    _ = 2 ^ #B := mk_set
    _ ≤ 2 ^ aleph0 := power_le_power_left two_ne_zero mk_le_aleph0
    _ = continuum := two_power_aleph0

definition vertical

TopologyByExample.BernsteinPlane.vertical

A vertical line is a member of the enumerated family.

def vertical (r : ℝ) : ClosedConnected
Definition
:=
  ⟨{p | p.1 = r}, isClosed_eq continuous_fst continuous_const, by
    have he : {p : ℝ × ℝ | p.1 = r} = range (fun t : ℝ ↦ (r, t)) := by
      ext p
      simp only [mem_ofPred_eq, mem_range]
      aesop
    rw [he]
    exact isPreconnected_range (continuous_const.prodMk continuous_id),
    ⟨(r, 0), rfl, (r, 1), rfl, by simp⟩⟩

theorem vertical_injective

TopologyByExample.BernsteinPlane.vertical_injective

Distinct real numbers determine distinct vertical lines.

theorem vertical_injective : Function.Injective vertical
Proof
:= by
  intro r s he
  have h : (r, (0 : ℝ)) ∈ (vertical s).val := by rw [← he]; rfl
  exact h

theorem cardinal_family

TopologyByExample.BernsteinPlane.cardinal_family

The closed connected nondegenerate plane subsets form a continuum-sized family.

theorem cardinal_family : #ClosedConnected = continuum
Proof
:= by
  apply le_antisymm cardinal_family_le
  simpa only [mk_real] using mk_le_of_injective vertical_injective

definition enumeration

TopologyByExample.BernsteinPlane.enumeration

A bijective continuum-length enumeration, with no repetitions.

def enumeration : BernsteinRecursion.Index ≃ ClosedConnected
:=
  (Cardinal.eq.mp (BernsteinRecursion.cardinal_index.trans cardinal_family.symm)).some

definition pairs

TopologyByExample.BernsteinPlane.pairs

The source recursion with both fresh points chosen inside the meagre reservoir.

def pairs : BernsteinRecursion.Index → (ℝ × ℝ) × (ℝ × ℝ)
Definition
:=
  BernsteinRecursion.pairs
    (fun a ↦ (enumeration a).val ∩ BernsteinMeagreReservoir.planeReservoir)
    (fun a ↦ BernsteinMeagreReservoir.cardinal_inter_continuum (enumeration a))

theorem pairs_source_spec

TopologyByExample.BernsteinPlane.pairs_source_spec

The selected pairs satisfy the unrestricted source recursion's fresh-point conditions.

theorem pairs_source_spec (a : BernsteinRecursion.Index) :
    (pairs a).1 ∈ (enumeration a).val ∧ (pairs a).2 ∈ (enumeration a).val ∧
      (pairs a).1 ≠ (pairs a).2 ∧ ∀ b < a,
        (pairs a).1 ≠ (pairs b).1 ∧ (pairs a).1 ≠ (pairs b).2 ∧
        (pairs a).2 ≠ (pairs b).1 ∧ (pairs a).2 ≠ (pairs b).2
Proof
:= by
  have h := BernsteinRecursion.pairs_spec _
    (fun a ↦ BernsteinMeagreReservoir.cardinal_inter_continuum (enumeration a)) a
  exact ⟨h.1.1, h.2.1.1, h.2.2⟩

On this site: Bernstein's connected set: Fresh pairs at every stage

definition carrier

TopologyByExample.BernsteinPlane.carrier

The first-coordinate range of the paired recursion.

def carrier : Set (ℝ × ℝ)
:= range (fun a ↦ (pairs a).1)

On this site: Space: Bernstein's connected set

theorem meets

TopologyByExample.BernsteinPlane.meets

Every nondegenerate closed connected plane set meets the chosen subset.

theorem meets (C : ClosedConnected) : (C.val ∩ carrier).Nonempty
Proof
:= by
  obtain ⟨a, rfl⟩ := enumeration.surjective C
  exact ⟨(pairs a).1, (BernsteinRecursion.pairs_spec
    (fun a ↦ (enumeration a).val ∩ BernsteinMeagreReservoir.planeReservoir)
    (fun a ↦ BernsteinMeagreReservoir.cardinal_inter_continuum (enumeration a)) a).1.1,
    mem_range_self a⟩

On this site: Bernstein's connected set: Every nondegenerate closed connected set meets the space

theorem meets_compl

TopologyByExample.BernsteinPlane.meets_compl

Every nondegenerate closed connected plane set also meets the complement.

theorem meets_compl (C : ClosedConnected) : (C.val ∩ carrierᶜ).Nonempty
Proof
:= by
  obtain ⟨a, rfl⟩ := enumeration.surjective C
  refine ⟨(pairs a).2, (BernsteinRecursion.pairs_spec
    (fun a ↦ (enumeration a).val ∩ BernsteinMeagreReservoir.planeReservoir)
    (fun a ↦ BernsteinMeagreReservoir.cardinal_inter_continuum (enumeration a)) a).2.1.1, ?_⟩
  intro hx
  exact (BernsteinRecursion.disjoint_ranges _ _).le_bot ⟨hx, mem_range_self a⟩

On this site: Bernstein's connected set: Every nondegenerate closed connected set meets the complement

theorem dense_of_meets

TopologyByExample.BernsteinPlane.dense_of_meets

Meeting every nondegenerate closed connected plane set implies density.

theorem dense_of_meets {S : Set (ℝ × ℝ)}
    (hS : ∀ C : ClosedConnected, (C.val ∩ S).Nonempty) : Dense S
Proof
:= by
  refine dense_iff_inter_open.mpr fun U hU ⟨x, hx⟩ ↦ ?_
  obtain ⟨r, hr, hsub⟩ := Metric.isOpen_iff.mp hU x hx
  have hh : 0 < r / 2 := half_pos hr
  obtain ⟨y, hy⟩ := (NormedSpace.sphere_nonempty
    (x := x) (r := r / 2)).mpr hh.le
  have hxy : x ≠ y := by
    intro he
    subst y
    have hz : (0 : ℝ) = r / 2 := by simpa using hy
    linarith
  have hn : (Metric.closedBall x (r / 2)).Nontrivial :=
    ⟨x, Metric.mem_closedBall_self hh.le, y, Metric.sphere_subset_closedBall hy, hxy⟩
  obtain ⟨z, hz, hzs⟩ := hS ⟨Metric.closedBall x (r / 2),
    Metric.isClosed_closedBall, Metric.isPreconnected_closedBall, hn⟩
  exact ⟨z, hsub ((Metric.closedBall_subset_ball (half_lt_self hr)) hz), hzs⟩

theorem dense_carrier

TopologyByExample.BernsteinPlane.dense_carrier

The chosen subset is dense in the plane.

theorem dense_carrier : Dense carrier
Proof
:= dense_of_meets meets

theorem dense_compl_carrier

TopologyByExample.BernsteinPlane.dense_compl_carrier

The complement of the chosen subset is dense in the plane.

theorem dense_compl_carrier : Dense carrierᶜ
Proof
:= dense_of_meets meets_compl

theorem interior_compact_eq_empty

TopologyByExample.BernsteinPlane.interior_compact_eq_empty

Compact subsets have empty interior in the chosen subspace.

theorem interior_compact_eq_empty {K : Set carrier} (hK : IsCompact K) :
    interior K = ∅
Proof
:= by
  apply dense_carrier.isDenseInducing_val.interior_compact_eq_empty _ hK
  simpa only [Subtype.range_coe_subtype, ofPred_mem_eq] using dense_compl_carrier

On this site: Bernstein's connected set: Compact subsets have empty interior

theorem not_compact_mem_nhds

TopologyByExample.BernsteinPlane.not_compact_mem_nhds

No point of the chosen subspace has a compact neighbourhood.

theorem not_compact_mem_nhds (x : carrier) {K : Set carrier} (hK : IsCompact K) :
    K ∉ nhds x
Proof
:= by
  intro hx
  have hi := mem_interior_iff_mem_nhds.mpr hx
  rw [interior_compact_eq_empty hK] at hi
  exact hi

On this site: Bernstein's connected set: No compact neighbourhoods

theorem not_weakly_locally_compact

TopologyByExample.BernsteinPlane.not_weakly_locally_compact

The chosen subspace is not weakly locally compact.

theorem not_weakly_locally_compact : ¬ WeaklyLocallyCompactSpace carrier
Proof
:= by
  intro h
  let := h
  obtain ⟨x, _, hx⟩ := meets (vertical 0)
  obtain ⟨K, hK, hKx⟩ := exists_compact_mem_nhds (⟨x, hx⟩ : carrier)
  exact not_compact_mem_nhds _ hK hKx

theorem cardinal_carrier

TopologyByExample.BernsteinPlane.cardinal_carrier

The chosen subset has cardinality continuum.

theorem cardinal_carrier : #carrier = continuum
Proof
:=
  (mk_range_eq _ (BernsteinRecursion.first_injective _ _)).trans
    BernsteinRecursion.cardinal_index

On this site: Bernstein's connected set has cardinality equal to \(\mathfrak{c}\)

theorem subsingleton_of_isClosed_of_isPreconnected

TopologyByExample.BernsteinPlane.subsingleton_of_isClosed_of_isPreconnected

A closed connected subset contained in the chosen set has at most one point.

theorem subsingleton_of_isClosed_of_isPreconnected {K : Set (ℝ × ℝ)}
    (hK : IsClosed K) (hc : IsPreconnected K) (hs : K ⊆ carrier) :
    K.Subsingleton
Proof
:= by
  by_contra hn
  have hnt : K.Nontrivial := Set.not_subsingleton_iff.mp hn
  obtain ⟨x, hx, hxc⟩ := meets_compl ⟨K, hK, hc, hnt⟩
  exact hxc (hs hx)

theorem subsingleton_of_isCompact_of_isPreconnected

TopologyByExample.BernsteinPlane.subsingleton_of_isCompact_of_isPreconnected

Every compact connected subset of the chosen set has at most one point.

theorem subsingleton_of_isCompact_of_isPreconnected {K : Set (ℝ × ℝ)}
    (hK : IsCompact K) (hc : IsPreconnected K) (hs : K ⊆ carrier) :
    K.Subsingleton
Proof
:=
  subsingleton_of_isClosed_of_isPreconnected hK.isClosed hc hs

theorem totally_path_disconnected

TopologyByExample.BernsteinPlane.totally_path_disconnected

Every path in the chosen subset is constant.

theorem totally_path_disconnected : TotallyPathDisconnectedSpace carrier
Proof
:= by
  refine ⟨fun x y ⟨p⟩ ↦ ?_⟩
  let f : unitInterval → ℝ × ℝ := fun t ↦ (p t).val
  have hf : Continuous f := continuous_subtypeVal.comp p.continuous
  have hs : range f ⊆ carrier := by
    rintro z ⟨t, rfl⟩
    exact (p t).property
  have h := subsingleton_of_isCompact_of_isPreconnected
    (isCompact_range hf) (isPreconnected_range hf) hs
  apply Subtype.ext
  simpa [f] using h (mem_range_self (f := f) 0) (mem_range_self (f := f) 1)

On this site: Bernstein's connected set is totally path disconnected

theorem exists_closed_separator

TopologyByExample.BernsteinPlane.exists_closed_separator

A disconnection of a dense subset yields a disjoint closed separator.

theorem exists_closed_separator {X : Type*} [TopologicalSpace X] {S : Set X}
    (hS : Dense S) (hn : ¬ IsPreconnected S) :
    ∃ F : Set X, IsClosed F ∧ Disjoint F S ∧ ¬ IsPreconnected Fᶜ
Proof
:= by
  classical
  simp only [IsPreconnected, not_forall] at hn
  obtain ⟨U, V, hn⟩ := hn
  push Not at hn
  obtain ⟨hU, hV, hcover, hSU, hSV, hempty⟩ := hn
  have hd : Disjoint U V := by
    apply Set.disjoint_left.mpr
    intro x hxU hxV
    obtain ⟨z, hz, hzS⟩ := hS.inter_open_nonempty (U ∩ V) (hU.inter hV)
      ⟨x, hxU, hxV⟩
    exact Set.notMem_empty z (hempty ▸ ⟨hzS, hz⟩)
  refine ⟨(U ∪ V)ᶜ, (hU.union hV).isClosed_compl, ?_, ?_⟩
  · exact Set.disjoint_left.mpr fun x hxF hxS ↦ hxF (hcover hxS)
  · rw [compl_compl]
    intro hc
    obtain ⟨x, hxS, hxU⟩ := hSU
    obtain ⟨y, hyS, hyV⟩ := hSV
    obtain ⟨z, _, hzU, hzV⟩ := hc U V hU hV Subset.rfl
      ⟨x, Or.inl hxU, hxU⟩ ⟨y, Or.inr hyV, hyV⟩
    exact Set.disjoint_left.mp hd hzU hzV

theorem isTotallyDisconnected_of_closed_disjoint

TopologyByExample.BernsteinPlane.isTotallyDisconnected_of_closed_disjoint

Closed sets disjoint from the chosen set are totally disconnected.

theorem isTotallyDisconnected_of_closed_disjoint {F : Set (ℝ × ℝ)}
    (hF : IsClosed F) (hd : Disjoint F carrier) : IsTotallyDisconnected F
Proof
:= by
  intro K hKF hK
  by_contra hn
  have hnt : (closure K).Nontrivial :=
    (Set.not_subsingleton_iff.mp hn).mono subset_closure
  obtain ⟨x, hx, hxc⟩ := meets ⟨closure K, isClosed_closure, hK.closure, hnt⟩
  exact Set.disjoint_left.mp hd ((closure_minimal hKF hF) hx) hxc

theorem closed_totally_disconnected_separator_of_not_preconnected

TopologyByExample.BernsteinPlane.closed_totally_disconnected_separator_of_not_preconnected

A failure of connectedness would give a closed totally disconnected plane separator.

theorem closed_totally_disconnected_separator_of_not_preconnected
    (hn : ¬ IsPreconnected carrier) :
    ∃ F : Set (ℝ × ℝ), IsClosed F ∧ IsTotallyDisconnected F ∧
      ¬ IsPreconnected Fᶜ
Proof
:= by
  obtain ⟨F, hF, hd, hc⟩ := exists_closed_separator dense_carrier hn
  exact ⟨F, hF, isTotallyDisconnected_of_closed_disjoint hF hd, hc⟩

theorem isPreconnected_of_meets

TopologyByExample.BernsteinPlane.isPreconnected_of_meets

A plane subset meeting every nondegenerate closed connected set is preconnected.

theorem isPreconnected_of_meets {S : Set (ℝ × ℝ)}
    (hS : ∀ C : ClosedConnected, (C.val ∩ S).Nonempty) : IsPreconnected S
Proof
:= by
  intro U V hU hV hcover hSU hSV
  by_contra hempty
  have hd : Disjoint U V := by
    apply Set.disjoint_left.mpr
    intro x hxU hxV
    obtain ⟨z, hz, hzS⟩ := (dense_of_meets hS).inter_open_nonempty (U ∩ V)
      (hU.inter hV) ⟨x, hxU, hxV⟩
    exact hempty ⟨z, hzS, hz⟩
  obtain ⟨a, _, ha⟩ := hSU
  obtain ⟨b, _, hb⟩ := hSV
  obtain ⟨K, hK, hc, hnt, hsub⟩ := PlaneRectangle.exists_compact_connected_outside
    hU hV ⟨a, ha⟩ ⟨b, hb⟩ hd
  obtain ⟨x, hxK, hxS⟩ := hS ⟨K, hK.isClosed, hc, hnt⟩
  exact hsub hxK (hcover hxS)

theorem isPreconnected_carrier

TopologyByExample.BernsteinPlane.isPreconnected_carrier

The exact paired-choice Bernstein subset of the plane is preconnected.

theorem isPreconnected_carrier : IsPreconnected carrier
Proof
:= isPreconnected_of_meets meets

theorem isPreconnected_compl_carrier

TopologyByExample.BernsteinPlane.isPreconnected_compl_carrier

The complement of the chosen carrier is preconnected.

theorem isPreconnected_compl_carrier : IsPreconnected carrierᶜ
Proof
:=
  isPreconnected_of_meets meets_compl

theorem isConnected_carrier

TopologyByExample.BernsteinPlane.isConnected_carrier

The exact paired-choice Bernstein subset of the plane is connected.

theorem isConnected_carrier : IsConnected carrier
Proof
:= by
  obtain ⟨x, _, hx⟩ := meets (vertical 0)
  exact ⟨⟨x, hx⟩, isPreconnected_carrier⟩

theorem isPreconnected_inter_open_convex

TopologyByExample.BernsteinPlane.isPreconnected_inter_open_convex

Intersections of the chosen set with open convex plane sets are preconnected.

theorem isPreconnected_inter_open_convex {O : Set (ℝ × ℝ)}
    (hO : IsOpen O) (hcO : Convex ℝ O) : IsPreconnected (carrier ∩ O)
Proof
:= by
  intro U V hU hV hcover hSU hSV
  by_contra hempty
  have hd : Disjoint (U ∩ O) (V ∩ O) := by
    apply Set.disjoint_left.mpr
    intro x hxU hxV
    obtain ⟨z, hz, hzS⟩ := dense_carrier.inter_open_nonempty ((U ∩ V) ∩ O)
      ((hU.inter hV).inter hO) ⟨x, ⟨hxU.1, hxV.1⟩, hxU.2⟩
    exact hempty ⟨z, ⟨hzS, hz.2⟩, hz.1⟩
  obtain ⟨a, haS, haU⟩ := hSU
  obtain ⟨b, hbS, hbV⟩ := hSV
  obtain ⟨K, hK, hc, hnt, hsub, hKO⟩ := PlaneRectangle.exists_compact_connected_outside_within
    (hU.inter hO) (hV.inter hO) ⟨a, haU, haS.2⟩ ⟨b, hbV, hbS.2⟩ hd
    hO hcO inter_subset_right inter_subset_right
  obtain ⟨x, hxK, hxS⟩ := meets ⟨K, hK.isClosed, hc, hnt⟩
  have hxO := hKO hxK
  rcases hcover ⟨hxS, hxO⟩ with hxU | hxV
  · exact hsub hxK (Or.inl ⟨hxU, hxO⟩)
  · exact hsub hxK (Or.inr ⟨hxV, hxO⟩)

On this site: Bernstein's connected set: Intersections with open convex sets are connected

theorem isPreconnected_ball

TopologyByExample.BernsteinPlane.isPreconnected_ball

Every metric ball in the chosen subspace is preconnected.

theorem isPreconnected_ball (x : carrier) (r : ℝ) :
    IsPreconnected (Metric.ball x r)
Proof
:= by
  apply Topology.IsInducing.subtypeVal.isPreconnected_image.mp
  have he : ((↑) : carrier → ℝ × ℝ) '' Metric.ball x r =
      carrier ∩ Metric.ball x.val r := by
    ext z
    constructor
    · rintro ⟨y, hy, rfl⟩
      exact ⟨y.property, hy⟩
    · rintro ⟨hz, hball⟩
      exact ⟨⟨z, hz⟩, hball, rfl⟩
  rw [he]
  exact isPreconnected_inter_open_convex Metric.isOpen_ball (convex_ball _ _)

theorem locallyConnectedSpace

TopologyByExample.BernsteinPlane.locallyConnectedSpace

The chosen Bernstein subspace is locally connected.

theorem locallyConnectedSpace : LocallyConnectedSpace carrier
Proof
:= by
  apply locallyConnectedSpace_iff_connected_subsets.mpr
  intro x U hU
  obtain ⟨r, hr, hsub⟩ := Metric.mem_nhds_iff.mp hU
  exact ⟨Metric.ball x r, Metric.ball_mem_nhds x hr, isPreconnected_ball x r, hsub⟩

On this site: Bernstein's connected set is locally connected