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_correct l : Zlength l = Z.of_nat (length l).