let s be State of SCM+FSA; ( IC s = 0 implies for P being Instruction-Sequence of SCM+FSA
for a being Int-Location
for k being Integer st a := k c= P holds
P halts_on s )
assume A1:
IC s = 0
; for P being Instruction-Sequence of SCM+FSA
for a being Int-Location
for k being Integer st a := k c= P holds
P halts_on s
let P be Instruction-Sequence of SCM+FSA; for a being Int-Location
for k being Integer st a := k c= P holds
P halts_on s
A2:
dom P = NAT
by PARTFUN1:def 2;
let a be Int-Location; for k being Integer st a := k c= P holds
P halts_on s
let k be Integer; ( a := k c= P implies P halts_on s )
assume A3:
a := k c= P
; P halts_on s
per cases
( k > 0 or k <= 0 )
;
suppose A4:
k > 0
;
P halts_on sthen consider k1 being
Nat such that A5:
k1 + 1
= k
and A6:
a := k = (<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)
by SCMFSA_7:def 1;
A7:
len (<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) =
(len <%(a := (intloc 0))%>) + (len (k1 --> (AddTo (a,(intloc 0)))))
by AFINSQ_1:17
.=
1
+ (len (k1 --> (AddTo (a,(intloc 0)))))
by AFINSQ_1:34
.=
k
by A5
;
set f =
(<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA);
A8:
((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . 0 =
(<%(a := (intloc 0))%> ^ ((k1 --> (AddTo (a,(intloc 0)))) ^ (Stop SCM+FSA))) . 0
by AFINSQ_1:27
.=
a := (intloc 0)
by AFINSQ_1:35
;
reconsider k =
k as
Element of
NAT by A4, INT_1:3;
A9:
len ((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) =
(len (<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0)))))) + (len (Stop SCM+FSA))
by AFINSQ_1:17
.=
k + 1
by A7, AFINSQ_1:34
;
A12:
for
i being
Element of
NAT st
i <= k holds
P . i = ((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i
by A3, A6, A10, GRFUNC_1:2;
then A13:
P . 0 = a := (intloc 0)
by A8;
A14:
now for n being Element of NAT st n = 0 holds
( Comput (P,s,n) = s & CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) )let n be
Element of
NAT ;
( n = 0 implies ( Comput (P,s,n) = s & CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) ) )assume
n = 0
;
( Comput (P,s,n) = s & CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) )hence A15:
Comput (
P,
s,
n)
= s
;
( CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) )hence
CurInstr (
P,
(Comput (P,s,n)))
= a := (intloc 0)
by A1, A13, A2, PARTFUN1:def 6;
Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s)thus Comput (
P,
s,
(n + 1)) =
Following (
P,
(Comput (P,s,n)))
by EXTPRO_1:3
.=
Exec (
(a := (intloc 0)),
s)
by A15, A1, A13, A2, PARTFUN1:def 6
;
verum end; A16:
now for i being Element of NAT st 1 <= i & i < k holds
((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i = AddTo (a,(intloc 0))let i be
Element of
NAT ;
( 1 <= i & i < k implies ((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i = AddTo (a,(intloc 0)) )assume that A17:
1
<= i
and A18:
i < k
;
((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i = AddTo (a,(intloc 0))reconsider i1 =
i - 1 as
Element of
NAT by A17, INT_1:5;
i - 1
< k - 1
by A18, XREAL_1:9;
then A19:
i1 in Segm k1
by A5, NAT_1:44;
A20:
len <%(a := (intloc 0))%> = 1
by AFINSQ_1:33;
A21:
len (k1 --> (AddTo (a,(intloc 0)))) = k1
;
i in dom (<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0)))))
by A18, A7, AFINSQ_1:86;
hence ((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i =
(<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) . i
by AFINSQ_1:def 3
.=
(k1 --> (AddTo (a,(intloc 0)))) . (i - 1)
by A17, A18, A20, A21, A5, AFINSQ_1:18
.=
AddTo (
a,
(intloc 0))
by A19, FUNCOP_1:7
;
verum end; A27:
for
i being
Element of
NAT st
i <= k holds
IC (Comput (P,s,i)) = i
proof
defpred S1[
Nat]
means ( $1
<= k implies
IC (Comput (P,s,$1)) = $1 );
let i be
Element of
NAT ;
( i <= k implies IC (Comput (P,s,i)) = i )
assume A28:
i <= k
;
IC (Comput (P,s,i)) = i
A29:
for
n being
Nat st
S1[
n] holds
S1[
n + 1]
proof
let n be
Nat;
( S1[n] implies S1[n + 1] )
assume A30:
S1[
n]
;
S1[n + 1]
assume A31:
n + 1
<= k
;
IC (Comput (P,s,(n + 1))) = n + 1
then A32:
n < k
by NAT_1:13;
per cases
( n = 0 or n > 0 )
;
suppose A34:
n > 0
;
IC (Comput (P,s,(n + 1))) = n + 1
n + 0 <= n + 1
by XREAL_1:7;
then A35:
CurInstr (
P,
(Comput (P,s,n))) =
P . n
by A30, A31, A2, PARTFUN1:def 6, XXREAL_0:2
.=
AddTo (
a,
(intloc 0))
by A22, A32, A34
;
A36:
Comput (
P,
s,
(n + 1)) =
Following (
P,
(Comput (P,s,n)))
by EXTPRO_1:3
.=
Exec (
(AddTo (a,(intloc 0))),
(Comput (P,s,n)))
by A35
;
thus IC (Comput (P,s,(n + 1))) =
(IC (Comput (P,s,n))) + 1
by A36, SCMFSA_2:64
.=
n + 1
by A30, A31, NAT_1:13
;
verum end; end;
end;
A37:
S1[
0 ]
by A1;
for
i being
Nat holds
S1[
i]
from NAT_1:sch 2(A37, A29);
hence
IC (Comput (P,s,i)) = i
by A28;
verum
end;
k < k + (len (Stop SCM+FSA))
by XREAL_1:29;
then A38:
((<%(a := (intloc 0))%> ^ (k1 --> (AddTo (a,(intloc 0))))) ^ (Stop SCM+FSA)) . k =
(Stop SCM+FSA) . (k - k)
by A7, AFINSQ_1:18
.=
halt SCM+FSA
by AFINSQ_1:34
;
CurInstr (
P,
(Comput (P,s,k))) =
P . (IC (Comput (P,s,k)))
by A2, PARTFUN1:def 6
.=
P . k
by A27
.=
halt SCM+FSA
by A38, A12
;
hence
P halts_on s
by EXTPRO_1:29;
verum end; suppose A39:
k <= 0
;
P halts_on sthen reconsider mk =
- k as
Element of
NAT by INT_1:3;
consider k1 being
Nat such that A40:
k1 + k = 1
and A41:
a := k = (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)
by A39, SCMFSA_7:def 1;
A42:
len (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) =
(len <%(a := (intloc 0))%>) + (len (k1 --> (SubFrom (a,(intloc 0)))))
by AFINSQ_1:17
.=
1
+ (len (k1 --> (SubFrom (a,(intloc 0)))))
by AFINSQ_1:34
.=
(mk + 1) + 1
by A40
;
set f =
(<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA);
A43:
((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . 0 =
(<%(a := (intloc 0))%> ^ ((k1 --> (SubFrom (a,(intloc 0)))) ^ (Stop SCM+FSA))) . 0
by AFINSQ_1:27
.=
a := (intloc 0)
by AFINSQ_1:35
;
A44:
len ((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) =
(len (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0)))))) + (len (Stop SCM+FSA))
by AFINSQ_1:17
.=
((mk + 1) + 1) + 1
by A42, AFINSQ_1:34
;
A47:
for
i being
Nat st
0 <= i &
i <= (mk + 1) + 1 holds
P . i = ((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i
by A3, A41, A45, GRFUNC_1:2;
then A48:
P . 0 = a := (intloc 0)
by A43;
A49:
now for n being Element of NAT st n = 0 holds
( Comput (P,s,n) = s & CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) )let n be
Element of
NAT ;
( n = 0 implies ( Comput (P,s,n) = s & CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) ) )assume
n = 0
;
( Comput (P,s,n) = s & CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) )hence A50:
Comput (
P,
s,
n)
= s
;
( CurInstr (P,(Comput (P,s,n))) = a := (intloc 0) & Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s) )hence
CurInstr (
P,
(Comput (P,s,n)))
= a := (intloc 0)
by A1, A48, A2, PARTFUN1:def 6;
Comput (P,s,(n + 1)) = Exec ((a := (intloc 0)),s)thus Comput (
P,
s,
(n + 1)) =
Following (
P,
(Comput (P,s,n)))
by EXTPRO_1:3
.=
Exec (
(a := (intloc 0)),
s)
by A50, A1, A48, A2, PARTFUN1:def 6
;
verum end; A51:
now for i being Nat st 1 <= i & i < (mk + 1) + 1 holds
((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i = SubFrom (a,(intloc 0))A52:
len <%(a := (intloc 0))%> = 1
by AFINSQ_1:33;
let i be
Nat;
( 1 <= i & i < (mk + 1) + 1 implies ((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i = SubFrom (a,(intloc 0)) )assume that A53:
1
<= i
and A54:
i < (mk + 1) + 1
;
((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i = SubFrom (a,(intloc 0))reconsider i1 =
i - 1 as
Element of
NAT by A53, INT_1:5;
i - 1
< (k1 + 1) - 1
by A54, A40, XREAL_1:9;
then A55:
i1 in Segm k1
by NAT_1:44;
A56:
len (k1 --> (SubFrom (a,(intloc 0)))) = k1
;
i in dom (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0)))))
by A54, A42, AFINSQ_1:86;
hence ((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . i =
(<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) . i
by AFINSQ_1:def 3
.=
(k1 --> (SubFrom (a,(intloc 0)))) . (i - 1)
by A40, A53, A54, A52, A56, AFINSQ_1:18
.=
SubFrom (
a,
(intloc 0))
by A55, FUNCOP_1:7
;
verum end; A61:
for
i being
Nat st
i <= (mk + 1) + 1 holds
IC (Comput (P,s,i)) = i
proof
defpred S1[
Nat]
means ( $1
<= (mk + 1) + 1 implies
IC (Comput (P,s,$1)) = $1 );
let i be
Nat;
( i <= (mk + 1) + 1 implies IC (Comput (P,s,i)) = i )
assume A62:
i <= (mk + 1) + 1
;
IC (Comput (P,s,i)) = i
A63:
for
n being
Nat st
S1[
n] holds
S1[
n + 1]
proof
let n be
Nat;
( S1[n] implies S1[n + 1] )
assume A64:
S1[
n]
;
S1[n + 1]
assume A65:
n + 1
<= (mk + 1) + 1
;
IC (Comput (P,s,(n + 1))) = n + 1
then A66:
n < (mk + 1) + 1
by NAT_1:13;
per cases
( n = 0 or n > 0 )
;
suppose A68:
n > 0
;
IC (Comput (P,s,(n + 1))) = n + 1
n + 0 <= n + 1
by XREAL_1:7;
then A69:
CurInstr (
P,
(Comput (P,s,n))) =
P . n
by A64, A65, A2, PARTFUN1:def 6, XXREAL_0:2
.=
SubFrom (
a,
(intloc 0))
by A57, A66, A68
;
A70:
Comput (
P,
s,
(n + 1)) =
Following (
P,
(Comput (P,s,n)))
by EXTPRO_1:3
.=
Exec (
(SubFrom (a,(intloc 0))),
(Comput (P,s,n)))
by A69
;
thus IC (Comput (P,s,(n + 1))) =
(IC (Comput (P,s,n))) + 1
by A70, SCMFSA_2:65
.=
n + 1
by A64, A65, NAT_1:13
;
verum end; end;
end;
A71:
S1[
0 ]
by A1;
for
i being
Nat holds
S1[
i]
from NAT_1:sch 2(A71, A63);
hence
IC (Comput (P,s,i)) = i
by A62;
verum
end;
(
len (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) <= (mk + 1) + 1 &
(mk + 1) + 1
< (len (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0)))))) + (len (Stop SCM+FSA)) implies
((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . ((mk + 1) + 1) = (Stop SCM+FSA) . (((mk + 1) + 1) - (len (<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))))) )
by AFINSQ_1:18;
then A72:
((<%(a := (intloc 0))%> ^ (k1 --> (SubFrom (a,(intloc 0))))) ^ (Stop SCM+FSA)) . ((mk + 1) + 1) = halt SCM+FSA
by A42, XREAL_1:29;
CurInstr (
P,
(Comput (P,s,((mk + 1) + 1)))) =
P . (IC (Comput (P,s,((mk + 1) + 1))))
by A2, PARTFUN1:def 6
.=
P . ((mk + 1) + 1)
by A61
.=
halt SCM+FSA
by A72, A47
;
hence
P halts_on s
by EXTPRO_1:29;
verum end; end;