:: SCMFSA9A  semantic presentation
theorem Th1: :: SCMFSA9A:1
theorem Th2: :: SCMFSA9A:2
canceled; 
theorem Th3: :: SCMFSA9A:3
canceled; 
theorem Th4: :: SCMFSA9A:4
theorem Th5: :: SCMFSA9A:5
canceled; 
theorem Th6: :: SCMFSA9A:6
theorem Th7: :: SCMFSA9A:7
theorem Th8: :: SCMFSA9A:8
theorem Th9: :: SCMFSA9A:9
theorem Th10: :: SCMFSA9A:10
theorem Th11: :: SCMFSA9A:11
theorem Th12: :: SCMFSA9A:12
set c1 = Int-Locations  \/ FinSeq-Locations ;
set c2 =  Start-At (insloc 0);
set c3 = the Instruction-Locations of SCM+FSA ;
theorem Th13: :: SCMFSA9A:13
theorem Th14: :: SCMFSA9A:14
theorem Th15: :: SCMFSA9A:15
theorem Th16: :: SCMFSA9A:16
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)) )
 
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))))
 
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))))
 
theorem Th17: :: SCMFSA9A:17
theorem Th18: :: SCMFSA9A:18
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 : 
:: deftheorem Def2   defines WithVariantWhile=0 SCMFSA9A:def 2 : 
theorem Th19: :: SCMFSA9A:19
theorem Th20: :: SCMFSA9A:20
theorem Th21: :: SCMFSA9A:21
theorem Th22: :: SCMFSA9A:22
theorem Th23: :: SCMFSA9A:23
theorem Th24: :: SCMFSA9A:24
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 )
theorem Th26: :: SCMFSA9A:26
theorem Th27: :: SCMFSA9A:27
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 ) )
 
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
 
 
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
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 )
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)) )
 
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))))
 
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))))
 
theorem Th30: :: SCMFSA9A:30
theorem Th31: :: SCMFSA9A:31
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 : 
:: deftheorem Def5   defines WithVariantWhile>0 SCMFSA9A:def 5 : 
theorem Th32: :: SCMFSA9A:32
theorem Th33: :: SCMFSA9A:33
theorem Th34: :: SCMFSA9A:34
theorem Th35: :: SCMFSA9A:35
theorem Th36: :: SCMFSA9A:36
theorem Th37: :: SCMFSA9A:37
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 )
theorem Th39: :: SCMFSA9A:39
theorem Th40: :: SCMFSA9A:40
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 ) )
 
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
 
 
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
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 )
theorem Th43: :: SCMFSA9A:43
theorem Th44: :: SCMFSA9A:44
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 )
 
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 ) )
 
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 ) )
:: deftheorem Def7   defines on_data_only SCMFSA9A:def 7 : 
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 ) ) )
theorem Th47: :: SCMFSA9A:47
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