:: SF_MASTR semantic presentation

theorem Th1: :: SF_MASTR:1
for b1, b2, b3 being set
for b4 being Function st b4 . b1 = b4 . b2 holds
b4 . b3 = (b4 * ((id (dom b4)) +* b1,b2)) . b3
proof end;

theorem Th2: :: SF_MASTR:2
for b1, b2 being set
for b3 being Function st ( b1 in dom b3 implies ( b2 in dom b3 & b3 . b1 = b3 . b2 ) ) holds
b3 = b3 * ((id (dom b3)) +* b1,b2)
proof end;

registration
let c1 be finite set ;
let c2 be set ;
cluster -> finite M4(a1,a2);
coherence
for b1 being Function of c1,c2 holds b1 is finite
proof end;
end;

registration
let c1 be finite set ;
let c2 be set ;
let c3 be Function of c1, Fin c2;
cluster Union a3 -> finite ;
coherence
Union c3 is finite
proof end;
end;

registration
cluster Int-Locations -> non empty ;
coherence
not Int-Locations is empty
by SCMFSA_2:9;
end;

registration
cluster FinSeq-Locations -> non empty ;
coherence
not FinSeq-Locations is empty
by SCMFSA_2:10;
end;

theorem Th3: :: SF_MASTR:3
canceled;

theorem Th4: :: SF_MASTR:4
canceled;

theorem Th5: :: SF_MASTR:5
for b1, b2, b3, b4 being Int-Location st b1 := b2 = b3 := b4 holds
( b1 = b3 & b2 = b4 )
proof end;

theorem Th6: :: SF_MASTR:6
for b1, b2, b3, b4 being Int-Location st AddTo b1,b2 = AddTo b3,b4 holds
( b1 = b3 & b2 = b4 )
proof end;

theorem Th7: :: SF_MASTR:7
for b1, b2, b3, b4 being Int-Location st SubFrom b1,b2 = SubFrom b3,b4 holds
( b1 = b3 & b2 = b4 )
proof end;

theorem Th8: :: SF_MASTR:8
for b1, b2, b3, b4 being Int-Location st MultBy b1,b2 = MultBy b3,b4 holds
( b1 = b3 & b2 = b4 )
proof end;

theorem Th9: :: SF_MASTR:9
for b1, b2, b3, b4 being Int-Location st Divide b1,b2 = Divide b3,b4 holds
( b1 = b3 & b2 = b4 )
proof end;

theorem Th10: :: SF_MASTR:10
for b1, b2 being Instruction-Location of SCM+FSA st goto b1 = goto b2 holds
b1 = b2
proof end;

theorem Th11: :: SF_MASTR:11
for b1, b2 being Int-Location
for b3, b4 being Instruction-Location of SCM+FSA st b1 =0_goto b3 = b2 =0_goto b4 holds
( b1 = b2 & b3 = b4 )
proof end;

theorem Th12: :: SF_MASTR:12
for b1, b2 being Int-Location
for b3, b4 being Instruction-Location of SCM+FSA st b1 >0_goto b3 = b2 >0_goto b4 holds
( b1 = b2 & b3 = b4 )
proof end;

theorem Th13: :: SF_MASTR:13
for b1, b2, b3, b4 being Int-Location
for b5, b6 being FinSeq-Location st b1 := b5,b2 = b3 := b6,b4 holds
( b2 = b4 & b1 = b3 & b5 = b6 )
proof end;

theorem Th14: :: SF_MASTR:14
for b1, b2, b3, b4 being Int-Location
for b5, b6 being FinSeq-Location st b5,b1 := b2 = b6,b3 := b4 holds
( b1 = b3 & b2 = b4 & b5 = b6 )
proof end;

theorem Th15: :: SF_MASTR:15
for b1, b2 being Int-Location
for b3, b4 being FinSeq-Location st b1 :=len b3 = b2 :=len b4 holds
( b1 = b2 & b3 = b4 )
proof end;

theorem Th16: :: SF_MASTR:16
for b1, b2 being Int-Location
for b3, b4 being FinSeq-Location st b3 :=<0,...,0> b1 = b4 :=<0,...,0> b2 holds
( b1 = b2 & b3 = b4 )
proof end;

definition
let c1 be Instruction of SCM+FSA ;
func UsedIntLoc c1 -> Element of Fin Int-Locations means :Def1: :: SF_MASTR:def 1
ex b1, b2 being Int-Location st
( ( a1 = b1 := b2 or a1 = AddTo b1,b2 or a1 = SubFrom b1,b2 or a1 = MultBy b1,b2 or a1 = Divide b1,b2 ) & a2 = {b1,b2} ) if InsCode a1 in {1,2,3,4,5}
ex b1 being Int-Location ex b2 being Instruction-Location of SCM+FSA st
( ( a1 = b1 =0_goto b2 or a1 = b1 >0_goto b2 ) & a2 = {b1} ) if ( InsCode a1 = 7 or InsCode a1 = 8 )
ex b1, b2 being Int-Location ex b3 being FinSeq-Location st
( ( a1 = b2 := b3,b1 or a1 = b3,b1 := b2 ) & a2 = {b1,b2} ) if ( InsCode a1 = 9 or InsCode a1 = 10 )
ex b1 being Int-Location ex b2 being FinSeq-Location st
( ( a1 = b1 :=len b2 or a1 = b2 :=<0,...,0> b1 ) & a2 = {b1} ) if ( InsCode a1 = 11 or InsCode a1 = 12 )
otherwise a2 = {} ;
existence
( ( InsCode c1 in {1,2,3,4,5} implies ex b1 being Element of Fin Int-Locations ex b2, b3 being Int-Location st
( ( c1 = b2 := b3 or c1 = AddTo b2,b3 or c1 = SubFrom b2,b3 or c1 = MultBy b2,b3 or c1 = Divide b2,b3 ) & b1 = {b2,b3} ) ) & ( ( InsCode c1 = 7 or InsCode c1 = 8 ) implies ex b1 being Element of Fin Int-Locations ex b2 being Int-Location ex b3 being Instruction-Location of SCM+FSA st
( ( c1 = b2 =0_goto b3 or c1 = b2 >0_goto b3 ) & b1 = {b2} ) ) & ( ( InsCode c1 = 9 or InsCode c1 = 10 ) implies ex b1 being Element of Fin Int-Locations ex b2, b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 := b4,b2 or c1 = b4,b2 := b3 ) & b1 = {b2,b3} ) ) & ( ( InsCode c1 = 11 or InsCode c1 = 12 ) implies ex b1 being Element of Fin Int-Locations ex b2 being Int-Location ex b3 being FinSeq-Location st
( ( c1 = b2 :=len b3 or c1 = b3 :=<0,...,0> b2 ) & b1 = {b2} ) ) & ( InsCode c1 in {1,2,3,4,5} or InsCode c1 = 7 or InsCode c1 = 8 or InsCode c1 = 9 or InsCode c1 = 10 or InsCode c1 = 11 or InsCode c1 = 12 or ex b1 being Element of Fin Int-Locations st b1 = {} ) )
proof end;
uniqueness
for b1, b2 being Element of Fin Int-Locations holds
( ( InsCode c1 in {1,2,3,4,5} & ex b3, b4 being Int-Location st
( ( c1 = b3 := b4 or c1 = AddTo b3,b4 or c1 = SubFrom b3,b4 or c1 = MultBy b3,b4 or c1 = Divide b3,b4 ) & b1 = {b3,b4} ) & ex b3, b4 being Int-Location st
( ( c1 = b3 := b4 or c1 = AddTo b3,b4 or c1 = SubFrom b3,b4 or c1 = MultBy b3,b4 or c1 = Divide b3,b4 ) & b2 = {b3,b4} ) implies b1 = b2 ) & ( ( InsCode c1 = 7 or InsCode c1 = 8 ) & ex b3 being Int-Location ex b4 being Instruction-Location of SCM+FSA st
( ( c1 = b3 =0_goto b4 or c1 = b3 >0_goto b4 ) & b1 = {b3} ) & ex b3 being Int-Location ex b4 being Instruction-Location of SCM+FSA st
( ( c1 = b3 =0_goto b4 or c1 = b3 >0_goto b4 ) & b2 = {b3} ) implies b1 = b2 ) & ( ( InsCode c1 = 9 or InsCode c1 = 10 ) & ex b3, b4 being Int-Location ex b5 being FinSeq-Location st
( ( c1 = b4 := b5,b3 or c1 = b5,b3 := b4 ) & b1 = {b3,b4} ) & ex b3, b4 being Int-Location ex b5 being FinSeq-Location st
( ( c1 = b4 := b5,b3 or c1 = b5,b3 := b4 ) & b2 = {b3,b4} ) implies b1 = b2 ) & ( ( InsCode c1 = 11 or InsCode c1 = 12 ) & ex b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 :=len b4 or c1 = b4 :=<0,...,0> b3 ) & b1 = {b3} ) & ex b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 :=len b4 or c1 = b4 :=<0,...,0> b3 ) & b2 = {b3} ) implies b1 = b2 ) & ( InsCode c1 in {1,2,3,4,5} or InsCode c1 = 7 or InsCode c1 = 8 or InsCode c1 = 9 or InsCode c1 = 10 or InsCode c1 = 11 or InsCode c1 = 12 or not b1 = {} or not b2 = {} or b1 = b2 ) )
proof end;
consistency
for b1 being Element of Fin Int-Locations holds
( ( InsCode c1 in {1,2,3,4,5} & ( InsCode c1 = 7 or InsCode c1 = 8 ) implies ( ex b2, b3 being Int-Location st
( ( c1 = b2 := b3 or c1 = AddTo b2,b3 or c1 = SubFrom b2,b3 or c1 = MultBy b2,b3 or c1 = Divide b2,b3 ) & b1 = {b2,b3} ) iff ex b2 being Int-Location ex b3 being Instruction-Location of SCM+FSA st
( ( c1 = b2 =0_goto b3 or c1 = b2 >0_goto b3 ) & b1 = {b2} ) ) ) & ( InsCode c1 in {1,2,3,4,5} & ( InsCode c1 = 9 or InsCode c1 = 10 ) implies ( ex b2, b3 being Int-Location st
( ( c1 = b2 := b3 or c1 = AddTo b2,b3 or c1 = SubFrom b2,b3 or c1 = MultBy b2,b3 or c1 = Divide b2,b3 ) & b1 = {b2,b3} ) iff ex b2, b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 := b4,b2 or c1 = b4,b2 := b3 ) & b1 = {b2,b3} ) ) ) & ( InsCode c1 in {1,2,3,4,5} & ( InsCode c1 = 11 or InsCode c1 = 12 ) implies ( ex b2, b3 being Int-Location st
( ( c1 = b2 := b3 or c1 = AddTo b2,b3 or c1 = SubFrom b2,b3 or c1 = MultBy b2,b3 or c1 = Divide b2,b3 ) & b1 = {b2,b3} ) iff ex b2 being Int-Location ex b3 being FinSeq-Location st
( ( c1 = b2 :=len b3 or c1 = b3 :=<0,...,0> b2 ) & b1 = {b2} ) ) ) & ( ( InsCode c1 = 7 or InsCode c1 = 8 ) & ( InsCode c1 = 9 or InsCode c1 = 10 ) implies ( ex b2 being Int-Location ex b3 being Instruction-Location of SCM+FSA st
( ( c1 = b2 =0_goto b3 or c1 = b2 >0_goto b3 ) & b1 = {b2} ) iff ex b2, b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 := b4,b2 or c1 = b4,b2 := b3 ) & b1 = {b2,b3} ) ) ) & ( ( InsCode c1 = 7 or InsCode c1 = 8 ) & ( InsCode c1 = 11 or InsCode c1 = 12 ) implies ( ex b2 being Int-Location ex b3 being Instruction-Location of SCM+FSA st
( ( c1 = b2 =0_goto b3 or c1 = b2 >0_goto b3 ) & b1 = {b2} ) iff ex b2 being Int-Location ex b3 being FinSeq-Location st
( ( c1 = b2 :=len b3 or c1 = b3 :=<0,...,0> b2 ) & b1 = {b2} ) ) ) & ( ( InsCode c1 = 9 or InsCode c1 = 10 ) & ( InsCode c1 = 11 or InsCode c1 = 12 ) implies ( ex b2, b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 := b4,b2 or c1 = b4,b2 := b3 ) & b1 = {b2,b3} ) iff ex b2 being Int-Location ex b3 being FinSeq-Location st
( ( c1 = b2 :=len b3 or c1 = b3 :=<0,...,0> b2 ) & b1 = {b2} ) ) ) )
by ENUMSET1:def 3;
end;

:: deftheorem Def1 defines UsedIntLoc SF_MASTR:def 1 :
for b1 being Instruction of SCM+FSA
for b2 being Element of Fin Int-Locations holds
( ( InsCode b1 in {1,2,3,4,5} implies ( b2 = UsedIntLoc b1 iff ex b3, b4 being Int-Location st
( ( b1 = b3 := b4 or b1 = AddTo b3,b4 or b1 = SubFrom b3,b4 or b1 = MultBy b3,b4 or b1 = Divide b3,b4 ) & b2 = {b3,b4} ) ) ) & ( ( InsCode b1 = 7 or InsCode b1 = 8 ) implies ( b2 = UsedIntLoc b1 iff ex b3 being Int-Location ex b4 being Instruction-Location of SCM+FSA st
( ( b1 = b3 =0_goto b4 or b1 = b3 >0_goto b4 ) & b2 = {b3} ) ) ) & ( ( InsCode b1 = 9 or InsCode b1 = 10 ) implies ( b2 = UsedIntLoc b1 iff ex b3, b4 being Int-Location ex b5 being FinSeq-Location st
( ( b1 = b4 := b5,b3 or b1 = b5,b3 := b4 ) & b2 = {b3,b4} ) ) ) & ( ( InsCode b1 = 11 or InsCode b1 = 12 ) implies ( b2 = UsedIntLoc b1 iff ex b3 being Int-Location ex b4 being FinSeq-Location st
( ( b1 = b3 :=len b4 or b1 = b4 :=<0,...,0> b3 ) & b2 = {b3} ) ) ) & ( InsCode b1 in {1,2,3,4,5} or InsCode b1 = 7 or InsCode b1 = 8 or InsCode b1 = 9 or InsCode b1 = 10 or InsCode b1 = 11 or InsCode b1 = 12 or ( b2 = UsedIntLoc b1 iff b2 = {} ) ) );

theorem Th17: :: SF_MASTR:17
UsedIntLoc (halt SCM+FSA ) = {}
proof end;

theorem Th18: :: SF_MASTR:18
for b1, b2 being Int-Location
for b3 being Instruction of SCM+FSA st ( b3 = b1 := b2 or b3 = AddTo b1,b2 or b3 = SubFrom b1,b2 or b3 = MultBy b1,b2 or b3 = Divide b1,b2 ) holds
UsedIntLoc b3 = {b1,b2}
proof end;

theorem Th19: :: SF_MASTR:19
for b1 being Instruction-Location of SCM+FSA holds UsedIntLoc (goto b1) = {}
proof end;

theorem Th20: :: SF_MASTR:20
for b1 being Int-Location
for b2 being Instruction-Location of SCM+FSA
for b3 being Instruction of SCM+FSA st ( b3 = b1 =0_goto b2 or b3 = b1 >0_goto b2 ) holds
UsedIntLoc b3 = {b1}
proof end;

theorem Th21: :: SF_MASTR:21
for b1, b2 being Int-Location
for b3 being FinSeq-Location
for b4 being Instruction of SCM+FSA st ( b4 = b1 := b3,b2 or b4 = b3,b2 := b1 ) holds
UsedIntLoc b4 = {b2,b1}
proof end;

theorem Th22: :: SF_MASTR:22
for b1 being Int-Location
for b2 being FinSeq-Location
for b3 being Instruction of SCM+FSA st ( b3 = b1 :=len b2 or b3 = b2 :=<0,...,0> b1 ) holds
UsedIntLoc b3 = {b1}
proof end;

definition
let c1 be programmed FinPartState of SCM+FSA ;
func UsedIntLoc c1 -> Subset of Int-Locations means :Def2: :: SF_MASTR:def 2
ex b1 being Function of the Instructions of SCM+FSA , Fin Int-Locations st
( ( for b2 being Instruction of SCM+FSA holds b1 . b2 = UsedIntLoc b2 ) & a2 = Union (b1 * a1) );
existence
ex b1 being Subset of Int-Locations ex b2 being Function of the Instructions of SCM+FSA , Fin Int-Locations st
( ( for b3 being Instruction of SCM+FSA holds b2 . b3 = UsedIntLoc b3 ) & b1 = Union (b2 * c1) )
proof end;
uniqueness
for b1, b2 being Subset of Int-Locations st ex b3 being Function of the Instructions of SCM+FSA , Fin Int-Locations st
( ( for b4 being Instruction of SCM+FSA holds b3 . b4 = UsedIntLoc b4 ) & b1 = Union (b3 * c1) ) & ex b3 being Function of the Instructions of SCM+FSA , Fin Int-Locations st
( ( for b4 being Instruction of SCM+FSA holds b3 . b4 = UsedIntLoc b4 ) & b2 = Union (b3 * c1) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def2 defines UsedIntLoc SF_MASTR:def 2 :
for b1 being programmed FinPartState of SCM+FSA
for b2 being Subset of Int-Locations holds
( b2 = UsedIntLoc b1 iff ex b3 being Function of the Instructions of SCM+FSA , Fin Int-Locations st
( ( for b4 being Instruction of SCM+FSA holds b3 . b4 = UsedIntLoc b4 ) & b2 = Union (b3 * b1) ) );

registration
let c1 be programmed FinPartState of SCM+FSA ;
cluster UsedIntLoc a1 -> finite ;
coherence
UsedIntLoc c1 is finite
proof end;
end;

theorem Th23: :: SF_MASTR:23
for b1 being Instruction of SCM+FSA
for b2 being programmed FinPartState of SCM+FSA st b1 in rng b2 holds
UsedIntLoc b1 c= UsedIntLoc b2
proof end;

theorem Th24: :: SF_MASTR:24
for b1, b2 being programmed FinPartState of SCM+FSA holds UsedIntLoc (b1 +* b2) c= (UsedIntLoc b1) \/ (UsedIntLoc b2)
proof end;

theorem Th25: :: SF_MASTR:25
for b1, b2 being programmed FinPartState of SCM+FSA st dom b1 misses dom b2 holds
UsedIntLoc (b1 +* b2) = (UsedIntLoc b1) \/ (UsedIntLoc b2)
proof end;

theorem Th26: :: SF_MASTR:26
for b1 being programmed FinPartState of SCM+FSA
for b2 being Nat holds UsedIntLoc b1 = UsedIntLoc (Shift b1,b2)
proof end;

theorem Th27: :: SF_MASTR:27
for b1 being Instruction of SCM+FSA
for b2 being Nat holds UsedIntLoc b1 = UsedIntLoc (IncAddr b1,b2)
proof end;

theorem Th28: :: SF_MASTR:28
for b1 being programmed FinPartState of SCM+FSA
for b2 being Nat holds UsedIntLoc b1 = UsedIntLoc (IncAddr b1,b2)
proof end;

theorem Th29: :: SF_MASTR:29
for b1 being Macro-Instruction
for b2 being Nat holds UsedIntLoc b1 = UsedIntLoc (ProgramPart (Relocated b1,b2))
proof end;

theorem Th30: :: SF_MASTR:30
for b1 being Macro-Instruction holds UsedIntLoc b1 = UsedIntLoc (Directed b1)
proof end;

theorem Th31: :: SF_MASTR:31
for b1, b2 being Macro-Instruction holds UsedIntLoc (b1 ';' b2) = (UsedIntLoc b1) \/ (UsedIntLoc b2)
proof end;

theorem Th32: :: SF_MASTR:32
for b1 being Instruction of SCM+FSA holds UsedIntLoc (Macro b1) = UsedIntLoc b1
proof end;

theorem Th33: :: SF_MASTR:33
for b1 being Instruction of SCM+FSA
for b2 being Macro-Instruction holds UsedIntLoc (b1 ';' b2) = (UsedIntLoc b1) \/ (UsedIntLoc b2)
proof end;

theorem Th34: :: SF_MASTR:34
for b1 being Instruction of SCM+FSA
for b2 being Macro-Instruction holds UsedIntLoc (b2 ';' b1) = (UsedIntLoc b2) \/ (UsedIntLoc b1)
proof end;

theorem Th35: :: SF_MASTR:35
for b1, b2 being Instruction of SCM+FSA holds UsedIntLoc (b1 ';' b2) = (UsedIntLoc b1) \/ (UsedIntLoc b2)
proof end;

definition
let c1 be Instruction of SCM+FSA ;
func UsedInt*Loc c1 -> Element of Fin FinSeq-Locations means :Def3: :: SF_MASTR:def 3
ex b1, b2 being Int-Location ex b3 being FinSeq-Location st
( ( a1 = b2 := b3,b1 or a1 = b3,b1 := b2 ) & a2 = {b3} ) if ( InsCode a1 = 9 or InsCode a1 = 10 )
ex b1 being Int-Location ex b2 being FinSeq-Location st
( ( a1 = b1 :=len b2 or a1 = b2 :=<0,...,0> b1 ) & a2 = {b2} ) if ( InsCode a1 = 11 or InsCode a1 = 12 )
otherwise a2 = {} ;
existence
( ( ( InsCode c1 = 9 or InsCode c1 = 10 ) implies ex b1 being Element of Fin FinSeq-Locations ex b2, b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 := b4,b2 or c1 = b4,b2 := b3 ) & b1 = {b4} ) ) & ( ( InsCode c1 = 11 or InsCode c1 = 12 ) implies ex b1 being Element of Fin FinSeq-Locations ex b2 being Int-Location ex b3 being FinSeq-Location st
( ( c1 = b2 :=len b3 or c1 = b3 :=<0,...,0> b2 ) & b1 = {b3} ) ) & ( InsCode c1 = 9 or InsCode c1 = 10 or InsCode c1 = 11 or InsCode c1 = 12 or ex b1 being Element of Fin FinSeq-Locations st b1 = {} ) )
proof end;
uniqueness
for b1, b2 being Element of Fin FinSeq-Locations holds
( ( ( InsCode c1 = 9 or InsCode c1 = 10 ) & ex b3, b4 being Int-Location ex b5 being FinSeq-Location st
( ( c1 = b4 := b5,b3 or c1 = b5,b3 := b4 ) & b1 = {b5} ) & ex b3, b4 being Int-Location ex b5 being FinSeq-Location st
( ( c1 = b4 := b5,b3 or c1 = b5,b3 := b4 ) & b2 = {b5} ) implies b1 = b2 ) & ( ( InsCode c1 = 11 or InsCode c1 = 12 ) & ex b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 :=len b4 or c1 = b4 :=<0,...,0> b3 ) & b1 = {b4} ) & ex b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 :=len b4 or c1 = b4 :=<0,...,0> b3 ) & b2 = {b4} ) implies b1 = b2 ) & ( InsCode c1 = 9 or InsCode c1 = 10 or InsCode c1 = 11 or InsCode c1 = 12 or not b1 = {} or not b2 = {} or b1 = b2 ) )
proof end;
consistency
for b1 being Element of Fin FinSeq-Locations st ( InsCode c1 = 9 or InsCode c1 = 10 ) & ( InsCode c1 = 11 or InsCode c1 = 12 ) holds
( ex b2, b3 being Int-Location ex b4 being FinSeq-Location st
( ( c1 = b3 := b4,b2 or c1 = b4,b2 := b3 ) & b1 = {b4} ) iff ex b2 being Int-Location ex b3 being FinSeq-Location st
( ( c1 = b2 :=len b3 or c1 = b3 :=<0,...,0> b2 ) & b1 = {b3} ) )
;
end;

:: deftheorem Def3 defines UsedInt*Loc SF_MASTR:def 3 :
for b1 being Instruction of SCM+FSA
for b2 being Element of Fin FinSeq-Locations holds
( ( ( InsCode b1 = 9 or InsCode b1 = 10 ) implies ( b2 = UsedInt*Loc b1 iff ex b3, b4 being Int-Location ex b5 being FinSeq-Location st
( ( b1 = b4 := b5,b3 or b1 = b5,b3 := b4 ) & b2 = {b5} ) ) ) & ( ( InsCode b1 = 11 or InsCode b1 = 12 ) implies ( b2 = UsedInt*Loc b1 iff ex b3 being Int-Location ex b4 being FinSeq-Location st
( ( b1 = b3 :=len b4 or b1 = b4 :=<0,...,0> b3 ) & b2 = {b4} ) ) ) & ( InsCode b1 = 9 or InsCode b1 = 10 or InsCode b1 = 11 or InsCode b1 = 12 or ( b2 = UsedInt*Loc b1 iff b2 = {} ) ) );

theorem Th36: :: SF_MASTR:36
for b1, b2 being Int-Location
for b3 being Instruction-Location of SCM+FSA
for b4 being Instruction of SCM+FSA st ( b4 = halt SCM+FSA or b4 = b1 := b2 or b4 = AddTo b1,b2 or b4 = SubFrom b1,b2 or b4 = MultBy b1,b2 or b4 = Divide b1,b2 or b4 = goto b3 or b4 = b1 =0_goto b3 or b4 = b1 >0_goto b3 ) holds
UsedInt*Loc b4 = {}
proof end;

theorem Th37: :: SF_MASTR:37
for b1, b2 being Int-Location
for b3 being FinSeq-Location
for b4 being Instruction of SCM+FSA st ( b4 = b1 := b3,b2 or b4 = b3,b2 := b1 ) holds
UsedInt*Loc b4 = {b3}
proof end;

theorem Th38: :: SF_MASTR:38
for b1 being Int-Location
for b2 being FinSeq-Location
for b3 being Instruction of SCM+FSA st ( b3 = b1 :=len b2 or b3 = b2 :=<0,...,0> b1 ) holds
UsedInt*Loc b3 = {b2}
proof end;

definition
let c1 be programmed FinPartState of SCM+FSA ;
func UsedInt*Loc c1 -> Subset of FinSeq-Locations means :Def4: :: SF_MASTR:def 4
ex b1 being Function of the Instructions of SCM+FSA , Fin FinSeq-Locations st
( ( for b2 being Instruction of SCM+FSA holds b1 . b2 = UsedInt*Loc b2 ) & a2 = Union (b1 * a1) );
existence
ex b1 being Subset of FinSeq-Locations ex b2 being Function of the Instructions of SCM+FSA , Fin FinSeq-Locations st
( ( for b3 being Instruction of SCM+FSA holds b2 . b3 = UsedInt*Loc b3 ) & b1 = Union (b2 * c1) )
proof end;
uniqueness
for b1, b2 being Subset of FinSeq-Locations st ex b3 being Function of the Instructions of SCM+FSA , Fin FinSeq-Locations st
( ( for b4 being Instruction of SCM+FSA holds b3 . b4 = UsedInt*Loc b4 ) & b1 = Union (b3 * c1) ) & ex b3 being Function of the Instructions of SCM+FSA , Fin FinSeq-Locations st
( ( for b4 being Instruction of SCM+FSA holds b3 . b4 = UsedInt*Loc b4 ) & b2 = Union (b3 * c1) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines UsedInt*Loc SF_MASTR:def 4 :
for b1 being programmed FinPartState of SCM+FSA
for b2 being Subset of FinSeq-Locations holds
( b2 = UsedInt*Loc b1 iff ex b3 being Function of the Instructions of SCM+FSA , Fin FinSeq-Locations st
( ( for b4 being Instruction of SCM+FSA holds b3 . b4 = UsedInt*Loc b4 ) & b2 = Union (b3 * b1) ) );

registration
let c1 be programmed FinPartState of SCM+FSA ;
cluster UsedInt*Loc a1 -> finite ;
coherence
UsedInt*Loc c1 is finite
proof end;
end;

theorem Th39: :: SF_MASTR:39
for b1 being Instruction of SCM+FSA
for b2 being programmed FinPartState of SCM+FSA st b1 in rng b2 holds
UsedInt*Loc b1 c= UsedInt*Loc b2
proof end;

theorem Th40: :: SF_MASTR:40
for b1, b2 being programmed FinPartState of SCM+FSA holds UsedInt*Loc (b1 +* b2) c= (UsedInt*Loc b1) \/ (UsedInt*Loc b2)
proof end;

theorem Th41: :: SF_MASTR:41
for b1, b2 being programmed FinPartState of SCM+FSA st dom b1 misses dom b2 holds
UsedInt*Loc (b1 +* b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2)
proof end;

theorem Th42: :: SF_MASTR:42
for b1 being programmed FinPartState of SCM+FSA
for b2 being Nat holds UsedInt*Loc b1 = UsedInt*Loc (Shift b1,b2)
proof end;

theorem Th43: :: SF_MASTR:43
for b1 being Instruction of SCM+FSA
for b2 being Nat holds UsedInt*Loc b1 = UsedInt*Loc (IncAddr b1,b2)
proof end;

theorem Th44: :: SF_MASTR:44
for b1 being programmed FinPartState of SCM+FSA
for b2 being Nat holds UsedInt*Loc b1 = UsedInt*Loc (IncAddr b1,b2)
proof end;

theorem Th45: :: SF_MASTR:45
for b1 being Macro-Instruction
for b2 being Nat holds UsedInt*Loc b1 = UsedInt*Loc (ProgramPart (Relocated b1,b2))
proof end;

theorem Th46: :: SF_MASTR:46
for b1 being Macro-Instruction holds UsedInt*Loc b1 = UsedInt*Loc (Directed b1)
proof end;

theorem Th47: :: SF_MASTR:47
for b1, b2 being Macro-Instruction holds UsedInt*Loc (b1 ';' b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2)
proof end;

theorem Th48: :: SF_MASTR:48
for b1 being Instruction of SCM+FSA holds UsedInt*Loc (Macro b1) = UsedInt*Loc b1
proof end;

theorem Th49: :: SF_MASTR:49
for b1 being Instruction of SCM+FSA
for b2 being Macro-Instruction holds UsedInt*Loc (b1 ';' b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2)
proof end;

theorem Th50: :: SF_MASTR:50
for b1 being Instruction of SCM+FSA
for b2 being Macro-Instruction holds UsedInt*Loc (b2 ';' b1) = (UsedInt*Loc b2) \/ (UsedInt*Loc b1)
proof end;

theorem Th51: :: SF_MASTR:51
for b1, b2 being Instruction of SCM+FSA holds UsedInt*Loc (b1 ';' b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2)
proof end;

definition
let c1 be Int-Location ;
attr a1 is read-only means :Def5: :: SF_MASTR:def 5
a1 = intloc 0;
end;

:: deftheorem Def5 defines read-only SF_MASTR:def 5 :
for b1 being Int-Location holds
( b1 is read-only iff b1 = intloc 0 );

notation
let c1 be Int-Location ;
antonym read-write c1 for read-only c1;
end;

registration
cluster intloc 0 -> read-only ;
coherence
intloc 0 is read-only
by Def5;
end;

registration
cluster read-write Int-Location ;
existence
not for b1 being Int-Location holds b1 is read-only
proof end;
end;

definition
let c1 be finite Subset of Int-Locations ;
func FirstNotIn c1 -> Int-Location means :Def6: :: SF_MASTR:def 6
ex b1 being non empty Subset of NAT st
( a2 = intloc (min b1) & b1 = { b2 where B is Nat : not intloc b2 in a1 } );
existence
ex b1 being Int-Location ex b2 being non empty Subset of NAT st
( b1 = intloc (min b2) & b2 = { b3 where B is Nat : not intloc b3 in c1 } )
proof end;
uniqueness
for b1, b2 being Int-Location st ex b3 being non empty Subset of NAT st
( b1 = intloc (min b3) & b3 = { b4 where B is Nat : not intloc b4 in c1 } ) & ex b3 being non empty Subset of NAT st
( b2 = intloc (min b3) & b3 = { b4 where B is Nat : not intloc b4 in c1 } ) holds
b1 = b2
;
end;

:: deftheorem Def6 defines FirstNotIn SF_MASTR:def 6 :
for b1 being finite Subset of Int-Locations
for b2 being Int-Location holds
( b2 = FirstNotIn b1 iff ex b3 being non empty Subset of NAT st
( b2 = intloc (min b3) & b3 = { b4 where B is Nat : not intloc b4 in b1 } ) );

theorem Th52: :: SF_MASTR:52
for b1 being finite Subset of Int-Locations holds not FirstNotIn b1 in b1
proof end;

theorem Th53: :: SF_MASTR:53
for b1, b2 being Nat
for b3 being finite Subset of Int-Locations st FirstNotIn b3 = intloc b1 & not intloc b2 in b3 holds
b1 <= b2
proof end;

definition
let c1 be programmed FinPartState of SCM+FSA ;
func FirstNotUsed c1 -> Int-Location means :Def7: :: SF_MASTR:def 7
ex b1 being finite Subset of Int-Locations st
( b1 = (UsedIntLoc a1) \/ {(intloc 0)} & a2 = FirstNotIn b1 );
existence
ex b1 being Int-Location ex b2 being finite Subset of Int-Locations st
( b2 = (UsedIntLoc c1) \/ {(intloc 0)} & b1 = FirstNotIn b2 )
proof end;
uniqueness
for b1, b2 being Int-Location st ex b3 being finite Subset of Int-Locations st
( b3 = (UsedIntLoc c1) \/ {(intloc 0)} & b1 = FirstNotIn b3 ) & ex b3 being finite Subset of Int-Locations st
( b3 = (UsedIntLoc c1) \/ {(intloc 0)} & b2 = FirstNotIn b3 ) holds
b1 = b2
;
end;

:: deftheorem Def7 defines FirstNotUsed SF_MASTR:def 7 :
for b1 being programmed FinPartState of SCM+FSA
for b2 being Int-Location holds
( b2 = FirstNotUsed b1 iff ex b3 being finite Subset of Int-Locations st
( b3 = (UsedIntLoc b1) \/ {(intloc 0)} & b2 = FirstNotIn b3 ) );

registration
let c1 be programmed FinPartState of SCM+FSA ;
cluster FirstNotUsed a1 -> read-write ;
coherence
not FirstNotUsed c1 is read-only
proof end;
end;

theorem Th54: :: SF_MASTR:54
for b1 being programmed FinPartState of SCM+FSA holds not FirstNotUsed b1 in UsedIntLoc b1
proof end;

theorem Th55: :: SF_MASTR:55
for b1, b2 being Int-Location
for b3 being programmed FinPartState of SCM+FSA st ( b1 := b2 in rng b3 or AddTo b1,b2 in rng b3 or SubFrom b1,b2 in rng b3 or MultBy b1,b2 in rng b3 or Divide b1,b2 in rng b3 ) holds
( FirstNotUsed b3 <> b1 & FirstNotUsed b3 <> b2 )
proof end;

theorem Th56: :: SF_MASTR:56
for b1 being Int-Location
for b2 being Instruction-Location of SCM+FSA
for b3 being programmed FinPartState of SCM+FSA st ( b1 =0_goto b2 in rng b3 or b1 >0_goto b2 in rng b3 ) holds
FirstNotUsed b3 <> b1
proof end;

theorem Th57: :: SF_MASTR:57
for b1, b2 being Int-Location
for b3 being FinSeq-Location
for b4 being programmed FinPartState of SCM+FSA st ( b1 := b3,b2 in rng b4 or b3,b2 := b1 in rng b4 ) holds
( FirstNotUsed b4 <> b2 & FirstNotUsed b4 <> b1 )
proof end;

theorem Th58: :: SF_MASTR:58
for b1 being Int-Location
for b2 being FinSeq-Location
for b3 being programmed FinPartState of SCM+FSA st ( b1 :=len b2 in rng b3 or b2 :=<0,...,0> b1 in rng b3 ) holds
FirstNotUsed b3 <> b1
proof end;

definition
let c1 be finite Subset of FinSeq-Locations ;
func First*NotIn c1 -> FinSeq-Location means :Def8: :: SF_MASTR:def 8
ex b1 being non empty Subset of NAT st
( a2 = fsloc (min b1) & b1 = { b2 where B is Nat : not fsloc b2 in a1 } );
existence
ex b1 being FinSeq-Location ex b2 being non empty Subset of NAT st
( b1 = fsloc (min b2) & b2 = { b3 where B is Nat : not fsloc b3 in c1 } )
proof end;
uniqueness
for b1, b2 being FinSeq-Location st ex b3 being non empty Subset of NAT st
( b1 = fsloc (min b3) & b3 = { b4 where B is Nat : not fsloc b4 in c1 } ) & ex b3 being non empty Subset of NAT st
( b2 = fsloc (min b3) & b3 = { b4 where B is Nat : not fsloc b4 in c1 } ) holds
b1 = b2
;
end;

:: deftheorem Def8 defines First*NotIn SF_MASTR:def 8 :
for b1 being finite Subset of FinSeq-Locations
for b2 being FinSeq-Location holds
( b2 = First*NotIn b1 iff ex b3 being non empty Subset of NAT st
( b2 = fsloc (min b3) & b3 = { b4 where B is Nat : not fsloc b4 in b1 } ) );

theorem Th59: :: SF_MASTR:59
for b1 being finite Subset of FinSeq-Locations holds not First*NotIn b1 in b1
proof end;

theorem Th60: :: SF_MASTR:60
for b1, b2 being Nat
for b3 being finite Subset of FinSeq-Locations st First*NotIn b3 = fsloc b1 & not fsloc b2 in b3 holds
b1 <= b2
proof end;

definition
let c1 be programmed FinPartState of SCM+FSA ;
func First*NotUsed c1 -> FinSeq-Location means :Def9: :: SF_MASTR:def 9
ex b1 being finite Subset of FinSeq-Locations st
( b1 = UsedInt*Loc a1 & a2 = First*NotIn b1 );
existence
ex b1 being FinSeq-Location ex b2 being finite Subset of FinSeq-Locations st
( b2 = UsedInt*Loc c1 & b1 = First*NotIn b2 )
proof end;
uniqueness
for b1, b2 being FinSeq-Location st ex b3 being finite Subset of FinSeq-Locations st
( b3 = UsedInt*Loc c1 & b1 = First*NotIn b3 ) & ex b3 being finite Subset of FinSeq-Locations st
( b3 = UsedInt*Loc c1 & b2 = First*NotIn b3 ) holds
b1 = b2
;
end;

:: deftheorem Def9 defines First*NotUsed SF_MASTR:def 9 :
for b1 being programmed FinPartState of SCM+FSA
for b2 being FinSeq-Location holds
( b2 = First*NotUsed b1 iff ex b3 being finite Subset of FinSeq-Locations st
( b3 = UsedInt*Loc b1 & b2 = First*NotIn b3 ) );

theorem Th61: :: SF_MASTR:61
for b1 being programmed FinPartState of SCM+FSA holds not First*NotUsed b1 in UsedInt*Loc b1
proof end;

theorem Th62: :: SF_MASTR:62
for b1, b2 being Int-Location
for b3 being FinSeq-Location
for b4 being programmed FinPartState of SCM+FSA st ( b1 := b3,b2 in rng b4 or b3,b2 := b1 in rng b4 ) holds
First*NotUsed b4 <> b3
proof end;

theorem Th63: :: SF_MASTR:63
for b1 being Int-Location
for b2 being FinSeq-Location
for b3 being programmed FinPartState of SCM+FSA st ( b1 :=len b2 in rng b3 or b2 :=<0,...,0> b1 in rng b3 ) holds
First*NotUsed b3 <> b2
proof end;

theorem Th64: :: SF_MASTR:64
for b1 being Macro-Instruction
for b2 being Nat holds dom b1 misses dom (Start-At (insloc b2))
proof end;

theorem Th65: :: SF_MASTR:65
for b1 being Macro-Instruction
for b2 being Nat holds IC SCM+FSA in dom (b1 +* (Start-At (insloc b2)))
proof end;

theorem Th66: :: SF_MASTR:66
for b1 being Macro-Instruction
for b2 being Nat holds (b1 +* (Start-At (insloc b2))) . (IC SCM+FSA ) = insloc b2
proof end;

theorem Th67: :: SF_MASTR:67
for b1 being Macro-Instruction
for b2 being Nat
for b3 being State of SCM+FSA st b1 +* (Start-At (insloc b2)) c= b3 holds
IC b3 = insloc b2
proof end;

theorem Th68: :: SF_MASTR:68
for b1 being Int-Location
for b2 being Instruction of SCM+FSA
for b3 being State of SCM+FSA st not b1 in UsedIntLoc b2 holds
(Exec b2,b3) . b1 = b3 . b1
proof end;

theorem Th69: :: SF_MASTR:69
for b1 being Int-Location
for b2 being Macro-Instruction
for b3 being Nat
for b4 being State of SCM+FSA st b2 +* (Start-At (insloc 0)) c= b4 & ( for b5 being Nat st b5 < b3 holds
IC ((Computation b4) . b5) in dom b2 ) & not b1 in UsedIntLoc b2 holds
((Computation b4) . b3) . b1 = b4 . b1
proof end;

theorem Th70: :: SF_MASTR:70
for b1 being FinSeq-Location
for b2 being Instruction of SCM+FSA
for b3 being State of SCM+FSA st not b1 in UsedInt*Loc b2 holds
(Exec b2,b3) . b1 = b3 . b1
proof end;

theorem Th71: :: SF_MASTR:71
for b1 being FinSeq-Location
for b2 being Macro-Instruction
for b3 being Nat
for b4 being State of SCM+FSA st b2 +* (Start-At (insloc 0)) c= b4 & ( for b5 being Nat st b5 < b3 holds
IC ((Computation b4) . b5) in dom b2 ) & not b1 in UsedInt*Loc b2 holds
((Computation b4) . b3) . b1 = b4 . b1
proof end;

theorem Th72: :: SF_MASTR:72
for b1 being Instruction of SCM+FSA
for b2, b3 being State of SCM+FSA st b2 | (UsedIntLoc b1) = b3 | (UsedIntLoc b1) & b2 | (UsedInt*Loc b1) = b3 | (UsedInt*Loc b1) & IC b2 = IC b3 holds
( IC (Exec b1,b2) = IC (Exec b1,b3) & (Exec b1,b2) | (UsedIntLoc b1) = (Exec b1,b3) | (UsedIntLoc b1) & (Exec b1,b2) | (UsedInt*Loc b1) = (Exec b1,b3) | (UsedInt*Loc b1) )
proof end;

theorem Th73: :: SF_MASTR:73
for b1 being Macro-Instruction
for b2 being Nat
for b3, b4 being State of SCM+FSA st b1 +* (Start-At (insloc 0)) c= b3 & b1 +* (Start-At (insloc 0)) c= b4 & b3 | (UsedIntLoc b1) = b4 | (UsedIntLoc b1) & b3 | (UsedInt*Loc b1) = b4 | (UsedInt*Loc b1) & ( for b5 being Nat st b5 < b2 holds
IC ((Computation b3) . b5) in dom b1 ) holds
( ( for b5 being Nat st b5 < b2 holds
IC ((Computation b4) . b5) in dom b1 ) & ( for b5 being Nat st b5 <= b2 holds
( IC ((Computation b3) . b5) = IC ((Computation b4) . b5) & ( for b6 being Int-Location st b6 in UsedIntLoc b1 holds
((Computation b3) . b5) . b6 = ((Computation b4) . b5) . b6 ) & ( for b6 being FinSeq-Location st b6 in UsedInt*Loc b1 holds
((Computation b3) . b5) . b6 = ((Computation b4) . b5) . b6 ) ) ) )
proof end;