Documentation

Mathlib.Algebra.Order.Group.Abs

Absolute values in ordered groups. #

instance Neg.toHasAbs {α : Type u_1} [Neg α] [Sup α] :
Abs α

abs a is the absolute value of a

Equations
  • Neg.toHasAbs = { abs := fun (a : α) => a ⊔ -a }
instance Inv.toHasAbs {α : Type u_1} [Inv α] [Sup α] :
Abs α

abs a is the absolute value of a.

Equations
  • Inv.toHasAbs = { abs := fun (a : α) => a ⊔ a⁻¹ }
theorem abs_eq_sup_neg {α : Type u_1} [Neg α] [Sup α] (a : α) :
|a| = a ⊔ -a
theorem abs_eq_sup_inv {α : Type u_1} [Inv α] [Sup α] (a : α) :
|a| = a ⊔ a⁻¹
theorem abs_eq_max_neg {α : Type u_1} [Neg α] [LinearOrder α] {a : α} :
|a| = max a (-a)
theorem abs_choice {α : Type u_1} [Neg α] [LinearOrder α] (x : α) :
|x| = x ∨ |x| = -x
theorem abs_le' {α : Type u_1} [Neg α] [LinearOrder α] {a : α} {b : α} :
|a| ≤ b ↔ a ≤ b ∧ -a ≤ b
theorem le_abs {α : Type u_1} [Neg α] [LinearOrder α] {a : α} {b : α} :
a ≤ |b| ↔ a ≤ b ∨ a ≤ -b
theorem le_abs_self {α : Type u_1} [Neg α] [LinearOrder α] (a : α) :
a ≤ |a|
theorem neg_le_abs_self {α : Type u_1} [Neg α] [LinearOrder α] (a : α) :
-a ≤ |a|
theorem lt_abs {α : Type u_1} [Neg α] [LinearOrder α] {a : α} {b : α} :
a < |b| ↔ a < b ∨ a < -b
theorem abs_le_abs {α : Type u_1} [Neg α] [LinearOrder α] {a : α} {b : α} (h₀ : a ≤ b) (h₁ : -a ≤ b) :
|a| ≤ |b|
theorem abs_by_cases {α : Type u_1} [Neg α] [LinearOrder α] (P : α → Prop) {a : α} (h1 : P a) (h2 : P (-a)) :
P |a|
@[simp]
theorem abs_neg {α : Type u_1} [AddGroup α] [LinearOrder α] (a : α) :
|(-a)| = |a|
theorem eq_or_eq_neg_of_abs_eq {α : Type u_1} [AddGroup α] [LinearOrder α] {a : α} {b : α} (h : |a| = b) :
a = b ∨ a = -b
theorem abs_eq_abs {α : Type u_1} [AddGroup α] [LinearOrder α] {a : α} {b : α} :
|a| = |b| ↔ a = b ∨ a = -b
theorem abs_sub_comm {α : Type u_1} [AddGroup α] [LinearOrder α] (a : α) (b : α) :
|a - b| = |b - a|
theorem abs_of_nonneg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} (h : 0 ≤ a) :
|a| = a
theorem abs_of_pos {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} (h : 0 < a) :
|a| = a
theorem abs_of_nonpos {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} (h : a ≤ 0) :
|a| = -a
theorem abs_of_neg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} (h : a < 0) :
|a| = -a
theorem abs_le_abs_of_nonneg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} {b : α} (ha : 0 ≤ a) (hab : a ≤ b) :
|a| ≤ |b|
@[simp]
theorem abs_zero {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] :
|0| = 0
@[simp]
theorem abs_pos {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} :
0 < |a| ↔ a ≠ 0
theorem abs_pos_of_pos {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} (h : 0 < a) :
0 < |a|
theorem abs_pos_of_neg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} (h : a < 0) :
0 < |a|
theorem neg_abs_le_self {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) :
-|a| ≤ a
theorem add_abs_nonneg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) :
0 ≤ a + |a|
theorem neg_abs_le_neg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) :
-|a| ≤ -a
@[simp]
theorem abs_nonneg {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) :
0 ≤ |a|
@[simp]
theorem abs_abs {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) :
|(|a|)| = |a|
@[simp]
theorem abs_eq_zero {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} :
|a| = 0 ↔ a = 0
@[simp]
theorem abs_nonpos_iff {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} :
|a| ≤ 0 ↔ a = 0
theorem abs_le_abs_of_nonpos {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} {b : α} [CovariantClass α α (Function.swap fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (ha : a ≤ 0) (hab : b ≤ a) :
|a| ≤ |b|
theorem abs_lt {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} {b : α} [CovariantClass α α (Function.swap fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] :
|a| < b ↔ -b < a ∧ a < b
theorem neg_lt_of_abs_lt {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} {b : α} [CovariantClass α α (Function.swap fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (h : |a| < b) :
-b < a
theorem lt_of_abs_lt {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] {a : α} {b : α} [CovariantClass α α (Function.swap fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (h : |a| < b) :
a < b
theorem max_sub_min_eq_abs' {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] [CovariantClass α α (Function.swap fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) (b : α) :
max a b - min a b = |a - b|
theorem max_sub_min_eq_abs {α : Type u_1} [AddGroup α] [LinearOrder α] [CovariantClass α α (fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] [CovariantClass α α (Function.swap fun (x x_1 : α) => x + x_1) fun (x x_1 : α) => x ≤ x_1] (a : α) (b : α) :
max a b - min a b = |b - a|
theorem abs_le {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} :
|a| ≤ b ↔ -b ≤ a ∧ a ≤ b
theorem le_abs' {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} :
a ≤ |b| ↔ b ≤ -a ∨ a ≤ b
theorem neg_le_of_abs_le {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} (h : |a| ≤ b) :
-b ≤ a
theorem le_of_abs_le {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} (h : |a| ≤ b) :
a ≤ b
theorem apply_abs_le_add_of_nonneg' {α : Type u_1} [LinearOrderedAddCommGroup α] {β : Type u_2} [AddZeroClass β] [Preorder β] [CovariantClass β β (fun (x x_1 : β) => x + x_1) fun (x x_1 : β) => x ≤ x_1] [CovariantClass β β (Function.swap fun (x x_1 : β) => x + x_1) fun (x x_1 : β) => x ≤ x_1] {f : α → β} {a : α} (h₁ : 0 ≤ f a) (h₂ : 0 ≤ f (-a)) :
f |a| ≤ f a + f (-a)
theorem apply_abs_le_mul_of_one_le' {α : Type u_1} [LinearOrderedAddCommGroup α] {β : Type u_2} [MulOneClass β] [Preorder β] [CovariantClass β β (fun (x x_1 : β) => x * x_1) fun (x x_1 : β) => x ≤ x_1] [CovariantClass β β (Function.swap fun (x x_1 : β) => x * x_1) fun (x x_1 : β) => x ≤ x_1] {f : α → β} {a : α} (h₁ : 1 ≤ f a) (h₂ : 1 ≤ f (-a)) :
f |a| ≤ f a * f (-a)
theorem apply_abs_le_add_of_nonneg {α : Type u_1} [LinearOrderedAddCommGroup α] {β : Type u_2} [AddZeroClass β] [Preorder β] [CovariantClass β β (fun (x x_1 : β) => x + x_1) fun (x x_1 : β) => x ≤ x_1] [CovariantClass β β (Function.swap fun (x x_1 : β) => x + x_1) fun (x x_1 : β) => x ≤ x_1] {f : α → β} (h : ∀ (x : α), 0 ≤ f x) (a : α) :
f |a| ≤ f a + f (-a)
theorem apply_abs_le_mul_of_one_le {α : Type u_1} [LinearOrderedAddCommGroup α] {β : Type u_2} [MulOneClass β] [Preorder β] [CovariantClass β β (fun (x x_1 : β) => x * x_1) fun (x x_1 : β) => x ≤ x_1] [CovariantClass β β (Function.swap fun (x x_1 : β) => x * x_1) fun (x x_1 : β) => x ≤ x_1] {f : α → β} (h : ∀ (x : α), 1 ≤ f x) (a : α) :
f |a| ≤ f a * f (-a)
theorem abs_add {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) :
|a + b| ≤ |a| + |b|

The triangle inequality in LinearOrderedAddCommGroups.

theorem abs_add' {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) :
|a| ≤ |b| + |b + a|
theorem abs_sub {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) :
|a - b| ≤ |a| + |b|
theorem abs_sub_le_iff {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} :
|a - b| ≤ c ↔ a - b ≤ c ∧ b - a ≤ c
theorem abs_sub_lt_iff {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} :
|a - b| < c ↔ a - b < c ∧ b - a < c
theorem sub_le_of_abs_sub_le_left {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} (h : |a - b| ≤ c) :
b - c ≤ a
theorem sub_le_of_abs_sub_le_right {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} (h : |a - b| ≤ c) :
a - c ≤ b
theorem sub_lt_of_abs_sub_lt_left {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} (h : |a - b| < c) :
b - c < a
theorem sub_lt_of_abs_sub_lt_right {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} (h : |a - b| < c) :
a - c < b
theorem abs_sub_abs_le_abs_sub {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) :
|a| - |b| ≤ |a - b|
theorem abs_abs_sub_abs_le_abs_sub {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) :
||a| - |b|| ≤ |a - b|
theorem abs_eq {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} (hb : 0 ≤ b) :
|a| = b ↔ a = b ∨ a = -b
theorem abs_le_max_abs_abs {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {c : α} (hab : a ≤ b) (hbc : b ≤ c) :
|b| ≤ max |a| |c|
theorem min_abs_abs_le_abs_max {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} :
min |a| |b| ≤ |max a b|
theorem min_abs_abs_le_abs_min {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} :
min |a| |b| ≤ |min a b|
theorem abs_max_le_max_abs_abs {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} :
|max a b| ≤ max |a| |b|
theorem abs_min_le_max_abs_abs {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} :
|min a b| ≤ max |a| |b|
theorem eq_of_abs_sub_eq_zero {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} (h : |a - b| = 0) :
a = b
theorem abs_sub_le {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) (c : α) :
|a - c| ≤ |a - b| + |b - c|
theorem abs_add_three {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) (b : α) (c : α) :
|a + b + c| ≤ |a| + |b| + |c|
theorem dist_bdd_within_interval {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} {lb : α} {ub : α} (hal : lb ≤ a) (hau : a ≤ ub) (hbl : lb ≤ b) (hbu : b ≤ ub) :
|a - b| ≤ ub - lb
theorem eq_of_abs_sub_nonpos {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} {b : α} (h : |a - b| ≤ 0) :
a = b
@[simp]
theorem abs_eq_self {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} :
|a| = a ↔ 0 ≤ a
@[simp]
theorem abs_eq_neg_self {α : Type u_1} [LinearOrderedAddCommGroup α] {a : α} :
|a| = -a ↔ a ≤ 0
theorem abs_cases {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) :
|a| = a ∧ 0 ≤ a ∨ |a| = -a ∧ a < 0

For an element a of a linear ordered ring, either abs a = a and 0 ≤ a, or abs a = -a and a < 0. Use cases on this lemma to automate linarith in inequalities

@[simp]
theorem max_zero_add_max_neg_zero_eq_abs_self {α : Type u_1} [LinearOrderedAddCommGroup α] (a : α) :
max a 0 + max (-a) 0 = |a|