constructor; repeat intro.
+ destruct H.
destruct x. destruct y. destruct z.
split; simpl in *.
- apply (@paf_join_hom _ _ pafF1 _ _ _ _ _ _ _); auto.
- apply (@paf_join_hom _ _ pafF2 _ _ _ _ _ _ _); auto.
+ (* PU *)
destruct x' as [f0 f1], y as [f2 f3], z as [f4 f5].
destruct H.
simpl in H, H0.
generalize (paf_preserves_unmap_left pafF1 f g f0 f2 f4 H); intro X.
destruct X as [x1 [y01 [? [? ?]]]].
generalize (paf_preserves_unmap_left pafF2 f g f1 f3 f5 H0); intro X.
destruct X as [x2 [y02 [? [? ?]]]].
exists (x1, x2). exists (y01, y02).
split. split...
split; simpl; congruence.
+ destruct x as [f0 f1], y as [f2 f3], z' as [f4 f5].
destruct H.
simpl in H, H0.
generalize (paf_preserves_unmap_right pafF1 f g f0 f2 f4 H); intro X.
destruct X as [y01 [z1 [? [? ?]]]].
generalize (paf_preserves_unmap_right pafF2 f g f1 f3 f5 H0); intro X.
destruct X as [y02 [z2 [? [? ?]]]].
exists (y01, y02). exists (z1, z2).
split. split...
split; simpl; congruence.
Qed.
End PairSAFunctor.
Section CoFunSAFunctor.
Variables (dom: Type) (rng : functor).
Variables (Join_rng: forall A, Join (rng A)) (pss_rng : pafunctor rng Join_rng).
Definition paf_fun : @pafunctor (ffunc (fconst dom) rng)
(fun A => Join_fun dom _ (Join_rng A)).
Proof with auto.
constructor; simpl; intros; intro; intros.
+ intro i.
specialize ( H i).
apply (paf_join_hom pss_rng f g _ _ _ H).
+ set (f' := fun d => paf_preserves_unmap_left pss_rng f g _ _ _ (H d)).
exists (fun d => projT1 (f' d)).
exists (fun d => proj1_sig (projT2 (f' d))).
split.
- intro d. (*spec f' d. *)
destruct (f' d) as [x [y0 [? [? ?]]]]...
- split; extensionality d;
simpl; unfold compose, f';
remember (paf_preserves_unmap_left pss_rng f g (x' d) (y d) (z d) (H d));
destruct s as [x [y0 [? [? ?]]]]...
+ set (f' := fun d => paf_preserves_unmap_right pss_rng f g (x d) (y d) (z' d) (H d)).
exists (fun d => projT1 (f' d)).
exists (fun d => proj1_sig (projT2 (f' d))).
split.
- intro d. (*spec f' d. *)
destruct (f' d) as [y0 [z [? [? ?]]]]...
- split; extensionality d;
simpl; unfold compose, f';
remember (paf_preserves_unmap_right pss_rng f g (x d) (y d) (z' d) (H d));
destruct s as [y0 [z [? [? ?]]]]...
Qed.
End CoFunSAFunctor.
(* (* This one is not used. *)
(* And the assumption, inj_sig, is wierd. *)
Section SigmaSAFunctor.
Variable I:Type.
Variables (F: I -> functor).
Variables (JOIN: forall i A, Join (F i A))
(fSA : forall i, pafunctor (F i) (JOIN i)).
Existing Instance Join_sigma.
Hypothesis inj_sig : forall A i x y,
existT (fun i => F i A) i x = existT (fun i => F i A) i y -> x = y.

(* Specifications: *)
Lemma paf_sigma : @pafunctor (fsig F)
(fun A => Join_sigma I (fun i => F i A) (fun i => JOIN i A)).