Module docstring
{"# Adjoining top/bottom elements to ordered monoids. "}
{"# Adjoining top/bottom elements to ordered monoids. "}
WithTop.one
instance
: One (WithTop α)
@[to_additive]
instance one : One (WithTop α) :=
⟨(1 : α)⟩
WithTop.coe_one
theorem
: ((1 : α) : WithTop α) = 1
@[to_additive (attr := simp, norm_cast)]
theorem coe_one : ((1 : α) : WithTop α) = 1 :=
rfl
WithTop.coe_eq_one
theorem
: (a : WithTop α) = 1 ↔ a = 1
@[to_additive (attr := simp, norm_cast)]
lemma coe_eq_one : (a : WithTop α) = 1 ↔ a = 1 := coe_eq_coe
WithTop.one_eq_coe
theorem
: 1 = (a : WithTop α) ↔ a = 1
@[to_additive (attr := simp, norm_cast)]
lemma one_eq_coe : 1 = (a : WithTop α) ↔ a = 1 := eq_comm.trans coe_eq_one
WithTop.top_ne_one
theorem
: (⊤ : WithTop α) ≠ 1
@[to_additive (attr := simp)] lemma top_ne_one : (⊤ : WithTop α) ≠ 1 := top_ne_coe
WithTop.one_ne_top
theorem
: (1 : WithTop α) ≠ ⊤
@[to_additive (attr := simp)] lemma one_ne_top : (1 : WithTop α) ≠ ⊤ := coe_ne_top
WithTop.untop_one
theorem
: (1 : WithTop α).untop coe_ne_top = 1
@[to_additive (attr := simp)]
theorem untop_one : (1 : WithTop α).untop coe_ne_top = 1 :=
rfl
WithTop.untopD_one
theorem
(d : α) : (1 : WithTop α).untopD d = 1
@[to_additive (attr := simp)]
theorem untopD_one (d : α) : (1 : WithTop α).untopD d = 1 :=
rfl
WithTop.one_le_coe
theorem
[LE α] {a : α} : 1 ≤ (a : WithTop α) ↔ 1 ≤ a
@[to_additive (attr := simp, norm_cast) coe_nonneg]
theorem one_le_coe [LE α] {a : α} : 1 ≤ (a : WithTop α) ↔ 1 ≤ a :=
coe_le_coe
WithTop.coe_le_one
theorem
[LE α] {a : α} : (a : WithTop α) ≤ 1 ↔ a ≤ 1
@[to_additive (attr := simp, norm_cast) coe_le_zero]
theorem coe_le_one [LE α] {a : α} : (a : WithTop α) ≤ 1 ↔ a ≤ 1 :=
coe_le_coe
WithTop.one_lt_coe
theorem
[LT α] {a : α} : 1 < (a : WithTop α) ↔ 1 < a
@[to_additive (attr := simp, norm_cast) coe_pos]
theorem one_lt_coe [LT α] {a : α} : 1 < (a : WithTop α) ↔ 1 < a :=
coe_lt_coe
WithTop.coe_lt_one
theorem
[LT α] {a : α} : (a : WithTop α) < 1 ↔ a < 1
@[to_additive (attr := simp, norm_cast) coe_lt_zero]
theorem coe_lt_one [LT α] {a : α} : (a : WithTop α) < 1 ↔ a < 1 :=
coe_lt_coe
WithTop.map_one
theorem
{β} (f : α → β) : (1 : WithTop α).map f = (f 1 : WithTop β)
WithTop.map_eq_one_iff
theorem
{α} {f : α → β} {v : WithTop α} [One β] : WithTop.map f v = 1 ↔ ∃ x, v = .some x ∧ f x = 1
@[to_additive]
theorem map_eq_one_iff {α} {f : α → β} {v : WithTop α} [One β] :
WithTop.mapWithTop.map f v = 1 ↔ ∃ x, v = .some x ∧ f x = 1 := map_eq_some_iff
WithTop.one_eq_map_iff
theorem
{α} {f : α → β} {v : WithTop α} [One β] : 1 = WithTop.map f v ↔ ∃ x, v = .some x ∧ f x = 1
@[to_additive]
theorem one_eq_map_iff {α} {f : α → β} {v : WithTop α} [One β] :
1 = WithTop.map f v ↔ ∃ x, v = .some x ∧ f x = 1 := some_eq_map_iff
WithTop.zeroLEOneClass
instance
[Zero α] [LE α] [ZeroLEOneClass α] : ZeroLEOneClass (WithTop α)
instance zeroLEOneClass [Zero α] [LE α] [ZeroLEOneClass α] : ZeroLEOneClass (WithTop α) :=
⟨coe_le_coe.2 zero_le_one⟩
WithTop.add
instance
: Add (WithTop α)
instance add : Add (WithTop α) :=
⟨Option.map₂ (· + ·)⟩
WithTop.coe_add
theorem
(a b : α) : ↑(a + b) = (a + b : WithTop α)
WithTop.top_add
theorem
(x : WithTop α) : ⊤ + x = ⊤
WithTop.add_top
theorem
(x : WithTop α) : x + ⊤ = ⊤
WithTop.add_eq_top
theorem
: x + y = ⊤ ↔ x = ⊤ ∨ y = ⊤
@[simp] lemma add_eq_top : x + y = ⊤ ↔ x = ⊤ ∨ y = ⊤ := by cases x <;> cases y <;> simp [← coe_add]
WithTop.add_ne_top
theorem
: x + y ≠ ⊤ ↔ x ≠ ⊤ ∧ y ≠ ⊤
lemma add_ne_top : x + y ≠ ⊤x + y ≠ ⊤ ↔ x ≠ ⊤ ∧ y ≠ ⊤ := by cases x <;> cases y <;> simp [← coe_add]
WithTop.add_lt_top
theorem
[LT α] : x + y < ⊤ ↔ x < ⊤ ∧ y < ⊤
@[simp]
lemma add_lt_top [LT α] : x + y < ⊤ ↔ x < ⊤ ∧ y < ⊤ := by
simp_rw [WithTop.lt_top_iff_ne_top, add_ne_top]
WithTop.add_eq_coe
theorem
: ∀ {a b : WithTop α} {c : α}, a + b = c ↔ ∃ a' b' : α, ↑a' = a ∧ ↑b' = b ∧ a' + b' = c
theorem add_eq_coe :
∀ {a b : WithTop α} {c : α}, a + b = c ↔ ∃ a' b' : α, ↑a' = a ∧ ↑b' = b ∧ a' + b' = c
| ⊤, b, c => by simp
| some a, ⊤, c => by simp
| some a, some b, c => by norm_cast; simp
WithTop.add_coe_eq_top_iff
theorem
: x + b = ⊤ ↔ x = ⊤
lemma add_coe_eq_top_iff : x + b = ⊤ ↔ x = ⊤ := by simp
WithTop.coe_add_eq_top_iff
theorem
: a + y = ⊤ ↔ y = ⊤
lemma coe_add_eq_top_iff : a + y = ⊤ ↔ y = ⊤ := by simp
WithTop.add_right_inj
theorem
[IsRightCancelAdd α] (hz : z ≠ ⊤) : x + z = y + z ↔ x = y
lemma add_right_inj [IsRightCancelAdd α] (hz : z ≠ ⊤) : x + z = y + z ↔ x = y := by
lift z to α using hz; cases x <;> cases y <;> simp [← coe_add]
WithTop.add_right_cancel
theorem
[IsRightCancelAdd α] (hz : z ≠ ⊤) (h : x + z = y + z) : x = y
lemma add_right_cancel [IsRightCancelAdd α] (hz : z ≠ ⊤) (h : x + z = y + z) : x = y :=
(WithTop.add_right_inj hz).1 h
WithTop.add_left_inj
theorem
[IsLeftCancelAdd α] (hx : x ≠ ⊤) : x + y = x + z ↔ y = z
lemma add_left_inj [IsLeftCancelAdd α] (hx : x ≠ ⊤) : x + y = x + z ↔ y = z := by
lift x to α using hx; cases y <;> cases z <;> simp [← coe_add]
WithTop.add_left_cancel
theorem
[IsLeftCancelAdd α] (hx : x ≠ ⊤) (h : x + y = x + z) : y = z
lemma add_left_cancel [IsLeftCancelAdd α] (hx : x ≠ ⊤) (h : x + y = x + z) : y = z :=
(WithTop.add_left_inj hx).1 h
WithTop.addLeftMono
instance
[LE α] [AddLeftMono α] : AddLeftMono (WithTop α)
instance addLeftMono [LE α] [AddLeftMono α] : AddLeftMono (WithTop α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add]; simpa using (add_le_add_left · _)
WithTop.addRightMono
instance
[LE α] [AddRightMono α] : AddRightMono (WithTop α)
instance addRightMono [LE α] [AddRightMono α] : AddRightMono (WithTop α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add, swap]; simpa using (add_le_add_right · _)
WithTop.addLeftReflectLT
instance
[LT α] [AddLeftReflectLT α] : AddLeftReflectLT (WithTop α)
instance addLeftReflectLT [LT α] [AddLeftReflectLT α] : AddLeftReflectLT (WithTop α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add, swap]; simpa using lt_of_add_lt_add_left
WithTop.addRightReflectLT
instance
[LT α] [AddRightReflectLT α] : AddRightReflectLT (WithTop α)
instance addRightReflectLT [LT α] [AddRightReflectLT α] : AddRightReflectLT (WithTop α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add, swap]; simpa using lt_of_add_lt_add_right
WithTop.le_of_add_le_add_left
theorem
[LE α] [AddLeftReflectLE α] (hx : x ≠ ⊤) : x + y ≤ x + z → y ≤ z
protected lemma le_of_add_le_add_left [LE α] [AddLeftReflectLE α] (hx : x ≠ ⊤) :
x + y ≤ x + z → y ≤ z := by
lift x to α using hx; cases y <;> cases z <;> simp [← coe_add]; simpa using le_of_add_le_add_left
WithTop.le_of_add_le_add_right
theorem
[LE α] [AddRightReflectLE α] (hz : z ≠ ⊤) : x + z ≤ y + z → x ≤ y
protected lemma le_of_add_le_add_right [LE α] [AddRightReflectLE α] (hz : z ≠ ⊤) :
x + z ≤ y + z → x ≤ y := by
lift z to α using hz; cases x <;> cases y <;> simp [← coe_add]; simpa using le_of_add_le_add_right
WithTop.add_lt_add_left
theorem
[LT α] [AddLeftStrictMono α] (hx : x ≠ ⊤) : y < z → x + y < x + z
protected lemma add_lt_add_left [LT α] [AddLeftStrictMono α] (hx : x ≠ ⊤) :
y < z → x + y < x + z := by
lift x to α using hx; cases y <;> cases z <;> simp [← coe_add]; simpa using (add_lt_add_left · _)
WithTop.add_lt_add_right
theorem
[LT α] [AddRightStrictMono α] (hz : z ≠ ⊤) : x < y → x + z < y + z
protected lemma add_lt_add_right [LT α] [AddRightStrictMono α] (hz : z ≠ ⊤) :
x < y → x + z < y + z := by
lift z to α using hz; cases x <;> cases y <;> simp [← coe_add]; simpa using (add_lt_add_right · _)
WithTop.add_le_add_iff_left
theorem
[LE α] [AddLeftMono α] [AddLeftReflectLE α] (hx : x ≠ ⊤) : x + y ≤ x + z ↔ y ≤ z
protected lemma add_le_add_iff_left [LE α] [AddLeftMono α] [AddLeftReflectLE α] (hx : x ≠ ⊤) :
x + y ≤ x + z ↔ y ≤ z := ⟨WithTop.le_of_add_le_add_left hx, (add_le_add_left · _)⟩
WithTop.add_le_add_iff_right
theorem
[LE α] [AddRightMono α] [AddRightReflectLE α] (hz : z ≠ ⊤) : x + z ≤ y + z ↔ x ≤ y
protected lemma add_le_add_iff_right [LE α] [AddRightMono α] [AddRightReflectLE α] (hz : z ≠ ⊤) :
x + z ≤ y + z ↔ x ≤ y := ⟨WithTop.le_of_add_le_add_right hz, (add_le_add_right · _)⟩
WithTop.add_lt_add_iff_left
theorem
[LT α] [AddLeftStrictMono α] [AddLeftReflectLT α] (hx : x ≠ ⊤) : x + y < x + z ↔ y < z
protected lemma add_lt_add_iff_left [LT α] [AddLeftStrictMono α] [AddLeftReflectLT α] (hx : x ≠ ⊤) :
x + y < x + z ↔ y < z := ⟨lt_of_add_lt_add_left, WithTop.add_lt_add_left hx⟩
WithTop.add_lt_add_iff_right
theorem
[LT α] [AddRightStrictMono α] [AddRightReflectLT α] (hz : z ≠ ⊤) : x + z < y + z ↔ x < y
protected lemma add_lt_add_iff_right [LT α] [AddRightStrictMono α] [AddRightReflectLT α]
(hz : z ≠ ⊤) : x + z < y + z ↔ x < y := ⟨lt_of_add_lt_add_right, WithTop.add_lt_add_right hz⟩
WithTop.add_lt_add_of_le_of_lt
theorem
[Preorder α] [AddLeftStrictMono α] [AddRightMono α] (hw : w ≠ ⊤) (hwy : w ≤ y) (hxz : x < z) : w + x < y + z
protected theorem add_lt_add_of_le_of_lt [Preorder α] [AddLeftStrictMono α]
[AddRightMono α] (hw : w ≠ ⊤) (hwy : w ≤ y) (hxz : x < z) :
w + x < y + z :=
(WithTop.add_lt_add_left hw hxz).trans_le <| add_le_add_right hwy _
WithTop.add_lt_add_of_lt_of_le
theorem
[Preorder α] [AddLeftMono α] [AddRightStrictMono α] (hx : x ≠ ⊤) (hwy : w < y) (hxz : x ≤ z) : w + x < y + z
protected theorem add_lt_add_of_lt_of_le [Preorder α] [AddLeftMono α]
[AddRightStrictMono α] (hx : x ≠ ⊤) (hwy : w < y) (hxz : x ≤ z) :
w + x < y + z :=
(WithTop.add_lt_add_right hx hwy).trans_le <| add_le_add_left hxz _
WithTop.addLECancellable_of_ne_top
theorem
[LE α] [ContravariantClass α α (· + ·) (· ≤ ·)] (hx : x ≠ ⊤) : AddLECancellable x
lemma addLECancellable_of_ne_top [LE α] [ContravariantClass α α (· + ·) (· ≤ ·)]
(hx : x ≠ ⊤) : AddLECancellable x := fun _b _c ↦ WithTop.le_of_add_le_add_left hx
WithTop.addLECancellable_of_lt_top
theorem
[Preorder α] [ContravariantClass α α (· + ·) (· ≤ ·)] (hx : x < ⊤) : AddLECancellable x
lemma addLECancellable_of_lt_top [Preorder α] [ContravariantClass α α (· + ·) (· ≤ ·)]
(hx : x < ⊤) : AddLECancellable x := addLECancellable_of_ne_top hx.ne
WithTop.addLECancellable_coe
theorem
[LE α] [ContravariantClass α α (· + ·) (· ≤ ·)] (a : α) : AddLECancellable (a : WithTop α)
lemma addLECancellable_coe [LE α] [ContravariantClass α α (· + ·) (· ≤ ·)] (a : α) :
AddLECancellable (a : WithTop α) := addLECancellable_of_ne_top coe_ne_top
WithTop.addLECancellable_iff_ne_top
theorem
[Nonempty α] [Preorder α] [ContravariantClass α α (· + ·) (· ≤ ·)] : AddLECancellable x ↔ x ≠ ⊤
lemma addLECancellable_iff_ne_top [Nonempty α] [Preorder α]
[ContravariantClass α α (· + ·) (· ≤ ·)] : AddLECancellableAddLECancellable x ↔ x ≠ ⊤ where
mp := by rintro h rfl; exact (coe_lt_top <| Classical.arbitrary _).not_le <| h <| by simp
mpr := addLECancellable_of_ne_top
WithTop.map_add
theorem
{F} [Add β] [FunLike F α β] [AddHomClass F α β] (f : F) (a b : WithTop α) : (a + b).map f = a.map f + b.map f
WithTop.addSemigroup
instance
[AddSemigroup α] : AddSemigroup (WithTop α)
instance addSemigroup [AddSemigroup α] : AddSemigroup (WithTop α) :=
{ WithTop.add with
add_assoc := fun _ _ _ => Option.map₂_assoc add_assoc }
WithTop.addCommSemigroup
instance
[AddCommSemigroup α] : AddCommSemigroup (WithTop α)
instance addCommSemigroup [AddCommSemigroup α] : AddCommSemigroup (WithTop α) :=
{ WithTop.addSemigroup with
add_comm := fun _ _ => Option.map₂_comm add_comm }
WithTop.addZeroClass
instance
[AddZeroClass α] : AddZeroClass (WithTop α)
instance addZeroClass [AddZeroClass α] : AddZeroClass (WithTop α) :=
{ WithTop.zero, WithTop.add with
zero_add := Option.map₂_left_identity zero_add
add_zero := Option.map₂_right_identity add_zero }
WithTop.addMonoid
instance
: AddMonoid (WithTop α)
instance addMonoid : AddMonoid (WithTop α) where
__ := WithTop.addSemigroup
__ := WithTop.addZeroClass
nsmul n a := match a, n with
| (a : α), n => ↑(n • a)
| ⊤, 0 => 0
| ⊤, _n + 1 => ⊤
nsmul_zero a := by cases a <;> simp [zero_nsmul]
nsmul_succ n a := by cases a <;> cases n <;> simp [succ_nsmul, coe_add]
WithTop.coe_nsmul
theorem
(a : α) (n : ℕ) : ↑(n • a) = n • (a : WithTop α)
WithTop.addHom
definition
: α →+ WithTop α
/-- Coercion from `α` to `WithTop α` as an `AddMonoidHom`. -/
def addHom : α →+ WithTop α where
toFun := WithTop.some
map_zero' := rfl
map_add' _ _ := rfl
WithTop.coe_addHom
theorem
: ⇑(addHom : α →+ WithTop α) = WithTop.some
@[simp, norm_cast] lemma coe_addHom : ⇑(addHom : α →+ WithTop α) = WithTop.some := rfl
WithTop.addCommMonoid
instance
[AddCommMonoid α] : AddCommMonoid (WithTop α)
instance addCommMonoid [AddCommMonoid α] : AddCommMonoid (WithTop α) :=
{ WithTop.addMonoid, WithTop.addCommSemigroup with }
WithTop.addMonoidWithOne
instance
: AddMonoidWithOne (WithTop α)
instance addMonoidWithOne : AddMonoidWithOne (WithTop α) :=
{ WithTop.one, WithTop.addMonoid with
natCast := fun n => ↑(n : α),
natCast_zero := by
simp only [Nat.cast_zero, WithTop.coe_zero],
natCast_succ := fun n => by
simp only [Nat.cast_add_one, WithTop.coe_add, WithTop.coe_one] }
WithTop.coe_natCast
theorem
(n : ℕ) : ((n : α) : WithTop α) = n
@[simp, norm_cast] lemma coe_natCast (n : ℕ) : ((n : α) : WithTop α) = n := rfl
WithTop.top_ne_natCast
theorem
(n : ℕ) : (⊤ : WithTop α) ≠ n
@[simp] lemma top_ne_natCast (n : ℕ) : (⊤ : WithTop α) ≠ n := top_ne_coe
WithTop.natCast_ne_top
theorem
(n : ℕ) : (n : WithTop α) ≠ ⊤
@[simp] lemma natCast_ne_top (n : ℕ) : (n : WithTop α) ≠ ⊤ := coe_ne_top
WithTop.natCast_lt_top
theorem
[LT α] (n : ℕ) : (n : WithTop α) < ⊤
@[simp] lemma natCast_lt_top [LT α] (n : ℕ) : (n : WithTop α) < ⊤ := coe_lt_top _
WithTop.coe_ofNat
theorem
(n : ℕ) [n.AtLeastTwo] : ((ofNat(n) : α) : WithTop α) = ofNat(n)
WithTop.coe_eq_ofNat
theorem
(n : ℕ) [n.AtLeastTwo] (m : α) : (m : WithTop α) = ofNat(n) ↔ m = ofNat(n)
@[simp] lemma coe_eq_ofNat (n : ℕ) [n.AtLeastTwo] (m : α) :
(m : WithTop α) = ofNat(n) ↔ m = ofNat(n) :=
coe_eq_coe
WithTop.ofNat_eq_coe
theorem
(n : ℕ) [n.AtLeastTwo] (m : α) : ofNat(n) = (m : WithTop α) ↔ ofNat(n) = m
@[simp] lemma ofNat_eq_coe (n : ℕ) [n.AtLeastTwo] (m : α) :
ofNat(n)ofNat(n) = (m : WithTop α) ↔ ofNat(n) = m :=
coe_eq_coe
WithTop.ofNat_ne_top
theorem
(n : ℕ) [n.AtLeastTwo] : (ofNat(n) : WithTop α) ≠ ⊤
@[simp] lemma ofNat_ne_top (n : ℕ) [n.AtLeastTwo] : (ofNat(n) : WithTop α) ≠ ⊤ :=
natCast_ne_top n
WithTop.top_ne_ofNat
theorem
(n : ℕ) [n.AtLeastTwo] : (⊤ : WithTop α) ≠ ofNat(n)
@[simp] lemma top_ne_ofNat (n : ℕ) [n.AtLeastTwo] : (⊤ : WithTop α) ≠ ofNat(n) :=
top_ne_natCast n
WithTop.map_ofNat
theorem
{f : α → β} (n : ℕ) [n.AtLeastTwo] : WithTop.map f (ofNat(n) : WithTop α) = f (ofNat(n))
@[simp] lemma map_ofNat {f : α → β} (n : ℕ) [n.AtLeastTwo] :
WithTop.map f (ofNat(n) : WithTop α) = f (ofNat(n)) := map_coe f n
WithTop.map_natCast
theorem
{f : α → β} (n : ℕ) : WithTop.map f (n : WithTop α) = f n
@[simp] lemma map_natCast {f : α → β} (n : ℕ) :
WithTop.map f (n : WithTop α) = f n := map_coe f n
WithTop.map_eq_ofNat_iff
theorem
{f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithTop β} : a.map f = ofNat(n) ↔ ∃ x, a = .some x ∧ f x = n
lemma map_eq_ofNat_iff {f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithTop β} :
a.map f = ofNat(n) ↔ ∃ x, a = .some x ∧ f x = n := map_eq_some_iff
WithTop.ofNat_eq_map_iff
theorem
{f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithTop β} : ofNat(n) = a.map f ↔ ∃ x, a = .some x ∧ f x = n
lemma ofNat_eq_map_iff {f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithTop β} :
ofNat(n)ofNat(n) = a.map f ↔ ∃ x, a = .some x ∧ f x = n := some_eq_map_iff
WithTop.map_eq_natCast_iff
theorem
{f : β → α} {n : ℕ} {a : WithTop β} : a.map f = n ↔ ∃ x, a = .some x ∧ f x = n
lemma map_eq_natCast_iff {f : β → α} {n : ℕ} {a : WithTop β} :
a.map f = n ↔ ∃ x, a = .some x ∧ f x = n := map_eq_some_iff
WithTop.natCast_eq_map_iff
theorem
{f : β → α} {n : ℕ} {a : WithTop β} : n = a.map f ↔ ∃ x, a = .some x ∧ f x = n
lemma natCast_eq_map_iff {f : β → α} {n : ℕ} {a : WithTop β} :
n = a.map f ↔ ∃ x, a = .some x ∧ f x = n := some_eq_map_iff
WithTop.charZero
instance
[AddMonoidWithOne α] [CharZero α] : CharZero (WithTop α)
instance charZero [AddMonoidWithOne α] [CharZero α] : CharZero (WithTop α) :=
{ cast_injective := Function.Injective.comp (f := Nat.cast (R := α))
(fun _ _ => WithTop.coe_eq_coe.1) Nat.cast_injective}
WithTop.addCommMonoidWithOne
instance
[AddCommMonoidWithOne α] : AddCommMonoidWithOne (WithTop α)
instance addCommMonoidWithOne [AddCommMonoidWithOne α] : AddCommMonoidWithOne (WithTop α) :=
{ WithTop.addMonoidWithOne, WithTop.addCommMonoid with }
WithTop.existsAddOfLE
instance
[LE α] [Add α] [ExistsAddOfLE α] : ExistsAddOfLE (WithTop α)
instance existsAddOfLE [LE α] [Add α] [ExistsAddOfLE α] : ExistsAddOfLE (WithTop α) :=
⟨fun {a} {b} =>
match a, b with
| ⊤, ⊤ => by simp
| (a : α), ⊤ => fun _ => ⟨⊤, rfl⟩
| (a : α), (b : α) => fun h => by
obtain ⟨c, rfl⟩ := exists_add_of_le (WithTop.coe_le_coe.1 h)
exact ⟨c, rfl⟩
| ⊤, (b : α) => fun h => (not_top_le_coe _ h).elim⟩
WithTop.one_lt_top
theorem
[One α] [LT α] : (1 : WithTop α) < ⊤
@[to_additive (attr := simp) top_pos]
theorem one_lt_top [One α] [LT α] : (1 : WithTop α) < ⊤ := coe_lt_top _
WithTop.zero_lt_coe
theorem
[Zero α] [LT α] (a : α) : (0 : WithTop α) < a ↔ 0 < a
@[norm_cast, deprecated coe_pos (since := "2024-10-22")]
theorem zero_lt_coe [Zero α] [LT α] (a : α) : (0 : WithTop α) < a ↔ 0 < a :=
coe_lt_coe
OneHom.withTopMap
definition
{M N : Type*} [One M] [One N] (f : OneHom M N) : OneHom (WithTop M) (WithTop N)
/-- A version of `WithTop.map` for `OneHom`s. -/
@[to_additive (attr := simps -fullyApplied)
"A version of `WithTop.map` for `ZeroHom`s"]
protected def _root_.OneHom.withTopMap {M N : Type*} [One M] [One N] (f : OneHom M N) :
OneHom (WithTop M) (WithTop N) where
toFun := WithTop.map f
map_one' := by rw [WithTop.map_one, map_one, coe_one]
AddHom.withTopMap
definition
{M N : Type*} [Add M] [Add N] (f : AddHom M N) : AddHom (WithTop M) (WithTop N)
/-- A version of `WithTop.map` for `AddHom`s. -/
@[simps -fullyApplied]
protected def _root_.AddHom.withTopMap {M N : Type*} [Add M] [Add N] (f : AddHom M N) :
AddHom (WithTop M) (WithTop N) where
toFun := WithTop.map f
map_add' := WithTop.map_add f
AddMonoidHom.withTopMap
definition
{M N : Type*} [AddZeroClass M] [AddZeroClass N] (f : M →+ N) : WithTop M →+ WithTop N
/-- A version of `WithTop.map` for `AddMonoidHom`s. -/
@[simps -fullyApplied]
protected def _root_.AddMonoidHom.withTopMap {M N : Type*} [AddZeroClass M] [AddZeroClass N]
(f : M →+ N) : WithTopWithTop M →+ WithTop N :=
{ ZeroHom.withTopMap f.toZeroHom, AddHom.withTopMap f.toAddHom with toFun := WithTop.map f }
WithBot.one
instance
: One (WithBot α)
@[to_additive] instance one : One (WithBot α) := WithTop.one
WithBot.coe_one
theorem
: ((1 : α) : WithBot α) = 1
@[to_additive (attr := simp, norm_cast)] lemma coe_one : ((1 : α) : WithBot α) = 1 := rfl
WithBot.coe_eq_one
theorem
: (a : WithBot α) = 1 ↔ a = 1
@[to_additive (attr := simp, norm_cast)]
lemma coe_eq_one : (a : WithBot α) = 1 ↔ a = 1 := coe_eq_coe
WithBot.one_eq_coe
theorem
: 1 = (a : WithBot α) ↔ a = 1
@[to_additive (attr := simp, norm_cast)]
lemma one_eq_coe : 1 = (a : WithBot α) ↔ a = 1 := eq_comm.trans coe_eq_one
WithBot.bot_ne_one
theorem
: (⊥ : WithBot α) ≠ 1
@[to_additive (attr := simp)] lemma bot_ne_one : (⊥ : WithBot α) ≠ 1 := bot_ne_coe
WithBot.one_ne_bot
theorem
: (1 : WithBot α) ≠ ⊥
@[to_additive (attr := simp)] lemma one_ne_bot : (1 : WithBot α) ≠ ⊥ := coe_ne_bot
WithBot.unbot_one
theorem
: (1 : WithBot α).unbot coe_ne_bot = 1
@[to_additive (attr := simp)]
theorem unbot_one : (1 : WithBot α).unbot coe_ne_bot = 1 :=
rfl
WithBot.unbotD_one
theorem
(d : α) : (1 : WithBot α).unbotD d = 1
@[to_additive (attr := simp)]
theorem unbotD_one (d : α) : (1 : WithBot α).unbotD d = 1 :=
rfl
WithBot.one_le_coe
theorem
[LE α] : 1 ≤ (a : WithBot α) ↔ 1 ≤ a
@[to_additive (attr := simp, norm_cast) coe_nonneg]
theorem one_le_coe [LE α] : 1 ≤ (a : WithBot α) ↔ 1 ≤ a := coe_le_coe
WithBot.coe_le_one
theorem
[LE α] : (a : WithBot α) ≤ 1 ↔ a ≤ 1
@[to_additive (attr := simp, norm_cast) coe_le_zero]
theorem coe_le_one [LE α] : (a : WithBot α) ≤ 1 ↔ a ≤ 1 := coe_le_coe
WithBot.one_lt_coe
theorem
[LT α] : 1 < (a : WithBot α) ↔ 1 < a
@[to_additive (attr := simp, norm_cast) coe_pos]
theorem one_lt_coe [LT α] : 1 < (a : WithBot α) ↔ 1 < a := coe_lt_coe
WithBot.coe_lt_one
theorem
[LT α] : (a : WithBot α) < 1 ↔ a < 1
@[to_additive (attr := simp, norm_cast) coe_lt_zero]
theorem coe_lt_one [LT α] : (a : WithBot α) < 1 ↔ a < 1 := coe_lt_coe
WithBot.map_one
theorem
{β} (f : α → β) : (1 : WithBot α).map f = (f 1 : WithBot β)
WithBot.map_eq_one_iff
theorem
{α} {f : α → β} {v : WithBot α} [One β] : WithBot.map f v = 1 ↔ ∃ x, v = .some x ∧ f x = 1
@[to_additive]
theorem map_eq_one_iff {α} {f : α → β} {v : WithBot α} [One β] :
WithBot.mapWithBot.map f v = 1 ↔ ∃ x, v = .some x ∧ f x = 1 := map_eq_some_iff
WithBot.one_eq_map_iff
theorem
{α} {f : α → β} {v : WithBot α} [One β] : 1 = WithBot.map f v ↔ ∃ x, v = .some x ∧ f x = 1
@[to_additive]
theorem one_eq_map_iff {α} {f : α → β} {v : WithBot α} [One β] :
1 = WithBot.map f v ↔ ∃ x, v = .some x ∧ f x = 1 := some_eq_map_iff
WithBot.zeroLEOneClass
instance
[Zero α] [LE α] [ZeroLEOneClass α] : ZeroLEOneClass (WithBot α)
instance zeroLEOneClass [Zero α] [LE α] [ZeroLEOneClass α] : ZeroLEOneClass (WithBot α) :=
⟨coe_le_coe.2 zero_le_one⟩
WithBot.add
instance
: Add (WithBot α)
instance add : Add (WithBot α) :=
⟨Option.map₂ (· + ·)⟩
WithBot.coe_add
theorem
(a b : α) : ↑(a + b) = (a + b : WithBot α)
WithBot.bot_add
theorem
(x : WithBot α) : ⊥ + x = ⊥
WithBot.add_bot
theorem
(x : WithBot α) : x + ⊥ = ⊥
WithBot.add_eq_bot
theorem
: x + y = ⊥ ↔ x = ⊥ ∨ y = ⊥
@[simp] lemma add_eq_bot : x + y = ⊥ ↔ x = ⊥ ∨ y = ⊥ := by cases x <;> cases y <;> simp [← coe_add]
WithBot.add_ne_bot
theorem
: x + y ≠ ⊥ ↔ x ≠ ⊥ ∧ y ≠ ⊥
lemma add_ne_bot : x + y ≠ ⊥x + y ≠ ⊥ ↔ x ≠ ⊥ ∧ y ≠ ⊥ := by cases x <;> cases y <;> simp [← coe_add]
WithBot.bot_lt_add
theorem
[LT α] : ⊥ < x + y ↔ ⊥ < x ∧ ⊥ < y
@[simp]
lemma bot_lt_add [LT α] : ⊥⊥ < x + y ↔ ⊥ < x ∧ ⊥ < y := by
simp_rw [WithBot.bot_lt_iff_ne_bot, add_ne_bot]
WithBot.add_eq_coe
theorem
: ∀ {a b : WithBot α} {c : α}, a + b = c ↔ ∃ a' b' : α, ↑a' = a ∧ ↑b' = b ∧ a' + b' = c
theorem add_eq_coe :
∀ {a b : WithBot α} {c : α}, a + b = c ↔ ∃ a' b' : α, ↑a' = a ∧ ↑b' = b ∧ a' + b' = c
| ⊥, b, c => by simp
| some a, ⊥, c => by simp
| some a, some b, c => by norm_cast; simp
WithBot.add_coe_eq_bot_iff
theorem
: x + b = ⊥ ↔ x = ⊥
lemma add_coe_eq_bot_iff : x + b = ⊥ ↔ x = ⊥ := by simp
WithBot.coe_add_eq_bot_iff
theorem
: a + y = ⊥ ↔ y = ⊥
lemma coe_add_eq_bot_iff : a + y = ⊥ ↔ y = ⊥ := by simp
WithBot.add_right_inj
theorem
[IsRightCancelAdd α] (hz : z ≠ ⊥) : x + z = y + z ↔ x = y
lemma add_right_inj [IsRightCancelAdd α] (hz : z ≠ ⊥) : x + z = y + z ↔ x = y := by
lift z to α using hz; cases x <;> cases y <;> simp [← coe_add]
WithBot.add_right_cancel
theorem
[IsRightCancelAdd α] (hz : z ≠ ⊥) (h : x + z = y + z) : x = y
lemma add_right_cancel [IsRightCancelAdd α] (hz : z ≠ ⊥) (h : x + z = y + z) : x = y :=
(WithBot.add_right_inj hz).1 h
WithBot.add_left_inj
theorem
[IsLeftCancelAdd α] (hx : x ≠ ⊥) : x + y = x + z ↔ y = z
lemma add_left_inj [IsLeftCancelAdd α] (hx : x ≠ ⊥) : x + y = x + z ↔ y = z := by
lift x to α using hx; cases y <;> cases z <;> simp [← coe_add]
WithBot.add_left_cancel
theorem
[IsLeftCancelAdd α] (hx : x ≠ ⊥) (h : x + y = x + z) : y = z
lemma add_left_cancel [IsLeftCancelAdd α] (hx : x ≠ ⊥) (h : x + y = x + z) : y = z :=
(WithBot.add_left_inj hx).1 h
WithBot.addLeftMono
instance
[LE α] [AddLeftMono α] : AddLeftMono (WithBot α)
instance addLeftMono [LE α] [AddLeftMono α] : AddLeftMono (WithBot α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add]; simpa using (add_le_add_left · _)
WithBot.addRightMono
instance
[LE α] [AddRightMono α] : AddRightMono (WithBot α)
instance addRightMono [LE α] [AddRightMono α] : AddRightMono (WithBot α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add, swap]; simpa using (add_le_add_right · _)
WithBot.addLeftReflectLT
instance
[LT α] [AddLeftReflectLT α] : AddLeftReflectLT (WithBot α)
instance addLeftReflectLT [LT α] [AddLeftReflectLT α] : AddLeftReflectLT (WithBot α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add, swap]; simpa using lt_of_add_lt_add_left
WithBot.addRightReflectLT
instance
[LT α] [AddRightReflectLT α] : AddRightReflectLT (WithBot α)
instance addRightReflectLT [LT α] [AddRightReflectLT α] : AddRightReflectLT (WithBot α) where
elim x y z := by
cases x <;> cases y <;> cases z <;> simp [← coe_add, swap]; simpa using lt_of_add_lt_add_right
WithBot.le_of_add_le_add_left
theorem
[LE α] [AddLeftReflectLE α] (hx : x ≠ ⊥) : x + y ≤ x + z → y ≤ z
protected lemma le_of_add_le_add_left [LE α] [AddLeftReflectLE α] (hx : x ≠ ⊥) :
x + y ≤ x + z → y ≤ z := by
lift x to α using hx; cases y <;> cases z <;> simp [← coe_add]; simpa using le_of_add_le_add_left
WithBot.le_of_add_le_add_right
theorem
[LE α] [AddRightReflectLE α] (hz : z ≠ ⊥) : x + z ≤ y + z → x ≤ y
protected lemma le_of_add_le_add_right [LE α] [AddRightReflectLE α] (hz : z ≠ ⊥) :
x + z ≤ y + z → x ≤ y := by
lift z to α using hz; cases x <;> cases y <;> simp [← coe_add]; simpa using le_of_add_le_add_right
WithBot.add_lt_add_left
theorem
[LT α] [AddLeftStrictMono α] (hx : x ≠ ⊥) : y < z → x + y < x + z
protected lemma add_lt_add_left [LT α] [AddLeftStrictMono α] (hx : x ≠ ⊥) :
y < z → x + y < x + z := by
lift x to α using hx; cases y <;> cases z <;> simp [← coe_add]; simpa using (add_lt_add_left · _)
WithBot.add_lt_add_right
theorem
[LT α] [AddRightStrictMono α] (hz : z ≠ ⊥) : x < y → x + z < y + z
protected lemma add_lt_add_right [LT α] [AddRightStrictMono α] (hz : z ≠ ⊥) :
x < y → x + z < y + z := by
lift z to α using hz; cases x <;> cases y <;> simp [← coe_add]; simpa using (add_lt_add_right · _)
WithBot.add_le_add_iff_left
theorem
[LE α] [AddLeftMono α] [AddLeftReflectLE α] (hx : x ≠ ⊥) : x + y ≤ x + z ↔ y ≤ z
protected lemma add_le_add_iff_left [LE α] [AddLeftMono α] [AddLeftReflectLE α] (hx : x ≠ ⊥) :
x + y ≤ x + z ↔ y ≤ z := ⟨WithBot.le_of_add_le_add_left hx, (add_le_add_left · _)⟩
WithBot.add_le_add_iff_right
theorem
[LE α] [AddRightMono α] [AddRightReflectLE α] (hz : z ≠ ⊥) : x + z ≤ y + z ↔ x ≤ y
protected lemma add_le_add_iff_right [LE α] [AddRightMono α] [AddRightReflectLE α] (hz : z ≠ ⊥) :
x + z ≤ y + z ↔ x ≤ y := ⟨WithBot.le_of_add_le_add_right hz, (add_le_add_right · _)⟩
WithBot.add_lt_add_iff_left
theorem
[LT α] [AddLeftStrictMono α] [AddLeftReflectLT α] (hx : x ≠ ⊥) : x + y < x + z ↔ y < z
protected lemma add_lt_add_iff_left [LT α] [AddLeftStrictMono α] [AddLeftReflectLT α] (hx : x ≠ ⊥) :
x + y < x + z ↔ y < z := ⟨lt_of_add_lt_add_left, WithBot.add_lt_add_left hx⟩
WithBot.add_lt_add_iff_right
theorem
[LT α] [AddRightStrictMono α] [AddRightReflectLT α] (hz : z ≠ ⊥) : x + z < y + z ↔ x < y
protected lemma add_lt_add_iff_right [LT α] [AddRightStrictMono α] [AddRightReflectLT α]
(hz : z ≠ ⊥) : x + z < y + z ↔ x < y := ⟨lt_of_add_lt_add_right, WithBot.add_lt_add_right hz⟩
WithBot.add_lt_add_of_le_of_lt
theorem
[Preorder α] [AddLeftStrictMono α] [AddRightMono α] (hw : w ≠ ⊥) (hwy : w ≤ y) (hxz : x < z) : w + x < y + z
protected theorem add_lt_add_of_le_of_lt [Preorder α] [AddLeftStrictMono α]
[AddRightMono α] (hw : w ≠ ⊥) (hwy : w ≤ y) (hxz : x < z) :
w + x < y + z :=
(WithBot.add_lt_add_left hw hxz).trans_le <| add_le_add_right hwy _
WithBot.add_lt_add_of_lt_of_le
theorem
[Preorder α] [AddLeftMono α] [AddRightStrictMono α] (hx : x ≠ ⊥) (hwy : w < y) (hxz : x ≤ z) : w + x < y + z
protected theorem add_lt_add_of_lt_of_le [Preorder α] [AddLeftMono α]
[AddRightStrictMono α] (hx : x ≠ ⊥) (hwy : w < y) (hxz : x ≤ z) :
w + x < y + z :=
(WithBot.add_lt_add_right hx hwy).trans_le <| add_le_add_left hxz _
WithBot.addLECancellable_of_ne_bot
theorem
[LE α] [ContravariantClass α α (· + ·) (· ≤ ·)] (hx : x ≠ ⊥) : AddLECancellable x
lemma addLECancellable_of_ne_bot [LE α] [ContravariantClass α α (· + ·) (· ≤ ·)]
(hx : x ≠ ⊥) : AddLECancellable x := fun _b _c ↦ WithBot.le_of_add_le_add_left hx
WithBot.addLECancellable_of_lt_bot
theorem
[Preorder α] [ContravariantClass α α (· + ·) (· ≤ ·)] (hx : x < ⊥) : AddLECancellable x
lemma addLECancellable_of_lt_bot [Preorder α] [ContravariantClass α α (· + ·) (· ≤ ·)]
(hx : x < ⊥) : AddLECancellable x := addLECancellable_of_ne_bot hx.ne
WithBot.addLECancellable_coe
theorem
[LE α] [ContravariantClass α α (· + ·) (· ≤ ·)] (a : α) : AddLECancellable (a : WithBot α)
lemma addLECancellable_coe [LE α] [ContravariantClass α α (· + ·) (· ≤ ·)] (a : α) :
AddLECancellable (a : WithBot α) := addLECancellable_of_ne_bot coe_ne_bot
WithBot.addLECancellable_iff_ne_bot
theorem
[Nonempty α] [Preorder α] [ContravariantClass α α (· + ·) (· ≤ ·)] : AddLECancellable x ↔ x ≠ ⊥
lemma addLECancellable_iff_ne_bot [Nonempty α] [Preorder α]
[ContravariantClass α α (· + ·) (· ≤ ·)] : AddLECancellableAddLECancellable x ↔ x ≠ ⊥ where
mp := by rintro h rfl; exact (bot_lt_coe <| Classical.arbitrary _).not_le <| h <| by simp
mpr := addLECancellable_of_ne_bot
WithBot.map_add
theorem
{F} [Add β] [FunLike F α β] [AddHomClass F α β] (f : F) (a b : WithBot α) : (a + b).map f = a.map f + b.map f
WithBot.AddSemigroup
instance
[AddSemigroup α] : AddSemigroup (WithBot α)
instance AddSemigroup [AddSemigroup α] : AddSemigroup (WithBot α) :=
WithTop.addSemigroup
WithBot.addCommSemigroup
instance
[AddCommSemigroup α] : AddCommSemigroup (WithBot α)
instance addCommSemigroup [AddCommSemigroup α] : AddCommSemigroup (WithBot α) :=
WithTop.addCommSemigroup
WithBot.addZeroClass
instance
[AddZeroClass α] : AddZeroClass (WithBot α)
instance addZeroClass [AddZeroClass α] : AddZeroClass (WithBot α) :=
WithTop.addZeroClass
WithBot.addMonoid
instance
: AddMonoid (WithBot α)
instance addMonoid : AddMonoid (WithBot α) := WithTop.addMonoid
WithBot.addHom
definition
: α →+ WithBot α
/-- Coercion from `α` to `WithBot α` as an `AddMonoidHom`. -/
def addHom : α →+ WithBot α where
toFun := WithTop.some
map_zero' := rfl
map_add' _ _ := rfl
WithBot.coe_addHom
theorem
: ⇑(addHom : α →+ WithBot α) = WithBot.some
@[simp, norm_cast] lemma coe_addHom : ⇑(addHom : α →+ WithBot α) = WithBot.some := rfl
WithBot.coe_nsmul
theorem
(a : α) (n : ℕ) : ↑(n • a) = n • (a : WithBot α)
WithBot.addCommMonoid
instance
[AddCommMonoid α] : AddCommMonoid (WithBot α)
instance addCommMonoid [AddCommMonoid α] : AddCommMonoid (WithBot α) :=
WithTop.addCommMonoid
WithBot.addMonoidWithOne
instance
: AddMonoidWithOne (WithBot α)
instance addMonoidWithOne : AddMonoidWithOne (WithBot α) := WithTop.addMonoidWithOne
WithBot.coe_natCast
theorem
(n : ℕ) : ((n : α) : WithBot α) = n
@[norm_cast] lemma coe_natCast (n : ℕ) : ((n : α) : WithBot α) = n := rfl
WithBot.natCast_ne_bot
theorem
(n : ℕ) : (n : WithBot α) ≠ ⊥
@[simp] lemma natCast_ne_bot (n : ℕ) : (n : WithBot α) ≠ ⊥ := coe_ne_bot
WithBot.bot_ne_natCast
theorem
(n : ℕ) : (⊥ : WithBot α) ≠ n
@[simp] lemma bot_ne_natCast (n : ℕ) : (⊥ : WithBot α) ≠ n := bot_ne_coe
WithBot.coe_ofNat
theorem
(n : ℕ) [n.AtLeastTwo] : ((ofNat(n) : α) : WithBot α) = ofNat(n)
WithBot.coe_eq_ofNat
theorem
(n : ℕ) [n.AtLeastTwo] (m : α) : (m : WithBot α) = ofNat(n) ↔ m = ofNat(n)
@[simp] lemma coe_eq_ofNat (n : ℕ) [n.AtLeastTwo] (m : α) :
(m : WithBot α) = ofNat(n) ↔ m = ofNat(n) :=
coe_eq_coe
WithBot.ofNat_eq_coe
theorem
(n : ℕ) [n.AtLeastTwo] (m : α) : ofNat(n) = (m : WithBot α) ↔ ofNat(n) = m
@[simp] lemma ofNat_eq_coe (n : ℕ) [n.AtLeastTwo] (m : α) :
ofNat(n)ofNat(n) = (m : WithBot α) ↔ ofNat(n) = m :=
coe_eq_coe
WithBot.ofNat_ne_bot
theorem
(n : ℕ) [n.AtLeastTwo] : (ofNat(n) : WithBot α) ≠ ⊥
@[simp] lemma ofNat_ne_bot (n : ℕ) [n.AtLeastTwo] : (ofNat(n) : WithBot α) ≠ ⊥ :=
natCast_ne_bot n
WithBot.bot_ne_ofNat
theorem
(n : ℕ) [n.AtLeastTwo] : (⊥ : WithBot α) ≠ ofNat(n)
@[simp] lemma bot_ne_ofNat (n : ℕ) [n.AtLeastTwo] : (⊥ : WithBot α) ≠ ofNat(n) :=
bot_ne_natCast n
WithBot.map_ofNat
theorem
{f : α → β} (n : ℕ) [n.AtLeastTwo] : WithBot.map f (ofNat(n) : WithBot α) = f ofNat(n)
@[simp] lemma map_ofNat {f : α → β} (n : ℕ) [n.AtLeastTwo] :
WithBot.map f (ofNat(n) : WithBot α) = f ofNat(n) := map_coe f n
WithBot.map_natCast
theorem
{f : α → β} (n : ℕ) : WithBot.map f (n : WithBot α) = f n
@[simp] lemma map_natCast {f : α → β} (n : ℕ) :
WithBot.map f (n : WithBot α) = f n := map_coe f n
WithBot.map_eq_ofNat_iff
theorem
{f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithBot β} : a.map f = ofNat(n) ↔ ∃ x, a = .some x ∧ f x = n
lemma map_eq_ofNat_iff {f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithBot β} :
a.map f = ofNat(n) ↔ ∃ x, a = .some x ∧ f x = n := map_eq_some_iff
WithBot.ofNat_eq_map_iff
theorem
{f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithBot β} : ofNat(n) = a.map f ↔ ∃ x, a = .some x ∧ f x = n
lemma ofNat_eq_map_iff {f : β → α} {n : ℕ} [n.AtLeastTwo] {a : WithBot β} :
ofNat(n)ofNat(n) = a.map f ↔ ∃ x, a = .some x ∧ f x = n := some_eq_map_iff
WithBot.map_eq_natCast_iff
theorem
{f : β → α} {n : ℕ} {a : WithBot β} : a.map f = n ↔ ∃ x, a = .some x ∧ f x = n
lemma map_eq_natCast_iff {f : β → α} {n : ℕ} {a : WithBot β} :
a.map f = n ↔ ∃ x, a = .some x ∧ f x = n := map_eq_some_iff
WithBot.natCast_eq_map_iff
theorem
{f : β → α} {n : ℕ} {a : WithBot β} : n = a.map f ↔ ∃ x, a = .some x ∧ f x = n
lemma natCast_eq_map_iff {f : β → α} {n : ℕ} {a : WithBot β} :
n = a.map f ↔ ∃ x, a = .some x ∧ f x = n := some_eq_map_iff
WithBot.charZero
instance
[AddMonoidWithOne α] [CharZero α] : CharZero (WithBot α)
instance charZero [AddMonoidWithOne α] [CharZero α] : CharZero (WithBot α) :=
WithTop.charZero
WithBot.addCommMonoidWithOne
instance
[AddCommMonoidWithOne α] : AddCommMonoidWithOne (WithBot α)
instance addCommMonoidWithOne [AddCommMonoidWithOne α] : AddCommMonoidWithOne (WithBot α) :=
WithTop.addCommMonoidWithOne
OneHom.withBotMap
definition
{M N : Type*} [One M] [One N] (f : OneHom M N) : OneHom (WithBot M) (WithBot N)
/-- A version of `WithBot.map` for `OneHom`s. -/
@[to_additive (attr := simps -fullyApplied)
"A version of `WithBot.map` for `ZeroHom`s"]
protected def _root_.OneHom.withBotMap {M N : Type*} [One M] [One N] (f : OneHom M N) :
OneHom (WithBot M) (WithBot N) where
toFun := WithBot.map f
map_one' := by rw [WithBot.map_one, map_one, coe_one]
AddHom.withBotMap
definition
{M N : Type*} [Add M] [Add N] (f : AddHom M N) : AddHom (WithBot M) (WithBot N)
/-- A version of `WithBot.map` for `AddHom`s. -/
@[simps -fullyApplied]
protected def _root_.AddHom.withBotMap {M N : Type*} [Add M] [Add N] (f : AddHom M N) :
AddHom (WithBot M) (WithBot N) where
toFun := WithBot.map f
map_add' := WithBot.map_add f
AddMonoidHom.withBotMap
definition
{M N : Type*} [AddZeroClass M] [AddZeroClass N] (f : M →+ N) : WithBot M →+ WithBot N
/-- A version of `WithBot.map` for `AddMonoidHom`s. -/
@[simps -fullyApplied]
protected def _root_.AddMonoidHom.withBotMap {M N : Type*} [AddZeroClass M] [AddZeroClass N]
(f : M →+ N) : WithBotWithBot M →+ WithBot N :=
{ ZeroHom.withBotMap f.toZeroHom, AddHom.withBotMap f.toAddHom with toFun := WithBot.map f }