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).

Lemma app_length : forall (X:Type) (l1 l2 : list X), length (l1 ++ l2) = length l1 + length l2.