Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(*                      Evgeny Makarov, INRIA, 2007                     *)
(************************************************************************)

Require Export ZLt.

Module ZAddOrderProp (Import Z : ZAxiomsMiniSig').
Include ZOrderProp Z.
Theorems that are either not valid on N or have different proofs on N and Z

forall n m : t, n < 0 -> m < 0 -> n + m < 0

forall n m : t, n < 0 -> m < 0 -> n + m < 0
n, m:t
H:n < 0
H0:m < 0

n + m < 0
n, m:t
H:n < 0
H0:m < 0

n + m < 0 + 0
now apply add_lt_mono. Qed.

forall n m : t, n < 0 -> m <= 0 -> n + m < 0

forall n m : t, n < 0 -> m <= 0 -> n + m < 0
n, m:t
H:n < 0
H0:m <= 0

n + m < 0
n, m:t
H:n < 0
H0:m <= 0

n + m < 0 + 0
now apply add_lt_le_mono. Qed.

forall n m : t, n <= 0 -> m < 0 -> n + m < 0

forall n m : t, n <= 0 -> m < 0 -> n + m < 0
n, m:t
H:n <= 0
H0:m < 0

n + m < 0
n, m:t
H:n <= 0
H0:m < 0

n + m < 0 + 0
now apply add_le_lt_mono. Qed.

forall n m : t, n <= 0 -> m <= 0 -> n + m <= 0

forall n m : t, n <= 0 -> m <= 0 -> n + m <= 0
n, m:t
H:n <= 0
H0:m <= 0

n + m <= 0
n, m:t
H:n <= 0
H0:m <= 0

n + m <= 0 + 0
now apply add_le_mono. Qed.
Sub and order

forall n m : t, 0 < m - n <-> n < m

forall n m : t, 0 < m - n <-> n < m
n, m:t

0 < m - n <-> n < m
now rewrite (add_lt_mono_r _ _ n), add_0_l, sub_simpl_r. Qed. Notation sub_pos := lt_0_sub (only parsing).

forall n m : t, 0 <= m - n <-> n <= m

forall n m : t, 0 <= m - n <-> n <= m
n, m:t

0 <= m - n <-> n <= m
now rewrite (add_le_mono_r _ _ n), add_0_l, sub_simpl_r. Qed. Notation sub_nonneg := le_0_sub (only parsing).

forall n m : t, n - m < 0 <-> n < m

forall n m : t, n - m < 0 <-> n < m
n, m:t

n - m < 0 <-> n < m
now rewrite (add_lt_mono_r _ _ m), add_0_l, sub_simpl_r. Qed. Notation sub_neg := lt_sub_0 (only parsing).

forall n m : t, n - m <= 0 <-> n <= m

forall n m : t, n - m <= 0 <-> n <= m
n, m:t

n - m <= 0 <-> n <= m
now rewrite (add_le_mono_r _ _ m), add_0_l, sub_simpl_r. Qed. Notation sub_nonpos := le_sub_0 (only parsing).

forall n m : t, n < m <-> - m < - n

forall n m : t, n < m <-> - m < - n
n, m:t

n < m <-> - m < - n
now rewrite <- lt_0_sub, <- add_opp_l, <- sub_opp_r, lt_0_sub. Qed.

forall n m : t, n <= m <-> - m <= - n

forall n m : t, n <= m <-> - m <= - n
n, m:t

n <= m <-> - m <= - n
now rewrite <- le_0_sub, <- add_opp_l, <- sub_opp_r, le_0_sub. Qed.

forall n : t, 0 < - n <-> n < 0

forall n : t, 0 < - n <-> n < 0
intro n; now rewrite (opp_lt_mono n 0), opp_0. Qed.

forall n : t, - n < 0 <-> 0 < n

forall n : t, - n < 0 <-> 0 < n
n:t

- n < 0 <-> 0 < n
now rewrite (opp_lt_mono 0 n), opp_0. Qed.

forall n : t, 0 <= - n <-> n <= 0

forall n : t, 0 <= - n <-> n <= 0
intro n; now rewrite (opp_le_mono n 0), opp_0. Qed.

forall n : t, - n <= 0 <-> 0 <= n

forall n : t, - n <= 0 <-> 0 <= n
n:t

- n <= 0 <-> 0 <= n
now rewrite (opp_le_mono 0 n), opp_0. Qed.

-1 < 0

-1 < 0
apply opp_neg_pos, lt_0_1. Qed.

forall n m p : t, n < m <-> p - m < p - n

forall n m p : t, n < m <-> p - m < p - n
n, m, p:t

n < m <-> p - m < p - n
now rewrite <- 2 add_opp_r, <- add_lt_mono_l, opp_lt_mono. Qed.

forall n m p : t, n < m <-> n - p < m - p

forall n m p : t, n < m <-> n - p < m - p
n, m, p:t

n < m <-> n - p < m - p
now rewrite <- 2 add_opp_r, add_lt_mono_r. Qed.

forall n m p q : t, n < m -> q < p -> n - p < m - q

forall n m p q : t, n < m -> q < p -> n - p < m - q
n, m, p, q:t
H1:n < m
H2:q < p

n - p < m - q
apply lt_trans with (m - p); [now apply sub_lt_mono_r | now apply sub_lt_mono_l]. Qed.

forall n m p : t, n <= m <-> p - m <= p - n

forall n m p : t, n <= m <-> p - m <= p - n
n, m, p:t

n <= m <-> p - m <= p - n
now rewrite <- 2 add_opp_r, <- add_le_mono_l, opp_le_mono. Qed.

forall n m p : t, n <= m <-> n - p <= m - p

forall n m p : t, n <= m <-> n - p <= m - p
n, m, p:t

n <= m <-> n - p <= m - p
now rewrite <- 2 add_opp_r, add_le_mono_r. Qed.

forall n m p q : t, n <= m -> q <= p -> n - p <= m - q

forall n m p q : t, n <= m -> q <= p -> n - p <= m - q
n, m, p, q:t
H1:n <= m
H2:q <= p

n - p <= m - q
apply le_trans with (m - p); [now apply sub_le_mono_r | now apply sub_le_mono_l]. Qed.

forall n m p q : t, n < m -> q <= p -> n - p < m - q

forall n m p q : t, n < m -> q <= p -> n - p < m - q
n, m, p, q:t
H1:n < m
H2:q <= p

n - p < m - q
apply lt_le_trans with (m - p); [now apply sub_lt_mono_r | now apply sub_le_mono_l]. Qed.

forall n m p q : t, n <= m -> q < p -> n - p < m - q

forall n m p q : t, n <= m -> q < p -> n - p < m - q
n, m, p, q:t
H1:n <= m
H2:q < p

n - p < m - q
apply le_lt_trans with (m - p); [now apply sub_le_mono_r | now apply sub_lt_mono_l]. Qed.

forall n m p q : t, n <= m -> p - n < q - m -> p < q

forall n m p q : t, n <= m -> p - n < q - m -> p < q
n, m, p, q:t
H1:n <= m
H2:p - n < q - m

p < q
apply (le_lt_add_lt (- m) (- n)); [now apply -> opp_le_mono | now rewrite 2 add_opp_r]. Qed.

forall n m p q : t, n < m -> p - n <= q - m -> p < q

forall n m p q : t, n < m -> p - n <= q - m -> p < q
n, m, p, q:t
H1:n < m
H2:p - n <= q - m

p < q
apply (lt_le_add_lt (- m) (- n)); [now apply -> opp_lt_mono | now rewrite 2 add_opp_r]. Qed.

forall n m p q : t, n <= m -> p - n <= q - m -> p <= q

forall n m p q : t, n <= m -> p - n <= q - m -> p <= q
n, m, p, q:t
H1:n <= m
H2:p - n <= q - m

p <= q
apply (le_le_add_le (- m) (- n)); [now apply -> opp_le_mono | now rewrite 2 add_opp_r]. Qed.

forall n m p : t, n + p < m <-> n < m - p

forall n m p : t, n + p < m <-> n < m - p
n, m, p:t

n + p < m <-> n < m - p
now rewrite (sub_lt_mono_r _ _ p), add_simpl_r. Qed.

forall n m p : t, n + p <= m <-> n <= m - p

forall n m p : t, n + p <= m <-> n <= m - p
n, m, p:t

n + p <= m <-> n <= m - p
now rewrite (sub_le_mono_r _ _ p), add_simpl_r. Qed.

forall n m p : t, n + p < m <-> p < m - n

forall n m p : t, n + p < m <-> p < m - n
n, m, p:t

n + p < m <-> p < m - n
rewrite add_comm; apply lt_add_lt_sub_r. Qed.

forall n m p : t, n + p <= m <-> p <= m - n

forall n m p : t, n + p <= m <-> p <= m - n
n, m, p:t

n + p <= m <-> p <= m - n
rewrite add_comm; apply le_add_le_sub_r. Qed.

forall n m p : t, n - p < m <-> n < m + p

forall n m p : t, n - p < m <-> n < m + p
n, m, p:t

n - p < m <-> n < m + p
now rewrite (add_lt_mono_r _ _ p), sub_simpl_r. Qed.

forall n m p : t, n - p <= m <-> n <= m + p

forall n m p : t, n - p <= m <-> n <= m + p
n, m, p:t

n - p <= m <-> n <= m + p
now rewrite (add_le_mono_r _ _ p), sub_simpl_r. Qed.

forall n m p : t, n - m < p <-> n < m + p

forall n m p : t, n - m < p <-> n < m + p
n, m, p:t

n - m < p <-> n < m + p
rewrite add_comm; apply lt_sub_lt_add_r. Qed.

forall n m p : t, n - m <= p <-> n <= m + p

forall n m p : t, n - m <= p <-> n <= m + p
n, m, p:t

n - m <= p <-> n <= m + p
rewrite add_comm; apply le_sub_le_add_r. Qed.

forall n m p q : t, n - m < p - q <-> n + q < m + p

forall n m p q : t, n - m < p - q <-> n + q < m + p
n, m, p, q:t

n - m < p - q <-> n + q < m + p
now rewrite lt_sub_lt_add_l, add_sub_assoc, <- lt_add_lt_sub_r. Qed.

forall n m p q : t, n - m <= p - q <-> n + q <= m + p

forall n m p q : t, n - m <= p - q <-> n + q <= m + p
n, m, p, q:t

n - m <= p - q <-> n + q <= m + p
now rewrite le_sub_le_add_l, add_sub_assoc, <- le_add_le_sub_r. Qed.

forall n m : t, 0 < m <-> n - m < n

forall n m : t, 0 < m <-> n - m < n
n, m:t

0 < m <-> n - m < n
now rewrite (sub_lt_mono_l _ _ n), sub_0_r. Qed.

forall n m : t, 0 <= m <-> n - m <= n

forall n m : t, 0 <= m <-> n - m <= n
n, m:t

0 <= m <-> n - m <= n
now rewrite (sub_le_mono_l _ _ n), sub_0_r. Qed.

forall n m p q : t, n - m < p - q -> n < m \/ q < p

forall n m p q : t, n - m < p - q -> n < m \/ q < p
n, m, p, q:t
H:n - m < p - q

n < m \/ q < p
now apply add_lt_cases, lt_sub_lt_add. Qed.

forall n m p q : t, n - m <= p - q -> n <= m \/ q <= p

forall n m p q : t, n - m <= p - q -> n <= m \/ q <= p
n, m, p, q:t
H:n - m <= p - q

n <= m \/ q <= p
now apply add_le_cases, le_sub_le_add. Qed.

forall n m : t, n - m < 0 -> n < 0 \/ 0 < m

forall n m : t, n - m < 0 -> n < 0 \/ 0 < m
n, m:t
H:n - m < 0

n < 0 \/ 0 < m
n, m:t
H:n - m < 0

n < 0 \/ - m < 0
n, m:t
H:n - m < 0

n + - m < 0
now rewrite add_opp_r. Qed.

forall n m : t, 0 < n - m -> 0 < n \/ m < 0

forall n m : t, 0 < n - m -> 0 < n \/ m < 0
n, m:t
H:0 < n - m

0 < n \/ m < 0
n, m:t
H:0 < n - m

0 < n \/ 0 < - m
n, m:t
H:0 < n - m

0 < n + - m
now rewrite add_opp_r. Qed.

forall n m : t, n - m <= 0 -> n <= 0 \/ 0 <= m

forall n m : t, n - m <= 0 -> n <= 0 \/ 0 <= m
n, m:t
H:n - m <= 0

n <= 0 \/ 0 <= m
n, m:t
H:n - m <= 0

n <= 0 \/ - m <= 0
n, m:t
H:n - m <= 0

n + - m <= 0
now rewrite add_opp_r. Qed.

forall n m : t, 0 <= n - m -> 0 <= n \/ m <= 0

forall n m : t, 0 <= n - m -> 0 <= n \/ m <= 0
n, m:t
H:0 <= n - m

0 <= n \/ m <= 0
n, m:t
H:0 <= n - m

0 <= n \/ 0 <= - m
n, m:t
H:0 <= n - m

0 <= n + - m
now rewrite add_opp_r. Qed. Section PosNeg. Variable P : Z.t -> Prop. Hypothesis P_wd : Proper (eq ==> iff) P.
P:t -> Prop
P_wd:Proper (eq ==> iff) P

P 0 -> (forall n : t, 0 < n -> P n /\ P (- n)) -> forall n : t, P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P

P 0 -> (forall n : t, 0 < n -> P n /\ P (- n)) -> forall n : t, P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t

P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:n < 0

P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:n == 0
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:0 < n
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:P (- n) /\ P (- - n)

P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:n == 0
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:0 < n
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:P (- - n)

P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:n == 0
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:0 < n
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:n == 0

P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:0 < n
P n
P:t -> Prop
P_wd:Proper (eq ==> iff) P
H1:P 0
H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)
n:t
H3:0 < n

P n
apply H2 in H3; now destruct H3. Qed. End PosNeg. Ltac zero_pos_neg n := induction_maker n ltac:(apply zero_pos_neg). End ZAddOrderProp.