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.

(* Specifications: *)
Lemma ins_item_ge :
forall (d' : decl) (n : nat) (g e f : env),
ins_in_env g d' n e f ->
forall v : nat, n <= v -> forall d : decl, item d e v -> item d f (S v).