let s be State of ; ( s starts_at 0 & Euclide-Algorithm c= s implies for x, y being Integer st s . (dl. 0 ) = x & s . (dl. 1) = y & x > 0 & y > 0 holds
(Result s) . (dl. 0 ) = x gcd y )
assume that
A1:
s starts_at 0
and
A2:
Euclide-Algorithm c= s
; for x, y being Integer st s . (dl. 0 ) = x & s . (dl. 1) = y & x > 0 & y > 0 holds
(Result s) . (dl. 0 ) = x gcd y
let x, y be Integer; ( s . (dl. 0 ) = x & s . (dl. 1) = y & x > 0 & y > 0 implies (Result s) . (dl. 0 ) = x gcd y )
assume that
A3:
( s . (dl. 0 ) = x & s . (dl. 1) = y )
and
A4:
x > 0
and
A5:
y > 0
; (Result s) . (dl. 0 ) = x gcd y
A6:
abs y = y
by A5, ABSVALUE:def 1;
now per cases
( x > y or x = y or y > x )
by XXREAL_0:1;
case A7:
x = y
;
ex s' being Element of K243(the Object-Kind of SCM ) st (Result s) . (dl. 0 ) = x gcd yreconsider x' =
x,
y' =
y as
Element of
NAT by A4, A5, INT_1:16;
take s' =
Computation s,4;
(Result s) . (dl. 0 ) = x gcd yA8:
s = Computation s,
(4 * 0 )
by AMI_1:13;
A9:
s' = Computation s,
(4 * (0 + 1))
;
x mod y =
x' mod y'
.=
0
by A7, NAT_D:25
;
then
s' . (dl. 1) = 0
by A1, A2, A3, A4, A5, A8, A9, Lm5;
then
IC s' = 4
by A1, A2, A3, A4, A5, A9, Lm4;
then
s halts_at IC s'
by A2, Lm3;
hence (Result s) . (dl. 0 ) =
s' . (dl. 0 )
by AMI_1:87
.=
y
by A1, A2, A3, A4, A5, A8, A9, Lm5
.=
x gcd y
by A6, A7, NAT_D:32
;
verum end; case A10:
y > x
;
ex s' being Element of K243(the Object-Kind of SCM ) st (Result s) . (dl. 0 ) = x gcd yreconsider x' =
x,
y' =
y as
Element of
NAT by A4, A5, INT_1:16;
take s' =
Computation s,4;
(Result s) . (dl. 0 ) = x gcd yA11:
s' = Computation s,
(4 * (0 + 1))
;
A12:
s = Computation s,
(4 * 0 )
by AMI_1:13;
then A13:
s' . (dl. 0 ) = y
by A1, A2, A3, A4, A5, A11, Lm5;
A14:
Euclide-Algorithm c= s'
by A2, AMI_1:86;
x mod y =
x' mod y'
.=
x'
by A10, NAT_D:24
;
then A15:
s' . (dl. 1) = x
by A1, A2, A3, A4, A5, A12, A11, Lm5;
then
IC s' = 0
by A1, A2, A3, A4, A5, A11, Lm4;
then A16:
s' starts_at 0
by AMI_1:def 41;
then consider k0 being
Element of
NAT such that A17:
s' halts_at IC (Computation s',k0)
by A4, A10, A13, A15, A14, Lm6;
Computation s,
(k0 + 4) = Computation s',
k0
by AMI_1:51;
then A18:
s halts_at IC (Computation s,(k0 + 4))
by A17, AMI_1:91;
(Result s') . (dl. 0 ) = x gcd y
by A4, A10, A13, A15, A16, A14, Lm6;
hence
(Result s) . (dl. 0 ) = x gcd y
by A18, AMI_1:90;
verum end; end; end;
hence
(Result s) . (dl. 0 ) = x gcd y
; verum