Skip to content

Commit

Permalink
chore(WithTop): add @[simp] to coe_add (#10204)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Feb 5, 2024
1 parent 2e5d90d commit 208205e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Mathlib/Algebra/Order/Monoid/WithTop.lean
Expand Up @@ -113,7 +113,7 @@ instance add : Add (WithTop α) :=
⟨Option.map₂ (· + ·)⟩
#align with_top.has_add WithTop.add

@[norm_cast] lemma coe_add (a b : α) : ↑(a + b) = (a + b : WithTop α) := rfl
@[simp, norm_cast] lemma coe_add (a b : α) : ↑(a + b) = (a + b : WithTop α) := rfl
#align with_top.coe_add WithTop.coe_add

section deprecated
Expand Down Expand Up @@ -142,7 +142,10 @@ theorem add_top (a : WithTop α) : a + ⊤ = ⊤ := by cases a <;> rfl

@[simp]
theorem add_eq_top : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
cases a <;> cases b <;> simp [none_eq_top, some_eq_coe, ← WithTop.coe_add]
match a, b with
| ⊤, _ => simp
| _, ⊤ => simp
| (a : α), (b : α) => simp only [← coe_add, coe_ne_top, or_false]
#align with_top.add_eq_top WithTop.add_eq_top

theorem add_ne_top : a + b ≠ ⊤ ↔ a ≠ ⊤ ∧ b ≠ ⊤ :=
Expand Down Expand Up @@ -580,7 +583,7 @@ section Add

variable [Add α] {a b c d : WithBot α} {x y : α}

-- `norm_cast` proves those lemmas, because `WithTop`/`WithBot` are reducible
@[simp, norm_cast]
theorem coe_add (a b : α) : ((a + b : α) : WithBot α) = a + b :=
rfl
#align with_bot.coe_add WithBot.coe_add
Expand Down

0 comments on commit 208205e

Please sign in to comment.