File: Mathlib/SetTheory/Ordinal/CantorNormalForm.lean

full_name: Ordinal.CNFRec
code: /-- Inducts on the base `b` expansion of an ordinal. -/
@[elab_as_elim]
noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0)
    (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : ∀ o, C o 
goal: C o

full_name: Ordinal.CNFRec_zero
code: @[simp]
theorem CNFRec_zero {C : Ordinal → Sort*} (b : Ordinal) (H0 : C 0)
    (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 
goal: b.CNFRec H0 H 0 = H0

full_name: Ordinal.CNFRec_pos
code: theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort*} (ho : o ≠ 0) (H0 : C 0)
    (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) :
    @CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) 
goal: b.CNFRec H0 H o = H o ho (b.CNFRec H0 H (o % b ^ Ordinal.log b o))

full_name: Ordinal.CNF
code: /-- The Cantor normal form of an ordinal `o` is the list of coefficients and exponents in the
base-`b` expansion of `o`.

We special-case `CNF 0 o = CNF 1 o = [(0, o)]` for `o ≠ 0`.

`CNF b (b ^ u₁ * v₁ + b ^ u₂ * v₂) = [(u₁, v₁), (u₂, v₂)]` -/
@[pp_nodot]
def CNF (b o : Ordinal) : List (Ordinal × Ordinal) 
goal: List (Ordinal.{u_1} × Ordinal.{u_1})

full_name: Ordinal.CNF_zero
code: @[simp]
theorem CNF_zero (b : Ordinal) : CNF b 0 = [] 
goal: Ordinal.CNF b 0 = []

full_name: Ordinal.CNF_ne_zero
code: /-- Recursive definition for the Cantor normal form. -/
theorem CNF_ne_zero {b o : Ordinal} (ho : o ≠ 0) :
    CNF b o = (log b o, o / b ^ log b o)::CNF b (o % b ^ log b o) 
goal: Ordinal.CNF b o = (Ordinal.log b o, o / b ^ Ordinal.log b o) :: Ordinal.CNF b (o % b ^ Ordinal.log b o)

full_name: Ordinal.zero_CNF
code: theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] 
goal: Ordinal.CNF 0 o = [(0, o)]

full_name: Ordinal.one_CNF
code: theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] 
goal: Ordinal.CNF 1 o = [(0, o)]

full_name: Ordinal.CNF_of_le_one
code: theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o = [⟨0, o⟩] 
goal: Ordinal.CNF b o = [(0, o)]

full_name: Ordinal.CNF_of_lt
code: theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] 
goal: Ordinal.CNF b o = [(0, o)]

full_name: Ordinal.CNF_foldr
code: /-- Evaluating the Cantor normal form of an ordinal returns the ordinal. -/
theorem CNF_foldr (b o : Ordinal) : (CNF b o).foldr (fun p r ↦ b ^ p.1 * p.2 + r) 0 = o 
goal: List.foldr (fun p r => b ^ p.1 * p.2 + r) 0 (Ordinal.CNF b o) = o

full_name: Ordinal.CNF_fst_le_log
code: /-- Every exponent in the Cantor normal form `CNF b o` is less or equal to `log b o`. -/
theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} :
    x ∈ CNF b o → x.1 ≤ log b o 
goal: x ∈ Ordinal.CNF b o → x.1 ≤ Ordinal.log b o

full_name: Ordinal.CNF_fst_le
code: /-- Every exponent in the Cantor normal form `CNF b o` is less or equal to `o`. -/
theorem CNF_fst_le {b o : Ordinal.{u}} {x : Ordinal × Ordinal} (h : x ∈ CNF b o) : x.1 ≤ o 
goal: x.1 ≤ o

full_name: Ordinal.CNF_lt_snd
code: /-- Every coefficient in a Cantor normal form is positive. -/
theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o → 0 < x.2 
goal: x ∈ Ordinal.CNF b o → 0 < x.2

full_name: Ordinal.CNF_snd_lt
code: /-- Every coefficient in the Cantor normal form `CNF b o` is less than `b`. -/
theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
    x ∈ CNF b o → x.2 < b 
goal: x ∈ Ordinal.CNF b o → x.2 < b

full_name: Ordinal.CNF_sorted
code: /-- The exponents of the Cantor normal form are decreasing. -/
theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) 
goal: List.Sorted (fun x x_1 => x > x_1) (List.map Prod.fst (Ordinal.CNF b o))