Documentation

Analysis.Section_4_3

Analysis I, Section 4.3: Absolute value and exponentiation #

I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.

Main constructions and results of this section:

Note: to avoid notational conflict, we are using the standard Mathlib definitions of absolute value and exponentiation. As such, it is possible to solve several of the exercises here rather easily using the Mathlib API for these operations. However, the spirit of the exercises is to solve these instead using the API provided in this section, as well as more basic Mathlib API for the rational numbers that does not reference either absolute value or exponentiation.

Tips from past users #

Users of the companion who have completed the exercises in this section are welcome to send their tips for future users in this section as PRs.

def Rat.Close (ε x y : ) :

This definition needs to be made outside of the Section 4.3 namespace for technical reasons.

Equations
Instances For
    @[reducible, inline]
    abbrev Section_4_3.abs (x : ) :

    Definition 4.3.1 (Absolute value)

    Equations
    Instances For
      theorem Section_4_3.abs_of_pos {x : } (hx : 0 < x) :
      abs x = x
      theorem Section_4_3.abs_of_neg {x : } (hx : x < 0) :
      abs x = -x

      Definition 4.3.1 (Absolute value)

      Definition 4.3.1 (Absolute value)

      theorem Section_4_3.abs_eq_abs (x : ) :
      abs x = |x|

      (Not from textbook) This definition of absolute value agrees with the Mathlib one. Henceforth we use the Mathlib absolute value.

      @[reducible, inline]
      abbrev Section_4_3.dist (x y : ) :
      Equations
      Instances For
        theorem Section_4_3.dist_eq (x y : ) :
        dist x y = |x - y|

        Definition 4.2 (Distance). We avoid the Mathlib notion of distance here because it is real-valued.

        theorem Section_4_3.abs_nonneg (x : ) :
        |x| 0

        Proposition 4.3.3(a) / Exercise 4.3.1

        theorem Section_4_3.abs_eq_zero_iff (x : ) :
        |x| = 0 x = 0

        Proposition 4.3.3(a) / Exercise 4.3.1

        theorem Section_4_3.abs_add (x y : ) :
        |x + y| |x| + |y|

        Proposition 4.3.3(b) / Exercise 4.3.1

        theorem Section_4_3.abs_le_iff (x y : ) :
        -y x x y |x| y

        Proposition 4.3.3(c) / Exercise 4.3.1

        theorem Section_4_3.le_abs (x : ) :
        -|x| x x |x|

        Proposition 4.3.3(c) / Exercise 4.3.1

        theorem Section_4_3.abs_mul (x y : ) :
        |x * y| = |x| * |y|

        Proposition 4.3.3(d) / Exercise 4.3.1

        theorem Section_4_3.abs_neg (x : ) :

        Proposition 4.3.3(d) / Exercise 4.3.1

        theorem Section_4_3.dist_nonneg (x y : ) :
        dist x y 0

        Proposition 4.3.3(e) / Exercise 4.3.1

        theorem Section_4_3.dist_eq_zero_iff (x y : ) :
        dist x y = 0 x = y

        Proposition 4.3.3(e) / Exercise 4.3.1

        theorem Section_4_3.dist_symm (x y : ) :
        dist x y = dist y x

        Proposition 4.3.3(f) / Exercise 4.3.1

        theorem Section_4_3.dist_le (x y z : ) :
        dist x z dist x y + dist y z

        Proposition 4.3.3(f) / Exercise 4.3.1

        theorem Section_4_3.close_iff (ε x y : ) :
        ε.Close x y |x - y| ε

        Definition 4.3.4 (eps-closeness). In the text the notion is undefined for ε zero or negative, but it is more convenient in Lean to assign a "junk" definition in this case. But this also allows some relaxations of hypotheses in the lemmas that follow.

        theorem Section_4_3.eq_if_close (x y : ) :
        x = y ε > 0, ε.Close x y

        Proposition 4.3.7(a) / Exercise 4.3.2

        theorem Section_4_3.close_symm (ε x y : ) :
        ε.Close x y ε.Close y x

        Proposition 4.3.7(b) / Exercise 4.3.2

        theorem Section_4_3.close_trans {ε δ x y z : } (hxy : ε.Close x y) (hyz : δ.Close y z) :
        (ε + δ).Close x z

        Proposition 4.3.7(c) / Exercise 4.3.2

        theorem Section_4_3.add_close {ε δ x y z w : } (hxy : ε.Close x y) (hzw : δ.Close z w) :
        (ε + δ).Close (x + z) (y + w)

        Proposition 4.3.7(d) / Exercise 4.3.2

        theorem Section_4_3.sub_close {ε δ x y z w : } (hxy : ε.Close x y) (hzw : δ.Close z w) :
        (ε + δ).Close (x - z) (y - w)

        Proposition 4.3.7(d) / Exercise 4.3.2

        theorem Section_4_3.close_mono {ε ε' x y : } (hxy : ε.Close x y) ( : ε' ε) :
        ε'.Close x y

        Proposition 4.3.7(e) / Exercise 4.3.2, slightly strengthened

        theorem Section_4_3.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

        Proposition 4.3.7(f) / Exercise 4.3.2

        theorem Section_4_3.close_mul_right {ε x y z : } (hxy : ε.Close x y) :
        (ε * |z|).Close (x * z) (y * z)

        Proposition 4.3.7(g) / Exercise 4.3.2

        theorem Section_4_3.close_mul_mul {ε δ x y z w : } (hxy : ε.Close x y) (hzw : δ.Close z w) :
        (ε * |z| + δ * |x| + ε * δ).Close (x * z) (y * w)

        Proposition 4.3.7(h) / Exercise 4.3.2

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

        This variant of Proposition 4.3.7(h) was not in the textbook, but can be useful in some later exercises.

        theorem Section_4_3.pow_zero (x : ) :
        x ^ 0 = 1

        Definition 4.3.9 (exponentiation). Here we use the Mathlib definition.

        theorem Section_4_3.pow_succ (x : ) (n : ) :
        x ^ (n + 1) = x ^ n * x

        Definition 4.3.9 (exponentiation). Here we use the Mathlib definition.

        theorem Section_4_3.pow_add (x : ) (m n : ) :
        x ^ n * x ^ m = x ^ (n + m)

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

        theorem Section_4_3.pow_mul (x : ) (m n : ) :
        (x ^ n) ^ m = x ^ (n * m)

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

        theorem Section_4_3.mul_pow (x y : ) (n : ) :
        (x * y) ^ n = x ^ n * y ^ n

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

        theorem Section_4_3.pow_eq_zero (x : ) (n : ) (hn : 0 < n) :
        x ^ n = 0 x = 0

        Proposition 4.3.10(b) (Properties of exponentiation, I) / Exercise 4.3.3

        theorem Section_4_3.pow_nonneg {x : } (n : ) (hx : x 0) :
        x ^ n 0

        Proposition 4.3.10(c) (Properties of exponentiation, I) / Exercise 4.3.3

        theorem Section_4_3.pow_pos {x : } (n : ) (hx : x > 0) :
        x ^ n > 0

        Proposition 4.3.10(c) (Properties of exponentiation, I) / Exercise 4.3.3

        theorem Section_4_3.pow_ge_pow (x y : ) (n : ) (hxy : x y) (hy : y 0) :
        x ^ n y ^ n

        Proposition 4.3.10(c) (Properties of exponentiation, I) / Exercise 4.3.3

        theorem Section_4_3.pow_gt_pow (x y : ) (n : ) (hxy : x > y) (hy : y 0) (hn : n > 0) :
        x ^ n > y ^ n

        Proposition 4.3.10(c) (Properties of exponentiation, I) / Exercise 4.3.3

        theorem Section_4_3.pow_abs (x : ) (n : ) :
        |x| ^ n = |x ^ n|

        Proposition 4.3.10(d) (Properties of exponentiation, I) / Exercise 4.3.3

        theorem Section_4_3.zpow_neg (x : ) (n : ) :
        x ^ (-n) = 1 / x ^ n

        Definition 4.3.11 (Exponentiation to a negative number). Here we use the Mathlib notion of integer exponentiation

        theorem Section_4_3.pow_eq_zpow (x : ) (n : ) :
        x ^ n = x ^ n
        theorem Section_4_3.zpow_add (x : ) (n m : ) (hx : x 0) :
        x ^ n * x ^ m = x ^ (n + m)

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

        theorem Section_4_3.zpow_mul (x : ) (n m : ) :
        (x ^ n) ^ m = x ^ (n * m)

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

        theorem Section_4_3.mul_zpow (x y : ) (n : ) :
        (x * y) ^ n = x ^ n * y ^ n

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

        theorem Section_4_3.zpow_pos {x : } (n : ) (hx : x > 0) :
        x ^ n > 0

        Proposition 4.3.12(b) (Properties of exponentiation, II) / Exercise 4.3.4

        theorem Section_4_3.zpow_ge_zpow {x y : } {n : } (hxy : x y) (hy : y > 0) (hn : n > 0) :
        x ^ n y ^ n

        Proposition 4.3.12(b) (Properties of exponentiation, II) / Exercise 4.3.4

        theorem Section_4_3.zpow_ge_zpow_ofneg {x y : } {n : } (hxy : x y) (hy : y > 0) (hn : n < 0) :
        x ^ n y ^ n
        theorem Section_4_3.zpow_inj {x y : } {n : } (hx : x > 0) (hy : y > 0) (hn : n 0) (hxy : x ^ n = y ^ n) :
        x = y

        Proposition 4.3.12(c) (Properties of exponentiation, II) / Exercise 4.3.4

        theorem Section_4_3.zpow_abs (x : ) (n : ) :
        |x| ^ n = |x ^ n|

        Proposition 4.3.12(d) (Properties of exponentiation, II) / Exercise 4.3.4

        theorem Section_4_3.two_pow_geq (N : ) :
        2 ^ N N

        Exercise 4.3.5