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 < 0forall n m : t, n < 0 -> m < 0 -> n + m < 0n, m:tH:n < 0H0:m < 0n + m < 0now apply add_lt_mono. Qed.n, m:tH:n < 0H0:m < 0n + m < 0 + 0forall n m : t, n < 0 -> m <= 0 -> n + m < 0forall n m : t, n < 0 -> m <= 0 -> n + m < 0n, m:tH:n < 0H0:m <= 0n + m < 0now apply add_lt_le_mono. Qed.n, m:tH:n < 0H0:m <= 0n + m < 0 + 0forall n m : t, n <= 0 -> m < 0 -> n + m < 0forall n m : t, n <= 0 -> m < 0 -> n + m < 0n, m:tH:n <= 0H0:m < 0n + m < 0now apply add_le_lt_mono. Qed.n, m:tH:n <= 0H0:m < 0n + m < 0 + 0forall n m : t, n <= 0 -> m <= 0 -> n + m <= 0forall n m : t, n <= 0 -> m <= 0 -> n + m <= 0n, m:tH:n <= 0H0:m <= 0n + m <= 0now apply add_le_mono. Qed.n, m:tH:n <= 0H0:m <= 0n + m <= 0 + 0
Sub and order
forall n m : t, 0 < m - n <-> n < mforall n m : t, 0 < m - n <-> n < mnow rewrite (add_lt_mono_r _ _ n), add_0_l, sub_simpl_r. Qed. Notation sub_pos := lt_0_sub (only parsing).n, m:t0 < m - n <-> n < mforall n m : t, 0 <= m - n <-> n <= mforall n m : t, 0 <= m - n <-> n <= mnow rewrite (add_le_mono_r _ _ n), add_0_l, sub_simpl_r. Qed. Notation sub_nonneg := le_0_sub (only parsing).n, m:t0 <= m - n <-> n <= mforall n m : t, n - m < 0 <-> n < mforall n m : t, n - m < 0 <-> n < mnow rewrite (add_lt_mono_r _ _ m), add_0_l, sub_simpl_r. Qed. Notation sub_neg := lt_sub_0 (only parsing).n, m:tn - m < 0 <-> n < mforall n m : t, n - m <= 0 <-> n <= mforall n m : t, n - m <= 0 <-> n <= mnow rewrite (add_le_mono_r _ _ m), add_0_l, sub_simpl_r. Qed. Notation sub_nonpos := le_sub_0 (only parsing).n, m:tn - m <= 0 <-> n <= mforall n m : t, n < m <-> - m < - nforall n m : t, n < m <-> - m < - nnow rewrite <- lt_0_sub, <- add_opp_l, <- sub_opp_r, lt_0_sub. Qed.n, m:tn < m <-> - m < - nforall n m : t, n <= m <-> - m <= - nforall n m : t, n <= m <-> - m <= - nnow rewrite <- le_0_sub, <- add_opp_l, <- sub_opp_r, le_0_sub. Qed.n, m:tn <= m <-> - m <= - nforall n : t, 0 < - n <-> n < 0intro n; now rewrite (opp_lt_mono n 0), opp_0. Qed.forall n : t, 0 < - n <-> n < 0forall n : t, - n < 0 <-> 0 < nforall n : t, - n < 0 <-> 0 < nnow rewrite (opp_lt_mono 0 n), opp_0. Qed.n:t- n < 0 <-> 0 < nforall n : t, 0 <= - n <-> n <= 0intro n; now rewrite (opp_le_mono n 0), opp_0. Qed.forall n : t, 0 <= - n <-> n <= 0forall n : t, - n <= 0 <-> 0 <= nforall n : t, - n <= 0 <-> 0 <= nnow rewrite (opp_le_mono 0 n), opp_0. Qed.n:t- n <= 0 <-> 0 <= n-1 < 0apply opp_neg_pos, lt_0_1. Qed.-1 < 0forall n m p : t, n < m <-> p - m < p - nforall n m p : t, n < m <-> p - m < p - nnow rewrite <- 2 add_opp_r, <- add_lt_mono_l, opp_lt_mono. Qed.n, m, p:tn < m <-> p - m < p - nforall n m p : t, n < m <-> n - p < m - pforall n m p : t, n < m <-> n - p < m - pnow rewrite <- 2 add_opp_r, add_lt_mono_r. Qed.n, m, p:tn < m <-> n - p < m - pforall n m p q : t, n < m -> q < p -> n - p < m - qforall n m p q : t, n < m -> q < p -> n - p < m - qapply lt_trans with (m - p); [now apply sub_lt_mono_r | now apply sub_lt_mono_l]. Qed.n, m, p, q:tH1:n < mH2:q < pn - p < m - qforall n m p : t, n <= m <-> p - m <= p - nforall n m p : t, n <= m <-> p - m <= p - nnow rewrite <- 2 add_opp_r, <- add_le_mono_l, opp_le_mono. Qed.n, m, p:tn <= m <-> p - m <= p - nforall n m p : t, n <= m <-> n - p <= m - pforall n m p : t, n <= m <-> n - p <= m - pnow rewrite <- 2 add_opp_r, add_le_mono_r. Qed.n, m, p:tn <= m <-> n - p <= m - pforall n m p q : t, n <= m -> q <= p -> n - p <= m - qforall n m p q : t, n <= m -> q <= p -> n - p <= m - qapply le_trans with (m - p); [now apply sub_le_mono_r | now apply sub_le_mono_l]. Qed.n, m, p, q:tH1:n <= mH2:q <= pn - p <= m - qforall n m p q : t, n < m -> q <= p -> n - p < m - qforall n m p q : t, n < m -> q <= p -> n - p < m - qapply lt_le_trans with (m - p); [now apply sub_lt_mono_r | now apply sub_le_mono_l]. Qed.n, m, p, q:tH1:n < mH2:q <= pn - p < m - qforall n m p q : t, n <= m -> q < p -> n - p < m - qforall n m p q : t, n <= m -> q < p -> n - p < m - qapply le_lt_trans with (m - p); [now apply sub_le_mono_r | now apply sub_lt_mono_l]. Qed.n, m, p, q:tH1:n <= mH2:q < pn - p < m - qforall n m p q : t, n <= m -> p - n < q - m -> p < qforall n m p q : t, n <= m -> p - n < q - m -> p < qapply (le_lt_add_lt (- m) (- n)); [now apply -> opp_le_mono | now rewrite 2 add_opp_r]. Qed.n, m, p, q:tH1:n <= mH2:p - n < q - mp < qforall n m p q : t, n < m -> p - n <= q - m -> p < qforall n m p q : t, n < m -> p - n <= q - m -> p < qapply (lt_le_add_lt (- m) (- n)); [now apply -> opp_lt_mono | now rewrite 2 add_opp_r]. Qed.n, m, p, q:tH1:n < mH2:p - n <= q - mp < qforall n m p q : t, n <= m -> p - n <= q - m -> p <= qforall n m p q : t, n <= m -> p - n <= q - m -> p <= qapply (le_le_add_le (- m) (- n)); [now apply -> opp_le_mono | now rewrite 2 add_opp_r]. Qed.n, m, p, q:tH1:n <= mH2:p - n <= q - mp <= qforall n m p : t, n + p < m <-> n < m - pforall n m p : t, n + p < m <-> n < m - pnow rewrite (sub_lt_mono_r _ _ p), add_simpl_r. Qed.n, m, p:tn + p < m <-> n < m - pforall n m p : t, n + p <= m <-> n <= m - pforall n m p : t, n + p <= m <-> n <= m - pnow rewrite (sub_le_mono_r _ _ p), add_simpl_r. Qed.n, m, p:tn + p <= m <-> n <= m - pforall n m p : t, n + p < m <-> p < m - nforall n m p : t, n + p < m <-> p < m - nrewrite add_comm; apply lt_add_lt_sub_r. Qed.n, m, p:tn + p < m <-> p < m - nforall n m p : t, n + p <= m <-> p <= m - nforall n m p : t, n + p <= m <-> p <= m - nrewrite add_comm; apply le_add_le_sub_r. Qed.n, m, p:tn + p <= m <-> p <= m - nforall n m p : t, n - p < m <-> n < m + pforall n m p : t, n - p < m <-> n < m + pnow rewrite (add_lt_mono_r _ _ p), sub_simpl_r. Qed.n, m, p:tn - p < m <-> n < m + pforall n m p : t, n - p <= m <-> n <= m + pforall n m p : t, n - p <= m <-> n <= m + pnow rewrite (add_le_mono_r _ _ p), sub_simpl_r. Qed.n, m, p:tn - p <= m <-> n <= m + pforall n m p : t, n - m < p <-> n < m + pforall n m p : t, n - m < p <-> n < m + prewrite add_comm; apply lt_sub_lt_add_r. Qed.n, m, p:tn - m < p <-> n < m + pforall n m p : t, n - m <= p <-> n <= m + pforall n m p : t, n - m <= p <-> n <= m + prewrite add_comm; apply le_sub_le_add_r. Qed.n, m, p:tn - m <= p <-> n <= m + pforall n m p q : t, n - m < p - q <-> n + q < m + pforall n m p q : t, n - m < p - q <-> n + q < m + pnow rewrite lt_sub_lt_add_l, add_sub_assoc, <- lt_add_lt_sub_r. Qed.n, m, p, q:tn - m < p - q <-> n + q < m + pforall n m p q : t, n - m <= p - q <-> n + q <= m + pforall n m p q : t, n - m <= p - q <-> n + q <= m + pnow rewrite le_sub_le_add_l, add_sub_assoc, <- le_add_le_sub_r. Qed.n, m, p, q:tn - m <= p - q <-> n + q <= m + pforall n m : t, 0 < m <-> n - m < nforall n m : t, 0 < m <-> n - m < nnow rewrite (sub_lt_mono_l _ _ n), sub_0_r. Qed.n, m:t0 < m <-> n - m < nforall n m : t, 0 <= m <-> n - m <= nforall n m : t, 0 <= m <-> n - m <= nnow rewrite (sub_le_mono_l _ _ n), sub_0_r. Qed.n, m:t0 <= m <-> n - m <= nforall n m p q : t, n - m < p - q -> n < m \/ q < pforall n m p q : t, n - m < p - q -> n < m \/ q < pnow apply add_lt_cases, lt_sub_lt_add. Qed.n, m, p, q:tH:n - m < p - qn < m \/ q < pforall n m p q : t, n - m <= p - q -> n <= m \/ q <= pforall n m p q : t, n - m <= p - q -> n <= m \/ q <= pnow apply add_le_cases, le_sub_le_add. Qed.n, m, p, q:tH:n - m <= p - qn <= m \/ q <= pforall n m : t, n - m < 0 -> n < 0 \/ 0 < mforall n m : t, n - m < 0 -> n < 0 \/ 0 < mn, m:tH:n - m < 0n < 0 \/ 0 < mn, m:tH:n - m < 0n < 0 \/ - m < 0now rewrite add_opp_r. Qed.n, m:tH:n - m < 0n + - m < 0forall n m : t, 0 < n - m -> 0 < n \/ m < 0forall n m : t, 0 < n - m -> 0 < n \/ m < 0n, m:tH:0 < n - m0 < n \/ m < 0n, m:tH:0 < n - m0 < n \/ 0 < - mnow rewrite add_opp_r. Qed.n, m:tH:0 < n - m0 < n + - mforall n m : t, n - m <= 0 -> n <= 0 \/ 0 <= mforall n m : t, n - m <= 0 -> n <= 0 \/ 0 <= mn, m:tH:n - m <= 0n <= 0 \/ 0 <= mn, m:tH:n - m <= 0n <= 0 \/ - m <= 0now rewrite add_opp_r. Qed.n, m:tH:n - m <= 0n + - m <= 0forall n m : t, 0 <= n - m -> 0 <= n \/ m <= 0forall n m : t, 0 <= n - m -> 0 <= n \/ m <= 0n, m:tH:0 <= n - m0 <= n \/ m <= 0n, m:tH:0 <= n - m0 <= n \/ 0 <= - mnow rewrite add_opp_r. Qed. Section PosNeg. Variable P : Z.t -> Prop. Hypothesis P_wd : Proper (eq ==> iff) P.n, m:tH:0 <= n - m0 <= n + - mP:t -> PropP_wd:Proper (eq ==> iff) PP 0 -> (forall n : t, 0 < n -> P n /\ P (- n)) -> forall n : t, P nP:t -> PropP_wd:Proper (eq ==> iff) PP 0 -> (forall n : t, 0 < n -> P n /\ P (- n)) -> forall n : t, P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tP nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:n < 0P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:n == 0P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:0 < nP nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:P (- n) /\ P (- - n)P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:n == 0P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:0 < nP nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:P (- - n)P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:n == 0P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:0 < nP nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:n == 0P nP:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:0 < nP napply H2 in H3; now destruct H3. Qed. End PosNeg. Ltac zero_pos_neg n := induction_maker n ltac:(apply zero_pos_neg). End ZAddOrderProp.P:t -> PropP_wd:Proper (eq ==> iff) PH1:P 0H2:forall n0 : t, 0 < n0 -> P n0 /\ P (- n0)n:tH3:0 < nP n