Skip to content

Commit ed8f67c

Browse files
committed
chore(SetTheory/Ordinal/Arithmetic): golf monoid and addMonoidWithOne
1 parent 07de307 commit ed8f67c

2 files changed

Lines changed: 7 additions & 33 deletions

File tree

Mathlib/SetTheory/Ordinal/Arithmetic.lean

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -525,33 +525,13 @@ theorem isSuccLimit_sub {a b : Ordinal} (ha : IsSuccPrelimit a) (h : b < a) :
525525
`b × a`. -/
526526
instance monoid : Monoid Ordinal.{u} where
527527
mul a b :=
528-
Quotient.liftOn₂ a b
529-
(fun ⟨α, r, _⟩ ⟨β, s, _⟩ => ⟦⟨β × α, Prod.Lex s r, inferInstance⟩⟧ :
530-
WellOrder → WellOrder → Ordinal)
531-
fun ⟨_, _, _⟩ _ _ _ ⟨f⟩ ⟨g⟩ => Quot.sound ⟨RelIso.prodLexCongr g f⟩
528+
Quotient.liftOn₂ a b (fun ⟨α, r, _⟩ ⟨β, s, _⟩ => ⟦⟨β × α, Prod.Lex s r, inferInstance⟩⟧)
529+
fun _ _ _ _ ⟨f⟩ ⟨g⟩ ↦ Quot.sound ⟨RelIso.prodLexCongr g f⟩
532530
mul_assoc a b c :=
533-
Quotient.inductionOn₃ a b c fun ⟨α, r, _⟩ ⟨β, s, _⟩ ⟨γ, t, _⟩ =>
534-
Eq.symm <|
535-
Quotient.sound
536-
⟨⟨prodAssoc _ _ _, @fun a b => by
537-
rcases a with ⟨⟨a₁, a₂⟩, a₃⟩
538-
rcases b with ⟨⟨b₁, b₂⟩, b₃⟩
539-
simp [Prod.lex_def, and_or_left, or_assoc, and_assoc]⟩⟩
540-
mul_one a :=
541-
inductionOn a fun α r _ =>
542-
Quotient.sound
543-
⟨⟨punitProd _, @fun a b => by
544-
rcases a with ⟨⟨⟨⟩⟩, a⟩; rcases b with ⟨⟨⟨⟩⟩, b⟩
545-
simp only [Prod.lex_def, emptyRelation, false_or]
546-
simp only [true_and]
547-
rfl⟩⟩
548-
one_mul a :=
549-
inductionOn a fun α r _ =>
550-
Quotient.sound
551-
⟨⟨prodPUnit _, @fun a b => by
552-
rcases a with ⟨a, ⟨⟨⟩⟩⟩; rcases b with ⟨b, ⟨⟨⟩⟩⟩
553-
simp only [Prod.lex_def, emptyRelation, and_false, or_false]
554-
rfl⟩⟩
531+
Quotient.inductionOn₃ a b c fun _ _ _ ↦
532+
.symm <| Quotient.sound ⟨⟨prodAssoc .., by grind [Prod.mk.injEq]⟩⟩
533+
mul_one a := inductionOn a fun α _ _ ↦ Quotient.sound ⟨⟨punitProd α, by simp [Prod.lex_def]⟩⟩
534+
one_mul a := inductionOn a fun α _ _ ↦ Quotient.sound ⟨⟨prodPUnit α, by simp [Prod.lex_def]⟩⟩
555535

556536
@[simp]
557537
theorem type_prod_lex {α β : Type u} (r : α → α → Prop) (s : β → β → Prop) [IsWellOrder α r]

Mathlib/SetTheory/Ordinal/Basic.lean

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,7 @@ instance addMonoidWithOne : AddMonoidWithOne Ordinal.{u} where
823823
zero_add o := inductionOn o fun α _ _ => (RelIso.emptySumLex _ _).ordinal_type_eq
824824
add_zero o := inductionOn o fun α _ _ => (RelIso.sumLexEmpty _ _).ordinal_type_eq
825825
add_assoc o₁ o₂ o₃ :=
826-
Quotient.inductionOn₃ o₁ o₂ o₃ fun ⟨α, r, _⟩ ⟨β, s, _⟩ ⟨γ, t, _⟩ =>
827-
Quot.sound
828-
⟨⟨sumAssoc _ _ _, by
829-
intro a b
830-
rcases a with (⟨a | a⟩ | a) <;> rcases b with (⟨b | b⟩ | b) <;>
831-
simp only [sumAssoc_apply_inl_inl, sumAssoc_apply_inl_inr, sumAssoc_apply_inr,
832-
Sum.lex_inl_inl, Sum.lex_inr_inr, Sum.Lex.sep, Sum.lex_inr_inl]⟩⟩
826+
Quotient.inductionOn₃ o₁ o₂ o₃ fun _ _ _ ↦ Quot.sound ⟨⟨sumAssoc .., by simp⟩⟩
833827
nsmul := nsmulRec
834828

835829
@[simp]

0 commit comments

Comments
 (0)