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 Import NZAxioms. Require Import NZAddOrder. Module Type NZMulOrderProp (Import NZ : NZOrdAxiomsSig'). Include NZAddOrderProp NZ.forall p q n m : t, S p == q -> p * n < p * m <-> q * n + m < q * m + nforall p q n m : t, S p == q -> p * n < p * m <-> q * n + m < q * m + np, q, n, m:tH:S p == qp * n < p * m <-> q * n + m < q * m + np, q, n, m:tH:S p == qp * n < p * m <-> S p * n + m < S p * m + np, q, n, m:tH:S p == qp * n < p * m <-> p * n + n + m < p * m + m + nnow rewrite <- add_lt_mono_r. Qed.p, q, n, m:tH:S p == qp * n < p * m <-> p * n + (m + n) < p * m + (m + n)forall p n m : t, 0 < p -> n < m <-> p * n < p * mforall p n m : t, 0 < p -> n < m <-> p * n < p * mp, n, m:tHp:0 < pn < m <-> p * n < p * mp:tHp:0 < pforall n m : t, n < m <-> p * n < p * mp:tHp:0 < pProper (eq ==> iff) (fun p0 : t => forall n m : t, n < m <-> p0 * n < p0 * m)p:tHp:0 < pforall n m : t, n < m <-> S 0 * n < S 0 * mp:tHp:0 < pforall m : t, 0 < m -> (forall n m0 : t, n < m0 <-> m * n < m * m0) -> forall n m0 : t, n < m0 <-> S m * n < S m * m0solve_proper.p:tHp:0 < pProper (eq ==> iff) (fun p0 : t => forall n m : t, n < m <-> p0 * n < p0 * m)p:tHp:0 < pforall n m : t, n < m <-> S 0 * n < S 0 * mnow nzsimpl.p:tHp:0 < pn, m:tn < m <-> S 0 * n < S 0 * mp:tHp:0 < pforall m : t, 0 < m -> (forall n m0 : t, n < m0 <-> m * n < m * m0) -> forall n m0 : t, n < m0 <-> S m * n < S m * m0forall m : t, 0 < m -> (forall n m0 : t, n < m0 <-> m * n < m * m0) -> forall n m0 : t, n < m0 <-> S m * n < S m * m0p:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tn < m <-> S p * n < S p * mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tn < m <-> p * n + n < p * m + mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0n < m <-> p * n + n < p * m + mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:n < mp * n + n < p * m + mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mn < mnow apply LR.p:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:n < mp * n + n < p * m + mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mn < mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mEQ:n == mn < mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mGT:m < nn < mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mEQ:n == mn < morder.p:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * m + m < p * m + mEQ:n == mn < mp:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mGT:m < nn < morder. Qed.p:tHp:0 < pIH:forall n0 m0 : t, n0 < m0 <-> p * n0 < p * m0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * n0 + n0 < p * m0 + m0H:p * n + n < p * m + mGT:p * m + m < p * n + nn < mforall p n m : t, 0 < p -> n < m <-> n * p < m * pforall p n m : t, 0 < p -> n < m <-> n * p < m * pp, n, m:t0 < p -> n < m <-> n * p < m * pnow apply mul_lt_mono_pos_l. Qed.p, n, m:t0 < p -> n < m <-> p * n < p * mforall p n m : t, p < 0 -> n < m <-> p * m < p * nforall p n m : t, p < 0 -> n < m <-> p * m < p * nforall n m : t, 0 < 0 -> n < m <-> 0 * m < 0 * nforall n : t, 0 <= n -> (forall n0 m : t, n < 0 -> n0 < m <-> n * m < n * n0) -> forall n0 m : t, S n < 0 -> n0 < m <-> S n * m < S n * n0forall n : t, n < 0 -> (forall n0 m : t, S n < 0 -> n0 < m <-> S n * m < S n * n0) -> forall n0 m : t, n < 0 -> n0 < m <-> n * m < n * n0order.forall n m : t, 0 < 0 -> n < m <-> 0 * m < 0 * nforall n : t, 0 <= n -> (forall n0 m : t, n < 0 -> n0 < m <-> n * m < n * n0) -> forall n0 m : t, S n < 0 -> n0 < m <-> S n * m < S n * n0p:tHp:0 <= pn, m:tHp':S p < 0n < m <-> S p * m < S p * norder.p:tHp:0 <= pn, m:tHp':p < 0n < m <-> S p * m < S p * nforall n : t, n < 0 -> (forall n0 m : t, S n < 0 -> n0 < m <-> S n * m < S n * n0) -> forall n0 m : t, n < 0 -> n0 < m <-> n * m < n * n0p:tHp:p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tn < m <-> p * m < p * np:tHp:S p <= 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tn < m <-> p * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tn < m <-> p * m < p * np:tHp:S p == 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tn < m <-> p * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tn < m <-> p * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tforall n0 m0 : t, n0 < m0 -> p * m0 < p * n0p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0n < m <-> p * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tforall n0 m0 : t, n0 < m0 -> p * m0 < p * n0p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m, n1, m1:tH:n1 < m1p * m1 < p * n1p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m, n1, m1:tH:n1 < m1n1 <= m1p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m, n1, m1:tH:n1 < m1p * m1 + m1 < p * n1 + n1now apply lt_le_incl.p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m, n1, m1:tH:n1 < m1n1 <= m1p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m, n1, m1:tH:n1 < m1p * m1 + m1 < p * n1 + n1now rewrite <- IH.p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m, n1, m1:tH:n1 < m1S p * m1 < S p * n1p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0n < m <-> p * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:n < mp * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nn < mnow apply LR.p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:n < mp * m < p * np:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nn < mp:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nEQ:n == mn < mp:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nGT:m < nn < mp:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nEQ:n == mn < morder.p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * mEQ:n == mn < mp:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nGT:m < nn < morder.p:tHp:S p < 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tLR:forall n0 m0 : t, n0 < m0 -> p * m0 < p * n0H:p * m < p * nGT:p * n < p * mn < mrewrite (mul_lt_pred p (S p)), Hp; now nzsimpl. Qed.p:tHp:S p == 0IH:forall n0 m0 : t, S p < 0 -> n0 < m0 <-> S p * m0 < S p * n0n, m:tn < m <-> p * m < p * nforall p n m : t, p < 0 -> n < m <-> m * p < n * pforall p n m : t, p < 0 -> n < m <-> m * p < n * pp, n, m:tp < 0 -> n < m <-> m * p < n * pnow apply mul_lt_mono_neg_l. Qed.p, n, m:tp < 0 -> n < m <-> p * m < p * nforall n m p : t, 0 <= p -> n <= m -> p * n <= p * mforall n m p : t, 0 <= p -> n <= m -> p * n <= p * mn, m, p:tH1:0 <= pH2:n <= mp * n <= p * mn, m, p:tH1:0 < pH2:n <= mp * n <= p * mn, m, p:tH1:0 == pH2:n <= mp * n <= p * mn, m, p:tH1:0 < pH2:n <= mp * n <= p * mn, m, p:tH1:0 < pH2:n < mp * n <= p * mn, m, p:tH1:0 < pH2:n == mp * n <= p * mn, m, p:tH1:0 < pH2:n < mp * n <= p * mnow apply mul_lt_mono_pos_l.n, m, p:tH1:0 < pH2:n < mp * n < p * mapply eq_le_incl; now rewrite H2.n, m, p:tH1:0 < pH2:n == mp * n <= p * mapply eq_le_incl; rewrite <- H1; now do 2 rewrite mul_0_l. Qed.n, m, p:tH1:0 == pH2:n <= mp * n <= p * mforall n m p : t, p <= 0 -> n <= m -> p * m <= p * nforall n m p : t, p <= 0 -> n <= m -> p * m <= p * nn, m, p:tH1:p <= 0H2:n <= mp * m <= p * nn, m, p:tH1:p < 0H2:n <= mp * m <= p * nn, m, p:tH1:p == 0H2:n <= mp * m <= p * nn, m, p:tH1:p < 0H2:n <= mp * m <= p * nn, m, p:tH1:p < 0H2:n < mp * m <= p * nn, m, p:tH1:p < 0H2:n == mp * m <= p * nn, m, p:tH1:p < 0H2:n < mp * m <= p * nnow apply mul_lt_mono_neg_l.n, m, p:tH1:p < 0H2:n < mp * m < p * napply eq_le_incl; now rewrite H2.n, m, p:tH1:p < 0H2:n == mp * m <= p * napply eq_le_incl; rewrite H1; now do 2 rewrite mul_0_l. Qed.n, m, p:tH1:p == 0H2:n <= mp * m <= p * nforall n m p : t, 0 <= p -> n <= m -> n * p <= m * pintros n m p H1 H2; rewrite (mul_comm n p), (mul_comm m p); now apply mul_le_mono_nonneg_l. Qed.forall n m p : t, 0 <= p -> n <= m -> n * p <= m * pforall n m p : t, p <= 0 -> n <= m -> m * p <= n * pintros n m p H1 H2; rewrite (mul_comm n p), (mul_comm m p); now apply mul_le_mono_nonpos_l. Qed.forall n m p : t, p <= 0 -> n <= m -> m * p <= n * pforall n m p : t, p ~= 0 -> p * n == p * m <-> n == mforall n m p : t, p ~= 0 -> p * n == p * m <-> n == mn, m, p:tHp:p ~= 0H:p * n == p * mn == mn, m, p:tHp:p < 0H:p * n == p * mLT:n < mn == mn, m, p:tHp:p < 0H:p * n == p * mGT:m < nn == mn, m, p:tHp:0 < pH:p * n == p * mLT:n < mn == mn, m, p:tHp:0 < pH:p * n == p * mGT:m < nn == mapply (mul_lt_mono_neg_l p) in LT; order.n, m, p:tHp:p < 0H:p * n == p * mLT:n < mn == mapply (mul_lt_mono_neg_l p) in GT; order.n, m, p:tHp:p < 0H:p * n == p * mGT:m < nn == mapply (mul_lt_mono_pos_l p) in LT; order.n, m, p:tHp:0 < pH:p * n == p * mLT:n < mn == mapply (mul_lt_mono_pos_l p) in GT; order. Qed.n, m, p:tHp:0 < pH:p * n == p * mGT:m < nn == mforall n m p : t, p ~= 0 -> n * p == m * p <-> n == mforall n m p : t, p ~= 0 -> n * p == m * p <-> n == mrewrite (mul_comm n p), (mul_comm m p); apply mul_cancel_l. Qed.n, m, p:tp ~= 0 -> n * p == m * p <-> n == mforall n m : t, m ~= 0 -> n * m == m <-> n == 1forall n m : t, m ~= 0 -> n * m == m <-> n == 1n, m:tH:m ~= 0n * m == m <-> n == 1now apply mul_cancel_r. Qed.n, m:tH:m ~= 0n * m == 1 * m <-> n == 1forall n m : t, n ~= 0 -> n * m == n <-> m == 1intros n m; rewrite mul_comm; apply mul_id_l. Qed.forall n m : t, n ~= 0 -> n * m == n <-> m == 1forall n m p : t, 0 < p -> n <= m <-> p * n <= p * mforall n m p : t, 0 < p -> n <= m <-> p * n <= p * mn, m, p:tH:0 < pn < m \/ n == m <-> p * n < p * m \/ p * n == p * mnow rewrite -> (mul_cancel_l n m p) by (intro H1; rewrite H1 in H; false_hyp H lt_irrefl). Qed.n, m, p:tH:0 < pp * n < p * m \/ n == m <-> p * n < p * m \/ p * n == p * mforall n m p : t, 0 < p -> n <= m <-> n * p <= m * pforall n m p : t, 0 < p -> n <= m <-> n * p <= m * prewrite (mul_comm n p), (mul_comm m p); apply mul_le_mono_pos_l. Qed.n, m, p:t0 < p -> n <= m <-> n * p <= m * pforall n m p : t, p < 0 -> n <= m <-> p * m <= p * nforall n m p : t, p < 0 -> n <= m <-> p * m <= p * nn, m, p:tH:p < 0n < m \/ n == m <-> p * m < p * n \/ p * m == p * nn, m, p:tH:p < 0p * m < p * n \/ n == m <-> p * m < p * n \/ p * m == p * nnow setoid_replace (n == m) with (m == n) by (split; now intro). Qed.n, m, p:tH:p < 0p * m < p * n \/ n == m <-> p * m < p * n \/ m == nforall n m p : t, p < 0 -> n <= m <-> m * p <= n * pforall n m p : t, p < 0 -> n <= m <-> m * p <= n * prewrite (mul_comm n p), (mul_comm m p); apply mul_le_mono_neg_l. Qed.n, m, p:tp < 0 -> n <= m <-> m * p <= n * pforall n m p q : t, 0 <= n -> n < m -> 0 <= p -> p < q -> n * p < m * qforall n m p q : t, 0 <= n -> n < m -> 0 <= p -> p < q -> n * p < m * qn, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qn * p < m * qn, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qn * p <= m * pn, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qm * p < m * qapply mul_le_mono_nonneg_r; [assumption | now apply lt_le_incl].n, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qn * p <= m * papply -> mul_lt_mono_pos_l; [assumption | now apply le_lt_trans with n]. Qed. (* There are still many variants of the theorem above. One can assume 0 < n or 0 < p or n <= m or p <= q. *)n, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qm * p < m * qforall n m p q : t, 0 <= n -> n <= m -> 0 <= p -> p <= q -> n * p <= m * qforall n m p q : t, 0 <= n -> n <= m -> 0 <= p -> p <= q -> n * p <= m * qn, m, p, q:tH1:0 <= nH2:n <= mH3:0 <= pH4:p <= qn * p <= m * qn, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qn * p <= m * qn, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p == qn * p <= m * qn, m, p, q:tH1:0 <= nH2:n == mH3:0 <= pH4:p < qn * p <= m * qn, m, p, q:tH1:0 <= nH2:n == mH3:0 <= pH4:p == qn * p <= m * qapply lt_le_incl; now apply mul_lt_mono_nonneg.n, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p < qn * p <= m * qrewrite <- H4; apply mul_le_mono_nonneg_r; [assumption | now apply lt_le_incl].n, m, p, q:tH1:0 <= nH2:n < mH3:0 <= pH4:p == qn * p <= m * qrewrite <- H2; apply mul_le_mono_nonneg_l; [assumption | now apply lt_le_incl].n, m, p, q:tH1:0 <= nH2:n == mH3:0 <= pH4:p < qn * p <= m * qrewrite H2; rewrite H4; now apply eq_le_incl. Qed.n, m, p, q:tH1:0 <= nH2:n == mH3:0 <= pH4:p == qn * p <= m * qforall n m : t, 0 < n -> 0 < m -> 0 < n * mforall n m : t, 0 < n -> 0 < m -> 0 < n * mn, m:tH1:0 < nH2:0 < m0 < n * mnow apply mul_lt_mono_pos_r. Qed.n, m:tH1:0 < nH2:0 < m0 * m < n * mforall n m : t, n < 0 -> m < 0 -> 0 < n * mforall n m : t, n < 0 -> m < 0 -> 0 < n * mn, m:tH1:n < 0H2:m < 00 < n * mnow apply mul_lt_mono_neg_r. Qed.n, m:tH1:n < 0H2:m < 00 * m < n * mforall n m : t, 0 < n -> m < 0 -> n * m < 0forall n m : t, 0 < n -> m < 0 -> n * m < 0n, m:tH1:0 < nH2:m < 0n * m < 0now apply mul_lt_mono_neg_r. Qed.n, m:tH1:0 < nH2:m < 0n * m < 0 * mforall n m : t, n < 0 -> 0 < m -> n * m < 0intros; rewrite mul_comm; now apply mul_pos_neg. Qed.forall n m : t, n < 0 -> 0 < m -> n * m < 0forall n m : t, 0 <= n -> 0 <= m -> 0 <= n * mforall n m : t, 0 <= n -> 0 <= m -> 0 <= n * mn, m:tH:0 <= nH0:0 <= m0 <= n * mapply mul_le_mono_nonneg; order. Qed.n, m:tH:0 <= nH0:0 <= m0 * m <= n * mforall n m : t, 0 < n -> 0 < n * m <-> 0 < mforall n m : t, 0 < n -> 0 < n * m <-> 0 < mn, m:tHn:0 < n0 < n * m <-> 0 < mn, m:tHn:0 < nn * 0 < n * m <-> 0 < mnow apply mul_lt_mono_pos_l. Qed.n, m:tHn:0 < n0 < m <-> n * 0 < n * mforall n m : t, 0 < m -> 0 < n * m <-> 0 < nforall n m : t, 0 < m -> 0 < n * m <-> 0 < nn, m:tHn:0 < m0 < n * m <-> 0 < nn, m:tHn:0 < m0 * m < n * m <-> 0 < nnow apply mul_lt_mono_pos_r. Qed.n, m:tHn:0 < m0 < n <-> 0 * m < n * mforall n m : t, 0 < n -> 0 <= n * m <-> 0 <= mforall n m : t, 0 < n -> 0 <= n * m <-> 0 <= mn, m:tHn:0 < n0 <= n * m <-> 0 <= mn, m:tHn:0 < nn * 0 <= n * m <-> 0 <= mnow apply mul_le_mono_pos_l. Qed.n, m:tHn:0 < n0 <= m <-> n * 0 <= n * mforall n m : t, 0 < m -> 0 <= n * m <-> 0 <= nforall n m : t, 0 < m -> 0 <= n * m <-> 0 <= nn, m:tHn:0 < m0 <= n * m <-> 0 <= nn, m:tHn:0 < m0 * m <= n * m <-> 0 <= nnow apply mul_le_mono_pos_r. Qed.n, m:tHn:0 < m0 <= n <-> 0 * m <= n * mforall n m : t, 1 < n -> 0 < m -> 1 < n * mforall n m : t, 1 < n -> 0 < m -> 1 < n * mn, m:tH1:1 < nH2:0 < m1 < n * mn, m:tH1:1 * m < n * mH2:0 < m1 < n * mn, m:tH1:1 < nH2:0 < mH:forall n0 m0 : t, 0 < m -> n0 < m0 -> n0 * m < m0 * m0 < mn, m:tH1:1 * m < n * mH2:0 < m1 < n * mnow apply lt_1_l with m.n, m:tH1:m < n * mH2:0 < m1 < n * massumption. Qed.n, m:tH1:1 < nH2:0 < mH:forall n0 m0 : t, 0 < m -> n0 < m0 -> n0 * m < m0 * m0 < mforall n m : t, n * m == 0 <-> n == 0 \/ m == 0forall n m : t, n * m == 0 <-> n == 0 \/ m == 0n, m:tn * m == 0 -> n == 0 \/ m == 0n, m:tn == 0 \/ m == 0 -> n * m == 0n, m:tn * m == 0 -> n == 0 \/ m == 0n, m:tH:n * m == 0H1:n < 0H2:m < 0n == 0 \/ m == 0n, m:tH:n * m == 0H1:n < 0H2:0 < mn == 0 \/ m == 0n, m:tH:n * m == 0H1:0 < nH2:m < 0n == 0 \/ m == 0n, m:tH:n * m == 0H1:0 < nH2:0 < mn == 0 \/ m == 0exfalso; now apply (lt_neq 0 (n * m)); [apply mul_neg_neg |].n, m:tH:n * m == 0H1:n < 0H2:m < 0n == 0 \/ m == 0exfalso; now apply (lt_neq (n * m) 0); [apply mul_neg_pos |].n, m:tH:n * m == 0H1:n < 0H2:0 < mn == 0 \/ m == 0exfalso; now apply (lt_neq (n * m) 0); [apply mul_pos_neg |].n, m:tH:n * m == 0H1:0 < nH2:m < 0n == 0 \/ m == 0exfalso; now apply (lt_neq 0 (n * m)); [apply mul_pos_pos |].n, m:tH:n * m == 0H1:0 < nH2:0 < mn == 0 \/ m == 0n, m:tn == 0 \/ m == 0 -> n * m == 0n, m:tH:n == 0n * m == 0n, m:tH:m == 0n * m == 0now rewrite H, mul_0_l.n, m:tH:n == 0n * m == 0now rewrite H, mul_0_r. Qed.n, m:tH:m == 0n * m == 0forall n m : t, n ~= 0 /\ m ~= 0 <-> n * m ~= 0forall n m : t, n ~= 0 /\ m ~= 0 <-> n * m ~= 0n, m:tH:n ~= 0 /\ m ~= 0n * m ~= 0n, m:tH:n * m ~= 0n ~= 0 /\ m ~= 0n, m:tH:n ~= 0 /\ m ~= 0n * m ~= 0tauto.n, m:tH:n ~= 0 /\ m ~= 0H1:n == 0 \/ m == 0Falsesplit; intro H1; rewrite H1 in H; (rewrite mul_0_l in H || rewrite mul_0_r in H); now apply H. Qed.n, m:tH:n * m ~= 0n ~= 0 /\ m ~= 0forall n : t, n * n == 0 <-> n == 0intro n; rewrite eq_mul_0; tauto. Qed.forall n : t, n * n == 0 <-> n == 0forall n m : t, n * m == 0 -> m ~= 0 -> n == 0forall n m : t, n * m == 0 -> m ~= 0 -> n == 0n, m:tH1:n * m == 0H2:m ~= 0n == 0n, m:tH1:n == 0 \/ m == 0H2:m ~= 0n == 0n, m:tH1:n == 0H2:m ~= 0n == 0n, m:tH1:m == 0H2:m ~= 0n == 0assumption.n, m:tH1:n == 0H2:m ~= 0n == 0false_hyp H1 H2. Qed.n, m:tH1:m == 0H2:m ~= 0n == 0forall n m : t, n * m == 0 -> n ~= 0 -> m == 0forall n m : t, n * m == 0 -> n ~= 0 -> m == 0n, m:tH1:n == 0 \/ m == 0H2:n ~= 0m == 0n, m:tH1:n == 0H2:n ~= 0m == 0n, m:tH1:m == 0H2:n ~= 0m == 0false_hyp H1 H2.n, m:tH1:n == 0H2:n ~= 0m == 0assumption. Qed.n, m:tH1:m == 0H2:n ~= 0m == 0
Some alternative names:
Definition mul_eq_0 := eq_mul_0. Definition mul_eq_0_l := eq_mul_0_l. Definition mul_eq_0_r := eq_mul_0_r.n, m:t0 < n * m <-> 0 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:t0 < n * m <-> 0 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:tH:0 < n * m0 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:tH1:0 < nH2:0 < m0 < n * mn, m:tH1:m < 0H2:n < 00 < n * mn, m:tH:0 < n * m0 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:tH:0 < n * mH1:n < 0H2:0 < m0 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:tH:0 < n * mH1:0 < nH2:m < 00 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:tH:0 < n * mH1:n < 0H2:0 < m0 < n /\ 0 < m \/ m < 0 /\ n < 0exfalso; now apply (lt_asymm (n * m) 0).n, m:tH:0 < n * mH1:n < 0H2:0 < mH3:n * m < 00 < n /\ 0 < m \/ m < 0 /\ n < 0n, m:tH:0 < n * mH1:0 < nH2:m < 00 < n /\ 0 < m \/ m < 0 /\ n < 0exfalso; now apply (lt_asymm (n * m) 0).n, m:tH:0 < n * mH1:0 < nH2:m < 0H3:n * m < 00 < n /\ 0 < m \/ m < 0 /\ n < 0now apply mul_pos_pos.n, m:tH1:0 < nH2:0 < m0 < n * mnow apply mul_neg_neg. Qed.n, m:tH1:m < 0H2:n < 00 < n * mforall n m : t, 0 <= n -> n < m -> n * n < m * mforall n m : t, 0 <= n -> n < m -> n * n < m * mnow apply mul_lt_mono_nonneg. Qed.n, m:tH1:0 <= nH2:n < mn * n < m * mforall n m : t, 0 <= n -> n <= m -> n * n <= m * mforall n m : t, 0 <= n -> n <= m -> n * n <= m * mnow apply mul_le_mono_nonneg. Qed. (* The converse theorems require nonnegativity (or nonpositivity) of the other variable *)n, m:tH1:0 <= nH2:n <= mn * n <= m * mforall n m : t, 0 <= m -> n * n < m * m -> n < mforall n m : t, 0 <= m -> n * n < m * m -> n < mn, m:tH1:0 <= mH2:n * n < m * mn < mn, m:tH1:0 <= mH2:n * n < m * mH:n < 0n < mn, m:tH1:0 <= mH2:n * n < m * mH:0 <= nn < mnow apply lt_le_trans with 0.n, m:tH1:0 <= mH2:n * n < m * mH:n < 0n < mn, m:tH1:0 <= mH2:n * n < m * mH:0 <= nn < mapply square_le_mono_nonneg in LE; order. Qed.n, m:tH1:0 <= mH2:n * n < m * mH:0 <= nLE:m <= nn < mforall n m : t, 0 <= m -> n * n <= m * m -> n <= mforall n m : t, 0 <= m -> n * n <= m * m -> n <= mn, m:tH1:0 <= mH2:n * n <= m * mn <= mn, m:tH1:0 <= mH2:n * n <= m * mH:n < 0n <= mn, m:tH1:0 <= mH2:n * n <= m * mH:0 <= nn <= mapply lt_le_incl; now apply lt_le_trans with 0.n, m:tH1:0 <= mH2:n * n <= m * mH:n < 0n <= mn, m:tH1:0 <= mH2:n * n <= m * mH:0 <= nn <= mapply square_lt_mono_nonneg in LT; order. Qed.n, m:tH1:0 <= mH2:n * n <= m * mH:0 <= nLT:m < nn <= mforall n m : t, n < m -> 1 + 2 * n < 2 * mforall n m : t, n < m -> 1 + 2 * n < 2 * mn, m:tn < m -> 1 + 2 * n < 2 * mn, m:t2 * S n <= 2 * m -> 1 + 2 * n < 2 * mn, m:t0 < 2n, m:t2 * S n <= 2 * m -> 1 + 2 * n < 2 * mn, m:tS 1 * S n <= S 1 * m -> 1 + S 1 * n < S 1 * mnow rewrite le_succ_l.n, m:tS (S (n + n)) <= m + m -> S (n + n) < m + morder'. Qed.n, m:t0 < 2forall a b : t, 1 < a -> 1 < b -> a + b <= a * bforall a b : t, 1 < a -> 1 < b -> a + b <= a * bforall a b : t, 0 < a -> 0 < b -> S a + S b <= S a * S bAUX:forall a b : t, 0 < a -> 0 < b -> S a + S b <= S a * S bforall a b : t, 1 < a -> 1 < b -> a + b <= a * bforall a b : t, 0 < a -> 0 < b -> S a + S b <= S a * S ba, b:tHa:0 < aHb:0 < bS a + S b <= S a * S ba, b:tHa:0 < aHb:0 < bS (S (a + b)) <= S (a * b + b + a)a, b:tHa:0 < aHb:0 < bS (a + b) <= a * b + b + aa, b:tHa:0 < aHb:0 < ba + b < a * b + b + aa, b:tHa:0 < aHb:0 < b0 + (a + b) < a * b + (a + b)now apply mul_pos_pos.a, b:tHa:0 < aHb:0 < b0 < a * bAUX:forall a b : t, 0 < a -> 0 < b -> S a + S b <= S a * S bforall a b : t, 1 < a -> 1 < b -> a + b <= a * bAUX:forall a0 b0 : t, 0 < a0 -> 0 < b0 -> S a0 + S b0 <= S a0 * S b0a, b:tHa:1 < aHb:1 < ba + b <= a * bAUX:forall a0 b0 : t, 0 < a0 -> 0 < b0 -> S a0 + S b0 <= S a0 * S b0a, b:tHa:1 < aHb:1 < bHa':S (P a) == aa + b <= a * bAUX:forall a0 b0 : t, 0 < a0 -> 0 < b0 -> S a0 + S b0 <= S a0 * S b0a, b:tHa:1 < aHb:1 < bHa':S (P a) == aHb':S (P b) == ba + b <= a * bapply AUX; rewrite succ_lt_mono, <- one_succ; order. Qed.AUX:forall a0 b0 : t, 0 < a0 -> 0 < b0 -> S a0 + S b0 <= S a0 * S b0a, b:tHa:1 < aHb:1 < bHa':S (P a) == aHb':S (P b) == bS (P a) + S (P b) <= S (P a) * S (P b)
A few results about squares
forall a : t, 0 <= a * aforall a : t, 0 <= a * aa:t0 <= a * aa:ta * 0 <= a * aa:tH:a <= 0a * 0 <= a * aa:tH:0 < aa * 0 <= a * anow apply mul_le_mono_nonpos_l.a:tH:a <= 0a * 0 <= a * aapply mul_le_mono_nonneg_l; order. Qed.a:tH:0 < aa * 0 <= a * aforall a b : t, 0 <= a -> 0 <= b -> b * a + a * b <= a * a + b * bforall a b : t, 0 <= a -> 0 <= b -> b * a + a * b <= a * a + b * bforall a b : t, 0 <= a <= b -> b * a + a * b <= a * a + b * bAUX:forall a b : t, 0 <= a <= b -> b * a + a * b <= a * a + b * bforall a b : t, 0 <= a -> 0 <= b -> b * a + a * b <= a * a + b * bforall a b : t, 0 <= a <= b -> b * a + a * b <= a * a + b * ba, b:tHa:0 <= aH:a <= bb * a + a * b <= a * a + b * ba, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= db * a + a * b <= a * a + b * ba, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= d(d + a) * a + a * (d + a) <= a * a + (d + a) * (d + a)a, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= dd * a + a * a + a * (d + a) <= a * a + (d * (d + a) + a * (d + a))a, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= dd * a + a * a + a * (d + a) <= a * a + d * (d + a) + a * (d + a)a, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= dd * a + a * a <= a * a + d * (d + a)a, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= da * a + d * a <= a * a + d * (d + a)a, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= dd * a <= d * (d + a)order.a, b:tHa:0 <= aH:a <= bd:tEQ:b == d + aHd:0 <= da <= d + aAUX:forall a b : t, 0 <= a <= b -> b * a + a * b <= a * a + b * bforall a b : t, 0 <= a -> 0 <= b -> b * a + a * b <= a * a + b * bAUX:forall a0 b0 : t, 0 <= a0 <= b0 -> b0 * a0 + a0 * b0 <= a0 * a0 + b0 * b0a, b:tHa:0 <= aHb:0 <= bb * a + a * b <= a * a + b * bAUX:forall a0 b0 : t, 0 <= a0 <= b0 -> b0 * a0 + a0 * b0 <= a0 * a0 + b0 * b0a, b:tHa:0 <= aHb:0 <= bH:a <= bb * a + a * b <= a * a + b * bAUX:forall a0 b0 : t, 0 <= a0 <= b0 -> b0 * a0 + a0 * b0 <= a0 * a0 + b0 * b0a, b:tHa:0 <= aHb:0 <= bH:b < ab * a + a * b <= a * a + b * bapply AUX; split; order.AUX:forall a0 b0 : t, 0 <= a0 <= b0 -> b0 * a0 + a0 * b0 <= a0 * a0 + b0 * b0a, b:tHa:0 <= aHb:0 <= bH:a <= bb * a + a * b <= a * a + b * bAUX:forall a0 b0 : t, 0 <= a0 <= b0 -> b0 * a0 + a0 * b0 <= a0 * a0 + b0 * b0a, b:tHa:0 <= aHb:0 <= bH:b < ab * a + a * b <= a * a + b * bapply AUX; split; order. Qed.AUX:forall a0 b0 : t, 0 <= a0 <= b0 -> b0 * a0 + a0 * b0 <= a0 * a0 + b0 * b0a, b:tHa:0 <= aHb:0 <= bH:b < aa * b + b * a <= b * b + a * aforall a b : t, 0 <= a -> 0 <= b -> a * a + b * b <= (a + b) * (a + b)forall a b : t, 0 <= a -> 0 <= b -> a * a + b * b <= (a + b) * (a + b)a, b:tHa:0 <= aHb:0 <= ba * a + b * b <= (a + b) * (a + b)a, b:tHa:0 <= aHb:0 <= ba * a + b * b <= a * a + a * b + (b * a + b * b)a, b:tHa:0 <= aHb:0 <= ba * a + b * b <= a * a + a * b + b * a + b * ba, b:tHa:0 <= aHb:0 <= ba * a <= a * a + a * b + b * aa, b:tHa:0 <= aHb:0 <= ba * a <= a * a + (a * b + b * a)a, b:tHa:0 <= aHb:0 <= ba * a + 0 <= a * a + (a * b + b * a)apply add_nonneg_nonneg; now apply mul_nonneg_nonneg. Qed.a, b:tHa:0 <= aHb:0 <= b0 <= a * b + b * aforall a b : t, 0 <= a -> 0 <= b -> (a + b) * (a + b) <= 2 * (a * a + b * b)forall a b : t, 0 <= a -> 0 <= b -> (a + b) * (a + b) <= 2 * (a * a + b * b)a, b:tHa:0 <= aHb:0 <= b(a + b) * (a + b) <= 2 * (a * a + b * b)a, b:tHa:0 <= aHb:0 <= ba * a + b * a + (a * b + b * b) <= 2 * (a * a) + 2 * (b * b)a, b:tHa:0 <= aHb:0 <= ba * a + b * a + (a * b + b * b) <= a * a + a * a + (b * b + b * b)a, b:tHa:0 <= aHb:0 <= ba * a + (b * a + (a * b + b * b)) <= a * a + (a * a + (b * b + b * b))a, b:tHa:0 <= aHb:0 <= bb * a + (a * b + b * b) <= a * a + (b * b + b * b)a, b:tHa:0 <= aHb:0 <= bb * a + a * b + b * b <= a * a + b * b + b * bapply crossmul_le_addsquare; order. Qed.a, b:tHa:0 <= aHb:0 <= bb * a + a * b <= a * a + b * bforall a b : t, 0 <= a -> 0 <= b -> 2 * 2 * a * b <= (a + b) * (a + b)forall a b : t, 0 <= a -> 0 <= b -> 2 * 2 * a * b <= (a + b) * (a + b)a, b:tH:0 <= aH0:0 <= b2 * 2 * a * b <= (a + b) * (a + b)a, b:tH:0 <= aH0:0 <= b(a + a + a + a) * b <= (a + b) * (a + b)a, b:tH:0 <= aH0:0 <= ba * b + a * b + a * b + a * b <= a * a + b * a + (a * b + b * b)a, b:tH:0 <= aH0:0 <= ba * b + a * b + a * b + a * b <= a * a + b * a + b * b + a * ba, b:tH:0 <= aH0:0 <= ba * b + a * b + a * b <= a * a + b * a + b * ba, b:tH:0 <= aH0:0 <= ba * b + a * b + a * b <= a * a + b * b + a * ba, b:tH:0 <= aH0:0 <= ba * b + a * b <= a * a + b * bnow apply crossmul_le_addsquare. Qed. End NZMulOrderProp.a, b:tH:0 <= aH0:0 <= bb * a + a * b <= a * a + b * b