Definition rgcdpT (p : polyF) (q : polyF) : cps polyF :=
let aux p1 q1 : cps polyF :=
'let b <- isnull p1; if b then ret q1
else 'let n <- sizeT p1; rgcdp_loopT n p1 q1 in
'let b <- lt_sizeT p q; if b then aux q p else aux p q.

(* Specifications: *)
Lemma rgcdpTP (k : polyF -> fF) :
(forall p e, qf_eval e (k p) = qf_eval e (k (lift (eval_poly e p)))) ->
forall p q e, qf_eval e (rgcdpT p q k) =
qf_eval e (k (lift (rgcdp (eval_poly e p) (eval_poly e q)))).
Lemma rgcdpT_qf (p : polyF) (q : polyF) :
rpoly p -> rpoly q -> qf_cps rpoly (rgcdpT p q).