(* 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                               *)
(*                                                                          *)
(****************************************************************************)
(*                                  Pol1.v                                  *)
(****************************************************************************)
(*****************************************************************************)
(*          Projet Coq  - Calculus of Inductive Constructions V5.8           *)
(*****************************************************************************)
(*                                                                           *)
(*      Meta-theory of the explicit substitution calculus lambda-env         *)
(*      Amokrane Saibi                                                       *)
(*                                                                           *)
(*      September 1993                                                       *)
(*                                                                           *)
(*****************************************************************************)
(* Preuve de terminaison: Polynome P1 *)
Definition e_P1 (b : wsort) (U : TS b) : nat :=
(fix F (w : wsort) (t : TS w) {struct t} : nat :=
match t with
| var n => power2 (S n)
| app t0 t1 => F wt t0 + F wt t1
| lambda t0 => F wt t0 + 2
| env t0 t1 => F wt t0 * F ws t1
| id => 2
| shift => 2
| cons t0 t1 => F wt t0 + F ws t1
| comp t0 t1 => F ws t0 * F ws t1
| lift t0 => F ws t0
| meta_X _ => 2
| meta_x _ => 2
end) b U.
(* var *)
(* app *)
(* lam *)
(* env *)
(*  id *)
(*  |  *)
(*  .  *)
(*  o  *)
(*  || *)
(*  X  *)
(*  x  *)
Notation P1 := (e_P1 _) (only parsing).
(* <Warning> : Syntax is discontinued *)
Hint Resolve gt_P1_1.
Hint Resolve P1_app.
Hint Resolve P1_lambda.
Hint Resolve P1_clos.
Hint Resolve P1_varshift1.
Hint Resolve P1_varshift2.
Hint Resolve P1_fvarcons.
Hint Resolve P1_fvarlift1.
Hint Resolve P1_fvarlift2.
Hint Resolve P1_rvarcons.
Hint Resolve P1_rvarlift1.
Hint Resolve P1_rvarlift2.
Hint Resolve P1_assenv.
Hint Resolve P1_mapenv.
Hint Resolve P1_shiftcons.
Hint Resolve P1_shiftlift1.
Hint Resolve P1_shiftlift2.
Hint Resolve P1_lift1.
Hint Resolve P1_lift2.
Hint Resolve P1_liftenv.

Theorem P1_idl :
forall M N : sub_explicits, reg_idl M N -> e_P1 _ M > e_P1 _ N.