let a, b be Integer; :: thesis: ex s, t being Integer st a gcd b = (s * a) + (t * b)
A1:
for a, b being Integer st a > 0 & b > 0 holds
ex s, t being Integer st a gcd b = (s * a) + (t * b)
proof
let a,
b be
Integer;
:: thesis: ( a > 0 & b > 0 implies ex s, t being Integer st a gcd b = (s * a) + (t * b) )
assume A2:
(
a > 0 &
b > 0 )
;
:: thesis: ex s, t being Integer st a gcd b = (s * a) + (t * b)
then reconsider a =
a,
b =
b as
Element of
NAT by INT_1:16;
set M =
{ z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) } ;
defpred S1[
Nat]
means ( $1
in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) } & $1
<> 0 );
(
a = (1 * a) + (0 * b) &
b = (0 * a) + (1 * b) )
;
then A3:
(
a in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) } &
b in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) } )
;
then A4:
ex
k being
Nat st
S1[
k]
by A2;
consider g being
Nat such that A5:
(
S1[
g] & ( for
n being
Nat st
S1[
n] holds
g <= n ) )
from NAT_1:sch 5(A4);
consider z being
Element of
NAT such that A6:
(
z = g & ex
s,
t being
Integer st
z = (s * a) + (t * b) )
by A5;
consider s,
t being
Integer such that A7:
g = (s * a) + (t * b)
by A6;
set G =
{ zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g } ;
A8:
(
abs a = a &
abs b = b )
by ABSVALUE:def 1;
A9:
{ zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g } = { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) }
proof
A10:
for
x being
set st
x in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) } holds
x in { zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g }
proof
let x be
set ;
:: thesis: ( x in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) } implies x in { zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g } )
assume
x in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) }
;
:: thesis: x in { zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g }
then consider x' being
Element of
NAT such that A11:
(
x' = x & ex
u,
v being
Integer st
x' = (u * a) + (v * b) )
;
consider u,
v being
Integer such that A12:
x = (u * a) + (v * b)
by A11;
consider r being
Nat such that A13:
(
x' = (g * (x' div g)) + r &
r < g )
by A5, NAT_D:def 1;
A14:
r in NAT
by ORDINAL1:def 13;
r =
x' - (g * (x' div g))
by A13
.=
((u * a) + (v * b)) - ((a * (s * (x' div g))) + (b * (t * (x' div g))))
by A7, A11, A12
.=
(a * (u + (- (s * (x' div g))))) + (b * (v + (- (t * (x' div g)))))
;
then
r in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) }
by A14;
then
r = 0
by A5, A13;
hence
x in { zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g }
by A11, A13;
:: thesis: verum
end;
for
x being
set st
x in { zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g } holds
x in { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) }
hence
{ zz where zz is Element of NAT : ex s being Element of NAT st zz = s * g } = { z where z is Element of NAT : ex s, t being Integer st z = (s * a) + (t * b) }
by A10, TARSKI:2;
:: thesis: verum
end;
then consider a' being
Element of
NAT such that A17:
(
a' = a & ex
s being
Element of
NAT st
a' = s * g )
by A3;
consider b' being
Element of
NAT such that A18:
(
b' = b & ex
t being
Element of
NAT st
b' = t * g )
by A3, A9;
consider u,
v being
Element of
NAT such that A19:
(
a = u * g &
b = v * g )
by A17, A18;
A20:
(
g divides abs a &
g divides abs b )
by A8, A19, NAT_D:def 3;
for
m being
Nat st
m divides abs a &
m divides abs b holds
m divides g
then g =
(abs a) gcd (abs b)
by A20, NAT_D:def 5
.=
a gcd b
by INT_2:51
;
hence
ex
s,
t being
Integer st
a gcd b = (s * a) + (t * b)
by A7;
:: thesis: verum
end;
hence
ex s, t being Integer st a gcd b = (s * a) + (t * b)
; :: thesis: verum