Inductive list (X:Type) : Type :=
  | nil : list X
  | cons : X -> list X -> list X.Inductive list (X:Type) : Type :=
  | nil : list X
  | cons : X -> list X -> list X.Inductive list (X:Type) : Type :=
  | nil : list X
  | cons : X -> list X -> list X.Instance dec_list' {A} (p q : list A) 
         (D : forall (x y : A), Dec (x = y)) : Dec (p = q).Fixpoint repeat (X : Type) (x : X) (count : nat) : list X :=
  match count with
  | 0 => nil X
  | S count' => cons X x (repeat X x count')
  end.Inductive mumble : Type :=
  | a : mumble
  | b : mumble -> nat -> mumble
  | c : mumble.Inductive mumble : Type :=
  | a : mumble
  | b : mumble -> nat -> mumble
  | c : mumble.Inductive mumble : Type :=
  | a : mumble
  | b : mumble -> nat -> mumble
  | c : mumble.Inductive mumble : Type :=
  | a : mumble
  | b : mumble -> nat -> mumble
  | c : mumble.Instance dec_mumble (p q : mumble) : Dec (p = q).Inductive grumble (X:Type) : Type :=
  | d : mumble -> grumble X
  | e : X -> grumble X.Inductive grumble (X:Type) : Type :=
  | d : mumble -> grumble X
  | e : X -> grumble X.Inductive grumble (X:Type) : Type :=
  | d : mumble -> grumble X
  | e : X -> grumble X.Instance dec_grumble' {A} (p q : grumble A) 
         (D : forall (x y : A), Dec (x = y)) : Dec (p = q).Fixpoint repeat' X x count : list X :=
  match count with
  | 0        => nil X
  | S count' => cons X x (repeat' X x count')
  end.Fixpoint repeat'' X x count : list X :=
  match count with
  | 0        => nil _
  | S count' => cons _ x (repeat'' _ x count')
  end.Fixpoint repeat''' {X : Type} (x : X) (count : nat) : list X :=
  match count with
  | 0        => nil
  | S count' => cons x (repeat''' x count')
  end.Inductive list' {X:Type} : Type :=
  | nil' : list'
  | cons' : X -> list' -> list'.Inductive list' {X:Type} : Type :=
  | nil' : list'
  | cons' : X -> list' -> list'.Inductive list' {X:Type} : Type :=
  | nil' : list'
  | cons' : X -> list' -> list'.Instance dec_list'' {A} (p q : @list' A) 
         (D : forall (x y : A), Dec (x = y)) : Dec (p = q).Fixpoint app {X : Type} (l1 l2 : list X)
             : (list X) :=
  match l1 with
  | nil      => l2
  | cons h t => cons h (app t l2)
  end.Fixpoint rev {X:Type} (l:list X) : list X :=
  match l with
  | nil      => nil
  | cons h t => app (rev t) (cons h nil)
  end.Fixpoint length {X : Type} (l : list X) : nat :=
  match l with
  | nil => 0
  | cons _ l' => S (length l')
  end.Notation "( x , y )" := (pair x y).

(* Specifications: *)
Theorem app_nil_r : forall (X:Type), forall l:list X, l ++ [] = l.
Theorem app_assoc : forall A (l m n:list A), l ++ m ++ n = (l ++ m) ++ n.
Lemma app_length : forall (X:Type) (l1 l2 : list X), length (l1 ++ l2) = length l1 + length l2.
Theorem rev_app_distr: forall X (l1 l2 : list X), rev (l1 ++ l2) = rev l1 ++ rev l2.
Theorem rev_involutive : forall X : Type, forall l : list X, rev (rev l) = l.