Lean4
/-- The ordinal corresponding to a cardinal `c` is the least ordinal
whose cardinal is `c`. For the order-embedding version, see `ord.order_embedding`. -/
def ord (c : Cardinal) : Ordinal :=
Quot.liftOn c (fun α : Type u => ⨅ r : { r // IsWellOrder α r }, @type α r.1 r.2) <|
by
rintro α β ⟨f⟩
refine congr_arg sInf <| ext fun o ↦ ⟨?_, ?_⟩ <;> rintro ⟨⟨r, hr⟩, rfl⟩ <;>
refine ⟨⟨_, RelIso.IsWellOrder.preimage r ?_⟩, type_preimage _ _⟩
exacts [f.symm, f]