:: SCMFSA_4 semantic presentation

registration
let c1 be set ;
let c2 be AMI-Struct of c1;
cluster -> finite FinPartState of a2;
coherence
for b1 being FinPartState of c2 holds b1 is finite
by AMI_1:def 24;
end;

registration
let c1 be set ;
let c2 be AMI-Struct of c1;
cluster finite programmed FinPartState of a2;
existence
ex b1 being FinPartState of c2 st b1 is programmed
proof end;
end;

theorem Th1: :: SCMFSA_4:1
for b1 being with_non-empty_elements set
for b2 being non empty non void definite AMI-Struct of b1
for b3 being programmed FinPartState of b2 holds rng b3 c= the Instructions of b2
proof end;

definition
let c1 be set ;
let c2 be AMI-Struct of c1;
let c3, c4 be programmed FinPartState of c2;
redefine func +* as c3 +* c4 -> programmed FinPartState of a2;
coherence
c3 +* c4 is programmed FinPartState of c2
by AMI_3:35;
end;

theorem Th2: :: SCMFSA_4:2
for b1 being with_non-empty_elements set
for b2 being non empty non void definite AMI-Struct of b1
for b3 being Function of the Instructions of b2,the Instructions of b2
for b4 being programmed FinPartState of b2 holds dom (b3 * b4) = dom b4
proof end;

definition
let c1 be Instruction-Location of SCM+FSA ;
let c2 be Nat;
func c1 + c2 -> Instruction-Location of SCM+FSA means :Def1: :: SCMFSA_4:def 1
ex b1 being Nat st
( a1 = insloc b1 & a3 = insloc (b1 + a2) );
existence
ex b1 being Instruction-Location of SCM+FSA ex b2 being Nat st
( c1 = insloc b2 & b1 = insloc (b2 + c2) )
proof end;
uniqueness
for b1, b2 being Instruction-Location of SCM+FSA st ex b3 being Nat st
( c1 = insloc b3 & b1 = insloc (b3 + c2) ) & ex b3 being Nat st
( c1 = insloc b3 & b2 = insloc (b3 + c2) ) holds
b1 = b2
by SCMFSA_2:18;
func c1 -' c2 -> Instruction-Location of SCM+FSA means :Def2: :: SCMFSA_4:def 2
ex b1 being Nat st
( a1 = insloc b1 & a3 = insloc (b1 -' a2) );
existence
ex b1 being Instruction-Location of SCM+FSA ex b2 being Nat st
( c1 = insloc b2 & b1 = insloc (b2 -' c2) )
proof end;
uniqueness
for b1, b2 being Instruction-Location of SCM+FSA st ex b3 being Nat st
( c1 = insloc b3 & b1 = insloc (b3 -' c2) ) & ex b3 being Nat st
( c1 = insloc b3 & b2 = insloc (b3 -' c2) ) holds
b1 = b2
by SCMFSA_2:18;
end;

:: deftheorem Def1 defines + SCMFSA_4:def 1 :
for b1 being Instruction-Location of SCM+FSA
for b2 being Nat
for b3 being Instruction-Location of SCM+FSA holds
( b3 = b1 + b2 iff ex b4 being Nat st
( b1 = insloc b4 & b3 = insloc (b4 + b2) ) );

:: deftheorem Def2 defines -' SCMFSA_4:def 2 :
for b1 being Instruction-Location of SCM+FSA
for b2 being Nat
for b3 being Instruction-Location of SCM+FSA holds
( b3 = b1 -' b2 iff ex b4 being Nat st
( b1 = insloc b4 & b3 = insloc (b4 -' b2) ) );

theorem Th3: :: SCMFSA_4:3
for b1 being Instruction-Location of SCM+FSA
for b2, b3 being Nat holds (b1 + b2) + b3 = b1 + (b2 + b3)
proof end;

theorem Th4: :: SCMFSA_4:4
for b1 being Instruction-Location of SCM+FSA
for b2 being Nat holds (b1 + b2) -' b2 = b1
proof end;

theorem Th5: :: SCMFSA_4:5
for b1 being Nat
for b2 being Instruction-Location of SCM+FSA
for b3 being Instruction-Location of SCM st b3 = b2 holds
b2 + b1 = b3 + b1
proof end;

theorem Th6: :: SCMFSA_4:6
for b1, b2 being Instruction-Location of SCM+FSA
for b3 being Nat holds
( Start-At (b1 + b3) = Start-At (b2 + b3) iff Start-At b1 = Start-At b2 )
proof end;

theorem Th7: :: SCMFSA_4:7
for b1, b2 being Instruction-Location of SCM+FSA
for b3 being Nat st Start-At b1 = Start-At b2 holds
Start-At (b1 -' b3) = Start-At (b2 -' b3)
proof end;

definition
let c1 be Instruction of SCM+FSA ;
let c2 be Nat;
func IncAddr c1,c2 -> Instruction of SCM+FSA means :Def3: :: SCMFSA_4:def 3
ex b1 being Instruction of SCM st
( b1 = a1 & a3 = IncAddr b1,a2 ) if InsCode a1 in {6,7,8}
otherwise a3 = a1;
existence
( ( InsCode c1 in {6,7,8} implies ex b1 being Instruction of SCM+FSA ex b2 being Instruction of SCM st
( b2 = c1 & b1 = IncAddr b2,c2 ) ) & ( not InsCode c1 in {6,7,8} implies ex b1 being Instruction of SCM+FSA st b1 = c1 ) )
proof end;
correctness
consistency
for b1 being Instruction of SCM+FSA holds verum
;
uniqueness
for b1, b2 being Instruction of SCM+FSA holds
( ( InsCode c1 in {6,7,8} & ex b3 being Instruction of SCM st
( b3 = c1 & b1 = IncAddr b3,c2 ) & ex b3 being Instruction of SCM st
( b3 = c1 & b2 = IncAddr b3,c2 ) implies b1 = b2 ) & ( not InsCode c1 in {6,7,8} & b1 = c1 & b2 = c1 implies b1 = b2 ) )
;
;
end;

:: deftheorem Def3 defines IncAddr SCMFSA_4:def 3 :
for b1 being Instruction of SCM+FSA
for b2 being Nat
for b3 being Instruction of SCM+FSA holds
( ( InsCode b1 in {6,7,8} implies ( b3 = IncAddr b1,b2 iff ex b4 being Instruction of SCM st
( b4 = b1 & b3 = IncAddr b4,b2 ) ) ) & ( not InsCode b1 in {6,7,8} implies ( b3 = IncAddr b1,b2 iff b3 = b1 ) ) );

theorem Th8: :: SCMFSA_4:8
for b1 being Nat holds IncAddr (halt SCM+FSA ),b1 = halt SCM+FSA
proof end;

theorem Th9: :: SCMFSA_4:9
for b1 being Nat
for b2, b3 being Int-Location holds IncAddr (b2 := b3),b1 = b2 := b3
proof end;

theorem Th10: :: SCMFSA_4:10
for b1 being Nat
for b2, b3 being Int-Location holds IncAddr (AddTo b2,b3),b1 = AddTo b2,b3
proof end;

theorem Th11: :: SCMFSA_4:11
for b1 being Nat
for b2, b3 being Int-Location holds IncAddr (SubFrom b2,b3),b1 = SubFrom b2,b3
proof end;

theorem Th12: :: SCMFSA_4:12
for b1 being Nat
for b2, b3 being Int-Location holds IncAddr (MultBy b2,b3),b1 = MultBy b2,b3
proof end;

theorem Th13: :: SCMFSA_4:13
for b1 being Nat
for b2, b3 being Int-Location holds IncAddr (Divide b2,b3),b1 = Divide b2,b3
proof end;

theorem Th14: :: SCMFSA_4:14
for b1 being Nat
for b2 being Instruction-Location of SCM+FSA holds IncAddr (goto b2),b1 = goto (b2 + b1)
proof end;

theorem Th15: :: SCMFSA_4:15
for b1 being Nat
for b2 being Instruction-Location of SCM+FSA
for b3 being Int-Location holds IncAddr (b3 =0_goto b2),b1 = b3 =0_goto (b2 + b1)
proof end;

theorem Th16: :: SCMFSA_4:16
for b1 being Nat
for b2 being Instruction-Location of SCM+FSA
for b3 being Int-Location holds IncAddr (b3 >0_goto b2),b1 = b3 >0_goto (b2 + b1)
proof end;

theorem Th17: :: SCMFSA_4:17
for b1 being Nat
for b2, b3 being Int-Location
for b4 being FinSeq-Location holds IncAddr (b3 := b4,b2),b1 = b3 := b4,b2
proof end;

theorem Th18: :: SCMFSA_4:18
for b1 being Nat
for b2, b3 being Int-Location
for b4 being FinSeq-Location holds IncAddr (b4,b2 := b3),b1 = b4,b2 := b3
proof end;

theorem Th19: :: SCMFSA_4:19
for b1 being Nat
for b2 being Int-Location
for b3 being FinSeq-Location holds IncAddr (b2 :=len b3),b1 = b2 :=len b3
proof end;

theorem Th20: :: SCMFSA_4:20
for b1 being Nat
for b2 being Int-Location
for b3 being FinSeq-Location holds IncAddr (b3 :=<0,...,0> b2),b1 = b3 :=<0,...,0> b2
proof end;

theorem Th21: :: SCMFSA_4:21
for b1 being Nat
for b2 being Instruction of SCM+FSA
for b3 being Instruction of SCM st b2 = b3 holds
IncAddr b2,b1 = IncAddr b3,b1
proof end;

theorem Th22: :: SCMFSA_4:22
for b1 being Instruction of SCM+FSA
for b2 being Nat holds InsCode (IncAddr b1,b2) = InsCode b1
proof end;

definition
let c1 be FinPartState of SCM+FSA ;
attr a1 is initial means :: SCMFSA_4:def 4
for b1, b2 being Nat st insloc b2 in dom a1 & b1 < b2 holds
insloc b1 in dom a1;
end;

:: deftheorem Def4 defines initial SCMFSA_4:def 4 :
for b1 being FinPartState of SCM+FSA holds
( b1 is initial iff for b2, b3 being Nat st insloc b3 in dom b1 & b2 < b3 holds
insloc b2 in dom b1 );

definition
func SCM+FSA-Stop -> FinPartState of SCM+FSA equals :: SCMFSA_4:def 5
(insloc 0) .--> (halt SCM+FSA );
correctness
coherence
(insloc 0) .--> (halt SCM+FSA ) is FinPartState of SCM+FSA
;
;
end;

:: deftheorem Def5 defines SCM+FSA-Stop SCMFSA_4:def 5 :
SCM+FSA-Stop = (insloc 0) .--> (halt SCM+FSA );

registration
cluster SCM+FSA-Stop -> non empty finite programmed initial ;
coherence
( not SCM+FSA-Stop is empty & SCM+FSA-Stop is initial & SCM+FSA-Stop is programmed )
proof end;
end;

registration
cluster non empty finite programmed initial FinPartState of SCM+FSA ;
existence
ex b1 being FinPartState of SCM+FSA st
( b1 is initial & b1 is programmed & not b1 is empty )
proof end;
end;

registration
let c1 be Function;
let c2 be finite Function;
cluster a2 * a1 -> finite ;
coherence
c1 * c2 is finite
proof end;
end;

definition
let c1 be non empty with_non-empty_elements set ;
let c2 be non empty non void definite AMI-Struct of c1;
let c3 be programmed FinPartState of c2;
let c4 be Function of the Instructions of c2,the Instructions of c2;
redefine func * as c4 * c3 -> programmed FinPartState of a2;
coherence
c3 * c4 is programmed FinPartState of c2
proof end;
end;

theorem Th23: :: SCMFSA_4:23
for b1, b2 being Nat
for b3 being Instruction of SCM+FSA holds IncAddr (IncAddr b3,b1),b2 = IncAddr b3,(b1 + b2)
proof end;

definition
let c1 be programmed FinPartState of SCM+FSA ;
let c2 be Nat;
func IncAddr c1,c2 -> programmed FinPartState of SCM+FSA means :Def6: :: SCMFSA_4:def 6
( dom a3 = dom a1 & ( for b1 being Nat st insloc b1 in dom a1 holds
a3 . (insloc b1) = IncAddr (pi a1,(insloc b1)),a2 ) );
existence
ex b1 being programmed FinPartState of SCM+FSA st
( dom b1 = dom c1 & ( for b2 being Nat st insloc b2 in dom c1 holds
b1 . (insloc b2) = IncAddr (pi c1,(insloc b2)),c2 ) )
proof end;
uniqueness
for b1, b2 being programmed FinPartState of SCM+FSA st dom b1 = dom c1 & ( for b3 being Nat st insloc b3 in dom c1 holds
b1 . (insloc b3) = IncAddr (pi c1,(insloc b3)),c2 ) & dom b2 = dom c1 & ( for b3 being Nat st insloc b3 in dom c1 holds
b2 . (insloc b3) = IncAddr (pi c1,(insloc b3)),c2 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines IncAddr SCMFSA_4:def 6 :
for b1 being programmed FinPartState of SCM+FSA
for b2 being Nat
for b3 being programmed FinPartState of SCM+FSA holds
( b3 = IncAddr b1,b2 iff ( dom b3 = dom b1 & ( for b4 being Nat st insloc b4 in dom b1 holds
b3 . (insloc b4) = IncAddr (pi b1,(insloc b4)),b2 ) ) );

theorem Th24: :: SCMFSA_4:24
for b1 being programmed FinPartState of SCM+FSA
for b2 being Nat
for b3 being Instruction-Location of SCM+FSA st b3 in dom b1 holds
(IncAddr b1,b2) . b3 = IncAddr (pi b1,b3),b2
proof end;

theorem Th25: :: SCMFSA_4:25
for b1 being Nat
for b2, b3 being programmed FinPartState of SCM+FSA holds IncAddr (b2 +* b3),b1 = (IncAddr b2,b1) +* (IncAddr b3,b1)
proof end;

theorem Th26: :: SCMFSA_4:26
for b1 being Nat
for b2 being Instruction of SCM+FSA
for b3 being Function of the Instructions of SCM+FSA ,the Instructions of SCM+FSA st b3 = (id the Instructions of SCM+FSA ) +* ((halt SCM+FSA ) .--> b2) holds
for b4 being programmed FinPartState of SCM+FSA holds IncAddr (b3 * b4),b1 = ((id the Instructions of SCM+FSA ) +* ((halt SCM+FSA ) .--> (IncAddr b2,b1))) * (IncAddr b4,b1)
proof end;

theorem Th27: :: SCMFSA_4:27
for b1, b2 being Nat
for b3 being programmed FinPartState of SCM+FSA holds IncAddr (IncAddr b3,b1),b2 = IncAddr b3,(b1 + b2)
proof end;

theorem Th28: :: SCMFSA_4:28
for b1 being Nat
for b2 being State of SCM+FSA holds Exec (IncAddr (CurInstr b2),b1),(b2 +* (Start-At ((IC b2) + b1))) = (Following b2) +* (Start-At ((IC (Following b2)) + b1))
proof end;

theorem Th29: :: SCMFSA_4:29
for b1 being Instruction of SCM+FSA
for b2 being State of SCM+FSA
for b3 being FinPartState of SCM+FSA
for b4, b5, b6 being Nat st IC b2 = insloc (b5 + b6) holds
Exec b1,(b2 +* (Start-At ((IC b2) -' b6))) = (Exec (IncAddr b1,b6),b2) +* (Start-At ((IC (Exec (IncAddr b1,b6),b2)) -' b6))
proof end;

definition
let c1 be FinPartState of SCM+FSA ;
let c2 be Nat;
func Shift c1,c2 -> programmed FinPartState of SCM+FSA means :Def7: :: SCMFSA_4:def 7
( dom a3 = { (insloc (b1 + a2)) where B is Nat : insloc b1 in dom a1 } & ( for b1 being Nat st insloc b1 in dom a1 holds
a3 . (insloc (b1 + a2)) = a1 . (insloc b1) ) );
existence
ex b1 being programmed FinPartState of SCM+FSA st
( dom b1 = { (insloc (b2 + c2)) where B is Nat : insloc b2 in dom c1 } & ( for b2 being Nat st insloc b2 in dom c1 holds
b1 . (insloc (b2 + c2)) = c1 . (insloc b2) ) )
proof end;
uniqueness
for b1, b2 being programmed FinPartState of SCM+FSA st dom b1 = { (insloc (b3 + c2)) where B is Nat : insloc b3 in dom c1 } & ( for b3 being Nat st insloc b3 in dom c1 holds
b1 . (insloc (b3 + c2)) = c1 . (insloc b3) ) & dom b2 = { (insloc (b3 + c2)) where B is Nat : insloc b3 in dom c1 } & ( for b3 being Nat st insloc b3 in dom c1 holds
b2 . (insloc (b3 + c2)) = c1 . (insloc b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def7 defines Shift SCMFSA_4:def 7 :
for b1 being FinPartState of SCM+FSA
for b2 being Nat
for b3 being programmed FinPartState of SCM+FSA holds
( b3 = Shift b1,b2 iff ( dom b3 = { (insloc (b4 + b2)) where B is Nat : insloc b4 in dom b1 } & ( for b4 being Nat st insloc b4 in dom b1 holds
b3 . (insloc (b4 + b2)) = b1 . (insloc b4) ) ) );

theorem Th30: :: SCMFSA_4:30
for b1 being Instruction-Location of SCM+FSA
for b2 being Nat
for b3 being FinPartState of SCM+FSA st b1 in dom b3 holds
(Shift b3,b2) . (b1 + b2) = b3 . b1
proof end;

theorem Th31: :: SCMFSA_4:31
for b1 being FinPartState of SCM+FSA
for b2 being Nat holds dom (Shift b1,b2) = { (b3 + b2) where B is Instruction-Location of SCM+FSA : b3 in dom b1 }
proof end;

theorem Th32: :: SCMFSA_4:32
for b1, b2 being Nat
for b3 being FinPartState of SCM+FSA holds Shift (Shift b3,b1),b2 = Shift b3,(b1 + b2)
proof end;

theorem Th33: :: SCMFSA_4:33
for b1 being programmed FinPartState of SCM+FSA
for b2 being Function of the Instructions of SCM+FSA ,the Instructions of SCM+FSA
for b3 being Nat holds Shift (b2 * b1),b3 = b2 * (Shift b1,b3)
proof end;

theorem Th34: :: SCMFSA_4:34
for b1 being Nat
for b2, b3 being FinPartState of SCM+FSA holds Shift (b2 +* b3),b1 = (Shift b2,b1) +* (Shift b3,b1)
proof end;

theorem Th35: :: SCMFSA_4:35
for b1, b2 being Nat
for b3 being programmed FinPartState of SCM+FSA holds Shift (IncAddr b3,b1),b2 = IncAddr (Shift b3,b2),b1
proof end;