:: SCMP_GCD semantic presentation
theorem Th1: :: SCMP_GCD:1
theorem Th2: :: SCMP_GCD:2
theorem Th3: :: SCMP_GCD:3
:: deftheorem Def1 defines intpos SCMP_GCD:def 1 :
theorem Th4: :: SCMP_GCD:4
theorem Th5: :: SCMP_GCD:5
theorem Th6: :: SCMP_GCD:6
:: deftheorem Def2 defines GBP SCMP_GCD:def 2 :
:: deftheorem Def3 defines SBP SCMP_GCD:def 3 :
theorem Th7: :: SCMP_GCD:7
theorem Th8: :: SCMP_GCD:8
theorem Th9: :: SCMP_GCD:9
theorem Th10: :: SCMP_GCD:10
theorem Th11: :: SCMP_GCD:11
definition
func GCD-Algorithm -> Program-block equals :: SCMP_GCD:def 4
((((((((((((((GBP := 0) ';' (SBP := 7)) ';' (saveIC SBP ,RetIC )) ';' (goto 2)) ';' (halt SCMPDS )) ';' (SBP ,3 <=0_goto 9)) ';' (SBP ,6 := SBP ,3)) ';' (Divide SBP ,2,SBP ,3)) ';' (SBP ,7 := SBP ,3)) ';' (SBP ,(4 + RetSP ) := GBP ,1)) ';' (AddTo GBP ,1,4)) ';' (saveIC SBP ,RetIC )) ';' (goto (- 7))) ';' (SBP ,2 := SBP ,6)) ';' (return SBP );
coherence
((((((((((((((GBP := 0) ';' (SBP := 7)) ';' (saveIC SBP ,RetIC )) ';' (goto 2)) ';' (halt SCMPDS )) ';' (SBP ,3 <=0_goto 9)) ';' (SBP ,6 := SBP ,3)) ';' (Divide SBP ,2,SBP ,3)) ';' (SBP ,7 := SBP ,3)) ';' (SBP ,(4 + RetSP ) := GBP ,1)) ';' (AddTo GBP ,1,4)) ';' (saveIC SBP ,RetIC )) ';' (goto (- 7))) ';' (SBP ,2 := SBP ,6)) ';' (return SBP ) is Program-block
;
end;
:: deftheorem Def4 defines GCD-Algorithm SCMP_GCD:def 4 :
GCD-Algorithm = ((((((((((((((GBP := 0) ';' (SBP := 7)) ';' (saveIC SBP ,RetIC )) ';' (goto 2)) ';' (halt SCMPDS )) ';' (SBP ,3 <=0_goto 9)) ';' (SBP ,6 := SBP ,3)) ';' (Divide SBP ,2,SBP ,3)) ';' (SBP ,7 := SBP ,3)) ';' (SBP ,(4 + RetSP ) := GBP ,1)) ';' (AddTo GBP ,1,4)) ';' (saveIC SBP ,RetIC )) ';' (goto (- 7))) ';' (SBP ,2 := SBP ,6)) ';' (return SBP );
set c1 = GBP := 0;
set c2 = SBP := 7;
set c3 = saveIC SBP ,RetIC ;
set c4 = goto 2;
set c5 = halt SCMPDS ;
set c6 = SBP ,3 <=0_goto 9;
set c7 = SBP ,6 := SBP ,3;
set c8 = Divide SBP ,2,SBP ,3;
set c9 = SBP ,7 := SBP ,3;
set c10 = SBP ,(4 + RetSP ) := GBP ,1;
set c11 = AddTo GBP ,1,4;
set c12 = saveIC SBP ,RetIC ;
set c13 = goto (- 7);
set c14 = SBP ,2 := SBP ,6;
set c15 = return SBP ;
theorem Th12: :: SCMP_GCD:12
theorem Th13: :: SCMP_GCD:13
theorem Th14: :: SCMP_GCD:14
(
GCD-Algorithm . (inspos 0) = GBP := 0 &
GCD-Algorithm . (inspos 1) = SBP := 7 &
GCD-Algorithm . (inspos 2) = saveIC SBP ,
RetIC &
GCD-Algorithm . (inspos 3) = goto 2 &
GCD-Algorithm . (inspos 4) = halt SCMPDS &
GCD-Algorithm . (inspos 5) = SBP ,3
<=0_goto 9 &
GCD-Algorithm . (inspos 6) = SBP ,6
:= SBP ,3 &
GCD-Algorithm . (inspos 7) = Divide SBP ,2,
SBP ,3 &
GCD-Algorithm . (inspos 8) = SBP ,7
:= SBP ,3 &
GCD-Algorithm . (inspos 9) = SBP ,
(4 + RetSP ) := GBP ,1 &
GCD-Algorithm . (inspos 10) = AddTo GBP ,1,4 &
GCD-Algorithm . (inspos 11) = saveIC SBP ,
RetIC &
GCD-Algorithm . (inspos 12) = goto (- 7) &
GCD-Algorithm . (inspos 13) = SBP ,2
:= SBP ,6 &
GCD-Algorithm . (inspos 14) = return SBP )
Lemma14:
for b1 being State of SCMPDS st GCD-Algorithm c= b1 holds
( b1 . (inspos 0) = GBP := 0 & b1 . (inspos 1) = SBP := 7 & b1 . (inspos 2) = saveIC SBP ,RetIC & b1 . (inspos 3) = goto 2 & b1 . (inspos 4) = halt SCMPDS & b1 . (inspos 5) = SBP ,3 <=0_goto 9 & b1 . (inspos 6) = SBP ,6 := SBP ,3 & b1 . (inspos 7) = Divide SBP ,2,SBP ,3 & b1 . (inspos 8) = SBP ,7 := SBP ,3 & b1 . (inspos 9) = SBP ,(4 + RetSP ) := GBP ,1 & b1 . (inspos 10) = AddTo GBP ,1,4 & b1 . (inspos 11) = saveIC SBP ,RetIC & b1 . (inspos 12) = goto (- 7) & b1 . (inspos 13) = SBP ,2 := SBP ,6 & b1 . (inspos 14) = return SBP )
theorem Th15: :: SCMP_GCD:15
Lemma16:
for b1, b2 being Nat st b1 > 0 holds
GBP <> intpos (b2 + b1)
Lemma17:
for b1, b2 being Nat st b1 > 1 holds
SBP <> intpos (b2 + b1)
Lemma18:
for b1 being Nat
for b2 being State of SCMPDS st GCD-Algorithm c= b2 & IC b2 = inspos 5 & b1 = b2 . SBP & b2 . GBP = 0 & b2 . (DataLoc (b2 . SBP ),3) > 0 holds
( IC ((Computation b2) . 7) = inspos (5 + 7) & (Computation b2) . 8 = Exec (goto (- 7)),((Computation b2) . 7) & ((Computation b2) . 7) . SBP = b1 + 4 & ((Computation b2) . 7) . GBP = 0 & ((Computation b2) . 7) . (intpos (b1 + 7)) = (b2 . (DataLoc (b2 . SBP ),2)) mod (b2 . (DataLoc (b2 . SBP ),3)) & ((Computation b2) . 7) . (intpos (b1 + 6)) = b2 . (DataLoc (b2 . SBP ),3) & ((Computation b2) . 7) . (intpos (b1 + 4)) = b1 & ((Computation b2) . 7) . (intpos (b1 + 5)) = inspos 11 )
Lemma19:
for b1, b2 being Nat
for b3 being State of SCMPDS st GCD-Algorithm c= b3 & IC b3 = inspos 5 & b1 = b3 . SBP & b3 . GBP = 0 & b3 . (DataLoc (b3 . SBP ),3) > 0 & 1 < b2 & b2 <= b1 + 1 holds
((Computation b3) . 7) . (intpos b2) = b3 . (intpos b2)
theorem Th16: :: SCMP_GCD:16
theorem Th17: :: SCMP_GCD:17
theorem Th18: :: SCMP_GCD:18
Lemma22:
for b1 being Nat
for b2, b3 being State of SCMPDS st GCD-Algorithm c= b2 & GCD-Algorithm c= b3 & IC b2 = inspos 5 & b1 = b2 . SBP & b2 . GBP = 0 & b2 . (DataLoc (b2 . SBP ),3) > 0 & IC b3 = IC b2 & b3 . SBP = b2 . SBP & b3 . GBP = 0 & b3 . (DataLoc (b2 . SBP ),2) = b2 . (DataLoc (b2 . SBP ),2) & b3 . (DataLoc (b2 . SBP ),3) = b2 . (DataLoc (b2 . SBP ),3) holds
( IC ((Computation b2) . 7) = inspos (5 + 7) & (Computation b2) . 8 = Exec (goto (- 7)),((Computation b2) . 7) & ((Computation b2) . 7) . SBP = b1 + 4 & ((Computation b2) . 7) . GBP = 0 & ((Computation b2) . 7) . (intpos (b1 + 7)) = (b2 . (intpos (b1 + 2))) mod (b2 . (intpos (b1 + 3))) & ((Computation b2) . 7) . (intpos (b1 + 6)) = b2 . (intpos (b1 + 3)) & IC ((Computation b3) . 7) = inspos (5 + 7) & (Computation b3) . 8 = Exec (goto (- 7)),((Computation b3) . 7) & ((Computation b3) . 7) . SBP = b1 + 4 & ((Computation b3) . 7) . GBP = 0 & ((Computation b3) . 7) . (intpos (b1 + 7)) = (b2 . (intpos (b1 + 2))) mod (b2 . (intpos (b1 + 3))) & ((Computation b3) . 7) . (intpos (b1 + 6)) = b2 . (intpos (b1 + 3)) & ((Computation b2) . 7) . (intpos (b1 + 4)) = b1 & ((Computation b2) . 7) . (intpos (b1 + 5)) = inspos 11 & ((Computation b3) . 7) . (intpos (b1 + 4)) = b1 & ((Computation b3) . 7) . (intpos (b1 + 5)) = inspos 11 )
Lemma23:
for b1 being Nat
for b2, b3 being State of SCMPDS st GCD-Algorithm c= b2 & GCD-Algorithm c= b3 & IC b2 = inspos 5 & b1 = b2 . SBP & b2 . GBP = 0 & b2 . (DataLoc (b2 . SBP ),3) > 0 & IC b3 = IC b2 & b3 . SBP = b2 . SBP & b3 . GBP = 0 & b3 . (DataLoc (b2 . SBP ),2) = b2 . (DataLoc (b2 . SBP ),2) & b3 . (DataLoc (b2 . SBP ),3) = b2 . (DataLoc (b2 . SBP ),3) holds
for b4 being Nat
for b5 being Int_position st b4 <= 7 & b2 . b5 = b3 . b5 holds
( IC ((Computation b2) . b4) = IC ((Computation b3) . b4) & ((Computation b2) . b4) . b5 = ((Computation b3) . b4) . b5 )
Lemma24:
for b1, b2 being State of SCMPDS st GCD-Algorithm c= b1 & GCD-Algorithm c= b2 & IC b1 = inspos 5 & b1 . SBP > 0 & b1 . GBP = 0 & b1 . (DataLoc (b1 . SBP ),3) >= 0 & b1 . (DataLoc (b1 . SBP ),2) >= b1 . (DataLoc (b1 . SBP ),3) & IC b2 = IC b1 & b2 . SBP = b1 . SBP & b2 . GBP = 0 & b2 . (DataLoc (b1 . SBP ),2) = b1 . (DataLoc (b1 . SBP ),2) & b2 . (DataLoc (b1 . SBP ),3) = b1 . (DataLoc (b1 . SBP ),3) holds
ex b3 being Nat st
( CurInstr ((Computation b1) . b3) = return SBP & b1 . SBP = ((Computation b1) . b3) . SBP & CurInstr ((Computation b2) . b3) = return SBP & b2 . SBP = ((Computation b2) . b3) . SBP & ( for b4 being Nat st 1 < b4 & b4 <= (b1 . SBP ) + 1 holds
( b1 . (intpos b4) = ((Computation b1) . b3) . (intpos b4) & b2 . (intpos b4) = ((Computation b2) . b3) . (intpos b4) ) ) & ( for b4 being Nat
for b5 being Int_position st b4 <= b3 & b1 . b5 = b2 . b5 holds
( IC ((Computation b1) . b4) = IC ((Computation b2) . b4) & ((Computation b1) . b4) . b5 = ((Computation b2) . b4) . b5 ) ) )
Lemma25:
for b1, b2 being State of SCMPDS
for b3 being Int_position
for b4 being Nat st Initialized GCD-Algorithm c= b1 & Initialized GCD-Algorithm c= b2 & b1 . b3 = b2 . b3 & b4 <= 4 holds
( IC ((Computation b1) . b4) = IC ((Computation b2) . b4) & ((Computation b1) . b4) . b3 = ((Computation b2) . b4) . b3 )
theorem Th19: :: SCMP_GCD:19