fact: Definition Zmodd a b := match a with | Z0 => 0 | Zpos a' => match b with | Z0 => ltac:(match eval hnf in (1 mod 0) with | 0 => exact 0 | _ => exact a end) | Zpos _ => Zmod_POS a' b | Zneg b' => let r := Zmod_POS a' (Zpos b') in match r with Z0 => 0 | _ => b + r end end | Zneg a' => match b with | Z0 => ltac:(match eval hnf in (1 mod 0) with | 0 => exact 0 | _ => exact a end) | Zpos _ => let r := Zmod_POS a' b in match r with Z0 => 0 | _ => b - r end | Zneg b' => - (Zmod_POS a' (Zpos b')) end end.
imports: ArithRing ZArith Zpow_facts Znumtheory Tactic