Notation "[ ]" := nil (format "[ ]") : list_scope.Notation "[ x ]" := (cons x nil) : list_scope.Notation "[ x ; y ; .. ; z ]" :=  (cons x (cons y .. (cons z nil) ..))
  (format "[ '[' x ;  '/' y ;  '/' .. ;  '/' z ']' ]") : list_scope.(** Head and tail *)

  Definition hd (default:A) (l:list A) :=
    match l with
      | [] => default
      | x :: _ => x
    end.Definition hd_error (l:list A) :=
    match l with
      | [] => None
      | x :: _ => Some x
    end.Definition tl (l:list A) :=
    match l with
      | [] => []
      | _ :: l' => l'
    end.(** The [In] predicate *)
  Fixpoint In (a:A) (l:list A) : Prop :=
    match l with
      | [] => False
      | b :: l' => b = a \/ In a l'
    end.

Lemma app_inv_head: forall l l1 l2 : list A, l ++ l1 = l ++ l2 -> l1 = l2.