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) *) (************************************************************************) Require Import Bool NSub NZParity.
Some additional properties of even, odd.
Module Type NParityProp (Import N : NAxiomsSig')(Import NP : NSubProp N). Include NZParityProp N N NP.forall n : t, n ~= 0 -> odd (P n) = even nforall n : t, n ~= 0 -> odd (P n) = even nn:tH:n ~= 0odd (P n) = even nn:tH:n ~= 0odd (P n) = even (S (P n))apply even_succ. Qed.n:tH:n ~= 0even (S (P n)) = odd (P n)forall n : t, n ~= 0 -> even (P n) = odd nforall n : t, n ~= 0 -> even (P n) = odd nn:tH:n ~= 0even (P n) = odd nn:tH:n ~= 0even (P n) = odd (S (P n))apply odd_succ. Qed.n:tH:n ~= 0odd (S (P n)) = even (P n)forall n m : t, m <= n -> even (n - m) = Bool.eqb (even n) (even m)forall n m : t, m <= n -> even (n - m) = Bool.eqb (even n) (even m)n, m:tH:m <= neven (n - m) = Bool.eqb (even n) (even m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n'Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n'n - m == 2 * (n' - m')n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'n - m == 2 * (n' - m' - 1) + 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * n' - 2 * m' - 1 == 2 * n' - 2 * m' - 2 + 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * n' - 2 * m' - 1 == 2 * n' - 2 * m' - S 1 + 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * n' - 2 * m' - 1 == 2 * n' - 2 * m' - (1 + 1) + 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * n' - 2 * m' - 1 == 2 * n' - 2 * m' - 1 - 1 + 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * n' - 2 * m' - 1 - 1 + 1 == 2 * n' - 2 * m' - 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'1 <= 2 * n' - 2 * m' - 1n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'1 + 1 <= 2 * n' - 2 * m'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * 1 <= 2 * n' - 2 * m'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'2 * 1 <= 2 * (n' - m')n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'1 <= n' - m'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'0 < n' - m'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'm' < n'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'LE:n' <= m'm' < n'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n'LE:n' <= m'2 * n' < 2 * m' + 1 -> m' < n'n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1Odd (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1n - m == 2 * (n' - m') + 1n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 12 * n' + 1 - 2 * m' == 2 * n' - 2 * m' + 1n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 12 * m' <= 2 * n'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1m' <= n'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1GT:n' < m'm' <= n'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m'n':tHn:n == 2 * n' + 1GT:n' < m'2 * n' + 1 < 2 * m' -> m' <= n'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1Even (n - m)n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1n - m == 2 * (n' - m')n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 12 * n' + 1 - (2 * m' + 1) == 2 * n' - 2 * m'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 12 * n' + 1 - 2 * m' - 1 == 2 * n' - 2 * m'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 12 * n' - 2 * m' + 1 - 1 == 2 * n' - 2 * m'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 12 * m' <= 2 * n'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 12 * m' <= 2 * n'n, m:tH:m <= nm':tHm:m == 2 * m' + 1n':tHn:n == 2 * n' + 1S (2 * m') <= S (2 * n')order. Qed.n, m:tH:m <= nm':tHm:m == S (2 * m')n':tHn:n == S (2 * n')S (2 * m') <= S (2 * n')forall n m : t, m <= n -> odd (n - m) = xorb (odd n) (odd m)forall n m : t, m <= n -> odd (n - m) = xorb (odd n) (odd m)n, m:tH:m <= nodd (n - m) = xorb (odd n) (odd m)n, m:tH:m <= nnegb (even (n - m)) = xorb (negb (even n)) (negb (even m))now destruct (even n), (even m). Qed. End NParityProp.n, m:tH:m <= nnegb (Bool.eqb (even n) (even m)) = xorb (negb (even n)) (negb (even m))