Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2020 Robert Y. Lewis. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Robert Y. Lewis
Ported by: Scott Morrison
-/
import Std.Tactic.Simpa
import Std.Tactic.Lint.Basic
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Order.Monoid.Lemmas
import Mathlib.Init.Data.Int.Order
import Mathlib.Algebra.Order.ZeroLEOne
import Mathlib.Algebra.GroupPower.Order

/-!
# Lemmas for `linarith`.

Those in the `Linarith` namespace should stay here.

Those outside the `Linarith` namespace may be deleted as they are ported to mathlib4.
-/

namespace Linarith

theorem 
lt_irrefl: ∀ {α : Type u} [inst : Preorder α] {a : α}, ¬a < a
lt_irrefl
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
Preorder: Type ?u.4 → Type ?u.4
Preorder
α: Type u
α
] {
a: α
a
:
α: Type u
α
} : ¬
a: α
a
<
a: α
a
:=
_root_.lt_irrefl: ∀ {α : Type ?u.29} [inst : Preorder α] (a : α), ¬a < a
_root_.lt_irrefl
a: α
a
theorem
eq_of_eq_of_eq: ∀ {α : Type u_1} [inst : OrderedSemiring α] {a b : α}, a = 0b = 0a + b = 0
eq_of_eq_of_eq
{
α: Type u_1
α
} [
OrderedSemiring: Type ?u.43 → Type ?u.43
OrderedSemiring
α: ?m.40
α
] {
a: α
a
b: α
b
:
α: ?m.40
α
} (
ha: a = 0
ha
:
a: α
a
=
0: ?m.52
0
) (
hb: b = 0
hb
:
b: α
b
=
0: ?m.242
0
) :
a: α
a
+
b: α
b
=
0: ?m.265
0
:=

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedSemiring α

a, b: α

ha: a = 0

hb: b = 0


a + b = 0

Goals accomplished! 🐙
theorem
le_of_eq_of_le: ∀ {α : Type u_1} [inst : OrderedSemiring α] {a b : α}, a = 0b 0a + b 0
le_of_eq_of_le
{
α: Type u_1
α
} [
OrderedSemiring: Type ?u.816 → Type ?u.816
OrderedSemiring
α: ?m.813
α
] {
a: α
a
b: α
b
:
α: ?m.813
α
} (
ha: a = 0
ha
:
a: α
a
=
0: ?m.825
0
) (
hb: b 0
hb
:
b: α
b
0: ?m.1015
0
) :
a: α
a
+
b: α
b
0: ?m.1123
0
:=

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedSemiring α

a, b: α

ha: a = 0

hb: b 0


a + b 0

Goals accomplished! 🐙
theorem
lt_of_eq_of_lt: ∀ {α : Type u_1} [inst : OrderedSemiring α] {a b : α}, a = 0b < 0a + b < 0
lt_of_eq_of_lt
{
α: Type u_1
α
} [
OrderedSemiring: Type ?u.1901 → Type ?u.1901
OrderedSemiring
α: ?m.1898
α
] {
a: α
a
b: α
b
:
α: ?m.1898
α
} (
ha: a = 0
ha
:
a: α
a
=
0: ?m.1910
0
) (
hb: b < 0
hb
:
b: α
b
<
0: ?m.2100
0
) :
a: α
a
+
b: α
b
<
0: ?m.2208
0
:=

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedSemiring α

a, b: α

ha: a = 0

hb: b < 0


a + b < 0

Goals accomplished! 🐙
theorem
le_of_le_of_eq: ∀ {α : Type u_1} [inst : OrderedSemiring α] {a b : α}, a 0b = 0a + b 0
le_of_le_of_eq
{
α: ?m.2948
α
} [
OrderedSemiring: Type ?u.2951 → Type ?u.2951
OrderedSemiring
α: ?m.2948
α
] {
a: α
a
b: α
b
:
α: ?m.2948
α
} (
ha: a 0
ha
:
a: α
a
0: ?m.2960
0
) (
hb: b = 0
hb
:
b: α
b
=
0: ?m.3235
0
) :
a: α
a
+
b: α
b
0: ?m.3258
0
:=

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedSemiring α

a, b: α

ha: a 0

hb: b = 0


a + b 0

Goals accomplished! 🐙
theorem
lt_of_lt_of_eq: ∀ {α : Type u_1} [inst : OrderedSemiring α] {a b : α}, a < 0b = 0a + b < 0
lt_of_lt_of_eq
{
α: ?m.4029
α
} [
OrderedSemiring: Type ?u.4032 → Type ?u.4032
OrderedSemiring
α: ?m.4029
α
] {
a: α
a
b: α
b
:
α: ?m.4029
α
} (
ha: a < 0
ha
:
a: α
a
<
0: ?m.4041
0
) (
hb: b = 0
hb
:
b: α
b
=
0: ?m.4316
0
) :
a: α
a
+
b: α
b
<
0: ?m.4339
0
:=

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedSemiring α

a, b: α

ha: a < 0

hb: b = 0


a + b < 0

Goals accomplished! 🐙
theorem
mul_neg: ∀ {α : Type u_1} [inst : StrictOrderedRing α] {a b : α}, a < 00 < bb * a < 0
mul_neg
{
α: ?m.5075
α
} [
StrictOrderedRing: Type ?u.5078 → Type ?u.5078
StrictOrderedRing
α: ?m.5075
α
] {
a: α
a
b: α
b
:
α: ?m.5075
α
} (
ha: a < 0
ha
:
a: α
a
<
0: ?m.5087
0
) (
hb: 0 < b
hb
:
0: ?m.5297
0
<
b: α
b
) :
b: α
b
*
a: α
a
<
0: ?m.5326
0
:= have : (-
b: α
b
)*
a: α
a
>
0: ?m.5450
0
:=
mul_pos_of_neg_of_neg: ∀ {α : Type ?u.5763} [inst : StrictOrderedRing α] {a b : α}, a < 0b < 00 < a * b
mul_pos_of_neg_of_neg
(
neg_neg_of_pos: ∀ {α : Type ?u.5805} [inst : OrderedAddCommGroup α] {a : α}, 0 < a-a < 0
neg_neg_of_pos
hb: 0 < b
hb
)
ha: a < 0
ha
neg_of_neg_pos: ∀ {α : Type ?u.5848} [inst : AddGroup α] [inst_1 : LT α] [inst_2 : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x < x_1] {a : α}, 0 < -aa < 0
neg_of_neg_pos
(

Goals accomplished! 🐙
α: Type u_1

inst✝: StrictOrderedRing α

a, b: α

ha: a < 0

hb: 0 < b

this: -b * a > 0


0 < -(b * a)

Goals accomplished! 🐙
) theorem
mul_nonpos: ∀ {α : Type u_1} [inst : OrderedRing α] {a b : α}, a 00 < bb * a 0
mul_nonpos
{
α: Type u_1
α
} [
OrderedRing: Type ?u.7170 → Type ?u.7170
OrderedRing
α: ?m.7167
α
] {
a: α
a
b: α
b
:
α: ?m.7167
α
} (
ha: a 0
ha
:
a: α
a
0: ?m.7179
0
) (
hb: 0 < b
hb
:
0: ?m.7450
0
<
b: α
b
) :
b: α
b
*
a: α
a
0: ?m.7545
0
:= have : (-
b: α
b
)*
a: α
a
0: ?m.7697
0
:=
mul_nonneg_of_nonpos_of_nonpos: ∀ {α : Type ?u.8113} [inst : OrderedRing α] {a b : α}, a 0b 00 a * b
mul_nonneg_of_nonpos_of_nonpos
(
le_of_lt: ∀ {α : Type ?u.8155} [inst : Preorder α] {a b : α}, a < ba b
le_of_lt
(
neg_neg_of_pos: ∀ {α : Type ?u.8241} [inst : OrderedAddCommGroup α] {a : α}, 0 < a-a < 0
neg_neg_of_pos
hb: 0 < b
hb
))
ha: a 0
ha

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedRing α

a, b: α

ha: a 0

hb: 0 < b

this: -b * a 0


b * a 0

Goals accomplished! 🐙
-- used alongside `mul_neg` and `mul_nonpos`, so has the same argument pattern for uniformity @[nolint
unusedArguments: Std.Tactic.Lint.Linter
unusedArguments
] theorem
mul_eq: ∀ {α : Type u_1} [inst : OrderedSemiring α] {a b : α}, a = 00 < bb * a = 0
mul_eq
{
α: ?m.9532
α
} [
OrderedSemiring: Type ?u.9535 → Type ?u.9535
OrderedSemiring
α: ?m.9532
α
] {
a: α
a
b: α
b
:
α: ?m.9532
α
} (
ha: a = 0
ha
:
a: α
a
=
0: ?m.9544
0
) (
_: 0 < b
_
:
0: ?m.9734
0
<
b: α
b
) :
b: α
b
*
a: α
a
=
0: ?m.9847
0
:=

Goals accomplished! 🐙
α: Type u_1

inst✝: OrderedSemiring α

a, b: α

ha: a = 0

x✝: 0 < b


b * a = 0

Goals accomplished! 🐙
lemma
eq_of_not_lt_of_not_gt: ∀ {α : Type u_1} [inst : LinearOrder α] (a b : α), ¬a < b¬b < aa = b
eq_of_not_lt_of_not_gt
{
α: ?m.10391
α
} [
LinearOrder: Type ?u.10394 → Type ?u.10394
LinearOrder
α: ?m.10391
α
] (
a: α
a
b: α
b
:
α: ?m.10391
α
) (
h1: ¬a < b
h1
: ¬
a: α
a
<
b: α
b
) (
h2: ¬b < a
h2
: ¬
b: α
b
<
a: α
a
) :
a: α
a
=
b: α
b
:=
le_antisymm: ∀ {α : Type ?u.10755} [inst : PartialOrder α] {a b : α}, a bb aa = b
le_antisymm
(
le_of_not_gt: ∀ {α : Type ?u.10795} [inst : LinearOrder α] {a b : α}, ¬a > ba b
le_of_not_gt
h2: ¬b < a
h2
) (
le_of_not_gt: ∀ {α : Type ?u.11166} [inst : LinearOrder α] {a b : α}, ¬a > ba b
le_of_not_gt
h1: ¬a < b
h1
) -- used in the `nlinarith` normalization steps. The `_` argument is for uniformity. @[nolint
unusedArguments: Std.Tactic.Lint.Linter
unusedArguments
] lemma
mul_zero_eq: ∀ {α : Type u_1} {R : ααProp} [inst : Semiring α] {a b : α}, R a 0b = 0a * b = 0
mul_zero_eq
{
α: Type u_1
α
} {
R: ααProp
R
:
α: ?m.11199
α
α: ?m.11199
α
Prop: Type
Prop
} [
Semiring: Type ?u.11208 → Type ?u.11208
Semiring
α: ?m.11199
α
] {
a: α
a
b: α
b
:
α: ?m.11199
α
} (
_: R a 0
_
:
R: ααProp
R
a: α
a
0: ?m.11216
0
) (
h: b = 0
h
:
b: α
b
=
0: ?m.11351
0
) :
a: α
a
*
b: α
b
=
0: ?m.11374
0
:=

Goals accomplished! 🐙
α: Type u_1

R: ααProp

inst✝: Semiring α

a, b: α

x✝: R a 0

h: b = 0


a * b = 0

Goals accomplished! 🐙
-- used in the `nlinarith` normalization steps. The `_` argument is for uniformity. @[nolint
unusedArguments: Std.Tactic.Lint.Linter
unusedArguments
] lemma
zero_mul_eq: ∀ {α : Type u_1} {R : ααProp} [inst : Semiring α] {a b : α}, a = 0R b 0a * b = 0
zero_mul_eq
{
α: Type u_1
α
} {
R: ααProp
R
:
α: ?m.11815
α
α: ?m.11815
α
Prop: Type
Prop
} [
Semiring: Type ?u.11824 → Type ?u.11824
Semiring
α: ?m.11815
α
] {
a: α
a
b: α
b
:
α: ?m.11815
α
} (
h: a = 0
h
:
a: α
a
=
0: ?m.11833
0
) (
_: R b 0
_
:
R: ααProp
R
b: α
b
0: ?m.11981
0
) :
a: α
a
*
b: α
b
=
0: ?m.11990
0
:=

Goals accomplished! 🐙
α: Type u_1

R: ααProp

inst✝: Semiring α

a, b: α

h: a = 0

x✝: R b 0


a * b = 0

Goals accomplished! 🐙
end Linarith section open Function -- These lemmas can be removed when their originals are ported. theorem
lt_zero_of_zero_gt: ∀ {α : Type u_1} [inst : Zero α] [inst_1 : LT α] {a : α}, 0 > aa < 0
lt_zero_of_zero_gt
[
Zero: Type ?u.12440 → Type ?u.12440
Zero
α: ?m.12437
α
] [
LT: Type ?u.12443 → Type ?u.12443
LT
α: ?m.12437
α
] {
a: α
a
:
α: ?m.12437
α
} (
h: 0 > a
h
:
0: ?m.12450
0
>
a: α
a
) :
a: α
a
<
0: ?m.12503
0
:=
h: 0 > a
h
theorem
le_zero_of_zero_ge: ∀ {α : Type u_1} [inst : Zero α] [inst_1 : LE α] {a : α}, 0 aa 0
le_zero_of_zero_ge
[
Zero: Type ?u.12542 → Type ?u.12542
Zero
α: ?m.12539
α
] [
LE: Type ?u.12545 → Type ?u.12545
LE
α: ?m.12539
α
] {
a: α
a
:
α: ?m.12539
α
} (
h: 0 a
h
:
0: ?m.12552
0
a: α
a
) :
a: α
a
0: ?m.12605
0
:=
h: 0 a
h