Section dio_ra_enum.
(* Given p = q in dio_eq (pos 1) (pos m), given a total µ-rec function of type recalg 1 that enumerates the solutions  given n compute x#w in vec nat (1+m). Compute p[x][w] = q[x][w]. If equal, return (S x), otherwise return 0 *)
Variable (m : nat) (p q : dio_polynomial (pos m) (pos 1)).
Let f := ra_dio_poly_test p q.
Let Hf x w : {e : nat |
⟦ f ⟧ (x ## w) e /\
(e = 0 <->
dp_eval
(fun i => vec_pos (vec_app (project m x) w) (pos_left 1 i))
(fun i => vec_pos (vec_app (project m x) w) (pos_right m i))
p =
dp_eval
(fun i => vec_pos (vec_app (project m x) w) (pos_left 1 i))
(fun i => vec_pos (vec_app (project m x) w) (pos_right m i)) q) }.
Let Hg1 x : ex (⟦g⟧ (x##vec_nil)).

Theorem dio_poly_eq_2_ra_prim :
{ g : recalg 1 | prim_rec g
/\ forall x, (exists n, ⟦g⟧ (n##vec_nil) (S x))
<-> exists w, dp_eval (vec_pos w) (fun _ => x) p
= dp_eval (vec_pos w) (fun _ => x) q }.