(************************************************************************)
(*         *   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)         *)
(************************************************************************)
(** Nota : this file is OBSOLETE, and left only for compatibility. Please consider instead predicates [Nat.Even] and [Nat.Odd] and Boolean functions [Nat.even] and [Nat.odd]. *)
(** Here we define the predicates [even] and [odd] by mutual induction and we prove the decidability and the exclusion of those predicates. The main results about parity are proved in the module Div2. *)
Local Open Scope nat_scope.
Implicit Types m n : nat.
(** * Inductive definition of [even] and [odd] *)
Inductive even : nat -> Prop :=
| even_O : even 0
| even_S : forall n, odd n -> even (S n)
with odd : nat -> Prop :=
odd_S : forall n, even n -> odd (S n).
Hint Constructors even: arith.
Hint Constructors odd: arith.
(** * Equivalence with predicates [Nat.Even] and [Nat.odd] *)
(** Basic facts *)
(** * Facts about [even] & [odd] wrt. [plus] *)
Ltac parity2bool :=
rewrite ?even_equiv, ?odd_equiv, <- ?Nat.even_spec, <- ?Nat.odd_spec.
Ltac parity_binop_spec :=
rewrite ?Nat.even_add, ?Nat.odd_add, ?Nat.even_mul, ?Nat.odd_mul.
Ltac parity_binop :=
parity2bool; parity_binop_spec; unfold Nat.odd;
do 2 destruct Nat.even; simpl; tauto.

Lemma even_plus_split n m :
even (n + m) -> even n /\ even m \/ odd n /\ odd m.