Skip to content

Commit 3160f4e

Browse files
committed
chore(SetTheory/Ordinal/Arithmetic): golf using grind
1 parent 07de307 commit 3160f4e

1 file changed

Lines changed: 8 additions & 36 deletions

File tree

Mathlib/SetTheory/Ordinal/Arithmetic.lean

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -626,29 +626,9 @@ private theorem mul_le_of_limit_aux {α β r s} [IsWellOrder α r] [IsWellOrder
626626
refine (RelEmbedding.ofMonotone (fun a => ?_) fun a b => ?_).ordinal_type_le.trans_lt this
627627
· rcases a with ⟨⟨b', a'⟩, h⟩
628628
by_cases e : b = b'
629-
· refine Sum.inr ⟨a', ?_⟩
630-
subst e
631-
obtain ⟨-, -, h⟩ | ⟨-, h⟩ := h
632-
· exact (irrefl _ h).elim
633-
· exact h
634-
· refine Sum.inl (⟨b', ?_⟩, a')
635-
obtain ⟨-, -, h⟩ | ⟨e, h⟩ := h
636-
· exact h
637-
· exact (e rfl).elim
638-
· rcases a with ⟨⟨b₁, a₁⟩, h₁⟩
639-
rcases b with ⟨⟨b₂, a₂⟩, h₂⟩
640-
intro h
641-
by_cases e₁ : b = b₁ <;> by_cases e₂ : b = b₂
642-
· substs b₁ b₂
643-
simpa only [subrel_val, Prod.lex_def, @irrefl _ s _ b, true_and, false_or,
644-
eq_self_iff_true, dif_pos, Sum.lex_inr_inr] using h
645-
· subst b₁
646-
simp only [subrel_val, Prod.lex_def, e₂, Prod.lex_def, dif_pos, subrel_val,
647-
or_false, dif_neg, not_false_iff, Sum.lex_inr_inl, false_and] at h ⊢
648-
obtain ⟨-, -, h₂_h⟩ | e₂ := h₂ <;> [exact asymm h h₂_h; exact e₂ rfl]
649-
· simp [e₂, show b₂ ≠ b₁ from e₂ ▸ e₁]
650-
· simpa only [dif_neg e₁, dif_neg e₂, Prod.lex_def, subrel_val, Subtype.mk_eq_mk,
651-
Sum.lex_inl_inl] using h
629+
· exact .inr ⟨a', by grind [asymm_of s]⟩
630+
· exact .inl (⟨b', by grind⟩, a')
631+
· grind [subrel_val, Sum.Lex.sep, asymm_of s]
652632

653633
theorem mul_le_iff_of_isSuccLimit {a b c : Ordinal} (h : IsSuccLimit b) :
654634
a * b ≤ c ↔ ∀ b' < b, a * b' ≤ c := by
@@ -847,19 +827,11 @@ theorem mul_sub (a b c : Ordinal) : a * (b - c) = a * b - a * c := by
847827

848828
theorem isSuccLimit_add_iff {a b : Ordinal} :
849829
IsSuccLimit (a + b) ↔ IsSuccLimit b ∨ b = 0 ∧ IsSuccLimit a := by
850-
constructor <;> intro h
851-
· by_cases h' : b = 0
852-
· rw [h', add_zero] at h
853-
right
854-
exact ⟨h', h⟩
855-
left
856-
rw [← add_sub_cancel a b]
857-
apply isSuccLimit_sub h.isSuccPrelimit
858-
suffices a + 0 < a + b by simpa only [add_zero] using this
859-
rwa [add_lt_add_iff_left, pos_iff_ne_zero]
860-
rcases h with (h | ⟨rfl, h⟩)
861-
· exact isSuccLimit_add a h
862-
· simpa only [add_zero]
830+
refine ⟨fun h ↦ ?_, by grind [isSuccLimit_add]⟩
831+
rcases eq_or_ne b 0 with (rfl | h')
832+
· grind
833+
rw [← add_sub_cancel a b]
834+
exact .inl <| isSuccLimit_sub h.isSuccPrelimit <| lt_add_of_pos_right a h'.pos
863835

864836
theorem isSuccLimit_add_iff_of_isSuccLimit {a b : Ordinal} (h : IsSuccLimit a) :
865837
IsSuccLimit (a + b) ↔ IsSuccPrelimit b := by

0 commit comments

Comments
 (0)