Inductive decl : Set :=
| Ax : term -> decl
| Def : term -> term -> decl.
Definition typ_of_decl (d : decl) : term :=
match d with
| Ax t => t
| Def m t => t
end.
Definition lift_decl (n : nat) (d : decl) (k : nat) :=
match d with
| Ax t => Ax (lift_rec n t k)
| Def m t => Def (lift_rec n m k) (lift_rec n t k)
end.
Definition subst_decl (a : term) (d : decl) (k : nat) :=
match d with
| Ax t => Ax (subst_rec a t k)
| Def m t => Def (subst_rec a m k) (subst_rec a t k)
end.
Definition val_ok (d : decl) (t : term) : Prop :=
match d with
| Def t' _ => t = t'
| _ => True
end.
Hint Unfold val_ok: pts.
Definition env := list decl.
(* acces a un terme de l'environnement *)
Definition item_lift (t : term) (e : env) (n : nat) :=
exists2 u : _, t = lift (S n) (typ_of_decl u) & item u e n.
(* insertion dans un environnement *)
Inductive ins_in_env (g : env) (d1 : decl) : nat -> env -> env -> Prop :=
| ins_O : ins_in_env g d1 0 g (d1 :: g)
| ins_S :
forall (n : nat) (e f : env) (d : decl),
ins_in_env g d1 n e f ->
ins_in_env g d1 (S n) (d :: e) (lift_decl 1 d n :: f).
Hint Resolve ins_O ins_S: pts.
simple induction 1; auto with arith pts.
simple destruct v; intros.
inversion_clear H2.
inversion_clear H3; auto with arith pts.
Qed.
simple induction 1; auto with arith pts.
intros.
inversion_clear H0.
simple destruct v; simpl in |- *; intros.
replace (n0 - 0) with n0; auto with arith pts.
inversion_clear H3; auto with arith pts.
inversion_clear H3; auto with arith pts.
Qed.

Lemma ins_item_lift_lt :
forall (d' : decl) (n : nat) (g e f : env),
ins_in_env g d' n e f ->
forall v : nat,
n > v ->
forall t : term, item_lift t e v -> item_lift (lift_rec 1 t n) f v.