Article SFMASTR2, MML version 4.99.1005

:: SFMASTR2:th 1
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b3 is_closed_on Initialize b1 & b3 is_halting_on Initialize b1 & not b2 in UsedIntLoc b3
   holds (IExec(b3,b1)) . b2 = (Initialize b1) . b2;

:: SFMASTR2:th 2
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being FinSeq-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b3 is_closed_on Initialize b1 & b3 is_halting_on Initialize b1 & not b2 in UsedInt*Loc b3
   holds (IExec(b3,b1)) . b2 = (Initialize b1) . b2;

:: SFMASTR2:th 3
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st (b3 is_closed_on Initialize b1 & b3 is_halting_on Initialize b1 or b3 is parahalting) &
         (b1 . intloc 0 <> 1 implies b2 is read-write) &
         not b2 in UsedIntLoc b3
   holds (IExec(b3,b1)) . b2 = b1 . b2;

:: SFMASTR2:th 4
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b1 . intloc 0 = 1
   holds    b2 is_closed_on b1
   iff
      b2 is_closed_on Initialize b1;

:: SFMASTR2:th 5
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b1 . intloc 0 = 1
   holds    b2 is_closed_on b1 & b2 is_halting_on b1
   iff
      b2 is_closed_on Initialize b1 & b2 is_halting_on Initialize b1;

:: SFMASTR2:th 6
theorem
for b1, b2 being Element of product the Object-Kind of SCM+FSA
for b3 being Element of bool Int-Locations
for b4 being Element of bool FinSeq-Locations holds
      b1 | (b3 \/ b4) = b2 | (b3 \/ b4)
   iff
      (for b5 being Int-Location
             st b5 in b3
          holds b1 . b5 = b2 . b5) &
       (for b5 being FinSeq-Location
             st b5 in b4
          holds b1 . b5 = b2 . b5);

:: SFMASTR2:th 7
theorem
for b1, b2 being Element of product the Object-Kind of SCM+FSA
for b3 being Element of bool Int-Locations holds
      b1 | (b3 \/ FinSeq-Locations) = b2 | (b3 \/ FinSeq-Locations)
   iff
      (for b4 being Int-Location
             st b4 in b3
          holds b1 . b4 = b2 . b4) &
       (for b4 being FinSeq-Location holds
          b1 . b4 = b2 . b4);

:: SFMASTR2:funcnot 1 => SFMASTR2:func 1
definition
  let a1 be Int-Location;
  let a2 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
  func times(A1,A2) -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
    ((1 -thRWNotIn ({a1} \/ UsedIntLoc a2)) := a1) ';' while>0(1 -thRWNotIn ({a1} \/ UsedIntLoc a2),a2 ';' SubFrom(1 -thRWNotIn ({a1} \/ UsedIntLoc a2),intloc 0));
end;

:: SFMASTR2:def 1
theorem
for b1 being Int-Location
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
   times(b1,b2) = ((1 -thRWNotIn ({b1} \/ UsedIntLoc b2)) := b1) ';' while>0(1 -thRWNotIn ({b1} \/ UsedIntLoc b2),b2 ';' SubFrom(1 -thRWNotIn ({b1} \/ UsedIntLoc b2),intloc 0));

:: SFMASTR2:funcnot 2 => SFMASTR2:func 1
notation
  let a1 be Int-Location;
  let a2 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
  synonym a1 times a2 for times(a1,a2);
end;

:: SFMASTR2:th 8
theorem
for b1 being Int-Location
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
   {b1} \/ UsedIntLoc b2 c= UsedIntLoc times(b1,b2);

:: SFMASTR2:th 9
theorem
for b1 being Int-Location
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
   UsedInt*Loc times(b1,b2) = UsedInt*Loc b2;

:: SFMASTR2:funcreg 1
registration
  let a1 be finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA;
  let a2 be Int-Location;
  cluster times(a2,a1) -> finite programmed initial good;
end;

:: SFMASTR2:funcnot 3 => SFMASTR2:func 2
definition
  let a1 be Element of product the Object-Kind of SCM+FSA;
  let a2 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
  let a3 be Int-Location;
  func StepTimes(A3,A2,A1) -> Function-like quasi_total Relation of NAT,product the Object-Kind of SCM+FSA equals
    StepWhile>0(1 -thRWNotIn ({a3} \/ UsedIntLoc a2),a2 ';' SubFrom(1 -thRWNotIn ({a3} \/ UsedIntLoc a2),intloc 0),Exec((1 -thRWNotIn ({a3} \/ UsedIntLoc a2)) := a3,Initialize a1));
end;

:: SFMASTR2:def 2
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
for b3 being Int-Location holds
   StepTimes(b3,b2,b1) = StepWhile>0(1 -thRWNotIn ({b3} \/ UsedIntLoc b2),b2 ';' SubFrom(1 -thRWNotIn ({b3} \/ UsedIntLoc b2),intloc 0),Exec((1 -thRWNotIn ({b3} \/ UsedIntLoc b2)) := b3,Initialize b1));

:: SFMASTR2:th 10
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA holds
   ((StepTimes(b2,b3,b1)) . 0) . intloc 0 = 1;

:: SFMASTR2:th 11
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
      st (b1 . intloc 0 <> 1 implies b2 is read-write)
   holds ((StepTimes(b2,b3,b1)) . 0) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3)) = b1 . b2;

:: SFMASTR2:th 12
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b4 being Element of NAT
      st ((StepTimes(b2,b3,b1)) . b4) . intloc 0 = 1 &
         b3 is_closed_on (StepTimes(b2,b3,b1)) . b4 &
         b3 is_halting_on (StepTimes(b2,b3,b1)) . b4
   holds ((StepTimes(b2,b3,b1)) . (b4 + 1)) . intloc 0 = 1 &
    (((StepTimes(b2,b3,b1)) . b4) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3)) <= 0 or ((StepTimes(b2,b3,b1)) . (b4 + 1)) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3)) = (((StepTimes(b2,b3,b1)) . b4) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3))) - 1);

:: SFMASTR2:th 13
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st (b1 . intloc 0 <> 1 implies b2 is read-write)
   holds ((StepTimes(b2,b3,b1)) . 0) . b2 = b1 . b2;

:: SFMASTR2:th 14
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being FinSeq-Location
for b4 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
   ((StepTimes(b2,b4,b1)) . 0) . b3 = b1 . b3;

:: SFMASTR2:prednot 1 => SFMASTR2:pred 1
definition
  let a1 be Element of product the Object-Kind of SCM+FSA;
  let a2 be Int-Location;
  let a3 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
  pred ProperTimesBody A2,A3,A1 means
    for b1 being Element of NAT
          st b1 < a1 . a2
       holds a3 is_closed_on (StepTimes(a2,a3,a1)) . b1 & a3 is_halting_on (StepTimes(a2,a3,a1)) . b1;
end;

:: SFMASTR2:dfs 3
definiens
  let a1 be Element of product the Object-Kind of SCM+FSA;
  let a2 be Int-Location;
  let a3 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
To prove
     ProperTimesBody a2,a3,a1
it is sufficient to prove
  thus for b1 being Element of NAT
          st b1 < a1 . a2
       holds a3 is_closed_on (StepTimes(a2,a3,a1)) . b1 & a3 is_halting_on (StepTimes(a2,a3,a1)) . b1;

:: SFMASTR2:def 3
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
      ProperTimesBody b2,b3,b1
   iff
      for b4 being Element of NAT
            st b4 < b1 . b2
         holds b3 is_closed_on (StepTimes(b2,b3,b1)) . b4 & b3 is_halting_on (StepTimes(b2,b3,b1)) . b4;

:: SFMASTR2:th 15
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b3 is parahalting
   holds ProperTimesBody b2,b3,b1;

:: SFMASTR2:th 16
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
   st ProperTimesBody b2,b3,b1
for b4 being Element of NAT
      st b4 <= b1 . b2
   holds ((StepTimes(b2,b3,b1)) . b4) . intloc 0 = 1;

:: SFMASTR2:th 17
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
   st (b1 . intloc 0 <> 1 implies b2 is read-write) &
      ProperTimesBody b2,b3,b1
for b4 being Element of NAT
      st b4 <= b1 . b2
   holds (((StepTimes(b2,b3,b1)) . b4) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3))) + b4 = b1 . b2;

:: SFMASTR2:th 18
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
   st ProperTimesBody b2,b3,b1 &
      0 <= b1 . b2 &
      (b1 . intloc 0 <> 1 implies b2 is read-write)
for b4 being Element of NAT
      st b1 . b2 <= b4
   holds ((StepTimes(b2,b3,b1)) . b4) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3)) = 0 &
    ((StepTimes(b2,b3,b1)) . b4) . intloc 0 = 1;

:: SFMASTR2:th 19
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b1 . intloc 0 = 1
   holds ((StepTimes(b2,b3,b1)) . 0) | ((UsedIntLoc b3) \/ FinSeq-Locations) = b1 | ((UsedIntLoc b3) \/ FinSeq-Locations);

:: SFMASTR2:th 20
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b4 being Element of NAT
      st ((StepTimes(b2,b3,b1)) . b4) . intloc 0 = 1 &
         b3 is_halting_on Initialize ((StepTimes(b2,b3,b1)) . b4) &
         b3 is_closed_on Initialize ((StepTimes(b2,b3,b1)) . b4) &
         0 < ((StepTimes(b2,b3,b1)) . b4) . (1 -thRWNotIn ({b2} \/ UsedIntLoc b3))
   holds ((StepTimes(b2,b3,b1)) . (b4 + 1)) | ((UsedIntLoc b3) \/ FinSeq-Locations) = (IExec(b3,(StepTimes(b2,b3,b1)) . b4)) | ((UsedIntLoc b3) \/ FinSeq-Locations);

:: SFMASTR2:th 21
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b4 being Element of NAT
      st (ProperTimesBody b2,b3,b1 or b3 is parahalting) &
         b4 < b1 . b2 &
         (b1 . intloc 0 <> 1 implies b2 is read-write)
   holds ((StepTimes(b2,b3,b1)) . (b4 + 1)) | ((UsedIntLoc b3) \/ FinSeq-Locations) = (IExec(b3,(StepTimes(b2,b3,b1)) . b4)) | ((UsedIntLoc b3) \/ FinSeq-Locations);

:: SFMASTR2:th 22
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b1 . b2 <= 0 & b1 . intloc 0 = 1
   holds (IExec(times(b2,b3),b1)) | ((UsedIntLoc b3) \/ FinSeq-Locations) = b1 | ((UsedIntLoc b3) \/ FinSeq-Locations);

:: SFMASTR2:th 23
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b4 being Element of NAT
      st b1 . b2 = b4 &
         (ProperTimesBody b2,b3,b1 or b3 is parahalting) &
         (b1 . intloc 0 <> 1 implies b2 is read-write)
   holds (IExec(times(b2,b3),b1)) | (Int-Locations \/ FinSeq-Locations) = ((StepTimes(b2,b3,b1)) . b4) | (Int-Locations \/ FinSeq-Locations);

:: SFMASTR2:th 24
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
      st b1 . intloc 0 = 1 & (ProperTimesBody b2,b3,b1 or b3 is parahalting)
   holds times(b2,b3) is_closed_on b1 & times(b2,b3) is_halting_on b1;

:: SFMASTR2:funcnot 4 => SFMASTR2:func 3
definition
  let a1 be read-write Int-Location;
  func triv-times A1 -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
    times(a1,(while=0(a1,Macro (a1 := a1))) ';' SubFrom(a1,intloc 0));
end;

:: SFMASTR2:def 4
theorem
for b1 being read-write Int-Location holds
   triv-times b1 = times(b1,(while=0(b1,Macro (b1 := b1))) ';' SubFrom(b1,intloc 0));

:: SFMASTR2:th 25
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
      st b1 . b2 <= 0
   holds (IExec(triv-times b2,b1)) . b2 = b1 . b2;

:: SFMASTR2:th 26
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
      st 0 <= b1 . b2
   holds (IExec(triv-times b2,b1)) . b2 = 0;

:: SFMASTR2:funcnot 5 => SFMASTR2:func 4
definition
  let a1, a2 be Int-Location;
  func Fib-macro(A1,A2) -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
    (((((1 -thNotUsed times(a1,(AddTo(a2,1 -thRWNotIn {a1,a2})) ';' swap(a2,1 -thRWNotIn {a1,a2}))) := a1) ';' SubFrom(a2,a2)) ';' ((1 -thRWNotIn {a1,a2}) := intloc 0)) ';' times(a1,(AddTo(a2,1 -thRWNotIn {a1,a2})) ';' swap(a2,1 -thRWNotIn {a1,a2}))) ';' (a1 := (1 -thNotUsed times(a1,(AddTo(a2,1 -thRWNotIn {a1,a2})) ';' swap(a2,1 -thRWNotIn {a1,a2}))));
end;

:: SFMASTR2:def 5
theorem
for b1, b2 being Int-Location holds
Fib-macro(b1,b2) = (((((1 -thNotUsed times(b1,(AddTo(b2,1 -thRWNotIn {b1,b2})) ';' swap(b2,1 -thRWNotIn {b1,b2}))) := b1) ';' SubFrom(b2,b2)) ';' ((1 -thRWNotIn {b1,b2}) := intloc 0)) ';' times(b1,(AddTo(b2,1 -thRWNotIn {b1,b2})) ';' swap(b2,1 -thRWNotIn {b1,b2}))) ';' (b1 := (1 -thNotUsed times(b1,(AddTo(b2,1 -thRWNotIn {b1,b2})) ';' swap(b2,1 -thRWNotIn {b1,b2}))));

:: SFMASTR2:th 27
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being read-write Int-Location
   st b2 <> b3
for b4 being Element of NAT
      st b4 = b1 . b2
   holds (IExec(Fib-macro(b2,b3),b1)) . b3 = Fib b4 &
    (IExec(Fib-macro(b2,b3),b1)) . b2 = b1 . b2;