(* This code is copyrighted by its authors; it is distributed under  *)
(* the terms of the LGPL license (see LICENSE and description files) *)
(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(****************************************************************************)
(*                                                                          *)
(*                                                                          *)
(*                   Solange Coupet-Grimal & Line Jakubiec                  *)
(*                                                                          *)
(*                                                                          *)
(*              Laboratoire d'Informatique de Marseille                     *)
(*               CMI-Technopole de Chateau-Gombert                          *)
(*                   39, Rue F. Joliot Curie                                *)
(*                   13453 MARSEILLE Cedex 13                               *)
(*           e-mail:{Solange.Coupet,Line.Jakubiec}@lim.univ-mrs.fr          *)
(*                                                                          *)
(*                                                                          *)
(*                                Coq V5.10                                 *)
(*                              May 30th 1996                               *)
(*                                                                          *)
(****************************************************************************)
(*                          Dependent_lists.v                               *)
(****************************************************************************)
Require Export Eqdep.
Require Export Arith.
Global Set Asymmetric Patterns.
Section Dependent_lists.
Variable A : Set.
Inductive list : nat -> Set :=
| nil : list 0
| cons : forall n : nat, A -> list n -> list (S n).
Definition eq_list := eq_dep nat list.
Definition hd (n : nat) (l : list n) : Exc A :=
match l in (list m) return (Exc A) with
| nil => error
| cons p a l' => value a
end.
Definition head (n : nat) (l : list n) :=
match l in (list p) return (0 < p -> A) with
| nil =>
(* nil*)
fun h : 0 < 0 => False_rec A (lt_irrefl 0 h)
(*cons p a l' *)
| cons p a l' => fun h : 0 < S p => a
end.
Definition Head (n : nat) (l : list (S n)) := head (S n) l (lt_O_Sn n).
Definition tl (n : nat) (l : list n) : list (pred n) :=
match l in (list m) return (list (pred m)) with
| nil => nil
| cons p a l' => l'
end.

Lemma empty_dep : forall (n : nat) (l : list n), n = 0 -> eq_list 0 nil n l.
unfold eq_list in |- *; intros n l.