:: SCMFSA9A semantic presentation

scheme :: SCMFSA9A:sch 1
s1{ F1( Nat) -> Nat, P1[ set ] } :
ex b1 being Nat st
( P1[b1] & ( for b2 being Nat st P1[b2] holds
b1 <= b2 ) )
provided
E1: for b1 being Nat holds
( F1((b1 + 1)) < F1(b1) or P1[b1] )
proof end;

theorem Th1: :: SCMFSA9A:1
for b1 being natural number holds
( not b1 is even iff ex b2 being Nat st b1 = (2 * b2) + 1 )
proof end;

theorem Th2: :: SCMFSA9A:2
canceled;

theorem Th3: :: SCMFSA9A:3
canceled;

theorem Th4: :: SCMFSA9A:4
for b1, b2 being Integer st 0 < b1 & 1 < b2 holds
b1 div b2 < b1
proof end;

theorem Th5: :: SCMFSA9A:5
canceled;

theorem Th6: :: SCMFSA9A:6
for b1 being non empty with_non-empty_elements set
for b2 being non empty non void halting IC-Ins-separated definite AMI-Struct of b1
for b3 being State of b2
for b4 being Nat st CurInstr ((Computation b3) . b4) = halt b2 holds
(Computation b3) . (LifeSpan b3) = (Computation b3) . b4
proof end;

theorem Th7: :: SCMFSA9A:7
for b1 being Instruction-Location of SCM+FSA
for b2 being Instruction of SCM+FSA holds UsedIntLoc (b1 .--> b2) = UsedIntLoc b2
proof end;

theorem Th8: :: SCMFSA9A:8
for b1 being Instruction-Location of SCM+FSA
for b2 being Instruction of SCM+FSA holds UsedInt*Loc (b1 .--> b2) = UsedInt*Loc b2
proof end;

theorem Th9: :: SCMFSA9A:9
UsedIntLoc SCM+FSA-Stop = {} by Th7, SCMFSA_4:def 5, SF_MASTR:17;

theorem Th10: :: SCMFSA9A:10
UsedInt*Loc SCM+FSA-Stop = {}
proof end;

theorem Th11: :: SCMFSA9A:11
for b1 being Instruction-Location of SCM+FSA holds UsedIntLoc (Goto b1) = {}
proof end;

theorem Th12: :: SCMFSA9A:12
for b1 being Instruction-Location of SCM+FSA holds UsedInt*Loc (Goto b1) = {}
proof end;

set c1 = Int-Locations \/ FinSeq-Locations ;

set c2 = Start-At (insloc 0);

set c3 = the Instruction-Locations of SCM+FSA ;

theorem Th13: :: SCMFSA9A:13
for b1 being Int-Location
for b2, b3 being Macro-Instruction holds UsedIntLoc (if=0 b1,b2,b3) = ({b1} \/ (UsedIntLoc b2)) \/ (UsedIntLoc b3)
proof end;

theorem Th14: :: SCMFSA9A:14
for b1, b2 being Macro-Instruction
for b3 being Int-Location holds UsedInt*Loc (if=0 b3,b1,b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2)
proof end;

theorem Th15: :: SCMFSA9A:15
for b1 being Int-Location
for b2, b3 being Macro-Instruction holds UsedIntLoc (if>0 b1,b2,b3) = ({b1} \/ (UsedIntLoc b2)) \/ (UsedIntLoc b3)
proof end;

theorem Th16: :: SCMFSA9A:16
for b1 being Int-Location
for b2, b3 being Macro-Instruction holds UsedInt*Loc (if>0 b1,b2,b3) = (UsedInt*Loc b2) \/ (UsedInt*Loc b3)
proof end;

Lemma14: for b1 being Int-Location
for b2 being Macro-Instruction holds
( insloc ((card b2) + 4) in dom (if=0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) & (if=0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) . (insloc ((card b2) + 4)) = goto ((insloc 0) + ((card b2) + 4)) )
proof end;

Lemma15: for b1 being Int-Location
for b2 being Macro-Instruction holds UsedIntLoc (if=0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) = UsedIntLoc ((if=0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) +* ((insloc ((card b2) + 4)) .--> (goto (insloc 0))))
proof end;

Lemma16: for b1 being Int-Location
for b2 being Macro-Instruction holds UsedInt*Loc (if=0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) = UsedInt*Loc ((if=0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) +* ((insloc ((card b2) + 4)) .--> (goto (insloc 0))))
proof end;

theorem Th17: :: SCMFSA9A:17
for b1 being Int-Location
for b2 being Macro-Instruction holds UsedIntLoc (while=0 b1,b2) = {b1} \/ (UsedIntLoc b2)
proof end;

theorem Th18: :: SCMFSA9A:18
for b1 being Int-Location
for b2 being Macro-Instruction holds UsedInt*Loc (while=0 b1,b2) = UsedInt*Loc b2
proof end;

definition
let c4 be State of SCM+FSA ;
let c5 be read-write Int-Location ;
let c6 be Macro-Instruction;
pred ProperBodyWhile=0 c2,c3,c1 means :Def1: :: SCMFSA9A:def 1
for b1 being Nat st ((StepWhile=0 a2,a3,a1) . b1) . a2 = 0 holds
( a3 is_closed_on (StepWhile=0 a2,a3,a1) . b1 & a3 is_halting_on (StepWhile=0 a2,a3,a1) . b1 );
pred WithVariantWhile=0 c2,c3,c1 means :Def2: :: SCMFSA9A:def 2
ex b1 being Function of product the Object-Kind of SCM+FSA , NAT st
for b2 being Nat holds
( b1 . ((StepWhile=0 a2,a3,a1) . (b2 + 1)) < b1 . ((StepWhile=0 a2,a3,a1) . b2) or ((StepWhile=0 a2,a3,a1) . b2) . a2 <> 0 );
end;

:: deftheorem Def1 defines ProperBodyWhile=0 SCMFSA9A:def 1 :
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction holds
( ProperBodyWhile=0 b2,b3,b1 iff for b4 being Nat st ((StepWhile=0 b2,b3,b1) . b4) . b2 = 0 holds
( b3 is_closed_on (StepWhile=0 b2,b3,b1) . b4 & b3 is_halting_on (StepWhile=0 b2,b3,b1) . b4 ) );

:: deftheorem Def2 defines WithVariantWhile=0 SCMFSA9A:def 2 :
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction holds
( WithVariantWhile=0 b2,b3,b1 iff ex b4 being Function of product the Object-Kind of SCM+FSA , NAT st
for b5 being Nat holds
( b4 . ((StepWhile=0 b2,b3,b1) . (b5 + 1)) < b4 . ((StepWhile=0 b2,b3,b1) . b5) or ((StepWhile=0 b2,b3,b1) . b5) . b2 <> 0 ) );

theorem Th19: :: SCMFSA9A:19
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being parahalting Macro-Instruction holds ProperBodyWhile=0 b2,b3,b1
proof end;

theorem Th20: :: SCMFSA9A:20
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st ProperBodyWhile=0 b2,b3,b1 & WithVariantWhile=0 b2,b3,b1 holds
( while=0 b2,b3 is_halting_on b1 & while=0 b2,b3 is_closed_on b1 )
proof end;

theorem Th21: :: SCMFSA9A:21
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being parahalting Macro-Instruction st WithVariantWhile=0 b2,b3,b1 holds
( while=0 b2,b3 is_halting_on b1 & while=0 b2,b3 is_closed_on b1 )
proof end;

theorem Th22: :: SCMFSA9A:22
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st (while=0 b2,b3) +* (Start-At (insloc 0)) c= b1 & b1 . b2 <> 0 holds
( LifeSpan b1 = 4 & ( for b4 being Nat holds ((Computation b1) . b4) | (Int-Locations \/ FinSeq-Locations ) = b1 | (Int-Locations \/ FinSeq-Locations ) ) )
proof end;

theorem Th23: :: SCMFSA9A:23
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st b3 is_closed_on b1 & b3 is_halting_on b1 & b1 . b2 = 0 holds
((Computation (b1 +* ((while=0 b2,b3) +* (Start-At (insloc 0))))) . ((LifeSpan (b1 +* (b3 +* (Start-At (insloc 0))))) + 3)) | (Int-Locations \/ FinSeq-Locations ) = ((Computation (b1 +* (b3 +* (Start-At (insloc 0))))) . (LifeSpan (b1 +* (b3 +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th24: :: SCMFSA9A:24
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction
for b4 being Nat st ((StepWhile=0 b2,b3,b1) . b4) . b2 <> 0 holds
((StepWhile=0 b2,b3,b1) . (b4 + 1)) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 b2,b3,b1) . b4) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th25: :: SCMFSA9A:25
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction
for b4 being Nat st ( ( b3 is_halting_on Initialize ((StepWhile=0 b2,b3,b1) . b4) & b3 is_closed_on Initialize ((StepWhile=0 b2,b3,b1) . b4) ) or b3 is parahalting ) & ((StepWhile=0 b2,b3,b1) . b4) . b2 = 0 & ((StepWhile=0 b2,b3,b1) . b4) . (intloc 0) = 1 holds
((StepWhile=0 b2,b3,b1) . (b4 + 1)) | (Int-Locations \/ FinSeq-Locations ) = (IExec b3,((StepWhile=0 b2,b3,b1) . b4)) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th26: :: SCMFSA9A:26
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being good Macro-Instruction st ( ProperBodyWhile=0 b2,b3,b1 or b3 is parahalting ) & b1 . (intloc 0) = 1 holds
for b4 being Nat holds ((StepWhile=0 b2,b3,b1) . b4) . (intloc 0) = 1
proof end;

theorem Th27: :: SCMFSA9A:27
for b1, b2 being State of SCM+FSA
for b3 being read-write Int-Location
for b4 being Macro-Instruction st ProperBodyWhile=0 b3,b4,b1 & b1 | (Int-Locations \/ FinSeq-Locations ) = b2 | (Int-Locations \/ FinSeq-Locations ) holds
for b5 being Nat holds ((StepWhile=0 b3,b4,b1) . b5) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 b3,b4,b2) . b5) | (Int-Locations \/ FinSeq-Locations )
proof end;

definition
let c4 be State of SCM+FSA ;
let c5 be read-write Int-Location ;
let c6 be Macro-Instruction;
assume that
E26: ( ProperBodyWhile=0 c5,c6,c4 or c6 is parahalting ) and
E27: WithVariantWhile=0 c5,c6,c4 ;
func ExitsAtWhile=0 c2,c3,c1 -> Nat means :Def3: :: SCMFSA9A:def 3
ex b1 being Nat st
( a4 = b1 & ((StepWhile=0 a2,a3,a1) . b1) . a2 <> 0 & ( for b2 being Nat st ((StepWhile=0 a2,a3,a1) . b2) . a2 <> 0 holds
b1 <= b2 ) & ((Computation (a1 +* ((while=0 a2,a3) +* (Start-At (insloc 0))))) . (LifeSpan (a1 +* ((while=0 a2,a3) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 a2,a3,a1) . b1) | (Int-Locations \/ FinSeq-Locations ) );
existence
ex b1, b2 being Nat st
( b1 = b2 & ((StepWhile=0 c5,c6,c4) . b2) . c5 <> 0 & ( for b3 being Nat st ((StepWhile=0 c5,c6,c4) . b3) . c5 <> 0 holds
b2 <= b3 ) & ((Computation (c4 +* ((while=0 c5,c6) +* (Start-At (insloc 0))))) . (LifeSpan (c4 +* ((while=0 c5,c6) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 c5,c6,c4) . b2) | (Int-Locations \/ FinSeq-Locations ) )
proof end;
uniqueness
for b1, b2 being Nat st ex b3 being Nat st
( b1 = b3 & ((StepWhile=0 c5,c6,c4) . b3) . c5 <> 0 & ( for b4 being Nat st ((StepWhile=0 c5,c6,c4) . b4) . c5 <> 0 holds
b3 <= b4 ) & ((Computation (c4 +* ((while=0 c5,c6) +* (Start-At (insloc 0))))) . (LifeSpan (c4 +* ((while=0 c5,c6) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 c5,c6,c4) . b3) | (Int-Locations \/ FinSeq-Locations ) ) & ex b3 being Nat st
( b2 = b3 & ((StepWhile=0 c5,c6,c4) . b3) . c5 <> 0 & ( for b4 being Nat st ((StepWhile=0 c5,c6,c4) . b4) . c5 <> 0 holds
b3 <= b4 ) & ((Computation (c4 +* ((while=0 c5,c6) +* (Start-At (insloc 0))))) . (LifeSpan (c4 +* ((while=0 c5,c6) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 c5,c6,c4) . b3) | (Int-Locations \/ FinSeq-Locations ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines ExitsAtWhile=0 SCMFSA9A:def 3 :
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st ( ProperBodyWhile=0 b2,b3,b1 or b3 is parahalting ) & WithVariantWhile=0 b2,b3,b1 holds
for b4 being Nat holds
( b4 = ExitsAtWhile=0 b2,b3,b1 iff ex b5 being Nat st
( b4 = b5 & ((StepWhile=0 b2,b3,b1) . b5) . b2 <> 0 & ( for b6 being Nat st ((StepWhile=0 b2,b3,b1) . b6) . b2 <> 0 holds
b5 <= b6 ) & ((Computation (b1 +* ((while=0 b2,b3) +* (Start-At (insloc 0))))) . (LifeSpan (b1 +* ((while=0 b2,b3) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 b2,b3,b1) . b5) | (Int-Locations \/ FinSeq-Locations ) ) );

theorem Th28: :: SCMFSA9A:28
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st b1 . (intloc 0) = 1 & b1 . b2 <> 0 holds
(IExec (while=0 b2,b3),b1) | (Int-Locations \/ FinSeq-Locations ) = b1 | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th29: :: SCMFSA9A:29
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st ( ProperBodyWhile=0 b2,b3, Initialize b1 or b3 is parahalting ) & WithVariantWhile=0 b2,b3, Initialize b1 holds
(IExec (while=0 b2,b3),b1) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile=0 b2,b3,(Initialize b1)) . (ExitsAtWhile=0 b2,b3,(Initialize b1))) | (Int-Locations \/ FinSeq-Locations )
proof end;

Lemma27: for b1 being Int-Location
for b2 being Macro-Instruction holds
( insloc ((card b2) + 4) in dom (if>0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) & (if>0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) . (insloc ((card b2) + 4)) = goto ((insloc 0) + ((card b2) + 4)) )
proof end;

Lemma28: for b1 being Int-Location
for b2 being Macro-Instruction holds UsedIntLoc (if>0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) = UsedIntLoc ((if>0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) +* ((insloc ((card b2) + 4)) .--> (goto (insloc 0))))
proof end;

Lemma29: for b1 being Int-Location
for b2 being Macro-Instruction holds UsedInt*Loc (if>0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) = UsedInt*Loc ((if>0 b1,(b2 ';' (Goto (insloc 0))),SCM+FSA-Stop ) +* ((insloc ((card b2) + 4)) .--> (goto (insloc 0))))
proof end;

theorem Th30: :: SCMFSA9A:30
for b1 being Int-Location
for b2 being Macro-Instruction holds UsedIntLoc (while>0 b1,b2) = {b1} \/ (UsedIntLoc b2)
proof end;

theorem Th31: :: SCMFSA9A:31
for b1 being Int-Location
for b2 being Macro-Instruction holds UsedInt*Loc (while>0 b1,b2) = UsedInt*Loc b2
proof end;

definition
let c4 be State of SCM+FSA ;
let c5 be read-write Int-Location ;
let c6 be Macro-Instruction;
pred ProperBodyWhile>0 c2,c3,c1 means :Def4: :: SCMFSA9A:def 4
for b1 being Nat st ((StepWhile>0 a2,a3,a1) . b1) . a2 > 0 holds
( a3 is_closed_on (StepWhile>0 a2,a3,a1) . b1 & a3 is_halting_on (StepWhile>0 a2,a3,a1) . b1 );
pred WithVariantWhile>0 c2,c3,c1 means :Def5: :: SCMFSA9A:def 5
ex b1 being Function of product the Object-Kind of SCM+FSA , NAT st
for b2 being Nat holds
( b1 . ((StepWhile>0 a2,a3,a1) . (b2 + 1)) < b1 . ((StepWhile>0 a2,a3,a1) . b2) or ((StepWhile>0 a2,a3,a1) . b2) . a2 <= 0 );
end;

:: deftheorem Def4 defines ProperBodyWhile>0 SCMFSA9A:def 4 :
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction holds
( ProperBodyWhile>0 b2,b3,b1 iff for b4 being Nat st ((StepWhile>0 b2,b3,b1) . b4) . b2 > 0 holds
( b3 is_closed_on (StepWhile>0 b2,b3,b1) . b4 & b3 is_halting_on (StepWhile>0 b2,b3,b1) . b4 ) );

:: deftheorem Def5 defines WithVariantWhile>0 SCMFSA9A:def 5 :
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction holds
( WithVariantWhile>0 b2,b3,b1 iff ex b4 being Function of product the Object-Kind of SCM+FSA , NAT st
for b5 being Nat holds
( b4 . ((StepWhile>0 b2,b3,b1) . (b5 + 1)) < b4 . ((StepWhile>0 b2,b3,b1) . b5) or ((StepWhile>0 b2,b3,b1) . b5) . b2 <= 0 ) );

theorem Th32: :: SCMFSA9A:32
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being parahalting Macro-Instruction holds ProperBodyWhile>0 b2,b3,b1
proof end;

theorem Th33: :: SCMFSA9A:33
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st ProperBodyWhile>0 b2,b3,b1 & WithVariantWhile>0 b2,b3,b1 holds
( while>0 b2,b3 is_halting_on b1 & while>0 b2,b3 is_closed_on b1 )
proof end;

theorem Th34: :: SCMFSA9A:34
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being parahalting Macro-Instruction st WithVariantWhile>0 b2,b3,b1 holds
( while>0 b2,b3 is_halting_on b1 & while>0 b2,b3 is_closed_on b1 )
proof end;

theorem Th35: :: SCMFSA9A:35
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st (while>0 b2,b3) +* (Start-At (insloc 0)) c= b1 & b1 . b2 <= 0 holds
( LifeSpan b1 = 4 & ( for b4 being Nat holds ((Computation b1) . b4) | (Int-Locations \/ FinSeq-Locations ) = b1 | (Int-Locations \/ FinSeq-Locations ) ) )
proof end;

theorem Th36: :: SCMFSA9A:36
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st b3 is_closed_on b1 & b3 is_halting_on b1 & b1 . b2 > 0 holds
((Computation (b1 +* ((while>0 b2,b3) +* (Start-At (insloc 0))))) . ((LifeSpan (b1 +* (b3 +* (Start-At (insloc 0))))) + 3)) | (Int-Locations \/ FinSeq-Locations ) = ((Computation (b1 +* (b3 +* (Start-At (insloc 0))))) . (LifeSpan (b1 +* (b3 +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th37: :: SCMFSA9A:37
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction
for b4 being Nat st ((StepWhile>0 b2,b3,b1) . b4) . b2 <= 0 holds
((StepWhile>0 b2,b3,b1) . (b4 + 1)) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 b2,b3,b1) . b4) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th38: :: SCMFSA9A:38
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction
for b4 being Nat st ( ( b3 is_halting_on Initialize ((StepWhile>0 b2,b3,b1) . b4) & b3 is_closed_on Initialize ((StepWhile>0 b2,b3,b1) . b4) ) or b3 is parahalting ) & ((StepWhile>0 b2,b3,b1) . b4) . b2 > 0 & ((StepWhile>0 b2,b3,b1) . b4) . (intloc 0) = 1 holds
((StepWhile>0 b2,b3,b1) . (b4 + 1)) | (Int-Locations \/ FinSeq-Locations ) = (IExec b3,((StepWhile>0 b2,b3,b1) . b4)) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th39: :: SCMFSA9A:39
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being good Macro-Instruction st ( ProperBodyWhile>0 b2,b3,b1 or b3 is parahalting ) & b1 . (intloc 0) = 1 holds
for b4 being Nat holds ((StepWhile>0 b2,b3,b1) . b4) . (intloc 0) = 1
proof end;

theorem Th40: :: SCMFSA9A:40
for b1, b2 being State of SCM+FSA
for b3 being read-write Int-Location
for b4 being Macro-Instruction st ProperBodyWhile>0 b3,b4,b1 & b1 | (Int-Locations \/ FinSeq-Locations ) = b2 | (Int-Locations \/ FinSeq-Locations ) holds
for b5 being Nat holds ((StepWhile>0 b3,b4,b1) . b5) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 b3,b4,b2) . b5) | (Int-Locations \/ FinSeq-Locations )
proof end;

definition
let c4 be State of SCM+FSA ;
let c5 be read-write Int-Location ;
let c6 be Macro-Instruction;
assume that
E41: ( ProperBodyWhile>0 c5,c6,c4 or c6 is parahalting ) and
E42: WithVariantWhile>0 c5,c6,c4 ;
func ExitsAtWhile>0 c2,c3,c1 -> Nat means :Def6: :: SCMFSA9A:def 6
ex b1 being Nat st
( a4 = b1 & ((StepWhile>0 a2,a3,a1) . b1) . a2 <= 0 & ( for b2 being Nat st ((StepWhile>0 a2,a3,a1) . b2) . a2 <= 0 holds
b1 <= b2 ) & ((Computation (a1 +* ((while>0 a2,a3) +* (Start-At (insloc 0))))) . (LifeSpan (a1 +* ((while>0 a2,a3) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 a2,a3,a1) . b1) | (Int-Locations \/ FinSeq-Locations ) );
existence
ex b1, b2 being Nat st
( b1 = b2 & ((StepWhile>0 c5,c6,c4) . b2) . c5 <= 0 & ( for b3 being Nat st ((StepWhile>0 c5,c6,c4) . b3) . c5 <= 0 holds
b2 <= b3 ) & ((Computation (c4 +* ((while>0 c5,c6) +* (Start-At (insloc 0))))) . (LifeSpan (c4 +* ((while>0 c5,c6) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 c5,c6,c4) . b2) | (Int-Locations \/ FinSeq-Locations ) )
proof end;
uniqueness
for b1, b2 being Nat st ex b3 being Nat st
( b1 = b3 & ((StepWhile>0 c5,c6,c4) . b3) . c5 <= 0 & ( for b4 being Nat st ((StepWhile>0 c5,c6,c4) . b4) . c5 <= 0 holds
b3 <= b4 ) & ((Computation (c4 +* ((while>0 c5,c6) +* (Start-At (insloc 0))))) . (LifeSpan (c4 +* ((while>0 c5,c6) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 c5,c6,c4) . b3) | (Int-Locations \/ FinSeq-Locations ) ) & ex b3 being Nat st
( b2 = b3 & ((StepWhile>0 c5,c6,c4) . b3) . c5 <= 0 & ( for b4 being Nat st ((StepWhile>0 c5,c6,c4) . b4) . c5 <= 0 holds
b3 <= b4 ) & ((Computation (c4 +* ((while>0 c5,c6) +* (Start-At (insloc 0))))) . (LifeSpan (c4 +* ((while>0 c5,c6) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 c5,c6,c4) . b3) | (Int-Locations \/ FinSeq-Locations ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines ExitsAtWhile>0 SCMFSA9A:def 6 :
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st ( ProperBodyWhile>0 b2,b3,b1 or b3 is parahalting ) & WithVariantWhile>0 b2,b3,b1 holds
for b4 being Nat holds
( b4 = ExitsAtWhile>0 b2,b3,b1 iff ex b5 being Nat st
( b4 = b5 & ((StepWhile>0 b2,b3,b1) . b5) . b2 <= 0 & ( for b6 being Nat st ((StepWhile>0 b2,b3,b1) . b6) . b2 <= 0 holds
b5 <= b6 ) & ((Computation (b1 +* ((while>0 b2,b3) +* (Start-At (insloc 0))))) . (LifeSpan (b1 +* ((while>0 b2,b3) +* (Start-At (insloc 0)))))) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 b2,b3,b1) . b5) | (Int-Locations \/ FinSeq-Locations ) ) );

theorem Th41: :: SCMFSA9A:41
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st b1 . (intloc 0) = 1 & b1 . b2 <= 0 holds
(IExec (while>0 b2,b3),b1) | (Int-Locations \/ FinSeq-Locations ) = b1 | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th42: :: SCMFSA9A:42
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction st ( ProperBodyWhile>0 b2,b3, Initialize b1 or b3 is parahalting ) & WithVariantWhile>0 b2,b3, Initialize b1 holds
(IExec (while>0 b2,b3),b1) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 b2,b3,(Initialize b1)) . (ExitsAtWhile>0 b2,b3,(Initialize b1))) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th43: :: SCMFSA9A:43
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being Macro-Instruction
for b4 being Nat st ((StepWhile>0 b2,b3,b1) . b4) . b2 <= 0 holds
for b5 being Nat st b4 <= b5 holds
((StepWhile>0 b2,b3,b1) . b5) | (Int-Locations \/ FinSeq-Locations ) = ((StepWhile>0 b2,b3,b1) . b4) | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th44: :: SCMFSA9A:44
for b1, b2 being State of SCM+FSA
for b3 being read-write Int-Location
for b4 being Macro-Instruction st b1 | (Int-Locations \/ FinSeq-Locations ) = b2 | (Int-Locations \/ FinSeq-Locations ) & ProperBodyWhile>0 b3,b4,b1 holds
ProperBodyWhile>0 b3,b4,b2
proof end;

Lemma44: for b1 being State of SCM+FSA
for b2 being Macro-Instruction st b1 . (intloc 0) = 1 holds
( b2 is_closed_on b1 iff b2 is_closed_on Initialize b1 )
proof end;

Lemma45: for b1 being State of SCM+FSA
for b2 being Macro-Instruction st b1 . (intloc 0) = 1 holds
( b2 is_closed_on b1 & b2 is_halting_on b1 iff ( b2 is_closed_on Initialize b1 & b2 is_halting_on Initialize b1 ) )
proof end;

theorem Th45: :: SCMFSA9A:45
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being good Macro-Instruction st b1 . (intloc 0) = 1 & ProperBodyWhile>0 b2,b3,b1 & WithVariantWhile>0 b2,b3,b1 holds
for b4, b5 being Nat st b4 <> b5 & b4 <= ExitsAtWhile>0 b2,b3,b1 & b5 <= ExitsAtWhile>0 b2,b3,b1 holds
( (StepWhile>0 b2,b3,b1) . b4 <> (StepWhile>0 b2,b3,b1) . b5 & ((StepWhile>0 b2,b3,b1) . b4) | (Int-Locations \/ FinSeq-Locations ) <> ((StepWhile>0 b2,b3,b1) . b5) | (Int-Locations \/ FinSeq-Locations ) )
proof end;

definition
let c4 be Function of product the Object-Kind of SCM+FSA , NAT ;
attr a1 is on_data_only means :Def7: :: SCMFSA9A:def 7
for b1, b2 being State of SCM+FSA st b1 | (Int-Locations \/ FinSeq-Locations ) = b2 | (Int-Locations \/ FinSeq-Locations ) holds
a1 . b1 = a1 . b2;
end;

:: deftheorem Def7 defines on_data_only SCMFSA9A:def 7 :
for b1 being Function of product the Object-Kind of SCM+FSA , NAT holds
( b1 is on_data_only iff for b2, b3 being State of SCM+FSA st b2 | (Int-Locations \/ FinSeq-Locations ) = b3 | (Int-Locations \/ FinSeq-Locations ) holds
b1 . b2 = b1 . b3 );

theorem Th46: :: SCMFSA9A:46
for b1 being State of SCM+FSA
for b2 being read-write Int-Location
for b3 being good Macro-Instruction st b1 . (intloc 0) = 1 & ProperBodyWhile>0 b2,b3,b1 & WithVariantWhile>0 b2,b3,b1 holds
ex b4 being Function of product the Object-Kind of SCM+FSA , NAT st
( b4 is on_data_only & ( for b5 being Nat holds
( b4 . ((StepWhile>0 b2,b3,b1) . (b5 + 1)) < b4 . ((StepWhile>0 b2,b3,b1) . b5) or ((StepWhile>0 b2,b3,b1) . b5) . b2 <= 0 ) ) )
proof end;

theorem Th47: :: SCMFSA9A:47
for b1, b2 being State of SCM+FSA
for b3 being read-write Int-Location
for b4 being good Macro-Instruction st b1 . (intloc 0) = 1 & b1 | (Int-Locations \/ FinSeq-Locations ) = b2 | (Int-Locations \/ FinSeq-Locations ) & ProperBodyWhile>0 b3,b4,b1 & WithVariantWhile>0 b3,b4,b1 holds
WithVariantWhile>0 b3,b4,b2
proof end;

definition
let c4, c5 be Int-Location ;
set c6 = 1 -stRWNotIn {c4,c5};
set c7 = 2 -ndRWNotIn {c4,c5};
set c8 = 3 -rdRWNotIn {c4,c5};
func Fusc_macro c1,c2 -> Macro-Instruction equals :: SCMFSA9A:def 8
(((SubFrom a2,a2) ';' ((1 -stRWNotIn {a1,a2}) := (intloc 0))) ';' ((2 -ndRWNotIn {a1,a2}) := a1)) ';' (while>0 (2 -ndRWNotIn {a1,a2}),((((3 -rdRWNotIn {a1,a2}) := 2) ';' (Divide (2 -ndRWNotIn {a1,a2}),(3 -rdRWNotIn {a1,a2}))) ';' (if=0 (3 -rdRWNotIn {a1,a2}),(Macro (AddTo (1 -stRWNotIn {a1,a2}),a2)),(Macro (AddTo a2,(1 -stRWNotIn {a1,a2}))))));
correctness
coherence
(((SubFrom c5,c5) ';' ((1 -stRWNotIn {c4,c5}) := (intloc 0))) ';' ((2 -ndRWNotIn {c4,c5}) := c4)) ';' (while>0 (2 -ndRWNotIn {c4,c5}),((((3 -rdRWNotIn {c4,c5}) := 2) ';' (Divide (2 -ndRWNotIn {c4,c5}),(3 -rdRWNotIn {c4,c5}))) ';' (if=0 (3 -rdRWNotIn {c4,c5}),(Macro (AddTo (1 -stRWNotIn {c4,c5}),c5)),(Macro (AddTo c5,(1 -stRWNotIn {c4,c5})))))) is Macro-Instruction
;
;
end;

:: deftheorem Def8 defines Fusc_macro SCMFSA9A:def 8 :
for b1, b2 being Int-Location holds Fusc_macro b1,b2 = (((SubFrom b2,b2) ';' ((1 -stRWNotIn {b1,b2}) := (intloc 0))) ';' ((2 -ndRWNotIn {b1,b2}) := b1)) ';' (while>0 (2 -ndRWNotIn {b1,b2}),((((3 -rdRWNotIn {b1,b2}) := 2) ';' (Divide (2 -ndRWNotIn {b1,b2}),(3 -rdRWNotIn {b1,b2}))) ';' (if=0 (3 -rdRWNotIn {b1,b2}),(Macro (AddTo (1 -stRWNotIn {b1,b2}),b2)),(Macro (AddTo b2,(1 -stRWNotIn {b1,b2}))))));

theorem Th48: :: SCMFSA9A:48
for b1 being State of SCM+FSA
for b2, b3 being read-write Int-Location st b2 <> b3 holds
for b4 being Nat st b4 = b1 . b2 holds
( (IExec (Fusc_macro b2,b3),b1) . b3 = Fusc b4 & (IExec (Fusc_macro b2,b3),b1) . b2 = b4 )
proof end;