Fixpoint pairmap x s := if s is y :: s' then f x y :: pairmap y s' else [::].

(* Specifications: *)
Lemma size_pairmap x s : size (pairmap x s) = size s.
Lemma pairmap_cat x s1 s2 : pairmap x (s1 ++ s2) = pairmap x s1 ++ pairmap (last x s1) s2.
Lemma nth_pairmap s n : n < size s -> forall x, nth x2 (pairmap x s) n = f (nth x1 (x :: s) n) (nth x1 s n).