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.
*)
Proof with auto.
induction l...
simpl.
rewrite <- IHl.
unfold Basics.compose.
rewrite map_app.
rewrite concat_app...
Qed.
Proof with auto.
induction l...
simpl.
intros.
rewrite IHl...
rewrite H...
Qed.
Hint Resolve Permutation_concat.
Proof with auto.
induction l...
simpl.
rewrite IHl.
repeat rewrite concat_app.
simpl.
rewrite app_ass.
apply Permutation_app...
rewrite Permutation_app_swap.
rewrite app_ass.
apply Permutation_app...
apply Permutation_app_swap.
Qed.

Lemma concat_product T U V (f: U -> T -> list V) l l':
Permutation
(concat (map (fun x => concat (map (fun y => f y x) l')) l))
(concat (map (fun x => concat (map (f x) l)) l')).