The natural numbers as a linearly ordered commutative semiring #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
We also have a variety of lemmas which have been deferred from data.nat.basic
because it is
easier to prove them with this ordered semiring instance available.
You may find that some theorems can be moved back to data.nat.basic
by modifying their proofs.
instances #
Equations
- nat.order_bot = {bot := 0, bot_le := nat.zero_le}
Equations
- nat.linear_ordered_comm_semiring = {add := comm_semiring.add nat.comm_semiring, add_assoc := _, zero := comm_semiring.zero nat.comm_semiring, zero_add := _, add_zero := _, nsmul := comm_semiring.nsmul nat.comm_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := comm_semiring.mul nat.comm_semiring, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := comm_semiring.one nat.comm_semiring, one_mul := _, mul_one := _, nat_cast := comm_semiring.nat_cast nat.comm_semiring, nat_cast_zero := _, nat_cast_succ := _, npow := comm_semiring.npow nat.comm_semiring, npow_zero' := _, npow_succ' := _, le := linear_order.le nat.linear_order, lt := nat.lt, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := nat.add_le_add_left, le_of_add_le_add_left := nat.le_of_add_le_add_left, exists_pair_ne := nat.linear_ordered_comm_semiring._proof_1, zero_le_one := nat.linear_ordered_comm_semiring._proof_2, mul_lt_mul_of_pos_left := nat.mul_lt_mul_of_pos_left, mul_lt_mul_of_pos_right := nat.mul_lt_mul_of_pos_right, mul_comm := _, le_total := _, decidable_le := linear_order.decidable_le nat.linear_order, decidable_eq := nat.decidable_eq, decidable_lt := linear_order.decidable_lt nat.linear_order, max := linear_order.max nat.linear_order, max_def := _, min := linear_order.min nat.linear_order, min_def := _}
Equations
- nat.linear_ordered_comm_monoid_with_zero = {le := linear_ordered_comm_semiring.le nat.linear_ordered_comm_semiring, lt := linear_ordered_comm_semiring.lt nat.linear_ordered_comm_semiring, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := linear_ordered_comm_semiring.decidable_le nat.linear_ordered_comm_semiring, decidable_eq := linear_ordered_comm_semiring.decidable_eq nat.linear_ordered_comm_semiring, decidable_lt := linear_ordered_comm_semiring.decidable_lt nat.linear_ordered_comm_semiring, max := linear_ordered_comm_semiring.max nat.linear_ordered_comm_semiring, max_def := _, min := linear_ordered_comm_semiring.min nat.linear_ordered_comm_semiring, min_def := _, mul := linear_ordered_comm_semiring.mul nat.linear_ordered_comm_semiring, mul_assoc := _, one := linear_ordered_comm_semiring.one nat.linear_ordered_comm_semiring, one_mul := _, mul_one := _, npow := linear_ordered_comm_semiring.npow nat.linear_ordered_comm_semiring, npow_zero' := _, npow_succ' := _, mul_comm := _, mul_le_mul_left := nat.linear_ordered_comm_monoid_with_zero._proof_1, zero := linear_ordered_comm_semiring.zero nat.linear_ordered_comm_semiring, zero_mul := _, mul_zero := _, zero_le_one := _}
Extra instances to short-circuit type class resolution and ensure computability
Equations
Equations
Equations
Equations
- nat.canonically_ordered_comm_semiring = {add := ordered_add_comm_monoid.add infer_instance, add_assoc := nat.canonically_ordered_comm_semiring._proof_1, zero := ordered_add_comm_monoid.zero infer_instance, zero_add := nat.canonically_ordered_comm_semiring._proof_2, add_zero := nat.canonically_ordered_comm_semiring._proof_3, nsmul := ordered_add_comm_monoid.nsmul infer_instance, nsmul_zero' := nat.canonically_ordered_comm_semiring._proof_4, nsmul_succ' := nat.canonically_ordered_comm_semiring._proof_5, add_comm := nat.canonically_ordered_comm_semiring._proof_6, le := ordered_add_comm_monoid.le infer_instance, lt := ordered_add_comm_monoid.lt infer_instance, le_refl := nat.canonically_ordered_comm_semiring._proof_7, le_trans := nat.canonically_ordered_comm_semiring._proof_8, lt_iff_le_not_le := nat.canonically_ordered_comm_semiring._proof_9, le_antisymm := nat.canonically_ordered_comm_semiring._proof_10, add_le_add_left := nat.canonically_ordered_comm_semiring._proof_11, bot := order_bot.bot nat.order_bot, bot_le := _, exists_add_of_le := nat.canonically_ordered_comm_semiring._proof_12, le_self_add := nat.le_add_right, mul := linear_ordered_semiring.mul infer_instance, left_distrib := nat.canonically_ordered_comm_semiring._proof_13, right_distrib := nat.canonically_ordered_comm_semiring._proof_14, zero_mul := nat.canonically_ordered_comm_semiring._proof_15, mul_zero := nat.canonically_ordered_comm_semiring._proof_16, mul_assoc := nat.canonically_ordered_comm_semiring._proof_17, one := linear_ordered_semiring.one infer_instance, one_mul := nat.canonically_ordered_comm_semiring._proof_18, mul_one := nat.canonically_ordered_comm_semiring._proof_19, nat_cast := linear_ordered_semiring.nat_cast infer_instance, nat_cast_zero := nat.canonically_ordered_comm_semiring._proof_20, nat_cast_succ := nat.canonically_ordered_comm_semiring._proof_21, npow := linear_ordered_semiring.npow infer_instance, npow_zero' := nat.canonically_ordered_comm_semiring._proof_22, npow_succ' := nat.canonically_ordered_comm_semiring._proof_23, mul_comm := nat.canonically_ordered_comm_semiring._proof_24, eq_zero_or_eq_zero_of_mul_eq_zero := nat.canonically_ordered_comm_semiring._proof_25}
Equations
- nat.canonically_linear_ordered_add_monoid = {add := canonically_ordered_add_monoid.add infer_instance, add_assoc := nat.canonically_linear_ordered_add_monoid._proof_1, zero := canonically_ordered_add_monoid.zero infer_instance, zero_add := nat.canonically_linear_ordered_add_monoid._proof_2, add_zero := nat.canonically_linear_ordered_add_monoid._proof_3, nsmul := canonically_ordered_add_monoid.nsmul infer_instance, nsmul_zero' := nat.canonically_linear_ordered_add_monoid._proof_4, nsmul_succ' := nat.canonically_linear_ordered_add_monoid._proof_5, add_comm := nat.canonically_linear_ordered_add_monoid._proof_6, le := canonically_ordered_add_monoid.le infer_instance, lt := canonically_ordered_add_monoid.lt infer_instance, le_refl := nat.canonically_linear_ordered_add_monoid._proof_7, le_trans := nat.canonically_linear_ordered_add_monoid._proof_8, lt_iff_le_not_le := nat.canonically_linear_ordered_add_monoid._proof_9, le_antisymm := nat.canonically_linear_ordered_add_monoid._proof_10, add_le_add_left := nat.canonically_linear_ordered_add_monoid._proof_11, bot := canonically_ordered_add_monoid.bot infer_instance, bot_le := nat.canonically_linear_ordered_add_monoid._proof_12, exists_add_of_le := nat.canonically_linear_ordered_add_monoid._proof_13, le_self_add := nat.canonically_linear_ordered_add_monoid._proof_14, le_total := _, decidable_le := linear_order.decidable_le nat.linear_order, decidable_eq := linear_order.decidable_eq nat.linear_order, decidable_lt := linear_order.decidable_lt nat.linear_order, max := linear_order.max nat.linear_order, max_def := _, min := linear_order.min nat.linear_order, min_def := _}
Equalities and inequalities involving zero and one #
succ
#
add
#
pred
#
sub
#
Most lemmas come from the has_ordered_sub
instance on ℕ
.
A version of nat.sub_succ
in the form _ - 1
instead of nat.pred _
.
mul
#
Recursion and induction principles #
This section is here due to dependencies -- the lemmas here require some of the lemmas proved above, and some of the results in later sections depend on the definitions in this section.
Given a predicate on two naturals P : ℕ → ℕ → Prop
, P a b
is true for all a < b
if
P (a + 1) (a + 1)
is true for all a
, P 0 (b + 1)
is true for all b
and for all
a < b
, P (a + 1) b
is true and P a (b + 1)
is true implies P (a + 1) (b + 1)
is true.