let p be Instruction-Sequence of SCM+FSA; for s being State of SCM+FSA
for a being read-write Int-Location
for I being Program of SCM+FSA st ProperBodyWhile>0 a,I,s,p & WithVariantWhile>0 a,I,s,p holds
( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p )
let s be State of SCM+FSA; for a being read-write Int-Location
for I being Program of SCM+FSA st ProperBodyWhile>0 a,I,s,p & WithVariantWhile>0 a,I,s,p holds
( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p )
let a be read-write Int-Location ; for I being Program of SCM+FSA st ProperBodyWhile>0 a,I,s,p & WithVariantWhile>0 a,I,s,p holds
( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p )
let I be Program of SCM+FSA; ( ProperBodyWhile>0 a,I,s,p & WithVariantWhile>0 a,I,s,p implies ( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p ) )
assume A2:
for k being Element of NAT st ((StepWhile>0 (a,I,p,s)) . k) . a > 0 holds
( I is_closed_on (StepWhile>0 (a,I,p,s)) . k,p +* (while>0 (a,I)) & I is_halting_on (StepWhile>0 (a,I,p,s)) . k,p +* (while>0 (a,I)) )
; SCMFSA9A:def 4 ( not WithVariantWhile>0 a,I,s,p or ( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p ) )
set s1 = Initialize s;
set p1 = p +* (while>0 (a,I));
A3:
(p +* (while>0 (a,I))) +* (while>0 (a,I)) = p +* (while>0 (a,I))
by FUNCT_4:93;
defpred S1[ Nat] means ((StepWhile>0 (a,I,p,s)) . $1) . a <= 0 ;
given f being Function of (product the Object-Kind of SCM+FSA),NAT such that A4:
for k being Element of NAT holds
( f . ((StepWhile>0 (a,I,p,s)) . (k + 1)) < f . ((StepWhile>0 (a,I,p,s)) . k) or ((StepWhile>0 (a,I,p,s)) . k) . a <= 0 )
; SCMFSA9A:def 5 ( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p )
deffunc H1( Nat) -> Element of NAT = f . ((StepWhile>0 (a,I,p,s)) . $1);
A5:
for k being Element of NAT holds
( H1(k + 1) < H1(k) or S1[k] )
by A4;
consider m being Element of NAT such that
A6:
S1[m]
and
A7:
for n being Element of NAT st S1[n] holds
m <= n
from NAT_1:sch 18(A5);
defpred S2[ Nat] means ( $1 + 1 <= m implies ex k being Element of NAT st (StepWhile>0 (a,I,p,s)) . ($1 + 1) = Comput ((p +* (while>0 (a,I))),(Initialize s),k) );
A8:
now let k be
Element of
NAT ;
( S2[k] implies S2[k + 1] )assume A9:
S2[
k]
;
S2[k + 1]now set sk1 =
(StepWhile>0 (a,I,p,s)) . (k + 1);
set sk =
(StepWhile>0 (a,I,p,s)) . k;
set pk =
p +* (while>0 (a,I));
assume A10:
(k + 1) + 1
<= m
;
ex m being Element of NAT st (StepWhile>0 (a,I,p,s)) . ((k + 1) + 1) = Comput ((p +* (while>0 (a,I))),(Initialize s),m)
k + 0 < k + (1 + 1)
by XREAL_1:6;
then
k < m
by A10, XXREAL_0:2;
then A11:
((StepWhile>0 (a,I,p,s)) . k) . a > 0
by A7;
(k + 1) + 0 < (k + 1) + 1
by XREAL_1:6;
then consider n being
Element of
NAT such that A12:
(StepWhile>0 (a,I,p,s)) . (k + 1) = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
n)
by A9, A10, XXREAL_0:2;
A13:
(StepWhile>0 (a,I,p,s)) . (k + 1) = Comput (
((p +* (while>0 (a,I))) +* (while>0 (a,I))),
(Initialize ((StepWhile>0 (a,I,p,s)) . k)),
((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . k)))) + 3))
by A3, SCMFSA_9:def 5;
take m =
n + ((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . (k + 1))))) + 3);
(StepWhile>0 (a,I,p,s)) . ((k + 1) + 1) = Comput ((p +* (while>0 (a,I))),(Initialize s),m)
(
I is_closed_on (StepWhile>0 (a,I,p,s)) . k,
p +* (while>0 (a,I)) &
I is_halting_on (StepWhile>0 (a,I,p,s)) . k,
p +* (while>0 (a,I)) )
by A2, A11;
then
IC ((StepWhile>0 (a,I,p,s)) . (k + 1)) = 0
by A13, A11, SCMFSA_9:42;
hence
(StepWhile>0 (a,I,p,s)) . ((k + 1) + 1) = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
m)
by A12, SCMFSA_9:45;
verum end; hence
S2[
k + 1]
;
verum end;
A15:
S2[ 0 ]
proof
assume
0 + 1
<= m
;
ex k being Element of NAT st (StepWhile>0 (a,I,p,s)) . (0 + 1) = Comput ((p +* (while>0 (a,I))),(Initialize s),k)
take n =
(LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3;
(StepWhile>0 (a,I,p,s)) . (0 + 1) = Comput ((p +* (while>0 (a,I))),(Initialize s),n)
thus
(StepWhile>0 (a,I,p,s)) . (0 + 1) = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
n)
by SCMFSA_9:44;
verum
end;
A16:
for k being Element of NAT holds S2[k]
from NAT_1:sch 1(A15, A8);
per cases
( m = 0 or m <> 0 )
;
suppose A17:
m <> 0
;
( while>0 (a,I) is_halting_on s,p & while>0 (a,I) is_closed_on s,p )set ii =
(LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3;
set sm =
(StepWhile>0 (a,I,p,s)) . m;
set pm =
p +* (while>0 (a,I));
set sm1 =
Initialize ((StepWhile>0 (a,I,p,s)) . m);
set pm1 =
(p +* (while>0 (a,I))) +* (while>0 (a,I));
consider i being
Nat such that A18:
m = i + 1
by A17, NAT_1:6;
reconsider i =
i as
Element of
NAT by ORDINAL1:def 12;
set si =
(StepWhile>0 (a,I,p,s)) . i;
set psi =
p +* (while>0 (a,I));
A19:
(StepWhile>0 (a,I,p,s)) . m = Comput (
((p +* (while>0 (a,I))) +* (while>0 (a,I))),
(Initialize ((StepWhile>0 (a,I,p,s)) . i)),
((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . i)))) + 3))
by A18, A3, SCMFSA_9:def 5;
m = i + 1
by A18;
then consider n being
Element of
NAT such that A20:
(StepWhile>0 (a,I,p,s)) . m = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
n)
by A16;
i < m
by A18, NAT_1:13;
then A21:
((StepWhile>0 (a,I,p,s)) . i) . a > 0
by A7;
then
(
I is_closed_on (StepWhile>0 (a,I,p,s)) . i,
p +* (while>0 (a,I)) &
I is_halting_on (StepWhile>0 (a,I,p,s)) . i,
p +* (while>0 (a,I)) )
by A2;
then
IC ((StepWhile>0 (a,I,p,s)) . m) = 0
by A19, A21, SCMFSA_9:42;
then
Start-At (
0,
SCM+FSA)
c= (StepWhile>0 (a,I,p,s)) . m
by MEMSTR_0:30;
then A24:
Initialize ((StepWhile>0 (a,I,p,s)) . m) = (StepWhile>0 (a,I,p,s)) . m
by FUNCT_4:98;
while>0 (
a,
I)
is_halting_on (StepWhile>0 (a,I,p,s)) . m,
p +* (while>0 (a,I))
by A6, SCMFSA_9:38;
then
(p +* (while>0 (a,I))) +* (while>0 (a,I)) halts_on Initialize ((StepWhile>0 (a,I,p,s)) . m)
by SCMFSA7B:def 7;
then consider j being
Element of
NAT such that A25:
CurInstr (
(p +* (while>0 (a,I))),
(Comput ((p +* (while>0 (a,I))),((StepWhile>0 (a,I,p,s)) . m),j)))
= halt SCM+FSA
by A24, A3, EXTPRO_1:29;
A26:
Comput (
(p +* (while>0 (a,I))),
(Initialize s),
(n + j))
= Comput (
(p +* (while>0 (a,I))),
(Comput ((p +* (while>0 (a,I))),(Initialize s),n)),
j)
by EXTPRO_1:4;
CurInstr (
(p +* (while>0 (a,I))),
(Comput ((p +* (while>0 (a,I))),(Initialize s),(n + j))))
= halt SCM+FSA
by A20, A25, A26;
then
p +* (while>0 (a,I)) halts_on Initialize s
by EXTPRO_1:29;
hence
while>0 (
a,
I)
is_halting_on s,
p
by SCMFSA7B:def 7;
while>0 (a,I) is_closed_on s,pnow let q be
Element of
NAT ;
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),b1)) in dom (while>0 (a,I))per cases
( q <= (LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3 or q > (LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3 )
;
suppose A27:
q <= (LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3
;
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),b1)) in dom (while>0 (a,I))A28:
(StepWhile>0 (a,I,p,s)) . 0 = s
by SCMFSA_9:def 5;
then A29:
s . a > 0
by A7, A17;
then
(
I is_closed_on s,
p +* (while>0 (a,I)) &
I is_halting_on s,
p +* (while>0 (a,I)) )
by A2, A28;
hence
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),q)) in dom (while>0 (a,I))
by A27, A29, A3, SCMFSA_9:42;
verum end; suppose A30:
q > (LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3
;
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),b1)) in dom (while>0 (a,I))A31:
now take k =
(LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize s))) + 3;
( (StepWhile>0 (a,I,p,s)) . 1 = Comput ((p +* (while>0 (a,I))),(Initialize s),k) & k <= q )thus
(
(StepWhile>0 (a,I,p,s)) . 1
= Comput (
(p +* (while>0 (a,I))),
(Initialize s),
k) &
k <= q )
by A30, SCMFSA_9:44;
verum end; defpred S3[
Nat]
means ( $1
<= m & $1
<> 0 & ex
k being
Element of
NAT st
(
(StepWhile>0 (a,I,p,s)) . $1
= Comput (
(p +* (while>0 (a,I))),
(Initialize s),
k) &
k <= q ) );
A32:
for
i being
Nat st
S3[
i] holds
i <= m
;
0 + 1
< m + 1
by A17, XREAL_1:6;
then
1
<= m
by NAT_1:13;
then A33:
ex
k being
Nat st
S3[
k]
by A31;
consider t being
Nat such that A34:
(
S3[
t] & ( for
i being
Nat st
S3[
i] holds
i <= t ) )
from NAT_1:sch 6(A32, A33);
reconsider t =
t as
Element of
NAT by ORDINAL1:def 12;
per cases
( t = m or t <> m )
;
suppose
t = m
;
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),b1)) in dom (while>0 (a,I))then consider r being
Element of
NAT such that A35:
(StepWhile>0 (a,I,p,s)) . m = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
r)
and A36:
r <= q
by A34;
consider x being
Nat such that A37:
q = r + x
by A36, NAT_1:10;
A38:
while>0 (
a,
I)
is_closed_on (StepWhile>0 (a,I,p,s)) . m,
p +* (while>0 (a,I))
by A6, SCMFSA_9:38;
reconsider x =
x as
Element of
NAT by ORDINAL1:def 12;
Comput (
(p +* (while>0 (a,I))),
(Initialize s),
q)
= Comput (
(p +* (while>0 (a,I))),
(Initialize ((StepWhile>0 (a,I,p,s)) . m)),
x)
by A24, A35, A37, EXTPRO_1:4;
hence
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),q)) in dom (while>0 (a,I))
by A38, A3, SCMFSA7B:def 6;
verum end; suppose A39:
t <> m
;
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),b1)) in dom (while>0 (a,I))set Dt =
(StepWhile>0 (a,I,p,s)) . t;
set pt =
p +* (while>0 (a,I));
consider y being
Nat such that A40:
t = y + 1
by A34, NAT_1:6;
reconsider y =
y as
Element of
NAT by ORDINAL1:def 12;
set Dy =
(StepWhile>0 (a,I,p,s)) . y;
set py =
p +* (while>0 (a,I));
A41:
(StepWhile>0 (a,I,p,s)) . t = Comput (
((p +* (while>0 (a,I))) +* (while>0 (a,I))),
(Initialize ((StepWhile>0 (a,I,p,s)) . y)),
((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . y)))) + 3))
by A40, A3, SCMFSA_9:def 5;
y + 0 < t
by A40, XREAL_1:6;
then
y < m
by A34, XXREAL_0:2;
then A42:
((StepWhile>0 (a,I,p,s)) . y) . a > 0
by A7;
then
(
I is_closed_on (StepWhile>0 (a,I,p,s)) . y,
p +* (while>0 (a,I)) &
I is_halting_on (StepWhile>0 (a,I,p,s)) . y,
p +* (while>0 (a,I)) )
by A2;
then A43:
IC ((StepWhile>0 (a,I,p,s)) . t) = 0
by A41, A42, SCMFSA_9:42;
consider z being
Element of
NAT such that A44:
(StepWhile>0 (a,I,p,s)) . t = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
z)
and A45:
z <= q
by A34;
consider w being
Nat such that A46:
q = z + w
by A45, NAT_1:10;
reconsider w =
w as
Element of
NAT by ORDINAL1:def 12;
A47:
(StepWhile>0 (a,I,p,s)) . t = Initialize ((StepWhile>0 (a,I,p,s)) . t)
by A44, A43, SCMFSA_9:45;
A48:
Comput (
(p +* (while>0 (a,I))),
(Initialize s),
q)
= Comput (
((p +* (while>0 (a,I))) +* (while>0 (a,I))),
(Initialize ((StepWhile>0 (a,I,p,s)) . t)),
w)
by A47, A3, A44, A46, EXTPRO_1:4;
set z2 =
z + ((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . t)))) + 3);
A49:
t < m
by A34, A39, XXREAL_0:1;
now assume A50:
z + ((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . t)))) + 3) <= q
;
contradictionA51:
now take k =
z + ((LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . t)))) + 3);
( (StepWhile>0 (a,I,p,s)) . (t + 1) = Comput ((p +* (while>0 (a,I))),(Initialize s),k) & k <= q )thus
(
(StepWhile>0 (a,I,p,s)) . (t + 1) = Comput (
(p +* (while>0 (a,I))),
(Initialize s),
k) &
k <= q )
by A44, A43, A50, SCMFSA_9:45;
verum end;
t + 1
<= m
by A49, NAT_1:13;
hence
contradiction
by A34, A51, XREAL_1:29;
verum end; then A52:
w < (LifeSpan (((p +* (while>0 (a,I))) +* I),(Initialize ((StepWhile>0 (a,I,p,s)) . t)))) + 3
by A46, XREAL_1:6;
A53:
((StepWhile>0 (a,I,p,s)) . t) . a > 0
by A7, A49;
then
(
I is_closed_on (StepWhile>0 (a,I,p,s)) . t,
p +* (while>0 (a,I)) &
I is_halting_on (StepWhile>0 (a,I,p,s)) . t,
p +* (while>0 (a,I)) )
by A2;
hence
IC (Comput ((p +* (while>0 (a,I))),(Initialize s),q)) in dom (while>0 (a,I))
by A52, A48, A53, SCMFSA_9:42;
verum end; end; end; end; end; hence
while>0 (
a,
I)
is_closed_on s,
p
by SCMFSA7B:def 6;
verum end; end;