Section two_lists_rect.
Variables (T: Type) (P: list T -> list T -> Type)
(Pnil_l: forall x, P nil x) (Pnil_r: forall x, P x nil)
(Pcons: forall x x' y y', P x' (y :: y') -> P (x :: x') y' -> P (x :: x') (y :: y')).
Let R: relation (list T * list T) := pair_rel (ltof (list T) (@length _)) (ltof (list T) (@length _)).
Let wf_R: well_founded R.
*)

Lemma concatMap_concatMap' T U V (g: T -> list U) (f: U -> list V) l:
concat (map f (concat (map g l))) = concat (map (concat ∘ map f ∘ g) l).