Section NoDup_gen_map.
Variable A B : Type.
Variable ea : A -> A -> Prop.
Variable eb : B -> B -> Prop.
Variable f : A -> B.
Hypothesis ea_symm :
forall a1 a2,
ea a1 a2 -> ea a2 a1.
Hypothesis ea_trans :
forall a1 a2 a3,
ea a1 a2 ->
ea a2 a3 ->
ea a1 a3.
Hypothesis ea_func :
forall a1 a2, ea a1 a2 -> eb (f a1) (f a2).
Hypothesis eb_symm :
forall b1 b2,
eb b1 b2 -> eb b2 b1.
Hypothesis eb_trans :
forall b1 b2 b3,
eb b1 b2 ->
eb b2 b3 ->
eb b1 b3.
Hypothesis ea_refl :
forall a y,
eb (f a) y ->
ea a a .
Hypothesis eb_func :
forall a1 a2,
eb (f a1) (f a2) -> ea a1 a2.
induction l; intuition; simpl in *.
intuition.
destruct H.
intuition.
intuition.
econstructor.
intuition.
eapply eb_symm.
eauto.
left.
eapply ea_refl.
eapply eb_symm.
eauto.
specialize (IHl y).
intuition.
destruct H2.
intuition.
econstructor.
split.
eauto.
intuition.
destruct H.
intuition.
left.
eapply eb_trans.
eapply eb_symm.
eauto.
eapply ea_func.
trivial.
right.
specialize (IHl y).
intuition.
eapply H2.
econstructor.
intuition.
eauto.
trivial.
Qed.
induction ls; intuition; simpl in *.
econstructor.
inversion H; clear H; subst.
econstructor.
intuition.
eapply H2.
eapply In_gen_map_iff in H.
destruct H.
intuition.
eapply In_gen_equiv_compat; [ eauto | eauto | idtac | idtac].
eapply eb_func.
eauto.
trivial.
eauto.
Qed.
End NoDup_gen_map.
induction ls; intuition; simpl in *.
intuition.
Qed.
induction ls; intuition; simpl in *.
econstructor.
inversion H; clear H; subst.
eapply app_NoDup; intuition.
eapply in_flatten in H3.
destruct H3.
intuition.
eapply app_NoDup_inv.
eapply H1.
right.
eapply H6.
left.
reflexivity.
intuition.
subst.
eapply H4.
eapply In_gen_weaken.
exact H6.
intuition.
subst.
subst.
simpl in *.
intuition.
eauto.
eauto.
eapply in_flatten in H2.
destruct H2.
intuition.
eapply app_NoDup_inv.
eapply H1.
right.
eapply H6.
left.
reflexivity.
intuition.
subst.
eapply H4.
eapply In_gen_weaken.
exact H6.
intuition.
subst.
subst.
simpl in *.
intuition.
eauto.
eauto.
Qed.
induction ls; intuition; simpl in *.
econstructor.
inversion H; clear H; subst.
econstructor.
intuition.
eapply H3.
eapply In_gen_weaken; eauto.
eauto.
Qed.
induction lsa; intuition; simpl in *.
destruct lsb;
simpl in *;
intuition.
right.
eauto.
Qed.

Theorem NoDup_gen_zip_fst :
forall (A B : Set)(ea : A -> A -> Prop)(lsa : list A)(lsb : list B),
NoDup_gen ea lsa ->
NoDup_gen (fun a b => ea (fst a) (fst b)) (zip lsa lsb).