Inductive larger_bound : positive -> positive -> Type :=
| larger_1  : forall b, larger_bound xH b
| larger_xI : forall x b, larger_bound x b -> larger_bound (xI x) (xO b)
| larger_xO : forall x b, larger_bound x b -> larger_bound (xO x) (xO b).

Lemma mul_mod_aux_correct p1 p2 m: forall n tp1 tp2 tn tm,
m <> 0 ->
larger_bound p1 p2 ->
evaluates tp1 (value_of_pos p1) ->
evaluates tp2 (value_of_pos p2) ->
evaluates tn (value_of_N n) ->
evaluates tm (value_of_N m) ->
evaluates (mul_mod_auxF (: tp1, tn, tm, tp2 :))
((N.pos p1 * n) mod m).