apply gcd_inv_Ol_aux with (a := 0); auto.
Qed.
Definition gcd' :=
gcd_rec (fun _ _ : nat => nat) (fun x : nat => x)
(fun x : nat => x) (fun x y r : nat => r) (fun x y r : nat => r).

Lemma gcd_ex : forall a b : nat, {r : nat | gcd_spec a b r}.
intros a b; pattern b, a in |- *; apply gcd_rec; clear a b.