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.

Equations
    Instances For
      theorem Real.exp_log {x : โ„} (hx : 0 < x) :
      exp (log x) = x
      @[simp]
      theorem Real.log_exp (x : โ„) :
      log (exp x) = x
      @[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.

      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) :
      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_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_nonpos {x : โ„} (hx : 0 โ‰ค x) (h'x : x โ‰ค 1) :
      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) :
      @[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.

      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_nat_eq_sum_factorization (n : โ„•) :
      log โ†‘n = n.factorization.sum fun (p t : โ„•) => โ†‘t * log โ†‘p

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

      Equations
        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 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.

          Equations
            Instances For

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

              Equations
                Instances For

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

                  Equations
                    Instances For