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:t
Hp:m == p * - n

p * - n == - p * n
n, m, p:t
Hp:m == p * n
p * n == - p * - n
n, m, p:t
Hp:m == p * n

p * n == - p * - n
now rewrite mul_opp_opp. Qed.

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:t
Hp:- m == p * n

m == - p * n
n, m, p:t
Hp:m == p * n
- m == - p * n
n, m, p:t
Hp:m == p * n

- m == - p * n
now rewrite Hp, mul_opp_l. Qed.

forall 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:t
H:abs n == n

(n | m) <-> (n | m)
n, m:t
H:abs n == - n
(- n | m) <-> (n | m)
n, m:t
H:abs n == - n

(- n | m) <-> (n | m)
apply divide_opp_l. Qed.

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:t
H:abs m == m

(n | m) <-> (n | m)
n, m:t
H:abs m == - m
(n | - m) <-> (n | m)
n, m:t
H:abs m == - m

(n | - m) <-> (n | m)
apply divide_opp_r. Qed.

forall n : t, (n | 1) -> abs n == 1

forall n : t, (n | 1) -> abs n == 1
n:t
Hn:(n | 1)

abs n == 1
n:t
Hn:(n | 1)

0 <= abs n
n:t
Hn:(n | 1)
(abs n | 1)
n:t
Hn:(n | 1)

(abs n | 1)
now apply divide_abs_l. Qed.

forall n : t, (n | 1) -> n == 1 \/ n == -1

forall n : t, (n | 1) -> n == 1 \/ n == -1
n, m:t
H:1 == m * n

n == 1 \/ n == -1
n, m:t
H:1 == n * m

n == 1 \/ n == -1
now apply eq_mul_1 with m. Qed.

forall n m : t, (n | m) -> (m | n) -> abs n == abs m

forall n m : t, (n | m) -> (m | n) -> abs n == abs m
n, m:t
H:(n | m)
H0:(m | n)

abs n == abs m
n, m:t
H:(n | m)
H0:(m | n)

(abs n | abs m)
n, m:t
H:(n | m)
H0:(m | n)
(abs m | abs n)
n, m:t
H:(n | m)
H0:(m | n)

(abs m | abs n)
now apply divide_abs_l, divide_abs_r. Qed.

forall n m : t, (n | m) -> (m | n) -> n == m \/ n == - m

forall n m : t, (n | m) -> (m | n) -> n == m \/ n == - m
n, m:t
H:(n | m)
H0:(m | n)

n == m \/ n == - m
now apply abs_eq_cases, divide_antisym_abs. Qed.

forall 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:t
H:(n | m)
H':(n | p)

(n | m - p)
n, m, p:t
H:(n | m)
H':(n | p)

(n | m + - p)
n, m, p:t
H:(n | m)
H':(n | p)

(n | - p)
now apply divide_opp_r. Qed.

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:t
H:(n | m)
H':(n | m + p)

(n | p)
n, m, p:t
H:(n | m)
H':(n | m + p)

(n | m + p - m)
now apply divide_sub_r. Qed.
Properties of gcd

forall n m : t, gcd (- n) m == gcd n m

forall n m : t, gcd (- n) m == gcd n m
n, m:t

gcd (- n) m == gcd n m
n, m:t

forall q : t, (q | gcd n m) <-> (q | - n) /\ (q | m)
n, m, 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.

forall n m : t, gcd n (- m) == gcd n m

forall n m : t, gcd n (- m) == gcd n m
n, m:t

gcd n (- m) == gcd n m
now rewrite gcd_comm, gcd_opp_l, gcd_comm. Qed.

forall n m : t, gcd (abs n) m == gcd n m

forall n m : t, gcd (abs n) m == gcd n m
n, m:t

gcd (abs n) m == gcd n m
n, m:t
H:abs n == n

gcd n m == gcd n m
n, m:t
H:abs n == - n
gcd (- n) m == gcd n m
n, m:t
H:abs n == - n

gcd (- n) m == gcd n m
apply gcd_opp_l. Qed.

forall n m : t, gcd n (abs m) == gcd n m

forall n m : t, gcd n (abs m) == gcd n m
n, m:t

gcd n (abs m) == gcd n m
now rewrite gcd_comm, gcd_abs_l, gcd_comm. Qed.

forall n : t, gcd 0 n == abs n

forall n : t, gcd 0 n == abs n
n:t

gcd 0 n == abs n
n:t

gcd 0 (abs n) == abs n
apply gcd_0_l_nonneg, abs_nonneg. Qed.

forall n : t, gcd n 0 == abs n

forall n : t, gcd n 0 == abs n
n:t

gcd n 0 == abs n
now rewrite gcd_comm, gcd_0_l. Qed.

forall n : t, gcd n n == abs n

forall n : t, gcd n n == abs n
n:t

gcd n n == abs n
n:t

gcd (abs n) (abs n) == abs n
apply gcd_diag_nonneg, abs_nonneg. Qed.

forall n m p : t, gcd n (m + p * n) == gcd n m

forall n m p : t, gcd n (m + p * n) == gcd n m
n, m, p:t

gcd n (m + p * n) == gcd n m
n, m, p:t

forall 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:t
U:(q | n)
V:(q | m)

(q | m + p * n)
n, m, p, q:t
U:(q | n)
V:(q | m + p * n)
(q | m)
n, m, p, q:t
U:(q | n)
V:(q | m)

(q | p * n)
n, m, p, q:t
U:(q | n)
V:(q | m + p * n)
(q | m)
n, m, p, q:t
U:(q | n)
V:(q | m + p * n)

(q | m)
n, m, p, q:t
U:(q | n)
V:(q | m + p * n)

(q | p * n)
n, m, p, q:t
U:(q | n)
V:(q | m + p * n)
(q | p * n + m)
n, m, p, q:t
U:(q | n)
V:(q | m + p * n)

(q | p * n + m)
now rewrite add_comm. Qed.

forall n m : t, gcd n (m + n) == gcd n m

forall n m : t, gcd n (m + n) == gcd n m
n, m:t

gcd n (m + n) == gcd n m
n, m:t

gcd n (m + 1 * n) == gcd n m
apply gcd_add_mult_diag_r. Qed.

forall n m : t, gcd n (m - n) == gcd n m

forall n m : t, gcd n (m - n) == gcd n m
n, m:t

gcd n (m - n) == gcd n m
n, m:t

gcd n (m - 1 * n) == gcd n m
n, m:t

gcd n (m + -1 * n) == gcd n m
apply gcd_add_mult_diag_r. Qed. Definition Bezout n m p := exists a b, a*n + b*m == p.

Proper (eq ==> eq ==> eq ==> iff) Bezout

Proper (eq ==> eq ==> eq ==> iff) Bezout

Proper (eq ==> eq ==> eq ==> iff) (fun n m p : t => exists a b : t, a * n + b * m == p)
x, x':t
Hx:x == x'
y, y':t
Hy:y == y'
z, z':t
Hz:z == z'

(exists a b : t, a * x + b * y == z) <-> (exists a b : t, a * x' + b * y' == z')
x, x':t
Hx:x == x'
y, y':t
Hy:y == y'
z, z':t
Hz:z == z'

(exists a b : t, a * x' + b * y == z) <-> (exists a b : t, a * x' + b * y' == z')
x, x':t
Hx:x == x'
y, y':t
Hy:y == y'
z, z':t
Hz: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.

forall n m : t, Bezout n m 1 -> gcd n m == 1

forall n m : t, Bezout n m 1 -> gcd n m == 1
n, m, q, r:t
H:q * n + r * m == 1

gcd n m == 1
n, m, q, r:t
H:q * n + r * m == 1

forall q0 : t, (q0 | n) -> (q0 | m) -> (q0 | 1)
n, m, q, r:t
H:q * n + r * m == 1
p:t
Hn:(p | n)
Hm:(p | m)

(p | 1)
n, m, q, r:t
H:q * n + r * m == 1
p:t
Hn:(p | n)
Hm:(p | m)

(p | q * n + r * m)
apply divide_add_r; now apply divide_mul_r. Qed.

forall n m p : t, gcd n m == p -> Bezout n m p

forall n m p : t, gcd n m == p -> Bezout n m p
(* First, a version restricted to natural numbers *)

forall 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 p
n:t
Hn:0 <= n

(fun t0 : t => forall m : t, 0 <= m -> Bezout t0 m (gcd t0 m)) 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 p
n:t
Hn:0 <= n

Proper (eq ==> iff) (fun t0 : t => forall m : t, 0 <= m -> Bezout t0 m (gcd t0 m))
n:t
Hn:0 <= n
forall 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 p
n:t
Hn:0 <= n

Proper (eq ==> iff) (fun t0 : t => forall m : t, 0 <= m -> exists a b : t, a * t0 + b * m == gcd t0 m)
n:t
Hn:0 <= n
forall 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 p
n:t
Hn:0 <= n

forall 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 p

forall 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 p
n:t
Hn:0 <= n
IHn: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:t
Hn:0 < n
IHn: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:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

(fun t0 : t => Bezout n t0 (gcd n t0)) m
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

Proper (eq ==> iff) (fun t0 : t => Bezout n t0 (gcd n t0))
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
forall n0 : t, 0 <= n0 -> (forall m0 : t, 0 <= m0 -> m0 < n0 -> Bezout n m0 (gcd n m0)) -> Bezout n n0 (gcd n n0)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

Proper (eq ==> iff) (fun t0 : t => exists a b : t, a * n + b * t0 == gcd n t0)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
forall n0 : t, 0 <= n0 -> (forall m0 : t, 0 <= m0 -> m0 < n0 -> Bezout n m0 (gcd n m0)) -> Bezout n n0 (gcd n n0)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

forall n0 : t, 0 <= n0 -> (forall m0 : t, 0 <= m0 -> m0 < n0 -> Bezout n m0 (gcd n m0)) -> Bezout n n0 (gcd n n0)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn: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:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)

Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m

Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m

0 <= m - n
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
m - n < m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n (m - n)
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m

m - n < m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n (m - n)
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n (m - n)

Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n (m - n)

exists b0 : t, (a - b) * n + b0 * m == gcd n m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n (m - n)

(a - b) * n + b * m == gcd n m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n m

(a - b) * n + b * m == gcd n m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n m

(a - b) * n + b * m == a * n + b * (m - n)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:n < m
a, b:t
EQ:a * n + b * (m - n) == gcd n m

a * n - b * n + b * m == a * n + (b * m - b * n)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m
Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m

Bezout n m (gcd n m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m

Bezout m m (gcd m m)
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m

Bezout m m m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m

exists b : t, 1 * m + b * m == m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
EQ:n == m

1 * m + 0 * m == m
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n

Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n

0 <= n
n:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
a, b:t
EQ:a * m + b * n == gcd m n
Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
a, b:t
EQ:a * m + b * n == gcd m n

Bezout n m (gcd n m)
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
a, b:t
EQ:a * m + b * n == gcd m n

exists b0 : t, b * n + b0 * m == gcd n m
n:t
Hn:0 == n
IHn: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:t
Hn:0 < n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m
IHm:forall m0 : t, 0 <= m0 -> m0 < m -> Bezout n m0 (gcd n m0)
LT:m < n
a, b:t
EQ:a * m + b * n == gcd m n

b * n + a * m == gcd n m
n:t
Hn:0 == n
IHn: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:t
Hn:0 == n
IHn: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:t
Hn:0 == n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm: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:t
Hn:0 == n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

Bezout 0 m 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:t
Hn:0 == n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

exists b : t, 0 * 0 + b * m == 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:t
Hn:0 == n
IHn:forall m0 : t, 0 <= m0 -> m0 < n -> forall m1 : t, 0 <= m1 -> Bezout m0 m1 (gcd m0 m1)
m:t
Hm:0 <= m

0 * 0 + 1 * m == 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
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
(* 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 : 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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm: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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:0 <= n

Bezout n m (gcd n m)
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:n <= 0
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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:n <= 0

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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:n <= 0
Hn':0 <= - n

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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:n <= 0
Hn':0 <= - n
a, b:t
EQ:a * - n + b * m == gcd (- n) 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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:n <= 0
Hn':0 <= - n
a, b:t
EQ:a * - n + b * m == gcd (- n) m

exists b0 : t, - a * n + b0 * 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 p
aux:forall n0 : t, 0 <= n0 -> forall m0 : t, 0 <= m0 -> Bezout n0 m0 (gcd n0 m0)
n, m:t
Hm:0 <= m
H:n <= 0
Hn':0 <= - n
a, b:t
EQ:a * - n + b * m == gcd (- n) m

- a * n + b * 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 p
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 p
(* And finally we do the same for 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:t
Hp:gcd n m == p

Bezout n m p
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:t

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:t
H:0 <= 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:t
H:m <= 0
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:t
H:m <= 0

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:t
H:m <= 0
Hm':0 <= - 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:t
H:m <= 0
Hm':0 <= - m
a, b:t
EQ: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:t
H:m <= 0
Hm':0 <= - m
a, b:t
EQ:a * n + b * - m == gcd n (- m)

exists b0 : t, a * n + b0 * 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:t
H:m <= 0
Hm':0 <= - m
a, b:t
EQ:a * n + b * - m == gcd n (- m)

a * n + - b * m == gcd n m
now rewrite <- gcd_opp_r, <- EQ, mul_opp_r, mul_opp_l. Qed.

forall n m p : t, gcd (p * n) (p * m) == abs p * gcd n m

forall n m p : t, gcd (p * n) (p * m) == abs p * gcd n m
n, m, p:t

gcd (p * n) (p * m) == abs p * gcd n m
n, m, p:t

0 <= 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:t
forall 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:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq: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:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq: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:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq: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:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:n == q * gcd n m

(abs p | p * q)
n, m, p:t
(abs p * gcd n m | p * m)
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq: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:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq: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:t
forall 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:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:m == q * gcd n m

(abs p * gcd n m | p * m)
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:m == q * gcd n m

(abs p * gcd n m | p * (q * gcd n m))
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:m == q * gcd n m

(abs p * gcd n m | p * q * gcd n m)
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:m == q * gcd n m

(abs p | p * q)
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:m == q * gcd n m

(abs p | abs p * sgn p * q)
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
Hq:m == q * gcd n m

(abs p | abs p * (sgn p * q))
n, m, p:t
forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p:t

forall q : t, (q | p * n) -> (q | p * m) -> (q | abs p * gcd n m)
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)

(q | abs p * gcd n m)
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m

(q | abs p * gcd n m)
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m

(q | p * sgn p * (a * n) + p * sgn p * (b * m))
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m

(q | p * sgn p * (a * n))
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m
(q | p * sgn p * (b * m))
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m

(q | p * n * (sgn p * a))
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m
(q | p * sgn p * (b * m))
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m

(q | p * sgn p * (b * m))
n, m, p, q:t
H:(q | p * n)
H':(q | p * m)
a, b:t
EQ:a * n + b * m == gcd n m

(q | p * m * (sgn p * b))
now apply divide_mul_l. Qed.

forall n m p : t, 0 <= p -> gcd (p * n) (p * m) == p * gcd n m

forall n m p : t, 0 <= p -> gcd (p * n) (p * m) == p * gcd n m
n, m, p:t
H:0 <= p

gcd (p * n) (p * m) == p * gcd n m
n, m, p:t
H:0 <= p

gcd (p * n) (p * m) == abs p * gcd n m
apply gcd_mul_mono_l. Qed.

forall n m p : t, gcd (n * p) (m * p) == gcd n m * abs p

forall n m p : t, gcd (n * p) (m * p) == gcd n m * abs p
n, m, p:t

gcd (n * p) (m * p) == gcd n m * abs p
now rewrite !(mul_comm _ p), gcd_mul_mono_l, mul_comm. Qed.

forall n m p : t, 0 <= p -> gcd (n * p) (m * p) == gcd n m * p

forall n m p : t, 0 <= p -> gcd (n * p) (m * p) == gcd n m * p
n, m, p:t
H:0 <= p

gcd (n * p) (m * p) == gcd n m * p
n, m, p:t
H:0 <= p

gcd (n * p) (m * p) == gcd n m * abs p
apply gcd_mul_mono_r. Qed.

forall 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:t
H:(n | m * p)
G:gcd n m == 1

(n | p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1

(n | p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1

(n | a * n * p + b * m * p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1

(n | a * n * p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1
(n | b * m * p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1

(n | a * p * n)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1
(n | b * m * p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1

(n | b * m * p)
n, m, p:t
H:(n | m * p)
G:gcd n m == 1
a, b:t
EQ:a * n + b * m == 1

(n | b * (m * p))
now apply divide_mul_r. Qed.

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:t
Hn:n ~= 0
H:(n | m * p)

exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 <= gcd n m

exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m

exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

exists q0 r : t, n == q0 * r /\ (q0 | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

exists r : t, n == gcd n m * r /\ (gcd n m | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

n == gcd n m * q /\ (gcd n m | m) /\ (q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

n == gcd n m * q
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
(gcd n m | m) /\ (q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

(gcd n m | m) /\ (q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

(gcd n m | m)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m

(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
Hr:m == r * gcd n m

(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(n | r * gcd n m * p)
Hr:m == r * gcd n m

(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(q * gcd n m | r * gcd n m * p)
Hr:m == r * gcd n m

(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(q * gcd n m | r * p * gcd n m)
Hr:m == r * gcd n m

(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(q | r * p)
Hr:m == r * gcd n m

(q | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(q | r * p)
Hr:m == r * gcd n m

gcd q r == 1
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(q | r * p)
Hr:m == r * gcd n m

gcd q r * gcd n m == 1 * gcd n m
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
G:0 < gcd n m
q:t
Hq:n == q * gcd n m
r:t
H:(q | r * p)
Hr:m == r * gcd n m

gcd q r * gcd n m == gcd n m
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m
exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:0 == gcd n m

exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:gcd n m == 0

exists q r : t, n == q * r /\ (q | m) /\ (r | p)
n, m, p:t
Hn:n ~= 0
H:(n | m * p)
G:n == 0 /\ m == 0

exists q r : t, n == q * r /\ (q | m) /\ (r | p)
destruct G as (Hn',_); order. Qed.
TODO : more about rel_prime (i.e. gcd == 1), about prime ...
End ZGcdProp.