Skip to content

Commit 900da3d

Browse files
committed
feat: more lemmas on Ordinal.type (leanprover-community#35519)
Extracted from leanprover-community#35513.
1 parent 360d94e commit 900da3d

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

Mathlib/Order/Max.lean

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,36 @@ universe u v
4040
variable {α β : Type*}
4141

4242
/-- Order without bottom elements. -/
43+
@[mk_iff noBotOrder_iff']
4344
class NoBotOrder (α : Type*) [LE α] : Prop where
4445
/-- For each term `a`, there is some `b` which is either incomparable or strictly smaller. -/
4546
exists_not_ge (a : α) : ∃ b, ¬a ≤ b
4647

4748
/-- Order without top elements. -/
48-
@[to_dual]
49+
@[to_dual, mk_iff noTopOrder_iff']
4950
class NoTopOrder (α : Type*) [LE α] : Prop where
5051
/-- For each term `a`, there is some `b` which is either incomparable or strictly larger. -/
5152
exists_not_le (a : α) : ∃ b, ¬b ≤ a
5253

5354
/-- Order without minimal elements. Sometimes called coinitial or dense. -/
55+
@[mk_iff noMinOrder_iff']
5456
class NoMinOrder (α : Type*) [LT α] : Prop where
5557
/-- For each term `a`, there is some strictly smaller `b`. -/
5658
exists_lt (a : α) : ∃ b, b < a
5759

5860
/-- Order without maximal elements. Sometimes called cofinal. -/
59-
@[to_dual]
61+
@[to_dual, mk_iff noMaxOrder_iff']
6062
class NoMaxOrder (α : Type*) [LT α] : Prop where
6163
/-- For each term `a`, there is some strictly greater `b`. -/
6264
exists_gt (a : α) : ∃ b, a < b
6365

6466
export NoBotOrder (exists_not_ge)
65-
6667
export NoTopOrder (exists_not_le)
67-
6868
export NoMinOrder (exists_lt)
69-
7069
export NoMaxOrder (exists_gt)
7170

71+
attribute [to_dual existing] noBotOrder_iff' noMinOrder_iff'
72+
7273
@[to_dual nonempty_gt]
7374
instance nonempty_lt [LT α] [NoMinOrder α] (a : α) : Nonempty { x // x < a } :=
7475
nonempty_subtype.2 (exists_lt a)
@@ -147,6 +148,10 @@ conversion. -/]
147148
def IsMin (a : α) : Prop :=
148149
∀ ⦃b⦄, b ≤ a → a ≤ b
149150

151+
@[to_dual]
152+
theorem noBotOrder_iff : NoBotOrder α ↔ ∀ x : α, ¬ IsBot x := by
153+
simp_rw [noBotOrder_iff', IsBot, not_forall]
154+
150155
@[to_dual (attr := simp)]
151156
theorem not_isBot [NoBotOrder α] (a : α) : ¬IsBot a := fun h =>
152157
let ⟨_, hb⟩ := exists_not_ge a
@@ -194,6 +199,10 @@ section Preorder
194199

195200
variable [Preorder α] {a b : α}
196201

202+
@[to_dual]
203+
theorem noMinOrder_iff : NoMinOrder α ↔ ∀ x : α, ¬ IsMin x := by
204+
simp [noMinOrder_iff', IsMin, lt_iff_le_not_ge]
205+
197206
@[to_dual]
198207
theorem IsBot.mono (ha : IsBot a) (h : b ≤ a) : IsBot b := fun _ => h.trans <| ha _
199208

Mathlib/SetTheory/Cardinal/Cofinality.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ theorem cof_eq_sInf_lsub (o : Ordinal.{u}) : cof o =
208208
@[simp]
209209
theorem lift_cof (o) : Cardinal.lift.{u, v} (cof o) = cof (Ordinal.lift.{u, v} o) := by
210210
refine inductionOn o fun α r _ ↦ ?_
211-
rw [← type_uLift, cof_type, cof_type, ← Cardinal.lift_id'.{v, u} (Order.cof _),
211+
rw [← type_ulift, cof_type, cof_type, ← Cardinal.lift_id'.{v, u} (Order.cof _),
212212
← Cardinal.lift_umax]
213213
apply RelIso.cof_eq_lift ⟨Equiv.ulift.symm, _⟩
214214
simp [swap]

Mathlib/SetTheory/Ordinal/Basic.lean

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,17 @@ def lift (o : Ordinal.{v}) : Ordinal.{max v u} :=
635635
⟨(RelIso.preimage Equiv.ulift r).trans <| f.trans (RelIso.preimage Equiv.ulift s).symm⟩
636636

637637
@[simp]
638-
theorem type_uLift (r : α → α → Prop) [IsWellOrder α r] :
638+
theorem type_ulift (r : α → α → Prop) [IsWellOrder α r] :
639639
type (ULift.down ⁻¹'o r) = lift.{v} (type r) :=
640640
rfl
641641

642+
@[deprecated (since := "2026-02-20")] alias type_uLift := type_ulift
643+
644+
@[simp]
645+
theorem type_lt_ulift [LinearOrder α] [WellFoundedLT α] :
646+
typeLT (ULift α) = lift.{v} (typeLT α) :=
647+
rfl
648+
642649
theorem _root_.RelIso.ordinal_lift_type_eq {r : α → α → Prop} {s : β → β → Prop}
643650
[IsWellOrder α r] [IsWellOrder β s] (f : r ≃r s) : lift.{v} (type r) = lift.{u} (type s) :=
644651
((RelIso.preimage Equiv.ulift r).trans <|
@@ -949,6 +956,34 @@ instance uniqueToTypeOne : Unique (ToType 1) where
949956
theorem one_toType_eq (x : ToType 1) : x = enum (· < ·) ⟨0, by simp⟩ :=
950957
Unique.eq_default x
951958

959+
theorem type_lt_mem_range_succ_iff [LinearOrder α] [WellFoundedLT α] :
960+
typeLT α ∈ range succ ↔ ∃ x : α, IsMax x := by
961+
simp_rw [← isTop_iff_isMax]
962+
constructor <;> intro ⟨a, ha⟩
963+
· refine ⟨enum (α := α) (· < ·) ⟨a, ?_⟩, fun b ↦ ?_⟩
964+
· rw [mem_Iio, ← ha, lt_succ_iff]
965+
· rw [← enum_typein (α := α) (· < ·) b, ← not_lt, enum_le_enum (r := (· < ·)),
966+
Subtype.mk_le_mk, ← lt_succ_iff, ha]
967+
exact typein_lt_type ..
968+
· refine ⟨typein (α := α) (· < ·) a, eq_of_forall_lt_iff fun o ↦ ?_⟩
969+
rw [lt_succ_iff]
970+
refine ⟨fun h ↦ h.trans_lt (typein_lt_type _ _), fun h ↦ ?_⟩
971+
rw [← typein_enum _ h, typein_le_typein, not_lt]
972+
apply ha
973+
974+
theorem type_lt_mem_range_succ [LinearOrder α] [WellFoundedLT α] [OrderTop α] :
975+
typeLT α ∈ range succ :=
976+
type_lt_mem_range_succ_iff.2 ⟨⊤, isMax_top⟩
977+
978+
theorem isSuccPrelimit_type_lt_iff [LinearOrder α] [WellFoundedLT α] :
979+
IsSuccPrelimit (typeLT α) ↔ NoMaxOrder α := by
980+
rw [← not_iff_not, noMaxOrder_iff, not_isSuccPrelimit_iff', type_lt_mem_range_succ_iff]
981+
simp [IsMax]
982+
983+
theorem isSuccPrelimit_type_lt [LinearOrder α] [WellFoundedLT α] [h : NoMaxOrder α] :
984+
IsSuccPrelimit (typeLT α) :=
985+
isSuccPrelimit_type_lt_iff.2 h
986+
952987
/-! ### Extra properties of typein and enum -/
953988

954989
-- TODO: use `ToType.mk` for lemmas on `ToType` rather than `enum` and `typein`.

0 commit comments

Comments
 (0)