From 6b62e98a0809a9ac22e64f82943473994e79bfaf Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Mon, 6 Dec 2021 17:11:43 +0100 Subject: ExtZ --- kvx/ExtZ.v | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 kvx/ExtZ.v (limited to 'kvx/ExtZ.v') diff --git a/kvx/ExtZ.v b/kvx/ExtZ.v new file mode 100644 index 00000000..095fd0cc --- /dev/null +++ b/kvx/ExtZ.v @@ -0,0 +1,12 @@ +Require Import Coq.ZArith.Zdiv. + +Open Scope Z. + +Definition Zdiv_ne (a b : Z) := + let q := Z.div a b in + let q1 := Z.succ q in + match Z.compare (a-b*q) (b*q1-a) with + | Lt => q + | Gt => q1 + | Eq => (if Z.even q then q else q1) + end. -- cgit