Documentation

Mathlib.Analysis.SpecialFunctions.Log.Basic

Real logarithm #

In this file we define Real.log to be the logarithm of a real number. As usual, we extend it from its domain (0, +โˆž) to a globally defined function. We choose to do it so that log 0 = 0 and log (-x) = log x.

We prove some basic properties of this function and show that it is continuous.

Tags #

logarithm, continuity

noncomputable def Real.log (x : โ„) :

The real logarithm function, equal to the inverse of the exponential for x > 0, to log |x| for x < 0, and to 0 for 0. We use this unconventional extension to (-โˆž, 0] as it gives the formula log (x * y) = log x + log y for all nonzero x and y, and the derivative of log is 1/x away from 0.

Instances For
    theorem Real.log_of_ne_zero {x : โ„} (hx : x โ‰  0) :
    log x = expOrderIso.symm โŸจ|x|, โ‹ฏโŸฉ
    theorem Real.log_of_pos {x : โ„} (hx : 0 < x) :
    log x = expOrderIso.symm โŸจx, hxโŸฉ
    theorem Real.exp_log_eq_abs {x : โ„} (hx : x โ‰  0) :
    exp (log x) = |x|
    theorem Real.exp_log {x : โ„} (hx : 0 < x) :
    exp (log x) = x
    theorem Real.exp_log_of_neg {x : โ„} (hx : x < 0) :
    exp (log x) = -x
    @[simp]
    theorem Real.log_exp (x : โ„) :
    log (exp x) = x
    @[simp]
    theorem Real.log_comp_exp :
    log โˆ˜ exp = id
    theorem Real.log_surjective :
    Function.Surjective log
    @[simp]
    theorem Real.log_one :
    log 1 = 0
    @[simp]
    theorem Real.log_div_self (x : โ„) :
    log (x / x) = 0

    This holds true for all x : โ„ because of the junk values 0 / 0 = 0 and log 0 = 0.

    @[simp]
    theorem Real.log_abs (x : โ„) :
    log |x| = log x
    theorem Real.sinh_log {x : โ„} (hx : 0 < x) :
    sinh (log x) = (x - xโปยน) / 2
    theorem Real.cosh_log {x : โ„} (hx : 0 < x) :
    cosh (log x) = (x + xโปยน) / 2
    theorem Real.log_mul {x y : โ„} (hx : x โ‰  0) (hy : y โ‰  0) :
    log (x * y) = log x + log y
    theorem Real.log_div {x y : โ„} (hx : x โ‰  0) (hy : y โ‰  0) :
    log (x / y) = log x - log y
    theorem Real.log_le_log_iff {x y : โ„} (h : 0 < x) (hโ‚ : 0 < y) :
    log x โ‰ค log y โ†” x โ‰ค y
    theorem Real.log_le_log {x y : โ„} (hx : 0 < x) (hxy : x โ‰ค y) :
    theorem Real.log_lt_log {x y : โ„} (hx : 0 < x) (h : x < y) :
    log x < log y
    theorem Real.log_lt_log_iff {x y : โ„} (hx : 0 < x) (hy : 0 < y) :
    log x < log y โ†” x < y
    theorem Real.log_le_iff_le_exp {x y : โ„} (hx : 0 < x) :
    log x โ‰ค y โ†” x โ‰ค exp y
    theorem Real.log_lt_iff_lt_exp {x y : โ„} (hx : 0 < x) :
    log x < y โ†” x < exp y
    theorem Real.le_log_iff_exp_le {x y : โ„} (hy : 0 < y) :
    x โ‰ค log y โ†” exp x โ‰ค y
    theorem Real.lt_log_iff_exp_lt {x y : โ„} (hy : 0 < y) :
    x < log y โ†” exp x < y
    theorem Real.log_pos_iff {x : โ„} (hx : 0 โ‰ค x) :
    0 < log x โ†” 1 < x
    theorem Real.log_pos {x : โ„} (hx : 1 < x) :
    0 < log x
    theorem Real.log_neg_iff {x : โ„} (h : 0 < x) :
    log x < 0 โ†” x < 1
    theorem Real.log_neg {x : โ„} (h0 : 0 < x) (h1 : x < 1) :
    log x < 0
    theorem Real.log_neg_of_lt_zero {x : โ„} (h0 : x < 0) (h1 : -1 < x) :
    log x < 0
    theorem Real.log_nonneg_iff {x : โ„} (hx : 0 < x) :
    0 โ‰ค log x โ†” 1 โ‰ค x
    theorem Real.log_nonpos {x : โ„} (hx : 0 โ‰ค x) (h'x : x โ‰ค 1) :
    theorem Real.log_intCast_nonneg (n : โ„ค) :
    0 โ‰ค log โ†‘n
    theorem Real.log_lt_sub_one_of_pos {x : โ„} (hx1 : 0 < x) (hx2 : x โ‰  1) :
    log x < x - 1
    theorem Real.eq_one_of_pos_of_log_eq_zero {x : โ„} (hโ‚ : 0 < x) (hโ‚‚ : log x = 0) :
    x = 1
    theorem Real.log_ne_zero_of_pos_of_ne_one {x : โ„} (hx_pos : 0 < x) (hx : x โ‰  1) :
    log x โ‰  0
    @[simp]
    theorem Real.log_eq_zero {x : โ„} :
    log x = 0 โ†” x = 0 โˆจ x = 1 โˆจ x = -1
    theorem Real.log_ne_zero {x : โ„} :
    log x โ‰  0 โ†” x โ‰  0 โˆง x โ‰  1 โˆง x โ‰  -1
    @[simp]
    theorem Real.log_pow (x : โ„) (n : โ„•) :
    log (x ^ n) = โ†‘n * log x
    @[simp]
    theorem Real.log_zpow (x : โ„) (n : โ„ค) :
    log (x ^ n) = โ†‘n * log x
    theorem Real.log_le_self {x : โ„} (hx : 0 โ‰ค x) :

    See Real.log_le_sub_one_of_pos for the stronger version when x โ‰  0.

    See Real.one_sub_inv_le_log_of_pos for the stronger version when x โ‰  0.

    theorem Real.abs_log_mul_self_lt (x : โ„) (h1 : 0 < x) (h2 : x โ‰ค 1) :
    |log x * x| < 1

    Bound for |log x * x| in the interval (0, 1].

    The real logarithm function tends to +โˆž at +โˆž.

    theorem Real.continuous_log :
    Continuous fun (x : { x : โ„ // x โ‰  0 }) => log โ†‘x

    The real logarithm is continuous as a function from nonzero reals.

    theorem Real.continuous_log' :
    Continuous fun (x : { x : โ„ // 0 < x }) => log โ†‘x

    The real logarithm is continuous as a function from positive reals.

    @[simp]
    theorem Real.continuousAt_log_iff {x : โ„} :
    ContinuousAt log x โ†” x โ‰  0
    theorem Real.log_list_prod {l : List โ„} (h : โˆ€ x โˆˆ l, x โ‰  0) :
    log l.prod = (List.map (fun (x : โ„) => log x) l).sum
    theorem Real.log_multiset_prod {s : Multiset โ„} (h : โˆ€ x โˆˆ s, x โ‰  0) :
    log s.prod = (Multiset.map (fun (x : โ„) => log x) s).sum
    theorem Real.log_prod {ฮฑ : Type u_1} {s : Finset ฮฑ} {f : ฮฑ โ†’ โ„} (hf : โˆ€ x โˆˆ s, f x โ‰  0) :
    log (โˆ i โˆˆ s, f i) = โˆ‘ i โˆˆ s, log (f i)
    theorem Finsupp.log_prod {ฮฑ : Type u_1} {ฮฒ : Type u_2} [Zero ฮฒ] (f : ฮฑ โ†’โ‚€ ฮฒ) (g : ฮฑ โ†’ ฮฒ โ†’ โ„) (hg : โˆ€ (a : ฮฑ), g a (f a) = 0 โ†’ f a = 0) :
    Real.log (f.prod g) = f.sum fun (a : ฮฑ) (b : ฮฒ) => Real.log (g a b)
    theorem Real.log_finprod {ฮฑ : Type u_1} {f : ฮฑ โ†’ โ„} (h : โˆ€ (a : ฮฑ), 0 < f a) :
    log (โˆแถ  (a : ฮฑ), f a) = โˆ‘แถ  (a : ฮฑ), log (f a)
    theorem Real.log_nat_eq_sum_factorization (n : โ„•) :
    log โ†‘n = n.factorization.sum fun (p t : โ„•) => โ†‘t * log โ†‘p
    theorem Real.tendsto_pow_log_div_mul_add_atTop (a b : โ„) (n : โ„•) (ha : a โ‰  0) :
    Filter.Tendsto (fun (x : โ„) => log x ^ n / (a * x + b)) Filter.atTop (nhds 0)

    Real.exp as an OpenPartialHomeomorph with source = univ and target = {z | 0 < z}.

    Instances For
      theorem Filter.Tendsto.log {ฮฑ : Type u_1} {f : ฮฑ โ†’ โ„} {l : Filter ฮฑ} {x : โ„} (h : Tendsto f l (nhds x)) (hx : x โ‰  0) :
      Tendsto (fun (x : ฮฑ) => Real.log (f x)) l (nhds (Real.log x))
      theorem Continuous.log {ฮฑ : Type u_1} [TopologicalSpace ฮฑ] {f : ฮฑ โ†’ โ„} (hf : Continuous f) (hโ‚€ : โˆ€ (x : ฮฑ), f x โ‰  0) :
      Continuous fun (x : ฮฑ) => Real.log (f x)
      theorem ContinuousAt.log {ฮฑ : Type u_1} [TopologicalSpace ฮฑ] {f : ฮฑ โ†’ โ„} {a : ฮฑ} (hf : ContinuousAt f a) (hโ‚€ : f a โ‰  0) :
      ContinuousAt (fun (x : ฮฑ) => Real.log (f x)) a
      theorem ContinuousWithinAt.log {ฮฑ : Type u_1} [TopologicalSpace ฮฑ] {f : ฮฑ โ†’ โ„} {s : Set ฮฑ} {a : ฮฑ} (hf : ContinuousWithinAt f s a) (hโ‚€ : f a โ‰  0) :
      ContinuousWithinAt (fun (x : ฮฑ) => Real.log (f x)) s a
      theorem ContinuousOn.log {ฮฑ : Type u_1} [TopologicalSpace ฮฑ] {f : ฮฑ โ†’ โ„} {s : Set ฮฑ} (hf : ContinuousOn f s) (hโ‚€ : โˆ€ x โˆˆ s, f x โ‰  0) :
      ContinuousOn (fun (x : ฮฑ) => Real.log (f x)) s
      theorem Real.tendsto_log_nat_add_one_sub_log :
      Filter.Tendsto (fun (k : โ„•) => log (โ†‘k + 1) - log โ†‘k) Filter.atTop (nhds 0)
      theorem Mathlib.Meta.Positivity.log_pos_of_isNat {e : โ„} {n : โ„•} (h : NormNum.IsNat e n) (w : Nat.blt 1 n = true) :
      theorem Mathlib.Meta.Positivity.log_pos_of_isNegNat {e : โ„} {n : โ„•} (h : NormNum.IsInt e (Int.negOfNat n)) (w : Nat.blt 1 n = true) :
      theorem Mathlib.Meta.Positivity.log_pos_of_isNNRat {e : โ„} {d n : โ„•} :
      NormNum.IsNNRat e n d โ†’ decide (1 < โ†‘n / โ†‘d) = true โ†’ 0 < Real.log e
      theorem Mathlib.Meta.Positivity.log_pos_of_isRat_neg {e : โ„} {d : โ„•} {n : โ„ค} :
      NormNum.IsRat e n d โ†’ decide (โ†‘n / โ†‘d < -1) = true โ†’ 0 < Real.log e
      theorem Mathlib.Meta.Positivity.log_nz_of_isNNRat {e : โ„} {d n : โ„•} :
      NormNum.IsNNRat e n d โ†’ decide (0 < โ†‘n / โ†‘d) = true โ†’ decide (โ†‘n / โ†‘d < 1) = true โ†’ Real.log e โ‰  0
      theorem Mathlib.Meta.Positivity.log_nz_of_isRat_neg {e : โ„} {d : โ„•} {n : โ„ค} :
      NormNum.IsRat e n d โ†’ decide (โ†‘n / โ†‘d < 0) = true โ†’ decide (-1 < โ†‘n / โ†‘d) = true โ†’ Real.log e โ‰  0

      Extension for the positivity tactic: Real.log of a natural number is always nonnegative.

      Instances For

        Extension for the positivity tactic: Real.log of an integer is always nonnegative.

        Instances For

          Extension for the positivity tactic: Real.log of a numeric literal.

          Instances For