(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(****************************************************************************)
(*                 The Calculus of Inductive Constructions                  *)
(*                                                                          *)
(*                                Projet Coq                                *)
(*                                                                          *)
(*                     INRIA                        ENS-CNRS                *)
(*              Rocquencourt                        Lyon                    *)
(*                                                                          *)
(*                                Coq V5.10                                 *)
(*                              Nov 25th 1994                               *)
(*                                                                          *)
(****************************************************************************)
(*                                  Zrec.v                                  *)
(****************************************************************************)
Require Export Arith.
Require Export Nat_complements.
Require Export misc.
Require Export Zbase.
Require Export Zle.
intros; unfold ltZ in |- *; elim m.
unfold not in |- *; simpl in |- *; intros; exact H.
unfold not in |- *; simpl in |- *; intros; exact H.
unfold not in |- *; simpl in |- *; intros; exact H.
Qed.
intros; apply (H OZ); intros.
unfold lt_absZ in H0; unfold absZ at 2 in H0; elim (lt_OZ m); assumption.
Qed.
(**********************************)
Inductive and_set_set_set (S1 S2 : Set) : Set :=
and_set_set_set_i : S2 -> S1 -> and_set_set_set S1 S2.
(*****************)
Definition and_recZ (p : nat) (P : Z -> Set) :=
forall n : nat, n <= p -> and_set_set_set (P (pos n)) (P (neg n)).
unfold and_recZ in |- *; intros; apply and_set_set_set_i.
(* neg n *)
elim (le_n_O_eq n H0). apply (H (neg 0)); intros.
rewrite (tech_lt_abs_OZ m). apply (Zrec1 P H). exact H1.
(* pos n *)
elim (le_n_O_eq n H0). apply (H (pos 0)); intros.
rewrite (tech_lt_abs_OZ m). apply (Zrec1 P H). exact H1.
Qed.
split.
(* P (neg n) *)
elim (lt_succ n p H1); intros. elim (H0 n a); intros; trivial with arith.
rewrite b. apply (H (neg (S p))).
simple destruct m. intros; apply (Zrec1 P H).
unfold lt_absZ in |- *; unfold absZ in |- *; unfold ltZ in |- *;
unfold leZ in |- *; intros.
elim (H0 n0); auto with arith.
unfold lt_absZ in |- *; unfold absZ in |- *; unfold ltZ in |- *;
unfold leZ in |- *; intros.
elim (H0 n0); auto with arith.
(* P (pos n) *)
elim (lt_succ n p H1); intros. elim (H0 n); intros; trivial with arith.
rewrite b. apply (H (pos (S p))).
simple destruct m. intros; apply (Zrec1 P H).
unfold lt_absZ in |- *; unfold absZ in |- *; unfold ltZ in |- *;
unfold leZ in |- *; intros.
elim (H0 n0); auto with arith.
unfold lt_absZ in |- *; unfold absZ in |- *; unfold ltZ in |- *;
unfold leZ in |- *; intros.
elim (H0 n0); auto with arith.
Qed.

(*************)
Theorem Zrec4 :
forall P : Z -> Set,
(forall n : Z, (forall m : Z, lt_absZ m n -> P m) -> P n) ->
forall p : nat, and_recZ p P.