Skip to content

Commit

Permalink
feat(order/bounded_lattice): min/max commute with coe (#6900)
Browse files Browse the repository at this point in the history
to with_bot and with_top





Co-authored-by: Floris van Doorn <fpv@andrew.cmu.edu>
  • Loading branch information
fpvandoorn and Floris van Doorn committed Apr 6, 2021
1 parent 13f7910 commit 108fa6f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/order/bounded_lattice.lean
Expand Up @@ -586,6 +586,14 @@ by rw [← sup_eq_max, lattice_eq_DLO]
theorem inf_eq_min [linear_order α] (x y : with_bot α) : x ⊓ y = min x y :=
by rw [← inf_eq_min, lattice_eq_DLO]

@[norm_cast] -- this is not marked simp because the corresponding with_top lemmas are used
lemma coe_min [linear_order α] (x y : α) : ((min x y : α) : with_bot α) = min x y :=
by simp [min, ite_cast]

@[norm_cast] -- this is not marked simp because the corresponding with_top lemmas are used
lemma coe_max [linear_order α] (x y : α) : ((max x y : α) : with_bot α) = max x y :=
by simp [max, ite_cast]

instance order_top [order_top α] : order_top (with_bot α) :=
{ top := some ⊤,
le_top := λ o a ha, by cases ha; exact ⟨_, rfl, le_top⟩,
Expand Down Expand Up @@ -815,6 +823,14 @@ by rw [← sup_eq_max, lattice_eq_DLO]
theorem inf_eq_min [linear_order α] (x y : with_top α) : x ⊓ y = min x y :=
by rw [← inf_eq_min, lattice_eq_DLO]

@[simp, norm_cast]
lemma coe_min [linear_order α] (x y : α) : ((min x y : α) : with_top α) = min x y :=
by simp [min, ite_cast]

@[simp, norm_cast]
lemma coe_max [linear_order α] (x y : α) : ((max x y : α) : with_top α) = max x y :=
by simp [max, ite_cast]

instance order_bot [order_bot α] : order_bot (with_top α) :=
{ bot := some ⊥,
bot_le := λ o a ha, by cases ha; exact ⟨_, rfl, bot_le⟩,
Expand Down

0 comments on commit 108fa6f

Please sign in to comment.