Section CPair_projections.
Let searchXY (a : nat) :=
boundedSearch (fun a y : nat => ltBool a (sumToN (S y))) a.
Definition cPairPi1 (a : nat) := a - sumToN (searchXY a).
Definition cPairPi2 (a : nat) := searchXY a - cPairPi1 a.

(* Specifications: *)
Lemma cPairProjectionsHelp :
forall a b : nat, b < sumToN (S a) -> sumToN a <= b -> searchXY b = a.
Lemma cPairProjections : forall a : nat, cPair (cPairPi1 a) (cPairPi2 a) = a.
Remark searchXYIsPR : isPR 1 searchXY.
Lemma cPairPi1IsPR : isPR 1 cPairPi1.
Lemma cPairPi2IsPR : isPR 1 cPairPi2.
Lemma cPairProjections1 : forall a b : nat, cPairPi1 (cPair a b) = a.
Lemma cPairProjections2 : forall a b : nat, cPairPi2 (cPair a b) = b.
End CPair_projections.