The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V15. Real analysis in one variable

Mathlib.Analysis.Real.OfDigits

20 declarations. Mathlib docs · Source

Representation of reals in positional system

This file defines Real.ofDigits and Real.digits functions which allows to work with the representations of reals as sequences of digits in positional system.

Main Definitions

  • ofDigits: takes a sequence of digits (d₀, d₁, ...) (as an ℕ → Fin b), and returns the real number 0.d₀d₁d₂....
  • digits: takes a real number in $[0,1)$ and returns the sequence of its digits.

Main Statements

  • ofDigits_digits states that ofDigits (digits x b) = x.

theorem Real.digits.congr_simp E1 #

∀ (x x_1 : ℝ), x = x_1 → ∀ (b : ℕ) [inst : NeZero b] (a a_1 : ℕ), a = a_1 → x.digits b a = x_1.digits b a_1

def Real.ofDigitsTerm E1 #

{b : ℕ} → (ℕ → Fin b) → ℕ → ℝ

ofDigits takes a sequence of digits (d₀, d₁, ...) in base b and returns the real number 0.d₀d₁d₂... = ∑ᵢ(dᵢ/bⁱ). This auxiliary definition ofDigitsTerm sends the sequence to the function sending i to dᵢ/bⁱ.

theorem Real.ofDigitsTerm_nonneg E1 #

∀ {b : ℕ} {digits : ℕ → Fin b} {n : ℕ}, 0 ≤ Real.ofDigitsTerm digits n

theorem Real.ofDigitsTerm_le E1 #

∀ {b : ℕ} {digits : ℕ → Fin b} {n : ℕ}, Real.ofDigitsTerm digits n ≤ (↑b - 1) * (↑b ^ (n + 1))⁻¹

theorem Real.summable_ofDigitsTerm E1 #

∀ {b : ℕ} {digits : ℕ → Fin b}, Summable (Real.ofDigitsTerm digits)

def Real.ofDigits E3 #

{b : ℕ} → (ℕ → Fin b) → ℝ

ofDigits d is the real number 0.d₀d₁d₂... in base b. We allow repeating representations like 0.999... here.

theorem Real.ofDigits_nonneg E1 #

∀ {b : ℕ} (digits : ℕ → Fin b), 0 ≤ Real.ofDigits digits

theorem Real.ofDigits_le_one E1 #

∀ {b : ℕ} (digits : ℕ → Fin b), Real.ofDigits digits ≤ 1

theorem Real.ofDigits_eq_sum_add_ofDigits E1 #

∀ {b : ℕ} (a : ℕ → Fin b) (n : ℕ),
  Real.ofDigits a = ∑ i ∈ Finset.range n, Real.ofDigitsTerm a i + (↑b ^ n)⁻¹ * Real.ofDigits fun i ↦ a (i + n)

theorem Real.abs_ofDigits_sub_ofDigits_le E1 #

∀ {b : ℕ} {x y : ℕ → Fin b} {n : ℕ}, (∀ i < n, x i = y i) → |Real.ofDigits x - Real.ofDigits y| ≤ (↑b ^ n)⁻¹

def Real.digits E3 #

ℝ → (b : ℕ) → [NeZero b] → ℕ → Fin b

Converts a real number x from the interval [0, 1) into sequence of its digits in base b.

theorem Real.ofDigits_digits_sum_eq E0 #

∀ {x : ℝ} {b : ℕ} [inst : NeZero b],
  x ∈ Set.Ico 0 1 → ∀ (n : ℕ), ↑b ^ n * ∑ i ∈ Finset.range n, Real.ofDigitsTerm (x.digits b) i = ↑⌊↑b ^ n * x⌋₊

theorem Real.le_sum_ofDigitsTerm_digits E1 #

∀ {x : ℝ} {b : ℕ} [inst : NeZero b],
  x ∈ Set.Ico 0 1 → ∀ (n : ℕ), x - (↑b)⁻¹ ^ n ≤ ∑ i ∈ Finset.range n, Real.ofDigitsTerm (x.digits b) i

theorem Real.sum_ofDigitsTerm_digits_le E1 #

∀ {x : ℝ} {b : ℕ} [inst : NeZero b],
  x ∈ Set.Ico 0 1 → ∀ (n : ℕ), ∑ i ∈ Finset.range n, Real.ofDigitsTerm (x.digits b) i ≤ x

theorem Real.hasSum_ofDigitsTerm_digits E1 #

∀ (x : ℝ) {b : ℕ} [inst : NeZero b], 1 < b → x ∈ Set.Ico 0 1 → HasSum (Real.ofDigitsTerm (x.digits b)) x

theorem Real.ofDigits_digits E3 #

∀ {b : ℕ} [inst : NeZero b] {x : ℝ}, 1 < b → x ∈ Set.Ico 0 1 → Real.ofDigits (x.digits b) = x

theorem Real.ofDigits_const_last_eq_one E1 #

∀ (b : ℕ) [NeZero b], (Real.ofDigits fun x ↦ Fin.last b) = 1

A generalization of the identity 0.(9) = 1 to arbitrary positional numeral systems.

theorem Real.ofDigits_const_last_eq_one' E1 #

∀ {b : ℕ} (hb : 1 < b), (Real.ofDigits fun x ↦ ⟨b - 1, ⋯⟩) = 1

A generalization of the identity 0.(9) = 1 to arbitrary positional numeral systems.

theorem Real.ofDigits_SurjOn E1 #

∀ {b : ℕ}, 1 < b → Set.SurjOn Real.ofDigits Set.univ (Set.Icc 0 1)

theorem Real.continuous_ofDigits E1 #

∀ {b : ℕ}, Continuous Real.ofDigits