Fixpoint Zlength_aux (acc:Z) (A:Type) (l:list A) : Z :=
  match l with
    | nil => acc
    | _ :: l => Zlength_aux (Z.succ acc) A l
  end.Definition Zlength := Zlength_aux 0.Implicit Type l : list A.

Lemma Zlength_nil_inv l : Zlength l = 0 -> l = nil.