Definition dhead a (l : list A) :=
  match l with nil => a | b :: _ => b end.Fixpoint fold2 (l1: list A) (l2: list B) (c: C) {struct l1}: C :=
  match l1, l2 with
    a::l3, b::l4 => fold2 l3 l4 (f a b c)
  | _, _ => c
  end.Fixpoint map2 (l1: list A) (l2: list B) {struct l1}: list C :=
  match l1, l2 with
    a::l3, b::l4 => (g a b)::map2 l3 l4
  | _, _ => nil
  end.

(* Specifications: *)
Lemma map2_length l1 l2: length (map2 l1 l2) = min (length l1) (length l2).