set_theory.ordinal.cantor_normal_form
⟷
Mathlib.SetTheory.Ordinal.CantorNormalForm
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
We move div_opow_log_pos
out of a proof and open the list
namespace.
Mathlib 4: https://github.com/leanprover-community/mathlib4/pull/3189
@@ -36,7 +36,7 @@ noncomputable theory
universe u
-open order
+open list
namespace ordinal
@@ -90,16 +90,15 @@ by simp [CNF_ne_zero ho, log_eq_zero hb]
/-- Evaluating the Cantor normal form of an ordinal returns the ordinal. -/
theorem CNF_foldr (b o : ordinal) : (CNF b o).foldr (λ p r, b ^ p.1 * p.2 + r) 0 = o :=
CNF_rec b (by { rw CNF_zero, refl })
- (λ o ho IH, by rw [CNF_ne_zero ho, list.foldr_cons, IH, div_add_mod]) o
+ (λ o ho IH, by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
/-- 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 :=
begin
refine CNF_rec b _ (λ o ho H, _) o,
- { rw CNF_zero,
- exact false.elim },
- { rw [CNF_ne_zero ho, list.mem_cons_iff],
+ { simp },
+ { rw [CNF_ne_zero ho, mem_cons_iff],
rintro (rfl | h),
{ exact le_rfl },
{ exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le) } }
@@ -114,17 +113,10 @@ theorem CNF_lt_snd {b o : ordinal.{u}} {x : ordinal × ordinal} : x ∈ CNF b o
begin
refine CNF_rec b _ (λ o ho IH, _) o,
{ simp },
- { rcases eq_zero_or_pos b with rfl | hb,
- { rw [zero_CNF ho, list.mem_singleton],
- rintro rfl,
- exact ordinal.pos_iff_ne_zero.2 ho },
- { rw CNF_ne_zero ho,
- rintro (rfl | h),
- { simp,
- rw div_pos,
- { exact opow_log_le_self _ ho },
- { exact (opow_pos _ hb).ne' } },
- { exact IH h } } }
+ { rw CNF_ne_zero ho,
+ rintro (rfl | h),
+ { exact div_opow_log_pos b ho },
+ { exact IH h } }
end
/-- Every coefficient in the Cantor normal form `CNF b o` is less than `b`. -/
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -191,7 +191,7 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
· simp [CNF_of_lt ho hob]
· rw [CNF_ne_zero ho, List.map_cons, List.sorted_cons]
refine' ⟨fun a H => _, IH⟩
- rw [List.mem_map] at H
+ rw [List.mem_map] at H
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
#align ordinal.CNF_sorted Ordinal.CNF_sorted
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathbin.SetTheory.Ordinal.Arithmetic
-import Mathbin.SetTheory.Ordinal.Exponential
+import SetTheory.Ordinal.Arithmetic
+import SetTheory.Ordinal.Exponential
#align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module set_theory.ordinal.cantor_normal_form
-! leanprover-community/mathlib commit 991ff3b5269848f6dd942ae8e9dd3c946035dc8b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.SetTheory.Ordinal.Arithmetic
import Mathbin.SetTheory.Ordinal.Exponential
+#align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b"
+
/-!
# Cantor Normal Form
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -45,6 +45,7 @@ open List
namespace Ordinal
+#print Ordinal.CNFRec /-
/-- Inducts on the base `b` expansion of an ordinal. -/
@[elab_as_elim]
noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort _} (H0 : C 0)
@@ -55,17 +56,22 @@ noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort _} (H0 : C 0)
let hwf := mod_opow_log_lt_self b ho
H o ho (CNF_rec (o % b ^ log b o))
#align ordinal.CNF_rec Ordinal.CNFRec
+-/
+#print Ordinal.CNFRec_zero /-
@[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 := by
rw [CNF_rec, dif_pos rfl]; rfl
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
+-/
+#print Ordinal.CNFRec_pos /-
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 _) := by rw [CNF_rec, dif_neg ho]
#align ordinal.CNF_rec_pos Ordinal.CNFRec_pos
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
#print Ordinal.CNF /-
@@ -89,26 +95,32 @@ theorem CNF_zero (b : Ordinal) : CNF b 0 = [] :=
-/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print Ordinal.CNF_ne_zero /-
/-- 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) :=
CNFRec_pos b ho _ _
#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zero
+-/
#print Ordinal.zero_CNF /-
theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
#align ordinal.zero_CNF Ordinal.zero_CNF
-/
+#print Ordinal.one_CNF /-
theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
#align ordinal.one_CNF Ordinal.one_CNF
+-/
+#print Ordinal.CNF_of_le_one /-
theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o = [⟨0, o⟩] :=
by
rcases le_one_iff.1 hb with (rfl | rfl)
· exact zero_CNF ho
· exact one_CNF ho
#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_one
+-/
#print Ordinal.CNF_of_lt /-
theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] := by
@@ -116,11 +128,13 @@ theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0,
#align ordinal.CNF_of_lt Ordinal.CNF_of_lt
-/
+#print Ordinal.CNF_foldr /-
/-- 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 :=
CNFRec b (by rw [CNF_zero]; rfl)
(fun o ho IH => by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
#align ordinal.CNF_foldr Ordinal.CNF_foldr
+-/
#print Ordinal.CNF_fst_le_log /-
/-- Every exponent in the Cantor normal form `CNF b o` is less or equal to `log b o`. -/
@@ -155,6 +169,7 @@ theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o
#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
-/
+#print Ordinal.CNF_snd_lt /-
/-- 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 := by
@@ -165,6 +180,7 @@ theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
· simpa using div_opow_log_lt o hb
· exact IH h
#align ordinal.CNF_snd_lt Ordinal.CNF_snd_lt
+-/
#print Ordinal.CNF_sorted /-
/-- The exponents of the Cantor normal form are decreasing. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -178,7 +178,7 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
· simp [CNF_of_lt ho hob]
· rw [CNF_ne_zero ho, List.map_cons, List.sorted_cons]
refine' ⟨fun a H => _, IH⟩
- rw [List.mem_map] at H
+ rw [List.mem_map] at H
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
#align ordinal.CNF_sorted Ordinal.CNF_sorted
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -110,9 +110,11 @@ theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o =
· exact one_CNF ho
#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_one
+#print Ordinal.CNF_of_lt /-
theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] := by
simp [CNF_ne_zero ho, log_eq_zero hb]
#align ordinal.CNF_of_lt Ordinal.CNF_of_lt
+-/
/-- 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 :=
@@ -120,6 +122,7 @@ theorem CNF_foldr (b o : Ordinal) : (CNF b o).foldr (fun p r => b ^ p.1 * p.2 +
(fun o ho IH => by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
#align ordinal.CNF_foldr Ordinal.CNF_foldr
+#print Ordinal.CNF_fst_le_log /-
/-- 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 :=
by
@@ -130,12 +133,16 @@ theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF
· exact le_rfl
· exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le)
#align ordinal.CNF_fst_le_log Ordinal.CNF_fst_le_log
+-/
+#print Ordinal.CNF_fst_le /-
/-- 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 :=
(CNF_fst_le_log h).trans <| log_le_self _ _
#align ordinal.CNF_fst_le Ordinal.CNF_fst_le
+-/
+#print Ordinal.CNF_lt_snd /-
/-- 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 :=
by
@@ -146,6 +153,7 @@ theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o
· exact div_opow_log_pos b ho
· exact IH h
#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
+-/
/-- 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} :
@@ -158,6 +166,7 @@ theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
· exact IH h
#align ordinal.CNF_snd_lt Ordinal.CNF_snd_lt
+#print Ordinal.CNF_sorted /-
/-- The exponents of the Cantor normal form are decreasing. -/
theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :=
by
@@ -173,6 +182,7 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
#align ordinal.CNF_sorted Ordinal.CNF_sorted
+-/
end Ordinal
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -45,12 +45,6 @@ open List
namespace Ordinal
-/- warning: ordinal.CNF_rec -> Ordinal.CNFRec is a dubious translation:
-lean 3 declaration is
- forall (b : Ordinal.{u1}) {C : Ordinal.{u1} -> Sort.{u2}}, (C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)) -> (forall (o : Ordinal.{u1}), C o)
-but is expected to have type
- forall (b : Ordinal.{u1}) {C : Ordinal.{u1} -> Sort.{u2}}, (C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.mod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)) -> (forall (o : Ordinal.{u1}), C o)
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec Ordinal.CNFRecₓ'. -/
/-- Inducts on the base `b` expansion of an ordinal. -/
@[elab_as_elim]
noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort _} (H0 : C 0)
@@ -62,24 +56,12 @@ noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort _} (H0 : C 0)
H o ho (CNF_rec (o % b ^ log b o))
#align ordinal.CNF_rec Ordinal.CNFRec
-/- warning: ordinal.CNF_rec_zero -> Ordinal.CNFRec_zero is a dubious translation:
-lean 3 declaration is
- forall {C : Ordinal.{u1} -> Sort.{u2}} (b : Ordinal.{u1}) (H0 : C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (H : forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)), Eq.{u2} (C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (Ordinal.CNFRec.{u1, u2} b C H0 H (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) H0
-but is expected to have type
- forall {C : Ordinal.{u2} -> Sort.{u1}} (b : Ordinal.{u2}) (H0 : C (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (H : forall (o : Ordinal.{u2}), (Ne.{succ (succ u2)} Ordinal.{u2} o (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) -> (C (HMod.hMod.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHMod.{succ u2} Ordinal.{u2} Ordinal.mod.{u2}) o (HPow.hPow.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHPow.{succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.pow.{u2}) b (Ordinal.log.{u2} b o)))) -> (C o)), Eq.{u1} (C (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (Ordinal.CNFRec.{u2, u1} b C H0 H (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) H0
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec_zero Ordinal.CNFRec_zeroₓ'. -/
@[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 := by
rw [CNF_rec, dif_pos rfl]; rfl
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
-/- warning: ordinal.CNF_rec_pos -> Ordinal.CNFRec_pos is a dubious translation:
-lean 3 declaration is
- forall (b : Ordinal.{u1}) {o : Ordinal.{u1}} {C : Ordinal.{u1} -> Sort.{u2}} (ho : Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (H0 : C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (H : forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)), Eq.{u2} (C o) (Ordinal.CNFRec.{u1, u2} b C H0 H o) (H o ho (Ordinal.CNFRec.{u1, u2} b C H0 H (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))))
-but is expected to have type
- forall (b : Ordinal.{u2}) {o : Ordinal.{u2}} {C : Ordinal.{u2} -> Sort.{u1}} (ho : Ne.{succ (succ u2)} Ordinal.{u2} o (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (H0 : C (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (H : forall (o : Ordinal.{u2}), (Ne.{succ (succ u2)} Ordinal.{u2} o (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) -> (C (HMod.hMod.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHMod.{succ u2} Ordinal.{u2} Ordinal.mod.{u2}) o (HPow.hPow.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHPow.{succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.pow.{u2}) b (Ordinal.log.{u2} b o)))) -> (C o)), Eq.{u1} (C o) (Ordinal.CNFRec.{u2, u1} b C H0 H o) (H o ho (Ordinal.CNFRec.{u2, u1} b C H0 H (HMod.hMod.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHMod.{succ u2} Ordinal.{u2} Ordinal.mod.{u2}) o (HPow.hPow.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHPow.{succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.pow.{u2}) b (Ordinal.log.{u2} b o)))))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec_pos Ordinal.CNFRec_posₓ'. -/
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 _) := by rw [CNF_rec, dif_neg ho]
@@ -106,12 +88,6 @@ theorem CNF_zero (b : Ordinal) : CNF b 0 = [] :=
#align ordinal.CNF_zero Ordinal.CNF_zero
-/
-/- warning: ordinal.CNF_ne_zero -> Ordinal.CNF_ne_zero is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (Ordinal.log.{u1} b o) (HDiv.hDiv.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHDiv.{succ u1} Ordinal.{u1} Ordinal.hasDiv.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) (Ordinal.CNF.{u1} b (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o))))))
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (Ordinal.log.{u1} b o) (HDiv.hDiv.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHDiv.{succ u1} Ordinal.{u1} Ordinal.div.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Ordinal.log.{u1} b o)))) (Ordinal.CNF.{u1} b (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.mod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Ordinal.log.{u1} b o))))))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zeroₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/-- Recursive definition for the Cantor normal form. -/
theorem CNF_ne_zero {b o : Ordinal} (ho : o ≠ 0) :
@@ -124,21 +100,9 @@ theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by sim
#align ordinal.zero_CNF Ordinal.zero_CNF
-/
-/- warning: ordinal.one_CNF -> Ordinal.one_CNF is a dubious translation:
-lean 3 declaration is
- forall {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1}))) o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
-but is expected to have type
- forall {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1})) o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
-Case conversion may be inaccurate. Consider using '#align ordinal.one_CNF Ordinal.one_CNFₓ'. -/
theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
#align ordinal.one_CNF Ordinal.one_CNF
-/- warning: ordinal.CNF_of_le_one -> Ordinal.CNF_of_le_one is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toHasLe.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1})))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1}))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_oneₓ'. -/
theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o = [⟨0, o⟩] :=
by
rcases le_one_iff.1 hb with (rfl | rfl)
@@ -146,34 +110,16 @@ theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o =
· exact one_CNF ho
#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_one
-/- warning: ordinal.CNF_of_lt -> Ordinal.CNF_of_lt is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) o b) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) o b) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_of_lt Ordinal.CNF_of_ltₓ'. -/
theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] := by
simp [CNF_ne_zero ho, log_eq_zero hb]
#align ordinal.CNF_of_lt Ordinal.CNF_of_lt
-/- warning: ordinal.CNF_foldr -> Ordinal.CNF_foldr is a dubious translation:
-lean 3 declaration is
- forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), Eq.{succ (succ u1)} Ordinal.{u1} (List.foldr.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (fun (p : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (r : Ordinal.{u1}) => HAdd.hAdd.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHAdd.{succ u1} Ordinal.{u1} Ordinal.hasAdd.{u1}) (HMul.hMul.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMul.{succ u1} Ordinal.{u1} (MulZeroClass.toHasMul.{succ u1} Ordinal.{u1} (MulZeroOneClass.toMulZeroClass.{succ u1} Ordinal.{u1} (MonoidWithZero.toMulZeroOneClass.{succ u1} Ordinal.{u1} Ordinal.monoidWithZero.{u1})))) (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) r) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) (Ordinal.CNF.{u1} b o)) o
-but is expected to have type
- forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), Eq.{succ (succ u1)} Ordinal.{u1} (List.foldr.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (fun (p : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (r : Ordinal.{u1}) => HAdd.hAdd.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHAdd.{succ u1} Ordinal.{u1} Ordinal.add.{u1}) (HMul.hMul.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMul.{succ u1} Ordinal.{u1} (MulZeroClass.toMul.{succ u1} Ordinal.{u1} (MulZeroOneClass.toMulZeroClass.{succ u1} Ordinal.{u1} (MonoidWithZero.toMulZeroOneClass.{succ u1} Ordinal.{u1} Ordinal.monoidWithZero.{u1})))) (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) r) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) (Ordinal.CNF.{u1} b o)) o
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_foldr Ordinal.CNF_foldrₓ'. -/
/-- 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 :=
CNFRec b (by rw [CNF_zero]; rfl)
(fun o ho IH => by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
#align ordinal.CNF_foldr Ordinal.CNF_foldr
-/- warning: ordinal.CNF_fst_le_log -> Ordinal.CNF_fst_le_log is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toHasLe.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) (Ordinal.log.{u1} b o))
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) (Ordinal.log.{u1} b o))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_fst_le_log Ordinal.CNF_fst_le_logₓ'. -/
/-- 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 :=
by
@@ -185,23 +131,11 @@ theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF
· exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le)
#align ordinal.CNF_fst_le_log Ordinal.CNF_fst_le_log
-/- warning: ordinal.CNF_fst_le -> Ordinal.CNF_fst_le is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toHasLe.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) o)
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) o)
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_fst_le Ordinal.CNF_fst_leₓ'. -/
/-- 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 :=
(CNF_fst_le_log h).trans <| log_le_self _ _
#align ordinal.CNF_fst_le Ordinal.CNF_fst_le
-/- warning: ordinal.CNF_lt_snd -> Ordinal.CNF_lt_snd is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x))
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_lt_snd Ordinal.CNF_lt_sndₓ'. -/
/-- 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 :=
by
@@ -213,12 +147,6 @@ theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o
· exact IH h
#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
-/- warning: ordinal.CNF_snd_lt -> Ordinal.CNF_snd_lt is a dubious translation:
-lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1}))) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
-but is expected to have type
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1})) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_snd_lt Ordinal.CNF_snd_ltₓ'. -/
/-- 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 := by
@@ -230,12 +158,6 @@ theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
· exact IH h
#align ordinal.CNF_snd_lt Ordinal.CNF_snd_lt
-/- warning: ordinal.CNF_sorted -> Ordinal.CNF_sorted is a dubious translation:
-lean 3 declaration is
- forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), List.Sorted.{succ u1} Ordinal.{u1} (GT.gt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1}))) (List.map.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Ordinal.CNF.{u1} b o))
-but is expected to have type
- forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), List.Sorted.{succ u1} Ordinal.{u1} (fun (x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1273 : Ordinal.{u1}) (x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1275 : Ordinal.{u1}) => GT.gt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1273 x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1275) (List.map.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Ordinal.CNF.{u1} b o))
-Case conversion may be inaccurate. Consider using '#align ordinal.CNF_sorted Ordinal.CNF_sortedₓ'. -/
/-- The exponents of the Cantor normal form are decreasing. -/
theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -70,10 +70,8 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec_zero Ordinal.CNFRec_zeroₓ'. -/
@[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 :=
- by
- rw [CNF_rec, dif_pos rfl]
- rfl
+ (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 := by
+ rw [CNF_rec, dif_pos rfl]; rfl
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
/- warning: ordinal.CNF_rec_pos -> Ordinal.CNFRec_pos is a dubious translation:
@@ -166,10 +164,7 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align ordinal.CNF_foldr Ordinal.CNF_foldrₓ'. -/
/-- 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 :=
- CNFRec b
- (by
- rw [CNF_zero]
- rfl)
+ CNFRec b (by rw [CNF_zero]; rfl)
(fun o ho IH => by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
#align ordinal.CNF_foldr Ordinal.CNF_foldr
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -137,7 +137,7 @@ theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by simp
/- warning: ordinal.CNF_of_le_one -> Ordinal.CNF_of_le_one is a dubious translation:
lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1})))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toHasLe.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1})))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
but is expected to have type
forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1}))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
Case conversion may be inaccurate. Consider using '#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_oneₓ'. -/
@@ -148,11 +148,15 @@ theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o =
· exact one_CNF ho
#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_one
-#print Ordinal.CNF_of_lt /-
+/- warning: ordinal.CNF_of_lt -> Ordinal.CNF_of_lt is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) o b) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) o b) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_of_lt Ordinal.CNF_of_ltₓ'. -/
theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] := by
simp [CNF_ne_zero ho, log_eq_zero hb]
#align ordinal.CNF_of_lt Ordinal.CNF_of_lt
--/
/- warning: ordinal.CNF_foldr -> Ordinal.CNF_foldr is a dubious translation:
lean 3 declaration is
@@ -169,7 +173,12 @@ theorem CNF_foldr (b o : Ordinal) : (CNF b o).foldr (fun p r => b ^ p.1 * p.2 +
(fun o ho IH => by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
#align ordinal.CNF_foldr Ordinal.CNF_foldr
-#print Ordinal.CNF_fst_le_log /-
+/- warning: ordinal.CNF_fst_le_log -> Ordinal.CNF_fst_le_log is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toHasLe.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) (Ordinal.log.{u1} b o))
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) (Ordinal.log.{u1} b o))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_fst_le_log Ordinal.CNF_fst_le_logₓ'. -/
/-- 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 :=
by
@@ -180,16 +189,24 @@ theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF
· exact le_rfl
· exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le)
#align ordinal.CNF_fst_le_log Ordinal.CNF_fst_le_log
--/
-#print Ordinal.CNF_fst_le /-
+/- warning: ordinal.CNF_fst_le -> Ordinal.CNF_fst_le is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toHasLe.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) o)
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) o)
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_fst_le Ordinal.CNF_fst_leₓ'. -/
/-- 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 :=
(CNF_fst_le_log h).trans <| log_le_self _ _
#align ordinal.CNF_fst_le Ordinal.CNF_fst_le
--/
-#print Ordinal.CNF_lt_snd /-
+/- warning: ordinal.CNF_lt_snd -> Ordinal.CNF_lt_snd is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x))
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}} {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_lt_snd Ordinal.CNF_lt_sndₓ'. -/
/-- 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 :=
by
@@ -200,11 +217,10 @@ theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o
· exact div_opow_log_pos b ho
· exact IH h
#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
--/
/- warning: ordinal.CNF_snd_lt -> Ordinal.CNF_snd_lt is a dubious translation:
lean 3 declaration is
- forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1}))) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1}))) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
but is expected to have type
forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1})) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
Case conversion may be inaccurate. Consider using '#align ordinal.CNF_snd_lt Ordinal.CNF_snd_ltₓ'. -/
@@ -219,7 +235,12 @@ theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
· exact IH h
#align ordinal.CNF_snd_lt Ordinal.CNF_snd_lt
-#print Ordinal.CNF_sorted /-
+/- warning: ordinal.CNF_sorted -> Ordinal.CNF_sorted is a dubious translation:
+lean 3 declaration is
+ forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), List.Sorted.{succ u1} Ordinal.{u1} (GT.gt.{succ u1} Ordinal.{u1} (Preorder.toHasLt.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1}))) (List.map.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Ordinal.CNF.{u1} b o))
+but is expected to have type
+ forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), List.Sorted.{succ u1} Ordinal.{u1} (fun (x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1273 : Ordinal.{u1}) (x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1275 : Ordinal.{u1}) => GT.gt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1273 x._@.Mathlib.SetTheory.Ordinal.CantorNormalForm._hyg.1275) (List.map.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Ordinal.CNF.{u1} b o))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_sorted Ordinal.CNF_sortedₓ'. -/
/-- The exponents of the Cantor normal form are decreasing. -/
theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :=
by
@@ -235,7 +256,6 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
#align ordinal.CNF_sorted Ordinal.CNF_sorted
--/
end Ordinal
mathlib commit https://github.com/leanprover-community/mathlib/commit/49b7f94aab3a3bdca1f9f34c5d818afb253b3993
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module set_theory.ordinal.cantor_normal_form
-! leanprover-community/mathlib commit ee05e9ce1322178f0c12004eb93c00d2c8c00ed2
+! leanprover-community/mathlib commit 991ff3b5269848f6dd942ae8e9dd3c946035dc8b
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -41,7 +41,7 @@ noncomputable section
universe u
-open Order
+open List
namespace Ordinal
@@ -166,7 +166,7 @@ theorem CNF_foldr (b o : Ordinal) : (CNF b o).foldr (fun p r => b ^ p.1 * p.2 +
(by
rw [CNF_zero]
rfl)
- (fun o ho IH => by rw [CNF_ne_zero ho, List.foldr_cons, IH, div_add_mod]) o
+ (fun o ho IH => by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
#align ordinal.CNF_foldr Ordinal.CNF_foldr
#print Ordinal.CNF_fst_le_log /-
@@ -174,9 +174,8 @@ theorem CNF_foldr (b o : Ordinal) : (CNF b o).foldr (fun p r => b ^ p.1 * p.2 +
theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o → x.1 ≤ log b o :=
by
refine' CNF_rec b _ (fun o ho H => _) o
- · rw [CNF_zero]
- exact False.elim
- · rw [CNF_ne_zero ho, List.mem_cons]
+ · simp
+ · rw [CNF_ne_zero ho, mem_cons_iff]
rintro (rfl | h)
· exact le_rfl
· exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le)
@@ -196,17 +195,10 @@ theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o
by
refine' CNF_rec b _ (fun o ho IH => _) o
· simp
- · rcases eq_zero_or_pos b with (rfl | hb)
- · rw [zero_CNF ho, List.mem_singleton]
- rintro rfl
- exact Ordinal.pos_iff_ne_zero.2 ho
- · rw [CNF_ne_zero ho]
- rintro (rfl | h)
- · simp
- rw [div_pos]
- · exact opow_log_le_self _ ho
- · exact (opow_pos _ hb).ne'
- · exact IH h
+ · rw [CNF_ne_zero ho]
+ rintro (rfl | h)
+ · exact div_opow_log_pos b ho
+ · exact IH h
#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce86f4e05e9a9b8da5e316b22c76ce76440c56a1
@@ -239,7 +239,7 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
· simp [CNF_of_lt ho hob]
· rw [CNF_ne_zero ho, List.map_cons, List.sorted_cons]
refine' ⟨fun a H => _, IH⟩
- rw [List.mem_map'] at H
+ rw [List.mem_map] at H
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
#align ordinal.CNF_sorted Ordinal.CNF_sorted
mathlib commit https://github.com/leanprover-community/mathlib/commit/195fcd60ff2bfe392543bceb0ec2adcdb472db4c
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module set_theory.ordinal.cantor_normal_form
-! leanprover-community/mathlib commit f1e061e3caef3022f0daa99d670ecf2c30e0b5c6
+! leanprover-community/mathlib commit ee05e9ce1322178f0c12004eb93c00d2c8c00ed2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.SetTheory.Ordinal.Exponential
/-!
# Cantor Normal Form
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
The Cantor normal form of an ordinal is generally defined as its base `ω` expansion, with its
non-zero exponents in decreasing order. Here, we more generally define a base `b` expansion
`ordinal.CNF` in this manner, which is well-behaved for any `b ≥ 2`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/22131150f88a2d125713ffa0f4693e3355b1eb49
@@ -42,31 +42,50 @@ open Order
namespace Ordinal
+/- warning: ordinal.CNF_rec -> Ordinal.CNFRec is a dubious translation:
+lean 3 declaration is
+ forall (b : Ordinal.{u1}) {C : Ordinal.{u1} -> Sort.{u2}}, (C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)) -> (forall (o : Ordinal.{u1}), C o)
+but is expected to have type
+ forall (b : Ordinal.{u1}) {C : Ordinal.{u1} -> Sort.{u2}}, (C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.mod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)) -> (forall (o : Ordinal.{u1}), C o)
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec Ordinal.CNFRecₓ'. -/
/-- Inducts on the base `b` expansion of an ordinal. -/
@[elab_as_elim]
-noncomputable def cNFRec (b : Ordinal) {C : Ordinal → Sort _} (H0 : C 0)
+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
| o =>
if ho : o = 0 then by rwa [ho]
else
let hwf := mod_opow_log_lt_self b ho
H o ho (CNF_rec (o % b ^ log b o))
-#align ordinal.CNF_rec Ordinal.cNFRec
-
+#align ordinal.CNF_rec Ordinal.CNFRec
+
+/- warning: ordinal.CNF_rec_zero -> Ordinal.CNFRec_zero is a dubious translation:
+lean 3 declaration is
+ forall {C : Ordinal.{u1} -> Sort.{u2}} (b : Ordinal.{u1}) (H0 : C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (H : forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)), Eq.{u2} (C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (Ordinal.CNFRec.{u1, u2} b C H0 H (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) H0
+but is expected to have type
+ forall {C : Ordinal.{u2} -> Sort.{u1}} (b : Ordinal.{u2}) (H0 : C (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (H : forall (o : Ordinal.{u2}), (Ne.{succ (succ u2)} Ordinal.{u2} o (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) -> (C (HMod.hMod.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHMod.{succ u2} Ordinal.{u2} Ordinal.mod.{u2}) o (HPow.hPow.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHPow.{succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.pow.{u2}) b (Ordinal.log.{u2} b o)))) -> (C o)), Eq.{u1} (C (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (Ordinal.CNFRec.{u2, u1} b C H0 H (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) H0
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec_zero Ordinal.CNFRec_zeroₓ'. -/
@[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 :=
+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 :=
by
rw [CNF_rec, dif_pos rfl]
rfl
-#align ordinal.CNF_rec_zero Ordinal.cNFRec_zero
-
-theorem cNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort _} (ho : o ≠ 0) (H0 : C 0)
+#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
+
+/- warning: ordinal.CNF_rec_pos -> Ordinal.CNFRec_pos is a dubious translation:
+lean 3 declaration is
+ forall (b : Ordinal.{u1}) {o : Ordinal.{u1}} {C : Ordinal.{u1} -> Sort.{u2}} (ho : Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (H0 : C (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) (H : forall (o : Ordinal.{u1}), (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (C (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) -> (C o)), Eq.{u2} (C o) (Ordinal.CNFRec.{u1, u2} b C H0 H o) (H o ho (Ordinal.CNFRec.{u1, u2} b C H0 H (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))))
+but is expected to have type
+ forall (b : Ordinal.{u2}) {o : Ordinal.{u2}} {C : Ordinal.{u2} -> Sort.{u1}} (ho : Ne.{succ (succ u2)} Ordinal.{u2} o (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (H0 : C (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) (H : forall (o : Ordinal.{u2}), (Ne.{succ (succ u2)} Ordinal.{u2} o (OfNat.ofNat.{succ u2} Ordinal.{u2} 0 (Zero.toOfNat0.{succ u2} Ordinal.{u2} Ordinal.zero.{u2}))) -> (C (HMod.hMod.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHMod.{succ u2} Ordinal.{u2} Ordinal.mod.{u2}) o (HPow.hPow.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHPow.{succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.pow.{u2}) b (Ordinal.log.{u2} b o)))) -> (C o)), Eq.{u1} (C o) (Ordinal.CNFRec.{u2, u1} b C H0 H o) (H o ho (Ordinal.CNFRec.{u2, u1} b C H0 H (HMod.hMod.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHMod.{succ u2} Ordinal.{u2} Ordinal.mod.{u2}) o (HPow.hPow.{succ u2, succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.{u2} (instHPow.{succ u2, succ u2} Ordinal.{u2} Ordinal.{u2} Ordinal.pow.{u2}) b (Ordinal.log.{u2} b o)))))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_rec_pos Ordinal.CNFRec_posₓ'. -/
+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 _) := by rw [CNF_rec, dif_neg ho]
-#align ordinal.CNF_rec_pos Ordinal.cNFRec_pos
+ @CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) := by rw [CNF_rec, dif_neg ho]
+#align ordinal.CNF_rec_pos Ordinal.CNFRec_pos
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print Ordinal.CNF /-
/-- The Cantor normal form of an ordinal `o` is the list of coefficients and exponents in the
base-`b` expansion of `o`.
@@ -74,50 +93,82 @@ 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) :=
- cNFRec b [] (fun o ho IH => (log b o, o / b ^ log b o)::IH) o
-#align ordinal.CNF Ordinal.cNF
+def CNF (b o : Ordinal) : List (Ordinal × Ordinal) :=
+ CNFRec b [] (fun o ho IH => (log b o, o / b ^ log b o)::IH) o
+#align ordinal.CNF Ordinal.CNF
+-/
+#print Ordinal.CNF_zero /-
@[simp]
-theorem cNF_zero (b : Ordinal) : cNF b 0 = [] :=
- cNFRec_zero b _ _
-#align ordinal.CNF_zero Ordinal.cNF_zero
+theorem CNF_zero (b : Ordinal) : CNF b 0 = [] :=
+ CNFRec_zero b _ _
+#align ordinal.CNF_zero Ordinal.CNF_zero
+-/
+/- warning: ordinal.CNF_ne_zero -> Ordinal.CNF_ne_zero is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (Ordinal.log.{u1} b o) (HDiv.hDiv.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHDiv.{succ u1} Ordinal.{u1} Ordinal.hasDiv.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o)))) (Ordinal.CNF.{u1} b (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.hasMod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Ordinal.log.{u1} b o))))))
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (Ordinal.log.{u1} b o) (HDiv.hDiv.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHDiv.{succ u1} Ordinal.{u1} Ordinal.div.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Ordinal.log.{u1} b o)))) (Ordinal.CNF.{u1} b (HMod.hMod.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMod.{succ u1} Ordinal.{u1} Ordinal.mod.{u1}) o (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Ordinal.log.{u1} b o))))))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zeroₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/-- 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) :=
- cNFRec_pos b ho _ _
-#align ordinal.CNF_ne_zero Ordinal.cNF_ne_zero
-
-theorem zero_cNF {o : Ordinal} (ho : o ≠ 0) : cNF 0 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
-#align ordinal.zero_CNF Ordinal.zero_cNF
-
-theorem one_cNF {o : Ordinal} (ho : o ≠ 0) : cNF 1 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
-#align ordinal.one_CNF Ordinal.one_cNF
+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) :=
+ CNFRec_pos b ho _ _
+#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zero
+
+#print Ordinal.zero_CNF /-
+theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
+#align ordinal.zero_CNF Ordinal.zero_CNF
+-/
-theorem cNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : cNF b o = [⟨0, o⟩] :=
+/- warning: ordinal.one_CNF -> Ordinal.one_CNF is a dubious translation:
+lean 3 declaration is
+ forall {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1}))) o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+but is expected to have type
+ forall {o : Ordinal.{u1}}, (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1})) o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+Case conversion may be inaccurate. Consider using '#align ordinal.one_CNF Ordinal.one_CNFₓ'. -/
+theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
+#align ordinal.one_CNF Ordinal.one_CNF
+
+/- warning: ordinal.CNF_of_le_one -> Ordinal.CNF_of_le_one is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1})))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1})))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LE.le.{succ u1} Ordinal.{u1} (Preorder.toLE.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) b (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1}))) -> (Ne.{succ (succ u1)} Ordinal.{u1} o (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1}))) -> (Eq.{succ (succ u1)} (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (Ordinal.CNF.{u1} b o) (List.cons.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (Prod.mk.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) o) (List.nil.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}))))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_oneₓ'. -/
+theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o = [⟨0, o⟩] :=
by
rcases le_one_iff.1 hb with (rfl | rfl)
· exact zero_CNF ho
· exact one_CNF ho
-#align ordinal.CNF_of_le_one Ordinal.cNF_of_le_one
+#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_one
-theorem cNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : cNF b o = [⟨0, o⟩] := by
+#print Ordinal.CNF_of_lt /-
+theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] := by
simp [CNF_ne_zero ho, log_eq_zero hb]
-#align ordinal.CNF_of_lt Ordinal.cNF_of_lt
+#align ordinal.CNF_of_lt Ordinal.CNF_of_lt
+-/
+/- warning: ordinal.CNF_foldr -> Ordinal.CNF_foldr is a dubious translation:
+lean 3 declaration is
+ forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), Eq.{succ (succ u1)} Ordinal.{u1} (List.foldr.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (fun (p : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (r : Ordinal.{u1}) => HAdd.hAdd.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHAdd.{succ u1} Ordinal.{u1} Ordinal.hasAdd.{u1}) (HMul.hMul.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMul.{succ u1} Ordinal.{u1} (MulZeroClass.toHasMul.{succ u1} Ordinal.{u1} (MulZeroOneClass.toMulZeroClass.{succ u1} Ordinal.{u1} (MonoidWithZero.toMulZeroOneClass.{succ u1} Ordinal.{u1} Ordinal.monoidWithZero.{u1})))) (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.hasPow.{u1}) b (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) r) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (OfNat.mk.{succ u1} Ordinal.{u1} 0 (Zero.zero.{succ u1} Ordinal.{u1} Ordinal.hasZero.{u1}))) (Ordinal.CNF.{u1} b o)) o
+but is expected to have type
+ forall (b : Ordinal.{u1}) (o : Ordinal.{u1}), Eq.{succ (succ u1)} Ordinal.{u1} (List.foldr.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) Ordinal.{u1} (fun (p : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (r : Ordinal.{u1}) => HAdd.hAdd.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHAdd.{succ u1} Ordinal.{u1} Ordinal.add.{u1}) (HMul.hMul.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHMul.{succ u1} Ordinal.{u1} (MulZeroClass.toMul.{succ u1} Ordinal.{u1} (MulZeroOneClass.toMulZeroClass.{succ u1} Ordinal.{u1} (MonoidWithZero.toMulZeroOneClass.{succ u1} Ordinal.{u1} Ordinal.monoidWithZero.{u1})))) (HPow.hPow.{succ u1, succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.{u1} (instHPow.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} Ordinal.pow.{u1}) b (Prod.fst.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} p)) r) (OfNat.ofNat.{succ u1} Ordinal.{u1} 0 (Zero.toOfNat0.{succ u1} Ordinal.{u1} Ordinal.zero.{u1})) (Ordinal.CNF.{u1} b o)) o
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_foldr Ordinal.CNF_foldrₓ'. -/
/-- 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 :=
- cNFRec b
+theorem CNF_foldr (b o : Ordinal) : (CNF b o).foldr (fun p r => b ^ p.1 * p.2 + r) 0 = o :=
+ CNFRec b
(by
rw [CNF_zero]
rfl)
(fun o ho IH => by rw [CNF_ne_zero ho, List.foldr_cons, IH, div_add_mod]) o
-#align ordinal.CNF_foldr Ordinal.cNF_foldr
+#align ordinal.CNF_foldr Ordinal.CNF_foldr
+#print Ordinal.CNF_fst_le_log /-
/-- 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 :=
+theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o → x.1 ≤ log b o :=
by
refine' CNF_rec b _ (fun o ho H => _) o
· rw [CNF_zero]
@@ -126,15 +177,19 @@ theorem cNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ cNF
rintro (rfl | h)
· exact le_rfl
· exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le)
-#align ordinal.CNF_fst_le_log Ordinal.cNF_fst_le_log
+#align ordinal.CNF_fst_le_log Ordinal.CNF_fst_le_log
+-/
+#print Ordinal.CNF_fst_le /-
/-- 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 :=
- (cNF_fst_le_log h).trans <| log_le_self _ _
-#align ordinal.CNF_fst_le Ordinal.cNF_fst_le
+theorem CNF_fst_le {b o : Ordinal.{u}} {x : Ordinal × Ordinal} (h : x ∈ CNF b o) : x.1 ≤ o :=
+ (CNF_fst_le_log h).trans <| log_le_self _ _
+#align ordinal.CNF_fst_le Ordinal.CNF_fst_le
+-/
+#print Ordinal.CNF_lt_snd /-
/-- 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 :=
+theorem CNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF b o → 0 < x.2 :=
by
refine' CNF_rec b _ (fun o ho IH => _) o
· simp
@@ -149,21 +204,29 @@ theorem cNF_lt_snd {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ cNF b o
· exact opow_log_le_self _ ho
· exact (opow_pos _ hb).ne'
· exact IH h
-#align ordinal.CNF_lt_snd Ordinal.cNF_lt_snd
+#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
+-/
+/- warning: ordinal.CNF_snd_lt -> Ordinal.CNF_snd_lt is a dubious translation:
+lean 3 declaration is
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (OfNat.mk.{succ u1} Ordinal.{u1} 1 (One.one.{succ u1} Ordinal.{u1} Ordinal.hasOne.{u1}))) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.Mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.hasMem.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
+but is expected to have type
+ forall {b : Ordinal.{u1}} {o : Ordinal.{u1}}, (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (OfNat.ofNat.{succ u1} Ordinal.{u1} 1 (One.toOfNat1.{succ u1} Ordinal.{u1} Ordinal.one.{u1})) b) -> (forall {x : Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}}, (Membership.mem.{succ u1, succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1}) (List.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) (List.instMembershipList.{succ u1} (Prod.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1})) x (Ordinal.CNF.{u1} b o)) -> (LT.lt.{succ u1} Ordinal.{u1} (Preorder.toLT.{succ u1} Ordinal.{u1} (PartialOrder.toPreorder.{succ u1} Ordinal.{u1} Ordinal.partialOrder.{u1})) (Prod.snd.{succ u1, succ u1} Ordinal.{u1} Ordinal.{u1} x) b))
+Case conversion may be inaccurate. Consider using '#align ordinal.CNF_snd_lt Ordinal.CNF_snd_ltₓ'. -/
/-- 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 := by
+theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
+ x ∈ CNF b o → x.2 < b := by
refine' CNF_rec b _ (fun o ho IH => _) o
· simp
· rw [CNF_ne_zero ho]
rintro (rfl | h)
· simpa using div_opow_log_lt o hb
· exact IH h
-#align ordinal.CNF_snd_lt Ordinal.cNF_snd_lt
+#align ordinal.CNF_snd_lt Ordinal.CNF_snd_lt
+#print Ordinal.CNF_sorted /-
/-- The exponents of the Cantor normal form are decreasing. -/
-theorem cNF_sorted (b o : Ordinal) : ((cNF b o).map Prod.fst).Sorted (· > ·) :=
+theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :=
by
refine' CNF_rec b _ (fun o ho IH => _) o
· simp
@@ -176,7 +239,8 @@ theorem cNF_sorted (b o : Ordinal) : ((cNF b o).map Prod.fst).Sorted (· > ·) :
rw [List.mem_map'] at H
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
-#align ordinal.CNF_sorted Ordinal.cNF_sorted
+#align ordinal.CNF_sorted Ordinal.CNF_sorted
+-/
end Ordinal
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
@@ -46,7 +46,7 @@ noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0)
by_cases h : o = 0
· rw [h]; exact H0
· exact H o h (CNFRec _ H0 H (o % b ^ log b o))
- termination_by CNFRec b H0 H o => o
+ termination_by o => o
decreasing_by exact mod_opow_log_lt_self b h
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec Ordinal.CNFRec
cases'
(#9171)
I literally went through and regex'd some uses of cases'
, replacing them with rcases
; this is meant to be a low effort PR as I hope that tools can do this in the future.
rcases
is an easier replacement than cases
, though with better tools we could in future do a second pass converting simple rcases
added here (and existing ones) to cases
.
@@ -163,7 +163,7 @@ set_option linter.uppercaseLean3 false in
theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) := by
refine' CNFRec b _ (fun o ho IH ↦ _) o
· simp only [gt_iff_lt, CNF_zero, map_nil, sorted_nil]
- · cases' le_or_lt b 1 with hb hb
+ · rcases le_or_lt b 1 with hb | hb
· simp only [CNF_of_le_one hb ho, gt_iff_lt, map_cons, map, sorted_singleton]
· cases' lt_or_le o b with hob hbo
· simp only [CNF_of_lt ho hob, gt_iff_lt, map_cons, map, sorted_singleton]
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -162,11 +162,11 @@ set_option linter.uppercaseLean3 false in
/-- The exponents of the Cantor normal form are decreasing. -/
theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) := by
refine' CNFRec b _ (fun o ho IH ↦ _) o
- · simp only [CNF_zero]
+ · simp only [gt_iff_lt, CNF_zero, map_nil, sorted_nil]
· cases' le_or_lt b 1 with hb hb
- · simp only [CNF_of_le_one hb ho, map]
+ · simp only [CNF_of_le_one hb ho, gt_iff_lt, map_cons, map, sorted_singleton]
· cases' lt_or_le o b with hob hbo
- · simp only [CNF_of_lt ho hob, map]
+ · simp only [CNF_of_lt ho hob, gt_iff_lt, map_cons, map, sorted_singleton]
· rw [CNF_ne_zero ho, map_cons, sorted_cons]
refine' ⟨fun a H ↦ _, IH⟩
rw [mem_map] at H
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -41,7 +41,7 @@ namespace Ordinal
/-- Inducts on the base `b` expansion of an ordinal. -/
@[elab_as_elim]
-noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort _} (H0 : C 0)
+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 := fun o ↦ by
by_cases h : o = 0
· rw [h]; exact H0
@@ -52,14 +52,14 @@ set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec Ordinal.CNFRec
@[simp]
-theorem CNFRec_zero {C : Ordinal → Sort _} (b : Ordinal) (H0 : C 0)
+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 := by
rw [CNFRec, dif_pos rfl]
rfl
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
-theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort _} (ho : o ≠ 0) (H0 : C 0)
+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 _) := by rw [CNFRec, dif_neg ho]
set_option linter.uppercaseLean3 false in
@@ -2,15 +2,12 @@
Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module set_theory.ordinal.cantor_normal_form
-! leanprover-community/mathlib commit 991ff3b5269848f6dd942ae8e9dd3c946035dc8b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.SetTheory.Ordinal.Arithmetic
import Mathlib.SetTheory.Ordinal.Exponential
+#align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b"
+
/-!
# Cantor Normal Form
by
s! (#3825)
This PR puts, with one exception, every single remaining by
that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh
. The exception is when the by
begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.
Essentially this is s/\n *by$/ by/g
, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated by
s".
@@ -121,8 +121,8 @@ set_option linter.uppercaseLean3 false in
#align ordinal.CNF_foldr Ordinal.CNF_foldr
/-- 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 :=
- by
+theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} :
+ x ∈ CNF b o → x.1 ≤ log b o := by
refine' CNFRec b _ (fun o ho H ↦ _) o
· rw [CNF_zero]
intro contra; contradiction
SetTheory/Ordinal/CantorNormalForm
(#3189)
We open the List
namespace and golf CNF_lt_snd
.
Mathlib 3: https://github.com/leanprover-community/mathlib/pull/16009
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module set_theory.ordinal.cantor_normal_form
-! leanprover-community/mathlib commit f1e061e3caef3022f0daa99d670ecf2c30e0b5c6
+! leanprover-community/mathlib commit 991ff3b5269848f6dd942ae8e9dd3c946035dc8b
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -38,7 +38,7 @@ noncomputable section
universe u
-open Order
+open List
namespace Ordinal
@@ -116,7 +116,7 @@ set_option linter.uppercaseLean3 false in
/-- 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 :=
CNFRec b (by rw [CNF_zero]; rfl)
- (fun o ho IH ↦ by rw [CNF_ne_zero ho, List.foldr_cons, IH, div_add_mod]) o
+ (fun o ho IH ↦ by rw [CNF_ne_zero ho, foldr_cons, IH, div_add_mod]) o
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_foldr Ordinal.CNF_foldr
@@ -126,7 +126,7 @@ theorem CNF_fst_le_log {b o : Ordinal.{u}} {x : Ordinal × Ordinal} : x ∈ CNF
refine' CNFRec b _ (fun o ho H ↦ _) o
· rw [CNF_zero]
intro contra; contradiction
- · rw [CNF_ne_zero ho, List.mem_cons]
+ · rw [CNF_ne_zero ho, mem_cons]
rintro (rfl | h)
· exact le_rfl
· exact (H h).trans (log_mono_right _ (mod_opow_log_lt_self b ho).le)
@@ -141,19 +141,11 @@ set_option linter.uppercaseLean3 false in
/-- 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 := by
- refine' CNFRec b _ (fun o ho IH ↦ _) o
- · simp only [CNF_zero, List.not_mem_nil, IsEmpty.forall_iff]
- · rcases eq_zero_or_pos b with (rfl | hb)
- · rw [zero_CNF ho, List.mem_singleton]
- rintro rfl
- exact Ordinal.pos_iff_ne_zero.2 ho
- · rw [CNF_ne_zero ho]
- intro h
- cases' (List.mem_cons.mp h) with h h
- · rw [h]; rw [div_pos]
- · exact opow_log_le_self _ ho
- · exact (opow_pos _ hb).ne'
- · exact IH h
+ refine' CNFRec b (by simp) (fun o ho IH ↦ _) o
+ rw [CNF_ne_zero ho]
+ rintro (h | ⟨_, h⟩)
+ · exact div_opow_log_pos b ho
+ · exact IH h
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_lt_snd Ordinal.CNF_lt_snd
@@ -161,10 +153,10 @@ set_option linter.uppercaseLean3 false in
theorem CNF_snd_lt {b o : Ordinal.{u}} (hb : 1 < b) {x : Ordinal × Ordinal} :
x ∈ CNF b o → x.2 < b := by
refine' CNFRec b _ (fun o ho IH ↦ _) o
- · simp only [CNF_zero, List.not_mem_nil, IsEmpty.forall_iff]
+ · simp only [CNF_zero, not_mem_nil, IsEmpty.forall_iff]
· rw [CNF_ne_zero ho]
intro h
- cases' (List.mem_cons.mp h) with h h
+ cases' (mem_cons.mp h) with h h
· rw [h]; simpa only using div_opow_log_lt o hb
· exact IH h
set_option linter.uppercaseLean3 false in
@@ -175,12 +167,12 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
refine' CNFRec b _ (fun o ho IH ↦ _) o
· simp only [CNF_zero]
· cases' le_or_lt b 1 with hb hb
- · simp only [CNF_of_le_one hb ho, List.map]
+ · simp only [CNF_of_le_one hb ho, map]
· cases' lt_or_le o b with hob hbo
- · simp only [CNF_of_lt ho hob, List.map]
- · rw [CNF_ne_zero ho, List.map_cons, List.sorted_cons]
+ · simp only [CNF_of_lt ho hob, map]
+ · rw [CNF_ne_zero ho, map_cons, sorted_cons]
refine' ⟨fun a H ↦ _, IH⟩
- rw [List.mem_map] at H
+ rw [mem_map] at H
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
set_option linter.uppercaseLean3 false in
Notably incorporates https://github.com/leanprover/std4/pull/98 and https://github.com/leanprover/std4/pull/109.
https://github.com/leanprover/std4/pull/98 moves a number of lemmas from Mathlib to Std, so the bump requires deleting them in Mathlib. I did check on each lemma whether its attributes were kept in the move (and gave attribute markings in Mathlib if they were not present in Std), but a reviewer may wish to re-check.
List.mem_map
changed statement from b ∈ l.map f ↔ ∃ a, a ∈ l ∧ b = f a
to b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b
. Similarly for List.exists_of_mem_map
. This was a deliberate change, so I have simply adjusted proofs (many become simpler, which supports the change). I also deleted List.mem_map'
, List.exists_of_mem_map'
, which were temporary versions in Mathlib while waiting for this change (replacing their uses with the unprimed versions).
Also, the lemma sublist_nil_iff_eq_nil
seems to have been renamed to sublist_nil
during the move, so I added an alias for the old name.
(another issue fixed during review by @digama0) List.Sublist.filter
had an argument change from explicit to implicit. This appears to have been an oversight (cc @JamesGallicchio). I have temporarily introduced List.Sublist.filter'
with the argument explicit, and replaced Mathlib uses of Sublist.filter
with Sublist.filter'
. Later we can fix the argument in Std, and then delete List.Sublist.filter'
.
@@ -180,7 +180,7 @@ theorem CNF_sorted (b o : Ordinal) : ((CNF b o).map Prod.fst).Sorted (· > ·) :
· simp only [CNF_of_lt ho hob, List.map]
· rw [CNF_ne_zero ho, List.map_cons, List.sorted_cons]
refine' ⟨fun a H ↦ _, IH⟩
- rw [List.mem_map'] at H
+ rw [List.mem_map] at H
rcases H with ⟨⟨a, a'⟩, H, rfl⟩
exact (CNF_fst_le_log H).trans_lt (log_mod_opow_log_lt_log_self hb ho hbo)
set_option linter.uppercaseLean3 false in
@@ -46,7 +46,7 @@ namespace 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 := fun o ↦ by
- by_cases (o = 0)
+ by_cases h : o = 0
· rw [h]; exact H0
· exact H o h (CNFRec _ H0 H (o % b ^ log b o))
termination_by CNFRec b H0 H o => o
@@ -187,4 +187,3 @@ set_option linter.uppercaseLean3 false in
#align ordinal.CNF_sorted Ordinal.CNF_sorted
end Ordinal
-
The unported dependencies are