:: SCMPDS_5 semantic presentation

theorem Th1: :: SCMPDS_5:1
for b1 being 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 st b3 = Following b3 holds
for b4 being Nat holds (Computation b3) . b4 = b3
proof end;

theorem Th2: :: SCMPDS_5:2
for b1 being set
for b2 being Instruction of SCMPDS holds
( b1 in dom (Load b2) iff b1 = inspos 0 )
proof end;

theorem Th3: :: SCMPDS_5:3
for b1 being Instruction-Location of SCMPDS
for b2 being Program-block st b1 in dom (stop b2) & (stop b2) . b1 <> halt SCMPDS holds
b1 in dom b2
proof end;

theorem Th4: :: SCMPDS_5:4
for b1 being Instruction of SCMPDS holds
( dom (Load b1) = {(inspos 0)} & (Load b1) . (inspos 0) = b1 ) by CQC_LANG:5, CQC_LANG:6;

theorem Th5: :: SCMPDS_5:5
for b1 being Instruction of SCMPDS holds inspos 0 in dom (Load b1)
proof end;

theorem Th6: :: SCMPDS_5:6
for b1 being Instruction of SCMPDS holds card (Load b1) = 1
proof end;

theorem Th7: :: SCMPDS_5:7
for b1 being Program-block holds card (stop b1) = (card b1) + 1 by SCMPDS_4:45, SCMPDS_4:74;

theorem Th8: :: SCMPDS_5:8
for b1 being Instruction of SCMPDS holds card (stop (Load b1)) = 2
proof end;

theorem Th9: :: SCMPDS_5:9
for b1 being Instruction of SCMPDS holds
( inspos 0 in dom (stop (Load b1)) & inspos 1 in dom (stop (Load b1)) )
proof end;

theorem Th10: :: SCMPDS_5:10
for b1 being Instruction of SCMPDS holds
( (stop (Load b1)) . (inspos 0) = b1 & (stop (Load b1)) . (inspos 1) = halt SCMPDS )
proof end;

theorem Th11: :: SCMPDS_5:11
for b1 being set
for b2 being Instruction of SCMPDS holds
( b1 in dom (stop (Load b2)) iff ( b1 = inspos 0 or b1 = inspos 1 ) )
proof end;

theorem Th12: :: SCMPDS_5:12
for b1 being Instruction of SCMPDS holds dom (stop (Load b1)) = {(inspos 0),(inspos 1)}
proof end;

theorem Th13: :: SCMPDS_5:13
for b1 being Instruction of SCMPDS holds
( inspos 0 in dom (Initialized (stop (Load b1))) & inspos 1 in dom (Initialized (stop (Load b1))) & (Initialized (stop (Load b1))) . (inspos 0) = b1 & (Initialized (stop (Load b1))) . (inspos 1) = halt SCMPDS )
proof end;

theorem Th14: :: SCMPDS_5:14
for b1, b2 being Program-block holds Initialized (stop (b1 ';' b2)) = (b1 ';' (b2 ';' SCMPDS-Stop )) +* (Start-At (inspos 0)) by SCMPDS_4:46;

theorem Th15: :: SCMPDS_5:15
for b1, b2 being Program-block holds Initialized b1 c= Initialized (stop (b1 ';' b2))
proof end;

theorem Th16: :: SCMPDS_5:16
for b1, b2 being Program-block holds dom (stop b1) c= dom (stop (b1 ';' b2))
proof end;

theorem Th17: :: SCMPDS_5:17
for b1, b2 being Program-block holds (Initialized (stop b1)) +* (Initialized (stop (b1 ';' b2))) = Initialized (stop (b1 ';' b2))
proof end;

theorem Th18: :: SCMPDS_5:18
for b1 being State of SCMPDS
for b2 being Program-block st Initialized b2 c= b1 holds
IC b1 = inspos 0
proof end;

theorem Th19: :: SCMPDS_5:19
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being Program-block holds (b2 +* (Initialized b3)) . b1 = b2 . b1
proof end;

theorem Th20: :: SCMPDS_5:20
for b1, b2 being State of SCMPDS
for b3 being parahalting Program-block st Initialized (stop b3) c= b1 & Initialized (stop b3) c= b2 & b1,b2 equal_outside the Instruction-Locations of SCMPDS holds
for b4 being Nat holds
( (Computation b1) . b4,(Computation b2) . b4 equal_outside the Instruction-Locations of SCMPDS & CurInstr ((Computation b1) . b4) = CurInstr ((Computation b2) . b4) )
proof end;

theorem Th21: :: SCMPDS_5:21
for b1, b2 being State of SCMPDS
for b3 being parahalting Program-block st Initialized (stop b3) c= b1 & Initialized (stop b3) c= b2 & b1,b2 equal_outside the Instruction-Locations of SCMPDS holds
( LifeSpan b1 = LifeSpan b2 & Result b1, Result b2 equal_outside the Instruction-Locations of SCMPDS )
proof end;

theorem Th22: :: SCMPDS_5:22
for b1 being State of SCMPDS
for b2 being Program-block holds IC (IExec b2,b1) = IC (Result (b1 +* (Initialized (stop b2))))
proof end;

theorem Th23: :: SCMPDS_5:23
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Program-block st Initialized (stop b2) c= b1 holds
for b4 being Nat st b4 <= LifeSpan b1 holds
(Computation b1) . b4,(Computation (b1 +* (b2 ';' b3))) . b4 equal_outside the Instruction-Locations of SCMPDS
proof end;

theorem Th24: :: SCMPDS_5:24
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Program-block st Initialized (stop b2) c= b1 holds
for b4 being Nat st b4 <= LifeSpan b1 holds
(Computation b1) . b4,(Computation (b1 +* (Initialized (stop (b2 ';' b3))))) . b4 equal_outside the Instruction-Locations of SCMPDS
proof end;

Lemma24: Load ((DataLoc 0,0) := 0) is parahalting
proof end;

definition
let c1 be Instruction of SCMPDS ;
attr a1 is No-StopCode means :Def1: :: SCMPDS_5:def 1
a1 <> halt SCMPDS ;
end;

:: deftheorem Def1 defines No-StopCode SCMPDS_5:def 1 :
for b1 being Instruction of SCMPDS holds
( b1 is No-StopCode iff b1 <> halt SCMPDS );

definition
let c1 be Instruction of SCMPDS ;
attr a1 is parahalting means :Def2: :: SCMPDS_5:def 2
Load a1 is parahalting;
end;

:: deftheorem Def2 defines parahalting SCMPDS_5:def 2 :
for b1 being Instruction of SCMPDS holds
( b1 is parahalting iff Load b1 is parahalting );

registration
cluster shiftable No-StopCode parahalting M2(the Instructions of SCMPDS );
existence
ex b1 being Instruction of SCMPDS st
( b1 is No-StopCode & b1 is shiftable & b1 is parahalting )
proof end;
end;

theorem Th25: :: SCMPDS_5:25
for b1 being Integer st b1 <> 0 holds
goto b1 is No-StopCode
proof end;

registration
let c1 be Int_position ;
cluster return a1 -> No-StopCode ;
coherence
return c1 is No-StopCode
proof end;
end;

registration
let c1 be Int_position ;
let c2 be Integer;
cluster a1 := a2 -> No-StopCode ;
coherence
c1 := c2 is No-StopCode
proof end;
cluster saveIC a1,a2 -> No-StopCode ;
coherence
saveIC c1,c2 is No-StopCode
proof end;
end;

registration
let c1 be Int_position ;
let c2, c3 be Integer;
cluster a1,a2 <>0_goto a3 -> No-StopCode ;
coherence
c1,c2 <>0_goto c3 is No-StopCode
proof end;
cluster a1,a2 <=0_goto a3 -> No-StopCode ;
coherence
c1,c2 <=0_goto c3 is No-StopCode
proof end;
cluster a1,a2 >=0_goto a3 -> No-StopCode ;
coherence
c1,c2 >=0_goto c3 is No-StopCode
proof end;
cluster a1,a2 := a3 -> No-StopCode ;
coherence
c1,c2 := c3 is No-StopCode
proof end;
end;

registration
let c1 be Int_position ;
let c2, c3 be Integer;
cluster AddTo a1,a2,a3 -> No-StopCode ;
coherence
AddTo c1,c2,c3 is No-StopCode
proof end;
end;

registration
let c1, c2 be Int_position ;
let c3, c4 be Integer;
cluster AddTo a1,a3,a2,a4 -> No-StopCode ;
coherence
AddTo c1,c3,c2,c4 is No-StopCode
proof end;
cluster SubFrom a1,a3,a2,a4 -> No-StopCode ;
coherence
SubFrom c1,c3,c2,c4 is No-StopCode
proof end;
cluster MultBy a1,a3,a2,a4 -> No-StopCode ;
coherence
MultBy c1,c3,c2,c4 is No-StopCode
proof end;
cluster Divide a1,a3,a2,a4 -> No-StopCode ;
coherence
Divide c1,c3,c2,c4 is No-StopCode
proof end;
cluster a1,a3 := a2,a4 -> No-StopCode ;
coherence
c1,c3 := c2,c4 is No-StopCode
proof end;
end;

registration
cluster halt SCMPDS -> parahalting ;
coherence
halt SCMPDS is parahalting
proof end;
end;

registration
let c1 be parahalting Instruction of SCMPDS ;
cluster Load a1 -> parahalting ;
coherence
Load c1 is parahalting
by Def2;
end;

Lemma27: for b1 being Instruction of SCMPDS st ( for b2 being State of SCMPDS holds (Exec b1,b2) . (IC SCMPDS ) = Next (IC b2) ) holds
Load b1 is parahalting
proof end;

registration
let c1 be Int_position ;
let c2 be Integer;
cluster a1 := a2 -> No-StopCode parahalting ;
coherence
c1 := c2 is parahalting
proof end;
end;

registration
let c1 be Int_position ;
let c2, c3 be Integer;
cluster a1,a2 := a3 -> No-StopCode parahalting ;
coherence
c1,c2 := c3 is parahalting
proof end;
cluster AddTo a1,a2,a3 -> No-StopCode parahalting ;
coherence
AddTo c1,c2,c3 is parahalting
proof end;
end;

registration
let c1, c2 be Int_position ;
let c3, c4 be Integer;
cluster AddTo a1,a3,a2,a4 -> No-StopCode parahalting ;
coherence
AddTo c1,c3,c2,c4 is parahalting
proof end;
cluster SubFrom a1,a3,a2,a4 -> No-StopCode parahalting ;
coherence
SubFrom c1,c3,c2,c4 is parahalting
proof end;
cluster MultBy a1,a3,a2,a4 -> No-StopCode parahalting ;
coherence
MultBy c1,c3,c2,c4 is parahalting
proof end;
cluster Divide a1,a3,a2,a4 -> No-StopCode parahalting ;
coherence
Divide c1,c3,c2,c4 is parahalting
proof end;
cluster a1,a3 := a2,a4 -> No-StopCode parahalting ;
coherence
c1,c3 := c2,c4 is parahalting
proof end;
end;

theorem Th26: :: SCMPDS_5:26
for b1 being Instruction of SCMPDS st InsCode b1 = 1 holds
not b1 is parahalting
proof end;

definition
let c1 be FinPartState of SCMPDS ;
attr a1 is No-StopCode means :Def3: :: SCMPDS_5:def 3
for b1 being Instruction-Location of SCMPDS st b1 in dom a1 holds
a1 . b1 <> halt SCMPDS ;
end;

:: deftheorem Def3 defines No-StopCode SCMPDS_5:def 3 :
for b1 being FinPartState of SCMPDS holds
( b1 is No-StopCode iff for b2 being Instruction-Location of SCMPDS st b2 in dom b1 holds
b1 . b2 <> halt SCMPDS );

registration
cluster parahalting shiftable No-StopCode FinPartState of SCMPDS ;
existence
ex b1 being Program-block st
( b1 is parahalting & b1 is shiftable & b1 is No-StopCode )
proof end;
end;

registration
let c1, c2 be No-StopCode Program-block;
cluster a1 ';' a2 -> No-StopCode ;
coherence
c1 ';' c2 is No-StopCode
proof end;
end;

registration
let c1 be No-StopCode Instruction of SCMPDS ;
cluster Load a1 -> No-StopCode ;
coherence
Load c1 is No-StopCode
proof end;
end;

registration
let c1 be No-StopCode Instruction of SCMPDS ;
let c2 be No-StopCode Program-block;
cluster a1 ';' a2 -> No-StopCode ;
coherence
c1 ';' c2 is No-StopCode
;
end;

registration
let c1 be No-StopCode Program-block;
let c2 be No-StopCode Instruction of SCMPDS ;
cluster a1 ';' a2 -> No-StopCode ;
coherence
c1 ';' c2 is No-StopCode
;
end;

registration
let c1, c2 be No-StopCode Instruction of SCMPDS ;
cluster a1 ';' a2 -> No-StopCode ;
coherence
c1 ';' c2 is No-StopCode
;
end;

theorem Th27: :: SCMPDS_5:27
for b1 being State of SCMPDS
for b2 being parahalting No-StopCode Program-block st Initialized (stop b2) c= b1 holds
IC ((Computation b1) . (LifeSpan (b1 +* (Initialized (stop b2))))) = inspos (card b2)
proof end;

theorem Th28: :: SCMPDS_5:28
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Nat st b3 < LifeSpan (b1 +* (Initialized (stop b2))) holds
IC ((Computation (b1 +* (Initialized (stop b2)))) . b3) in dom b2
proof end;

theorem Th29: :: SCMPDS_5:29
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Nat st Initialized b2 c= b1 & b3 <= LifeSpan (b1 +* (Initialized (stop b2))) holds
(Computation b1) . b3,(Computation (b1 +* (Initialized (stop b2)))) . b3 equal_outside the Instruction-Locations of SCMPDS
proof end;

theorem Th30: :: SCMPDS_5:30
for b1 being State of SCMPDS
for b2 being parahalting No-StopCode Program-block st Initialized b2 c= b1 holds
IC ((Computation b1) . (LifeSpan (b1 +* (Initialized (stop b2))))) = inspos (card b2)
proof end;

theorem Th31: :: SCMPDS_5:31
for b1 being State of SCMPDS
for b2 being parahalting Program-block holds
( not Initialized b2 c= b1 or CurInstr ((Computation b1) . (LifeSpan (b1 +* (Initialized (stop b2))))) = halt SCMPDS or IC ((Computation b1) . (LifeSpan (b1 +* (Initialized (stop b2))))) = inspos (card b2) )
proof end;

theorem Th32: :: SCMPDS_5:32
for b1 being State of SCMPDS
for b2 being parahalting No-StopCode Program-block
for b3 being Nat st Initialized b2 c= b1 & b3 < LifeSpan (b1 +* (Initialized (stop b2))) holds
CurInstr ((Computation b1) . b3) <> halt SCMPDS
proof end;

theorem Th33: :: SCMPDS_5:33
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Program-block
for b4 being Nat st b4 <= LifeSpan (b1 +* (Initialized (stop b2))) holds
(Computation (b1 +* (Initialized (stop b2)))) . b4,(Computation (b1 +* ((b2 ';' b3) +* (Start-At (inspos 0))))) . b4 equal_outside the Instruction-Locations of SCMPDS
proof end;

theorem Th34: :: SCMPDS_5:34
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Program-block
for b4 being Nat st b4 <= LifeSpan (b1 +* (Initialized (stop b2))) holds
(Computation (b1 +* (Initialized (stop b2)))) . b4,(Computation (b1 +* (Initialized (stop (b2 ';' b3))))) . b4 equal_outside the Instruction-Locations of SCMPDS
proof end;

registration
let c1 be parahalting Program-block;
let c2 be parahalting shiftable Program-block;
cluster a1 ';' a2 -> parahalting ;
coherence
c1 ';' c2 is parahalting
proof end;
end;

registration
let c1 be parahalting Instruction of SCMPDS ;
let c2 be parahalting shiftable Program-block;
cluster a1 ';' a2 -> parahalting ;
coherence
c1 ';' c2 is parahalting
;
end;

registration
let c1 be parahalting Program-block;
let c2 be shiftable parahalting Instruction of SCMPDS ;
cluster a1 ';' a2 -> parahalting ;
coherence
c1 ';' c2 is parahalting
;
end;

registration
let c1 be parahalting Instruction of SCMPDS ;
let c2 be shiftable parahalting Instruction of SCMPDS ;
cluster a1 ';' a2 -> parahalting ;
coherence
c1 ';' c2 is parahalting
;
end;

theorem Th35: :: SCMPDS_5:35
for b1, b2 being Nat
for b3, b4 being State of SCMPDS
for b5 being parahalting shiftable Program-block st b3 = (Computation (b4 +* (Initialized (stop b5)))) . b1 holds
Exec (CurInstr b3),(b3 +* (Start-At ((IC b3) + b2))) = (Following b3) +* (Start-At ((IC (Following b3)) + b2))
proof end;

theorem Th36: :: SCMPDS_5:36
for b1 being State of SCMPDS
for b2 being parahalting No-StopCode Program-block
for b3 being parahalting shiftable Program-block
for b4 being Nat st Initialized (stop (b2 ';' b3)) c= b1 holds
((Computation ((Result (b1 +* (Initialized (stop b2)))) +* (Initialized (stop b3)))) . b4) +* (Start-At ((IC ((Computation ((Result (b1 +* (Initialized (stop b2)))) +* (Initialized (stop b3)))) . b4)) + (card b2))),(Computation (b1 +* (Initialized (stop (b2 ';' b3))))) . ((LifeSpan (b1 +* (Initialized (stop b2)))) + b4) equal_outside the Instruction-Locations of SCMPDS
proof end;

Lemma39: for b1 being parahalting No-StopCode Program-block
for b2 being parahalting shiftable Program-block
for b3, b4 being State of SCMPDS st Initialized (stop (b1 ';' b2)) c= b3 & b4 = b3 +* (Initialized (stop b1)) holds
( IC ((Computation b3) . (LifeSpan b4)) = inspos (card b1) & ((Computation b3) . (LifeSpan b4)) | SCM-Data-Loc = (((Computation b4) . (LifeSpan b4)) +* (Initialized (stop b2))) | SCM-Data-Loc & Shift (stop b2),(card b1) c= (Computation b3) . (LifeSpan b4) & LifeSpan b3 = (LifeSpan b4) + (LifeSpan ((Result b4) +* (Initialized (stop b2)))) )
proof end;

theorem Th37: :: SCMPDS_5:37
for b1 being State of SCMPDS
for b2 being parahalting No-StopCode Program-block
for b3 being parahalting shiftable Program-block holds LifeSpan (b1 +* (Initialized (stop (b2 ';' b3)))) = (LifeSpan (b1 +* (Initialized (stop b2)))) + (LifeSpan ((Result (b1 +* (Initialized (stop b2)))) +* (Initialized (stop b3))))
proof end;

theorem Th38: :: SCMPDS_5:38
for b1 being State of SCMPDS
for b2 being parahalting No-StopCode Program-block
for b3 being parahalting shiftable Program-block holds IExec (b2 ';' b3),b1 = (IExec b3,(IExec b2,b1)) +* (Start-At ((IC (IExec b3,(IExec b2,b1))) + (card b2)))
proof end;

theorem Th39: :: SCMPDS_5:39
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being parahalting No-StopCode Program-block
for b4 being parahalting shiftable Program-block holds (IExec (b3 ';' b4),b2) . b1 = (IExec b4,(IExec b3,b2)) . b1
proof end;

definition
let c1 be State of SCMPDS ;
func Initialized c1 -> State of SCMPDS equals :: SCMPDS_5:def 4
a1 +* (Start-At (inspos 0));
coherence
c1 +* (Start-At (inspos 0)) is State of SCMPDS
;
end;

:: deftheorem Def4 defines Initialized SCMPDS_5:def 4 :
for b1 being State of SCMPDS holds Initialized b1 = b1 +* (Start-At (inspos 0));

theorem Th40: :: SCMPDS_5:40
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being Instruction-Location of SCMPDS holds
( IC (Initialized b2) = inspos 0 & (Initialized b2) . b1 = b2 . b1 & (Initialized b2) . b3 = b2 . b3 )
proof end;

theorem Th41: :: SCMPDS_5:41
for b1, b2 being State of SCMPDS holds
( b1,b2 equal_outside the Instruction-Locations of SCMPDS iff b1 | (SCM-Data-Loc \/ {(IC SCMPDS )}) = b2 | (SCM-Data-Loc \/ {(IC SCMPDS )}) )
proof end;

theorem Th42: :: SCMPDS_5:42
canceled;

theorem Th43: :: SCMPDS_5:43
for b1 being Instruction of SCMPDS
for b2, b3 being State of SCMPDS st b2 | SCM-Data-Loc = b3 | SCM-Data-Loc & InsCode b1 <> 3 holds
(Exec b1,b2) | SCM-Data-Loc = (Exec b1,b3) | SCM-Data-Loc
proof end;

theorem Th44: :: SCMPDS_5:44
for b1, b2 being State of SCMPDS
for b3 being shiftable Instruction of SCMPDS st b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
(Exec b3,b1) | SCM-Data-Loc = (Exec b3,b2) | SCM-Data-Loc
proof end;

theorem Th45: :: SCMPDS_5:45
for b1 being State of SCMPDS
for b2 being parahalting Instruction of SCMPDS holds Exec b2,(Initialized b1) = IExec (Load b2),b1
proof end;

theorem Th46: :: SCMPDS_5:46
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being parahalting No-StopCode Program-block
for b4 being shiftable parahalting Instruction of SCMPDS holds (IExec (b3 ';' b4),b2) . b1 = (Exec b4,(IExec b3,b2)) . b1
proof end;

theorem Th47: :: SCMPDS_5:47
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being No-StopCode parahalting Instruction of SCMPDS
for b4 being shiftable parahalting Instruction of SCMPDS holds (IExec (b3 ';' b4),b2) . b1 = (Exec b4,(Exec b3,(Initialized b2))) . b1
proof end;