introvoyz041/TaoAnalysisBench huggingface dataset:
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

variable (I : Type*)

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

namespace Chapter9

-- <CONTEXT>
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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem closure_of_N :
  closure ((fun n:ℕ ↦ (n:ℝ)) '' .univ) = ((fun n:ℕ ↦ (n:ℝ)) '' .univ) := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Lemma 9.1.13 / Exercise 9.1.3 (Mathlib version) -/
theorem closure_of_N :
    closure (Set.range (fun n : ℕ => (n : ℝ))) = Set.range (fun n : ℕ => (n : ℝ)) := by
end TaoBench
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

namespace Chapter9

-- <CONTEXT>
variable (I : Type*)

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

-- </CONTEXT>
-- <TARGET_THEOREM>
theorem closure_of_Q :
  closure ((fun n:ℚ ↦ (n:ℝ)) '' .univ) = .univ := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Lemma 9.1.13 / Exercise 9.1.3 -/
theorem closure_of_Q :
  closure ((fun n : ℚ => (n : ℝ)) '' (Set.univ : Set ℚ)) = (Set.univ : Set ℝ) := by
end TaoBench
import Mathlib.Topology.Instances.Real

namespace Chapter9

/-- Lemma 9.1.13 / Exercise 9.1.3 -/
theorem closure_of_Z :
  closure ((fun n:ℤ ↦ (n:ℝ)) '' .univ) = ((fun n:ℤ ↦ (n:ℝ)) '' .univ) := by
end Chapter9
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

variable (I : Type*)

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

namespace Chapter9

-- <CONTEXT>
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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem closure_of_Z :
  closure ((fun n:ℤ ↦ (n:ℝ)) '' .univ) = ((fun n:ℤ ↦ (n:ℝ)) '' .univ) := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench
theorem closure_of_Z :
  closure ((fun n : ℤ ↦ (n : ℝ)) '' (Set.univ : Set ℤ)) =
    (fun n : ℤ ↦ (n : ℝ)) '' (Set.univ : Set ℤ) := by
end TaoBench
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

variable (I : Type*)

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

namespace Chapter9

-- <CONTEXT>
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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem closure_of_subset_closure {X Y:Set ℝ} (h: X ⊆ Y) (h' : Y ⊆ closure X): closure Y = closure X := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Exercise 9.1.6 (Mathlib version) -/
theorem closure_of_subset_closure {X Y : Set ℝ}
    (h : X ⊆ Y) (h' : Y ⊆ closure X) :
    closure Y = closure X := by
end TaoBench
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

-- <CONTEXT>
variable (I : Type*)

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

namespace Chapter9

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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem closure_subset {X Y:Set ℝ} (h: X ⊆ Y): closure X ⊆ closure Y := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Lemma 9.1.11 / Exercise 9.1.2 -/
theorem closure_subset {X Y : Set ℝ} (h : X ⊆ Y) : closure X ⊆ closure Y := by
end TaoBench
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

namespace Chapter9

-- <CONTEXT>
variable (I : Type*)

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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem closure_union (X Y:Set ℝ): closure (X ∪ Y) = closure X ∪ closure Y := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Lemma 9.1.11 / Exercise 9.1.2 (closure of a union in ℝ). -/
theorem closure_union (X Y : Set ℝ) :
    closure (X ∪ Y) = closure X ∪ closure Y := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Topology.Instances.Real
import Mathlib.Order.ConditionallyCompleteLattice.Basic

namespace Chapter9

/-- Corollary 9.7.4 (Images of continuous functions) / Exercise 9.7.1 -/
theorem continuous_image_Icc {a b:ℝ} (hab: a < b) {f:ℝ → ℝ} (hf: ContinuousOn f (.Icc a b)) {y:ℝ} (hy: sInf (f '' .Icc a b) ≤ y ∧ y ≤ sSup (f '' .Icc a b)) : ∃ c ∈ Set.Icc a b, f c = y := by
end Chapter9
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4

namespace Chapter9

-- <CONTEXT>
theorem intermediate_value {a b:ℝ} (hab: a < b) {f:ℝ → ℝ} (hf: ContinuousOn f (.Icc a b)) {y:ℝ} (hy: y ∈ Set.Icc (f a) (f b) ∨ y ∈ Set.Icc (f a) (f b)) :
  ∃ c ∈ Set.Icc a b, f c = y := by
  sorry

open Classical in
noncomputable abbrev f_9_7_1 : ℝ → ℝ := fun x ↦ if x ≤ 0 then -1 else 1

abbrev f_9_7_2 : ℝ → ℝ := fun x ↦ x^3 - x

-- </CONTEXT>
-- <TARGET_THEOREM>
theorem continuous_image_Icc {a b:ℝ} (hab: a < b) {f:ℝ → ℝ} (hf: ContinuousOn f (.Icc a b)) {y:ℝ} (hy: sInf (f '' .Icc a b) ≤ y ∧ y ≤ sSup (f '' .Icc a b)) : ∃ c ∈ Set.Icc a b, f c = y := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Corollary 9.7.4 (Images of continuous functions) / Exercise 9.7.1 -/
theorem continuous_image_Icc
  {a b : ℝ} (hab : a < b) {f : ℝ → ℝ}
  (hf : ContinuousOn f (Set.Icc a b))
  {y : ℝ}
  (hy : sInf (f '' Set.Icc a b) ≤ y ∧ y ≤ sSup (f '' Set.Icc a b)) :
  ∃ c ∈ Set.Icc a b, f c = y := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Data.Real.Basic
import Mathlib.Topology.Basic
import Mathlib.Data.Set.Lattice

namespace Chapter9

/-- Exercise 9.7.2 -/
theorem exists_fixed_pt {f:ℝ → ℝ} (hf: ContinuousOn f (.Icc 0 1)) (hmap: f '' .Icc 0 1 ⊆ .Icc 0 1) : ∃ x ∈ Set.Icc 0 1, f x = x := by
end Chapter9
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4

namespace Chapter9

-- <CONTEXT>
theorem intermediate_value {a b : ℝ} (hab : a < b) {f : ℝ → ℝ} (hf : ContinuousOn f (.Icc a b)) {y : ℝ} (hy : y ∈ Set.Icc (f a) (f b) ∨ y ∈ Set.Icc (f a) (f b)) :
  ∃ c ∈ Set.Icc a b, f c = y := by
  sorry

open Classical in
noncomputable abbrev f_9_7_1 : ℝ → ℝ := fun x ↦ if x ≤ 0 then -1 else 1

abbrev f_9_7_2 : ℝ → ℝ := fun x ↦ x^3 - x

theorem continuous_image_Icc' {a b : ℝ} (hab : a < b) {f : ℝ → ℝ} (hf : ContinuousOn f (.Icc a b)) : f '' .Icc a b = .Icc (sInf (f '' .Icc a b)) (sSup (f '' .Icc a b)) := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem exists_fixed_pt {f : ℝ → ℝ} (hf : ContinuousOn f (.Icc 0 1)) (hmap : f '' .Icc 0 1 ⊆ .Icc 0 1) : ∃ x ∈ Set.Icc 0 1, f x = x := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Exercise 9.7.2 (fixed point on `[0,1]`):
If `f : ℝ → ℝ` is continuous on `[0,1]` and maps `[0,1]` into itself,
then `f` has a fixed point in `[0,1]`. -/
theorem exists_fixed_pt
  {f : ℝ → ℝ}
  (hf : ContinuousOn f (Set.Icc 0 1))
  (hmap : f '' Set.Icc 0 1 ⊆ Set.Icc 0 1) :
  ∃ x ∈ Set.Icc 0 1, f x = x := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Data.Real.Basic
import Mathlib.Topology.Instances.Real
import Mathlib.Order.Filter.AtTopBot

/-- Definition 9.1.5.  Note that a slightly different `Real.adherent` was defined in Chapter 6.4 -/
abbrev Real.adherent' (ε:ℝ) (x:ℝ) (X: Set ℝ) := ∃ y ∈ X, |x - y| ≤ ε

namespace Chapter9

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

/-- Lemma 9.1.14 / Exercise 9.1.5 -/
theorem limit_of_AdherentPt (X: Set ℝ) (x:ℝ) :
  AdherentPt x X ↔ ∃ a : ℕ → ℝ, (∀ n, a n ∈ X) ∧ Filter.atTop.Tendsto a (nhds x) := by
end Chapter9
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

variable (I : Type*)

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

namespace Chapter9

-- <CONTEXT>
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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem limit_of_AdherentPt (X: Set ℝ) (x:ℝ) :
  AdherentPt x X ↔ ∃ a : ℕ → ℝ, (∀ n, a n ∈ X) ∧ Filter.atTop.Tendsto a (nhds x) := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench
theorem limit_of_AdherentPt (X : Set ℝ) (x : ℝ) :
  x ∈ closure X ↔
    ∃ a : ℕ → ℝ,
      (∀ n, a n ∈ X) ∧ Tendsto a atTop (nhds x) := by
end TaoBench
import Mathlib.Topology.Instances.Real
import Mathlib.Order.Monotone

namespace Chapter9

/-- Exercise 9.8.3 -/
theorem mono_of_continuous_inj {a b:ℝ} (h: a < b) {f:ℝ → ℝ}
  (hf: ContinuousOn f (.Icc a b))
  (hinj: Function.Injective (fun x: Set.Icc a b ↦ f x )) :
  StrictMonoOn f (.Icc a b) ∨ StrictAntiOn f (.Icc a b) := by
end Chapter9
import Mathlib
import Analysis.Section_9_6
import Analysis.Tags.Section_9_6

namespace Chapter9

-- <CONTEXT>
theorem MonotoneOn.iff {X: Set ℝ} (f: ℝ → ℝ) : MonotoneOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y ≥ f x := by
  sorry

theorem StrictMono.iff {X: Set ℝ} (f: ℝ → ℝ) : StrictMonoOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y > f x := by
  sorry

theorem AntitoneOn.iff {X: Set ℝ} (f: ℝ → ℝ) : AntitoneOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y ≤ f x := by
  sorry

theorem StrictAntitone.iff {X: Set ℝ} (f: ℝ → ℝ) : StrictAntiOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y < f x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem mono_of_continuous_inj {a b:ℝ} (h: a < b) {f:ℝ → ℝ}
  (hf: ContinuousOn f (.Icc a b))
  (hinj: Function.Injective (fun x: Set.Icc a b ↦ f x )) :
  StrictMonoOn f (.Icc a b) ∨ StrictAntiOn f (.Icc a b) := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Exercise 9.8.3 (Mathlib translation) -/
theorem mono_of_continuous_inj {a b : ℝ} (h : a < b) {f : ℝ → ℝ}
    (hf : ContinuousOn f (Set.Icc a b))
    (hinj : Function.Injective fun x : Set.Icc a b => f x) :
    StrictMonoOn f (Set.Icc a b) ∨ StrictAntiOn f (Set.Icc a b) := by
end TaoBench
import Mathlib.Data.Real.Basic
import Mathlib.Order.Monotone
import Mathlib.Data.Set.Intervals.Basic

namespace Chapter9

/-- Exercise 9.8.2 -/
theorem no_strictmono_intermediate_value :
    ∃ (a b : ℝ) (hab : a < b) (f : ℝ → ℝ)
      (hf : StrictMonoOn f (.Icc a b)),
      ¬ ∃ y, y ∈ Set.Icc (f a) (f b) ∨ y ∈ Set.Icc (f a) (f b) := by
end Chapter9
import Mathlib
import Analysis.Section_9_6
import Analysis.Tags.Section_9_6

namespace Chapter9

-- <CONTEXT>
theorem MonotoneOn.iff {X: Set ℝ} (f: ℝ → ℝ) : MonotoneOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y ≥ f x := by
  sorry

theorem StrictMono.iff {X: Set ℝ} (f: ℝ → ℝ) : StrictMonoOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y > f x := by
  sorry

theorem AntitoneOn.iff {X: Set ℝ} (f: ℝ → ℝ) : AntitoneOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y ≤ f x := by
  sorry

theorem StrictAntitone.iff {X: Set ℝ} (f: ℝ → ℝ) : StrictAntiOn f X  ↔ ∀ x ∈ X, ∀ y ∈ X, y > x → f y < f x := by
  sorry

theorem IsMaxOn.of_strictmono_on_compact {a b:ℝ} (h:a < b) {f:ℝ → ℝ} (hf: StrictMonoOn f (.Icc a b)) :
  ∃ xmax ∈ Set.Icc a b, IsMaxOn f (.Icc a b) xmax := by
  sorry

theorem IsMaxOn.of_antitone_on_compact {a b:ℝ} (h:a < b) {f:ℝ → ℝ} (hf: AntitoneOn f (.Icc a b)) :
  ∃ xmax ∈ Set.Icc a b, IsMaxOn f (.Icc a b) xmax := by
  sorry

theorem IsMaxOn.of_strictantitone_on_compact {a b:ℝ} (h:a < b) {f:ℝ → ℝ} (hf: StrictAntiOn f (.Icc a b)) :
  ∃ xmax ∈ Set.Icc a b, IsMaxOn f (.Icc a b) xmax := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem no_strictmono_intermediate_value : ∃ (a b:ℝ) (hab: a < b) (f:ℝ → ℝ) (hf: StrictMonoOn f (.Icc a b)), ¬ ∃ y, y ∈ Set.Icc (f a) (f b) ∨ y ∈ Set.Icc (f a) (f b) := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench
theorem no_strictmono_intermediate_value :
    ∃ (a b : ℝ) (hab : a < b) (f : ℝ → ℝ)
      (hf : StrictMonoOn f (Set.Icc a b)),
      ¬ ∃ y, y ∈ Set.Icc (f a) (f b) ∨ y ∈ Set.Icc (f a) (f b) := by
end TaoBench
import Mathlib
import Analysis.Section_6_4
import Analysis.Tags.Section_6_4

variable (I : Type*)

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

namespace Chapter9

-- <CONTEXT>
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
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem subset_closure (X:Set ℝ): X ⊆ closure X := by
-- </TARGET_THEOREM>

end Chapter9
import Mathlib.Tactic
import Mathlib.Analysis.Calculus.Deriv.Basic

namespace Chapter10

/-- Proposition 10.1.10 / Exercise 10.1.3 -/
theorem _root_.ContinuousWithinAt.of_differentiableWithinAt {X: Set ℝ} {x₀ : ℝ} {f: ℝ → ℝ}
  (h: DifferentiableWithinAt ℝ f X x₀) :
  ContinuousWithinAt f X x₀ := by
end Chapter10
import Mathlib

namespace Chapter10

-- <CONTEXT>
variable (x₀ : ℝ)

theorem _root_.HasDerivWithinAt.iff (X: Set ℝ) (x₀ : ℝ) (f: ℝ → ℝ)
  (L:ℝ) :
  HasDerivWithinAt f L X x₀ ↔ (nhdsWithin x₀ (X \ {x₀})).Tendsto (fun x ↦ (f x - f x₀) / (x - x₀))
   (nhds L) := by
  sorry

theorem _root_.DifferentiableWithinAt.iff (X: Set ℝ) (x₀ : ℝ) (f: ℝ → ℝ) :
  DifferentiableWithinAt ℝ f X x₀ ↔ ∃ L, HasDerivWithinAt f L X x₀ := by
  sorry

theorem _root_.DifferentiableWithinAt.of_hasDeriv {X: Set ℝ} {x₀ : ℝ} {f: ℝ → ℝ} {L:ℝ}
  (hL: HasDerivWithinAt f L X x₀) : DifferentiableWithinAt ℝ f X x₀ := by
  sorry

theorem derivative_unique {X: Set ℝ} {x₀ : ℝ}
  (hx₀: ClusterPt x₀ (.principal (X \ {x₀}))) {f: ℝ → ℝ} {L L':ℝ}
  (hL: HasDerivWithinAt f L X x₀) (hL': HasDerivWithinAt f L' X x₀) :
  L = L' := by
  sorry

theorem derivative_unique' (X: Set ℝ) {x₀ : ℝ}
  (hx₀: ClusterPt x₀ (.principal (X \ {x₀}))) {f: ℝ → ℝ} {L :ℝ}
  (hL: HasDerivWithinAt f L X x₀)
  (hdiff : DifferentiableWithinAt ℝ f X x₀):
  L = derivWithin f X x₀ := by
  sorry

abbrev f_10_1_6 : ℝ → ℝ := abs
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem _root_.ContinuousWithinAt.of_differentiableWithinAt {X: Set ℝ} {x₀ : ℝ} {f: ℝ → ℝ}
  (h: DifferentiableWithinAt ℝ f X x₀) :
  ContinuousWithinAt f X x₀ := by
-- </TARGET_THEOREM>

end Chapter10
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Proposition 10.1.10 / Exercise 10.1.3 -/
theorem _root_.ContinuousWithinAt.of_differentiableWithinAt
  {X : Set ℝ} {x₀ : ℝ} {f : ℝ → ℝ}
  (h : DifferentiableWithinAt ℝ f X x₀) :
  ContinuousWithinAt f X x₀ := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Analysis.Calculus.Deriv
import Mathlib.Data.Real.Basic
import Mathlib.Topology.Instances.Real

namespace Chapter10

/-- Proposition 10.5.1 (L'Hôpital's rule, I) / Exercise 10.5.1-/
theorem _root_.Filter.Tendsto.of_div {X: Set ℝ} {f g: ℝ → ℝ} {x₀ f'x₀ g'x₀:ℝ}
  (hfx₀: f x₀ = 0) (hgx₀: g x₀ = 0) (hg_non: g'x₀ ≠ 0)
  (hf'x₀: HasDerivWithinAt f f'x₀ X x₀) (hg'x₀: HasDerivWithinAt g g'x₀ X x₀) :
  (∃ δ > 0, ∀ x ∈ X \ {x₀} ∩ .Ioo (x₀ - δ) (x₀ + δ), g x ≠ 0) ∧
  (nhdsWithin x₀ (X \ {x₀})).Tendsto (fun x ↦ f x / g x) (nhds (f'x₀ / g'x₀))
  := by
end Chapter10
import Mathlib
import Analysis.Section_9_1
import Analysis.Tags.Section_9_1
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1
import Analysis.Section_10_2
import Analysis.Tags.Section_10_2

namespace Chapter10

-- <CONTEXT>
theorem _root_.Filter.Tendsto.of_div' {a b L: ℝ} (hab: a < b) {f g f' g': ℝ → ℝ}
  (hf: DifferentiableOn ℝ f (.Icc a b)) (hg: DifferentiableOn ℝ g (.Icc a b))
  (hf': f' = derivWithin f (.Icc a b)) (hg': g' = derivWithin g (.Icc a b))
  (hfa: f a = 0) (hga: g a = 0) (hgnon: ∀ x ∈ Set.Icc a b, g' x ≠ 0)
  (hderiv: (nhdsWithin a (.Icc a b)).Tendsto (fun x ↦ f' x / g' x) (nhds L)) :
  (∀ x ∈ Set.Ioc a b, g x ≠ 0) ∧
  (nhdsWithin a (.Ioc a b)).Tendsto (fun x ↦ f x / g x) (nhds L) := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem _root_.Filter.Tendsto.of_div {X: Set ℝ} {f g: ℝ → ℝ} {x₀ f'x₀ g'x₀: ℝ}
  (hfx₀: f x₀ = 0) (hgx₀: g x₀ = 0) (hg_non: g'x₀ ≠ 0)
  (hf'x₀: HasDerivWithinAt f f'x₀ X x₀) (hg'x₀: HasDerivWithinAt g g'x₀ X x₀) :
  (∃ δ > 0, ∀ x ∈ X \ {x₀} ∩ .Ioo (x₀ - δ) (x₀ + δ), g x ≠ 0) ∧
  (nhdsWithin x₀ (X \ {x₀})).Tendsto (fun x ↦ f x / g x) (nhds (f'x₀ / g'x₀))
  := by
-- </TARGET_THEOREM>

end Chapter10
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Proposition 10.5.1 (L'Hôpital's rule, I) / Exercise 10.5.1 -/
theorem _root_.Filter.Tendsto.of_div
  {X : Set ℝ} {f g : ℝ → ℝ} {x₀ f'x₀ g'x₀ : ℝ}
  (hfx₀ : f x₀ = 0) (hgx₀ : g x₀ = 0) (hg_non : g'x₀ ≠ 0)
  (hf'x₀ : HasDerivWithinAt f f'x₀ X x₀)
  (hg'x₀ : HasDerivWithinAt g g'x₀ X x₀) :
  (∃ δ > 0, ∀ x ∈ (X \ {x₀}) ∩ .Ioo (x₀ - δ) (x₀ + δ), g x ≠ 0) ∧
    (nhdsWithin x₀ (X \ {x₀})).Tendsto (fun x ↦ f x / g x) (nhds (f'x₀ / g'x₀)) := by
end TaoBench
import Mathlib.Tactic

open BigOperators
open Classical

namespace Finset

/-- Lemma 7.1.4(e) / Exercise 7.1.1 -/
theorem abs_finite_series_le {m n:ℤ} (a: ℤ → ℝ) :
  |∑ i ∈ Icc m n, a i| ≤ ∑ i ∈ Icc m n, |a i| := by
end Finset
import Mathlib

open BigOperators
open Classical

namespace Finset

-- <CONTEXT>
theorem sum_of_empty {n m:ℤ} (h: n < m) (a: ℤ → ℝ) : ∑ i ∈ Icc m n, a i = 0 := by
  sorry

theorem sum_of_nonempty {n m:ℤ} (h: n ≥ m-1) (a: ℤ → ℝ) :
    ∑ i ∈ Icc m (n+1), a i = ∑ i ∈ Icc m n, a i + a (n+1) := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem abs_finite_series_le {m n:ℤ} (a: ℤ → ℝ) :
  |∑ i ∈ Icc m n, a i| ≤ ∑ i ∈ Icc m n, |a i| := by
-- </TARGET_THEOREM>

end Finset
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Lemma 7.1.4(e) / Exercise 7.1.1 -/
theorem abs_finite_series_le {m n : ℤ} (a : ℤ → ℝ) :
  |∑ i ∈ Finset.Icc m n, a i| ≤ ∑ i ∈ Finset.Icc m n, |a i| := by
end TaoBench
import Mathlib.Tactic

open BigOperators
open Classical

namespace Finset

/-- Proposition 7.1.11(i) / Exercise 7.1.2 -/
theorem abs_finite_series_le' {X':Type*} (f: X' → ℝ) (X: Finset X') :
    |∑ x ∈ X, f x| ≤ ∑ x ∈ X, |f x| := by
end Finset