introvoyz041/TaoAnalysisBench huggingface dataset:
import Mathlib/Data/Real/Basic
import Mathlib/Topology/Basic
import Mathlib/Data/Set/Intervals/Basic
import Mathlib/Analysis/Calculus/Deriv

/-- Exercise 10.2.2 -/
theorem Exercise_10_2_2 :
    ∃ f : ℝ → ℝ,
      ContinuousOn f (.Icc (-1) 1) ∧
      IsMaxOn f (.Icc (-1) 1) 0 ∧
      ¬ DifferentiableWithinAt ℝ f (.Icc (-1) 1) 0 := by
import Mathlib
import Analysis.Section_9_6
import Analysis.Tags.Section_9_6

namespace Chapter10

-- <CONTEXT>
theorem IsLocalMaxOn.iff (X:Set ℝ) (f:ℝ → ℝ) (x₀:ℝ) :
  IsLocalMaxOn f X x₀ ↔
  ∃ δ > 0, IsMaxOn f (X ∩ .Ioo (x₀ - δ) (x₀ + δ)) x₀ := by
  sorry

theorem IsLocalMinOn.iff (X:Set ℝ) (f:ℝ → ℝ) (x₀:ℝ) :
  IsLocalMinOn f X x₀ ↔
  ∃ δ > 0, IsMinOn f (X ∩ .Ioo (x₀ - δ) (x₀ + δ)) x₀ := by
  sorry

abbrev f_10_2_3 : ℝ → ℝ := fun x ↦ x^2 - x^4

theorem IsLocalMaxOn.of_restrict {X Y:Set ℝ} (hXY: Y ⊆ X) (f:ℝ → ℝ) (x₀:ℝ)
  (h: IsLocalMaxOn f X x₀) : IsLocalMaxOn f Y x₀ := by
  sorry

theorem IsLocalMinOn.of_restrict {X Y:Set ℝ} (hXY: Y ⊆ X) (f:ℝ → ℝ) (x₀:ℝ)
  (h: IsLocalMinOn f X x₀) : IsLocalMinOn f Y x₀ := by
  sorry

theorem IsMaxOn.deriv_eq_zero_counter : ∃ (a b:ℝ) (hab: a < b) (f:ℝ → ℝ)
  (x₀:ℝ) (hx₀: x₀ ∈ Set.Icc a b) (h: IsMaxOn f (.Icc a b) x₀) (L:ℝ)
  (hderiv: HasDerivWithinAt f L (.Icc a b) x₀), L ≠ 0 := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_2_2 :
    ∃ f : ℝ → ℝ,
      ContinuousOn f (.Icc (-1) 1) ∧
      IsMaxOn f (.Icc (-1) 1) 0 ∧
      ¬ DifferentiableWithinAt ℝ f (.Icc (-1) 1) 0 := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.2.2.
There exists a real-valued function on `[-1, 1]` which is continuous on this interval,
attains a maximum there at `0`, but is not differentiable at `0` (even as a one-sided
derivative within the interval). -/
theorem Exercise_10_2_2 :
    ∃ f : ℝ → ℝ,
      ContinuousOn f (Icc (-1 : ℝ) 1) ∧
      IsMaxOn f (Icc (-1 : ℝ) 1) 0 ∧
      ¬ DifferentiableWithinAt ℝ f (Icc (-1 : ℝ) 1) 0 := by
end TaoBench
import Mathlib.Data.Real.Basic
import Mathlib.Data.Set.Intervals.Basic
import Mathlib.Topology.Algebra.Order
import Mathlib.Analysis.Calculus.Deriv

/-- Exercise 10.2.3 -/
theorem Exercise_10_2_3 :
    ∃ f : ℝ → ℝ,
      DifferentiableOn ℝ f (.Icc (-1) 1) ∧
      HasDerivWithinAt f 0 (.Ioo (-1) 1) 0 ∧
      ¬ IsLocalMaxOn f (.Icc (-1) 1) 0 ∧
      ¬ IsLocalMinOn f (.Icc (-1) 1) 0 := by
import Mathlib
import Analysis.Section_9_6
import Analysis.Tags.Section_9_6

namespace Chapter10

-- <CONTEXT>
theorem IsLocalMaxOn.iff (X:Set ℝ) (f:ℝ → ℝ) (x₀:ℝ) :
  IsLocalMaxOn f X x₀ ↔
  ∃ δ > 0, IsMaxOn f (X ∩ .Ioo (x₀ - δ) (x₀ + δ)) x₀ := by
  sorry

theorem IsLocalMinOn.iff (X:Set ℝ) (f:ℝ → ℝ) (x₀:ℝ) :
  IsLocalMinOn f X x₀ ↔
  ∃ δ > 0, IsMinOn f (X ∩ .Ioo (x₀ - δ) (x₀ + δ)) x₀ := by
  sorry

abbrev f_10_2_3 : ℝ → ℝ := fun x ↦ x^2 - x^4

theorem IsLocalMaxOn.of_restrict {X Y:Set ℝ} (hXY: Y ⊆ X) (f:ℝ → ℝ) (x₀:ℝ)
  (h: IsLocalMaxOn f X x₀) : IsLocalMaxOn f Y x₀ := by
  sorry

theorem IsLocalMinOn.of_restrict {X Y:Set ℝ} (hXY: Y ⊆ X) (f:ℝ → ℝ) (x₀:ℝ)
  (h: IsLocalMinOn f X x₀) : IsLocalMinOn f Y x₀ := by
  sorry

theorem IsMaxOn.deriv_eq_zero_counter : ∃ (a b:ℝ) (hab: a < b) (f:ℝ → ℝ)
  (x₀:ℝ) (hx₀: x₀ ∈ Set.Icc a b) (h: IsMaxOn f (.Icc a b) x₀) (L:ℝ)
  (hderiv: HasDerivWithinAt f L (.Icc a b) x₀), L ≠ 0 := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_2_3 :
    ∃ f : ℝ → ℝ,
      DifferentiableOn ℝ f (.Icc (-1) 1) ∧
      HasDerivWithinAt f 0 (.Ioo (-1) 1) 0 ∧
      ¬ IsLocalMaxOn f (.Icc (-1) 1) 0 ∧
      ¬ IsLocalMinOn f (.Icc (-1) 1) 0 := by
-- </TARGET_THEOREM>

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

namespace TaoBench
theorem Exercise_10_2_3 :
    ∃ f : ℝ → ℝ,
      DifferentiableOn ℝ f (Icc (-1 : ℝ) 1) ∧
      HasDerivWithinAt f 0 (Ioo (-1 : ℝ) 1) 0 ∧
      ¬ IsLocalMaxOn f (Icc (-1 : ℝ) 1) 0 ∧
      ¬ IsLocalMinOn f (Icc (-1 : ℝ) 1) 0 := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Data.Real.Basic
import Mathlib.Analysis.Calculus.Deriv
import Mathlib.Order.Monotone

/-- Exercise 10.3.3 -/
theorem Exercise_10_3_3 :
    ∃ f : ℝ → ℝ, StrictMono f ∧ Differentiable ℝ f ∧ deriv f 0 = 0 := by
import Mathlib

namespace Chapter10

-- <CONTEXT>
theorem derivative_of_antitone (X : Set ℝ) {x₀ : ℝ} (hx₀ : ClusterPt x₀ (.principal (X \ {x₀})))
  {f : ℝ → ℝ} (hmono : Antitone f) (hderiv : DifferentiableWithinAt ℝ f X x₀) :
    derivWithin f X x₀ ≤ 0 := by
  sorry

theorem strictAnti_of_negative_derivative {a b : ℝ} (hab : a < b) {f : ℝ → ℝ}
  (hderiv : DifferentiableOn ℝ f (.Icc a b)) (hneg : ∀ x ∈ Set.Ioo a b, derivWithin f (.Icc a b) x < 0) :
    StrictAntiOn f (.Icc a b) := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_3_3 :
    ∃ f : ℝ → ℝ, StrictMono f ∧ Differentiable ℝ f ∧ deriv f 0 = 0 := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.3.3.
There exists a strictly monotone function `f : ℝ → ℝ` which is differentiable over `ℝ`
and whose derivative at `0` is `0`. -/
theorem Exercise_10_3_3 :
    ∃ f : ℝ → ℝ, StrictMono f ∧ Differentiable ℝ f ∧ deriv f 0 = 0 := by
end TaoBench
import Mathlib.Data.Real.Basic
import Mathlib.Order.Monotone
import Mathlib.Analysis.Calculus.Deriv

namespace Chapter10

/-- Exercise 10.3.5 -/
theorem Exercise_10_3_5 :
    ∃ (X : Set ℝ) (f : ℝ → ℝ),
      DifferentiableOn ℝ f X ∧
      (∀ x ∈ X, derivWithin f X x > 0) ∧
      ¬ StrictMonoOn f X := by
end Chapter10
import Mathlib

namespace Chapter10

-- <CONTEXT>
theorem derivative_of_antitone (X:Set ℝ) {x₀:ℝ} (hx₀: ClusterPt x₀ (.principal (X \ {x₀})))
  {f:ℝ → ℝ} (hmono: Antitone f) (hderiv: DifferentiableWithinAt ℝ f X x₀) :
    derivWithin f X x₀ ≤ 0 := by
  sorry

theorem strictAnti_of_negative_derivative {a b:ℝ} (hab: a < b) {f:ℝ → ℝ}
  (hderiv: DifferentiableOn ℝ f (.Icc a b)) (hneg: ∀ x ∈ Set.Ioo a b, derivWithin f (.Icc a b) x < 0) :
    StrictAntiOn f (.Icc a b) := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_3_5 :
    ∃ (X : Set ℝ) (f : ℝ → ℝ),
      DifferentiableOn ℝ f X ∧
      (∀ x ∈ X, derivWithin f X x > 0) ∧
      ¬ StrictMonoOn f X := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.3.5 (Tao, Analysis I, §10.3).

There exists a subset `X ⊆ ℝ` and a function `f : ℝ → ℝ` such that
`f` is differentiable on `X` (in the sense of `DifferentiableOn` / `derivWithin`),
the derivative of `f` within `X` is strictly positive at every point of `X`,
but `f` is not strictly monotone on `X`. -/
theorem Exercise_10_3_5 :
    ∃ (X : Set ℝ) (f : ℝ → ℝ),
      DifferentiableOn ℝ f X ∧
      (∀ x ∈ X, derivWithin f X x > 0) ∧
      ¬ StrictMonoOn f X := by
end TaoBench
import Mathlib.Data.Real.Basic
import Mathlib.Topology.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.Real

/-- Exercise 10.4.1(a) -/
theorem Exercise_10_4_1_a {n:ℕ} (hn: n > 0) :
    ContinuousOn (fun x:ℝ ↦ x^(1/n:ℝ)) (.Ici 0) := by
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1

namespace Chapter10

-- <CONTEXT>
theorem _root_.HasDerivWithinAt.of_inverse {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ * f'x₀ = 1 := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse' {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ = 1/f'x₀ := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse_of_zero_deriv {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f 0 X x₀) :
  ¬ DifferentiableWithinAt ℝ g Y y₀ := by
  sorry

theorem inverse_function_theorem {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgYX: ∀ y ∈ Y, g y ∈ X)
  (hgf: ∀ x ∈ X, g (f x) = x) (hfg: ∀ y ∈ Y, f (g y) = y)
  {x₀ y₀ f'x₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀) (hne : f'x₀ ≠ 0)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: ContinuousWithinAt g Y y₀) :
    HasDerivWithinAt g (1/f'x₀) Y y₀ := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_4_1_a {n:ℕ} (hn: n > 0) : ContinuousOn (fun x:ℝ ↦ x^(1/n:ℝ)) (.Ici 0) := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.4.1(a) -/
theorem Exercise_10_4_1_a {n : ℕ} (hn : n > 0) :
  ContinuousOn (fun x : ℝ ↦ x ^ (1 / (n : ℝ))) (Ici (0 : ℝ)) := by
end TaoBench
import Mathlib/Tactic
import Mathlib/Analysis/Calculus/Derivative
import Mathlib/Analysis/SpecialFunctions/Pow
import Mathlib/Topology/Instances/Real
import Mathlib/Data/Set/Intervals/Basic

/-- Exercise 10.4.1(b) -/
theorem Exercise_10_4_1_b {n:ℕ} (hn: n > 0) {x:ℝ} (hx: x ∈ Set.Ici 0) :
    HasDerivWithinAt (fun x:ℝ ↦ x^(1/n:ℝ))
      ((n:ℝ)⁻¹ * x^((n:ℝ)⁻¹-1)) (.Ici 0) x := by
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1

namespace Chapter10

-- <CONTEXT>
theorem _root_.HasDerivWithinAt.of_inverse {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ * f'x₀ = 1 := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse' {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ = 1/f'x₀ := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse_of_zero_deriv {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f 0 X x₀) :
  ¬ DifferentiableWithinAt ℝ g Y y₀ := by
  sorry

theorem inverse_function_theorem {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgYX: ∀ y ∈ Y, g y ∈ X)
  (hgf: ∀ x ∈ X, g (f x) = x) (hfg: ∀ y ∈ Y, f (g y) = y)
  {x₀ y₀ f'x₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀) (hne : f'x₀ ≠ 0)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: ContinuousWithinAt g Y y₀) :
    HasDerivWithinAt g (1/f'x₀) Y y₀ := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_4_1_b {n:ℕ} (hn: n > 0) {x:ℝ} (hx: x ∈ Set.Ici 0) : HasDerivWithinAt (fun x:ℝ ↦ x^(1/n:ℝ))
  ((n:ℝ)⁻¹ * x^((n:ℝ)⁻¹-1)) (.Ici 0) x := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.4.1(b) -/
theorem Exercise_10_4_1_b {n : ℕ} (hn : n > 0) {x : ℝ} (hx : x ∈ Set.Ici 0) :
    HasDerivWithinAt (fun x : ℝ ↦ x ^ (1 / n : ℝ))
      ((n : ℝ)⁻¹ * x ^ ((n : ℝ)⁻¹ - 1)) (Set.Ici 0) x := by
end TaoBench
import Mathlib/Analysis/Calculus/Derivative
import Mathlib/Analysis/SpecialFunctions/Pow
import Mathlib/Data/Real/Basic
import Mathlib/Topology/Algebra/Order

/-- Exercise 10.4.2(a) -/
theorem Exercise_10_4_2_a (q:ℚ) {x:ℝ} (hx: x ∈ Set.Ici 0) :
  HasDerivWithinAt (fun x:ℝ ↦ x^(q:ℝ)) (q * x^(q-1:ℝ)) (.Ici 0) x := by
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1

namespace Chapter10

-- <CONTEXT>
theorem _root_.HasDerivWithinAt.of_inverse {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ * f'x₀ = 1 := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse' {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ = 1/f'x₀ := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse_of_zero_deriv {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f 0 X x₀) :
  ¬ DifferentiableWithinAt ℝ g Y y₀ := by
  sorry

theorem inverse_function_theorem {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgYX: ∀ y ∈ Y, g y ∈ X)
  (hgf: ∀ x ∈ X, g (f x) = x) (hfg: ∀ y ∈ Y, f (g y) = y)
  {x₀ y₀ f'x₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀) (hne : f'x₀ ≠ 0)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: ContinuousWithinAt g Y y₀) :
    HasDerivWithinAt g (1/f'x₀) Y y₀ := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_4_2_a (q:ℚ) {x:ℝ} (hx: x ∈ Set.Ici 0) :
  HasDerivWithinAt (fun x:ℝ ↦ x^(q:ℝ)) (q * x^(q-1:ℝ)) (.Ici 0) x := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.4.2(a) -/
theorem Exercise_10_4_2_a (q : ℚ) {x : ℝ} (hx : x ∈ Set.Ici (0 : ℝ)) :
  HasDerivWithinAt (fun x : ℝ ↦ x ^ (q : ℝ)) (q * x ^ ((q - 1 : ℚ) : ℝ)) (Set.Ici (0 : ℝ)) x := by
end TaoBench
import Mathlib/Topology/Instances/Real
import Mathlib/Topology/Instances/Rational
import Mathlib/Analysis/SpecialFunctions/Pow/Real

noncomputable section

/-- Exercise 10.4.2(b) -/
theorem Exercise_10_4_2_ba (q : ℚ) :
    (nhdsWithin 1 (.Ici 0 \ {1})).Tendsto (fun x : ℝ ↦ (x^(q:ℝ) - 1) / (x - 1)) (nhds q) := by
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1

namespace Chapter10

-- <CONTEXT>
theorem _root_.HasDerivWithinAt.of_inverse {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ * f'x₀ = 1 := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse' {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ = 1/f'x₀ := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse_of_zero_deriv {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f 0 X x₀) :
  ¬ DifferentiableWithinAt ℝ g Y y₀ := by
  sorry

theorem inverse_function_theorem {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgYX: ∀ y ∈ Y, g y ∈ X)
  (hgf: ∀ x ∈ X, g (f x) = x) (hfg: ∀ y ∈ Y, f (g y) = y)
  {x₀ y₀ f'x₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀) (hne : f'x₀ ≠ 0)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: ContinuousWithinAt g Y y₀) :
    HasDerivWithinAt g (1/f'x₀) Y y₀ := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_4_2_ba (q : ℚ) :
    (nhdsWithin 1 (.Ici 0 \ {1})).Tendsto (fun x : ℝ ↦ (x^(q:ℝ) - 1) / (x - 1)) (nhds q) := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.4.2(b) -/
theorem Exercise_10_4_2_ba (q : ℚ) :
  Tendsto (fun x : ℝ ↦ (x^(q : ℝ) - 1) / (x - 1))
    (nhdsWithin (1 : ℝ) (Ici (0 : ℝ) \ {1}))
    (nhds (q : ℝ)) := by
end TaoBench
import Mathlib/Analysis/Calculus/Deriv
import Mathlib/Analysis/SpecialFunctions/Log
import Mathlib/Data/Real/Basic

namespace Chapter10

/-- Exercise 10.4.2(b) -/
theorem Exercise_10_4_2_bb (α:ℝ) {x:ℝ} (hx: x ∈ Set.Ici 0) :
  HasDerivWithinAt (fun x:ℝ ↦ x^α) (α * x^(α-1)) (.Ici 0) x := by
end Chapter10
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1

namespace Chapter10

-- <CONTEXT>
theorem _root_.HasDerivWithinAt.of_inverse {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ * f'x₀ = 1 := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse' {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ = 1/f'x₀ := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse_of_zero_deriv {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f 0 X x₀) :
  ¬ DifferentiableWithinAt ℝ g Y y₀ := by
  sorry

theorem inverse_function_theorem {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgYX: ∀ y ∈ Y, g y ∈ X)
  (hgf: ∀ x ∈ X, g (f x) = x) (hfg: ∀ y ∈ Y, f (g y) = y)
  {x₀ y₀ f'x₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀) (hne : f'x₀ ≠ 0)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: ContinuousWithinAt g Y y₀) :
    HasDerivWithinAt g (1/f'x₀) Y y₀ := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_4_2_bb (α:ℝ) {x:ℝ} (hx: x ∈ Set.Ici 0) :
  HasDerivWithinAt (fun x:ℝ ↦ x^α) (α * x^(α-1)) (.Ici 0) x := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.4.2(b) -/
theorem Exercise_10_4_2_bb (α : ℝ) {x : ℝ} (hx : x ∈ Set.Ici 0) :
  HasDerivWithinAt (fun x : ℝ ↦ x ^ α) (α * x ^ (α - 1)) (.Ici 0) x := by
end TaoBench
import Mathlib/Topology/Instances/Real
import Mathlib/Analysis/SpecialFunctions/Pow
import Mathlib/Data/Set/Lattice
import Mathlib/Tactic

namespace Chapter10

/-- Exercise 10.4.3(a) -/
theorem Exercise_10_4_3_a (α:ℝ) :
    (nhdsWithin 1 (.Ici 0 \ {1})).Tendsto (fun x:ℝ ↦ (x^α - 1^α) / (x - 1)) (nhds α) := by
end Chapter10
import Mathlib
import Analysis.Section_9_3
import Analysis.Tags.Section_9_3
import Analysis.Section_9_4
import Analysis.Tags.Section_9_4
import Analysis.Section_10_1
import Analysis.Tags.Section_10_1

namespace Chapter10

-- <CONTEXT>
theorem _root_.HasDerivWithinAt.of_inverse {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ * f'x₀ = 1 := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse' {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀ f'x₀ g'y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: HasDerivWithinAt g g'y₀ Y y₀) :
  g'y₀ = 1/f'x₀ := by
  sorry

theorem _root_.HasDerivWithinAt.of_inverse_of_zero_deriv {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgf: ∀ x ∈ X, g (f x) = x)
  {x₀ y₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f 0 X x₀) :
  ¬ DifferentiableWithinAt ℝ g Y y₀ := by
  sorry

theorem inverse_function_theorem {X Y: Set ℝ} {f: ℝ → ℝ} {g:ℝ → ℝ}
  (hfXY: ∀ x ∈ X, f x ∈ Y) (hgYX: ∀ y ∈ Y, g y ∈ X)
  (hgf: ∀ x ∈ X, g (f x) = x) (hfg: ∀ y ∈ Y, f (g y) = y)
  {x₀ y₀ f'x₀: ℝ} (hx₀: x₀ ∈ X) (hfx₀: f x₀ = y₀) (hne : f'x₀ ≠ 0)
  (hcluster: ClusterPt x₀ (.principal (X \ {x₀})))
  (hf: HasDerivWithinAt f f'x₀ X x₀) (hg: ContinuousWithinAt g Y y₀) :
    HasDerivWithinAt g (1/f'x₀) Y y₀ := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem Exercise_10_4_3_a (α:ℝ) :
    (nhdsWithin 1 (.Ici 0 \ {1})).Tendsto (fun x:ℝ ↦ (x^α - 1^α) / (x - 1)) (nhds α) := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Exercise 10.4.3(a) -/
theorem Exercise_10_4_3_a (α : ℝ) :
  Tendsto (fun x : ℝ ↦ (x ^ α - 1 ^ α) / (x - 1))
    (nhdsWithin 1 (Ici (0 : ℝ) \ {1}))
    (nhds α) := by
end TaoBench
import Mathlib/Analysis/Calculus/Deriv/Basic

namespace Chapter10

/-- Proposition 10.2.6 (Local extrema are stationary) / Exercise 10.2.1 -/
theorem IsLocalMaxOn.deriv_eq_zero {a b:ℝ} (hab: a < b) {f:ℝ → ℝ} {x₀:ℝ}
  (hx₀: x₀ ∈ Set.Ioo a b) (h: IsLocalMaxOn f (.Ioo a b) x₀) {L:ℝ}
  (hderiv: HasDerivWithinAt f L (.Ioo a b) x₀) : L = 0 := by
end Chapter10
import Mathlib
import Analysis.Section_9_6
import Analysis.Tags.Section_9_6

namespace Chapter10

-- <CONTEXT>
theorem IsLocalMaxOn.iff (X:Set ℝ) (f:ℝ → ℝ) (x₀:ℝ) :
  IsLocalMaxOn f X x₀ ↔
  ∃ δ > 0, IsMaxOn f (X ∩ .Ioo (x₀ - δ) (x₀ + δ)) x₀ := by
  sorry

theorem IsLocalMinOn.iff (X:Set ℝ) (f:ℝ → ℝ) (x₀:ℝ) :
  IsLocalMinOn f X x₀ ↔
  ∃ δ > 0, IsMinOn f (X ∩ .Ioo (x₀ - δ) (x₀ + δ)) x₀ := by
  sorry

abbrev f_10_2_3 : ℝ → ℝ := fun x ↦ x^2 - x^4

theorem IsLocalMaxOn.of_restrict {X Y:Set ℝ} (hXY: Y ⊆ X) (f:ℝ → ℝ) (x₀:ℝ)
  (h: IsLocalMaxOn f X x₀) : IsLocalMaxOn f Y x₀ := by
  sorry

theorem IsLocalMinOn.of_restrict {X Y:Set ℝ} (hXY: Y ⊆ X) (f:ℝ → ℝ) (x₀:ℝ)
  (h: IsLocalMinOn f X x₀) : IsLocalMinOn f Y x₀ := by
  sorry

theorem IsMaxOn.deriv_eq_zero_counter : ∃ (a b:ℝ) (hab: a < b) (f:ℝ → ℝ)
  (x₀:ℝ) (hx₀: x₀ ∈ Set.Icc a b) (h: IsMaxOn f (.Icc a b) x₀) (L:ℝ)
  (hderiv: HasDerivWithinAt f L (.Icc a b) x₀), L ≠ 0 := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem IsLocalMaxOn.deriv_eq_zero {a b:ℝ} (hab: a < b) {f:ℝ → ℝ} {x₀:ℝ}
  (hx₀: x₀ ∈ Set.Ioo a b) (h: IsLocalMaxOn f (.Ioo a b) x₀) {L:ℝ}
  (hderiv: HasDerivWithinAt f L (.Ioo a b) x₀) : L = 0 := by
-- </TARGET_THEOREM>

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

namespace TaoBench

namespace Chapter10

/-- Proposition 10.2.6 (Local extrema are stationary) / Exercise 10.2.1 -/
theorem IsLocalMaxOn.deriv_eq_zero {a b : ℝ} (hab : a < b) {f : ℝ → ℝ} {x0 : ℝ}
  (hx0 : x0 ∈ Set.Ioo a b) (h : IsLocalMaxOn f (Set.Ioo a b) x0) {L : ℝ}
  (hderiv : HasDerivWithinAt f L (Set.Ioo a b) x0) : L = 0 := by
end Chapter10

end TaoBench