algebra.order.ring.with_top
⟷
Mathlib.Algebra.Order.Ring.WithTop
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
@@ -20,8 +20,6 @@ variables {α : Type*}
namespace with_top
-instance [nonempty α] : nontrivial (with_top α) := option.nontrivial
-
variable [decidable_eq α]
section has_mul
@@ -198,8 +196,6 @@ end with_top
namespace with_bot
-instance [nonempty α] : nontrivial (with_bot α) := option.nontrivial
-
variable [decidable_eq α]
section has_mul
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
with_top
/with_bot
(#18487)
Backport leanprover-community/mathlib4#2406
@@ -36,15 +36,36 @@ instance : mul_zero_class (with_top α) :=
lemma mul_def {a b : with_top α} : a * b = if a = 0 ∨ b = 0 then 0 else option.map₂ (*) a b := rfl
-@[simp] lemma mul_top {a : with_top α} (h : a ≠ 0) : a * ⊤ = ⊤ :=
-by cases a; simp [mul_def, h]; refl
+lemma mul_top' {a : with_top α} : a * ⊤ = if a = 0 then 0 else ⊤ :=
+by induction a using with_top.rec_top_coe; simp [mul_def]; refl
-@[simp] lemma top_mul {a : with_top α} (h : a ≠ 0) : ⊤ * a = ⊤ :=
-by cases a; simp [mul_def, h]; refl
+@[simp] lemma mul_top {a : with_top α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
+
+lemma top_mul' {a : with_top α} : ⊤ * a = if a = 0 then 0 else ⊤ :=
+by induction a using with_top.rec_top_coe; simp [mul_def]; refl
+
+@[simp] lemma top_mul {a : with_top α} (h : a ≠ 0) : ⊤ * a = ⊤ := by rw [top_mul', if_neg h]
@[simp] lemma top_mul_top : (⊤ * ⊤ : with_top α) = ⊤ :=
top_mul top_ne_zero
+theorem mul_eq_top_iff {a b : with_top α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 :=
+begin
+ rw [mul_def, ite_eq_iff, ← none_eq_top, option.map₂_eq_none_iff],
+ have ha : a = 0 → a ≠ none := λ h, h.symm ▸ zero_ne_top,
+ have hb : b = 0 → b ≠ none := λ h, h.symm ▸ zero_ne_top,
+ tauto
+end
+
+theorem mul_lt_top' [has_lt α] {a b : with_top α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ :=
+begin
+ rw [with_top.lt_top_iff_ne_top] at *,
+ simp only [ne.def, mul_eq_top_iff, *, and_false, false_and, false_or, not_false_iff]
+end
+
+theorem mul_lt_top [has_lt α] {a b : with_top α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
+ mul_lt_top' (with_top.lt_top_iff_ne_top.2 ha) (with_top.lt_top_iff_ne_top.2 hb)
+
instance [no_zero_divisors α] : no_zero_divisors (with_top α) :=
begin
refine ⟨λ a b h₁, decidable.by_contradiction $ λ h₂, _⟩,
@@ -59,7 +80,7 @@ section mul_zero_class
variables [mul_zero_class α]
-@[norm_cast] lemma coe_mul {a b : α} : (↑(a * b) : with_top α) = a * b :=
+@[simp, norm_cast] lemma coe_mul {a b : α} : (↑(a * b) : with_top α) = a * b :=
decidable.by_cases (assume : a = 0, by simp [this]) $ assume ha,
decidable.by_cases (assume : b = 0, by simp [this]) $ assume hb,
by { simp [*, mul_def] }
@@ -69,22 +90,6 @@ lemma mul_coe {b : α} (hb : b ≠ 0) : ∀{a : with_top α}, a * b = a.bind (λ
by simp [hb]
| (some a) := show ↑a * ↑b = ↑(a * b), from coe_mul.symm
-@[simp] lemma mul_eq_top_iff {a b : with_top α} : a * b = ⊤ ↔ (a ≠ 0 ∧ b = ⊤) ∨ (a = ⊤ ∧ b ≠ 0) :=
-begin
- cases a; cases b; simp only [none_eq_top, some_eq_coe],
- { simp [← coe_mul] },
- { by_cases hb : b = 0; simp [hb] },
- { by_cases ha : a = 0; simp [ha] },
- { simp [← coe_mul] }
-end
-
-lemma mul_lt_top [preorder α] {a b : with_top α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
-begin
- lift a to α using ha,
- lift b to α using hb,
- simp only [← coe_mul, coe_lt_top]
-end
-
@[simp] lemma untop'_zero_mul (a b : with_top α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 :=
begin
by_cases ha : a = 0, { rw [ha, zero_mul, ← coe_zero, untop'_coe, zero_mul] },
@@ -127,7 +132,7 @@ instance [mul_zero_one_class α] [nontrivial α] : mul_zero_one_class (with_top
induction y using with_top.rec_top_coe,
{ have : (f x : with_top S) ≠ 0, by simpa [hf.eq_iff' (map_zero f)] using hx,
simp [hx, this] },
- simp [← coe_mul]
+ simp only [← coe_mul, map_coe, map_mul]
end,
.. f.to_zero_hom.with_top_map, .. f.to_monoid_hom.to_one_hom.with_top_map }
@@ -163,7 +168,7 @@ begin
induction c using with_top.rec_top_coe,
{ by_cases ha : a = 0; simp [ha] },
{ by_cases hc : c = 0, { simp [hc] },
- simp [mul_coe hc], cases a; cases b,
+ simp only [mul_coe hc], cases a; cases b,
repeat { refl <|> exact congr_arg some (add_mul _ _ _) } }
end
@@ -216,6 +221,15 @@ with_top.top_mul h
@[simp] lemma bot_mul_bot : (⊥ * ⊥ : with_bot α) = ⊥ :=
with_top.top_mul_top
+theorem mul_eq_bot_iff {a b : with_bot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
+with_top.mul_eq_top_iff
+
+theorem bot_lt_mul' [has_lt α] {a b : with_bot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
+@with_top.mul_lt_top' αᵒᵈ _ _ _ _ _ _ ha hb
+
+theorem bot_lt_mul [has_lt α] {a b : with_bot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : ⊥ < a * b :=
+@with_top.mul_lt_top αᵒᵈ _ _ _ _ _ _ ha hb
+
end has_mul
section mul_zero_class
@@ -228,16 +242,6 @@ with_top.coe_mul
lemma mul_coe {b : α} (hb : b ≠ 0) {a : with_bot α} : a * b = a.bind (λa:α, ↑(a * b)) :=
with_top.mul_coe hb
-@[simp] lemma mul_eq_bot_iff {a b : with_bot α} : a * b = ⊥ ↔ (a ≠ 0 ∧ b = ⊥) ∨ (a = ⊥ ∧ b ≠ 0) :=
-with_top.mul_eq_top_iff
-
-lemma bot_lt_mul [preorder α] {a b : with_bot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
-begin
- lift a to α using ne_bot_of_gt ha,
- lift b to α using ne_bot_of_gt hb,
- simp only [← coe_mul, bot_lt_coe],
-end
-
end mul_zero_class
/-- `nontrivial α` is needed here as otherwise we have `1 * ⊥ = ⊥` but also `= 0 * ⊥ = 0`. -/
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
with_bot
(#18149)
mathlib4 PR: https://github.com/leanprover-community/mathlib4/pull/1508
@@ -13,7 +13,7 @@ import algebra.order.ring.canonical
> Any changes to this file require a corresponding PR to mathlib4.
The main results of this section are `with_top.canonically_ordered_comm_semiring` and
-`with_bot.comm_monoid_with_zero`.
+`with_bot.ordered_comm_semiring`.
-/
variables {α : Type*}
@@ -260,17 +260,114 @@ with_top.comm_monoid_with_zero
instance [canonically_ordered_comm_semiring α] [nontrivial α] : comm_semiring (with_bot α) :=
with_top.comm_semiring
-instance [canonically_ordered_comm_semiring α] [nontrivial α] : pos_mul_mono (with_bot α) :=
-pos_mul_mono_iff_covariant_pos.2 ⟨begin
- rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk],
- lift x to α using x0.ne_bot,
- induction a using with_bot.rec_bot_coe, { simp_rw [mul_bot x0.ne.symm, bot_le] },
- induction b using with_bot.rec_bot_coe, { exact absurd h (bot_lt_coe a).not_le },
- simp only [← coe_mul, coe_le_coe] at *,
- exact mul_le_mul_left' h x,
- end ⟩
-
-instance [canonically_ordered_comm_semiring α] [nontrivial α] : mul_pos_mono (with_bot α) :=
-pos_mul_mono_iff_mul_pos_mono.mp infer_instance
+instance [mul_zero_class α] [preorder α] [pos_mul_mono α] :
+ pos_mul_mono (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk],
+ rcases eq_or_ne x 0 with rfl | x0', { simp, },
+ lift x to α, { rintro ⟨rfl⟩, exact (with_bot.bot_lt_coe (0 : α)).not_le x0, },
+ induction a using with_bot.rec_bot_coe, { simp_rw [mul_bot x0', bot_le] },
+ induction b using with_bot.rec_bot_coe, { exact absurd h (bot_lt_coe a).not_le },
+ simp only [← coe_mul, coe_le_coe] at *,
+ norm_cast at x0,
+ exact mul_le_mul_of_nonneg_left h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [mul_pos_mono α] :
+ mul_pos_mono (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk],
+ rcases eq_or_ne x 0 with rfl | x0', { simp, },
+ lift x to α, { rintro ⟨rfl⟩, exact (with_bot.bot_lt_coe (0 : α)).not_le x0, },
+ induction a using with_bot.rec_bot_coe, { simp_rw [bot_mul x0', bot_le] },
+ induction b using with_bot.rec_bot_coe, { exact absurd h (bot_lt_coe a).not_le },
+ simp only [← coe_mul, coe_le_coe] at *,
+ norm_cast at x0,
+ exact mul_le_mul_of_nonneg_right h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [pos_mul_strict_mono α] :
+ pos_mul_strict_mono (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk],
+ lift x to α using x0.ne_bot,
+ induction b using with_bot.rec_bot_coe, { exact absurd h not_lt_bot, },
+ induction a using with_bot.rec_bot_coe, { simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe], },
+ simp only [← coe_mul, coe_lt_coe] at *,
+ norm_cast at x0,
+ exact mul_lt_mul_of_pos_left h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [mul_pos_strict_mono α] :
+ mul_pos_strict_mono (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk],
+ lift x to α using x0.ne_bot,
+ induction b using with_bot.rec_bot_coe, { exact absurd h not_lt_bot, },
+ induction a using with_bot.rec_bot_coe, { simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe], },
+ simp only [← coe_mul, coe_lt_coe] at *,
+ norm_cast at x0,
+ exact mul_lt_mul_of_pos_right h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [pos_mul_reflect_lt α] :
+ pos_mul_reflect_lt (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk] at h,
+ rcases eq_or_ne x 0 with rfl | x0', { simpa using h, },
+ lift x to α, { rintro ⟨rfl⟩, exact (with_bot.bot_lt_coe (0 : α)).not_le x0, },
+ induction b using with_bot.rec_bot_coe, { rw [mul_bot x0'] at h, exact absurd h bot_le.not_lt, },
+ induction a using with_bot.rec_bot_coe, { exact with_bot.bot_lt_coe _, },
+ simp only [← coe_mul, coe_lt_coe] at *,
+ norm_cast at x0,
+ exact lt_of_mul_lt_mul_left h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [mul_pos_reflect_lt α] :
+ mul_pos_reflect_lt (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk] at h,
+ rcases eq_or_ne x 0 with rfl | x0', { simpa using h, },
+ lift x to α, { rintro ⟨rfl⟩, exact (with_bot.bot_lt_coe (0 : α)).not_le x0, },
+ induction b using with_bot.rec_bot_coe, { rw [bot_mul x0'] at h, exact absurd h bot_le.not_lt, },
+ induction a using with_bot.rec_bot_coe, { exact with_bot.bot_lt_coe _, },
+ simp only [← coe_mul, coe_lt_coe] at *,
+ norm_cast at x0,
+ exact lt_of_mul_lt_mul_right h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [pos_mul_mono_rev α] :
+ pos_mul_mono_rev (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk] at h,
+ lift x to α using x0.ne_bot,
+ induction a using with_bot.rec_bot_coe, { exact bot_le, },
+ induction b using with_bot.rec_bot_coe,
+ { rw [mul_bot x0.ne.symm, ← coe_mul] at h, exact absurd h (bot_lt_coe (x * a)).not_le, },
+ simp only [← coe_mul, coe_le_coe] at *,
+ norm_cast at x0,
+ exact le_of_mul_le_mul_left h x0,
+end ⟩
+
+instance [mul_zero_class α] [preorder α] [mul_pos_mono_rev α] :
+ mul_pos_mono_rev (with_bot α) :=
+⟨begin
+ rintros ⟨x, x0⟩ a b h, simp only [subtype.coe_mk] at h,
+ lift x to α using x0.ne_bot,
+ induction a using with_bot.rec_bot_coe, { exact bot_le, },
+ induction b using with_bot.rec_bot_coe,
+ { rw [bot_mul x0.ne.symm, ← coe_mul] at h, exact absurd h (bot_lt_coe (a * x)).not_le, },
+ simp only [← coe_mul, coe_le_coe] at *,
+ norm_cast at x0,
+ exact le_of_mul_le_mul_right h x0,
+end ⟩
+
+instance [canonically_ordered_comm_semiring α] [nontrivial α] :
+ ordered_comm_semiring (with_bot α) :=
+{ mul_le_mul_of_nonneg_left := λ _ _ _, mul_le_mul_of_nonneg_left,
+ mul_le_mul_of_nonneg_right := λ _ _ _, mul_le_mul_of_nonneg_right,
+ .. with_bot.zero_le_one_class,
+ .. with_bot.ordered_add_comm_monoid,
+ .. with_bot.comm_semiring, }
end with_bot
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
option.map₂
(#18081)
Relevant parts are forward-ported as leanprover-community/mathlib4#1439
Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@@ -30,12 +30,11 @@ variables [has_zero α] [has_mul α]
instance : mul_zero_class (with_top α) :=
{ zero := 0,
- mul := λ m n, if m = 0 ∨ n = 0 then 0 else m.bind (λa, n.bind $ λb, ↑(a * b)),
+ mul := λ m n, if m = 0 ∨ n = 0 then 0 else option.map₂ (*) m n,
zero_mul := assume a, if_pos $ or.inl rfl,
mul_zero := assume a, if_pos $ or.inr rfl }
-lemma mul_def {a b : with_top α} :
- a * b = if a = 0 ∨ b = 0 then 0 else a.bind (λa, b.bind $ λb, ↑(a * b)) := rfl
+lemma mul_def {a b : with_top α} : a * b = if a = 0 ∨ b = 0 then 0 else option.map₂ (*) a b := rfl
@[simp] lemma mul_top {a : with_top α} (h : a ≠ 0) : a * ⊤ = ⊤ :=
by cases a; simp [mul_def, h]; refl
@@ -46,6 +45,14 @@ by cases a; simp [mul_def, h]; refl
@[simp] lemma top_mul_top : (⊤ * ⊤ : with_top α) = ⊤ :=
top_mul top_ne_zero
+instance [no_zero_divisors α] : no_zero_divisors (with_top α) :=
+begin
+ refine ⟨λ a b h₁, decidable.by_contradiction $ λ h₂, _⟩,
+ rw [mul_def, if_neg h₂] at h₁,
+ rcases option.mem_map₂_iff.1 h₁ with ⟨a, b, (rfl : _ = _), (rfl : _ = _), hab⟩,
+ exact h₂ ((eq_zero_or_eq_zero_of_mul_eq_zero hab).imp (congr_arg some) (congr_arg some))
+end
+
end has_mul
section mul_zero_class
@@ -55,7 +62,7 @@ variables [mul_zero_class α]
@[norm_cast] lemma coe_mul {a b : α} : (↑(a * b) : with_top α) = a * b :=
decidable.by_cases (assume : a = 0, by simp [this]) $ assume ha,
decidable.by_cases (assume : b = 0, by simp [this]) $ assume hb,
-by { simp [*, mul_def], refl }
+by { simp [*, mul_def] }
lemma mul_coe {b : α} (hb : b ≠ 0) : ∀{a : with_top α}, a * b = a.bind (λa:α, ↑(a * b))
| none := show (if (⊤:with_top α) = 0 ∨ (b:with_top α) = 0 then 0 else ⊤ : with_top α) = ⊤,
@@ -114,8 +121,8 @@ instance [mul_zero_one_class α] [nontrivial α] : mul_zero_one_class (with_top
begin
have : ∀ z, map f z = 0 ↔ z = 0,
from λ z, (option.map_injective hf).eq_iff' f.to_zero_hom.with_top_map.map_zero,
- rcases eq_or_ne x 0 with rfl|hx, { simp },
- rcases eq_or_ne y 0 with rfl|hy, { simp },
+ rcases decidable.eq_or_ne x 0 with rfl|hx, { simp },
+ rcases decidable.eq_or_ne y 0 with rfl|hy, { simp },
induction x using with_top.rec_top_coe, { simp [hy, this] },
induction y using with_top.rec_top_coe,
{ have : (f x : with_top S) ≠ 0, by simpa [hf.eq_iff' (map_zero f)] using hx,
@@ -124,10 +131,6 @@ instance [mul_zero_one_class α] [nontrivial α] : mul_zero_one_class (with_top
end,
.. f.to_zero_hom.with_top_map, .. f.to_monoid_hom.to_one_hom.with_top_map }
-instance [mul_zero_class α] [no_zero_divisors α] : no_zero_divisors (with_top α) :=
-⟨λ a b, by cases a; cases b; dsimp [mul_def]; split_ifs;
- simp [*, none_eq_top, some_eq_coe, mul_eq_zero] at *⟩
-
instance [semigroup_with_zero α] [no_zero_divisors α] : semigroup_with_zero (with_top α) :=
{ mul := (*),
zero := 0,
@@ -150,7 +153,7 @@ instance [comm_monoid_with_zero α] [no_zero_divisors α] [nontrivial α] :
{ mul := (*),
zero := 0,
mul_comm := λ a b,
- by simp only [or_comm, mul_def, option.bind_comm a b, mul_comm],
+ by simp only [or_comm, mul_def, mul_comm, @option.map₂_comm _ _ _ _ a b _ mul_comm],
.. with_top.monoid_with_zero }
variables [canonically_ordered_comm_semiring α]
@@ -202,7 +205,7 @@ instance : mul_zero_class (with_bot α) :=
with_top.mul_zero_class
lemma mul_def {a b : with_bot α} :
- a * b = if a = 0 ∨ b = 0 then 0 else a.bind (λa, b.bind $ λb, ↑(a * b)) := rfl
+ a * b = if a = 0 ∨ b = 0 then 0 else option.map₂ (*) a b := rfl
@[simp] lemma mul_bot {a : with_bot α} (h : a ≠ 0) : a * ⊥ = ⊥ :=
with_top.mul_top h
@@ -220,9 +223,7 @@ section mul_zero_class
variables [mul_zero_class α]
@[norm_cast] lemma coe_mul {a b : α} : (↑(a * b) : with_bot α) = a * b :=
-decidable.by_cases (assume : a = 0, by simp [this]) $ assume ha,
-decidable.by_cases (assume : b = 0, by simp [this]) $ assume hb,
-by { simp [*, mul_def], refl }
+with_top.coe_mul
lemma mul_coe {b : α} (hb : b ≠ 0) {a : with_bot α} : a * b = a.bind (λa:α, ↑(a * b)) :=
with_top.mul_coe hb
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -203,7 +203,7 @@ instance [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
mul := (· * ·)
zero := 0
mul_comm := fun a b => by
- simp only [or_comm', mul_def, mul_comm, @Option.map₂_comm _ _ _ _ a b _ mul_comm] }
+ simp only [or_comm, mul_def, mul_comm, @Option.map₂_comm _ _ _ _ a b _ mul_comm] }
variable [CanonicallyOrderedCommSemiring α]
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-/
-import Algebra.Hom.Ring
+import Algebra.Ring.Hom.Defs
import Algebra.Order.Monoid.WithTop
import Algebra.Order.Ring.Canonical
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -99,7 +99,7 @@ theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤)
instance [NoZeroDivisors α] : NoZeroDivisors (WithTop α) :=
by
refine' ⟨fun a b h₁ => Decidable.by_contradiction fun h₂ => _⟩
- rw [mul_def, if_neg h₂] at h₁
+ rw [mul_def, if_neg h₂] at h₁
rcases Option.mem_map₂_iff.1 h₁ with ⟨a, b, rfl : _ = _, rfl : _ = _, hab⟩
exact h₂ ((eq_zero_or_eq_zero_of_mul_eq_zero hab).imp (congr_arg some) (congr_arg some))
@@ -348,7 +348,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMono α] : PosMulMono (WithBot
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_le_mul_of_nonneg_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot α) :=
@@ -359,7 +359,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_le_mul_of_nonneg_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMono (WithBot α) :=
@@ -369,7 +369,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMon
induction b using WithBot.recBotCoe; · exact absurd h not_lt_bot
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_lt_mul_of_pos_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMono (WithBot α) :=
@@ -379,51 +379,51 @@ instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMon
induction b using WithBot.recBotCoe; · exact absurd h not_lt_bot
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_lt_mul_of_pos_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
rcases eq_or_ne x 0 with (rfl | x0'); · simpa using h
lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
- induction b using WithBot.recBotCoe; · rw [mul_bot x0'] at h ; exact absurd h bot_le.not_lt
+ induction b using WithBot.recBotCoe; · rw [mul_bot x0'] at h; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact lt_of_mul_lt_mul_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
rcases eq_or_ne x 0 with (rfl | x0'); · simpa using h
lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
- induction b using WithBot.recBotCoe; · rw [bot_mul x0'] at h ; exact absurd h bot_le.not_lt
+ induction b using WithBot.recBotCoe; · rw [bot_mul x0'] at h; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact lt_of_mul_lt_mul_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulReflectLE α] : PosMulReflectLE (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
induction a using WithBot.recBotCoe; · exact bot_le
induction b using WithBot.recBotCoe
- · rw [mul_bot x0.ne.symm, ← coe_mul] at h ; exact absurd h (bot_lt_coe (x * a)).not_le
+ · rw [mul_bot x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe (x * a)).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact le_of_mul_le_mul_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosReflectLE α] : MulPosReflectLE (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
induction a using WithBot.recBotCoe; · exact bot_le
induction b using WithBot.recBotCoe
- · rw [bot_mul x0.ne.symm, ← coe_mul] at h ; exact absurd h (bot_lt_coe (a * x)).not_le
+ · rw [bot_mul x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe (a * x)).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact le_of_mul_le_mul_right h x0⟩
instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : OrderedCommSemiring (WithBot α) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -117,12 +117,13 @@ theorem coe_mul {a b : α} : (↑(a * b) : WithTop α) = a * b :=
#align with_top.coe_mul WithTop.coe_mul
-/
-#print WithTop.mul_coe /-
-theorem mul_coe {b : α} (hb : b ≠ 0) : ∀ {a : WithTop α}, a * b = a.bind fun a : α => ↑(a * b)
+#print WithTop.mul_coe_eq_bind /-
+theorem mul_coe_eq_bind {b : α} (hb : b ≠ 0) :
+ ∀ {a : WithTop α}, a * b = a.bind fun a : α => ↑(a * b)
| none =>
show (if (⊤ : WithTop α) = 0 ∨ (b : WithTop α) = 0 then 0 else ⊤ : WithTop α) = ⊤ by simp [hb]
| some a => show ↑a * ↑b = ↑(a * b) from coe_mul.symm
-#align with_top.mul_coe WithTop.mul_coe
+#align with_top.mul_coe WithTop.mul_coe_eq_bind
-/
#print WithTop.untop'_zero_mul /-
@@ -310,10 +311,11 @@ theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b :=
#align with_bot.coe_mul WithBot.coe_mul
-/
-#print WithBot.mul_coe /-
-theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} : a * b = a.bind fun a : α => ↑(a * b) :=
- WithTop.mul_coe hb
-#align with_bot.mul_coe WithBot.mul_coe
+#print WithBot.mul_coe_eq_bind /-
+theorem mul_coe_eq_bind {b : α} (hb : b ≠ 0) {a : WithBot α} :
+ a * b = a.bind fun a : α => ↑(a * b) :=
+ WithTop.mul_coe_eq_bind hb
+#align with_bot.mul_coe WithBot.mul_coe_eq_bind
-/
end MulZeroClass
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -402,7 +402,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT
norm_cast at x0
exact lt_of_mul_lt_mul_right h x0⟩
-instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (WithBot α) :=
+instance [MulZeroClass α] [Preorder α] [PosMulReflectLE α] : PosMulReflectLE (WithBot α) :=
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
@@ -413,7 +413,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (Wit
norm_cast at x0
exact le_of_mul_le_mul_left h x0⟩
-instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (WithBot α) :=
+instance [MulZeroClass α] [Preorder α] [MulPosReflectLE α] : MulPosReflectLE (WithBot α) :=
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-/
-import Mathbin.Algebra.Hom.Ring
-import Mathbin.Algebra.Order.Monoid.WithTop
-import Mathbin.Algebra.Order.Ring.Canonical
+import Algebra.Hom.Ring
+import Algebra.Order.Monoid.WithTop
+import Algebra.Order.Ring.Canonical
#align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
mathlib commit https://github.com/leanprover-community/mathlib/commit/63721b2c3eba6c325ecf8ae8cca27155a4f6306f
@@ -425,7 +425,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (Wit
exact le_of_mul_le_mul_right h x0⟩
instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : OrderedCommSemiring (WithBot α) :=
- { WithBot.zeroLeOneClass, WithBot.orderedAddCommMonoid,
+ { WithBot.zeroLEOneClass, WithBot.orderedAddCommMonoid,
WithBot.commSemiring with
mul_le_mul_of_nonneg_left := fun _ _ _ => mul_le_mul_of_nonneg_left
mul_le_mul_of_nonneg_right := fun _ _ _ => mul_le_mul_of_nonneg_right }
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit 0111834459f5d7400215223ea95ae38a1265a907
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.Hom.Ring
import Mathbin.Algebra.Order.Monoid.WithTop
import Mathbin.Algebra.Order.Ring.Canonical
+#align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
+
/-! # Structures involving `*` and `0` on `with_top` and `with_bot`
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -38,31 +38,44 @@ instance : MulZeroClass (WithTop α) where
zero_mul a := if_pos <| Or.inl rfl
mul_zero a := if_pos <| Or.inr rfl
+#print WithTop.mul_def /-
theorem mul_def {a b : WithTop α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
#align with_top.mul_def WithTop.mul_def
+-/
+#print WithTop.mul_top' /-
theorem mul_top' {a : WithTop α} : a * ⊤ = if a = 0 then 0 else ⊤ := by
induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
#align with_top.mul_top' WithTop.mul_top'
+-/
+#print WithTop.mul_top /-
@[simp]
theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
#align with_top.mul_top WithTop.mul_top
+-/
+#print WithTop.top_mul' /-
theorem top_mul' {a : WithTop α} : ⊤ * a = if a = 0 then 0 else ⊤ := by
induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
#align with_top.top_mul' WithTop.top_mul'
+-/
+#print WithTop.top_mul /-
@[simp]
theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by rw [top_mul', if_neg h]
#align with_top.top_mul WithTop.top_mul
+-/
+#print WithTop.top_mul_top /-
@[simp]
theorem top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ :=
top_mul top_ne_zero
#align with_top.top_mul_top WithTop.top_mul_top
+-/
+#print WithTop.mul_eq_top_iff /-
theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 :=
by
rw [mul_def, ite_eq_iff, ← none_eq_top, Option.map₂_eq_none_iff]
@@ -70,16 +83,21 @@ theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤
have hb : b = 0 → b ≠ none := fun h => h.symm ▸ zero_ne_top
tauto
#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
+-/
+#print WithTop.mul_lt_top' /-
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ :=
by
rw [WithTop.lt_top_iff_ne_top] at *
simp only [Ne.def, mul_eq_top_iff, *, and_false_iff, false_and_iff, false_or_iff, not_false_iff]
#align with_top.mul_lt_top' WithTop.mul_lt_top'
+-/
+#print WithTop.mul_lt_top /-
theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
mul_lt_top' (WithTop.lt_top_iff_ne_top.2 ha) (WithTop.lt_top_iff_ne_top.2 hb)
#align with_top.mul_lt_top WithTop.mul_lt_top
+-/
instance [NoZeroDivisors α] : NoZeroDivisors (WithTop α) :=
by
@@ -94,18 +112,23 @@ section MulZeroClass
variable [MulZeroClass α]
+#print WithTop.coe_mul /-
@[simp, norm_cast]
theorem coe_mul {a b : α} : (↑(a * b) : WithTop α) = a * b :=
Decidable.byCases (fun this : a = 0 => by simp [this]) fun ha =>
Decidable.byCases (fun this : b = 0 => by simp [this]) fun hb => by simp [*, mul_def]
#align with_top.coe_mul WithTop.coe_mul
+-/
+#print WithTop.mul_coe /-
theorem mul_coe {b : α} (hb : b ≠ 0) : ∀ {a : WithTop α}, a * b = a.bind fun a : α => ↑(a * b)
| none =>
show (if (⊤ : WithTop α) = 0 ∨ (b : WithTop α) = 0 then 0 else ⊤ : WithTop α) = ⊤ by simp [hb]
| some a => show ↑a * ↑b = ↑(a * b) from coe_mul.symm
#align with_top.mul_coe WithTop.mul_coe
+-/
+#print WithTop.untop'_zero_mul /-
@[simp]
theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 :=
by
@@ -117,6 +140,7 @@ theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.u
induction b using WithTop.recTopCoe; · rw [mul_top ha, untop'_top, MulZeroClass.mul_zero]
rw [← coe_mul, untop'_coe, untop'_coe, untop'_coe]
#align with_top.untop'_zero_mul WithTop.untop'_zero_mul
+-/
end MulZeroClass
@@ -135,6 +159,7 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
| ⊤ => top_mul (mt coe_eq_coe.1 one_ne_zero)
| (a : α) => by rw [← coe_one, ← coe_mul, mul_one] }
+#print MonoidWithZeroHom.withTopMap /-
/-- A version of `with_top.map` for `monoid_with_zero_hom`s. -/
@[simps (config := { fullyApplied := false })]
protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [DecidableEq R]
@@ -155,6 +180,7 @@ protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [D
simp [hx, this]
simp only [← coe_mul, map_coe, map_mul] }
#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
+-/
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
{ WithTop.mulZeroClass with
@@ -206,6 +232,7 @@ instance [Nontrivial α] : CommSemiring (WithTop α) :=
instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
{ WithTop.commSemiring, WithTop.canonicallyOrderedAddMonoid, WithTop.noZeroDivisors with }
+#print RingHom.withTopMap /-
/-- A version of `with_top.map` for `ring_hom`s. -/
@[simps (config := { fullyApplied := false })]
protected def RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R] [DecidableEq R]
@@ -213,6 +240,7 @@ protected def RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring
(hf : Function.Injective f) : WithTop R →+* WithTop S :=
{ f.toMonoidWithZeroHom.withTop_map hf, f.toAddMonoidHom.withTop_map with toFun := WithTop.map f }
#align ring_hom.with_top_map RingHom.withTopMap
+-/
end WithTop
@@ -227,36 +255,50 @@ variable [Zero α] [Mul α]
instance : MulZeroClass (WithBot α) :=
WithTop.mulZeroClass
+#print WithBot.mul_def /-
theorem mul_def {a b : WithBot α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
#align with_bot.mul_def WithBot.mul_def
+-/
+#print WithBot.mul_bot /-
@[simp]
theorem mul_bot {a : WithBot α} (h : a ≠ 0) : a * ⊥ = ⊥ :=
WithTop.mul_top h
#align with_bot.mul_bot WithBot.mul_bot
+-/
+#print WithBot.bot_mul /-
@[simp]
theorem bot_mul {a : WithBot α} (h : a ≠ 0) : ⊥ * a = ⊥ :=
WithTop.top_mul h
#align with_bot.bot_mul WithBot.bot_mul
+-/
+#print WithBot.bot_mul_bot /-
@[simp]
theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
WithTop.top_mul_top
#align with_bot.bot_mul_bot WithBot.bot_mul_bot
+-/
+#print WithBot.mul_eq_bot_iff /-
theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
WithTop.mul_eq_top_iff
#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
+-/
+#print WithBot.bot_lt_mul' /-
theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
@WithTop.mul_lt_top' αᵒᵈ _ _ _ _ _ _ ha hb
#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'
+-/
+#print WithBot.bot_lt_mul /-
theorem bot_lt_mul [LT α] {a b : WithBot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : ⊥ < a * b :=
@WithTop.mul_lt_top αᵒᵈ _ _ _ _ _ _ ha hb
#align with_bot.bot_lt_mul WithBot.bot_lt_mul
+-/
end Mul
@@ -264,14 +306,18 @@ section MulZeroClass
variable [MulZeroClass α]
+#print WithBot.coe_mul /-
@[norm_cast]
theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b :=
WithTop.coe_mul
#align with_bot.coe_mul WithBot.coe_mul
+-/
+#print WithBot.mul_coe /-
theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} : a * b = a.bind fun a : α => ↑(a * b) :=
WithTop.mul_coe hb
#align with_bot.mul_coe WithBot.mul_coe
+-/
end MulZeroClass
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -303,7 +303,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMono α] : PosMulMono (WithBot
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_le_mul_of_nonneg_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot α) :=
@@ -314,7 +314,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_le_mul_of_nonneg_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMono (WithBot α) :=
@@ -324,7 +324,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMon
induction b using WithBot.recBotCoe; · exact absurd h not_lt_bot
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_lt_mul_of_pos_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMono (WithBot α) :=
@@ -334,7 +334,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMon
induction b using WithBot.recBotCoe; · exact absurd h not_lt_bot
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_lt_mul_of_pos_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT (WithBot α) :=
@@ -345,7 +345,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT
induction b using WithBot.recBotCoe; · rw [mul_bot x0'] at h ; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact lt_of_mul_lt_mul_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT (WithBot α) :=
@@ -356,7 +356,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT
induction b using WithBot.recBotCoe; · rw [bot_mul x0'] at h ; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact lt_of_mul_lt_mul_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (WithBot α) :=
@@ -367,7 +367,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (Wit
induction b using WithBot.recBotCoe
· rw [mul_bot x0.ne.symm, ← coe_mul] at h ; exact absurd h (bot_lt_coe (x * a)).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact le_of_mul_le_mul_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (WithBot α) :=
@@ -378,7 +378,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (Wit
induction b using WithBot.recBotCoe
· rw [bot_mul x0.ne.symm, ← coe_mul] at h ; exact absurd h (bot_lt_coe (a * x)).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact le_of_mul_le_mul_right h x0⟩
instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : OrderedCommSemiring (WithBot α) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -84,7 +84,7 @@ theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤)
instance [NoZeroDivisors α] : NoZeroDivisors (WithTop α) :=
by
refine' ⟨fun a b h₁ => Decidable.by_contradiction fun h₂ => _⟩
- rw [mul_def, if_neg h₂] at h₁
+ rw [mul_def, if_neg h₂] at h₁
rcases Option.mem_map₂_iff.1 h₁ with ⟨a, b, rfl : _ = _, rfl : _ = _, hab⟩
exact h₂ ((eq_zero_or_eq_zero_of_mul_eq_zero hab).imp (congr_arg some) (congr_arg some))
@@ -189,7 +189,10 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c :=
· by_cases ha : a = 0 <;> simp [ha]
· by_cases hc : c = 0; · simp [hc]
simp only [mul_coe hc]; cases a <;> cases b
- repeat' first |rfl|exact congr_arg some (add_mul _ _ _)
+ repeat'
+ first
+ | rfl
+ | exact congr_arg some (add_mul _ _ _)
/-- This instance requires `canonically_ordered_comm_semiring` as it is the smallest class
that derives from both `non_assoc_non_unital_semiring` and `canonically_ordered_add_monoid`, both
@@ -300,7 +303,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMono α] : PosMulMono (WithBot
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_le_mul_of_nonneg_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot α) :=
@@ -311,7 +314,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_le_mul_of_nonneg_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMono (WithBot α) :=
@@ -321,7 +324,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMon
induction b using WithBot.recBotCoe; · exact absurd h not_lt_bot
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_lt_mul_of_pos_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMono (WithBot α) :=
@@ -331,51 +334,51 @@ instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMon
induction b using WithBot.recBotCoe; · exact absurd h not_lt_bot
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact mul_lt_mul_of_pos_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
rcases eq_or_ne x 0 with (rfl | x0'); · simpa using h
lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
- induction b using WithBot.recBotCoe; · rw [mul_bot x0'] at h; exact absurd h bot_le.not_lt
+ induction b using WithBot.recBotCoe; · rw [mul_bot x0'] at h ; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact lt_of_mul_lt_mul_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
rcases eq_or_ne x 0 with (rfl | x0'); · simpa using h
lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
- induction b using WithBot.recBotCoe; · rw [bot_mul x0'] at h; exact absurd h bot_le.not_lt
+ induction b using WithBot.recBotCoe; · rw [bot_mul x0'] at h ; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact lt_of_mul_lt_mul_right h x0⟩
instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
induction a using WithBot.recBotCoe; · exact bot_le
induction b using WithBot.recBotCoe
- · rw [mul_bot x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe (x * a)).not_le
+ · rw [mul_bot x0.ne.symm, ← coe_mul] at h ; exact absurd h (bot_lt_coe (x * a)).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact le_of_mul_le_mul_left h x0⟩
instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (WithBot α) :=
⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
+ rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
induction a using WithBot.recBotCoe; · exact bot_le
induction b using WithBot.recBotCoe
- · rw [bot_mul x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe (a * x)).not_le
+ · rw [bot_mul x0.ne.symm, ← coe_mul] at h ; exact absurd h (bot_lt_coe (a * x)).not_le
simp only [← coe_mul, coe_le_coe] at *
- norm_cast at x0
+ norm_cast at x0
exact le_of_mul_le_mul_right h x0⟩
instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : OrderedCommSemiring (WithBot α) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -38,73 +38,31 @@ instance : MulZeroClass (WithTop α) where
zero_mul a := if_pos <| Or.inl rfl
mul_zero a := if_pos <| Or.inr rfl
-/- warning: with_top.mul_def -> WithTop.mul_def is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithTop.{u1} α) (Or (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithTop.{u1} α) (Or (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.200 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.202 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.200 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.202) a b))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_def WithTop.mul_defₓ'. -/
theorem mul_def {a b : WithTop α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
#align with_top.mul_def WithTop.mul_def
-/- warning: with_top.mul_top' -> WithTop.mul_top' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] (a : WithTop.{u1} α), Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_top' WithTop.mul_top'ₓ'. -/
theorem mul_top' {a : WithTop α} : a * ⊤ = if a = 0 then 0 else ⊤ := by
induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
#align with_top.mul_top' WithTop.mul_top'
-/- warning: with_top.mul_top -> WithTop.mul_top is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_top WithTop.mul_topₓ'. -/
@[simp]
theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
#align with_top.mul_top WithTop.mul_top
-/- warning: with_top.top_mul' -> WithTop.top_mul' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)) a) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] (a : WithTop.{u1} α), Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)) a) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.top_mul' WithTop.top_mul'ₓ'. -/
theorem top_mul' {a : WithTop α} : ⊤ * a = if a = 0 then 0 else ⊤ := by
induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
#align with_top.top_mul' WithTop.top_mul'
-/- warning: with_top.top_mul -> WithTop.top_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)) a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)) a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.top_mul WithTop.top_mulₓ'. -/
@[simp]
theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by rw [top_mul', if_neg h]
#align with_top.top_mul WithTop.top_mul
-/- warning: with_top.top_mul_top -> WithTop.top_mul_top is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α], Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α], Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))
-Case conversion may be inaccurate. Consider using '#align with_top.top_mul_top WithTop.top_mul_topₓ'. -/
@[simp]
theorem top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ :=
top_mul top_ne_zero
#align with_top.top_mul_top WithTop.top_mul_top
-/- warning: with_top.mul_eq_top_iff -> WithTop.mul_eq_top_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iffₓ'. -/
theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 :=
by
rw [mul_def, ite_eq_iff, ← none_eq_top, Option.map₂_eq_none_iff]
@@ -113,24 +71,12 @@ theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤
tauto
#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
-/- warning: with_top.mul_lt_top' -> WithTop.mul_lt_top' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_lt_top' WithTop.mul_lt_top'ₓ'. -/
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ :=
by
rw [WithTop.lt_top_iff_ne_top] at *
simp only [Ne.def, mul_eq_top_iff, *, and_false_iff, false_and_iff, false_or_iff, not_false_iff]
#align with_top.mul_lt_top' WithTop.mul_lt_top'
-/- warning: with_top.mul_lt_top -> WithTop.mul_lt_top is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_lt_top WithTop.mul_lt_topₓ'. -/
theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
mul_lt_top' (WithTop.lt_top_iff_ne_top.2 ha) (WithTop.lt_top_iff_ne_top.2 hb)
#align with_top.mul_lt_top WithTop.mul_lt_top
@@ -148,36 +94,18 @@ section MulZeroClass
variable [MulZeroClass α]
-/- warning: with_top.coe_mul -> WithTop.coe_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : α} {b : α}, Eq.{succ u1} (WithTop.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toHasMul.{u1} α _inst_2)) a b)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : α} {b : α}, Eq.{succ u1} (WithTop.{u1} α) (WithTop.some.{u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toMul.{u1} α _inst_2)) a b)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) (WithTop.some.{u1} α a) (WithTop.some.{u1} α b))
-Case conversion may be inaccurate. Consider using '#align with_top.coe_mul WithTop.coe_mulₓ'. -/
@[simp, norm_cast]
theorem coe_mul {a b : α} : (↑(a * b) : WithTop α) = a * b :=
Decidable.byCases (fun this : a = 0 => by simp [this]) fun ha =>
Decidable.byCases (fun this : b = 0 => by simp [this]) fun hb => by simp [*, mul_def]
#align with_top.coe_mul WithTop.coe_mul
-/- warning: with_top.mul_coe -> WithTop.mul_coe is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {b : α}, (Ne.{succ u1} α b (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2))))) -> (forall {a : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) b)) (Option.bind.{u1, u1} α α a (fun (a : α) => (fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toHasMul.{u1} α _inst_2)) a b))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {b : α}, (Ne.{succ u1} α b (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))) -> (forall {a : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a (WithTop.some.{u1} α b)) (Option.bind.{u1, u1} α α a (fun (a : α) => Option.some.{u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toMul.{u1} α _inst_2)) a b))))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_coe WithTop.mul_coeₓ'. -/
theorem mul_coe {b : α} (hb : b ≠ 0) : ∀ {a : WithTop α}, a * b = a.bind fun a : α => ↑(a * b)
| none =>
show (if (⊤ : WithTop α) = 0 ∨ (b : WithTop α) = 0 then 0 else ⊤ : WithTop α) = ⊤ by simp [hb]
| some a => show ↑a * ↑b = ↑(a * b) from coe_mul.symm
#align with_top.mul_coe WithTop.mul_coe
-/- warning: with_top.untop'_zero_mul -> WithTop.untop'_zero_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] (a : WithTop.{u1} α) (b : WithTop.{u1} α), Eq.{succ u1} α (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a b)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toHasMul.{u1} α _inst_2)) (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))) a) (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))) b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] (a : WithTop.{u1} α) (b : WithTop.{u1} α), Eq.{succ u1} α (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a b)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toMul.{u1} α _inst_2)) (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))) a) (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))) b))
-Case conversion may be inaccurate. Consider using '#align with_top.untop'_zero_mul WithTop.untop'_zero_mulₓ'. -/
@[simp]
theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 :=
by
@@ -207,12 +135,6 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
| ⊤ => top_mul (mt coe_eq_coe.1 one_ne_zero)
| (a : α) => by rw [← coe_one, ← coe_mul, mul_one] }
-/- warning: monoid_with_zero_hom.with_top_map -> MonoidWithZeroHom.withTopMap is a dubious translation:
-lean 3 declaration is
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) (fun (_x : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) => R -> S) (MonoidWithZeroHom.hasCoeToFun.{u1, u2} R S _inst_2 _inst_5) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.mulZeroOneClass.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.mulZeroOneClass.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
-but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
-Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `monoid_with_zero_hom`s. -/
@[simps (config := { fullyApplied := false })]
protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [DecidableEq R]
@@ -281,12 +203,6 @@ instance [Nontrivial α] : CommSemiring (WithTop α) :=
instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
{ WithTop.commSemiring, WithTop.canonicallyOrderedAddMonoid, WithTop.noZeroDivisors with }
-/- warning: ring_hom.with_top_map -> RingHom.withTopMap is a dubious translation:
-lean 3 declaration is
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (fun (_x : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) => R -> S) (RingHom.hasCoeToFun.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.canonicallyOrderedCommSemiring.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.canonicallyOrderedCommSemiring.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
-but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
-Case conversion may be inaccurate. Consider using '#align ring_hom.with_top_map RingHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `ring_hom`s. -/
@[simps (config := { fullyApplied := false })]
protected def RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R] [DecidableEq R]
@@ -308,75 +224,33 @@ variable [Zero α] [Mul α]
instance : MulZeroClass (WithBot α) :=
WithTop.mulZeroClass
-/- warning: with_bot.mul_def -> WithBot.mul_def is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3008 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3010 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3008 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3010) a b))
-Case conversion may be inaccurate. Consider using '#align with_bot.mul_def WithBot.mul_defₓ'. -/
theorem mul_def {a b : WithBot α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
#align with_bot.mul_def WithBot.mul_def
-/- warning: with_bot.mul_bot -> WithBot.mul_bot is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) -> (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) -> (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_bot.mul_bot WithBot.mul_botₓ'. -/
@[simp]
theorem mul_bot {a : WithBot α} (h : a ≠ 0) : a * ⊥ = ⊥ :=
WithTop.mul_top h
#align with_bot.mul_bot WithBot.mul_bot
-/- warning: with_bot.bot_mul -> WithBot.bot_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) -> (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) a) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) -> (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) a) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_bot.bot_mul WithBot.bot_mulₓ'. -/
@[simp]
theorem bot_mul {a : WithBot α} (h : a ≠ 0) : ⊥ * a = ⊥ :=
WithTop.top_mul h
#align with_bot.bot_mul WithBot.bot_mul
-/- warning: with_bot.bot_mul_bot -> WithBot.bot_mul_bot is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α], Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α], Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))
-Case conversion may be inaccurate. Consider using '#align with_bot.bot_mul_bot WithBot.bot_mul_botₓ'. -/
@[simp]
theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
WithTop.top_mul_top
#align with_bot.bot_mul_bot WithBot.bot_mul_bot
-/- warning: with_bot.mul_eq_bot_iff -> WithBot.mul_eq_bot_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))))
-Case conversion may be inaccurate. Consider using '#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iffₓ'. -/
theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
WithTop.mul_eq_top_iff
#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
-/- warning: with_bot.bot_lt_mul' -> WithBot.bot_lt_mul' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) b) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) b) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
-Case conversion may be inaccurate. Consider using '#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'ₓ'. -/
theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
@WithTop.mul_lt_top' αᵒᵈ _ _ _ _ _ _ ha hb
#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'
-/- warning: with_bot.bot_lt_mul -> WithBot.bot_lt_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) -> (Ne.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) -> (Ne.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
-Case conversion may be inaccurate. Consider using '#align with_bot.bot_lt_mul WithBot.bot_lt_mulₓ'. -/
theorem bot_lt_mul [LT α] {a b : WithBot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : ⊥ < a * b :=
@WithTop.mul_lt_top αᵒᵈ _ _ _ _ _ _ ha hb
#align with_bot.bot_lt_mul WithBot.bot_lt_mul
@@ -387,23 +261,11 @@ section MulZeroClass
variable [MulZeroClass α]
-/- warning: with_bot.coe_mul -> WithBot.coe_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : α} {b : α}, Eq.{succ u1} (WithBot.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toHasMul.{u1} α _inst_2)) a b)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : α} {b : α}, Eq.{succ u1} (WithBot.{u1} α) (WithBot.some.{u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toMul.{u1} α _inst_2)) a b)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) (WithBot.some.{u1} α a) (WithBot.some.{u1} α b))
-Case conversion may be inaccurate. Consider using '#align with_bot.coe_mul WithBot.coe_mulₓ'. -/
@[norm_cast]
theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b :=
WithTop.coe_mul
#align with_bot.coe_mul WithBot.coe_mul
-/- warning: with_bot.mul_coe -> WithBot.mul_coe is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {b : α}, (Ne.{succ u1} α b (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2))))) -> (forall {a : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) b)) (Option.bind.{u1, u1} α α a (fun (a : α) => (fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toHasMul.{u1} α _inst_2)) a b))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {b : α}, (Ne.{succ u1} α b (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))) -> (forall {a : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a (WithBot.some.{u1} α b)) (Option.bind.{u1, u1} α α a (fun (a : α) => Option.some.{u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toMul.{u1} α _inst_2)) a b))))
-Case conversion may be inaccurate. Consider using '#align with_bot.mul_coe WithBot.mul_coeₓ'. -/
theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} : a * b = a.bind fun a : α => ↑(a * b) :=
WithTop.mul_coe hb
#align with_bot.mul_coe WithBot.mul_coe
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -225,12 +225,9 @@ protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [D
by
have : ∀ z, map f z = 0 ↔ z = 0 := fun z =>
(Option.map_injective hf).eq_iff' f.to_zero_hom.with_top_map.map_zero
- rcases Decidable.eq_or_ne x 0 with (rfl | hx)
- · simp
- rcases Decidable.eq_or_ne y 0 with (rfl | hy)
- · simp
- induction x using WithTop.recTopCoe
- · simp [hy, this]
+ rcases Decidable.eq_or_ne x 0 with (rfl | hx); · simp
+ rcases Decidable.eq_or_ne y 0 with (rfl | hy); · simp
+ induction x using WithTop.recTopCoe; · simp [hy, this]
induction y using WithTop.recTopCoe
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [hx, this]
@@ -268,10 +265,8 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c :=
by
induction c using WithTop.recTopCoe
· by_cases ha : a = 0 <;> simp [ha]
- · by_cases hc : c = 0
- · simp [hc]
- simp only [mul_coe hc]
- cases a <;> cases b
+ · by_cases hc : c = 0; · simp [hc]
+ simp only [mul_coe hc]; cases a <;> cases b
repeat' first |rfl|exact congr_arg some (add_mul _ _ _)
/-- This instance requires `canonically_ordered_comm_semiring` as it is the smallest class
@@ -281,10 +276,7 @@ instance [Nontrivial α] : CommSemiring (WithTop α) :=
{ WithTop.addCommMonoidWithOne,
WithTop.commMonoidWithZero with
right_distrib := distrib'
- left_distrib := fun a b c =>
- by
- rw [mul_comm, distrib', mul_comm b, mul_comm c]
- rfl }
+ left_distrib := fun a b c => by rw [mul_comm, distrib', mul_comm b, mul_comm c]; rfl }
instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
{ WithTop.commSemiring, WithTop.canonicallyOrderedAddMonoid, WithTop.noZeroDivisors with }
@@ -442,9 +434,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMono α] : PosMulMono (WithBot
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk]
rcases eq_or_ne x 0 with (rfl | x0'); · simp
- lift x to α;
- · rintro ⟨rfl⟩
- exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
induction a using WithBot.recBotCoe; · simp_rw [mul_bot x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
@@ -455,9 +445,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk]
rcases eq_or_ne x 0 with (rfl | x0'); · simp
- lift x to α;
- · rintro ⟨rfl⟩
- exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
induction a using WithBot.recBotCoe; · simp_rw [bot_mul x0', bot_le]
induction b using WithBot.recBotCoe; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *
@@ -488,12 +476,8 @@ instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
rcases eq_or_ne x 0 with (rfl | x0'); · simpa using h
- lift x to α;
- · rintro ⟨rfl⟩
- exact (WithBot.bot_lt_coe (0 : α)).not_le x0
- induction b using WithBot.recBotCoe;
- · rw [mul_bot x0'] at h
- exact absurd h bot_le.not_lt
+ lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ induction b using WithBot.recBotCoe; · rw [mul_bot x0'] at h; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
norm_cast at x0
@@ -503,12 +487,8 @@ instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk] at h
rcases eq_or_ne x 0 with (rfl | x0'); · simpa using h
- lift x to α;
- · rintro ⟨rfl⟩
- exact (WithBot.bot_lt_coe (0 : α)).not_le x0
- induction b using WithBot.recBotCoe;
- · rw [bot_mul x0'] at h
- exact absurd h bot_le.not_lt
+ lift x to α; · rintro ⟨rfl⟩; exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ induction b using WithBot.recBotCoe; · rw [bot_mul x0'] at h; exact absurd h bot_le.not_lt
induction a using WithBot.recBotCoe; · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
norm_cast at x0
@@ -520,8 +500,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (Wit
lift x to α using x0.ne_bot
induction a using WithBot.recBotCoe; · exact bot_le
induction b using WithBot.recBotCoe
- · rw [mul_bot x0.ne.symm, ← coe_mul] at h
- exact absurd h (bot_lt_coe (x * a)).not_le
+ · rw [mul_bot x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe (x * a)).not_le
simp only [← coe_mul, coe_le_coe] at *
norm_cast at x0
exact le_of_mul_le_mul_left h x0⟩
@@ -532,8 +511,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (Wit
lift x to α using x0.ne_bot
induction a using WithBot.recBotCoe; · exact bot_le
induction b using WithBot.recBotCoe
- · rw [bot_mul x0.ne.symm, ← coe_mul] at h
- exact absurd h (bot_lt_coe (a * x)).not_le
+ · rw [bot_mul x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe (a * x)).not_le
simp only [← coe_mul, coe_le_coe] at *
norm_cast at x0
exact le_of_mul_le_mul_right h x0⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -273,7 +273,6 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c :=
simp only [mul_coe hc]
cases a <;> cases b
repeat' first |rfl|exact congr_arg some (add_mul _ _ _)
-#align with_top.distrib' with_top.distrib'
/-- This instance requires `canonically_ordered_comm_semiring` as it is the smallest class
that derives from both `non_assoc_non_unital_semiring` and `canonically_ordered_add_monoid`, both
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
@@ -211,7 +211,7 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) (fun (_x : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) => R -> S) (MonoidWithZeroHom.hasCoeToFun.{u1, u2} R S _inst_2 _inst_5) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.mulZeroOneClass.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.mulZeroOneClass.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
+ forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `monoid_with_zero_hom`s. -/
@[simps (config := { fullyApplied := false })]
@@ -294,7 +294,7 @@ instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (fun (_x : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) => R -> S) (RingHom.hasCoeToFun.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.canonicallyOrderedCommSemiring.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.canonicallyOrderedCommSemiring.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
+ forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2397 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
Case conversion may be inaccurate. Consider using '#align ring_hom.with_top_map RingHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `ring_hom`s. -/
@[simps (config := { fullyApplied := false })]
mathlib commit https://github.com/leanprover-community/mathlib/commit/02ba8949f486ebecf93fe7460f1ed0564b5e442c
@@ -42,7 +42,7 @@ instance : MulZeroClass (WithTop α) where
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithTop.{u1} α) (Or (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithTop.{u1} α) (Or (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.211 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.213 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.211 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.213) a b))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithTop.{u1} α) (Or (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.200 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.202 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.200 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.202) a b))
Case conversion may be inaccurate. Consider using '#align with_top.mul_def WithTop.mul_defₓ'. -/
theorem mul_def {a b : WithTop α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
@@ -321,7 +321,7 @@ instance : MulZeroClass (WithBot α) :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3030 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3032 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3030 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3032) a b))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3008 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3010 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3008 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3010) a b))
Case conversion may be inaccurate. Consider using '#align with_bot.mul_def WithBot.mul_defₓ'. -/
theorem mul_def {a b : WithBot α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
+! leanprover-community/mathlib commit 0111834459f5d7400215223ea95ae38a1265a907
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -26,9 +26,6 @@ variable {α : Type _}
namespace WithTop
-instance [Nonempty α] : Nontrivial (WithTop α) :=
- Option.nontrivial
-
variable [DecidableEq α]
section Mul
@@ -311,9 +308,6 @@ end WithTop
namespace WithBot
-instance [Nonempty α] : Nontrivial (WithBot α) :=
- Option.nontrivial
-
variable [DecidableEq α]
section Mul
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -214,7 +214,7 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) (fun (_x : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) => R -> S) (MonoidWithZeroHom.hasCoeToFun.{u1, u2} R S _inst_2 _inst_5) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.mulZeroOneClass.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.mulZeroOneClass.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
+ forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `monoid_with_zero_hom`s. -/
@[simps (config := { fullyApplied := false })]
@@ -297,7 +297,7 @@ instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (fun (_x : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) => R -> S) (RingHom.hasCoeToFun.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.canonicallyOrderedCommSemiring.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.canonicallyOrderedCommSemiring.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
+ forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
Case conversion may be inaccurate. Consider using '#align ring_hom.with_top_map RingHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `ring_hom`s. -/
@[simps (config := { fullyApplied := false })]
@@ -327,7 +327,7 @@ instance : MulZeroClass (WithBot α) :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3025 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3027 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3025 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3027) a b))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3030 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3032 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3030 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3032) a b))
Case conversion may be inaccurate. Consider using '#align with_bot.mul_def WithBot.mul_defₓ'. -/
theorem mul_def {a b : WithBot α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -184,10 +184,12 @@ Case conversion may be inaccurate. Consider using '#align with_top.untop'_zero_m
@[simp]
theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 :=
by
- by_cases ha : a = 0; · rw [ha, zero_mul, ← coe_zero, untop'_coe, zero_mul]
- by_cases hb : b = 0; · rw [hb, mul_zero, ← coe_zero, untop'_coe, mul_zero]
- induction a using WithTop.recTopCoe; · rw [top_mul hb, untop'_top, zero_mul]
- induction b using WithTop.recTopCoe; · rw [mul_top ha, untop'_top, mul_zero]
+ by_cases ha : a = 0;
+ · rw [ha, MulZeroClass.zero_mul, ← coe_zero, untop'_coe, MulZeroClass.zero_mul]
+ by_cases hb : b = 0;
+ · rw [hb, MulZeroClass.mul_zero, ← coe_zero, untop'_coe, MulZeroClass.mul_zero]
+ induction a using WithTop.recTopCoe; · rw [top_mul hb, untop'_top, MulZeroClass.zero_mul]
+ induction b using WithTop.recTopCoe; · rw [mul_top ha, untop'_top, MulZeroClass.mul_zero]
rw [← coe_mul, untop'_coe, untop'_coe, untop'_coe]
#align with_top.untop'_zero_mul WithTop.untop'_zero_mul
@@ -243,9 +245,10 @@ instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop
mul := (· * ·)
zero := 0
mul_assoc := fun a b c => by
- rcases eq_or_ne a 0 with (rfl | ha); · simp only [zero_mul]
- rcases eq_or_ne b 0 with (rfl | hb); · simp only [zero_mul, mul_zero]
- rcases eq_or_ne c 0 with (rfl | hc); · simp only [mul_zero]
+ rcases eq_or_ne a 0 with (rfl | ha); · simp only [MulZeroClass.zero_mul]
+ rcases eq_or_ne b 0 with (rfl | hb);
+ · simp only [MulZeroClass.zero_mul, MulZeroClass.mul_zero]
+ rcases eq_or_ne c 0 with (rfl | hc); · simp only [MulZeroClass.mul_zero]
induction a using WithTop.recTopCoe; · simp [hb, hc]
induction b using WithTop.recTopCoe; · simp [ha, hc]
induction c using WithTop.recTopCoe; · simp [ha, hb]
mathlib commit https://github.com/leanprover-community/mathlib/commit/38f16f960f5006c6c0c2bac7b0aba5273188f4e5
@@ -212,7 +212,7 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) (fun (_x : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) => R -> S) (MonoidWithZeroHom.hasCoeToFun.{u1, u2} R S _inst_2 _inst_5) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.mulZeroOneClass.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.mulZeroOneClass.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
+ forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `monoid_with_zero_hom`s. -/
@[simps (config := { fullyApplied := false })]
@@ -294,7 +294,7 @@ instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (fun (_x : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) => R -> S) (RingHom.hasCoeToFun.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.canonicallyOrderedCommSemiring.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.canonicallyOrderedCommSemiring.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
but is expected to have type
- forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
+ forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2372 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
Case conversion may be inaccurate. Consider using '#align ring_hom.with_top_map RingHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `ring_hom`s. -/
@[simps (config := { fullyApplied := false })]
mathlib commit https://github.com/leanprover-community/mathlib/commit/9da1b3534b65d9661eb8f42443598a92bbb49211
@@ -208,16 +208,16 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
| ⊤ => top_mul (mt coe_eq_coe.1 one_ne_zero)
| (a : α) => by rw [← coe_one, ← coe_mul, mul_one] }
-/- warning: monoid_with_zero_hom.with_top_map -> WithTop.MonoidWithZeroHom.withTopMap is a dubious translation:
+/- warning: monoid_with_zero_hom.with_top_map -> MonoidWithZeroHom.withTopMap is a dubious translation:
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u2) (succ u1), max (succ u1) (succ u2)} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) (fun (_x : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) => R -> S) (MonoidWithZeroHom.hasCoeToFun.{u1, u2} R S _inst_2 _inst_5) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.mulZeroOneClass.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.mulZeroOneClass.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
but is expected to have type
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_2 : MulZeroOneClass.{u1} R] [_inst_3 : DecidableEq.{succ u1} R] [_inst_4 : Nontrivial.{u1} R] [_inst_5 : MulZeroOneClass.{u2} S] [_inst_6 : DecidableEq.{succ u2} S] [_inst_7 : Nontrivial.{u2} S] (f : MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulOneClass.toMul.{u1} R (MulZeroOneClass.toMulOneClass.{u1} R _inst_2)) (MulOneClass.toMul.{u2} S (MulZeroOneClass.toMulOneClass.{u2} S _inst_5)) (MonoidHomClass.toMulHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S (MulZeroOneClass.toMulOneClass.{u1} R _inst_2) (MulZeroOneClass.toMulOneClass.{u2} S _inst_5) (MonoidWithZeroHomClass.toMonoidHomClass.{max u1 u2, u1, u2} (MonoidWithZeroHom.{u1, u2} R S _inst_2 _inst_5) R S _inst_2 _inst_5 (MonoidWithZeroHom.monoidWithZeroHomClass.{u1, u2} R S _inst_2 _inst_5)))) f)) -> (MonoidWithZeroHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (WithTop.instMulZeroOneClassWithTop.{u1} R (fun (a : R) (b : R) => _inst_3 a b) _inst_2 _inst_4) (WithTop.instMulZeroOneClassWithTop.{u2} S (fun (a : S) (b : S) => _inst_6 a b) _inst_5 _inst_7))
-Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.with_top_map WithTop.MonoidWithZeroHom.withTopMapₓ'. -/
+Case conversion may be inaccurate. Consider using '#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `monoid_with_zero_hom`s. -/
@[simps (config := { fullyApplied := false })]
-protected def WithTop.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R]
- [DecidableEq R] [Nontrivial R] [MulZeroOneClass S] [DecidableEq S] [Nontrivial S] (f : R →*₀ S)
+protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [DecidableEq R]
+ [Nontrivial R] [MulZeroOneClass S] [DecidableEq S] [Nontrivial S] (f : R →*₀ S)
(hf : Function.Injective f) : WithTop R →*₀ WithTop S :=
{ f.toZeroHom.withTop_map,
f.toMonoidHom.toOneHom.withTop_map with
@@ -236,7 +236,7 @@ protected def WithTop.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneCla
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [hx, this]
simp only [← coe_mul, map_coe, map_mul] }
-#align monoid_with_zero_hom.with_top_map WithTop.MonoidWithZeroHom.withTopMap
+#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
{ WithTop.mulZeroClass with
@@ -290,19 +290,19 @@ instance [Nontrivial α] : CommSemiring (WithTop α) :=
instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
{ WithTop.commSemiring, WithTop.canonicallyOrderedAddMonoid, WithTop.noZeroDivisors with }
-/- warning: ring_hom.with_top_map -> WithTop.RingHom.withTopMap is a dubious translation:
+/- warning: ring_hom.with_top_map -> RingHom.withTopMap is a dubious translation:
lean 3 declaration is
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (fun (_x : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) => R -> S) (RingHom.hasCoeToFun.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.canonicallyOrderedCommSemiring.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.canonicallyOrderedCommSemiring.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
but is expected to have type
forall {R : Type.{u1}} {S : Type.{u2}} [_inst_3 : CanonicallyOrderedCommSemiring.{u1} R] [_inst_4 : DecidableEq.{succ u1} R] [_inst_5 : Nontrivial.{u1} R] [_inst_6 : CanonicallyOrderedCommSemiring.{u2} S] [_inst_7 : DecidableEq.{succ u2} S] [_inst_8 : Nontrivial.{u2} S] (f : RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))), (Function.Injective.{succ u1, succ u2} R S (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2398 : R) => S) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))))) (NonUnitalNonAssocSemiring.toMul.{u2} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3))))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} S (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6))))) R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))) (RingHom.instRingHomClassRingHom.{u1, u2} R S (Semiring.toNonAssocSemiring.{u1} R (OrderedSemiring.toSemiring.{u1} R (OrderedCommSemiring.toOrderedSemiring.{u1} R (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} R _inst_3)))) (Semiring.toNonAssocSemiring.{u2} S (OrderedSemiring.toSemiring.{u2} S (OrderedCommSemiring.toOrderedSemiring.{u2} S (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} S _inst_6)))))))) f)) -> (RingHom.{u1, u2} (WithTop.{u1} R) (WithTop.{u2} S) (Semiring.toNonAssocSemiring.{u1} (WithTop.{u1} R) (OrderedSemiring.toSemiring.{u1} (WithTop.{u1} R) (OrderedCommSemiring.toOrderedSemiring.{u1} (WithTop.{u1} R) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u1} (WithTop.{u1} R) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u1} R (fun (a : R) (b : R) => _inst_4 a b) _inst_3 _inst_5))))) (Semiring.toNonAssocSemiring.{u2} (WithTop.{u2} S) (OrderedSemiring.toSemiring.{u2} (WithTop.{u2} S) (OrderedCommSemiring.toOrderedSemiring.{u2} (WithTop.{u2} S) (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{u2} (WithTop.{u2} S) (WithTop.instCanonicallyOrderedCommSemiringWithTop.{u2} S (fun (a : S) (b : S) => _inst_7 a b) _inst_6 _inst_8))))))
-Case conversion may be inaccurate. Consider using '#align ring_hom.with_top_map WithTop.RingHom.withTopMapₓ'. -/
+Case conversion may be inaccurate. Consider using '#align ring_hom.with_top_map RingHom.withTopMapₓ'. -/
/-- A version of `with_top.map` for `ring_hom`s. -/
@[simps (config := { fullyApplied := false })]
-protected def WithTop.RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R]
- [DecidableEq R] [Nontrivial R] [CanonicallyOrderedCommSemiring S] [DecidableEq S] [Nontrivial S]
- (f : R →+* S) (hf : Function.Injective f) : WithTop R →+* WithTop S :=
+protected def RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R] [DecidableEq R]
+ [Nontrivial R] [CanonicallyOrderedCommSemiring S] [DecidableEq S] [Nontrivial S] (f : R →+* S)
+ (hf : Function.Injective f) : WithTop R →+* WithTop S :=
{ f.toMonoidWithZeroHom.withTop_map hf, f.toAddMonoidHom.withTop_map with toFun := WithTop.map f }
-#align ring_hom.with_top_map WithTop.RingHom.withTopMap
+#align ring_hom.with_top_map RingHom.withTopMap
end WithTop
@@ -324,7 +324,7 @@ instance : MulZeroClass (WithBot α) :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3033 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3035 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3033 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3035) a b))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3025 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3027 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3025 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3027) a b))
Case conversion may be inaccurate. Consider using '#align with_bot.mul_def WithBot.mul_defₓ'. -/
theorem mul_def {a b : WithBot α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/271bf175e6c51b8d31d6c0107b7bb4a967c7277e
@@ -51,6 +51,12 @@ theorem mul_def {a b : WithTop α} : a * b = if a = 0 ∨ b = 0 then 0 else Opti
rfl
#align with_top.mul_def WithTop.mul_def
+/- warning: with_top.mul_top' -> WithTop.mul_top' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] (a : WithTop.{u1} α), Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
+Case conversion may be inaccurate. Consider using '#align with_top.mul_top' WithTop.mul_top'ₓ'. -/
theorem mul_top' {a : WithTop α} : a * ⊤ = if a = 0 then 0 else ⊤ := by
induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
#align with_top.mul_top' WithTop.mul_top'
@@ -65,6 +71,12 @@ Case conversion may be inaccurate. Consider using '#align with_top.mul_top WithT
theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
#align with_top.mul_top WithTop.mul_top
+/- warning: with_top.top_mul' -> WithTop.top_mul' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)) a) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] (a : WithTop.{u1} α), Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)) a) (ite.{succ u1} (WithTop.{u1} α) (Eq.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (WithTop.instDecidableEqWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
+Case conversion may be inaccurate. Consider using '#align with_top.top_mul' WithTop.top_mul'ₓ'. -/
theorem top_mul' {a : WithTop α} : ⊤ * a = if a = 0 then 0 else ⊤ := by
induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
#align with_top.top_mul' WithTop.top_mul'
@@ -94,7 +106,7 @@ theorem top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {_inst_3 : WithTop.{u1} α} {a : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_3 a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) _inst_3 (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) _inst_3 (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))))))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))))
Case conversion may be inaccurate. Consider using '#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iffₓ'. -/
theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 :=
by
@@ -104,6 +116,12 @@ theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤
tauto
#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
+/- warning: with_top.mul_lt_top' -> WithTop.mul_lt_top' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
+Case conversion may be inaccurate. Consider using '#align with_top.mul_lt_top' WithTop.mul_lt_top'ₓ'. -/
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ :=
by
rw [WithTop.lt_top_iff_ne_top] at *
@@ -114,7 +132,7 @@ theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {_inst_4 : WithTop.{u1} α} {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) _inst_4 (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_3)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_4 a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.lt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
Case conversion may be inaccurate. Consider using '#align with_top.mul_lt_top WithTop.mul_lt_topₓ'. -/
theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
mul_lt_top' (WithTop.lt_top_iff_ne_top.2 ha) (WithTop.lt_top_iff_ne_top.2 hb)
@@ -306,7 +324,7 @@ instance : MulZeroClass (WithBot α) :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (Or.decidable (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Option.decidableEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))) (Option.map₂.{u1, u1, u1} α α α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3)) a b))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.2622 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.2624 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.2622 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.2624) a b))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (ite.{succ u1} (WithBot.{u1} α) (Or (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (instDecidableOr (Eq.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (WithBot.instDecidableEqWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))) (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))) (Option.map₂.{u1, u1, u1} α α α (fun (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3033 : α) (x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3035 : α) => HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α _inst_3) x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3033 x._@.Mathlib.Algebra.Order.Ring.WithTop._hyg.3035) a b))
Case conversion may be inaccurate. Consider using '#align with_bot.mul_def WithBot.mul_defₓ'. -/
theorem mul_def {a b : WithBot α} : a * b = if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b :=
rfl
@@ -349,12 +367,18 @@ theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {_inst_3 : WithBot.{u1} α} {a : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_3 a) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) _inst_3 (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) _inst_3 (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))))))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2)))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α _inst_2))))))
Case conversion may be inaccurate. Consider using '#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iffₓ'. -/
theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
WithTop.mul_eq_top_iff
#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
+/- warning: with_bot.bot_lt_mul' -> WithBot.bot_lt_mul' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) b) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) b) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
+Case conversion may be inaccurate. Consider using '#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'ₓ'. -/
theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
@WithTop.mul_lt_top' αᵒᵈ _ _ _ _ _ _ ha hb
#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'
@@ -363,7 +387,7 @@ theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) :
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) -> (Ne.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {_inst_4 : WithBot.{u1} α} {a : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) _inst_4) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_4 a))
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) -> (Ne.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.lt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
Case conversion may be inaccurate. Consider using '#align with_bot.bot_lt_mul WithBot.bot_lt_mulₓ'. -/
theorem bot_lt_mul [LT α] {a b : WithBot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : ⊥ < a * b :=
@WithTop.mul_lt_top αᵒᵈ _ _ _ _ _ _ ha hb
mathlib commit https://github.com/leanprover-community/mathlib/commit/271bf175e6c51b8d31d6c0107b7bb4a967c7277e
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit e7e2ba8aa216a5833b5ed85a93317263711a36b5
+! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -51,6 +51,10 @@ theorem mul_def {a b : WithTop α} : a * b = if a = 0 ∨ b = 0 then 0 else Opti
rfl
#align with_top.mul_def WithTop.mul_def
+theorem mul_top' {a : WithTop α} : a * ⊤ = if a = 0 then 0 else ⊤ := by
+ induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
+#align with_top.mul_top' WithTop.mul_top'
+
/- warning: with_top.mul_top -> WithTop.mul_top is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
@@ -58,9 +62,13 @@ but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
Case conversion may be inaccurate. Consider using '#align with_top.mul_top WithTop.mul_topₓ'. -/
@[simp]
-theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by cases a <;> simp [mul_def, h] <;> rfl
+theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
#align with_top.mul_top WithTop.mul_top
+theorem top_mul' {a : WithTop α} : ⊤ * a = if a = 0 then 0 else ⊤ := by
+ induction a using WithTop.recTopCoe <;> simp [mul_def] <;> rfl
+#align with_top.top_mul' WithTop.top_mul'
+
/- warning: with_top.top_mul -> WithTop.top_mul is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)) a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
@@ -68,7 +76,7 @@ but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))) -> (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)) a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
Case conversion may be inaccurate. Consider using '#align with_top.top_mul WithTop.top_mulₓ'. -/
@[simp]
-theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by cases a <;> simp [mul_def, h] <;> rfl
+theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by rw [top_mul', if_neg h]
#align with_top.top_mul WithTop.top_mul
/- warning: with_top.top_mul_top -> WithTop.top_mul_top is a dubious translation:
@@ -82,6 +90,36 @@ theorem top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ :=
top_mul top_ne_zero
#align with_top.top_mul_top WithTop.top_mul_top
+/- warning: with_top.mul_eq_top_iff -> WithTop.mul_eq_top_iff is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α _inst_2)))))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {_inst_3 : WithTop.{u1} α} {a : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_3 a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) _inst_3 (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) _inst_3 (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))))))
+Case conversion may be inaccurate. Consider using '#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iffₓ'. -/
+theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 :=
+ by
+ rw [mul_def, ite_eq_iff, ← none_eq_top, Option.map₂_eq_none_iff]
+ have ha : a = 0 → a ≠ none := fun h => h.symm ▸ zero_ne_top
+ have hb : b = 0 → b ≠ none := fun h => h.symm ▸ zero_ne_top
+ tauto
+#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
+
+theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ :=
+ by
+ rw [WithTop.lt_top_iff_ne_top] at *
+ simp only [Ne.def, mul_eq_top_iff, *, and_false_iff, false_and_iff, false_or_iff, not_false_iff]
+#align with_top.mul_lt_top' WithTop.mul_lt_top'
+
+/- warning: with_top.mul_lt_top -> WithTop.mul_lt_top is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (WithTop.hasLt.{u1} α _inst_4) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {_inst_4 : WithTop.{u1} α} {a : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) _inst_4 (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_3)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_4 a) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
+Case conversion may be inaccurate. Consider using '#align with_top.mul_lt_top WithTop.mul_lt_topₓ'. -/
+theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
+ mul_lt_top' (WithTop.lt_top_iff_ne_top.2 ha) (WithTop.lt_top_iff_ne_top.2 hb)
+#align with_top.mul_lt_top WithTop.mul_lt_top
+
instance [NoZeroDivisors α] : NoZeroDivisors (WithTop α) :=
by
refine' ⟨fun a b h₁ => Decidable.by_contradiction fun h₂ => _⟩
@@ -101,7 +139,7 @@ lean 3 declaration is
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : α} {b : α}, Eq.{succ u1} (WithTop.{u1} α) (WithTop.some.{u1} α (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toMul.{u1} α _inst_2)) a b)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) (WithTop.some.{u1} α a) (WithTop.some.{u1} α b))
Case conversion may be inaccurate. Consider using '#align with_top.coe_mul WithTop.coe_mulₓ'. -/
-@[norm_cast]
+@[simp, norm_cast]
theorem coe_mul {a b : α} : (↑(a * b) : WithTop α) = a * b :=
Decidable.byCases (fun this : a = 0 => by simp [this]) fun ha =>
Decidable.byCases (fun this : b = 0 => by simp [this]) fun hb => by simp [*, mul_def]
@@ -119,35 +157,6 @@ theorem mul_coe {b : α} (hb : b ≠ 0) : ∀ {a : WithTop α}, a * b = a.bind f
| some a => show ↑a * ↑b = ↑(a * b) from coe_mul.symm
#align with_top.mul_coe WithTop.mul_coe
-/- warning: with_top.mul_eq_top_iff -> WithTop.mul_eq_top_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (OfNat.mk.{u1} (WithTop.{u1} α) 0 (Zero.zero.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2))))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Or (And (Ne.{succ u1} (WithTop.{u1} α) a (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))) (And (Eq.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) (Ne.{succ u1} (WithTop.{u1} α) b (OfNat.ofNat.{u1} (WithTop.{u1} α) 0 (Zero.toOfNat0.{u1} (WithTop.{u1} α) (WithTop.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))))))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iffₓ'. -/
-@[simp]
-theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 :=
- by
- cases a <;> cases b <;> simp only [none_eq_top, some_eq_coe]
- · simp [← coe_mul]
- · by_cases hb : b = 0 <;> simp [hb]
- · by_cases ha : a = 0 <;> simp [ha]
- · simp [← coe_mul]
-#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
-
-/- warning: with_top.mul_lt_top -> WithTop.mul_lt_top is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_3)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {a : WithTop.{u1} α} {b : WithTop.{u1} α}, (Ne.{succ u1} (WithTop.{u1} α) a (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (Ne.{succ u1} (WithTop.{u1} α) b (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))) -> (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_3)) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toMul.{u1} (WithTop.{u1} α) (WithTop.instMulZeroClassWithTop.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a b) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align with_top.mul_lt_top WithTop.mul_lt_topₓ'. -/
-theorem mul_lt_top [Preorder α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
- by
- lift a to α using ha
- lift b to α using hb
- simp only [← coe_mul, coe_lt_top]
-#align with_top.mul_lt_top WithTop.mul_lt_top
-
/- warning: with_top.untop'_zero_mul -> WithTop.untop'_zero_mul is a dubious translation:
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] (a : WithTop.{u1} α) (b : WithTop.{u1} α), Eq.{succ u1} α (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))) (HMul.hMul.{u1, u1, u1} (WithTop.{u1} α) (WithTop.{u1} α) (WithTop.{u1} α) (instHMul.{u1} (WithTop.{u1} α) (MulZeroClass.toHasMul.{u1} (WithTop.{u1} α) (WithTop.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a b)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (MulZeroClass.toHasMul.{u1} α _inst_2)) (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))) a) (WithTop.untop'.{u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))) b))
@@ -208,7 +217,7 @@ protected def WithTop.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneCla
induction y using WithTop.recTopCoe
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [hx, this]
- simp [← coe_mul] }
+ simp only [← coe_mul, map_coe, map_mul] }
#align monoid_with_zero_hom.with_top_map WithTop.MonoidWithZeroHom.withTopMap
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
@@ -243,7 +252,7 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c :=
· by_cases ha : a = 0 <;> simp [ha]
· by_cases hc : c = 0
· simp [hc]
- simp [mul_coe hc]
+ simp only [mul_coe hc]
cases a <;> cases b
repeat' first |rfl|exact congr_arg some (add_mul _ _ _)
#align with_top.distrib' with_top.distrib'
@@ -336,6 +345,30 @@ theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
WithTop.top_mul_top
#align with_bot.bot_mul_bot WithBot.bot_mul_bot
+/- warning: with_bot.mul_eq_bot_iff -> WithBot.mul_eq_bot_iff is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α _inst_2)))))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {_inst_3 : WithBot.{u1} α} {a : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_3 a) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) _inst_3 (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) _inst_3 (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))))))
+Case conversion may be inaccurate. Consider using '#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iffₓ'. -/
+theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
+ WithTop.mul_eq_top_iff
+#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
+
+theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
+ @WithTop.mul_lt_top' αᵒᵈ _ _ _ _ _ _ ha hb
+#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'
+
+/- warning: with_bot.bot_lt_mul -> WithBot.bot_lt_mul is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : Zero.{u1} α] [_inst_3 : Mul.{u1} α] [_inst_4 : LT.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (Ne.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) -> (Ne.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) -> (LT.lt.{u1} (WithBot.{u1} α) (WithBot.hasLt.{u1} α _inst_4) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) _inst_2 _inst_3))) a b))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {_inst_4 : WithBot.{u1} α} {a : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) _inst_4) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) _inst_4 a))
+Case conversion may be inaccurate. Consider using '#align with_bot.bot_lt_mul WithBot.bot_lt_mulₓ'. -/
+theorem bot_lt_mul [LT α] {a b : WithBot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : ⊥ < a * b :=
+ @WithTop.mul_lt_top αᵒᵈ _ _ _ _ _ _ ha hb
+#align with_bot.bot_lt_mul WithBot.bot_lt_mul
+
end Mul
section MulZeroClass
@@ -363,30 +396,6 @@ theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} : a * b = a.bind fun a
WithTop.mul_coe hb
#align with_bot.mul_coe WithBot.mul_coe
-/- warning: with_bot.mul_eq_bot_iff -> WithBot.mul_eq_bot_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2)))))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (OfNat.mk.{u1} (WithBot.{u1} α) 0 (Zero.zero.{u1} (WithBot.{u1} α) (WithBot.hasZero.{u1} α (MulZeroClass.toHasZero.{u1} α _inst_2))))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a b) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Or (And (Ne.{succ u1} (WithBot.{u1} α) a (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2))))) (Eq.{succ u1} (WithBot.{u1} α) b (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)))) (And (Eq.{succ u1} (WithBot.{u1} α) a (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))) (Ne.{succ u1} (WithBot.{u1} α) b (OfNat.ofNat.{u1} (WithBot.{u1} α) 0 (Zero.toOfNat0.{u1} (WithBot.{u1} α) (WithBot.zero.{u1} α (MulZeroClass.toZero.{u1} α _inst_2)))))))
-Case conversion may be inaccurate. Consider using '#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iffₓ'. -/
-@[simp]
-theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
- WithTop.mul_eq_top_iff
-#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
-
-/- warning: with_bot.bot_lt_mul -> WithBot.bot_lt_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) b) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toHasMul.{u1} (WithBot.{u1} α) (WithBot.mulZeroClass.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toHasZero.{u1} α _inst_2) (MulZeroClass.toHasMul.{u1} α _inst_2)))) a b))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : MulZeroClass.{u1} α] [_inst_3 : Preorder.{u1} α] {a : WithBot.{u1} α} {b : WithBot.{u1} α}, (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) a) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) b) -> (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_3)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α)) (HMul.hMul.{u1, u1, u1} (WithBot.{u1} α) (WithBot.{u1} α) (WithBot.{u1} α) (instHMul.{u1} (WithBot.{u1} α) (MulZeroClass.toMul.{u1} (WithBot.{u1} α) (WithBot.instMulZeroClassWithBot.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (MulZeroClass.toZero.{u1} α _inst_2) (MulZeroClass.toMul.{u1} α _inst_2)))) a b))
-Case conversion may be inaccurate. Consider using '#align with_bot.bot_lt_mul WithBot.bot_lt_mulₓ'. -/
-theorem bot_lt_mul [Preorder α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
- by
- lift a to α using ne_bot_of_gt ha
- lift b to α using ne_bot_of_gt hb
- simp only [← coe_mul, bot_lt_coe]
-#align with_bot.bot_lt_mul WithBot.bot_lt_mul
-
end MulZeroClass
/-- `nontrivial α` is needed here as otherwise we have `1 * ⊥ = ⊥` but also `= 0 * ⊥ = 0`. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -89,7 +89,7 @@ lemma coe_mul_eq_bind {a : α} (ha : a ≠ 0) : ∀ b, (a * b : WithTop α) = b.
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ := by
rw [WithTop.lt_top_iff_ne_top] at *
- simp only [Ne.def, mul_eq_top_iff, *, and_false, false_and, or_self, not_false_eq_true]
+ simp only [Ne, mul_eq_top_iff, *, and_false, false_and, or_self, not_false_eq_true]
#align with_top.mul_lt_top' WithTop.mul_lt_top'
theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
@@ -250,12 +250,12 @@ lemma mul_eq_bot_iff : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠
#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
lemma mul_coe_eq_bind {b : α} (hb : b ≠ 0) : ∀ a, (a * b : WithBot α) = a.bind fun a ↦ ↑(a * b)
- | ⊥ => by simp [bot_mul, hb]; rfl
+ | ⊥ => by simp only [ne_eq, coe_eq_zero, hb, not_false_eq_true, bot_mul]; rfl
| (a : α) => rfl
#align with_bot.mul_coe WithBot.mul_coe_eq_bind
lemma coe_mul_eq_bind {a : α} (ha : a ≠ 0) : ∀ b, (a * b : WithBot α) = b.bind fun b ↦ ↑(a * b)
- | ⊥ => by simp [bot_mul, ha]; rfl
+ | ⊥ => by simp only [ne_eq, coe_eq_zero, ha, not_false_eq_true, mul_bot]; rfl
| (b : α) => rfl
@[simp]
@@ -133,7 +133,7 @@ protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type*} [MulZeroOneClass
induction' y using WithTop.recTopCoe with y
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [mul_top hx, mul_top this]
- · -- Porting note: todo: `simp [← coe_mul]` times out
+ · -- Porting note (#11215): TODO: `simp [← coe_mul]` times out
simp only [map_coe, ← coe_mul, map_mul] }
#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -133,7 +133,7 @@ protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type*} [MulZeroOneClass
induction' y using WithTop.recTopCoe with y
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [mul_top hx, mul_top this]
- · -- porting note: todo: `simp [← coe_mul]` times out
+ · -- Porting note: todo: `simp [← coe_mul]` times out
simp only [map_coe, ← coe_mul, map_mul] }
#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
Avoid relying on the autogenerated name, and remove duplicate instances.
@@ -22,8 +22,6 @@ namespace WithTop
variable [DecidableEq α]
-instance : DecidableEq (WithTop α) := instDecidableEqOption
-
section MulZeroClass
variable [MulZeroClass α] {a b : WithTop α}
@@ -215,8 +213,6 @@ namespace WithBot
variable [DecidableEq α]
-instance : DecidableEq (WithBot α) := instDecidableEqOption
-
section MulZeroClass
variable [MulZeroClass α] {a b : WithBot α}
ℝ≥0 → ℝ≥0∞
commute defeqly with nsmul
and pow
(#10225)
by tweaking the definition of the AddMonoid
and MonoidWithZero
instances for WithTop
. Also unprotect ENNReal.coe_injective
and rename ENNReal.coe_eq_coe → ENNReal.coe_inj
.
From LeanAPAP
@@ -3,10 +3,10 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-/
+import Mathlib.Algebra.GroupWithZero.Basic
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Algebra.Order.Ring.Canonical
import Mathlib.Algebra.Ring.Hom.Defs
-import Mathlib.Tactic.Tauto
import Std.Data.Option.Lemmas
#align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
@@ -24,47 +24,71 @@ variable [DecidableEq α]
instance : DecidableEq (WithTop α) := instDecidableEqOption
-section Mul
-
-variable [Zero α] [Mul α]
+section MulZeroClass
+variable [MulZeroClass α] {a b : WithTop α}
-instance instMulZeroClassWithTop : MulZeroClass (WithTop α) where
+instance instMulZeroClass : MulZeroClass (WithTop α) where
zero := 0
- mul m n := if m = 0 ∨ n = 0 then 0 else Option.map₂ (· * ·) m n
- zero_mul _ := if_pos <| Or.inl rfl
- mul_zero _ := if_pos <| Or.inr rfl
-
-theorem mul_def {a b : WithTop α} :
- a * b = (if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b : WithTop α) :=
- rfl
-#align with_top.mul_def WithTop.mul_def
-
--- Porting note: commented out @[simp] to placate the `simp can prove this` linter
--- @[simp]
-theorem top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ := by simp [mul_def]; rfl
-#align with_top.top_mul_top WithTop.top_mul_top
+ mul a b := match a, b with
+ | (a : α), (b : α) => ↑(a * b)
+ | (a : α), ⊤ => if a = 0 then 0 else ⊤
+ | ⊤, (b : α) => if b = 0 then 0 else ⊤
+ | ⊤, ⊤ => ⊤
+ mul_zero a := match a with
+ | (a : α) => congr_arg some $ mul_zero _
+ | ⊤ => if_pos rfl
+ zero_mul b := match b with
+ | (b : α) => congr_arg some $ zero_mul _
+ | ⊤ => if_pos rfl
+
+@[simp, norm_cast] lemma coe_mul (a b : α) : (↑(a * b) : WithTop α) = a * b := rfl
+#align with_top.coe_mul WithTop.coe_mul
-theorem mul_top' (a : WithTop α) : a * ⊤ = if a = 0 then 0 else ⊤ := by
- induction a using recTopCoe <;> simp [mul_def] <;> rfl
+lemma mul_top' : ∀ (a : WithTop α), a * ⊤ = if a = 0 then 0 else ⊤
+ | (a : α) => if_congr coe_eq_zero.symm rfl rfl
+ | ⊤ => (if_neg top_ne_zero).symm
#align with_top.mul_top' WithTop.mul_top'
-@[simp] theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
+@[simp] lemma mul_top (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
#align with_top.mul_top WithTop.mul_top
-theorem top_mul' (a : WithTop α) : ⊤ * a = if a = 0 then 0 else ⊤ := by
- induction a using recTopCoe <;> simp [mul_def] <;> rfl
+lemma top_mul' : ∀ (b : WithTop α), ⊤ * b = if b = 0 then 0 else ⊤
+ | (b : α) => if_congr coe_eq_zero.symm rfl rfl
+ | ⊤ => (if_neg top_ne_zero).symm
#align with_top.top_mul' WithTop.top_mul'
-@[simp] theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by rw [top_mul', if_neg h]
+@[simp] lemma top_mul (hb : b ≠ 0) : ⊤ * b = ⊤ := by rw [top_mul', if_neg hb]
#align with_top.top_mul WithTop.top_mul
-theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 := by
- rw [mul_def, ite_eq_iff, ← none_eq_top, Option.map₂_eq_none_iff]
- have ha : a = 0 → a ≠ none := fun h => h.symm ▸ zero_ne_top
- have hb : b = 0 → b ≠ none := fun h => h.symm ▸ zero_ne_top
- tauto
+-- eligible for dsimp
+@[simp, nolint simpNF] lemma top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ := rfl
+#align with_top.top_mul_top WithTop.top_mul_top
+
+lemma mul_def (a b : WithTop α) :
+ a * b = if a = 0 ∨ b = 0 then 0 else WithTop.map₂ (· * ·) a b := by
+ cases a <;> cases b <;> aesop (add simp [none_eq_top, some_eq_coe])
+#align with_top.mul_def WithTop.mul_def
+
+lemma mul_eq_top_iff : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 := by rw [mul_def]; aesop
#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
+lemma mul_coe_eq_bind {b : α} (hb : b ≠ 0) : ∀ a, (a * b : WithTop α) = a.bind fun a ↦ ↑(a * b)
+ | ⊤ => by simp [top_mul, hb]; rfl
+ | (a : α) => rfl
+#align with_top.mul_coe WithTop.mul_coe_eq_bind
+
+lemma coe_mul_eq_bind {a : α} (ha : a ≠ 0) : ∀ b, (a * b : WithTop α) = b.bind fun b ↦ ↑(a * b)
+ | ⊤ => by simp [top_mul, ha]; rfl
+ | (b : α) => rfl
+
+@[simp] lemma untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 := by
+ by_cases ha : a = 0; · rw [ha, zero_mul, ← coe_zero, untop'_coe, zero_mul]
+ by_cases hb : b = 0; · rw [hb, mul_zero, ← coe_zero, untop'_coe, mul_zero]
+ induction a using WithTop.recTopCoe; · rw [top_mul hb, untop'_top, zero_mul]
+ induction b using WithTop.recTopCoe; · rw [mul_top ha, untop'_top, mul_zero]
+ rw [← coe_mul, untop'_coe, untop'_coe, untop'_coe]
+#align with_top.untop'_zero_mul WithTop.untop'_zero_mul
+
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ := by
rw [WithTop.lt_top_iff_ne_top] at *
simp only [Ne.def, mul_eq_top_iff, *, and_false, false_and, or_self, not_false_eq_true]
@@ -74,60 +98,23 @@ theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤)
mul_lt_top' (WithTop.lt_top_iff_ne_top.2 ha) (WithTop.lt_top_iff_ne_top.2 hb)
#align with_top.mul_lt_top WithTop.mul_lt_top
-instance noZeroDivisors [NoZeroDivisors α] : NoZeroDivisors (WithTop α) := by
+instance instNoZeroDivisors [NoZeroDivisors α] : NoZeroDivisors (WithTop α) := by
refine ⟨fun h₁ => Decidable.by_contradiction fun h₂ => ?_⟩
rw [mul_def, if_neg h₂] at h₁
rcases Option.mem_map₂_iff.1 h₁ with ⟨a, b, (rfl : _ = _), (rfl : _ = _), hab⟩
exact h₂ ((eq_zero_or_eq_zero_of_mul_eq_zero hab).imp (congr_arg some) (congr_arg some))
-end Mul
-
-section MulZeroClass
-
-variable [MulZeroClass α]
-
-@[simp, norm_cast]
-theorem coe_mul {a b : α} : (↑(a * b) : WithTop α) = a * b := by
- by_cases ha : a = 0
- · simp [ha]
- · by_cases hb : b = 0
- · simp [hb]
- · simp [*, mul_def]
- rfl
-#align with_top.coe_mul WithTop.coe_mul
-
-theorem mul_coe {b : α} (hb : b ≠ 0) : ∀ {a : WithTop α},
- a * (b : WithTop α) = a.bind fun a : α => ↑(a * b)
- | none =>
- show (if (⊤ : WithTop α) = 0 ∨ (b : WithTop α) = 0 then 0 else ⊤ : WithTop α) = ⊤ by simp [hb]
- | Option.some a => by
- rw [some_eq_coe, ← coe_mul]
- rfl
-#align with_top.mul_coe WithTop.mul_coe
-
-@[simp]
-theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 := by
- by_cases ha : a = 0; · rw [ha, zero_mul, ← coe_zero, untop'_coe, zero_mul]
- by_cases hb : b = 0; · rw [hb, mul_zero, ← coe_zero, untop'_coe, mul_zero]
- induction a using WithTop.recTopCoe; · rw [top_mul hb, untop'_top, zero_mul]
- induction b using WithTop.recTopCoe; · rw [mul_top ha, untop'_top, mul_zero]
- rw [← coe_mul, untop'_coe, untop'_coe, untop'_coe]
-#align with_top.untop'_zero_mul WithTop.untop'_zero_mul
-
end MulZeroClass
/-- `Nontrivial α` is needed here as otherwise we have `1 * ⊤ = ⊤` but also `0 * ⊤ = 0`. -/
-instance instMulZeroOneClassWithTop [MulZeroOneClass α] [Nontrivial α] :
- MulZeroOneClass (WithTop α) :=
- { WithTop.instMulZeroClassWithTop with
- one_mul := fun a =>
- match a with
- | ⊤ => mul_top (mt coe_eq_coe.1 one_ne_zero)
- | (a : α) => by rw [← coe_one, ← coe_mul, one_mul],
- mul_one := fun a =>
- match a with
- | ⊤ => top_mul (mt coe_eq_coe.1 one_ne_zero)
- | (a : α) => by rw [← coe_one, ← coe_mul, mul_one] }
+instance instMulZeroOneClass [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) where
+ __ := instMulZeroClass
+ one_mul a := match a with
+ | ⊤ => mul_top (mt coe_eq_coe.1 one_ne_zero)
+ | (a : α) => by rw [← coe_one, ← coe_mul, one_mul]
+ mul_one a := match a with
+ | ⊤ => top_mul (mt coe_eq_coe.1 one_ne_zero)
+ | (a : α) => by rw [← coe_one, ← coe_mul, mul_one]
/-- A version of `WithTop.map` for `MonoidWithZeroHom`s. -/
@[simps (config := .asFn)]
@@ -152,31 +139,43 @@ protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type*} [MulZeroOneClass
simp only [map_coe, ← coe_mul, map_mul] }
#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
-instance instSemigroupWithZeroWithTop [SemigroupWithZero α] [NoZeroDivisors α] :
- SemigroupWithZero (WithTop α) :=
- { WithTop.instMulZeroClassWithTop with
- mul_assoc := fun a b c => by
- rcases eq_or_ne a 0 with (rfl | ha); · simp only [zero_mul]
- rcases eq_or_ne b 0 with (rfl | hb); · simp only [zero_mul, mul_zero]
- rcases eq_or_ne c 0 with (rfl | hc); · simp only [mul_zero]
- -- Porting note: below needed to be rewritten due to changed `simp` behaviour for `coe`
- induction' a using WithTop.recTopCoe with a; · simp [hb, hc]
- induction' b using WithTop.recTopCoe with b; · simp [mul_top ha, top_mul hc]
- induction' c using WithTop.recTopCoe with c
- · rw [mul_top hb, mul_top ha]
- rw [← coe_zero, ne_eq, coe_eq_coe] at ha hb
- simp [ha, hb]
- simp only [← coe_mul, mul_assoc] }
-
-instance monoidWithZero [MonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
- MonoidWithZero (WithTop α) :=
- { WithTop.instMulZeroOneClassWithTop, WithTop.instSemigroupWithZeroWithTop with }
-
-instance commMonoidWithZero [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
- CommMonoidWithZero (WithTop α) :=
- { WithTop.monoidWithZero with
- mul_comm := fun _ _ => ite_congr (propext or_comm) (fun _ => rfl)
- (fun _ => Option.map₂_comm mul_comm) }
+instance instSemigroupWithZero [SemigroupWithZero α] [NoZeroDivisors α] :
+ SemigroupWithZero (WithTop α) where
+ __ := instMulZeroClass
+ mul_assoc a b c := by
+ rcases eq_or_ne a 0 with (rfl | ha); · simp only [zero_mul]
+ rcases eq_or_ne b 0 with (rfl | hb); · simp only [zero_mul, mul_zero]
+ rcases eq_or_ne c 0 with (rfl | hc); · simp only [mul_zero]
+ -- Porting note: below needed to be rewritten due to changed `simp` behaviour for `coe`
+ induction' a using WithTop.recTopCoe with a; · simp [hb, hc]
+ induction' b using WithTop.recTopCoe with b; · simp [mul_top ha, top_mul hc]
+ induction' c using WithTop.recTopCoe with c
+ · rw [mul_top hb, mul_top ha]
+ rw [← coe_zero, ne_eq, coe_eq_coe] at ha hb
+ simp [ha, hb]
+ simp only [← coe_mul, mul_assoc]
+
+section MonoidWithZero
+variable [MonoidWithZero α] [NoZeroDivisors α] [Nontrivial α]
+
+instance instMonoidWithZero : MonoidWithZero (WithTop α) where
+ __ := instMulZeroOneClass
+ __ := instSemigroupWithZero
+ npow n a := match a, n with
+ | (a : α), n => ↑(a ^ n)
+ | ⊤, 0 => 1
+ | ⊤, _n + 1 => ⊤
+ npow_zero a := by cases a <;> simp
+ npow_succ n a := by cases n <;> cases a <;> simp [none_eq_top, some_eq_coe, pow_succ]
+
+@[simp, norm_cast] lemma coe_pow (a : α) (n : ℕ) : (↑(a ^ n) : WithTop α) = a ^ n := rfl
+
+end MonoidWithZero
+
+instance instCommMonoidWithZero [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
+ CommMonoidWithZero (WithTop α) where
+ __ := instMonoidWithZero
+ mul_comm a b := by simp_rw [mul_def]; exact if_congr or_comm rfl (Option.map₂_comm mul_comm)
variable [CanonicallyOrderedCommSemiring α]
@@ -185,7 +184,7 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c := b
· by_cases ha : a = 0 <;> simp [ha]
· by_cases hc : c = 0
· simp [hc]
- simp only [mul_coe hc]
+ simp only [mul_coe_eq_bind hc]
cases a <;> cases b
repeat' first | rfl |exact congr_arg some (add_mul _ _ _)
@@ -193,7 +192,7 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c := b
that derives from both `NonAssocNonUnitalSemiring` and `CanonicallyOrderedAddCommMonoid`, both
of which are required for distributivity. -/
instance commSemiring [Nontrivial α] : CommSemiring (WithTop α) :=
- { WithTop.addCommMonoidWithOne, WithTop.commMonoidWithZero with
+ { addCommMonoidWithOne, instCommMonoidWithZero with
right_distrib := distrib'
left_distrib := fun a b c => by
rw [mul_comm, distrib', mul_comm b, mul_comm c] }
@@ -218,36 +217,60 @@ variable [DecidableEq α]
instance : DecidableEq (WithBot α) := instDecidableEqOption
-section Mul
+section MulZeroClass
+variable [MulZeroClass α] {a b : WithBot α}
-variable [Zero α] [Mul α]
+instance : MulZeroClass (WithBot α) := WithTop.instMulZeroClass
-instance : MulZeroClass (WithBot α) :=
- WithTop.instMulZeroClassWithTop
+@[simp, norm_cast] lemma coe_mul (a b : α) : (↑(a * b) : WithBot α) = a * b := rfl
+#align with_bot.coe_mul WithBot.coe_mul
-theorem mul_def {a b : WithBot α} :
- a * b = if a = 0 ∨ b = 0 then (0 : WithBot α) else Option.map₂ (· * ·) a b :=
- rfl
-#align with_bot.mul_def WithBot.mul_def
+lemma mul_bot' : ∀ (a : WithBot α), a * ⊥ = if a = 0 then 0 else ⊥
+ | (a : α) => if_congr coe_eq_zero.symm rfl rfl
+ | ⊥ => (if_neg bot_ne_zero).symm
+#align with_bot.mul_bot' WithBot.mul_bot'
-@[simp]
-theorem mul_bot {a : WithBot α} (h : a ≠ 0) : a * ⊥ = ⊥ :=
- WithTop.mul_top h
+@[simp] lemma mul_bot (h : a ≠ 0) : a * ⊥ = ⊥ := by rw [mul_bot', if_neg h]
#align with_bot.mul_bot WithBot.mul_bot
-@[simp]
-theorem bot_mul {a : WithBot α} (h : a ≠ 0) : ⊥ * a = ⊥ :=
- WithTop.top_mul h
+lemma bot_mul' : ∀ (b : WithBot α), ⊥ * b = if b = 0 then 0 else ⊥
+ | (b : α) => if_congr coe_eq_zero.symm rfl rfl
+ | ⊥ => (if_neg bot_ne_zero).symm
+#align with_bot.bot_mul' WithBot.bot_mul'
+
+@[simp] lemma bot_mul (hb : b ≠ 0) : ⊥ * b = ⊥ := by rw [bot_mul', if_neg hb]
#align with_bot.bot_mul WithBot.bot_mul
-theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
- WithTop.top_mul_top
+-- eligible for dsimp
+@[simp, nolint simpNF] lemma bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ := rfl
#align with_bot.bot_mul_bot WithBot.bot_mul_bot
-theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
- WithTop.mul_eq_top_iff
+lemma mul_def (a b : WithBot α) :
+ a * b = if a = 0 ∨ b = 0 then 0 else WithBot.map₂ (· * ·) a b := by
+ cases a <;> cases b <;> aesop (add simp [none_eq_bot, some_eq_coe])
+#align with_bot.mul_def WithBot.mul_def
+
+lemma mul_eq_bot_iff : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 := by rw [mul_def]; aesop
#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
+lemma mul_coe_eq_bind {b : α} (hb : b ≠ 0) : ∀ a, (a * b : WithBot α) = a.bind fun a ↦ ↑(a * b)
+ | ⊥ => by simp [bot_mul, hb]; rfl
+ | (a : α) => rfl
+#align with_bot.mul_coe WithBot.mul_coe_eq_bind
+
+lemma coe_mul_eq_bind {a : α} (ha : a ≠ 0) : ∀ b, (a * b : WithBot α) = b.bind fun b ↦ ↑(a * b)
+ | ⊥ => by simp [bot_mul, ha]; rfl
+ | (b : α) => rfl
+
+@[simp]
+lemma unbot'_zero_mul (a b : WithBot α) : (a * b).unbot' 0 = a.unbot' 0 * b.unbot' 0 := by
+ by_cases ha : a = 0; · rw [ha, zero_mul, ← coe_zero, unbot'_coe, zero_mul]
+ by_cases hb : b = 0; · rw [hb, mul_zero, ← coe_zero, unbot'_coe, mul_zero]
+ induction a using WithBot.recBotCoe; · rw [bot_mul hb, unbot'_bot, zero_mul]
+ induction b using WithBot.recBotCoe; · rw [mul_bot ha, unbot'_bot, mul_zero]
+ rw [← coe_mul, unbot'_coe, unbot'_coe, unbot'_coe]
+#align with_bot.unbot'_zero_mul WithBot.unbot'_zero_mul
+
theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
WithTop.mul_lt_top' (α := αᵒᵈ) ha hb
#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'
@@ -256,40 +279,29 @@ theorem bot_lt_mul [LT α] {a b : WithBot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥)
WithTop.mul_lt_top (α := αᵒᵈ) ha hb
#align with_bot.bot_lt_mul WithBot.bot_lt_mul
-end Mul
-
-section MulZeroClass
-
-variable [MulZeroClass α]
-
-@[simp, norm_cast] -- porting note: added `simp`
-theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b :=
- WithTop.coe_mul
-#align with_bot.coe_mul WithBot.coe_mul
-
-theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} :
- a * (b : WithBot α) = a.bind fun a : α => ↑(a * b) :=
- WithTop.mul_coe hb
-#align with_bot.mul_coe WithBot.mul_coe
+instance instNoZeroDivisors [NoZeroDivisors α] : NoZeroDivisors (WithBot α) :=
+ WithTop.instNoZeroDivisors
end MulZeroClass
/-- `Nontrivial α` is needed here as otherwise we have `1 * ⊥ = ⊥` but also `= 0 * ⊥ = 0`. -/
-instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithBot α) :=
- WithTop.instMulZeroOneClassWithTop
+instance instMulZeroOneClass [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithBot α) :=
+ WithTop.instMulZeroOneClass
+
+instance instSemigroupWithZero [SemigroupWithZero α] [NoZeroDivisors α] :
+ SemigroupWithZero (WithBot α) := WithTop.instSemigroupWithZero
+
+section MonoidWithZero
+variable [MonoidWithZero α] [NoZeroDivisors α] [Nontrivial α]
-instance [MulZeroClass α] [NoZeroDivisors α] : NoZeroDivisors (WithBot α) :=
- WithTop.noZeroDivisors
+instance instMonoidWithZero : MonoidWithZero (WithBot α) := WithTop.instMonoidWithZero
-instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithBot α) :=
- WithTop.instSemigroupWithZeroWithTop
+@[simp, norm_cast] lemma coe_pow (a : α) (n : ℕ) : (↑(a ^ n) : WithBot α) = a ^ n := rfl
-instance [MonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] : MonoidWithZero (WithBot α) :=
- WithTop.monoidWithZero
+end MonoidWithZero
instance commMonoidWithZero [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
- CommMonoidWithZero (WithBot α) :=
- WithTop.commMonoidWithZero
+ CommMonoidWithZero (WithBot α) := WithTop.instCommMonoidWithZero
instance commSemiring [CanonicallyOrderedCommSemiring α] [Nontrivial α] :
CommSemiring (WithBot α) :=
@@ -240,7 +240,6 @@ theorem bot_mul {a : WithBot α} (h : a ≠ 0) : ⊥ * a = ⊥ :=
WithTop.top_mul h
#align with_bot.bot_mul WithBot.bot_mul
-@[simp]
theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
WithTop.top_mul_top
#align with_bot.bot_mul_bot WithBot.bot_mul_bot
@@ -75,7 +75,7 @@ theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤)
#align with_top.mul_lt_top WithTop.mul_lt_top
instance noZeroDivisors [NoZeroDivisors α] : NoZeroDivisors (WithTop α) := by
- refine ⟨fun h₁ => Decidable.by_contradiction <| fun h₂ => ?_⟩
+ refine ⟨fun h₁ => Decidable.by_contradiction fun h₂ => ?_⟩
rw [mul_def, if_neg h₂] at h₁
rcases Option.mem_map₂_iff.1 h₁ with ⟨a, b, (rfl : _ = _), (rfl : _ = _), hab⟩
exact h₂ ((eq_zero_or_eq_zero_of_mul_eq_zero hab).imp (congr_arg some) (congr_arg some))
...MonoRev
to ...ReflectLE
in classes (#8890)
Either ReflectLT
should be called StrictMonoRev
or ReflectLE
should be called MonoRev
, but we can't have both and hope people understand the relation between them.
@@ -392,7 +392,7 @@ instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT
norm_cast at x0
exact lt_of_mul_lt_mul_right h x0 ⟩
-instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (WithBot α) :=
+instance [MulZeroClass α] [Preorder α] [PosMulReflectLE α] : PosMulReflectLE (WithBot α) :=
⟨by
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk] at h
@@ -406,7 +406,7 @@ instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (Wit
norm_cast at x0
exact le_of_mul_le_mul_left h x0 ⟩
-instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (WithBot α) :=
+instance [MulZeroClass α] [Preorder α] [MulPosReflectLE α] : MulPosReflectLE (WithBot α) :=
⟨by
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk] at h
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -67,7 +67,7 @@ theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ := by
rw [WithTop.lt_top_iff_ne_top] at *
- simp only [Ne.def, mul_eq_top_iff, *, and_false, false_and, false_or]
+ simp only [Ne.def, mul_eq_top_iff, *, and_false, false_and, or_self, not_false_eq_true]
#align with_top.mul_lt_top' WithTop.mul_lt_top'
theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
Use .asFn
and .lemmasOnly
as simps
configuration options.
For reference, these are defined here:
@@ -130,7 +130,7 @@ instance instMulZeroOneClassWithTop [MulZeroOneClass α] [Nontrivial α] :
| (a : α) => by rw [← coe_one, ← coe_mul, mul_one] }
/-- A version of `WithTop.map` for `MonoidWithZeroHom`s. -/
-@[simps (config := { fullyApplied := false })]
+@[simps (config := .asFn)]
protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type*} [MulZeroOneClass R] [DecidableEq R]
[Nontrivial R] [MulZeroOneClass S] [DecidableEq S] [Nontrivial S] (f : R →*₀ S)
(hf : Function.Injective f) : WithTop R →*₀ WithTop S :=
@@ -203,7 +203,7 @@ instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
eq_zero_or_eq_zero_of_mul_eq_zero := eq_zero_or_eq_zero_of_mul_eq_zero}
/-- A version of `WithTop.map` for `RingHom`s. -/
-@[simps (config := { fullyApplied := false })]
+@[simps (config := .asFn)]
protected def _root_.RingHom.withTopMap {R S : Type*} [CanonicallyOrderedCommSemiring R]
[DecidableEq R] [Nontrivial R] [CanonicallyOrderedCommSemiring S] [DecidableEq S] [Nontrivial S]
(f : R →+* S) (hf : Function.Injective f) : WithTop R →+* WithTop S :=
Hom
and file name (#8095)
I believe the file defining a type of morphisms belongs alongside the file defining the structure this morphism works on. So I would like to reorganize the files in the Mathlib.Algebra.Hom
folder so that e.g. Mathlib.Algebra.Hom.Ring
becomes Mathlib.Algebra.Ring.Hom
and Mathlib.Algebra.Hom.NonUnitalAlg
becomes Mathlib.Algebra.Algebra.NonUnitalHom
.
While fixing the imports I went ahead and sorted them for good luck.
The full list of changes is: renamed: Mathlib/Algebra/Hom/NonUnitalAlg.lean -> Mathlib/Algebra/Algebra/NonUnitalHom.lean renamed: Mathlib/Algebra/Hom/Aut.lean -> Mathlib/Algebra/Group/Aut.lean renamed: Mathlib/Algebra/Hom/Commute.lean -> Mathlib/Algebra/Group/Commute/Hom.lean renamed: Mathlib/Algebra/Hom/Embedding.lean -> Mathlib/Algebra/Group/Embedding.lean renamed: Mathlib/Algebra/Hom/Equiv/Basic.lean -> Mathlib/Algebra/Group/Equiv/Basic.lean renamed: Mathlib/Algebra/Hom/Equiv/TypeTags.lean -> Mathlib/Algebra/Group/Equiv/TypeTags.lean renamed: Mathlib/Algebra/Hom/Equiv/Units/Basic.lean -> Mathlib/Algebra/Group/Units/Equiv.lean renamed: Mathlib/Algebra/Hom/Equiv/Units/GroupWithZero.lean -> Mathlib/Algebra/GroupWithZero/Units/Equiv.lean renamed: Mathlib/Algebra/Hom/Freiman.lean -> Mathlib/Algebra/Group/Freiman.lean renamed: Mathlib/Algebra/Hom/Group/Basic.lean -> Mathlib/Algebra/Group/Hom/Basic.lean renamed: Mathlib/Algebra/Hom/Group/Defs.lean -> Mathlib/Algebra/Group/Hom/Defs.lean renamed: Mathlib/Algebra/Hom/GroupAction.lean -> Mathlib/GroupTheory/GroupAction/Hom.lean renamed: Mathlib/Algebra/Hom/GroupInstances.lean -> Mathlib/Algebra/Group/Hom/Instances.lean renamed: Mathlib/Algebra/Hom/Iterate.lean -> Mathlib/Algebra/GroupPower/IterateHom.lean renamed: Mathlib/Algebra/Hom/Centroid.lean -> Mathlib/Algebra/Ring/CentroidHom.lean renamed: Mathlib/Algebra/Hom/Ring/Basic.lean -> Mathlib/Algebra/Ring/Hom/Basic.lean renamed: Mathlib/Algebra/Hom/Ring/Defs.lean -> Mathlib/Algebra/Ring/Hom/Defs.lean renamed: Mathlib/Algebra/Hom/Units.lean -> Mathlib/Algebra/Group/Units/Hom.lean
Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Reorganizing.20.60Mathlib.2EAlgebra.2EHom.60
@@ -3,11 +3,11 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-/
-import Mathlib.Algebra.Hom.Ring.Defs
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Algebra.Order.Ring.Canonical
-import Std.Data.Option.Lemmas
+import Mathlib.Algebra.Ring.Hom.Defs
import Mathlib.Tactic.Tauto
+import Std.Data.Option.Lemmas
#align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
Removes nonterminal simps on lines looking like simp [...]
@@ -185,7 +185,7 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c := b
· by_cases ha : a = 0 <;> simp [ha]
· by_cases hc : c = 0
· simp [hc]
- simp [mul_coe hc]
+ simp only [mul_coe hc]
cases a <;> cases b
repeat' first | rfl |exact congr_arg some (add_mul _ _ _)
Renames:
CanonicallyOrderedMonoid
->
CanonicallyOrderedCommMonoid
CanonicallyOrderedAddMonoid
->
CanonicallyOrderedAddCommMonoid
CanonicallyLinearOrderedMonoid
->
CanonicallyLinearOrderedCommMonoid
CanonicallyLinearOrderedAddMonoid
->
CanonicallyLinearOrderedAddCommMonoid
@@ -190,7 +190,7 @@ private theorem distrib' (a b c : WithTop α) : (a + b) * c = a * c + b * c := b
repeat' first | rfl |exact congr_arg some (add_mul _ _ _)
/-- This instance requires `CanonicallyOrderedCommSemiring` as it is the smallest class
-that derives from both `NonAssocNonUnitalSemiring` and `CanonicallyOrderedAddMonoid`, both
+that derives from both `NonAssocNonUnitalSemiring` and `CanonicallyOrderedAddCommMonoid`, both
of which are required for distributivity. -/
instance commSemiring [Nontrivial α] : CommSemiring (WithTop α) :=
{ WithTop.addCommMonoidWithOne, WithTop.commMonoidWithZero with
@@ -199,7 +199,7 @@ instance commSemiring [Nontrivial α] : CommSemiring (WithTop α) :=
rw [mul_comm, distrib', mul_comm b, mul_comm c] }
instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
- { WithTop.commSemiring, WithTop.canonicallyOrderedAddMonoid with
+ { WithTop.commSemiring, WithTop.canonicallyOrderedAddCommMonoid with
eq_zero_or_eq_zero_of_mul_eq_zero := eq_zero_or_eq_zero_of_mul_eq_zero}
/-- A version of `WithTop.map` for `RingHom`s. -/
This removes redundant field values of the form add := add
for smaller terms and less unfolding during unification.
A list of all files containing a structure instance of the form { a1, ... with x1 := val, ... }
where some xi
is a field of some aj
was generated by modifying the structure instance elaboration algorithm to print such overlaps to stdout in a custom toolchain.
Using that toolchain, I went through each file on the list and attempted to remove algebraic fields that overlapped and were redundant, eg add := add
and not toFun
(though some other ones did creep in). If things broke (which was the case in a couple of cases), I did not push further and reverted.
It is possible that pushing harder and trying to remove all redundant overlaps will yield further improvements.
@@ -120,8 +120,6 @@ end MulZeroClass
instance instMulZeroOneClassWithTop [MulZeroOneClass α] [Nontrivial α] :
MulZeroOneClass (WithTop α) :=
{ WithTop.instMulZeroClassWithTop with
- mul := (· * ·)
- one := 1, zero := 0
one_mul := fun a =>
match a with
| ⊤ => mul_top (mt coe_eq_coe.1 one_ne_zero)
@@ -157,8 +155,6 @@ protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type*} [MulZeroOneClass
instance instSemigroupWithZeroWithTop [SemigroupWithZero α] [NoZeroDivisors α] :
SemigroupWithZero (WithTop α) :=
{ WithTop.instMulZeroClassWithTop with
- mul := (· * ·)
- zero := 0
mul_assoc := fun a b c => by
rcases eq_or_ne a 0 with (rfl | ha); · simp only [zero_mul]
rcases eq_or_ne b 0 with (rfl | hb); · simp only [zero_mul, mul_zero]
@@ -179,8 +175,6 @@ instance monoidWithZero [MonoidWithZero α] [NoZeroDivisors α] [Nontrivial α]
instance commMonoidWithZero [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
CommMonoidWithZero (WithTop α) :=
{ WithTop.monoidWithZero with
- mul := (· * ·)
- zero := 0,
mul_comm := fun _ _ => ite_congr (propext or_comm) (fun _ => rfl)
(fun _ => Option.map₂_comm mul_comm) }
@@ -3,10 +3,11 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-/
-import Mathlib.Algebra.Hom.Ring
+import Mathlib.Algebra.Hom.Ring.Defs
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Algebra.Order.Ring.Canonical
import Std.Data.Option.Lemmas
+import Mathlib.Tactic.Tauto
#align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -15,7 +15,7 @@ The main results of this section are `WithTop.canonicallyOrderedCommSemiring` an
`WithBot.orderedCommSemiring`.
-/
-variable {α : Type _}
+variable {α : Type*}
namespace WithTop
@@ -132,7 +132,7 @@ instance instMulZeroOneClassWithTop [MulZeroOneClass α] [Nontrivial α] :
/-- A version of `WithTop.map` for `MonoidWithZeroHom`s. -/
@[simps (config := { fullyApplied := false })]
-protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [DecidableEq R]
+protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type*} [MulZeroOneClass R] [DecidableEq R]
[Nontrivial R] [MulZeroOneClass S] [DecidableEq S] [Nontrivial S] (f : R →*₀ S)
(hf : Function.Injective f) : WithTop R →*₀ WithTop S :=
{ f.toZeroHom.withTopMap, f.toMonoidHom.toOneHom.withTopMap with
@@ -209,7 +209,7 @@ instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
/-- A version of `WithTop.map` for `RingHom`s. -/
@[simps (config := { fullyApplied := false })]
-protected def _root_.RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R]
+protected def _root_.RingHom.withTopMap {R S : Type*} [CanonicallyOrderedCommSemiring R]
[DecidableEq R] [Nontrivial R] [CanonicallyOrderedCommSemiring S] [DecidableEq S] [Nontrivial S]
(f : R →+* S) (hf : Function.Injective f) : WithTop R →+* WithTop S :=
{MonoidWithZeroHom.withTopMap f.toMonoidWithZeroHom hf, f.toAddMonoidHom.withTopMap with}
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -27,7 +27,7 @@ section Mul
variable [Zero α] [Mul α]
-instance : MulZeroClass (WithTop α) where
+instance instMulZeroClassWithTop : MulZeroClass (WithTop α) where
zero := 0
mul m n := if m = 0 ∨ n = 0 then 0 else Option.map₂ (· * ·) m n
zero_mul _ := if_pos <| Or.inl rfl
@@ -116,7 +116,8 @@ theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.u
end MulZeroClass
/-- `Nontrivial α` is needed here as otherwise we have `1 * ⊤ = ⊤` but also `0 * ⊤ = 0`. -/
-instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
+instance instMulZeroOneClassWithTop [MulZeroOneClass α] [Nontrivial α] :
+ MulZeroOneClass (WithTop α) :=
{ WithTop.instMulZeroClassWithTop with
mul := (· * ·)
one := 1, zero := 0
@@ -152,7 +153,8 @@ protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClas
simp only [map_coe, ← coe_mul, map_mul] }
#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
-instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
+instance instSemigroupWithZeroWithTop [SemigroupWithZero α] [NoZeroDivisors α] :
+ SemigroupWithZero (WithTop α) :=
{ WithTop.instMulZeroClassWithTop with
mul := (· * ·)
zero := 0
@@ -2,17 +2,14 @@
Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit 0111834459f5d7400215223ea95ae38a1265a907
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.Hom.Ring
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Algebra.Order.Ring.Canonical
import Std.Data.Option.Lemmas
+#align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
+
/-! # Structures involving `*` and `0` on `WithTop` and `WithBot`
The main results of this section are `WithTop.canonicallyOrderedCommSemiring` and
`WithBot.orderedCommSemiring`.
I was looking on https://github.com/leanprover-community/mathlib4/pull/4933 to see what simp related porting notes I could improve after https://github.com/leanprover/lean4/pull/2266 lands in Lean 4. Mostly things I found could be cleaned up in any case, and so I've moved those into this PR.
There is lots more work to do diagnosing all the simp-related porting notes!
Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
@@ -151,7 +151,8 @@ protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClas
induction' y using WithTop.recTopCoe with y
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [mul_top hx, mul_top this]
- · simp only [map_coe, ← coe_mul, map_mul] } -- porting note: todo: `simp [← coe_mul]` fails
+ · -- porting note: todo: `simp [← coe_mul]` times out
+ simp only [map_coe, ← coe_mul, map_mul] }
#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
@@ -2,8 +2,9 @@
Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
+
! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
+! leanprover-community/mathlib commit 0111834459f5d7400215223ea95ae38a1265a907
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -21,9 +22,6 @@ variable {α : Type _}
namespace WithTop
-instance [Nonempty α] : Nontrivial (WithTop α) :=
- Option.nontrivial
-
variable [DecidableEq α]
instance : DecidableEq (WithTop α) := instDecidableEqOption
@@ -221,9 +219,6 @@ end WithTop
namespace WithBot
-instance [Nonempty α] : Nontrivial (WithBot α) :=
- Option.nontrivial
-
variable [DecidableEq α]
instance : DecidableEq (WithBot α) := instDecidableEqOption
@@ -136,7 +136,7 @@ instance [MulZeroOneClass α] [Nontrivial α] : MulZeroOneClass (WithTop α) :=
/-- A version of `WithTop.map` for `MonoidWithZeroHom`s. -/
@[simps (config := { fullyApplied := false })]
-protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [DecidableEq R]
+protected def _root_.MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [DecidableEq R]
[Nontrivial R] [MulZeroOneClass S] [DecidableEq S] [Nontrivial S] (f : R →*₀ S)
(hf : Function.Injective f) : WithTop R →*₀ WithTop S :=
{ f.toZeroHom.withTopMap, f.toMonoidHom.toOneHom.withTopMap with
@@ -154,7 +154,7 @@ protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [D
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [mul_top hx, mul_top this]
· simp only [map_coe, ← coe_mul, map_mul] } -- porting note: todo: `simp [← coe_mul]` fails
-#align monoid_with_zero_hom.with_top_map WithTop.MonoidWithZeroHom.withTopMap
+#align monoid_with_zero_hom.with_top_map MonoidWithZeroHom.withTopMap
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
{ WithTop.instMulZeroClassWithTop with
@@ -211,11 +211,11 @@ instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
/-- A version of `WithTop.map` for `RingHom`s. -/
@[simps (config := { fullyApplied := false })]
-protected def RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R] [DecidableEq R]
- [Nontrivial R] [CanonicallyOrderedCommSemiring S] [DecidableEq S] [Nontrivial S] (f : R →+* S)
- (hf : Function.Injective f) : WithTop R →+* WithTop S :=
+protected def _root_.RingHom.withTopMap {R S : Type _} [CanonicallyOrderedCommSemiring R]
+ [DecidableEq R] [Nontrivial R] [CanonicallyOrderedCommSemiring S] [DecidableEq S] [Nontrivial S]
+ (f : R →+* S) (hf : Function.Injective f) : WithTop R →+* WithTop S :=
{MonoidWithZeroHom.withTopMap f.toMonoidWithZeroHom hf, f.toAddMonoidHom.withTopMap with}
-#align ring_hom.with_top_map WithTop.RingHom.withTopMap
+#align ring_hom.with_top_map RingHom.withTopMap
end WithTop
WithTop
/WithBot
(#2406)
Some of these lemmas are generalized from ENNReal
while porting Data.Real.ENNReal
. Backported to Mathlib 3 in leanprover-community/mathlib#18487, now forward-porting back to Mathlib 4. Also forward-porting leanprover-community/mathlib#18391
order.with_bot
@995b47e555f1b6297c7cf16855f1023e355219fb
..afdb4fa3b32d41106a4a09b371ce549ad7958abd
algebra.order.monoid.with_top
@e7e2ba8aa216a5833b5ed85a93317263711a36b5
..afdb4fa3b32d41106a4a09b371ce549ad7958abd
algebra.order.sub.with_top
@10b4e499f43088dd3bb7b5796184ad5216648ab1
..afdb4fa3b32d41106a4a09b371ce549ad7958abd
algebra.order.ring.with_top
@e7e2ba8aa216a5833b5ed85a93317263711a36b5
..afdb4fa3b32d41106a4a09b371ce549ad7958abd
data.list.big_operators.basic
@47adfab39a11a072db552f47594bf8ed2cf8a722
..6c5f73fd6f6cc83122788a80a27cdd54663609f4
algebra.big_operators.order
@509de852e1de55e1efa8eacfa11df0823f26f226
..afdb4fa3b32d41106a4a09b371ce549ad7958abd
@@ -3,7 +3,7 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit e7e2ba8aa216a5833b5ed85a93317263711a36b5
+! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -48,14 +48,36 @@ theorem mul_def {a b : WithTop α} :
theorem top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ := by simp [mul_def]; rfl
#align with_top.top_mul_top WithTop.top_mul_top
-@[simp]
-theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by cases a <;> simp [mul_def, h] <;> rfl
+theorem mul_top' (a : WithTop α) : a * ⊤ = if a = 0 then 0 else ⊤ := by
+ induction a using recTopCoe <;> simp [mul_def] <;> rfl
+#align with_top.mul_top' WithTop.mul_top'
+
+@[simp] theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h]
#align with_top.mul_top WithTop.mul_top
-@[simp]
-theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by cases a <;> simp [mul_def, h] <;> rfl
+theorem top_mul' (a : WithTop α) : ⊤ * a = if a = 0 then 0 else ⊤ := by
+ induction a using recTopCoe <;> simp [mul_def] <;> rfl
+#align with_top.top_mul' WithTop.top_mul'
+
+@[simp] theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by rw [top_mul', if_neg h]
#align with_top.top_mul WithTop.top_mul
+theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 := by
+ rw [mul_def, ite_eq_iff, ← none_eq_top, Option.map₂_eq_none_iff]
+ have ha : a = 0 → a ≠ none := fun h => h.symm ▸ zero_ne_top
+ have hb : b = 0 → b ≠ none := fun h => h.symm ▸ zero_ne_top
+ tauto
+#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
+
+theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ := by
+ rw [WithTop.lt_top_iff_ne_top] at *
+ simp only [Ne.def, mul_eq_top_iff, *, and_false, false_and, false_or]
+#align with_top.mul_lt_top' WithTop.mul_lt_top'
+
+theorem mul_lt_top [LT α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ :=
+ mul_lt_top' (WithTop.lt_top_iff_ne_top.2 ha) (WithTop.lt_top_iff_ne_top.2 hb)
+#align with_top.mul_lt_top WithTop.mul_lt_top
+
instance noZeroDivisors [NoZeroDivisors α] : NoZeroDivisors (WithTop α) := by
refine ⟨fun h₁ => Decidable.by_contradiction <| fun h₂ => ?_⟩
rw [mul_def, if_neg h₂] at h₁
@@ -68,7 +90,7 @@ section MulZeroClass
variable [MulZeroClass α]
-@[norm_cast]
+@[simp, norm_cast]
theorem coe_mul {a b : α} : (↑(a * b) : WithTop α) = a * b := by
by_cases ha : a = 0
· simp [ha]
@@ -87,23 +109,6 @@ theorem mul_coe {b : α} (hb : b ≠ 0) : ∀ {a : WithTop α},
rfl
#align with_top.mul_coe WithTop.mul_coe
-@[simp]
-theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 := by
- match a with
- | none => match b with
- | none => simp [none_eq_top]
- | Option.some b => by_cases hb : b = 0 <;> simp [none_eq_top, some_eq_coe, hb]
- | Option.some a => match b with
- | none => by_cases ha : a = 0 <;> simp [none_eq_top, some_eq_coe, ha]
- | Option.some b => simp [some_eq_coe, ← coe_mul]
-#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
-
-theorem mul_lt_top [Preorder α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ := by
- lift a to α using ha
- lift b to α using hb
- simp only [← coe_mul, coe_lt_top]
-#align with_top.mul_lt_top WithTop.mul_lt_top
-
@[simp]
theorem untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 := by
by_cases ha : a = 0; · rw [ha, zero_mul, ← coe_zero, untop'_coe, zero_mul]
@@ -148,7 +153,7 @@ protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [D
induction' y using WithTop.recTopCoe with y
· have : (f x : WithTop S) ≠ 0 := by simpa [hf.eq_iff' (map_zero f)] using hx
simp [mul_top hx, mul_top this]
- · simp [← coe_mul, map_coe] }
+ · simp only [map_coe, ← coe_mul, map_mul] } -- porting note: todo: `simp [← coe_mul]` fails
#align monoid_with_zero_hom.with_top_map WithTop.MonoidWithZeroHom.withTopMap
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
@@ -250,13 +255,25 @@ theorem bot_mul_bot : (⊥ * ⊥ : WithBot α) = ⊥ :=
WithTop.top_mul_top
#align with_bot.bot_mul_bot WithBot.bot_mul_bot
+theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
+ WithTop.mul_eq_top_iff
+#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
+
+theorem bot_lt_mul' [LT α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b :=
+ WithTop.mul_lt_top' (α := αᵒᵈ) ha hb
+#align with_bot.bot_lt_mul' WithBot.bot_lt_mul'
+
+theorem bot_lt_mul [LT α] {a b : WithBot α} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : ⊥ < a * b :=
+ WithTop.mul_lt_top (α := αᵒᵈ) ha hb
+#align with_bot.bot_lt_mul WithBot.bot_lt_mul
+
end Mul
section MulZeroClass
variable [MulZeroClass α]
-@[norm_cast]
+@[simp, norm_cast] -- porting note: added `simp`
theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b :=
WithTop.coe_mul
#align with_bot.coe_mul WithBot.coe_mul
@@ -266,17 +283,6 @@ theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} :
WithTop.mul_coe hb
#align with_bot.mul_coe WithBot.mul_coe
-@[simp]
-theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥ ∨ a = ⊥ ∧ b ≠ 0 :=
- WithTop.mul_eq_top_iff
-#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
-
-theorem bot_lt_mul [Preorder α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b := by
- lift a to α using ne_bot_of_gt ha
- lift b to α using ne_bot_of_gt hb
- simp only [← coe_mul, bot_lt_coe]
-#align with_bot.bot_lt_mul WithBot.bot_lt_mul
-
end MulZeroClass
/-- `Nontrivial α` is needed here as otherwise we have `1 * ⊥ = ⊥` but also `= 0 * ⊥ = 0`. -/
Update some SHAs of files that changed in mathlib3.
These 17 files need mainly only updated SHA as they've been only touched by backports or already have been forward-ported.
The relevant changes are:
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -3,7 +3,7 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro
! This file was ported from Lean 3 source module algebra.order.ring.with_top
-! leanprover-community/mathlib commit 550b58538991c8977703fdeb7c9d51a5aa27df11
+! leanprover-community/mathlib commit e7e2ba8aa216a5833b5ed85a93317263711a36b5
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -425,9 +425,9 @@ instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (Wit
exact le_of_mul_le_mul_right h x0 ⟩
instance orderedCommSemiring [CanonicallyOrderedCommSemiring α] [Nontrivial α] :
- OrderedCommSemiring (WithBot α) :=
+ OrderedCommSemiring (WithBot α) :=
{ WithBot.zeroLEOneClass, WithBot.orderedAddCommMonoid, WithBot.commSemiring with
- mul_le_mul_of_nonneg_left := fun _ _ _ => mul_le_mul_of_nonneg_left,
- mul_le_mul_of_nonneg_right := fun _ _ _ => mul_le_mul_of_nonneg_right, }
+ mul_le_mul_of_nonneg_left := fun _ _ _ => mul_le_mul_of_nonneg_left
+ mul_le_mul_of_nonneg_right := fun _ _ _ => mul_le_mul_of_nonneg_right }
end WithBot
@@ -304,10 +304,15 @@ instance [MulZeroClass α] [Preorder α] [PosMulMono α] : PosMulMono (WithBot
⟨by
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk]
- rcases eq_or_ne x 0 with rfl | x0'; simp
- lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
- induction a using WithBot.recBotCoe; { simp_rw [mul_bot x0', bot_le] }
- induction b using WithBot.recBotCoe; { exact absurd h (bot_lt_coe _).not_le }
+ rcases eq_or_ne x 0 with rfl | x0'
+ · simp
+ lift x to α
+ · rintro rfl
+ exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ induction a using WithBot.recBotCoe
+ · simp_rw [mul_bot x0', bot_le]
+ induction b using WithBot.recBotCoe
+ · exact absurd h (bot_lt_coe _).not_le
simp only [← coe_mul, coe_le_coe] at *
norm_cast at x0
exact mul_le_mul_of_nonneg_left h x0 ⟩
@@ -316,10 +321,15 @@ instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot
⟨by
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk]
- rcases eq_or_ne x 0 with rfl | x0'; simp
- lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
- induction a using WithBot.recBotCoe; { simp_rw [bot_mul x0', bot_le] }
- induction b using WithBot.recBotCoe; { exact absurd h (bot_lt_coe _).not_le }
+ rcases eq_or_ne x 0 with rfl | x0'
+ · simp
+ lift x to α
+ · rintro rfl
+ exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ induction a using WithBot.recBotCoe
+ · simp_rw [bot_mul x0', bot_le]
+ induction b using WithBot.recBotCoe
+ · exact absurd h (bot_lt_coe _).not_le
simp only [← coe_mul, coe_le_coe] at *
norm_cast at x0
exact mul_le_mul_of_nonneg_right h x0 ⟩
@@ -329,8 +339,10 @@ instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMon
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk]
lift x to α using x0.ne_bot
- induction b using WithBot.recBotCoe; { exact absurd h not_lt_bot }
- induction a using WithBot.recBotCoe; { simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe] }
+ induction b using WithBot.recBotCoe
+ · exact absurd h not_lt_bot
+ induction a using WithBot.recBotCoe
+ · simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
norm_cast at x0
exact mul_lt_mul_of_pos_left h x0 ⟩
@@ -340,8 +352,10 @@ instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMon
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk]
lift x to α using x0.ne_bot
- induction b using WithBot.recBotCoe; { exact absurd h not_lt_bot }
- induction a using WithBot.recBotCoe; { simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe] }
+ induction b using WithBot.recBotCoe
+ · exact absurd h not_lt_bot
+ induction a using WithBot.recBotCoe
+ · simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe]
simp only [← coe_mul, coe_lt_coe] at *
norm_cast at x0
exact mul_lt_mul_of_pos_right h x0 ⟩
@@ -350,10 +364,16 @@ instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT
⟨by
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk] at h
- rcases eq_or_ne x 0 with rfl | x0'; { simp at h }
- lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
- induction b using WithBot.recBotCoe; { rw [mul_bot x0'] at h; exact absurd h bot_le.not_lt }
- induction a using WithBot.recBotCoe; { exact WithBot.bot_lt_coe _ }
+ rcases eq_or_ne x 0 with rfl | x0'
+ · simp at h
+ lift x to α
+ · rintro rfl
+ exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ induction b using WithBot.recBotCoe
+ · rw [mul_bot x0'] at h
+ exact absurd h bot_le.not_lt
+ induction a using WithBot.recBotCoe
+ · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
norm_cast at x0
exact lt_of_mul_lt_mul_left h x0 ⟩
@@ -362,10 +382,16 @@ instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT
⟨by
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk] at h
- rcases eq_or_ne x 0 with rfl | x0'; { simp at h }
- lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
- induction b using WithBot.recBotCoe; { rw [bot_mul x0'] at h; exact absurd h bot_le.not_lt }
- induction a using WithBot.recBotCoe; { exact WithBot.bot_lt_coe _ }
+ rcases eq_or_ne x 0 with rfl | x0'
+ · simp at h
+ lift x to α
+ · rintro rfl
+ exact (WithBot.bot_lt_coe (0 : α)).not_le x0
+ induction b using WithBot.recBotCoe
+ · rw [bot_mul x0'] at h
+ exact absurd h bot_le.not_lt
+ induction a using WithBot.recBotCoe
+ · exact WithBot.bot_lt_coe _
simp only [← coe_mul, coe_lt_coe] at *
norm_cast at x0
exact lt_of_mul_lt_mul_right h x0 ⟩
@@ -375,9 +401,11 @@ instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (Wit
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
- induction a using WithBot.recBotCoe; { exact bot_le }
+ induction a using WithBot.recBotCoe
+ · exact bot_le
induction b using WithBot.recBotCoe
- · rw [mul_bot x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe _).not_le
+ · rw [mul_bot x0.ne.symm, ← coe_mul] at h
+ exact absurd h (bot_lt_coe _).not_le
simp only [← coe_mul, coe_le_coe] at *
norm_cast at x0
exact le_of_mul_le_mul_left h x0 ⟩
@@ -387,9 +415,11 @@ instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (Wit
intro ⟨x, x0⟩ a b h
simp only [Subtype.coe_mk] at h
lift x to α using x0.ne_bot
- induction a using WithBot.recBotCoe; { exact bot_le }
+ induction a using WithBot.recBotCoe
+ · exact bot_le
induction b using WithBot.recBotCoe
- · rw [bot_mul x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe _).not_le
+ · rw [bot_mul x0.ne.symm, ← coe_mul] at h
+ exact absurd h (bot_lt_coe _).not_le
simp only [← coe_mul, coe_le_coe] at *
norm_cast at x0
exact le_of_mul_le_mul_right h x0 ⟩
Option.map₂
(#1439)
This is a forward-port of leanprover-community/mathlib#18081
@@ -34,12 +34,12 @@ variable [Zero α] [Mul α]
instance : MulZeroClass (WithTop α) where
zero := 0
- mul m n := if m = 0 ∨ n = 0 then 0 else m.bind fun a => n.bind fun b => ↑(a * b)
+ mul m n := if m = 0 ∨ n = 0 then 0 else Option.map₂ (· * ·) m n
zero_mul _ := if_pos <| Or.inl rfl
mul_zero _ := if_pos <| Or.inr rfl
theorem mul_def {a b : WithTop α} :
- a * b = if a = 0 ∨ b = 0 then (0 : WithTop α) else a.bind fun a => b.bind fun b => ↑(a * b) :=
+ a * b = (if a = 0 ∨ b = 0 then 0 else Option.map₂ (· * ·) a b : WithTop α) :=
rfl
#align with_top.mul_def WithTop.mul_def
@@ -56,6 +56,12 @@ theorem mul_top {a : WithTop α} (h : a ≠ 0) : a * ⊤ = ⊤ := by cases a <;>
theorem top_mul {a : WithTop α} (h : a ≠ 0) : ⊤ * a = ⊤ := by cases a <;> simp [mul_def, h] <;> rfl
#align with_top.top_mul WithTop.top_mul
+instance noZeroDivisors [NoZeroDivisors α] : NoZeroDivisors (WithTop α) := by
+ refine ⟨fun h₁ => Decidable.by_contradiction <| fun h₂ => ?_⟩
+ rw [mul_def, if_neg h₂] at h₁
+ rcases Option.mem_map₂_iff.1 h₁ with ⟨a, b, (rfl : _ = _), (rfl : _ = _), hab⟩
+ exact h₂ ((eq_zero_or_eq_zero_of_mul_eq_zero hab).imp (congr_arg some) (congr_arg some))
+
end Mul
section MulZeroClass
@@ -133,9 +139,9 @@ protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [D
map_mul' := fun x y => by
have : ∀ z, map f z = 0 ↔ z = 0 := fun z =>
(Option.map_injective hf).eq_iff' f.toZeroHom.withTopMap.map_zero
- rcases eq_or_ne x 0 with (rfl | hx)
+ rcases Decidable.eq_or_ne x 0 with (rfl | hx)
· simp
- rcases eq_or_ne y 0 with (rfl | hy)
+ rcases Decidable.eq_or_ne y 0 with (rfl | hy)
· simp
induction' x using WithTop.recTopCoe with x
· simp [hy, this]
@@ -145,12 +151,6 @@ protected def MonoidWithZeroHom.withTopMap {R S : Type _} [MulZeroOneClass R] [D
· simp [← coe_mul, map_coe] }
#align monoid_with_zero_hom.with_top_map WithTop.MonoidWithZeroHom.withTopMap
-instance noZeroDivisors [MulZeroClass α] [NoZeroDivisors α] : NoZeroDivisors (WithTop α) :=
- ⟨ by
- intro a b
- cases a <;> cases b <;> dsimp [mul_def] <;> split_ifs <;>
- simp_all [none_eq_top, some_eq_coe, mul_eq_zero]⟩
-
instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithTop α) :=
{ WithTop.instMulZeroClassWithTop with
mul := (· * ·)
@@ -177,7 +177,8 @@ instance commMonoidWithZero [CommMonoidWithZero α] [NoZeroDivisors α] [Nontriv
{ WithTop.monoidWithZero with
mul := (· * ·)
zero := 0,
- mul_comm := fun a b => by simp only [or_comm, mul_def, Option.bind_comm a b, mul_comm] }
+ mul_comm := fun _ _ => ite_congr (propext or_comm) (fun _ => rfl)
+ (fun _ => Option.map₂_comm mul_comm) }
variable [CanonicallyOrderedCommSemiring α]
@@ -230,7 +231,7 @@ instance : MulZeroClass (WithBot α) :=
WithTop.instMulZeroClassWithTop
theorem mul_def {a b : WithBot α} :
- a * b = if a = 0 ∨ b = 0 then (0 : WithBot α) else a.bind fun a => b.bind fun b => ↑(a * b) :=
+ a * b = if a = 0 ∨ b = 0 then (0 : WithBot α) else Option.map₂ (· * ·) a b :=
rfl
#align with_bot.mul_def WithBot.mul_def
@@ -256,14 +257,8 @@ section MulZeroClass
variable [MulZeroClass α]
@[norm_cast]
-theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b := by
- -- Porting note: Some lemmas seem to be no longer simp
- by_cases ha : a = 0
- · simp [coe_zero, ha]
- · by_cases hb : b = 0
- · simp [coe_zero, hb]
- · simp [*, coe_eq_zero, mul_def]
- rfl
+theorem coe_mul {a b : α} : (↑(a * b) : WithBot α) = a * b :=
+ WithTop.coe_mul
#align with_bot.coe_mul WithBot.coe_mul
theorem mul_coe {b : α} (hb : b ≠ 0) {a : WithBot α} :
WithBot
(#1508)
mathlib3 PR: https://github.com/leanprover-community/mathlib/pull/18149
Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>
@@ -14,7 +14,7 @@ import Std.Data.Option.Lemmas
/-! # Structures involving `*` and `0` on `WithTop` and `WithBot`
The main results of this section are `WithTop.canonicallyOrderedCommSemiring` and
-`WithBot.commMonoidWithZero`.
+`WithBot.orderedCommSemiring`.
-/
variable {α : Type _}
@@ -297,22 +297,112 @@ instance [SemigroupWithZero α] [NoZeroDivisors α] : SemigroupWithZero (WithBot
instance [MonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] : MonoidWithZero (WithBot α) :=
WithTop.monoidWithZero
-instance [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
+instance commMonoidWithZero [CommMonoidWithZero α] [NoZeroDivisors α] [Nontrivial α] :
CommMonoidWithZero (WithBot α) :=
WithTop.commMonoidWithZero
-instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : CommSemiring (WithBot α) :=
+instance commSemiring [CanonicallyOrderedCommSemiring α] [Nontrivial α] :
+ CommSemiring (WithBot α) :=
WithTop.commSemiring
-instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : PosMulMono (WithBot α) :=
- posMulMono_iff_covariant_pos.2
- ⟨by
- rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk]
- lift x to α using x0.ne_bot
- induction' a using WithBot.recBotCoe with a; · simp_rw [mul_bot x0.ne.symm, bot_le]
- induction' b using WithBot.recBotCoe with b; · exact absurd h (bot_lt_coe a).not_le
- simp only [← coe_mul, coe_le_coe] at *
- exact mul_le_mul_left' h x⟩
-
-instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : MulPosMono (WithBot α) :=
- posMulMono_iff_mulPosMono.mp inferInstance
+instance [MulZeroClass α] [Preorder α] [PosMulMono α] : PosMulMono (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk]
+ rcases eq_or_ne x 0 with rfl | x0'; simp
+ lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
+ induction a using WithBot.recBotCoe; { simp_rw [mul_bot x0', bot_le] }
+ induction b using WithBot.recBotCoe; { exact absurd h (bot_lt_coe _).not_le }
+ simp only [← coe_mul, coe_le_coe] at *
+ norm_cast at x0
+ exact mul_le_mul_of_nonneg_left h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [MulPosMono α] : MulPosMono (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk]
+ rcases eq_or_ne x 0 with rfl | x0'; simp
+ lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
+ induction a using WithBot.recBotCoe; { simp_rw [bot_mul x0', bot_le] }
+ induction b using WithBot.recBotCoe; { exact absurd h (bot_lt_coe _).not_le }
+ simp only [← coe_mul, coe_le_coe] at *
+ norm_cast at x0
+ exact mul_le_mul_of_nonneg_right h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [PosMulStrictMono α] : PosMulStrictMono (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk]
+ lift x to α using x0.ne_bot
+ induction b using WithBot.recBotCoe; { exact absurd h not_lt_bot }
+ induction a using WithBot.recBotCoe; { simp_rw [mul_bot x0.ne.symm, ← coe_mul, bot_lt_coe] }
+ simp only [← coe_mul, coe_lt_coe] at *
+ norm_cast at x0
+ exact mul_lt_mul_of_pos_left h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [MulPosStrictMono α] : MulPosStrictMono (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk]
+ lift x to α using x0.ne_bot
+ induction b using WithBot.recBotCoe; { exact absurd h not_lt_bot }
+ induction a using WithBot.recBotCoe; { simp_rw [bot_mul x0.ne.symm, ← coe_mul, bot_lt_coe] }
+ simp only [← coe_mul, coe_lt_coe] at *
+ norm_cast at x0
+ exact mul_lt_mul_of_pos_right h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [PosMulReflectLT α] : PosMulReflectLT (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk] at h
+ rcases eq_or_ne x 0 with rfl | x0'; { simp at h }
+ lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
+ induction b using WithBot.recBotCoe; { rw [mul_bot x0'] at h; exact absurd h bot_le.not_lt }
+ induction a using WithBot.recBotCoe; { exact WithBot.bot_lt_coe _ }
+ simp only [← coe_mul, coe_lt_coe] at *
+ norm_cast at x0
+ exact lt_of_mul_lt_mul_left h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [MulPosReflectLT α] : MulPosReflectLT (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk] at h
+ rcases eq_or_ne x 0 with rfl | x0'; { simp at h }
+ lift x to α; { rintro rfl; exact (WithBot.bot_lt_coe (0 : α)).not_le x0 }
+ induction b using WithBot.recBotCoe; { rw [bot_mul x0'] at h; exact absurd h bot_le.not_lt }
+ induction a using WithBot.recBotCoe; { exact WithBot.bot_lt_coe _ }
+ simp only [← coe_mul, coe_lt_coe] at *
+ norm_cast at x0
+ exact lt_of_mul_lt_mul_right h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [PosMulMonoRev α] : PosMulMonoRev (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk] at h
+ lift x to α using x0.ne_bot
+ induction a using WithBot.recBotCoe; { exact bot_le }
+ induction b using WithBot.recBotCoe
+ · rw [mul_bot x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe _).not_le
+ simp only [← coe_mul, coe_le_coe] at *
+ norm_cast at x0
+ exact le_of_mul_le_mul_left h x0 ⟩
+
+instance [MulZeroClass α] [Preorder α] [MulPosMonoRev α] : MulPosMonoRev (WithBot α) :=
+ ⟨by
+ intro ⟨x, x0⟩ a b h
+ simp only [Subtype.coe_mk] at h
+ lift x to α using x0.ne_bot
+ induction a using WithBot.recBotCoe; { exact bot_le }
+ induction b using WithBot.recBotCoe
+ · rw [bot_mul x0.ne.symm, ← coe_mul] at h; exact absurd h (bot_lt_coe _).not_le
+ simp only [← coe_mul, coe_le_coe] at *
+ norm_cast at x0
+ exact le_of_mul_le_mul_right h x0 ⟩
+
+instance orderedCommSemiring [CanonicallyOrderedCommSemiring α] [Nontrivial α] :
+ OrderedCommSemiring (WithBot α) :=
+ { WithBot.zeroLEOneClass, WithBot.orderedAddCommMonoid, WithBot.commSemiring with
+ mul_le_mul_of_nonneg_left := fun _ _ _ => mul_le_mul_of_nonneg_left,
+ mul_le_mul_of_nonneg_right := fun _ _ _ => mul_le_mul_of_nonneg_right, }
+
+end WithBot
Corresponds to [#18167](https://github.com/leanprover-community/mathlib/pull/18167).
@@ -201,7 +201,7 @@ instance commSemiring [Nontrivial α] : CommSemiring (WithTop α) :=
instance [Nontrivial α] : CanonicallyOrderedCommSemiring (WithTop α) :=
{ WithTop.commSemiring, WithTop.canonicallyOrderedAddMonoid with
- eq_zero_or_eq_zero_of_mul_eq_zero := fun _ _ => eq_zero_or_eq_zero_of_mul_eq_zero}
+ eq_zero_or_eq_zero_of_mul_eq_zero := eq_zero_or_eq_zero_of_mul_eq_zero}
/-- A version of `WithTop.map` for `RingHom`s. -/
@[simps (config := { fullyApplied := false })]
@@ -93,20 +93,9 @@ theorem mul_eq_top_iff {a b : WithTop α} : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤
#align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff
theorem mul_lt_top [Preorder α] {a b : WithTop α} (ha : a ≠ ⊤) (hb : b ≠ ⊤) : a * b < ⊤ := by
- match a with
- | none =>
- exfalso
- exact ha none_eq_top
- | Option.some a => match b with
- | none =>
- exfalso
- exact hb none_eq_top
- | Option.some b =>
- simp only [some_eq_coe, ← coe_mul, coe_lt_top]
- -- Porting note: use `lift` tactic:
- /-lift a to α using ha
+ lift a to α using ha
lift b to α using hb
- simp only [← coe_mul, coe_lt_top]-/
+ simp only [← coe_mul, coe_lt_top]
#align with_top.mul_lt_top WithTop.mul_lt_top
@[simp]
@@ -288,15 +277,8 @@ theorem mul_eq_bot_iff {a b : WithBot α} : a * b = ⊥ ↔ a ≠ 0 ∧ b = ⊥
#align with_bot.mul_eq_bot_iff WithBot.mul_eq_bot_iff
theorem bot_lt_mul [Preorder α] {a b : WithBot α} (ha : ⊥ < a) (hb : ⊥ < b) : ⊥ < a * b := by
- induction a using WithBot.recBotCoe
- · have := ne_bot_of_gt ha
- contradiction
- induction b using WithBot.recBotCoe
- · have := ne_bot_of_gt hb
- contradiction
- -- porting note: lift not implemented yet, this would replace the previous six lines
- -- lift a to α using ne_bot_of_gt ha
- -- lift b to α using ne_bot_of_gt hb
+ lift a to α using ne_bot_of_gt ha
+ lift b to α using ne_bot_of_gt hb
simp only [← coe_mul, bot_lt_coe]
#align with_bot.bot_lt_mul WithBot.bot_lt_mul
@@ -326,11 +308,7 @@ instance [CanonicallyOrderedCommSemiring α] [Nontrivial α] : PosMulMono (WithB
posMulMono_iff_covariant_pos.2
⟨by
rintro ⟨x, x0⟩ a b h; simp only [Subtype.coe_mk]
- induction' x using WithBot.recBotCoe with x
- · have := x0.ne_bot
- contradiction
- -- porting note: lift not implemented yet, this would replace the previous three lines
- -- lift x to α using x0.ne_bot
+ lift x to α using x0.ne_bot
induction' a using WithBot.recBotCoe with a; · simp_rw [mul_bot x0.ne.symm, bot_le]
induction' b using WithBot.recBotCoe with b; · exact absurd h (bot_lt_coe a).not_le
simp only [← coe_mul, coe_le_coe] at *