Theorem: Ordinal.CNF_sorted
File: Mathlib/SetTheory/Ordinal/CantorNormalForm.lean

tactic: refine CNFRec b ?_ (fun o ho IH ↦ ?_) o
state_before: b o : Ordinal.{u_1}
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))
state_after: case refine_1
b o : Ordinal.{u_1}
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b 0))

case refine_2
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))

tactic: simp only [gt_iff_lt, CNF_zero, map_nil, sorted_nil]
state_before: case refine_1
b o : Ordinal.{u_1}
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b 0))
state_after: no goals

tactic: rcases le_or_lt b 1 with hb | hb
state_before: case refine_2
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))
state_after: case refine_2.inl
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : b ≤ 1
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))

case refine_2.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))

tactic: simp only [CNF_of_le_one hb ho, gt_iff_lt, map_cons, map, sorted_singleton]
state_before: case refine_2.inl
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : b ≤ 1
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))
state_after: no goals

tactic: cases' lt_or_le o b with hob hbo
state_before: case refine_2.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))
state_after: case refine_2.inr.inl
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hob : o < b
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))

case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))

tactic: simp only [CNF_of_lt ho hob, gt_iff_lt, map_cons, map, sorted_singleton]
state_before: case refine_2.inr.inl
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hob : o < b
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))
state_after: no goals

tactic: rw [CNF_ne_zero ho, map_cons, sorted_cons]
state_before: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
⊢ Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b o))
state_after: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
⊢ (∀ b_1 ∈ map Prod.fst (CNF b (o % b ^ log b o)), (log b o, o / b ^ log b o).1 > b_1) ∧
    Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))

tactic: refine ⟨fun a H ↦ ?_, IH⟩
state_before: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
⊢ (∀ b_1 ∈ map Prod.fst (CNF b (o % b ^ log b o)), (log b o, o / b ^ log b o).1 > b_1) ∧
    Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
state_after: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
a : Ordinal.{u_1}
H : a ∈ map Prod.fst (CNF b (o % b ^ log b o))
⊢ (log b o, o / b ^ log b o).1 > a

tactic: rw [mem_map] at H
state_before: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
a : Ordinal.{u_1}
H : a ∈ map Prod.fst (CNF b (o % b ^ log b o))
⊢ (log b o, o / b ^ log b o).1 > a
state_after: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
a : Ordinal.{u_1}
H : ∃ a_1 ∈ CNF b (o % b ^ log b o), a_1.1 = a
⊢ (log b o, o / b ^ log b o).1 > a

tactic: rcases H with ⟨⟨a, a'⟩, H, rfl⟩
state_before: case refine_2.inr.inr
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
a : Ordinal.{u_1}
H : ∃ a_1 ∈ CNF b (o % b ^ log b o), a_1.1 = a
⊢ (log b o, o / b ^ log b o).1 > a
state_after: case refine_2.inr.inr.intro.mk.intro
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
a a' : Ordinal.{u_1}
H : (a, a') ∈ CNF b (o % b ^ log b o)
⊢ (log b o, o / b ^ log b o).1 > (a, a').1

tactic: exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
state_before: case refine_2.inr.inr.intro.mk.intro
b o✝ o : Ordinal.{u_1}
ho : o ≠ 0
IH : Sorted (fun x x_1 => x > x_1) (map Prod.fst (CNF b (o % b ^ log b o)))
hb : 1 < b
hbo : b ≤ o
a a' : Ordinal.{u_1}
H : (a, a') ∈ CNF b (o % b ^ log b o)
⊢ (log b o, o / b ^ log b o).1 > (a, a').1
state_after: no goals