Library Stdlib.Numbers.NatInt.NZOrder
Lemmas about orders for modules implementing NZOrdSig'
This file defines the
NZOrderProp functor type, meant to be
Included in
a module implementing the
NZOrdSig' module type.
It contains lemmas and tactics about
le,
lt and
eq.
The firt part contains important basic lemmas about
le and
lt, for instance
- succ_lt_mono, succ_le_mono, lt_succ_diag_r, le_succ_diag_r, ...
- le_refl, le_antisymm, lt_asymm, le_trans, lt_trans, ...
- decidability lemmas like le_gt_cases, eq_decidable, ...
It also adds the following tactics:
- le_elim H to reason by cases on an hypothesis (H) : n <= m
- the domain-agnostic order (see Stdlib.Structures.OrdersTac) and order'
which knows that 0 < 1 < 2
The second part proves many induction principles involving the orders and
defines the tactic notation
nzord_induct.
Basic facts about le, lt, eq and succ
Direct consequences of the specifications of lt and le
Trichotomy
Asymmetry and transitivity.
Some type classes about order
Making the generic order tactic
Some direct consequences of order
Theorem lt_neq :
forall n m,
n < m -> n ~= m.
Theorem le_neq :
forall n m,
n < m <-> n <= m /\ n ~= m.
Theorem eq_le_incl :
forall n m,
n == m -> n <= m.
Lemma lt_stepl :
forall x y z,
x < y -> x == z -> z < y.
Lemma lt_stepr :
forall x y z,
x < y -> y == z -> x < z.
Lemma le_stepl :
forall x y z,
x <= y -> x == z -> z <= y.
Lemma le_stepr :
forall x y z,
x <= y -> y == z -> x <= z.
Declare Left Step lt_stepl.
Declare Right Step lt_stepr.
Declare Left Step le_stepl.
Declare Right Step le_stepr.
Theorem le_lt_trans :
forall n m p,
n <= m -> m < p -> n < p.
Theorem lt_le_trans :
forall n m p,
n < m -> m <= p -> n < p.
Theorem le_antisymm :
forall n m,
n <= m -> m <= n -> n == m.
More properties of < and <= with respect to S and 0
The order tactic enriched with some knowledge of 0,1,2
More Trichotomy, decidability and double negation elimination
The following theorem is cleary redundant, but helps not to
remember whether one has to say
le_gt_cases or
lt_ge_cases.
Decidability of equality, even though true in each finite ring, does not
have a uniform proof. Otherwise, the proof for two fixed numbers would
reduce to a normal form that will say if the numbers are equal or not,
which cannot be true in all finite rings. Therefore, we prove decidability
in the presence of order.
DNE stands for double-negation elimination.
Redundant but useful
Redundant but useful
The difference between integers and natural numbers is that for
every integer there is a predecessor, which is not true for natural
numbers. However, for both classes, every number that is bigger than
some other number has a predecessor. The proof of this fact by regular
induction does not go through, so we need to use strong
(course-of-value) induction.
Order-based induction principles
Stronger variant of induction with assumptions n >= 0 (n < 0)
in the induction step
Section Induction.
Variable A :
t -> Prop.
Hypothesis A_wd :
Proper (
eq==>iff)
A.
Section Center.
Variable z :
t.
Section RightInduction.
Let A' (
n :
t) :=
forall m,
z <= m -> m < n -> A m.
Let right_step :=
forall n,
z <= n -> A n -> A (
S n).
Let right_step' :=
forall n,
z <= n -> A' n -> A n.
Let right_step'' :=
forall n,
A' n <-> A' (
S n).
Theorem strong_right_induction:
right_step' -> forall n,
z <= n -> A n.
Theorem right_induction :
A z -> right_step -> forall n,
z <= n -> A n.
Theorem right_induction' :
(forall n,
n <= z -> A n) -> right_step -> forall n,
A n.
Theorem strong_right_induction' :
(forall n,
n <= z -> A n) -> right_step' -> forall n,
A n.
End RightInduction.
Section LeftInduction.
Let A' (
n :
t) :=
forall m,
m <= z -> n <= m -> A m.
Let left_step :=
forall n,
n < z -> A (
S n)
-> A n.
Let left_step' :=
forall n,
n <= z -> A' (
S n)
-> A n.
Let left_step'' :=
forall n,
A' n <-> A' (
S n).
Theorem strong_left_induction:
left_step' -> forall n,
n <= z -> A n.
Theorem left_induction :
A z -> left_step -> forall n,
n <= z -> A n.
Theorem left_induction' :
(forall n,
z <= n -> A n) -> left_step -> forall n,
A n.
Theorem strong_left_induction' :
(forall n,
z <= n -> A n) -> left_step' -> forall n,
A n.
End LeftInduction.
Theorem order_induction :
A z ->
(forall n,
z <= n -> A n -> A (
S n)
) ->
(forall n,
n < z -> A (
S n)
-> A n) ->
forall n,
A n.
Theorem order_induction' :
A z ->
(forall n,
z <= n -> A n -> A (
S n)
) ->
(forall n,
n <= z -> A n -> A (
P n)
) ->
forall n,
A n.
End Center.
Theorem order_induction_0 :
A 0
->
(forall n, 0
<= n -> A n -> A (
S n)
) ->
(forall n,
n < 0
-> A (
S n)
-> A n) ->
forall n,
A n.
Theorem order_induction'_0 :
A 0
->
(forall n, 0
<= n -> A n -> A (
S n)
) ->
(forall n,
n <= 0
-> A n -> A (
P n)
) ->
forall n,
A n.
Elimination principle for <
Elimination principle for <=
Induction principles with respect to a measure