unfold app_rel, cart_eq in |- *; intuition.
Qed.
Hint Resolve coupl_proj: algebra.
End Projections.
Section Maps.
Variable E F G : Setoid.
Definition curry (f : MAP (cart E F) G) (x : E) (y : F) := f (couple x y).
Definition fun2_compatible (f : E -> F -> G) :=
forall (x x' : E) (y y' : F),
Equal x x' -> Equal y y' -> Equal (f x y) (f x' y').
Definition uncurry :
forall f : E -> F -> G, fun2_compatible f -> MAP (cart E F) G.
intros f H'; try assumption.
apply (Build_Map (Ap:=fun x : cart E F => f (proj1 x) (proj2 x))).
red in |- *.
intros x y; try assumption.
elim x.
elim y.
simpl in |- *.
unfold app_rel, cart_eq in |- *; intuition.
Defined.
Variable f : MAP E (cart F G).
Definition map_proj1 : MAP E F := comp_map_map (proj1_map F G) f.
Definition map_proj2 : MAP E G := comp_map_map (proj2_map F G) f.
Definition map_couple : MAP E F -> MAP E G -> MAP E (cart F G).
intros g h.
apply (Build_Map (Ap:=fun x : E => couple (g x) (h x))).
red in |- *.
intros x y H'; try assumption.
apply couple_comp; auto with algebra.
Defined.

(* Specifications: *)
Lemma map_couple_proj_prop : Equal (map_couple map_proj1 map_proj2) f.
simpl in |- *.