Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* <O___,, * (see CREDITS file for the list of authors) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************) Require Import Morphisms BinInt ZDivEucl. Local Open Scope Z_scope.
In this convention, the remainder is always positive.
For other conventions, see Z.div and Z.quot in file BinIntDef.
To avoid collision with the other divisions, we place this one
under a module.
Module ZEuclid. Definition modulo a b := Z.modulo a (Z.abs b). Definition div a b := (Z.sgn b) * (Z.div a (Z.abs b)).Proper (eq ==> eq ==> eq) modulocongruence. Qed.Proper (eq ==> eq ==> eq) moduloProper (eq ==> eq ==> eq) divcongruence. Qed.Proper (eq ==> eq ==> eq) diva, b:Zb <> 0 -> a = b * div a b + modulo a ba, b:Zb <> 0 -> a = b * div a b + modulo a ba, b:ZHb:b <> 0a = b * div a b + modulo a ba, b:ZHb:b <> 0a = b * (Z.sgn b * (a / Z.abs b)) + a mod Z.abs ba, b:ZHb:b <> 0a = b * Z.sgn b * (a / Z.abs b) + a mod Z.abs ba, b:ZHb:b <> 0a = Z.abs b * (a / Z.abs b) + a mod Z.abs bnow destruct b. Qed.a, b:ZHb:b <> 0Z.abs b <> 0a, b:Zb <> 0 -> 0 <= modulo a b < Z.abs ba, b:Zb <> 0 -> 0 <= modulo a b < Z.abs ba, b:ZHb:b <> 00 <= modulo a b < Z.abs ba, b:ZHb:b <> 00 <= a mod Z.abs b < Z.abs ba, b:ZHb:b <> 00 < Z.abs bnow destruct Hb. Qed.a:ZHb:0 <> 0Eq = Lta, b:Z0 <= a -> 0 < b -> 0 <= modulo a b < ba, b:Z0 <= a -> 0 < b -> 0 <= modulo a b < ba, b:ZHb:0 < b0 <= modulo a b < ba, b:ZHb:0 < b0 <= modulo a b < Z.abs bZ.order. Qed. Include ZEuclidProp Z Z Z. End ZEuclid.a, b:ZHb:0 < bb <> 0