:: SCMPDS_7 semantic presentation

set c1 = the Instruction-Locations of SCMPDS ;

set c2 = SCM-Data-Loc ;

theorem Th1: :: SCMPDS_7:1
for b1 being State of SCMPDS
for b2, b3 being Nat st IC b1 = inspos b2 holds
ICplusConst b1,(b3 - b2) = inspos b3
proof end;

theorem Th2: :: SCMPDS_7:2
for b1, b2 being FinPartState of SCMPDS st b1 c= b2 holds
ProgramPart b1 c= ProgramPart b2
proof end;

theorem Th3: :: SCMPDS_7:3
for b1, b2 being programmed FinPartState of SCMPDS
for b3 being Nat st b1 c= b2 holds
Shift b1,b3 c= Shift b2,b3
proof end;

theorem Th4: :: SCMPDS_7:4
for b1 being State of SCMPDS st IC b1 = inspos 0 holds
Initialized b1 = b1
proof end;

theorem Th5: :: SCMPDS_7:5
for b1 being State of SCMPDS
for b2 being Program-block st IC b1 = inspos 0 holds
b1 +* (Initialized b2) = b1 +* b2
proof end;

theorem Th6: :: SCMPDS_7:6
for b1 being Nat
for b2 being State of SCMPDS holds ((Computation b2) . b1) | the Instruction-Locations of SCMPDS = b2 | the Instruction-Locations of SCMPDS
proof end;

theorem Th7: :: SCMPDS_7:7
for b1, b2 being State of SCMPDS st IC b1 = IC b2 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc & b1 | the Instruction-Locations of SCMPDS = b2 | the Instruction-Locations of SCMPDS holds
b1 = b2
proof end;

theorem Th8: :: SCMPDS_7:8
for b1 being Instruction-Location of SCMPDS
for b2 being Program-block holds
( b1 in dom b2 iff b1 in dom (Initialized b2) )
proof end;

theorem Th9: :: SCMPDS_7:9
for b1 being set
for b2 being State of SCMPDS
for b3 being Instruction-Location of SCMPDS
for b4 being Program-block st b1 in dom b4 holds
b4 . b1 = (b2 +* (b4 +* (Start-At b3))) . b1
proof end;

theorem Th10: :: SCMPDS_7:10
for b1 being State of SCMPDS
for b2 being Instruction-Location of SCMPDS
for b3 being Program-block st b2 in dom b3 holds
(b1 +* (Initialized b3)) . b2 = b3 . b2
proof end;

theorem Th11: :: SCMPDS_7:11
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being Instruction-Location of SCMPDS
for b4 being Program-block holds (b2 +* (b4 +* (Start-At b3))) . b1 = b2 . b1
proof end;

theorem Th12: :: SCMPDS_7:12
for b1 being State of SCMPDS
for b2 being Instruction-Location of SCMPDS holds (b1 +* (Start-At b2)) . (IC SCMPDS ) = b2
proof end;

theorem Th13: :: SCMPDS_7:13
canceled;

theorem Th14: :: SCMPDS_7:14
for b1, b2 being Instruction of SCMPDS
for b3 being Program-block holds ((b3 ';' b1) ';' b2) . (inspos (card b3)) = b1
proof end;

theorem Th15: :: SCMPDS_7:15
for b1, b2, b3 being Instruction of SCMPDS
for b4 being Program-block holds ((b1 ';' b4) ';' b2) ';' b3 = b1 ';' ((b4 ';' b2) ';' b3)
proof end;

theorem Th16: :: SCMPDS_7:16
for b1, b2, b3 being Program-block holds Shift b1,(card b2) c= (b2 ';' b1) ';' b3
proof end;

theorem Th17: :: SCMPDS_7:17
for b1, b2 being Program-block holds b1 c= stop (b1 ';' b2)
proof end;

theorem Th18: :: SCMPDS_7:18
for b1 being Nat
for b2 being Instruction-Location of SCMPDS
for b3 being Program-block st b2 in dom b3 holds
(Shift (stop b3),b1) . (b2 + b1) = (Shift b3,b1) . (b2 + b1)
proof end;

theorem Th19: :: SCMPDS_7:19
for b1 being Nat
for b2 being Program-block st card b2 > 0 holds
(Shift (stop b2),b1) . (inspos b1) = (Shift b2,b1) . (inspos b1)
proof end;

theorem Th20: :: SCMPDS_7:20
for b1 being State of SCMPDS
for b2 being Instruction of SCMPDS st InsCode b2 in {0,4,5,6} holds
(Exec b2,b1) | SCM-Data-Loc = b1 | SCM-Data-Loc
proof end;

theorem Th21: :: SCMPDS_7:21
for b1, b2 being State of SCMPDS holds (b1 +* (b2 | the Instruction-Locations of SCMPDS )) | SCM-Data-Loc = b1 | SCM-Data-Loc
proof end;

theorem Th22: :: SCMPDS_7:22
for b1 being Instruction of SCMPDS holds rng (Load b1) = {b1}
proof end;

theorem Th23: :: SCMPDS_7:23
for b1 being Instruction of SCMPDS
for b2, b3 being State of SCMPDS st IC b2 = IC b3 & b2 | SCM-Data-Loc = b3 | SCM-Data-Loc holds
( IC (Exec b1,b2) = IC (Exec b1,b3) & (Exec b1,b2) | SCM-Data-Loc = (Exec b1,b3) | SCM-Data-Loc )
proof end;

theorem Th24: :: SCMPDS_7:24
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & Initialized (stop b3) c= b1 & Initialized (stop b3) c= b2 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
for b4 being Nat holds
( IC ((Computation b1) . b4) = IC ((Computation b2) . b4) & CurInstr ((Computation b1) . b4) = CurInstr ((Computation b2) . b4) & ((Computation b1) . b4) | SCM-Data-Loc = ((Computation b2) . b4) | SCM-Data-Loc )
proof end;

theorem Th25: :: SCMPDS_7:25
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
for b4 being Nat holds
( (Computation (b1 +* (Initialized (stop b3)))) . b4,(Computation (b2 +* (Initialized (stop b3)))) . b4 equal_outside the Instruction-Locations of SCMPDS & CurInstr ((Computation (b1 +* (Initialized (stop b3)))) . b4) = CurInstr ((Computation (b2 +* (Initialized (stop b3)))) . b4) )
proof end;

theorem Th26: :: SCMPDS_7:26
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & 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 Th27: :: SCMPDS_7:27
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & b3 is_halting_on b1 & Initialized (stop b3) c= b1 & Initialized (stop b3) c= b2 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
LifeSpan b1 = LifeSpan b2
proof end;

theorem Th28: :: SCMPDS_7:28
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & b3 is_halting_on b1 & 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 Th29: :: SCMPDS_7:29
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & b3 is_halting_on b1 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
( LifeSpan (b1 +* (Initialized (stop b3))) = LifeSpan (b2 +* (Initialized (stop b3))) & Result (b1 +* (Initialized (stop b3))), Result (b2 +* (Initialized (stop b3))) equal_outside the Instruction-Locations of SCMPDS )
proof end;

theorem Th30: :: SCMPDS_7:30
for b1, b2 being State of SCMPDS
for b3 being Program-block st b3 is_closed_on b1 & b3 is_halting_on b1 & Initialized (stop b3) c= b1 & Initialized (stop b3) c= b2 & ex b4 being Nat st (Computation b1) . b4,b2 equal_outside the Instruction-Locations of SCMPDS holds
Result b1, Result b2 equal_outside the Instruction-Locations of SCMPDS
proof end;

registration
let c3 be Program-block;
cluster Initialized a1 -> initial ;
correctness
coherence
Initialized c3 is initial
;
proof end;
end;

theorem Th31: :: SCMPDS_7:31
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Int_position st b2 is_halting_on b1 holds
(IExec b2,b1) . b3 = ((Computation (b1 +* (Initialized (stop b2)))) . (LifeSpan (b1 +* (Initialized (stop b2))))) . b3
proof end;

theorem Th32: :: SCMPDS_7:32
for b1 being State of SCMPDS
for b2 being parahalting Program-block
for b3 being Int_position holds (IExec b2,b1) . b3 = ((Computation (b1 +* (Initialized (stop b2)))) . (LifeSpan (b1 +* (Initialized (stop b2))))) . b3
proof end;

theorem Th33: :: SCMPDS_7:33
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Nat st Initialized (stop b2) c= b1 & b2 is_closed_on b1 & b2 is_halting_on b1 & b3 < LifeSpan b1 holds
IC ((Computation b1) . b3) in dom b2
proof end;

theorem Th34: :: SCMPDS_7:34
for b1, b2 being State of SCMPDS
for b3 being shiftable Program-block st Initialized (stop b3) c= b1 & b3 is_closed_on b1 & b3 is_halting_on b1 holds
for b4 being Nat st Shift b3,b4 c= b2 & card b3 > 0 & IC b2 = inspos b4 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
for b5 being Nat st b5 < LifeSpan b1 holds
( (IC ((Computation b1) . b5)) + b4 = IC ((Computation b2) . b5) & CurInstr ((Computation b1) . b5) = CurInstr ((Computation b2) . b5) & ((Computation b1) . b5) | SCM-Data-Loc = ((Computation b2) . b5) | SCM-Data-Loc )
proof end;

theorem Th35: :: SCMPDS_7:35
for b1 being State of SCMPDS
for b2 being No-StopCode Program-block st Initialized (stop b2) c= b1 & b2 is_halting_on b1 & card b2 > 0 holds
LifeSpan b1 > 0
proof end;

theorem Th36: :: SCMPDS_7:36
for b1, b2 being State of SCMPDS
for b3 being shiftable No-StopCode Program-block st Initialized (stop b3) c= b1 & b3 is_closed_on b1 & b3 is_halting_on b1 holds
for b4 being Nat st Shift b3,b4 c= b2 & card b3 > 0 & IC b2 = inspos b4 & b1 | SCM-Data-Loc = b2 | SCM-Data-Loc holds
( IC ((Computation b2) . (LifeSpan b1)) = inspos ((card b3) + b4) & ((Computation b1) . (LifeSpan b1)) | SCM-Data-Loc = ((Computation b2) . (LifeSpan b1)) | SCM-Data-Loc )
proof end;

theorem Th37: :: SCMPDS_7:37
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Nat st IC ((Computation (b1 +* (Initialized b2))) . b3) = inspos 0 holds
((Computation (b1 +* (Initialized b2))) . b3) +* (Initialized b2) = (Computation (b1 +* (Initialized b2))) . b3
proof end;

theorem Th38: :: SCMPDS_7:38
for b1 being State of SCMPDS
for b2, b3 being Program-block
for b4 being Nat st b2 is_closed_on b1 & b2 is_halting_on b1 & 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 Th39: :: SCMPDS_7:39
for b1 being State of SCMPDS
for b2, b3 being Program-block
for b4 being Nat st b2 c= b3 & b2 is_closed_on b1 & b2 is_halting_on b1 & b4 <= LifeSpan (b1 +* (Initialized (stop b2))) holds
(Computation (b1 +* (Initialized b3))) . b4,(Computation (b1 +* (Initialized (stop b2)))) . b4 equal_outside the Instruction-Locations of SCMPDS
proof end;

theorem Th40: :: SCMPDS_7:40
for b1 being State of SCMPDS
for b2, b3 being Program-block
for b4 being Nat st b4 <= LifeSpan (b1 +* (Initialized (stop b2))) & b2 c= b3 & b2 is_closed_on b1 & b2 is_halting_on b1 holds
IC ((Computation (b1 +* (Initialized b3))) . b4) in dom (stop b2)
proof end;

theorem Th41: :: SCMPDS_7:41
for b1 being State of SCMPDS
for b2, b3 being Program-block st b2 c= b3 & b2 is_closed_on b1 & b2 is_halting_on b1 & not CurInstr ((Computation (b1 +* (Initialized b3))) . (LifeSpan (b1 +* (Initialized (stop b2))))) = halt SCMPDS holds
IC ((Computation (b1 +* (Initialized b3))) . (LifeSpan (b1 +* (Initialized (stop b2))))) = inspos (card b2)
proof end;

theorem Th42: :: SCMPDS_7:42
for b1 being State of SCMPDS
for b2, b3 being Program-block st b2 is_halting_on b1 & b3 is_closed_on IExec b2,b1 & b3 is_halting_on IExec b2,b1 holds
( b3 is_closed_on (Computation (b1 +* (Initialized (stop b2)))) . (LifeSpan (b1 +* (Initialized (stop b2)))) & b3 is_halting_on (Computation (b1 +* (Initialized (stop b2)))) . (LifeSpan (b1 +* (Initialized (stop b2)))) )
proof end;

theorem Th43: :: SCMPDS_7:43
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being shiftable Program-block st b2 is_closed_on b1 & b2 is_halting_on b1 & b3 is_closed_on IExec b2,b1 & b3 is_halting_on IExec b2,b1 holds
( b2 ';' b3 is_closed_on b1 & b2 ';' b3 is_halting_on b1 )
proof end;

theorem Th44: :: SCMPDS_7:44
for b1 being State of SCMPDS
for b2 being No-StopCode Program-block
for b3 being Program-block st b2 c= b3 & b2 is_closed_on b1 & b2 is_halting_on b1 holds
IC ((Computation (b1 +* (Initialized b3))) . (LifeSpan (b1 +* (Initialized (stop b2))))) = inspos (card b2)
proof end;

theorem Th45: :: SCMPDS_7:45
for b1 being Program-block
for b2 being State of SCMPDS
for b3 being Nat st b1 is_halting_on b2 & b3 < LifeSpan (b2 +* (Initialized (stop b1))) holds
CurInstr ((Computation (b2 +* (Initialized (stop b1)))) . b3) <> halt SCMPDS
proof end;

theorem Th46: :: SCMPDS_7:46
for b1, b2 being Program-block
for b3 being State of SCMPDS
for b4 being Nat st b1 is_closed_on b3 & b1 is_halting_on b3 & b4 < LifeSpan (b3 +* (Initialized (stop b1))) holds
CurInstr ((Computation (b3 +* (Initialized (stop (b1 ';' b2))))) . b4) <> halt SCMPDS
proof end;

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

theorem Th47: :: SCMPDS_7:47
for b1 being State of SCMPDS
for b2 being No-StopCode Program-block
for b3 being shiftable Program-block st b2 is_closed_on b1 & b2 is_halting_on b1 & b3 is_closed_on IExec b2,b1 & b3 is_halting_on IExec b2,b1 holds
LifeSpan (b1 +* (Initialized (stop (b2 ';' b3)))) = (LifeSpan (b1 +* (Initialized (stop b2)))) + (LifeSpan ((Result (b1 +* (Initialized (stop b2)))) +* (Initialized (stop b3)))) by Lemma35;

theorem Th48: :: SCMPDS_7:48
for b1 being State of SCMPDS
for b2 being No-StopCode Program-block
for b3 being shiftable Program-block st b2 is_closed_on b1 & b2 is_halting_on b1 & b3 is_closed_on IExec b2,b1 & b3 is_halting_on IExec b2,b1 holds
IExec (b2 ';' b3),b1 = (IExec b3,(IExec b2,b1)) +* (Start-At ((IC (IExec b3,(IExec b2,b1))) + (card b2)))
proof end;

theorem Th49: :: SCMPDS_7:49
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being No-StopCode Program-block
for b4 being shiftable Program-block st b3 is_closed_on b2 & b3 is_halting_on b2 & b4 is_closed_on IExec b3,b2 & b4 is_halting_on IExec b3,b2 holds
(IExec (b3 ';' b4),b2) . b1 = (IExec b4,(IExec b3,b2)) . b1
proof end;

theorem Th50: :: SCMPDS_7:50
for b1 being Int_position
for b2 being State of SCMPDS
for b3 being No-StopCode Program-block
for b4 being shiftable parahalting Instruction of SCMPDS st b3 is_closed_on b2 & b3 is_halting_on b2 holds
(IExec (b3 ';' b4),b2) . b1 = (Exec b4,(IExec b3,b2)) . b1
proof end;

definition
let c3 be Int_position ;
let c4 be Integer;
let c5 be Nat;
let c6 be Program-block;
func for-up c1,c2,c3,c4 -> Program-block equals :: SCMPDS_7:def 1
(((a1,a2 >=0_goto ((card a4) + 3)) ';' a4) ';' (AddTo a1,a2,a3)) ';' (goto (- ((card a4) + 2)));
coherence
(((c3,c4 >=0_goto ((card c6) + 3)) ';' c6) ';' (AddTo c3,c4,c5)) ';' (goto (- ((card c6) + 2))) is Program-block
;
end;

:: deftheorem Def1 defines for-up SCMPDS_7:def 1 :
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds for-up b1,b2,b3,b4 = (((b1,b2 >=0_goto ((card b4) + 3)) ';' b4) ';' (AddTo b1,b2,b3)) ';' (goto (- ((card b4) + 2)));

theorem Th51: :: SCMPDS_7:51
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds card (for-up b1,b2,b3,b4) = (card b4) + 3
proof end;

Lemma40: for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds card (stop (for-up b1,b2,b3,b4)) = (card b4) + 4
proof end;

theorem Th52: :: SCMPDS_7:52
for b1 being Int_position
for b2 being Integer
for b3, b4 being Nat
for b5 being Program-block holds
( b4 < (card b5) + 3 iff inspos b4 in dom (for-up b1,b2,b3,b5) )
proof end;

theorem Th53: :: SCMPDS_7:53
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds
( (for-up b1,b2,b3,b4) . (inspos 0) = b1,b2 >=0_goto ((card b4) + 3) & (for-up b1,b2,b3,b4) . (inspos ((card b4) + 1)) = AddTo b1,b2,b3 & (for-up b1,b2,b3,b4) . (inspos ((card b4) + 2)) = goto (- ((card b4) + 2)) )
proof end;

Lemma43: for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds for-up b1,b2,b3,b4 = (b1,b2 >=0_goto ((card b4) + 3)) ';' ((b4 ';' (AddTo b1,b2,b3)) ';' (goto (- ((card b4) + 2))))
by Th15;

theorem Th54: :: SCMPDS_7:54
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat st b1 . (DataLoc (b1 . b3),b4) >= 0 holds
( for-up b3,b4,b5,b2 is_closed_on b1 & for-up b3,b4,b5,b2 is_halting_on b1 )
proof end;

theorem Th55: :: SCMPDS_7:55
for b1 being State of SCMPDS
for b2 being Program-block
for b3, b4 being Int_position
for b5 being Integer
for b6 being Nat st b1 . (DataLoc (b1 . b3),b5) >= 0 holds
IExec (for-up b3,b5,b6,b2),b1 = b1 +* (Start-At (inspos ((card b2) + 3)))
proof end;

theorem Th56: :: SCMPDS_7:56
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat st b1 . (DataLoc (b1 . b3),b4) >= 0 holds
IC (IExec (for-up b3,b4,b5,b2),b1) = inspos ((card b2) + 3)
proof end;

theorem Th57: :: SCMPDS_7:57
for b1 being State of SCMPDS
for b2 being Program-block
for b3, b4 being Int_position
for b5 being Integer
for b6 being Nat st b1 . (DataLoc (b1 . b3),b5) >= 0 holds
(IExec (for-up b3,b5,b6,b2),b1) . b4 = b1 . b4
proof end;

Lemma46: for b1 being Program-block
for b2 being Int_position
for b3 being Integer
for b4 being Nat holds Shift b1,1 c= for-up b2,b3,b4,b1
proof end;

theorem Th58: :: SCMPDS_7:58
for b1 being State of SCMPDS
for b2 being shiftable No-StopCode Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat
for b6 being set st b1 . (DataLoc (b1 . b3),b4) < 0 & not DataLoc (b1 . b3),b4 in b6 & b5 > 0 & card b2 > 0 & b3 <> DataLoc (b1 . b3),b4 & ( for b7 being State of SCMPDS st ( for b8 being Int_position st b8 in b6 holds
b7 . b8 = b1 . b8 ) & b7 . b3 = b1 . b3 holds
( (IExec b2,b7) . b3 = b7 . b3 & (IExec b2,b7) . (DataLoc (b1 . b3),b4) = b7 . (DataLoc (b1 . b3),b4) & b2 is_closed_on b7 & b2 is_halting_on b7 & ( for b8 being Int_position st b8 in b6 holds
(IExec b2,b7) . b8 = b7 . b8 ) ) ) holds
( for-up b3,b4,b5,b2 is_closed_on b1 & for-up b3,b4,b5,b2 is_halting_on b1 )
proof end;

theorem Th59: :: SCMPDS_7:59
for b1 being State of SCMPDS
for b2 being shiftable No-StopCode Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat
for b6 being set st b1 . (DataLoc (b1 . b3),b4) < 0 & not DataLoc (b1 . b3),b4 in b6 & b5 > 0 & card b2 > 0 & b3 <> DataLoc (b1 . b3),b4 & ( for b7 being State of SCMPDS st ( for b8 being Int_position st b8 in b6 holds
b7 . b8 = b1 . b8 ) & b7 . b3 = b1 . b3 holds
( (IExec b2,b7) . b3 = b7 . b3 & (IExec b2,b7) . (DataLoc (b1 . b3),b4) = b7 . (DataLoc (b1 . b3),b4) & b2 is_closed_on b7 & b2 is_halting_on b7 & ( for b8 being Int_position st b8 in b6 holds
(IExec b2,b7) . b8 = b7 . b8 ) ) ) holds
IExec (for-up b3,b4,b5,b2),b1 = IExec (for-up b3,b4,b5,b2),(IExec (b2 ';' (AddTo b3,b4,b5)),b1)
proof end;

registration
let c3 be shiftable Program-block;
let c4 be Int_position ;
let c5 be Integer;
let c6 be Nat;
cluster for-up a2,a3,a4,a1 -> shiftable ;
correctness
coherence
for-up c4,c5,c6,c3 is shiftable
;
proof end;
end;

registration
let c3 be No-StopCode Program-block;
let c4 be Int_position ;
let c5 be Integer;
let c6 be Nat;
cluster for-up a2,a3,a4,a1 -> No-StopCode ;
correctness
coherence
for-up c4,c5,c6,c3 is No-StopCode
;
proof end;
end;

definition
let c3 be Int_position ;
let c4 be Integer;
let c5 be Nat;
let c6 be Program-block;
func for-down c1,c2,c3,c4 -> Program-block equals :: SCMPDS_7:def 2
(((a1,a2 <=0_goto ((card a4) + 3)) ';' a4) ';' (AddTo a1,a2,(- a3))) ';' (goto (- ((card a4) + 2)));
coherence
(((c3,c4 <=0_goto ((card c6) + 3)) ';' c6) ';' (AddTo c3,c4,(- c5))) ';' (goto (- ((card c6) + 2))) is Program-block
;
end;

:: deftheorem Def2 defines for-down SCMPDS_7:def 2 :
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds for-down b1,b2,b3,b4 = (((b1,b2 <=0_goto ((card b4) + 3)) ';' b4) ';' (AddTo b1,b2,(- b3))) ';' (goto (- ((card b4) + 2)));

theorem Th60: :: SCMPDS_7:60
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds card (for-down b1,b2,b3,b4) = (card b4) + 3
proof end;

Lemma49: for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds card (stop (for-down b1,b2,b3,b4)) = (card b4) + 4
proof end;

theorem Th61: :: SCMPDS_7:61
for b1 being Int_position
for b2 being Integer
for b3, b4 being Nat
for b5 being Program-block holds
( b4 < (card b5) + 3 iff inspos b4 in dom (for-down b1,b2,b3,b5) )
proof end;

theorem Th62: :: SCMPDS_7:62
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds
( (for-down b1,b2,b3,b4) . (inspos 0) = b1,b2 <=0_goto ((card b4) + 3) & (for-down b1,b2,b3,b4) . (inspos ((card b4) + 1)) = AddTo b1,b2,(- b3) & (for-down b1,b2,b3,b4) . (inspos ((card b4) + 2)) = goto (- ((card b4) + 2)) )
proof end;

Lemma52: for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds for-down b1,b2,b3,b4 = (b1,b2 <=0_goto ((card b4) + 3)) ';' ((b4 ';' (AddTo b1,b2,(- b3))) ';' (goto (- ((card b4) + 2))))
by Th15;

theorem Th63: :: SCMPDS_7:63
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat st b1 . (DataLoc (b1 . b3),b4) <= 0 holds
( for-down b3,b4,b5,b2 is_closed_on b1 & for-down b3,b4,b5,b2 is_halting_on b1 )
proof end;

theorem Th64: :: SCMPDS_7:64
for b1 being State of SCMPDS
for b2 being Program-block
for b3, b4 being Int_position
for b5 being Integer
for b6 being Nat st b1 . (DataLoc (b1 . b3),b5) <= 0 holds
IExec (for-down b3,b5,b6,b2),b1 = b1 +* (Start-At (inspos ((card b2) + 3)))
proof end;

theorem Th65: :: SCMPDS_7:65
for b1 being State of SCMPDS
for b2 being Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat st b1 . (DataLoc (b1 . b3),b4) <= 0 holds
IC (IExec (for-down b3,b4,b5,b2),b1) = inspos ((card b2) + 3)
proof end;

theorem Th66: :: SCMPDS_7:66
for b1 being State of SCMPDS
for b2 being Program-block
for b3, b4 being Int_position
for b5 being Integer
for b6 being Nat st b1 . (DataLoc (b1 . b3),b5) <= 0 holds
(IExec (for-down b3,b5,b6,b2),b1) . b4 = b1 . b4
proof end;

Lemma56: for b1 being Program-block
for b2 being Int_position
for b3 being Integer
for b4 being Nat holds Shift b1,1 c= for-down b2,b3,b4,b1
proof end;

theorem Th67: :: SCMPDS_7:67
for b1 being State of SCMPDS
for b2 being shiftable No-StopCode Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat
for b6 being set st b1 . (DataLoc (b1 . b3),b4) > 0 & not DataLoc (b1 . b3),b4 in b6 & b5 > 0 & card b2 > 0 & b3 <> DataLoc (b1 . b3),b4 & ( for b7 being State of SCMPDS st ( for b8 being Int_position st b8 in b6 holds
b7 . b8 = b1 . b8 ) & b7 . b3 = b1 . b3 holds
( (IExec b2,b7) . b3 = b7 . b3 & (IExec b2,b7) . (DataLoc (b1 . b3),b4) = b7 . (DataLoc (b1 . b3),b4) & b2 is_closed_on b7 & b2 is_halting_on b7 & ( for b8 being Int_position st b8 in b6 holds
(IExec b2,b7) . b8 = b7 . b8 ) ) ) holds
( for-down b3,b4,b5,b2 is_closed_on b1 & for-down b3,b4,b5,b2 is_halting_on b1 )
proof end;

theorem Th68: :: SCMPDS_7:68
for b1 being State of SCMPDS
for b2 being shiftable No-StopCode Program-block
for b3 being Int_position
for b4 being Integer
for b5 being Nat
for b6 being set st b1 . (DataLoc (b1 . b3),b4) > 0 & not DataLoc (b1 . b3),b4 in b6 & b5 > 0 & card b2 > 0 & b3 <> DataLoc (b1 . b3),b4 & ( for b7 being State of SCMPDS st ( for b8 being Int_position st b8 in b6 holds
b7 . b8 = b1 . b8 ) & b7 . b3 = b1 . b3 holds
( (IExec b2,b7) . b3 = b7 . b3 & (IExec b2,b7) . (DataLoc (b1 . b3),b4) = b7 . (DataLoc (b1 . b3),b4) & b2 is_closed_on b7 & b2 is_halting_on b7 & ( for b8 being Int_position st b8 in b6 holds
(IExec b2,b7) . b8 = b7 . b8 ) ) ) holds
IExec (for-down b3,b4,b5,b2),b1 = IExec (for-down b3,b4,b5,b2),(IExec (b2 ';' (AddTo b3,b4,(- b5))),b1)
proof end;

registration
let c3 be shiftable Program-block;
let c4 be Int_position ;
let c5 be Integer;
let c6 be Nat;
cluster for-down a2,a3,a4,a1 -> shiftable ;
correctness
coherence
for-down c4,c5,c6,c3 is shiftable
;
proof end;
end;

registration
let c3 be No-StopCode Program-block;
let c4 be Int_position ;
let c5 be Integer;
let c6 be Nat;
cluster for-down a2,a3,a4,a1 -> No-StopCode ;
correctness
coherence
for-down c4,c5,c6,c3 is No-StopCode
;
proof end;
end;

definition
let c3 be Nat;
func sum c1 -> Program-block equals :: SCMPDS_7:def 3
(((GBP := 0) ';' (GBP ,2 := a1)) ';' (GBP ,3 := 0)) ';' (for-down GBP ,2,1,(Load (AddTo GBP ,3,1)));
coherence
(((GBP := 0) ';' (GBP ,2 := c3)) ';' (GBP ,3 := 0)) ';' (for-down GBP ,2,1,(Load (AddTo GBP ,3,1))) is Program-block
;
end;

:: deftheorem Def3 defines sum SCMPDS_7:def 3 :
for b1 being Nat holds sum b1 = (((GBP := 0) ';' (GBP ,2 := b1)) ';' (GBP ,3 := 0)) ';' (for-down GBP ,2,1,(Load (AddTo GBP ,3,1)));

theorem Th69: :: SCMPDS_7:69
for b1 being State of SCMPDS st b1 . GBP = 0 holds
( for-down GBP ,2,1,(Load (AddTo GBP ,3,1)) is_closed_on b1 & for-down GBP ,2,1,(Load (AddTo GBP ,3,1)) is_halting_on b1 )
proof end;

theorem Th70: :: SCMPDS_7:70
for b1 being State of SCMPDS
for b2 being Nat st b1 . GBP = 0 & b1 . (intpos 2) = b2 & b1 . (intpos 3) = 0 holds
(IExec (for-down GBP ,2,1,(Load (AddTo GBP ,3,1))),b1) . (intpos 3) = b2
proof end;

theorem Th71: :: SCMPDS_7:71
for b1 being State of SCMPDS
for b2 being Nat holds (IExec (sum b2),b1) . (intpos 3) = b2
proof end;

definition
let c3, c4, c5, c6, c7 be Nat;
func sum c1,c2,c3,c4,c5 -> Program-block equals :: SCMPDS_7:def 4
(((intpos a1),a3 := 0) ';' ((intpos a4) := a5)) ';' (for-down (intpos a1),a2,1,((AddTo (intpos a1),a3,(intpos a5),0) ';' (AddTo (intpos a4),0,1)));
coherence
(((intpos c3),c5 := 0) ';' ((intpos c6) := c7)) ';' (for-down (intpos c3),c4,1,((AddTo (intpos c3),c5,(intpos c7),0) ';' (AddTo (intpos c6),0,1))) is Program-block
;
end;

:: deftheorem Def4 defines sum SCMPDS_7:def 4 :
for b1, b2, b3, b4, b5 being Nat holds sum b1,b2,b3,b4,b5 = (((intpos b1),b3 := 0) ';' ((intpos b4) := b5)) ';' (for-down (intpos b1),b2,1,((AddTo (intpos b1),b3,(intpos b5),0) ';' (AddTo (intpos b4),0,1)));

theorem Th72: :: SCMPDS_7:72
for b1 being State of SCMPDS
for b2, b3, b4, b5, b6 being Nat st b1 . (intpos b2) > b2 & b3 < b4 & b1 . (intpos b5) = b6 & (b1 . (intpos b2)) + b4 < b5 & b5 < b6 & b6 < b1 . (intpos b6) holds
( for-down (intpos b2),b3,1,((AddTo (intpos b2),b4,(intpos b6),0) ';' (AddTo (intpos b5),0,1)) is_closed_on b1 & for-down (intpos b2),b3,1,((AddTo (intpos b2),b4,(intpos b6),0) ';' (AddTo (intpos b5),0,1)) is_halting_on b1 )
proof end;

theorem Th73: :: SCMPDS_7:73
for b1 being State of SCMPDS
for b2, b3, b4, b5, b6 being Nat
for b7 being FinSequence of NAT st b1 . (intpos b2) > b2 & b3 < b4 & b1 . (intpos b5) = b6 & (b1 . (intpos b2)) + b4 < b5 & b5 < b6 & b6 < b1 . (intpos b6) & b1 . (DataLoc (b1 . (intpos b2)),b4) = 0 & len b7 = b1 . (DataLoc (b1 . (intpos b2)),b3) & ( for b8 being Nat st b8 < len b7 holds
b7 . (b8 + 1) = b1 . (DataLoc (b1 . (intpos b6)),b8) ) holds
(IExec (for-down (intpos b2),b3,1,((AddTo (intpos b2),b4,(intpos b6),0) ';' (AddTo (intpos b5),0,1))),b1) . (DataLoc (b1 . (intpos b2)),b4) = Sum b7
proof end;

theorem Th74: :: SCMPDS_7:74
for b1 being State of SCMPDS
for b2, b3, b4, b5, b6 being Nat
for b7 being FinSequence of NAT st b1 . (intpos b2) > b2 & b3 < b4 & (b1 . (intpos b2)) + b4 < b5 & b5 < b6 & b6 < b1 . (intpos b6) & len b7 = b1 . (DataLoc (b1 . (intpos b2)),b3) & ( for b8 being Nat st b8 < len b7 holds
b7 . (b8 + 1) = b1 . (DataLoc (b1 . (intpos b6)),b8) ) holds
(IExec (sum b2,b3,b4,b5,b6),b1) . (DataLoc (b1 . (intpos b2)),b4) = Sum b7
proof end;