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) *)
(************************************************************************)
Properties of the greatest common divisor
Require Import ZAxioms ZMulOrder ZSgnAbs NZGcd. Module Type ZGcdProp (Import A : ZAxiomsSig') (Import B : ZMulOrderProp A) (Import C : ZSgnAbsProp A B). Include NZGcdProp A A B.
Results concerning divisibility
forall n m : t, (- n | m) <-> (n | m)forall n m : t, (- n | m) <-> (n | m)n, m:t(- n | m) <-> (n | m)n, m, p:tHp:m == p * - np * - n == - p * nn, m, p:tHp:m == p * np * n == - p * - nnow rewrite mul_opp_opp. Qed.n, m, p:tHp:m == p * np * n == - p * - nforall n m : t, (n | - m) <-> (n | m)forall n m : t, (n | - m) <-> (n | m)n, m:t(n | - m) <-> (n | m)n, m, p:tHp:- m == p * nm == - p * nn, m, p:tHp:m == p * n- m == - p * nnow rewrite Hp, mul_opp_l. Qed.n, m, p:tHp:m == p * n- m == - p * nforall n m : t, (abs n | m) <-> (n | m)forall n m : t, (abs n | m) <-> (n | m)n, m:t(abs n | m) <-> (n | m)n, m:tH:abs n == n(n | m) <-> (n | m)n, m:tH:abs n == - n(- n | m) <-> (n | m)apply divide_opp_l. Qed.n, m:tH:abs n == - n(- n | m) <-> (n | m)forall n m : t, (n | abs m) <-> (n | m)forall n m : t, (n | abs m) <-> (n | m)n, m:t(n | abs m) <-> (n | m)n, m:tH:abs m == m(n | m) <-> (n | m)n, m:tH:abs m == - m(n | - m) <-> (n | m)apply divide_opp_r. Qed.n, m:tH:abs m == - m(n | - m) <-> (n | m)forall n : t, (n | 1) -> abs n == 1forall n : t, (n | 1) -> abs n == 1n:tHn:(n | 1)abs n == 1n:tHn:(n | 1)0 <= abs nn:tHn:(n | 1)(abs n | 1)now apply divide_abs_l. Qed.n:tHn:(n | 1)(abs n | 1)forall n : t, (n | 1) -> n == 1 \/ n == -1forall n : t, (n | 1) -> n == 1 \/ n == -1n, m:tH:1 == m * nn == 1 \/ n == -1now apply eq_mul_1 with m. Qed.n, m:tH:1 == n * mn == 1 \/ n == -1forall n m : t, (n | m) -> (m | n) -> abs n == abs mforall n m : t, (n | m) -> (m | n) -> abs n == abs mn, m:tH:(n | m)H0:(m | n)abs n == abs mn, m:tH:(n | m)H0:(m | n)(abs n | abs m)n, m:tH:(n | m)H0:(m | n)(abs m | abs n)now apply divide_abs_l, divide_abs_r. Qed.n, m:tH:(n | m)H0:(m | n)(abs m | abs n)forall n m : t, (n | m) -> (m | n) -> n == m \/ n == - mforall n m : t, (n | m) -> (m | n) -> n == m \/ n == - mnow apply abs_eq_cases, divide_antisym_abs. Qed.n, m:tH:(n | m)H0:(m | n)n == m \/ n == - mforall n m p : t, (n | m) -> (n | p) -> (n | m - p)forall n m p : t, (n | m) -> (n | p) -> (n | m - p)n, m, p:tH:(n | m)H':(n | p)(n | m - p)n, m, p:tH:(n | m)H':(n | p)(n | m + - p)now apply divide_opp_r. Qed.n, m, p:tH:(n | m)H':(n | p)(n | - p)forall n m p : t, (n | m) -> (n | m + p) -> (n | p)forall n m p : t, (n | m) -> (n | m + p) -> (n | p)n, m, p:tH:(n | m)H':(n | m + p)(n | p)now apply divide_sub_r. Qed.n, m, p:tH:(n | m)H':(n | m + p)(n | m + p - m)
Properties of gcd
forall n m : t, gcd (- n) m == gcd n mforall n m : t, gcd (- n) m == gcd n mn, m:tgcd (- n) m == gcd n mn, m:tforall q : t, (q | gcd n m) <-> (q | - n) /\ (q | m)n, m, q:t(q | gcd n m) <-> (q | - n) /\ (q | m)apply gcd_divide_iff. Qed.n, m, q:t(q | gcd n m) <-> (q | n) /\ (q | m)forall n m : t, gcd n (- m) == gcd n mforall n m : t, gcd n (- m) == gcd n mnow rewrite gcd_comm, gcd_opp_l, gcd_comm. Qed.n, m:tgcd n (- m) == gcd n mforall n m : t, gcd (abs n) m == gcd n mforall n m : t, gcd (abs n) m == gcd n mn, m:tgcd (abs n) m == gcd n mn, m:tH:abs n == ngcd n m == gcd n mn, m:tH:abs n == - ngcd (- n) m == gcd n mapply gcd_opp_l. Qed.n, m:tH:abs n == - ngcd (- n) m == gcd n mforall n m : t, gcd n (abs m) == gcd n mforall n m : t, gcd n (abs m) == gcd n mnow rewrite gcd_comm, gcd_abs_l, gcd_comm. Qed.n, m:tgcd n (abs m) == gcd n mforall n : t, gcd 0 n == abs nforall n : t, gcd 0 n == abs nn:tgcd 0 n == abs napply gcd_0_l_nonneg, abs_nonneg. Qed.n:tgcd 0 (abs n) == abs nforall n : t, gcd n 0 == abs nforall n : t, gcd n 0 == abs nnow rewrite gcd_comm, gcd_0_l. Qed.n:tgcd n 0 == abs nforall n : t, gcd n n == abs nforall n : t, gcd n n == abs nn:tgcd n n == abs napply gcd_diag_nonneg, abs_nonneg. Qed.n:tgcd (abs n) (abs n) == abs nforall n m p : t, gcd n (m + p * n) == gcd n mforall n m p : t, gcd n (m + p * n) == gcd n mn, m, p:tgcd n (m + p * n) == gcd n mn, m, p:tforall q : t, (q | gcd n m) <-> (q | n) /\ (q | m + p * n)n, m, p, q:t(q | gcd n m) <-> (q | n) /\ (q | m + p * n)n, m, p, q:t(q | n) /\ (q | m) <-> (q | n) /\ (q | m + p * n)n, m, p, q:tU:(q | n)V:(q | m)(q | m + p * n)n, m, p, q:tU:(q | n)V:(q | m + p * n)(q | m)n, m, p, q:tU:(q | n)V:(q | m)(q | p * n)n, m, p, q:tU:(q | n)V:(q | m + p * n)(q | m)n, m, p, q:tU:(q | n)V:(q | m + p * n)(q | m)n, m, p, q:tU:(q | n)V:(q | m + p * n)(q | p * n)n, m, p, q:tU:(q | n)V:(q | m + p * n)(q | p * n + m)now rewrite add_comm. Qed.n, m, p, q:tU:(q | n)V:(q | m + p * n)(q | p * n + m)forall n m : t, gcd n (m + n) == gcd n mforall n m : t, gcd n (m + n) == gcd n mn, m:tgcd n (m + n) == gcd n mapply gcd_add_mult_diag_r. Qed.n, m:tgcd n (m + 1 * n) == gcd n mforall n m : t, gcd n (m - n) == gcd n mforall n m : t, gcd n (m - n) == gcd n mn, m:tgcd n (m - n) == gcd n mn, m:tgcd n (m - 1 * n) == gcd n mapply gcd_add_mult_diag_r. Qed. Definition Bezout n m p := exists a b, a*n + b*m == p.n, m:tgcd n (m + -1 * n) == gcd n mProper (eq ==> eq ==> eq ==> iff) BezoutProper (eq ==> eq ==> eq ==> iff) BezoutProper (eq ==> eq ==> eq ==> iff) (fun n m p : t => exists a b : t, a * n + b * m == p)x, x':tHx:x == x'y, y':tHy:y == y'z, z':tHz:z == z'(exists a b : t, a * x + b * y == z) <-> (exists a b : t, a * x' + b * y' == z')x, x':tHx:x == x'y, y':tHy:y == y'z, z':tHz:z == z'(exists a b : t, a * x' + b * y == z) <-> (exists a b : t, a * x' + b * y' == z')now setoid_rewrite Hz. Qed.x, x':tHx:x == x'y, y':tHy:y == y'z, z':tHz:z == z'(exists a b : t, a * x' + b * y' == z) <-> (exists a b : t, a * x' + b * y' == z')forall n m : t, Bezout n m 1 -> gcd n m == 1forall n m : t, Bezout n m 1 -> gcd n m == 1n, m, q, r:tH:q * n + r * m == 1gcd n m == 1n, m, q, r:tH:q * n + r * m == 1forall q0 : t, (q0 | n) -> (q0 | m) -> (q0 | 1)n, m, q, r:tH:q * n + r * m == 1p:tHn:(p | n)Hm:(p | m)(p | 1)apply divide_add_r; now apply divide_mul_r. Qed.n, m, q, r:tH:q * n + r * m == 1p:tHn:(p | n)Hm:(p | m)(p | q * n + r * m)forall n m p : t, gcd n m == p -> Bezout n m p(* First, a version restricted to natural numbers *)forall n m p : t, gcd n m == p -> Bezout n m pforall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 <= n(fun t0 : t => forall m : t, 0 <= m -> Bezout t0 m (gcd t0 m)) naux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 <= nProper (eq ==> iff) (fun t0 : t => forall m : t, 0 <= m -> Bezout t0 m (gcd t0 m))n:tHn:0 <= nforall n0 : t, 0 <= n0 -> (forall m : t, 0 <= m -> m < n0 -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)) -> forall m : t, 0 <= m -> Bezout n0 m (gcd n0 m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 <= nProper (eq ==> iff) (fun t0 : t => forall m : t, 0 <= m -> exists a b : t, a * t0 + b * m == gcd t0 m)n:tHn:0 <= nforall n0 : t, 0 <= n0 -> (forall m : t, 0 <= m -> m < n0 -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)) -> forall m : t, 0 <= m -> Bezout n0 m (gcd n0 m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 <= nforall n0 : t, 0 <= n0 -> (forall m : t, 0 <= m -> m < n0 -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)) -> forall m : t, 0 <= m -> Bezout n0 m (gcd n0 m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pforall n : t, 0 <= n -> (forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)) -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 <= nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= m(fun t0 : t => Bezout n t0 (gcd n t0)) mn:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mProper (eq ==> iff) (fun t0 : t => Bezout n t0 (gcd n t0))n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mforall n0 : t, 0 <= n0 -> (forall m0 : t, 0 <= m0 -> m0 < n0 -> Bezout n m0 (gcd n m0)) -> Bezout n n0 (gcd n n0)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mProper (eq ==> iff) (fun t0 : t => exists a b : t, a * n + b * t0 == gcd n t0)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mforall n0 : t, 0 <= n0 -> (forall m0 : t, 0 <= m0 -> m0 < n0 -> Bezout n m0 (gcd n m0)) -> Bezout n n0 (gcd n n0)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mforall n0 : t, 0 <= n0 -> (forall m0 : t, 0 <= m0 -> m0 < n0 -> Bezout n m0 (gcd n m0)) -> Bezout n n0 (gcd n n0)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall n0 : t, 0 <= n0 -> (forall m : t, 0 <= m -> m < n0 -> Bezout n m (gcd n m)) -> Bezout n n0 (gcd n n0)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)Bezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m p(* n < m *)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < m0 <= m - nn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < mm - n < mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n (m - n)Bezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < mm - n < mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n (m - n)Bezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n (m - n)Bezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n (m - n)exists b0 : t, (a - b) * n + b0 * m == gcd n mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n (m - n)(a - b) * n + b * m == gcd n mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n m(a - b) * n + b * m == gcd n mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n m(a - b) * n + b * m == a * n + b * (m - n)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:n < ma, b:tEQ:a * n + b * (m - n) == gcd n ma * n - b * n + b * m == a * n + (b * m - b * n)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m p(* n = m *)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout n m (gcd n m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout m m (gcd m m)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mBezout m m mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == mexists b : t, 1 * m + b * m == mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)EQ:n == m1 * m + 0 * m == mn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m p(* m < n *)n:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < n0 <= nn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < na, b:tEQ:a * m + b * n == gcd m nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < na, b:tEQ:a * m + b * n == gcd m nBezout n m (gcd n m)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < na, b:tEQ:a * m + b * n == gcd m nexists b0 : t, b * n + b0 * m == gcd n mn:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 < nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mIHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)LT:m < na, b:tEQ:a * m + b * n == gcd m nb * n + a * m == gcd n mn:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m p(* n = 0 *)n:tHn:0 == nIHn:forall m : t, 0 <= m -> m < n -> forall m0 : t, 0 <= m0 -> Bezout m m0 (gcd m m0)forall m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 == nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mBezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 == nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mBezout 0 m maux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 == nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= mexists b : t, 0 * 0 + b * m == maux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m pn:tHn:0 == nIHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)m:tHm:0 <= m0 * 0 + 1 * m == maux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m p(* Then we relax the positivity condition on n *)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)forall n m : t, 0 <= m -> Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mBezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:0 <= nBezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:n <= 0Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:n <= 0Bezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:n <= 0Hn':0 <= - nBezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:n <= 0Hn':0 <= - na, b:tEQ:a * - n + b * m == gcd (- n) mBezout n m (gcd n m)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:n <= 0Hn':0 <= - na, b:tEQ:a * - n + b * m == gcd (- n) mexists b0 : t, - a * n + b0 * m == gcd n maux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m:tHm:0 <= mH:n <= 0Hn':0 <= - na, b:tEQ:a * - n + b * m == gcd (- n) m- a * n + b * m == gcd n maux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m p(* And finally we do the same for m *)aux:forall n : t, 0 <= n -> forall m : t, 0 <= m -> Bezout n m (gcd n m)aux':forall n m : t, 0 <= m -> Bezout n m (gcd n m)forall n m p : t, gcd n m == p -> Bezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tHp:gcd n m == pBezout n m paux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tBezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:0 <= mBezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:m <= 0Bezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:m <= 0Bezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:m <= 0Hm':0 <= - mBezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:m <= 0Hm':0 <= - ma, b:tEQ:a * n + b * - m == gcd n (- m)Bezout n m (gcd n m)aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:m <= 0Hm':0 <= - ma, b:tEQ:a * n + b * - m == gcd n (- m)exists b0 : t, a * n + b0 * m == gcd n mnow rewrite <- gcd_opp_r, <- EQ, mul_opp_r, mul_opp_l. Qed.aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)aux':forall n0 m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)n, m, p:tH:m <= 0Hm':0 <= - ma, b:tEQ:a * n + b * - m == gcd n (- m)a * n + - b * m == gcd n mforall n m p : t, gcd (p * n) (p * m) == abs p * gcd n mforall n m p : t, gcd (p * n) (p * m) == abs p * gcd n mn, m, p:tgcd (p * n) (p * m) == abs p * gcd n mn, m, p:t0 <= abs p * gcd n mn, m, p:t(abs p * gcd n m | p * n)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p:t(abs p * gcd n m | p * n)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:n == q * gcd n m(abs p * gcd n m | p * n)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:n == q * gcd n m(abs p * gcd n m | p * (q * gcd n m))n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:n == q * gcd n m(abs p * gcd n m | p * q * gcd n m)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:n == q * gcd n m(abs p | p * q)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:n == q * gcd n m(abs p | abs p * sgn p * q)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:n == q * gcd n m(abs p | abs p * (sgn p * q))n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p:t(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:m == q * gcd n m(abs p * gcd n m | p * m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:m == q * gcd n m(abs p * gcd n m | p * (q * gcd n m))n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:m == q * gcd n m(abs p * gcd n m | p * q * gcd n m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:m == q * gcd n m(abs p | p * q)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:m == q * gcd n m(abs p | abs p * sgn p * q)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tHq:m == q * gcd n m(abs p | abs p * (sgn p * q))n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p:tforall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)n, m, p, q:tH:(q | p * n)H':(q | p * m)(q | abs p * gcd n m)n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | abs p * gcd n m)n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * sgn p * (a * n) + p * sgn p * (b * m))n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * sgn p * (a * n))n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * sgn p * (b * m))n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * n * (sgn p * a))n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * sgn p * (b * m))n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * sgn p * (b * m))now apply divide_mul_l. Qed.n, m, p, q:tH:(q | p * n)H':(q | p * m)a, b:tEQ:a * n + b * m == gcd n m(q | p * m * (sgn p * b))forall n m p : t, 0 <= p -> gcd (p * n) (p * m) == p * gcd n mforall n m p : t, 0 <= p -> gcd (p * n) (p * m) == p * gcd n mn, m, p:tH:0 <= pgcd (p * n) (p * m) == p * gcd n mapply gcd_mul_mono_l. Qed.n, m, p:tH:0 <= pgcd (p * n) (p * m) == abs p * gcd n mforall n m p : t, gcd (n * p) (m * p) == gcd n m * abs pforall n m p : t, gcd (n * p) (m * p) == gcd n m * abs pnow rewrite !(mul_comm _ p), gcd_mul_mono_l, mul_comm. Qed.n, m, p:tgcd (n * p) (m * p) == gcd n m * abs pforall n m p : t, 0 <= p -> gcd (n * p) (m * p) == gcd n m * pforall n m p : t, 0 <= p -> gcd (n * p) (m * p) == gcd n m * pn, m, p:tH:0 <= pgcd (n * p) (m * p) == gcd n m * papply gcd_mul_mono_r. Qed.n, m, p:tH:0 <= pgcd (n * p) (m * p) == gcd n m * abs pforall n m p : t, (n | m * p) -> gcd n m == 1 -> (n | p)forall n m p : t, (n | m * p) -> gcd n m == 1 -> (n | p)n, m, p:tH:(n | m * p)G:gcd n m == 1(n | p)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | p)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | a * n * p + b * m * p)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | a * n * p)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | b * m * p)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | a * p * n)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | b * m * p)n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | b * m * p)now apply divide_mul_r. Qed.n, m, p:tH:(n | m * p)G:gcd n m == 1a, b:tEQ:a * n + b * m == 1(n | b * (m * p))forall n m p : t, n ~= 0 -> (n | m * p) -> exists q r : t, n == q * r /\ (q | m) /\ (r | p)forall n m p : t, n ~= 0 -> (n | m * p) -> exists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)exists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 <= gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n mexists q0 r : t, n == q0 * r /\ (q0 | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n mexists r : t, n == gcd n m * r /\ (gcd n m | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n mn == gcd n m * q /\ (gcd n m | m) /\ (q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n mn == gcd n m * qn, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n m(gcd n m | m) /\ (q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n m(gcd n m | m) /\ (q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n m(gcd n m | m)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 < gcd n mq:tHq:n == q * gcd n mr:tHr:m == r * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(n | r * gcd n m * p)Hr:m == r * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(q * gcd n m | r * gcd n m * p)Hr:m == r * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(q * gcd n m | r * p * gcd n m)Hr:m == r * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(q | r * p)Hr:m == r * gcd n m(q | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(q | r * p)Hr:m == r * gcd n mgcd q r == 1n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(q | r * p)Hr:m == r * gcd n mgcd q r * gcd n m == 1 * gcd n mn, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0G:0 < gcd n mq:tHq:n == q * gcd n mr:tH:(q | r * p)Hr:m == r * gcd n mgcd q r * gcd n m == gcd n mn, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:0 == gcd n mexists q r : t, n == q * r /\ (q | m) /\ (r | p)n, m, p:tHn:n ~= 0H:(n | m * p)G:gcd n m == 0exists q r : t, n == q * r /\ (q | m) /\ (r | p)destruct G as (Hn',_); order. Qed.n, m, p:tHn:n ~= 0H:(n | m * p)G:n == 0 /\ m == 0exists q r : t, n == q * r /\ (q | m) /\ (r | p)
TODO : more about rel_prime (i.e. gcd == 1), about prime ...
End ZGcdProp.