import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

variable (I : Type*)

namespace Chapter9

-- <CONTEXT>
abbrev _root_.Real.adherent' (ε:ℝ) (x:ℝ) (X: Set ℝ) := ∃ y ∈ X, |x - y| ≤ ε

abbrev AdherentPt (x:ℝ) (X:Set ℝ) := ∀ ε > (0:ℝ), ε.adherent' x X

theorem closure_def (X:Set ℝ) : closure X = { x | AdherentPt x X } := by
  sorry

theorem closure_def' (X:Set ℝ) (x :ℝ) : x ∈ closure X ↔ AdherentPt x X := by
  sorry

theorem AdherentPt_def (x:ℝ) (X:Set ℝ) : AdherentPt x X = ClusterPt x (.principal X) := by
  sorry

theorem closure_of_Ioo {a b:ℝ} (h:a < b) : closure (.Ioo a b) = .Icc a b := by
  sorry

theorem closure_of_Ioc {a b:ℝ} (h:a < b) : closure (.Ioc a b) = .Icc a b := by
  sorry

theorem closure_of_Ico {a b:ℝ} (h:a < b) : closure (.Ico a b) = .Icc a b := by
  sorry

theorem closure_of_Icc {a b:ℝ} (h:a ≤ b) : closure (.Icc a b) = .Icc a b := by
  sorry

theorem closure_of_Ioi {a:ℝ} : closure (.Ioi a) = .Ici a := by
  sorry

theorem closure_of_Ici {a:ℝ} : closure (.Ici a) = .Ici a := by
  sorry

theorem closure_of_Iio {a:ℝ} : closure (.Iio a) = .Iic a := by
  sorry

theorem closure_of_Iic {a:ℝ} : closure (.Iic a) = .Iic a := by
  sorry

theorem closure_of_R : closure (.univ: Set ℝ) = .univ := by
  sorry

theorem AdherentPt.of_mem {X: Set ℝ} {x: ℝ} (h: x ∈ X) : AdherentPt x X := by
  sorry

theorem isClosed_def (X:Set ℝ): IsClosed X ↔ closure X = X := by
  sorry

theorem isClosed_def' (X:Set ℝ): IsClosed X ↔ ∀ x, AdherentPt x X → x ∈ X := by
  sorry

theorem Icc_closed {a b:ℝ} : IsClosed (.Icc a b) := by
  sorry

theorem Ici_closed (a:ℝ) : IsClosed (.Ici a) := by
  sorry

theorem Iic_closed (a:ℝ) : IsClosed (.Iic a) := by
  sorry

theorem R_closed : IsClosed (.univ : Set ℝ) := by
  sorry

theorem Ico_not_closed {a b:ℝ} (h: a < b) : ¬ IsClosed (.Ico a b) := by
  sorry

theorem Ioc_not_closed {a b:ℝ} (h: a < b) : ¬ IsClosed (.Ioc a b) := by
  sorry

theorem Ioo_not_closed {a b:ℝ} (h: a < b) : ¬ IsClosed (.Ioo a b) := by
  sorry

theorem Ioi_not_closed (a:ℝ) : ¬ IsClosed (.Ioi a) := by
  sorry

theorem Iio_not_closed (a:ℝ) : ¬ IsClosed (.Iio a) := by
  sorry

theorem N_closed : IsClosed ((fun n:ℕ ↦ (n:ℝ)) '' .univ) := by
  sorry

theorem Z_closed : IsClosed ((fun n:ℤ ↦ (n:ℝ)) '' .univ) := by
  sorry

theorem Q_not_closed : ¬ IsClosed ((fun n:ℚ ↦ (n:ℝ)) '' .univ) := by
  sorry

theorem isClosed_iff_limits_mem (X: Set ℝ) :
  IsClosed X ↔ ∀ (a:ℕ → ℝ) (L:ℝ), (∀ n, a n ∈ X) → Filter.atTop.Tendsto a (nhds L) → L ∈ X := by
  sorry

abbrev LimitPt (x:ℝ) (X: Set ℝ) := AdherentPt x (X \ {x})

theorem LimitPt.iff_AccPt (x:ℝ) (X: Set ℝ) : LimitPt x X ↔ AccPt x (.principal X) := by
  sorry

abbrev IsolatedPt (x:ℝ) (X: Set ℝ) := x ∈ X ∧ ∃ ε>0, ∀ y ∈ X \ {x}, |x-y| > ε

theorem LimitPt.iff_limit (x:ℝ) (X: Set ℝ) :
  LimitPt x X ↔ ∃ a : ℕ → ℝ, (∀ n, a n ∈ X \ {x}) ∧ Filter.atTop.Tendsto a (nhds x) := by
  sorry

theorem mem_Icc_isLimit {a b x:ℝ} (h: a < b) (hx: x ∈ Set.Icc a b) : LimitPt x (.Icc a b) := by
  sorry

theorem mem_Ico_isLimit {a b x:ℝ} (hx: x ∈ Set.Ico a b) : LimitPt x (.Ico a b) := by
  sorry

theorem mem_Ioc_isLimit {a b x:ℝ} (hx: x ∈ Set.Ioc a b) : LimitPt x (.Ioc a b) := by
  sorry

theorem mem_Ioo_isLimit {a b x:ℝ} (hx: x ∈ Set.Ioo a b) : LimitPt x (.Ioo a b) := by
  sorry

theorem mem_Ici_isLimit {a x:ℝ} (hx: x ∈ Set.Ici a) : LimitPt x (.Ici a) := by
  sorry

theorem mem_Ioi_isLimit {a x:ℝ} (hx: x ∈ Set.Ioi a) : LimitPt x (.Ioi a) := by
  sorry

theorem mem_Iic_isLimit {a x:ℝ} (hx: x ∈ Set.Iic a) : LimitPt x (.Iic a) := by
  sorry

theorem mem_Iio_isLimit {a x:ℝ} (hx: x ∈ Set.Iio a) : LimitPt x (.Iio a) := by
  sorry

theorem mem_R_isLimit {x:ℝ} : LimitPt x (.univ) := by
  sorry

theorem isBounded_def (X: Set ℝ) : Bornology.IsBounded X ↔ ∃ M > 0, X ⊆ .Icc (-M) M := by
  sorry

theorem Icc_bounded (a b:ℝ) : Bornology.IsBounded (.Icc a b) := by
  sorry

theorem Ici_unbounded (a: ℝ) : ¬ Bornology.IsBounded (.Ici a) := by
  sorry

theorem N_unbounded (a: ℝ) : ¬ Bornology.IsBounded ((fun n:ℕ ↦ (n:ℝ)) '' .univ) := by
  sorry

theorem Z_unbounded (a: ℝ) : ¬ Bornology.IsBounded ((fun n:ℤ ↦ (n:ℝ)) '' .univ) := by
  sorry

theorem Q_unbounded (a: ℝ) : ¬ Bornology.IsBounded ((fun n:ℚ ↦ (n:ℝ)) '' .univ) := by
  sorry

theorem R_unbounded (a: ℝ) : ¬ Bornology.IsBounded (.univ: Set ℝ) := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_9_1_9a {X:Set ℝ} {x:ℝ} (hx: AdherentPt x X) : LimitPt x X ∨ IsolatedPt x X := by
-- </TARGET_THEOREM>

end Chapter9