let s be State of SCMPDS ; for I being shiftable No-StopCode Program of SCMPDS
for a, b, c being Int_position
for i, d being Integer st card I > 0 & s . a = d & s . b > 0 & s . c > 0 & s . (DataLoc d,i) = (s . b) - (s . c) & ( for t being State of SCMPDS st t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c holds
( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) ) ) holds
( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) )
let I be shiftable No-StopCode Program of SCMPDS ; for a, b, c being Int_position
for i, d being Integer st card I > 0 & s . a = d & s . b > 0 & s . c > 0 & s . (DataLoc d,i) = (s . b) - (s . c) & ( for t being State of SCMPDS st t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c holds
( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) ) ) holds
( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) )
let a, b, c be Int_position ; for i, d being Integer st card I > 0 & s . a = d & s . b > 0 & s . c > 0 & s . (DataLoc d,i) = (s . b) - (s . c) & ( for t being State of SCMPDS st t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c holds
( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) ) ) holds
( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) )
let i, d be Integer; ( card I > 0 & s . a = d & s . b > 0 & s . c > 0 & s . (DataLoc d,i) = (s . b) - (s . c) & ( for t being State of SCMPDS st t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c holds
( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) ) ) implies ( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) ) )
set ci = DataLoc (s . a),i;
assume A1:
card I > 0
; ( not s . a = d or not s . b > 0 or not s . c > 0 or not s . (DataLoc d,i) = (s . b) - (s . c) or ex t being State of SCMPDS st
( t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c & not ( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) ) ) or ( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) ) )
consider f being Function of (product the Object-Kind of SCMPDS ),NAT such that
A2:
for s being State of SCMPDS holds
( ( s . b = s . c implies f . s = 0 ) & ( s . b <> s . c implies f . s = max (abs (s . b)),(abs (s . c)) ) )
by Th6;
deffunc H1( State of SCMPDS ) -> Element of NAT = f . $1;
set s1 = IExec (while<>0 a,i,I),s;
set ss = Dstate (IExec (while<>0 a,i,I),s);
defpred S1[ set ] means ex t being State of SCMPDS st
( t = $1 & t . b > 0 & t . c > 0 & (t . b) gcd (t . c) = (s . b) gcd (s . c) & t . (DataLoc d,i) = (t . b) - (t . c) );
assume that
A3:
s . a = d
and
A4:
s . b > 0
and
A5:
s . c > 0
and
A6:
s . (DataLoc d,i) = (s . b) - (s . c)
; ( ex t being State of SCMPDS st
( t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c & not ( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) ) ) or ( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) ) )
assume A7:
for t being State of SCMPDS st t . b > 0 & t . c > 0 & t . a = d & t . (DataLoc d,i) = (t . b) - (t . c) & t . b <> t . c holds
( (IExec I,t) . a = d & I is_closed_on t & I is_halting_on t & ( t . b > t . c implies ( (IExec I,t) . b = (t . b) - (t . c) & (IExec I,t) . c = t . c ) ) & ( t . b <= t . c implies ( (IExec I,t) . c = (t . c) - (t . b) & (IExec I,t) . b = t . b ) ) & (IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c) )
; ( (IExec (while<>0 a,i,I),s) . b = (s . b) gcd (s . c) & (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c) )
A8:
now let t be
State of
SCMPDS ;
( S1[ Dstate t] & t . a = s . a & t . (DataLoc (s . a),i) <> 0 implies ( (IExec I,t) . a = t . a & I is_closed_on t & I is_halting_on t & H1( Dstate (IExec I,t)) < H1( Dstate t) & S1[ Dstate (IExec I,t)] ) )assume that A9:
S1[
Dstate t]
and A10:
t . a = s . a
and A11:
t . (DataLoc (s . a),i) <> 0
;
( (IExec I,t) . a = t . a & I is_closed_on t & I is_halting_on t & H1( Dstate (IExec I,t)) < H1( Dstate t) & S1[ Dstate (IExec I,t)] )set It =
IExec I,
t;
set t2 =
Dstate (IExec I,t);
set t1 =
Dstate t;
set x =
(IExec I,t) . b;
set y =
(IExec I,t) . c;
consider v being
State of
SCMPDS such that A12:
v = Dstate t
and A13:
v . b > 0
and A14:
v . c > 0
and A15:
(v . b) gcd (v . c) = (s . b) gcd (s . c)
and A16:
v . (DataLoc d,i) = (v . b) - (v . c)
by A9;
A17:
t . b > 0
by A12, A13, SCMPDS_8:4;
A18:
t . c > 0
by A12, A14, SCMPDS_8:4;
A19:
t . (DataLoc d,i) =
(v . b) - (v . c)
by A12, A16, SCMPDS_8:4
.=
(t . b) - (v . c)
by A12, SCMPDS_8:4
.=
(t . b) - (t . c)
by A12, SCMPDS_8:4
;
then A20:
(
t . b > t . c implies (
(IExec I,t) . b = (t . b) - (t . c) &
(IExec I,t) . c = t . c ) )
by A3, A7, A10, A17, A18;
A21:
t . b <> t . c
by A3, A11, A19;
hence
(IExec I,t) . a = t . a
by A3, A7, A10, A17, A18, A19;
( I is_closed_on t & I is_halting_on t & H1( Dstate (IExec I,t)) < H1( Dstate t) & S1[ Dstate (IExec I,t)] )thus
(
I is_closed_on t &
I is_halting_on t )
by A3, A7, A10, A17, A18, A19, A21;
( H1( Dstate (IExec I,t)) < H1( Dstate t) & S1[ Dstate (IExec I,t)] )A22:
(
t . b <= t . c implies (
(IExec I,t) . c = (t . c) - (t . b) &
(IExec I,t) . b = t . b ) )
by A3, A7, A10, A17, A18, A19, A21;
A23:
now per cases
( t . b > t . c or t . b <= t . c )
;
suppose A24:
t . b > t . c
;
( (IExec I,t) . b > 0 & (IExec I,t) . c > 0 & ((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c) & max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c) )then
(t . b) - (t . c) > 0
by XREAL_1:52;
hence
(IExec I,t) . b > 0
by A3, A7, A10, A17, A18, A19, A24;
( (IExec I,t) . c > 0 & ((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c) & max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c) )thus
(IExec I,t) . c > 0
by A3, A7, A10, A17, A18, A19, A24;
( ((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c) & max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c) )thus
((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c)
by A17, A18, A20, A22, PREPOWER:111;
max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c)A25:
(IExec I,t) . b = (t . b) - (t . c)
by A3, A7, A10, A17, A18, A19, A24;
hereby verum
A26:
max (t . b),
(t . c) = t . b
by A24, XXREAL_0:def 10;
per cases
( max ((IExec I,t) . b),((IExec I,t) . c) = (IExec I,t) . b or max ((IExec I,t) . b),((IExec I,t) . c) = (IExec I,t) . c )
by XXREAL_0:16;
suppose
max ((IExec I,t) . b),
((IExec I,t) . c) = (IExec I,t) . c
;
max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c)hence
max ((IExec I,t) . b),
((IExec I,t) . c) < max (t . b),
(t . c)
by A3, A7, A10, A17, A18, A19, A24, A26;
verum end; end;
end; end; suppose A27:
t . b <= t . c
;
( (IExec I,t) . b > 0 & (IExec I,t) . c > 0 & ((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c) & max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c) )hence
(IExec I,t) . b > 0
by A3, A7, A10, A17, A18, A19, A21;
( (IExec I,t) . c > 0 & ((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c) & max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c) )
t . b < t . c
by A21, A27, XXREAL_0:1;
then
(t . c) - (t . b) > 0
by XREAL_1:52;
hence
(IExec I,t) . c > 0
by A3, A7, A10, A17, A18, A19, A21, A27;
( ((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c) & max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c) )thus
((IExec I,t) . b) gcd ((IExec I,t) . c) = (t . b) gcd (t . c)
by A17, A18, A20, A22, PREPOWER:111;
max ((IExec I,t) . b),((IExec I,t) . c) < max (t . b),(t . c)A28:
(IExec I,t) . c = (t . c) - (t . b)
by A3, A7, A10, A17, A18, A19, A21, A27;
A29:
(IExec I,t) . b = t . b
by A3, A7, A10, A17, A18, A19, A21, A27;
end; end; end; thus
H1(
Dstate (IExec I,t))
< H1(
Dstate t)
S1[ Dstate (IExec I,t)]proof
(Dstate t) . b <> t . c
by A21, SCMPDS_8:4;
then
(Dstate t) . b <> (Dstate t) . c
by SCMPDS_8:4;
then A31:
H1(
Dstate t) =
max (abs ((Dstate t) . b)),
(abs ((Dstate t) . c))
by A2
.=
max (abs (t . b)),
(abs ((Dstate t) . c))
by SCMPDS_8:4
.=
max (abs (t . b)),
(abs (t . c))
by SCMPDS_8:4
.=
max (t . b),
(abs (t . c))
by A17, ABSVALUE:def 1
.=
max (t . b),
(t . c)
by A18, ABSVALUE:def 1
;
then
H1(
Dstate t)
>= t . b
by XXREAL_0:25;
then A32:
H1(
Dstate t)
> 0
by A17, XXREAL_0:2;
per cases
( (Dstate (IExec I,t)) . b = (Dstate (IExec I,t)) . c or (Dstate (IExec I,t)) . b <> (Dstate (IExec I,t)) . c )
;
suppose
(Dstate (IExec I,t)) . b <> (Dstate (IExec I,t)) . c
;
H1( Dstate (IExec I,t)) < H1( Dstate t)then H1(
Dstate (IExec I,t)) =
max (abs ((Dstate (IExec I,t)) . b)),
(abs ((Dstate (IExec I,t)) . c))
by A2
.=
max (abs ((IExec I,t) . b)),
(abs ((Dstate (IExec I,t)) . c))
by SCMPDS_8:4
.=
max (abs ((IExec I,t) . b)),
(abs ((IExec I,t) . c))
by SCMPDS_8:4
.=
max ((IExec I,t) . b),
(abs ((IExec I,t) . c))
by A23, ABSVALUE:def 1
.=
max ((IExec I,t) . b),
((IExec I,t) . c)
by A23, ABSVALUE:def 1
;
hence
H1(
Dstate (IExec I,t))
< H1(
Dstate t)
by A23, A31;
verum end; end;
end; A33:
(IExec I,t) . (DataLoc d,i) = ((IExec I,t) . b) - ((IExec I,t) . c)
by A3, A7, A10, A17, A18, A19, A21;
thus
S1[
Dstate (IExec I,t)]
verumproof
take u =
Dstate (IExec I,t);
( u = Dstate (IExec I,t) & u . b > 0 & u . c > 0 & (u . b) gcd (u . c) = (s . b) gcd (s . c) & u . (DataLoc d,i) = (u . b) - (u . c) )
thus
u = Dstate (IExec I,t)
;
( u . b > 0 & u . c > 0 & (u . b) gcd (u . c) = (s . b) gcd (s . c) & u . (DataLoc d,i) = (u . b) - (u . c) )
thus
(
u . b > 0 &
u . c > 0 )
by A23, SCMPDS_8:4;
( (u . b) gcd (u . c) = (s . b) gcd (s . c) & u . (DataLoc d,i) = (u . b) - (u . c) )
thus (u . b) gcd (u . c) =
((IExec I,t) . b) gcd (u . c)
by SCMPDS_8:4
.=
(t . b) gcd (t . c)
by A23, SCMPDS_8:4
.=
(v . b) gcd (t . c)
by A12, SCMPDS_8:4
.=
(s . b) gcd (s . c)
by A12, A15, SCMPDS_8:4
;
u . (DataLoc d,i) = (u . b) - (u . c)
thus u . (DataLoc d,i) =
((IExec I,t) . b) - ((IExec I,t) . c)
by A33, SCMPDS_8:4
.=
(u . b) - ((IExec I,t) . c)
by SCMPDS_8:4
.=
(u . b) - (u . c)
by SCMPDS_8:4
;
verum
end; end;
A34:
for t being State of SCMPDS st S1[ Dstate t] holds
( H1( Dstate t) = 0 iff t . (DataLoc (s . a),i) = 0 )
A41:
S1[ Dstate s]
A42:
( H1( Dstate (IExec (while<>0 a,i,I),s)) = 0 & S1[ Dstate (IExec (while<>0 a,i,I),s)] )
from SCPINVAR:sch 5(A1, A34, A41, A8);
then consider w being State of SCMPDS such that
A43:
w = Dstate (IExec (while<>0 a,i,I),s)
and
A44:
w . b > 0
and
w . c > 0
and
A45:
(w . b) gcd (w . c) = (s . b) gcd (s . c)
and
A46:
w . (DataLoc d,i) = (w . b) - (w . c)
;
A47: (w . b) - (w . c) =
(IExec (while<>0 a,i,I),s) . (DataLoc (s . a),i)
by A3, A43, A46, SCMPDS_8:4
.=
0
by A34, A42
;
then A48: abs (w . b) =
(abs (w . b)) gcd (abs (w . c))
by NAT_D:32
.=
(s . b) gcd (s . c)
by A45, INT_2:51
;
thus (IExec (while<>0 a,i,I),s) . b =
(Dstate (IExec (while<>0 a,i,I),s)) . b
by SCMPDS_8:4
.=
(s . b) gcd (s . c)
by A43, A44, A48, ABSVALUE:def 1
; (IExec (while<>0 a,i,I),s) . c = (s . b) gcd (s . c)
thus (IExec (while<>0 a,i,I),s) . c =
(Dstate (IExec (while<>0 a,i,I),s)) . c
by SCMPDS_8:4
.=
(s . b) gcd (s . c)
by A43, A44, A47, A48, ABSVALUE:def 1
; verum