Require Export FunctionProperties.
(* CSB = Cantor-Schroeder-Bernstein theorem *)
Section CSB.
Variable X Y:Type.
Variable f:X->Y.
Variable g:Y->X.
Hypothesis f_inj: injective f.
Hypothesis g_inj: injective g.
Inductive X_even: X->Prop :=
| not_g_img: forall x:X, (forall y:Y, g y <> x) -> X_even x
| g_Y_odd: forall y:Y, Y_odd y -> X_even (g y)
with Y_odd: Y->Prop :=
| f_X_even: forall x:X, X_even x -> Y_odd (f x).
Inductive X_odd: X->Prop :=
| g_Y_even: forall y:Y, Y_even y -> X_odd (g y)
with Y_even: Y->Prop :=
| not_f_img: forall y:Y, (forall x:X, f x <> y) -> Y_even y
| f_X_odd: forall x:X, X_odd x -> Y_even (f x).
Scheme X_even_coind := Minimality for X_even Sort Prop
with Y_odd_coind := Minimality for Y_odd Sort Prop.
Scheme X_odd_coind := Minimality for X_odd Sort Prop
with Y_even_coind := Minimality for Y_even Sort Prop.

(* Specifications: *)
Lemma even_odd_excl: forall x:X, ~(X_even x /\ X_odd x).
Lemma even_odd_excl2: forall y:Y, ~(Y_even y /\ Y_odd y).
Definition finv: forall y:Y, (exists x:X, f x = y) ->
{ x:X | f x = y }.