introvoyz041/TaoAnalysisBench huggingface dataset:
import Mathlib

def Rat.Close (ε : ℚ) (x y : ℚ) := |x - y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x : ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x : ℚ} (hx : 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x : ℚ} (hx : x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x : ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y : ℚ) : dist x y = |x - y| := by
  sorry

theorem close_iff (ε x y : ℚ) : ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x : ℚ) : (0 : ℚ).Close x x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem add_close {ε δ x y z w : ℚ} (hxy : ε.Close x y) (hzw : δ.Close z w) :
    (ε + δ).Close (x + z) (y + w) := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.7(d) / Exercise 4.3.2 (Mathlib version). -/
theorem add_close {ε δ x y z w : ℚ}
    (hxy : |x - y| ≤ ε) (hzw : |z - w| ≤ δ) :
    |(x + z) - (y + w)| ≤ ε + δ := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Data.Rat.Order
import Mathlib.Data.Real.Basic

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε


namespace Section_4_3

/-- Proposition 4.3.7(f) / Exercise 4.3.2 -/
theorem close_between {ε x y z w:ℚ} (hxy: ε.Close x y) (hxz: ε.Close x z)
  (hbetween: (y ≤ w ∧ w ≤ z) ∨ (z ≤ w ∧ w ≤ y)) : ε.Close x w := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by sorry

theorem abs_of_zero : abs 0 = 0 := by sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem close_between {ε x y z w:ℚ} (hxy: ε.Close x y) (hxz: ε.Close x z)
  (hbetween: (y ≤ w ∧ w ≤ z) ∨ (z ≤ w ∧ w ≤ y)) : ε.Close x w := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-
Mathematically: if |x - y| ≤ ε and |x - z| ≤ ε and w lies between y and z
(in either order), then |x - w| ≤ ε.
-/
theorem close_between {ε x y z w : ℚ}
    (hxy : |x - y| ≤ ε) (hxz : |x - z| ≤ ε)
    (hbetween : (y ≤ w ∧ w ≤ z) ∨ (z ≤ w ∧ w ≤ y)) :
    |x - w| ≤ ε := by
end TaoBench
import Mathlib.Tactic

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε


namespace Section_4_3

/-- Proposition 4.3.7(e) / Exercise 4.3.2, slightly strengthened -/
theorem close_mono {ε ε' x y:ℚ} (hxy: ε.Close x y) (hε: ε' ≥  ε) :
    ε'.Close x y := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry

-- </CONTEXT>
-- <TARGET_THEOREM>
theorem close_mono {ε ε' x y:ℚ} (hxy: ε.Close x y) (hε: ε' ≥  ε) :
    ε'.Close x y := by
  sorry
-- </TARGET_THEOREM>

theorem close_mul_mul' {ε δ x y z w:ℚ} (hxy: ε.Close x y) (hzw: δ.Close z w) :
    (ε*|z|+δ*|y|).Close (x * z) (y * w) := by
  sorry

lemma pow_zero (x:ℚ) : x^0 = 1 := by
  sorry

lemma pow_succ (x:ℚ) (n:ℕ) : x^(n+1) = x^n * x := by
  sorry

theorem zpow_neg (x:ℚ) (n:ℕ) : x^(-(n:ℤ)) = 1/(x^n) := by
  sorry

theorem pow_eq_zpow (x:ℚ) (n:ℕ): x^(n:ℤ) = x^n := by
  sorry
theorem zpow_ge_zpow_ofneg {x y:ℚ} {n:ℤ} (hxy: x ≥ y) (hy: y > 0) (hn: n < 0) : x^n ≤ y^n := by
end Section_4_3
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat Set Filter

namespace TaoBench

/-- Monotonicity of Tao's `Close` relation on ℚ in the tolerance parameter. -/
theorem close_mono {ε ε' x y : ℚ} (hxy : |x - y| ≤ ε) (hε : ε' ≥ ε) :
    |x - y| ≤ ε' := by
end TaoBench
import Mathlib.Tactic
import Mathlib.Data.Rat.Order

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

/-- Proposition 4.3.7(h) / Exercise 4.3.2 -/
theorem close_mul_mul {ε δ x y z w:ℚ} (hxy: ε.Close x y) (hzw: δ.Close z w) :
    (ε*|z|+δ*|x|+ε*δ).Close (x * z) (y * w) := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y : ℚ) := |x - y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x : ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x : ℚ} (hx : 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x : ℚ} (hx : x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x : ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y : ℚ) : dist x y = |x - y| := by
  sorry

theorem close_iff (ε x y : ℚ) : ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x : ℚ) : (0 : ℚ).Close x x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem close_mul_mul {ε δ x y z w : ℚ} (hxy : ε.Close x y) (hzw : δ.Close z w) :
    (ε * |z| + δ * |x| + ε * δ).Close (x * z) (y * w) := by
-- </TARGET_THEOREM>

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

namespace TaoBench

namespace Section_4_3

/-- Proposition 4.3.7(h) / Exercise 4.3.2 (Tao, *Analysis I*).

If `|x - y| ≤ ε` and `|z - w| ≤ δ` for rationals `x y z w ε δ`,
then
`|x * z - y * w| ≤ ε * |z| + δ * |x| + ε * δ`. -/
theorem close_mul_mul {ε δ x y z w : ℚ}
    (hxy : |x - y| ≤ ε) (hzw : |z - w| ≤ δ) :
    |x * z - y * w| ≤ ε * |z| + δ * |x| + ε * δ := by
end Section_4_3

end TaoBench
import Mathlib.Tactic

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x - y| ≤ ε

namespace Section_4_3

/-- Proposition 4.3.7(g) / Exercise 4.3.2 -/
theorem close_mul_right {ε x y z:ℚ} (hxy: ε.Close x y) :
    (ε*|z|).Close (x * z) (y * z) := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem close_mul_right {ε x y z:ℚ} (hxy: ε.Close x y) :
    (ε*|z|).Close (x * z) (y * z) := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Mathlib translation of Tao's Proposition 4.3.7(g) / Exercise 4.3.2. -/
theorem close_mul_right {ε x y z : ℚ} (hxy : |x - y| ≤ ε) :
    |x * z - y * z| ≤ ε * |z| := by
end TaoBench
import Mathlib.Tactic

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

/-- Proposition 4.3.7(b) / Exercise 4.3.2 -/
theorem close_symm (ε x y:ℚ) : ε.Close x y ↔ ε.Close y x := by
end Section_4_3
import Mathlib

namespace Section_4_3

-- <CONTEXT>
def _root_.Rat.Close (ε : ℚ) (x y : ℚ) := |x - y| ≤ ε

abbrev abs (x : ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x : ℚ} (hx : 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x : ℚ} (hx : x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x : ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y : ℚ) : dist x y = |x - y| := by
  sorry

theorem close_iff (ε x y : ℚ) : ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x : ℚ) : (0 : ℚ).Close x x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem close_symm (ε x y : ℚ) : ε.Close x y ↔ ε.Close y x := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.7(b) / Exercise 4.3.2 -/
theorem close_symm (ε x y : ℚ) :
    |x - y| ≤ ε ↔ |y - x| ≤ ε := by
end TaoBench
import Mathlib.Tactic

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε


namespace Section_4_3

/-- Proposition 4.3.7(c) / Exercise 4.3.2 -/
theorem close_trans {ε δ x y z:ℚ} (hxy: ε.Close x y) (hyz: δ.Close y z) :
    (ε + δ).Close x z := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y : ℚ) := |x - y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x : ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x : ℚ} (hx : 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x : ℚ} (hx : x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x : ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y : ℚ) : dist x y = |x - y| := by
  sorry

theorem close_iff (ε x y : ℚ) : ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x : ℚ) : (0 : ℚ).Close x x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem close_trans {ε δ x y z : ℚ} (hxy : ε.Close x y) (hyz : δ.Close y z) :
    (ε + δ).Close x z := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/- Mathlib translation of Section_4_3.close_trans -/
theorem close_trans {ε δ x y z : ℚ}
    (hxy : |x - y| ≤ ε) (hyz : |y - z| ≤ δ) :
    |x - z| ≤ ε + δ := by
end TaoBench
import Mathlib.Data.Rat.Basic

namespace Section_4_3

abbrev dist (x y : ℚ) := |x - y|

/-- Proposition 4.3.3(e) / Exercise 4.3.1 -/
theorem dist_eq_zero_iff (x y:ℚ) : dist x y = 0 ↔ x = y := by
end Section_4_3
import Mathlib

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem dist_eq_zero_iff (x y:ℚ) : dist x y = 0 ↔ x = y := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.3(e) / Exercise 4.3.1 -/
theorem dist_eq_zero_iff (x y : ℚ) : |x - y| = 0 ↔ x = y := by
end TaoBench
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem dist_le (x y z:ℚ) : dist x z ≤ dist x y + dist y z := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.3(f) / Exercise 4.3.1 -/
theorem dist_le (x y z : ℚ) : |x - z| ≤ |x - y| + |y - z| := by
end TaoBench
import Mathlib

-- <CONTEXT>
def Rat.Close (ε : ℚ) (x y : ℚ) := |x - y| ≤ ε

namespace Section_4_3

abbrev abs (x : ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x : ℚ} (hx : 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x : ℚ} (hx : x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x : ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y : ℚ) : dist x y = |x - y| := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem dist_nonneg (x y : ℚ) : dist x y ≥ 0 := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.3(e) / Exercise 4.3.1 -/
theorem dist_nonneg (x y : ℚ) : |x - y| ≥ 0 := by
end TaoBench
import Mathlib.Data.Rat.Basic
import Mathlib.Algebra.Order.Ring.Abs

namespace Section_4_3

abbrev dist (x y : ℚ) := |x - y|

/-- Proposition 4.3.3(f) / Exercise 4.3.1 -/
theorem dist_symm (x y:ℚ) : dist x y = dist y x := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem dist_symm (x y:ℚ) : dist x y = dist y x := by
-- </TARGET_THEOREM>

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

namespace TaoBench

namespace Section_4_3

/-- Proposition 4.3.3(f) / Exercise 4.3.1 -/
theorem dist_symm (x y : ℚ) : |x - y| = |y - x| := by
end Section_4_3

end TaoBench
import Mathlib.Tactic

/--
  This definition needs to be made outside of the Section 4.3 namespace for technical reasons.
-/
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

/-- Proposition 4.3.7(a) / Exercise 4.3.2 -/
theorem eq_if_close (x y:ℚ) : x = y ↔ ∀ ε:ℚ, ε > 0 → ε.Close x y := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem eq_if_close (x y:ℚ) : x = y ↔ ∀ ε:ℚ, ε > 0 → ε.Close x y := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.7(a) / Exercise 4.3.2 -/
theorem eq_if_close (x y : ℚ) :
    x = y ↔ ∀ ε : ℚ, ε > 0 → |x - y| ≤ ε := by
end TaoBench
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem le_abs (x:ℚ) : -|x| ≤ x ∧ x ≤ |x| := by
-- </TARGET_THEOREM>

end Section_4_3
import Mathlib.Tactic
import Mathlib.Data.Rat.Basic

namespace Section_4_3

/-- Proposition 4.3.10(a) (Properties of exponentiation, I) / Exercise 4.3.3 -/
theorem mul_pow (x y:ℚ) (n:ℕ) : (x*y)^n = x^n * y^n := by
end Section_4_3
import Mathlib

-- <CONTEXT>
def Rat.Close (ε : ℚ) (x y : ℚ) := |x - y| ≤ ε

namespace Section_4_3

abbrev abs (x : ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x : ℚ} (hx : 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x : ℚ} (hx : x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x : ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y : ℚ) : dist x y = |x - y| := by
  sorry

theorem close_iff (ε x y : ℚ) : ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x : ℚ) : (0 : ℚ).Close x x := by
  sorry

theorem close_mul_mul' {ε δ x y z w : ℚ} (hxy : ε.Close x y) (hzw : δ.Close z w) :
    (ε * |z| + δ * |y|).Close (x * z) (y * w) := by
  sorry

lemma pow_zero (x : ℚ) : x ^ 0 = 1 := by
  sorry

lemma pow_succ (x : ℚ) (n : ℕ) : x ^ (n + 1) = x ^ n * x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem mul_pow (x y : ℚ) (n : ℕ) : (x * y) ^ n = x ^ n * y ^ n := by
-- </TARGET_THEOREM>

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

namespace TaoBench

namespace Section_4_3

/-- Proposition 4.3.10(a) (Properties of exponentiation, I) / Exercise 4.3.3.

For rational numbers `x, y` and a natural number `n`, the `n`-th power of the
product equals the product of the `n`-th powers. -/
theorem mul_pow (x y : ℚ) (n : ℕ) : (x * y)^n = x^n * y^n := by
end Section_4_3

end TaoBench
import Mathlib.Data.Rat.Basic
import Mathlib.Algebra.GroupPower

namespace Section_4_3

/-- Proposition 4.3.12(a) (Properties of exponentiation, II) / Exercise 4.3.4 -/
theorem mul_zpow (x y:ℚ) (n:ℤ) : (x*y)^n = x^n * y^n := by
end Section_4_3
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry

theorem close_mul_mul' {ε δ x y z w:ℚ} (hxy: ε.Close x y) (hzw: δ.Close z w) :
    (ε*|z|+δ*|y|).Close (x * z) (y * w) := by
    sorry

lemma pow_zero (x:ℚ) : x^0 = 1 := by
  sorry

lemma pow_succ (x:ℚ) (n:ℕ) : x^(n+1) = x^n * x := by
  sorry

theorem zpow_neg (x:ℚ) (n:ℕ) : x^(-(n:ℤ)) = 1/(x^n) := by
  sorry

theorem pow_eq_zpow (x:ℚ) (n:ℕ): x^(n:ℤ) = x^n := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem mul_zpow (x y:ℚ) (n:ℤ) : (x*y)^n = x^n * y^n := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.12(a) (Properties of exponentiation, II) / Exercise 4.3.4.

Mathematically: for rational numbers `x, y` and an integer `n`, the integer power
(respectively `zpow` in Mathlib) is multiplicative:
`(x * y) ^ n = x ^ n * y ^ n`. -/
theorem mul_zpow (x y : ℚ) (n : ℤ) :
    (x * y) ^ n = x ^ n * y ^ n := by
end TaoBench
import Mathlib

def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

-- <CONTEXT>
abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry

theorem close_mul_mul' {ε δ x y z w:ℚ} (hxy: ε.Close x y) (hzw: δ.Close z w) :
    (ε*|z|+δ*|y|).Close (x * z) (y * w) := by
  sorry

lemma pow_zero (x:ℚ) : x^0 = 1 := by
  sorry

lemma pow_succ (x:ℚ) (n:ℕ) : x^(n+1) = x^n * x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem pow_abs (x:ℚ) (n:ℕ) : |x|^n = |x^n| := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.10(d) (Properties of exponentiation, I) / Exercise 4.3.3 -/
theorem pow_abs (x : ℚ) (n : ℕ) : |x| ^ n = |x ^ n| := by
end TaoBench
import Mathlib.Data.Rat.Basic
import Mathlib.Algebra.GroupPower

namespace Section_4_3

/-- Proposition 4.3.10(a) (Properties of exponentiation, I) / Exercise 4.3.3 -/
theorem pow_add (x:ℚ) (m n:ℕ) : x^n * x^m = x^(n+m) := by
end Section_4_3
import Mathlib

-- <CONTEXT>
def Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

namespace Section_4_3

abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry

theorem close_mul_mul' {ε δ x y z w:ℚ} (hxy: ε.Close x y) (hzw: δ.Close z w) :
    (ε*|z|+δ*|y|).Close (x * z) (y * w) := by
  sorry

lemma pow_zero (x:ℚ) : x^0 = 1 := by
  sorry

lemma pow_succ (x:ℚ) (n:ℕ) : x^(n+1) = x^n * x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem pow_add (x:ℚ) (m n:ℕ) : x^n * x^m = x^(n+m) := by
-- </TARGET_THEOREM>

end Section_4_3
import Mathlib.Data.Rat.Basic
import Mathlib.Algebra.GroupPower

namespace Section_4_3

/-- Proposition 4.3.10(b) (Properties of exponentiation, I) / Exercise 4.3.3 -/
theorem pow_eq_zero (x:ℚ) (n:ℕ) (hn : 0 < n) : x^n = 0 ↔ x = 0 := by
end Section_4_3
import Mathlib

namespace Section_4_3

-- <CONTEXT>
def _root_.Rat.Close (ε : ℚ) (x y:ℚ) := |x-y| ≤ ε

abbrev abs (x:ℚ) : ℚ := if x > 0 then x else (if x < 0 then -x else 0)

theorem abs_of_pos {x: ℚ} (hx: 0 < x) : abs x = x := by
  sorry

theorem abs_of_neg {x: ℚ} (hx: x < 0) : abs x = -x := by
  sorry

theorem abs_of_zero : abs 0 = 0 := by
  sorry

theorem abs_eq_abs (x: ℚ) : abs x = |x| := by
  sorry

abbrev dist (x y : ℚ) := |x - y|

theorem dist_eq (x y: ℚ) : dist x y = |x-y| := by
  sorry

theorem close_iff (ε x y:ℚ): ε.Close x y ↔ |x - y| ≤ ε := by
  sorry

theorem close_refl (x:ℚ) : (0:ℚ).Close x x := by
  sorry

theorem close_mul_mul' {ε δ x y z w:ℚ} (hxy: ε.Close x y) (hzw: δ.Close z w) :
    (ε*|z|+δ*|y|).Close (x * z) (y * w) := by
    sorry

lemma pow_zero (x:ℚ) : x^0 = 1 := by
  sorry

lemma pow_succ (x:ℚ) (n:ℕ) : x^(n+1) = x^n * x := by
  sorry
-- </CONTEXT>
-- <TARGET_THEOREM>
theorem pow_eq_zero (x:ℚ) (n:ℕ) (hn : 0 < n) : x^n = 0 ↔ x = 0 := by
-- </TARGET_THEOREM>

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

namespace TaoBench

/-- Proposition 4.3.10(b) (Properties of exponentiation, I) / Exercise 4.3.3 -/
theorem pow_eq_zero (x : ℚ) (n : ℕ) (hn : 0 < n) : x ^ n = 0 ↔ x = 0 := by
end TaoBench