set D = Int-Locations \/ FinSeq-Locations;
set SAt = Start-At (0,SCM+FSA);
Lm1:
for a being Int-Location
for I being MacroInstruction of SCM+FSA holds (if=0 (a,(I ';' (goto 0)))) . ((card (I ';' (goto 0))) + 1) = goto ((card (I ';' (goto 0))) + 1)
Lm2:
for a being Int-Location
for I being MacroInstruction of SCM+FSA holds (if>0 (a,(I ';' (goto 0)))) . ((card (I ';' (goto 0))) + 1) = goto ((card (I ';' (goto 0))) + 1)
Lm3:
for a being Int-Location
for I being MacroInstruction of SCM+FSA holds UsedILoc (if=0 (a,(I ';' (goto 0)))) = UsedILoc ((if=0 (a,(I ';' (goto 0)))) +* (((card I) + 2),(goto 0)))
Lm4:
for a being Int-Location
for I being MacroInstruction of SCM+FSA holds UsedI*Loc (if=0 (a,(I ';' (goto 0)))) = UsedI*Loc ((if=0 (a,(I ';' (goto 0)))) +* (((card I) + 2),(goto 0)))
definition
let p be
Instruction-Sequence of
SCM+FSA;
let s be
State of
SCM+FSA;
let a be
read-write Int-Location;
let I be
MacroInstruction of
SCM+FSA ;
pred ProperBodyWhile=0 a,
I,
s,
p means
for
k being
Nat st
((StepWhile=0 (a,I,p,s)) . k) . a = 0 holds
I is_halting_on (StepWhile=0 (a,I,p,s)) . k,
p +* (while=0 (a,I));
pred WithVariantWhile=0 a,
I,
s,
p means
ex
f being
Function of
(product (the_Values_of SCM+FSA)),
NAT st
for
k being
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 );
end;
::
deftheorem defines
ProperBodyWhile=0 SCMFSA9A:def 1 :
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for a being read-write Int-Location
for I being MacroInstruction of SCM+FSA holds
( ProperBodyWhile=0 a,I,s,p iff for k being Nat st ((StepWhile=0 (a,I,p,s)) . k) . a = 0 holds
I is_halting_on (StepWhile=0 (a,I,p,s)) . k,p +* (while=0 (a,I)) );
::
deftheorem defines
WithVariantWhile=0 SCMFSA9A:def 2 :
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for a being read-write Int-Location
for I being MacroInstruction of SCM+FSA holds
( WithVariantWhile=0 a,I,s,p iff ex f being Function of (product (the_Values_of SCM+FSA)),NAT st
for k being 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 ) );
theorem Th19:
for
p being
Instruction-Sequence of
SCM+FSA for
s being
State of
SCM+FSA for
a being
read-write Int-Location for
k being
Nat for
I being
really-closed MacroInstruction of
SCM+FSA st (
I is_halting_on Initialized ((StepWhile=0 (a,I,p,s)) . k),
p +* (while=0 (a,I)) or
I is
parahalting ) &
((StepWhile=0 (a,I,p,s)) . k) . a = 0 &
((StepWhile=0 (a,I,p,s)) . k) . (intloc 0) = 1 holds
DataPart ((StepWhile=0 (a,I,p,s)) . (k + 1)) = DataPart (IExec (I,(p +* (while=0 (a,I))),((StepWhile=0 (a,I,p,s)) . k)))
theorem
for
p1,
p2 being
Instruction-Sequence of
SCM+FSA for
s1,
s2 being
State of
SCM+FSA for
a being
read-write Int-Location for
I being
really-closed MacroInstruction of
SCM+FSA st
ProperBodyWhile=0 a,
I,
s1,
p1 &
DataPart s1 = DataPart s2 holds
for
k being
Nat holds
DataPart ((StepWhile=0 (a,I,p1,s1)) . k) = DataPart ((StepWhile=0 (a,I,p2,s2)) . k)
definition
let p be
Instruction-Sequence of
SCM+FSA;
let s be
State of
SCM+FSA;
let a be
read-write Int-Location;
let I be
really-closed MacroInstruction of
SCM+FSA ;
assume that A1:
(
ProperBodyWhile=0 a,
I,
s,
p or
I is
parahalting )
and A2:
WithVariantWhile=0 a,
I,
s,
p
;
func ExitsAtWhile=0 (
a,
I,
p,
s)
-> Nat means :
Def3:
ex
k being
Nat st
(
it = k &
((StepWhile=0 (a,I,p,s)) . k) . a <> 0 & ( for
i being
Nat st
((StepWhile=0 (a,I,p,s)) . i) . a <> 0 holds
k <= i ) &
DataPart (Comput ((p +* (while=0 (a,I))),(Initialize s),(LifeSpan ((p +* (while=0 (a,I))),(Initialize s))))) = DataPart ((StepWhile=0 (a,I,p,s)) . k) );
existence
ex b1, k being Nat st
( b1 = k & ((StepWhile=0 (a,I,p,s)) . k) . a <> 0 & ( for i being Nat st ((StepWhile=0 (a,I,p,s)) . i) . a <> 0 holds
k <= i ) & DataPart (Comput ((p +* (while=0 (a,I))),(Initialize s),(LifeSpan ((p +* (while=0 (a,I))),(Initialize s))))) = DataPart ((StepWhile=0 (a,I,p,s)) . k) )
uniqueness
for b1, b2 being Nat st ex k being Nat st
( b1 = k & ((StepWhile=0 (a,I,p,s)) . k) . a <> 0 & ( for i being Nat st ((StepWhile=0 (a,I,p,s)) . i) . a <> 0 holds
k <= i ) & DataPart (Comput ((p +* (while=0 (a,I))),(Initialize s),(LifeSpan ((p +* (while=0 (a,I))),(Initialize s))))) = DataPart ((StepWhile=0 (a,I,p,s)) . k) ) & ex k being Nat st
( b2 = k & ((StepWhile=0 (a,I,p,s)) . k) . a <> 0 & ( for i being Nat st ((StepWhile=0 (a,I,p,s)) . i) . a <> 0 holds
k <= i ) & DataPart (Comput ((p +* (while=0 (a,I))),(Initialize s),(LifeSpan ((p +* (while=0 (a,I))),(Initialize s))))) = DataPart ((StepWhile=0 (a,I,p,s)) . k) ) holds
b1 = b2
end;
::
deftheorem Def3 defines
ExitsAtWhile=0 SCMFSA9A:def 3 :
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for a being read-write Int-Location
for I being really-closed MacroInstruction of SCM+FSA st ( ProperBodyWhile=0 a,I,s,p or I is parahalting ) & WithVariantWhile=0 a,I,s,p holds
for b5 being Nat holds
( b5 = ExitsAtWhile=0 (a,I,p,s) iff ex k being Nat st
( b5 = k & ((StepWhile=0 (a,I,p,s)) . k) . a <> 0 & ( for i being Nat st ((StepWhile=0 (a,I,p,s)) . i) . a <> 0 holds
k <= i ) & DataPart (Comput ((p +* (while=0 (a,I))),(Initialize s),(LifeSpan ((p +* (while=0 (a,I))),(Initialize s))))) = DataPart ((StepWhile=0 (a,I,p,s)) . k) ) );
theorem
for
p being
Instruction-Sequence of
SCM+FSA for
s being
State of
SCM+FSA for
a being
read-write Int-Location for
I being
really-closed MacroInstruction of
SCM+FSA st (
ProperBodyWhile=0 a,
I,
Initialized s,
p or
I is
parahalting ) &
WithVariantWhile=0 a,
I,
Initialized s,
p holds
DataPart (IExec ((while=0 (a,I)),p,s)) = DataPart ((StepWhile=0 (a,I,p,(Initialized s))) . (ExitsAtWhile=0 (a,I,p,(Initialized s))))
Lm5:
for a being Int-Location
for I being MacroInstruction of SCM+FSA holds UsedILoc (if>0 (a,(I ';' (goto 0)))) = UsedILoc ((if>0 (a,(I ';' (goto 0)))) +* (((card I) + 2),(goto 0)))
Lm6:
for a being Int-Location
for I being MacroInstruction of SCM+FSA holds UsedI*Loc (if>0 (a,(I ';' (goto 0)))) = UsedI*Loc ((if>0 (a,(I ';' (goto 0)))) +* (((card I) + 2),(goto 0)))
definition
let p be
Instruction-Sequence of
SCM+FSA;
let s be
State of
SCM+FSA;
let a be
read-write Int-Location;
let I be
MacroInstruction of
SCM+FSA ;
pred ProperBodyWhile>0 a,
I,
s,
p means
for
k being
Nat st
((StepWhile>0 (a,I,p,s)) . k) . a > 0 holds
I is_halting_on (StepWhile>0 (a,I,p,s)) . k,
p +* (while>0 (a,I));
pred WithVariantWhile>0 a,
I,
s,
p means
ex
f being
Function of
(product (the_Values_of SCM+FSA)),
NAT st
for
k being
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 );
end;
::
deftheorem defines
ProperBodyWhile>0 SCMFSA9A:def 4 :
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for a being read-write Int-Location
for I being MacroInstruction of SCM+FSA holds
( ProperBodyWhile>0 a,I,s,p iff for k being Nat st ((StepWhile>0 (a,I,p,s)) . k) . a > 0 holds
I is_halting_on (StepWhile>0 (a,I,p,s)) . k,p +* (while>0 (a,I)) );
::
deftheorem defines
WithVariantWhile>0 SCMFSA9A:def 5 :
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for a being read-write Int-Location
for I being MacroInstruction of SCM+FSA holds
( WithVariantWhile>0 a,I,s,p iff ex f being Function of (product (the_Values_of SCM+FSA)),NAT st
for k being 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 ) );
theorem Th32:
for
p being
Instruction-Sequence of
SCM+FSA for
s being
State of
SCM+FSA for
a being
read-write Int-Location for
k being
Nat for
I being
really-closed MacroInstruction of
SCM+FSA st (
I is_halting_on Initialized ((StepWhile>0 (a,I,p,s)) . k),
p +* (while>0 (a,I)) or
I is
parahalting ) &
((StepWhile>0 (a,I,p,s)) . k) . a > 0 &
((StepWhile>0 (a,I,p,s)) . k) . (intloc 0) = 1 holds
DataPart ((StepWhile>0 (a,I,p,s)) . (k + 1)) = DataPart (IExec (I,(p +* (while>0 (a,I))),((StepWhile>0 (a,I,p,s)) . k)))
theorem Th34:
for
p1,
p2 being
Instruction-Sequence of
SCM+FSA for
s1,
s2 being
State of
SCM+FSA for
a being
read-write Int-Location for
I being
really-closed MacroInstruction of
SCM+FSA st
ProperBodyWhile>0 a,
I,
s1,
p1 &
DataPart s1 = DataPart s2 holds
for
k being
Nat holds
DataPart ((StepWhile>0 (a,I,p1,s1)) . k) = DataPart ((StepWhile>0 (a,I,p2,s2)) . k)
definition
let p be
Instruction-Sequence of
SCM+FSA;
let s be
State of
SCM+FSA;
let a be
read-write Int-Location;
let I be
really-closed MacroInstruction of
SCM+FSA ;
assume that A1:
(
ProperBodyWhile>0 a,
I,
s,
p or
I is
parahalting )
and A2:
WithVariantWhile>0 a,
I,
s,
p
;
func ExitsAtWhile>0 (
a,
I,
p,
s)
-> Nat means :
Def6:
ex
k being
Nat st
(
it = k &
((StepWhile>0 (a,I,p,s)) . k) . a <= 0 & ( for
i being
Nat st
((StepWhile>0 (a,I,p,s)) . i) . a <= 0 holds
k <= i ) &
DataPart (Comput ((p +* (while>0 (a,I))),(Initialize s),(LifeSpan ((p +* (while>0 (a,I))),(Initialize s))))) = DataPart ((StepWhile>0 (a,I,p,s)) . k) );
existence
ex b1, k being Nat st
( b1 = k & ((StepWhile>0 (a,I,p,s)) . k) . a <= 0 & ( for i being Nat st ((StepWhile>0 (a,I,p,s)) . i) . a <= 0 holds
k <= i ) & DataPart (Comput ((p +* (while>0 (a,I))),(Initialize s),(LifeSpan ((p +* (while>0 (a,I))),(Initialize s))))) = DataPart ((StepWhile>0 (a,I,p,s)) . k) )
uniqueness
for b1, b2 being Nat st ex k being Nat st
( b1 = k & ((StepWhile>0 (a,I,p,s)) . k) . a <= 0 & ( for i being Nat st ((StepWhile>0 (a,I,p,s)) . i) . a <= 0 holds
k <= i ) & DataPart (Comput ((p +* (while>0 (a,I))),(Initialize s),(LifeSpan ((p +* (while>0 (a,I))),(Initialize s))))) = DataPart ((StepWhile>0 (a,I,p,s)) . k) ) & ex k being Nat st
( b2 = k & ((StepWhile>0 (a,I,p,s)) . k) . a <= 0 & ( for i being Nat st ((StepWhile>0 (a,I,p,s)) . i) . a <= 0 holds
k <= i ) & DataPart (Comput ((p +* (while>0 (a,I))),(Initialize s),(LifeSpan ((p +* (while>0 (a,I))),(Initialize s))))) = DataPart ((StepWhile>0 (a,I,p,s)) . k) ) holds
b1 = b2
end;
::
deftheorem Def6 defines
ExitsAtWhile>0 SCMFSA9A:def 6 :
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for a being read-write Int-Location
for I being really-closed MacroInstruction of SCM+FSA st ( ProperBodyWhile>0 a,I,s,p or I is parahalting ) & WithVariantWhile>0 a,I,s,p holds
for b5 being Nat holds
( b5 = ExitsAtWhile>0 (a,I,p,s) iff ex k being Nat st
( b5 = k & ((StepWhile>0 (a,I,p,s)) . k) . a <= 0 & ( for i being Nat st ((StepWhile>0 (a,I,p,s)) . i) . a <= 0 holds
k <= i ) & DataPart (Comput ((p +* (while>0 (a,I))),(Initialize s),(LifeSpan ((p +* (while>0 (a,I))),(Initialize s))))) = DataPart ((StepWhile>0 (a,I,p,s)) . k) ) );
theorem Th36:
for
p being
Instruction-Sequence of
SCM+FSA for
s being
State of
SCM+FSA for
a being
read-write Int-Location for
I being
really-closed MacroInstruction of
SCM+FSA st (
ProperBodyWhile>0 a,
I,
Initialized s,
p or
I is
parahalting ) &
WithVariantWhile>0 a,
I,
Initialized s,
p holds
DataPart (IExec ((while>0 (a,I)),p,s)) = DataPart ((StepWhile>0 (a,I,p,(Initialized s))) . (ExitsAtWhile>0 (a,I,p,(Initialized s))))
Lm7:
for p being Instruction-Sequence of SCM+FSA
for s being State of SCM+FSA
for I being really-closed Program of st s . (intloc 0) = 1 holds
( I is_halting_on s,p iff I is_halting_on Initialized s,p )
theorem Th39:
for
p being
Instruction-Sequence of
SCM+FSA for
s being
State of
SCM+FSA for
a being
read-write Int-Location for
Ig being
good really-closed MacroInstruction of
SCM+FSA st
s . (intloc 0) = 1 &
ProperBodyWhile>0 a,
Ig,
s,
p &
WithVariantWhile>0 a,
Ig,
s,
p holds
for
i,
j being
Nat st
i <> j &
i <= ExitsAtWhile>0 (
a,
Ig,
p,
s) &
j <= ExitsAtWhile>0 (
a,
Ig,
p,
s) holds
(
(StepWhile>0 (a,Ig,p,s)) . i <> (StepWhile>0 (a,Ig,p,s)) . j &
DataPart ((StepWhile>0 (a,Ig,p,s)) . i) <> DataPart ((StepWhile>0 (a,Ig,p,s)) . j) )
canceled;
theorem Th40:
for
p being
Instruction-Sequence of
SCM+FSA for
s being
State of
SCM+FSA for
a being
read-write Int-Location for
Ig being
good really-closed MacroInstruction of
SCM+FSA st
s . (intloc 0) = 1 &
ProperBodyWhile>0 a,
Ig,
s,
p &
WithVariantWhile>0 a,
Ig,
s,
p holds
ex
f being
Function of
(product (the_Values_of SCM+FSA)),
NAT st
(
f is
on_data_only & ( for
k being
Nat holds
(
f . ((StepWhile>0 (a,Ig,p,s)) . (k + 1)) < f . ((StepWhile>0 (a,Ig,p,s)) . k) or
((StepWhile>0 (a,Ig,p,s)) . k) . a <= 0 ) ) )
theorem
for
p1,
p2 being
Instruction-Sequence of
SCM+FSA for
s1,
s2 being
State of
SCM+FSA for
a being
read-write Int-Location for
Ig being
good really-closed MacroInstruction of
SCM+FSA st
s1 . (intloc 0) = 1 &
DataPart s1 = DataPart s2 &
ProperBodyWhile>0 a,
Ig,
s1,
p1 &
WithVariantWhile>0 a,
Ig,
s1,
p1 holds
WithVariantWhile>0 a,
Ig,
s2,
p2
definition
let N,
result be
Int-Location;
func Fusc_macro (
N,
result)
-> MacroInstruction of
SCM+FSA equals
(((SubFrom (result,result)) ";" ((1 -stRWNotIn {N,result}) := (intloc 0))) ";" ((2 -ndRWNotIn {N,result}) := N)) ";" (while>0 ((2 -ndRWNotIn {N,result}),((((3 -rdRWNotIn {N,result}) := 2) ";" (Divide ((2 -ndRWNotIn {N,result}),(3 -rdRWNotIn {N,result})))) ";" (if=0 ((3 -rdRWNotIn {N,result}),(Macro (AddTo ((1 -stRWNotIn {N,result}),result))),(Macro (AddTo (result,(1 -stRWNotIn {N,result})))))))));
correctness
coherence
(((SubFrom (result,result)) ";" ((1 -stRWNotIn {N,result}) := (intloc 0))) ";" ((2 -ndRWNotIn {N,result}) := N)) ";" (while>0 ((2 -ndRWNotIn {N,result}),((((3 -rdRWNotIn {N,result}) := 2) ";" (Divide ((2 -ndRWNotIn {N,result}),(3 -rdRWNotIn {N,result})))) ";" (if=0 ((3 -rdRWNotIn {N,result}),(Macro (AddTo ((1 -stRWNotIn {N,result}),result))),(Macro (AddTo (result,(1 -stRWNotIn {N,result}))))))))) is MacroInstruction of SCM+FSA ;
;
end;
::
deftheorem defines
Fusc_macro SCMFSA9A:def 7 :
for N, result being Int-Location holds Fusc_macro (N,result) = (((SubFrom (result,result)) ";" ((1 -stRWNotIn {N,result}) := (intloc 0))) ";" ((2 -ndRWNotIn {N,result}) := N)) ";" (while>0 ((2 -ndRWNotIn {N,result}),((((3 -rdRWNotIn {N,result}) := 2) ";" (Divide ((2 -ndRWNotIn {N,result}),(3 -rdRWNotIn {N,result})))) ";" (if=0 ((3 -rdRWNotIn {N,result}),(Macro (AddTo ((1 -stRWNotIn {N,result}),result))),(Macro (AddTo (result,(1 -stRWNotIn {N,result})))))))));
set D = Data-Locations ;
theorem Th48:
for
s being
State of
SCM+FSA for
p being
Instruction-Sequence of
SCM+FSA for
k being
Nat for
a being
read-write Int-Location for
J being
good really-closed MacroInstruction of
SCM+FSA st not
J destroys a &
((StepTimes (a,J,p,s)) . k) . (intloc 0) = 1 &
J is_halting_on (StepTimes (a,J,p,s)) . k,
p +* (Times (a,J)) holds
(
((StepTimes (a,J,p,s)) . (k + 1)) . (intloc 0) = 1 & (
((StepTimes (a,J,p,s)) . k) . a > 0 implies
((StepTimes (a,J,p,s)) . (k + 1)) . a = (((StepTimes (a,J,p,s)) . k) . a) - 1 ) )