Definition allpairs s t := foldr (fun x => cat (map (f x) t)) [::] s.

(* Specifications: *)
Lemma size_allpairs s t : size (allpairs s t) = size s * size t.
Lemma allpairs_cat s1 s2 t : allpairs (s1 ++ s2) t = allpairs s1 t ++ allpairs s2 t.