fact: Fixpoint Pmod (a b : positive) {struct a} : N := match a with | xH => if 1 ?< b then 1%N else 0%N | xO a' => let r := Pmod a' b in match r with | N0 => 0%N | Npos r' => if (xO r') ?< b then Npos (xO r') else PminusN (xO r') b end | xI a' => let r := Pmod a' b in match r with | N0 => if 1 ?< b then 1%N else 0%N | Npos r' => if (xI r') ?< b then Npos (xI r') else PminusN (xI r') b end end.
imports: ZArith Lia ZCmisc