:: SCMFSA6A semantic presentation

definition
mode Macro-Instruction is programmed initial FinPartState of SCM+FSA ;
end;

definition
let I be programmed FinPartState of SCM+FSA ;
func Directed I -> programmed FinPartState of SCM+FSA equals :: SCMFSA6A:def 1
((id the Instructions of SCM+FSA ) +* ((halt SCM+FSA ) .--> (goto (insloc (card I))))) * I;
coherence
((id the Instructions of SCM+FSA ) +* ((halt SCM+FSA ) .--> (goto (insloc (card I))))) * I is programmed FinPartState of SCM+FSA
proof end;
correctness
;
end;

:: deftheorem defines Directed SCMFSA6A:def 1 :
for I being programmed FinPartState of SCM+FSA holds Directed I = ((id the Instructions of SCM+FSA ) +* ((halt SCM+FSA ) .--> (goto (insloc (card I))))) * I;

theorem :: SCMFSA6A:1
canceled;

theorem :: SCMFSA6A:2
canceled;

theorem :: SCMFSA6A:3
canceled;

theorem :: SCMFSA6A:4
canceled;

theorem :: SCMFSA6A:5
canceled;

theorem :: SCMFSA6A:6
canceled;

theorem :: SCMFSA6A:7
canceled;

theorem :: SCMFSA6A:8
canceled;

theorem :: SCMFSA6A:9
canceled;

theorem :: SCMFSA6A:10
canceled;

theorem :: SCMFSA6A:11
canceled;

theorem :: SCMFSA6A:12
canceled;

theorem :: SCMFSA6A:13
canceled;

theorem Th14: :: SCMFSA6A:14
for I being Macro-Instruction holds dom (Directed I) = dom I
proof end;

registration
let I be Macro-Instruction;
cluster Directed I -> programmed initial ;
coherence
Directed I is initial
proof end;
end;

definition
let i be Instruction of SCM+FSA ;
func Macro i -> Macro-Instruction equals :: SCMFSA6A:def 2
(insloc 0 ),(insloc 1) --> i,(halt SCM+FSA );
coherence
(insloc 0 ),(insloc 1) --> i,(halt SCM+FSA ) is Macro-Instruction
proof end;
correctness
;
end;

:: deftheorem defines Macro SCMFSA6A:def 2 :
for i being Instruction of SCM+FSA holds Macro i = (insloc 0 ),(insloc 1) --> i,(halt SCM+FSA );

registration
let i be Instruction of SCM+FSA ;
cluster Macro i -> non empty ;
coherence
not Macro i is empty
;
end;

theorem Th15: :: SCMFSA6A:15
for P being Macro-Instruction
for n being Element of NAT holds
( n < card P iff n in dom P )
proof end;

registration
let I be initial FinPartState of SCM+FSA ;
cluster ProgramPart I -> initial ;
coherence
ProgramPart I is initial
proof end;
end;

theorem Th16: :: SCMFSA6A:16
for I, J being Macro-Instruction holds dom I misses dom (ProgramPart (Relocated J,(card I)))
proof end;

theorem Th17: :: SCMFSA6A:17
for m being Element of NAT
for I being programmed FinPartState of SCM+FSA holds card (ProgramPart (Relocated I,m)) = card I
proof end;

theorem Th18: :: SCMFSA6A:18
for I being Macro-Instruction holds not halt SCM+FSA in rng (Directed I)
proof end;

theorem Th19: :: SCMFSA6A:19
for m being Element of NAT
for I being Macro-Instruction holds ProgramPart (Relocated (Directed I),m) = ((id the Instructions of SCM+FSA ) +* ((halt SCM+FSA ) .--> (goto (insloc (m + (card I)))))) * (ProgramPart (Relocated I,m))
proof end;

theorem :: SCMFSA6A:20
for I, J being FinPartState of SCM+FSA holds ProgramPart (I +* J) = (ProgramPart I) +* (ProgramPart J) by FUNCT_4:75;

theorem Th21: :: SCMFSA6A:21
for n being Element of NAT
for I, J being FinPartState of SCM+FSA holds ProgramPart (Relocated (I +* J),n) = (ProgramPart (Relocated I,n)) +* (ProgramPart (Relocated J,n))
proof end;

theorem Th22: :: SCMFSA6A:22
for m, n being Element of NAT
for I being Macro-Instruction holds ProgramPart (Relocated (ProgramPart (Relocated I,m)),n) = ProgramPart (Relocated I,(m + n))
proof end;

definition
let I be FinPartState of SCM+FSA ;
func Initialized I -> FinPartState of SCM+FSA equals :: SCMFSA6A:def 3
(I +* ((intloc 0 ) .--> 1)) +* (Start-At (insloc 0 ));
coherence
(I +* ((intloc 0 ) .--> 1)) +* (Start-At (insloc 0 )) is FinPartState of SCM+FSA
proof end;
correctness
;
end;

:: deftheorem defines Initialized SCMFSA6A:def 3 :
for I being FinPartState of SCM+FSA holds Initialized I = (I +* ((intloc 0 ) .--> 1)) +* (Start-At (insloc 0 ));

theorem Th23: :: SCMFSA6A:23
for i being Instruction of SCM+FSA
for s being State of SCM+FSA holds
( InsCode i in {0 ,6,7,8} or (Exec i,s) . (IC SCM+FSA ) = Next (IC s) )
proof end;

theorem Th24: :: SCMFSA6A:24
for I being Macro-Instruction holds IC SCM+FSA in dom (Initialized I)
proof end;

theorem :: SCMFSA6A:25
for I being Macro-Instruction holds IC (Initialized I) = insloc 0
proof end;

Lm1: now
assume intloc 0 in NAT ; :: thesis: contradiction
then reconsider l = intloc 0 as Instruction-Location of SCM+FSA by AMI_1:def 4;
l = intloc 0 ;
hence contradiction by SCMFSA_2:84; :: thesis: verum
end;

Lm2: now
assume IC SCM+FSA in NAT ; :: thesis: contradiction
then reconsider l = IC SCM+FSA as Instruction-Location of SCM+FSA by AMI_1:def 4;
l = IC SCM+FSA ;
hence contradiction by AMI_1:48; :: thesis: verum
end;

theorem Th26: :: SCMFSA6A:26
for I being Macro-Instruction holds I c= Initialized I
proof end;

theorem :: SCMFSA6A:27
canceled;

theorem Th28: :: SCMFSA6A:28
for s1, s2 being State of SCM+FSA st IC s1 = IC s2 & ( for a being Int-Location holds s1 . a = s2 . a ) & ( for f being FinSeq-Location holds s1 . f = s2 . f ) holds
s1,s2 equal_outside NAT
proof end;

theorem :: SCMFSA6A:29
canceled;

theorem Th30: :: SCMFSA6A:30
for s1, s2 being State of SCM+FSA st s1,s2 equal_outside NAT holds
for a being Int-Location holds s1 . a = s2 . a
proof end;

theorem Th31: :: SCMFSA6A:31
for s1, s2 being State of SCM+FSA st s1,s2 equal_outside NAT holds
for f being FinSeq-Location holds s1 . f = s2 . f
proof end;

theorem :: SCMFSA6A:32
for i being Instruction of SCM+FSA
for s1, s2 being State of SCM+FSA st s1,s2 equal_outside NAT holds
Exec i,s1, Exec i,s2 equal_outside NAT
proof end;

theorem :: SCMFSA6A:33
for I being Macro-Instruction holds (Initialized I) | NAT = I
proof end;

scheme :: SCMFSA6A:sch 1
SCMFSAEx{ F1( set ) -> Element of the Instructions of SCM+FSA , F2( set ) -> Integer, F3( set ) -> FinSequence of INT , F4() -> Instruction-Location of SCM+FSA } :
ex S being State of SCM+FSA st
( IC S = F4() & ( for i being Element of NAT holds
( S . (insloc i) = F1(i) & S . (intloc i) = F2(i) & S . (fsloc i) = F3(i) ) ) )
proof end;

theorem :: SCMFSA6A:34
for s being State of SCM+FSA holds dom s = ((Int-Locations \/ FinSeq-Locations ) \/ {(IC SCM+FSA )}) \/ NAT by AMI_1:79, SCMFSA_2:8;

theorem :: SCMFSA6A:35
for s being State of SCM+FSA
for x being set holds
( not x in dom s or x is Int-Location or x is FinSeq-Location or x = IC SCM+FSA or x is Instruction-Location of SCM+FSA )
proof end;

theorem :: SCMFSA6A:36
for s1, s2 being State of SCM+FSA holds
( ( for l being Instruction-Location of SCM+FSA holds s1 . l = s2 . l ) iff s1 | NAT = s2 | NAT )
proof end;

theorem :: SCMFSA6A:37
for i being Instruction-Location of SCM+FSA holds
( not i in Int-Locations \/ FinSeq-Locations & not IC SCM+FSA in Int-Locations \/ FinSeq-Locations )
proof end;

theorem Th38: :: SCMFSA6A:38
for s1, s2 being State of SCM+FSA holds
( ( ( for a being Int-Location holds s1 . a = s2 . a ) & ( for f being FinSeq-Location holds s1 . f = s2 . f ) ) iff s1 | (Int-Locations \/ FinSeq-Locations ) = s2 | (Int-Locations \/ FinSeq-Locations ) )
proof end;

theorem :: SCMFSA6A:39
for s1, s2 being State of SCM+FSA st s1,s2 equal_outside NAT holds
s1 | (Int-Locations \/ FinSeq-Locations ) = s2 | (Int-Locations \/ FinSeq-Locations )
proof end;

theorem :: SCMFSA6A:40
for s, ss being State of SCM+FSA
for A being set holds (ss +* (s | A)) | A = s | A
proof end;

theorem :: SCMFSA6A:41
for s1, s2 being State of SCM+FSA
for n being Element of NAT
for i being Instruction of SCM+FSA st (IC s1) + n = IC s2 & s1 | (Int-Locations \/ FinSeq-Locations ) = s2 | (Int-Locations \/ FinSeq-Locations ) holds
( (IC (Exec i,s1)) + n = IC (Exec (IncAddr i,n),s2) & (Exec i,s1) | (Int-Locations \/ FinSeq-Locations ) = (Exec (IncAddr i,n),s2) | (Int-Locations \/ FinSeq-Locations ) )
proof end;

theorem :: SCMFSA6A:42
for I, J being Macro-Instruction holds I,J equal_outside NAT
proof end;

theorem Th43: :: SCMFSA6A:43
for I being Macro-Instruction holds dom (Initialized I) = ((dom I) \/ {(intloc 0 )}) \/ {(IC SCM+FSA )}
proof end;

theorem Th44: :: SCMFSA6A:44
for I being Macro-Instruction
for x being set holds
( not x in dom (Initialized I) or x in dom I or x = intloc 0 or x = IC SCM+FSA )
proof end;

theorem Th45: :: SCMFSA6A:45
for I being Macro-Instruction holds intloc 0 in dom (Initialized I)
proof end;

theorem Th46: :: SCMFSA6A:46
for I being Macro-Instruction holds
( (Initialized I) . (intloc 0 ) = 1 & (Initialized I) . (IC SCM+FSA ) = insloc 0 )
proof end;

theorem Th47: :: SCMFSA6A:47
for I being Macro-Instruction holds
( not intloc 0 in dom I & not IC SCM+FSA in dom I )
proof end;

theorem Th48: :: SCMFSA6A:48
for I being Macro-Instruction
for a being Int-Location st a <> intloc 0 holds
not a in dom (Initialized I)
proof end;

theorem Th49: :: SCMFSA6A:49
for I being Macro-Instruction
for f being FinSeq-Location holds not f in dom (Initialized I)
proof end;

theorem Th50: :: SCMFSA6A:50
for I being Macro-Instruction
for x being set st x in dom I holds
I . x = (Initialized I) . x
proof end;

theorem Th51: :: SCMFSA6A:51
for I, J being Macro-Instruction
for s being State of SCM+FSA st Initialized J c= s holds
s +* (Initialized I) = s +* I
proof end;

theorem :: SCMFSA6A:52
for I, J being Macro-Instruction
for s being State of SCM+FSA st Initialized J c= s holds
Initialized I c= s +* I
proof end;

theorem :: SCMFSA6A:53
for I, J being Macro-Instruction
for s being State of SCM+FSA holds s +* (Initialized I),s +* (Initialized J) equal_outside NAT
proof end;

definition
let I, J be Macro-Instruction;
func I ';' J -> Macro-Instruction equals :: SCMFSA6A:def 4
(Directed I) +* (ProgramPart (Relocated J,(card I)));
coherence
(Directed I) +* (ProgramPart (Relocated J,(card I))) is Macro-Instruction
proof end;
correctness
;
end;

:: deftheorem defines ';' SCMFSA6A:def 4 :
for I, J being Macro-Instruction holds I ';' J = (Directed I) +* (ProgramPart (Relocated J,(card I)));

theorem :: SCMFSA6A:54
for I, J being Macro-Instruction
for l being Instruction-Location of SCM+FSA st l in dom I & I . l <> halt SCM+FSA holds
(I ';' J) . l = I . l
proof end;

theorem :: SCMFSA6A:55
for I, J being Macro-Instruction holds Directed I c= I ';' J
proof end;

theorem Th56: :: SCMFSA6A:56
for I, J being Macro-Instruction holds dom I c= dom (I ';' J)
proof end;

theorem :: SCMFSA6A:57
for I, J being Macro-Instruction holds I +* (I ';' J) = I ';' J
proof end;

theorem :: SCMFSA6A:58
for I, J being Macro-Instruction holds (Initialized I) +* (I ';' J) = Initialized (I ';' J)
proof end;

definition
let i be Instruction of SCM+FSA ;
let J be Macro-Instruction;
func i ';' J -> Macro-Instruction equals :: SCMFSA6A:def 5
(Macro i) ';' J;
correctness
coherence
(Macro i) ';' J is Macro-Instruction
;
;
end;

:: deftheorem defines ';' SCMFSA6A:def 5 :
for i being Instruction of SCM+FSA
for J being Macro-Instruction holds i ';' J = (Macro i) ';' J;

definition
let I be Macro-Instruction;
let j be Instruction of SCM+FSA ;
func I ';' j -> Macro-Instruction equals :: SCMFSA6A:def 6
I ';' (Macro j);
correctness
coherence
I ';' (Macro j) is Macro-Instruction
;
;
end;

:: deftheorem defines ';' SCMFSA6A:def 6 :
for I being Macro-Instruction
for j being Instruction of SCM+FSA holds I ';' j = I ';' (Macro j);

definition
let i, j be Instruction of SCM+FSA ;
func i ';' j -> Macro-Instruction equals :: SCMFSA6A:def 7
(Macro i) ';' (Macro j);
correctness
coherence
(Macro i) ';' (Macro j) is Macro-Instruction
;
;
end;

:: deftheorem defines ';' SCMFSA6A:def 7 :
for i, j being Instruction of SCM+FSA holds i ';' j = (Macro i) ';' (Macro j);

theorem :: SCMFSA6A:59
for i, j being Instruction of SCM+FSA holds i ';' j = (Macro i) ';' j ;

theorem :: SCMFSA6A:60
for i, j being Instruction of SCM+FSA holds i ';' j = i ';' (Macro j) ;

theorem Th61: :: SCMFSA6A:61
for I, J being Macro-Instruction holds card (I ';' J) = (card I) + (card J)
proof end;

theorem Th62: :: SCMFSA6A:62
for I, J, K being Macro-Instruction holds (I ';' J) ';' K = I ';' (J ';' K)
proof end;

theorem :: SCMFSA6A:63
for k being Instruction of SCM+FSA
for I, J being Macro-Instruction holds (I ';' J) ';' k = I ';' (J ';' k) by Th62;

theorem :: SCMFSA6A:64
for j being Instruction of SCM+FSA
for I, K being Macro-Instruction holds (I ';' j) ';' K = I ';' (j ';' K) by Th62;

theorem :: SCMFSA6A:65
for j, k being Instruction of SCM+FSA
for I being Macro-Instruction holds (I ';' j) ';' k = I ';' (j ';' k) by Th62;

theorem :: SCMFSA6A:66
for i being Instruction of SCM+FSA
for J, K being Macro-Instruction holds (i ';' J) ';' K = i ';' (J ';' K) by Th62;

theorem :: SCMFSA6A:67
for i, k being Instruction of SCM+FSA
for J being Macro-Instruction holds (i ';' J) ';' k = i ';' (J ';' k) by Th62;

theorem :: SCMFSA6A:68
for i, j being Instruction of SCM+FSA
for K being Macro-Instruction holds (i ';' j) ';' K = i ';' (j ';' K) by Th62;

theorem :: SCMFSA6A:69
for i, j, k being Instruction of SCM+FSA holds (i ';' j) ';' k = i ';' (j ';' k) by Th62;