proposition: Lemma exercise2_2 x y z w: (xpair x y = xpair z w) <-> (x = z /\ y = w).
proof: Proof. split; last by move=> [] -> ->. move => eq. have fp2: inc (singleton x) (xpair z w) by rewrite -eq /xpair; fprops. have sp2: inc (doubleton x (singleton y)) (xpair z w). by rewrite -eq /xpair; fprops. have xz: x=z. case /set2_P: fp2; first by apply: set1_inj. by move=> sd; symmetry; apply: set1_eq; ue. split=>//. rewrite xz in sp2. case /set2_P: sp2 => hyp. symmetry. have syz: (singleton y = z) by apply: set1_eq; ue. have: (inc (doubleton z (singleton w)) (xpair x y)). by rewrite eq /xpair; fprops. rewrite xz /xpair hyp; move/set1_P => zwz. have: (singleton w = z) by apply: set1_eq; ue. by rewrite - syz; apply: set1_inj. apply: set1_inj. have sp3: (inc (singleton w) (doubleton z (singleton y))) by ue. case /set2_P: sp3 => sp4; last by symmetry. have sp5: (inc (singleton y) (doubleton z (singleton w))) by ue. by case /set2_P: sp5; try ue. Qed.
imports: mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat)