Article RELOC, MML version 4.99.1005

:: RELOC:th 2
theorem
for b1, b2 being Instruction-Location of SCM
for b3 being Element of NAT holds
      Start-At (b1 + b3) = Start-At (b2 + b3)
   iff
      Start-At b1 = Start-At b2;

:: RELOC:th 3
theorem
for b1, b2 being Instruction-Location of SCM
for b3 being natural set
      st Start-At b1 = Start-At b2
   holds Start-At (b1 -' b3) = Start-At (b2 -' b3);

:: RELOC:funcnot 1 => RELOC:func 1
definition
  let a1 be Element of the Instructions of SCM;
  let a2 be Element of NAT;
  func IncAddr(A1,A2) -> Element of the Instructions of SCM equals
    goto ((@ a1) jump_address @ + a2)
    if InsCode a1 = 6,
(@ a1) cond_address @ =0_goto ((@ a1) cjump_address @ + a2)
    if InsCode a1 = 7,
(@ a1) cond_address @ >0_goto ((@ a1) cjump_address @ + a2)
    if InsCode a1 = 8
    otherwise a1;
end;

:: RELOC:def 3
theorem
for b1 being Element of the Instructions of SCM
for b2 being Element of NAT holds
   (InsCode b1 = 6 implies IncAddr(b1,b2) = goto ((@ b1) jump_address @ + b2)) &
    (InsCode b1 = 7 implies IncAddr(b1,b2) = (@ b1) cond_address @ =0_goto ((@ b1) cjump_address @ + b2)) &
    (InsCode b1 = 8 implies IncAddr(b1,b2) = (@ b1) cond_address @ >0_goto ((@ b1) cjump_address @ + b2)) &
    (InsCode b1 <> 6 & InsCode b1 <> 7 & InsCode b1 <> 8 implies IncAddr(b1,b2) = b1);

:: RELOC:th 4
theorem
for b1 being Element of NAT holds
   IncAddr(halt SCM,b1) = halt SCM;

:: RELOC:th 5
theorem
for b1 being Element of NAT
for b2, b3 being Data-Location holds
IncAddr(b2 := b3,b1) = b2 := b3;

:: RELOC:th 6
theorem
for b1 being Element of NAT
for b2, b3 being Data-Location holds
IncAddr(AddTo(b2,b3),b1) = AddTo(b2,b3);

:: RELOC:th 7
theorem
for b1 being Element of NAT
for b2, b3 being Data-Location holds
IncAddr(SubFrom(b2,b3),b1) = SubFrom(b2,b3);

:: RELOC:th 8
theorem
for b1 being Element of NAT
for b2, b3 being Data-Location holds
IncAddr(MultBy(b2,b3),b1) = MultBy(b2,b3);

:: RELOC:th 9
theorem
for b1 being Element of NAT
for b2, b3 being Data-Location holds
IncAddr(Divide(b2,b3),b1) = Divide(b2,b3);

:: RELOC:th 10
theorem
for b1 being Element of NAT
for b2 being Instruction-Location of SCM holds
   IncAddr(goto b2,b1) = goto (b2 + b1);

:: RELOC:th 11
theorem
for b1 being Element of NAT
for b2 being Instruction-Location of SCM
for b3 being Data-Location holds
   IncAddr(b3 =0_goto b2,b1) = b3 =0_goto (b2 + b1);

:: RELOC:th 12
theorem
for b1 being Element of NAT
for b2 being Instruction-Location of SCM
for b3 being Data-Location holds
   IncAddr(b3 >0_goto b2,b1) = b3 >0_goto (b2 + b1);

:: RELOC:th 13
theorem
for b1 being Element of the Instructions of SCM
for b2 being Element of NAT holds
   InsCode IncAddr(b1,b2) = InsCode b1;

:: RELOC:th 14
theorem
for b1, b2 being Element of the Instructions of SCM
for b3 being Element of NAT
      st (InsCode b2 <> 0 & InsCode b2 <> 1 & InsCode b2 <> 2 & InsCode b2 <> 3 & InsCode b2 <> 4 implies InsCode b2 = 5) &
         IncAddr(b1,b3) = b2
   holds b1 = b2;

:: RELOC:funcnot 2 => RELOC:func 2
definition
  let a1 be finite programmed Element of sproduct the Object-Kind of SCM;
  let a2 be Element of NAT;
  func IncAddr(A1,A2) -> finite programmed Element of sproduct the Object-Kind of SCM means
    proj1 it = proj1 a1 &
     (for b1 being Element of NAT
           st b1 in proj1 a1
        holds it . b1 = IncAddr(pi(a1,b1),a2));
end;

:: RELOC:def 5
theorem
for b1 being finite programmed Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT
for b3 being finite programmed Element of sproduct the Object-Kind of SCM holds
      b3 = IncAddr(b1,b2)
   iff
      proj1 b3 = proj1 b1 &
       (for b4 being Element of NAT
             st b4 in proj1 b1
          holds b3 . b4 = IncAddr(pi(b1,b4),b2));

:: RELOC:th 18
theorem
for b1 being finite programmed Element of sproduct the Object-Kind of SCM
for b2, b3 being Element of NAT
      st b3 in proj1 b1
   holds (IncAddr(b1,b2)) . b3 = IncAddr(pi(b1,b3),b2);

:: RELOC:th 19
theorem
for b1 being Element of NAT
for b2 being finite programmed Element of sproduct the Object-Kind of SCM holds
   Shift(IncAddr(b2,b1),b1) = IncAddr(Shift(b2,b1),b1);

:: RELOC:funcnot 3 => RELOC:func 3
definition
  let a1 be finite Element of sproduct the Object-Kind of SCM;
  let a2 be Element of NAT;
  func Relocated(A1,A2) -> finite Element of sproduct the Object-Kind of SCM equals
    ((Start-At ((IC a1) + a2)) +* IncAddr(Shift(ProgramPart a1,a2),a2)) +* DataPart a1;
end;

:: RELOC:def 6
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT holds
   Relocated(b1,b2) = ((Start-At ((IC b1) + b2)) +* IncAddr(Shift(ProgramPart b1,b2),b2)) +* DataPart b1;

:: RELOC:th 20
theorem
for b1 being Element of NAT
for b2 being finite Element of sproduct the Object-Kind of SCM holds
   proj1 IncAddr(Shift(ProgramPart b2,b1),b1) c= NAT;

:: RELOC:th 21
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT holds
   DataPart Relocated(b1,b2) = DataPart b1;

:: RELOC:th 22
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT holds
   ProgramPart Relocated(b1,b2) = IncAddr(Shift(ProgramPart b1,b2),b2);

:: RELOC:th 23
theorem
for b1 being Element of NAT
for b2 being finite Element of sproduct the Object-Kind of SCM holds
   proj1 ProgramPart Relocated(b2,b1) = {b3 + b1 where b3 is Element of NAT: b3 in proj1 ProgramPart b2};

:: RELOC:th 24
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT
for b3 being Instruction-Location of SCM holds
      b3 in proj1 b1
   iff
      b3 + b2 in proj1 Relocated(b1,b2);

:: RELOC:th 25
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT holds
   IC SCM in proj1 Relocated(b1,b2);

:: RELOC:th 26
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT holds
   IC Relocated(b1,b2) = (IC b1) + b2;

:: RELOC:th 27
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2, b3 being Element of NAT
for b4 being Element of the Instructions of SCM
      st b3 in proj1 ProgramPart b1 & b4 = b1 . b3
   holds IncAddr(b4,b2) = (Relocated(b1,b2)) . (b3 + b2);

:: RELOC:th 28
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT holds
   Start-At ((IC b1) + b2) c= Relocated(b1,b2);

:: RELOC:th 29
theorem
for b1 being finite data-only Element of sproduct the Object-Kind of SCM
for b2 being finite Element of sproduct the Object-Kind of SCM
for b3 being Element of NAT
      st IC SCM in proj1 b2
   holds Relocated(b2 +* b1,b3) = (Relocated(b2,b3)) +* b1;

:: RELOC:th 30
theorem
for b1 being Element of NAT
for b2 being finite autonomic Element of sproduct the Object-Kind of SCM
for b3, b4 being Element of product the Object-Kind of SCM
      st b2 c= b3 & Relocated(b2,b1) c= b4
   holds b2 c= b3 +* (b4 | SCM-Data-Loc);

:: RELOC:th 31
theorem
for b1 being Element of NAT
for b2 being Element of product the Object-Kind of SCM holds
   Exec(IncAddr(CurInstr b2,b1),b2 +* Start-At ((IC b2) + b1)) = (Following b2) +* Start-At ((IC Following b2) + b1);

:: RELOC:th 32
theorem
for b1 being Element of the Instructions of SCM
for b2 being Element of product the Object-Kind of SCM
for b3, b4 being Element of NAT
      st IC b2 = b3 + b4
   holds Exec(b1,b2 +* Start-At ((IC b2) -' b4)) = (Exec(IncAddr(b1,b4),b2)) +* Start-At ((IC Exec(IncAddr(b1,b4),b2)) -' b4);

:: RELOC:th 33
theorem
for b1 being Element of NAT
for b2 being finite autonomic Element of sproduct the Object-Kind of SCM
   st IC SCM in proj1 b2
for b3 being Element of product the Object-Kind of SCM
   st b2 c= b3
for b4 being Element of NAT holds
   Computation(b3 +* Relocated(b2,b1),b4) = ((Computation(b3,b4)) +* Start-At ((IC Computation(b3,b4)) + b1)) +* ProgramPart Relocated(b2,b1);

:: RELOC:th 34
theorem
for b1 being Element of NAT
for b2 being finite autonomic Element of sproduct the Object-Kind of SCM
for b3, b4, b5 being Element of product the Object-Kind of SCM
   st IC SCM in proj1 b2 & b2 c= b3 & Relocated(b2,b1) c= b4 & b5 = b3 +* (b4 | SCM-Data-Loc)
for b6 being Element of NAT holds
   (IC Computation(b3,b6)) + b1 = IC Computation(b4,b6) &
    IncAddr(CurInstr Computation(b3,b6),b1) = CurInstr Computation(b4,b6) &
    (Computation(b3,b6)) | proj1 DataPart b2 = (Computation(b4,b6)) | proj1 DataPart Relocated(b2,b1) &
    (Computation(b5,b6)) | SCM-Data-Loc = (Computation(b4,b6)) | SCM-Data-Loc;

:: RELOC:th 35
theorem
for b1 being finite autonomic Element of sproduct the Object-Kind of SCM
for b2 being Element of NAT
      st IC SCM in proj1 b1
   holds    b1 is halting(NAT, {INT}, SCM)
   iff
      Relocated(b1,b2) is halting(NAT, {INT}, SCM);

:: RELOC:th 36
theorem
for b1 being Element of NAT
for b2 being finite autonomic Element of sproduct the Object-Kind of SCM
   st IC SCM in proj1 b2
for b3 being Element of product the Object-Kind of SCM
   st Relocated(b2,b1) c= b3
for b4 being Element of NAT holds
   Computation(b3,b4) = (((Computation(b3 +* b2,b4)) +* Start-At ((IC Computation(b3 +* b2,b4)) + b1)) +* (b3 | proj1 ProgramPart b2)) +* ProgramPart Relocated(b2,b1);

:: RELOC:th 37
theorem
for b1 being Element of NAT
for b2 being finite Element of sproduct the Object-Kind of SCM
   st IC SCM in proj1 b2
for b3 being Element of product the Object-Kind of SCM
   st b2 c= b3 &
      Relocated(b2,b1) is autonomic(NAT, {INT}, SCM)
for b4 being Element of NAT holds
   Computation(b3,b4) = (((Computation(b3 +* Relocated(b2,b1),b4)) +* Start-At ((IC Computation(b3 +* Relocated(b2,b1),b4)) -' b1)) +* (b3 | proj1 ProgramPart Relocated(b2,b1))) +* ProgramPart b2;

:: RELOC:th 38
theorem
for b1 being finite Element of sproduct the Object-Kind of SCM
   st IC SCM in proj1 b1
for b2 being Element of NAT holds
      b1 is autonomic(NAT, {INT}, SCM)
   iff
      Relocated(b1,b2) is autonomic(NAT, {INT}, SCM);

:: RELOC:th 39
theorem
for b1 being finite autonomic halting Element of sproduct the Object-Kind of SCM
   st IC SCM in proj1 b1
for b2 being Element of NAT holds
   DataPart Result b1 = DataPart Result Relocated(b1,b2);

:: RELOC:th 40
theorem
for b1 being Function-like Relation of FinPartSt SCM,FinPartSt SCM
for b2 being finite Element of sproduct the Object-Kind of SCM
   st IC SCM in proj1 b2 & b1 is data-only(NAT, {INT}, SCM)
for b3 being Element of NAT holds
      b2 computes b1
   iff
      Relocated(b2,b3) computes b1;