Article SFMASTR1, MML version 4.99.1005

:: SFMASTR1:attrnot 1 => SFMASTR1:attr 1
definition
  let a1 be Element of the Instructions of SCM+FSA;
  attr a1 is good means
    Macro a1 is good;
end;

:: SFMASTR1:dfs 1
definiens
  let a1 be Element of the Instructions of SCM+FSA;
To prove
     a1 is good
it is sufficient to prove
  thus Macro a1 is good;

:: SFMASTR1:def 1
theorem
for b1 being Element of the Instructions of SCM+FSA holds
      b1 is good
   iff
      Macro b1 is good;

:: SFMASTR1:funcreg 1
registration
  let a1 be read-write Int-Location;
  let a2 be Int-Location;
  cluster a1 := a2 -> good;
end;

:: SFMASTR1:funcreg 2
registration
  let a1 be read-write Int-Location;
  let a2 be Int-Location;
  cluster AddTo(a1,a2) -> good;
end;

:: SFMASTR1:funcreg 3
registration
  let a1 be read-write Int-Location;
  let a2 be Int-Location;
  cluster SubFrom(a1,a2) -> good;
end;

:: SFMASTR1:funcreg 4
registration
  let a1 be read-write Int-Location;
  let a2 be Int-Location;
  cluster MultBy(a1,a2) -> good;
end;

:: SFMASTR1:exreg 1
registration
  cluster parahalting good Element of the Instructions of SCM+FSA;
end;

:: SFMASTR1:funcreg 5
registration
  let a1, a2 be read-write Int-Location;
  cluster Divide(a1,a2) -> good;
end;

:: SFMASTR1:funcreg 6
registration
  let a1 be Instruction-Location of SCM+FSA;
  cluster goto a1 -> good;
end;

:: SFMASTR1:funcreg 7
registration
  let a1 be Int-Location;
  let a2 be Instruction-Location of SCM+FSA;
  cluster a1 =0_goto a2 -> good;
end;

:: SFMASTR1:funcreg 8
registration
  let a1 be Int-Location;
  let a2 be Instruction-Location of SCM+FSA;
  cluster a1 >0_goto a2 -> good;
end;

:: SFMASTR1:funcreg 9
registration
  let a1 be Int-Location;
  let a2 be FinSeq-Location;
  let a3 be read-write Int-Location;
  cluster a3 :=(a2,a1) -> good;
end;

:: SFMASTR1:funcreg 10
registration
  let a1 be FinSeq-Location;
  let a2 be read-write Int-Location;
  cluster a2 :=len a1 -> good;
end;

:: SFMASTR1:funcreg 11
registration
  let a1 be FinSeq-Location;
  let a2 be Int-Location;
  cluster a1 :=<0,...,0> a2 -> good;
end;

:: SFMASTR1:funcreg 12
registration
  let a1 be FinSeq-Location;
  let a2, a3 be Int-Location;
  cluster (a1,a2):= a3 -> good;
end;

:: SFMASTR1:exreg 2
registration
  cluster good Element of the Instructions of SCM+FSA;
end;

:: SFMASTR1:funcreg 13
registration
  let a1 be good Element of the Instructions of SCM+FSA;
  cluster Macro a1 -> finite programmed initial good;
end;

:: SFMASTR1:funcreg 14
registration
  let a1, a2 be good Element of the Instructions of SCM+FSA;
  cluster a1 ';' a2 -> finite programmed initial good;
end;

:: SFMASTR1:funcreg 15
registration
  let a1 be good Element of the Instructions of SCM+FSA;
  let a2 be finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA;
  cluster a1 ';' a2 -> finite programmed initial good;
end;

:: SFMASTR1:funcreg 16
registration
  let a1 be good Element of the Instructions of SCM+FSA;
  let a2 be finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA;
  cluster a2 ';' a1 -> finite programmed initial good;
end;

:: SFMASTR1:funcreg 17
registration
  let a1, a2 be read-write Int-Location;
  cluster swap(a1,a2) -> finite programmed initial good;
end;

:: SFMASTR1:funcreg 18
registration
  let a1 be finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA;
  let a2 be read-write Int-Location;
  cluster Times(a2,a1) -> finite programmed initial good;
end;

:: SFMASTR1:th 1
theorem
for b1 being Int-Location
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st not b1 in UsedIntLoc b2
   holds b2 does_not_destroy b1;

:: SFMASTR1:th 2
theorem
for b1 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
   (b1 +* Start-At insloc 0) | (Int-Locations \/ FinSeq-Locations) = {};

:: SFMASTR1:th 3
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b2 is_halting_on Initialize b1 & b2 is_closed_on Initialize b1 & b3 is_closed_on IExec(b2,b1)
   holds b2 ';' b3 is_closed_on Initialize b1;

:: SFMASTR1:th 4
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
      st b2 is_halting_on Initialize b1 & b3 is_halting_on IExec(b2,b1) & b2 is_closed_on Initialize b1 & b3 is_closed_on IExec(b2,b1)
   holds b2 ';' b3 is_halting_on Initialize b1;

:: SFMASTR1:th 5
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
   st b2 is_closed_on b1 &
      b2 +* Start-At insloc 0 c= b1 &
      b1 is halting(NAT, {INT,INT *}, SCM+FSA)
for b4 being Element of NAT
      st b4 <= LifeSpan b1
   holds Computation(b1,b4),Computation(b1 +* (b2 ';' b3),b4) equal_outside NAT;

:: SFMASTR1:th 6
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 finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
      st b3 is_halting_on Initialize b1 & b2 is_halting_on IExec(b3,b1) & b3 is_closed_on Initialize b1 & b2 is_closed_on IExec(b3,b1)
   holds LifeSpan (b1 +* Initialized (b3 ';' b2)) = ((LifeSpan (b1 +* Initialized b3)) + 1) + LifeSpan ((Result (b1 +* Initialized b3)) +* Initialized b2);

:: SFMASTR1:th 7
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 finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
      st b3 is_halting_on Initialize b1 & b2 is_halting_on IExec(b3,b1) & b3 is_closed_on Initialize b1 & b2 is_closed_on IExec(b3,b1)
   holds IExec(b3 ';' b2,b1) = (IExec(b2,IExec(b3,b1))) +* Start-At ((IC IExec(b2,IExec(b3,b1))) + card b3);

:: SFMASTR1:th 8
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 finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b4 being Int-Location
      st (b3 is parahalting or b3 is_halting_on Initialize b1 & b3 is_closed_on Initialize b1) &
         (b2 is parahalting or b2 is_halting_on IExec(b3,b1) & b2 is_closed_on IExec(b3,b1))
   holds (IExec(b3 ';' b2,b1)) . b4 = (IExec(b2,IExec(b3,b1))) . b4;

:: SFMASTR1:th 9
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 finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b4 being FinSeq-Location
      st (b3 is parahalting or b3 is_halting_on Initialize b1 & b3 is_closed_on Initialize b1) &
         (b2 is parahalting or b2 is_halting_on IExec(b3,b1) & b2 is_closed_on IExec(b3,b1))
   holds (IExec(b3 ';' b2,b1)) . b4 = (IExec(b2,IExec(b3,b1))) . b4;

:: SFMASTR1:th 10
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 finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
      st (b3 is parahalting or b3 is_halting_on Initialize b1 & b3 is_closed_on Initialize b1) &
         (b2 is parahalting or b2 is_halting_on IExec(b3,b1) & b2 is_closed_on IExec(b3,b1))
   holds (IExec(b3 ';' b2,b1)) | (Int-Locations \/ FinSeq-Locations) = (IExec(b2,IExec(b3,b1))) | (Int-Locations \/ FinSeq-Locations);

:: SFMASTR1:th 11
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
      st (b2 is parahalting or b2 is_closed_on Initialize b1 & b2 is_halting_on Initialize b1)
   holds (Initialize IExec(b2,b1)) | (Int-Locations \/ FinSeq-Locations) = (IExec(b2,b1)) | (Int-Locations \/ FinSeq-Locations);

:: SFMASTR1:th 12
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b3 being parahalting Element of the Instructions of SCM+FSA
for b4 being Int-Location
      st (b2 is parahalting or b2 is_halting_on Initialize b1 & b2 is_closed_on Initialize b1)
   holds (IExec(b2 ';' b3,b1)) . b4 = (Exec(b3,IExec(b2,b1))) . b4;

:: SFMASTR1:th 13
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b3 being parahalting Element of the Instructions of SCM+FSA
for b4 being FinSeq-Location
      st (b2 is parahalting or b2 is_halting_on Initialize b1 & b2 is_closed_on Initialize b1)
   holds (IExec(b2 ';' b3,b1)) . b4 = (Exec(b3,IExec(b2,b1))) . b4;

:: SFMASTR1:th 14
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b3 being parahalting Element of the Instructions of SCM+FSA
      st (b2 is parahalting or b2 is_halting_on Initialize b1 & b2 is_closed_on Initialize b1)
   holds (IExec(b2 ';' b3,b1)) | (Int-Locations \/ FinSeq-Locations) = (Exec(b3,IExec(b2,b1))) | (Int-Locations \/ FinSeq-Locations);

:: SFMASTR1:th 15
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 parahalting good Element of the Instructions of SCM+FSA
for b4 being Int-Location
      st (b2 is parahalting or b2 is_halting_on Exec(b3,Initialize b1) & b2 is_closed_on Exec(b3,Initialize b1))
   holds (IExec(b3 ';' b2,b1)) . b4 = (IExec(b2,Exec(b3,Initialize b1))) . b4;

:: SFMASTR1:th 16
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 parahalting good Element of the Instructions of SCM+FSA
for b4 being FinSeq-Location
      st (b2 is parahalting or b2 is_halting_on Exec(b3,Initialize b1) & b2 is_closed_on Exec(b3,Initialize b1))
   holds (IExec(b3 ';' b2,b1)) . b4 = (IExec(b2,Exec(b3,Initialize b1))) . b4;

:: SFMASTR1:th 17
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 parahalting good Element of the Instructions of SCM+FSA
      st (b2 is parahalting or b2 is_halting_on Exec(b3,Initialize b1) & b2 is_closed_on Exec(b3,Initialize b1))
   holds (IExec(b3 ';' b2,b1)) | (Int-Locations \/ FinSeq-Locations) = (IExec(b2,Exec(b3,Initialize b1))) | (Int-Locations \/ FinSeq-Locations);

:: SFMASTR1:funcnot 1 => SFMASTR1:func 1
definition
  let a1 be Int-Location;
  redefine func {a1} -> Element of bool Int-Locations;
end;

:: SFMASTR1:funcnot 2 => SFMASTR1:func 2
definition
  let a1, a2 be Int-Location;
  redefine func {a1, a2} -> Element of bool Int-Locations;
  commutativity;
::  for a1, a2 being Int-Location holds
::  {a1,a2} = {a2,a1};
end;

:: SFMASTR1:funcnot 3 => SFMASTR1:func 3
definition
  let a1, a2, a3 be Int-Location;
  redefine func {a1, a2, a3} -> Element of bool Int-Locations;
end;

:: SFMASTR1:funcnot 4 => SFMASTR1:func 4
definition
  let a1, a2, a3, a4 be Int-Location;
  redefine func {a1, a2, a3, a4} -> Element of bool Int-Locations;
end;

:: SFMASTR1:funcnot 5 => SFMASTR1:func 5
definition
  let a1 be finite Element of bool Int-Locations;
  func RWNotIn-seq A1 -> Function-like quasi_total Relation of NAT,bool NAT means
    it . 0 = {b1 where b1 is Element of NAT: not intloc b1 in a1 & b1 <> 0} &
     (for b1 being Element of NAT
     for b2 being non empty Element of bool NAT
           st it . b1 = b2
        holds it . (b1 + 1) = b2 \ {min b2}) &
     (for b1 being Element of NAT holds
        it . b1 is infinite);
end;

:: SFMASTR1:def 2
theorem
for b1 being finite Element of bool Int-Locations
for b2 being Function-like quasi_total Relation of NAT,bool NAT holds
      b2 = RWNotIn-seq b1
   iff
      b2 . 0 = {b3 where b3 is Element of NAT: not intloc b3 in b1 & b3 <> 0} &
       (for b3 being Element of NAT
       for b4 being non empty Element of bool NAT
             st b2 . b3 = b4
          holds b2 . (b3 + 1) = b4 \ {min b4}) &
       (for b3 being Element of NAT holds
          b2 . b3 is infinite);

:: SFMASTR1:funcreg 19
registration
  let a1 be finite Element of bool Int-Locations;
  let a2 be Element of NAT;
  cluster (RWNotIn-seq a1) . a2 -> non empty;
end;

:: SFMASTR1:th 18
theorem
for b1 being finite Element of bool Int-Locations
for b2 being Element of NAT holds
   not 0 in (RWNotIn-seq b1) . b2 &
    (for b3 being Element of NAT
          st b3 in (RWNotIn-seq b1) . b2
       holds not intloc b3 in b1);

:: SFMASTR1:th 19
theorem
for b1 being finite Element of bool Int-Locations
for b2 being Element of NAT holds
   min ((RWNotIn-seq b1) . b2) < min ((RWNotIn-seq b1) . (b2 + 1));

:: SFMASTR1:th 20
theorem
for b1 being finite Element of bool Int-Locations
for b2, b3 being Element of NAT
      st b2 < b3
   holds min ((RWNotIn-seq b1) . b2) < min ((RWNotIn-seq b1) . b3);

:: SFMASTR1:funcnot 6 => SFMASTR1:func 6
definition
  let a1 be Element of NAT;
  let a2 be finite Element of bool Int-Locations;
  func A1 -thRWNotIn A2 -> Int-Location equals
    intloc min ((RWNotIn-seq a2) . a1);
end;

:: SFMASTR1:def 3
theorem
for b1 being Element of NAT
for b2 being finite Element of bool Int-Locations holds
   b1 -thRWNotIn b2 = intloc min ((RWNotIn-seq b2) . b1);

:: SFMASTR1:funcnot 7 => SFMASTR1:func 6
notation
  let a1 be Element of NAT;
  let a2 be finite Element of bool Int-Locations;
  synonym a1 -stRWNotIn a2 for a1 -thRWNotIn a2;
end;

:: SFMASTR1:funcnot 8 => SFMASTR1:func 6
notation
  let a1 be Element of NAT;
  let a2 be finite Element of bool Int-Locations;
  synonym a1 -ndRWNotIn a2 for a1 -thRWNotIn a2;
end;

:: SFMASTR1:funcnot 9 => SFMASTR1:func 6
notation
  let a1 be Element of NAT;
  let a2 be finite Element of bool Int-Locations;
  synonym a1 -rdRWNotIn a2 for a1 -thRWNotIn a2;
end;

:: SFMASTR1:funcreg 20
registration
  let a1 be Element of NAT;
  let a2 be finite Element of bool Int-Locations;
  cluster a1 -thRWNotIn a2 -> read-write;
end;

:: SFMASTR1:th 21
theorem
for b1 being finite Element of bool Int-Locations
for b2 being Element of NAT holds
   not b2 -thRWNotIn b1 in b1;

:: SFMASTR1:th 22
theorem
for b1 being finite Element of bool Int-Locations
for b2, b3 being Element of NAT
      st b2 <> b3
   holds b2 -thRWNotIn b1 <> b3 -thRWNotIn b1;

:: SFMASTR1:funcnot 10 => SFMASTR1:func 7
definition
  let a1 be Element of NAT;
  let a2 be finite programmed Element of sproduct the Object-Kind of SCM+FSA;
  func A1 -thNotUsed A2 -> Int-Location equals
    a1 -thRWNotIn UsedIntLoc a2;
end;

:: SFMASTR1:def 4
theorem
for b1 being Element of NAT
for b2 being finite programmed Element of sproduct the Object-Kind of SCM+FSA holds
   b1 -thNotUsed b2 = b1 -thRWNotIn UsedIntLoc b2;

:: SFMASTR1:funcnot 11 => SFMASTR1:func 7
notation
  let a1 be Element of NAT;
  let a2 be finite programmed Element of sproduct the Object-Kind of SCM+FSA;
  synonym a1 -stNotUsed a2 for a1 -thNotUsed a2;
end;

:: SFMASTR1:funcnot 12 => SFMASTR1:func 7
notation
  let a1 be Element of NAT;
  let a2 be finite programmed Element of sproduct the Object-Kind of SCM+FSA;
  synonym a1 -ndNotUsed a2 for a1 -thNotUsed a2;
end;

:: SFMASTR1:funcnot 13 => SFMASTR1:func 7
notation
  let a1 be Element of NAT;
  let a2 be finite programmed Element of sproduct the Object-Kind of SCM+FSA;
  synonym a1 -rdNotUsed a2 for a1 -thNotUsed a2;
end;

:: SFMASTR1:funcreg 21
registration
  let a1 be Element of NAT;
  let a2 be finite programmed Element of sproduct the Object-Kind of SCM+FSA;
  cluster a1 -thNotUsed a2 -> read-write;
end;

:: SFMASTR1:th 23
theorem
for b1, b2 being Int-Location holds
b1 in UsedIntLoc swap(b1,b2) & b2 in UsedIntLoc swap(b1,b2);

:: SFMASTR1:funcnot 14 => SFMASTR1:func 8
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
    ((((((2 -thRWNotIn UsedIntLoc swap(a2,1 -thRWNotIn {a1,a2})) := a1) ';' SubFrom(a2,a2)) ';' ((1 -thRWNotIn {a1,a2}) := intloc 0)) ';' ((1 -thRWNotIn UsedIntLoc swap(a2,1 -thRWNotIn {a1,a2})) := (2 -thRWNotIn UsedIntLoc swap(a2,1 -thRWNotIn {a1,a2})))) ';' Times(1 -thRWNotIn UsedIntLoc swap(a2,1 -thRWNotIn {a1,a2}),(AddTo(a2,1 -thRWNotIn {a1,a2})) ';' swap(a2,1 -thRWNotIn {a1,a2}))) ';' (a1 := (2 -thRWNotIn UsedIntLoc swap(a2,1 -thRWNotIn {a1,a2})));
end;

:: SFMASTR1:def 5
theorem
for b1, b2 being Int-Location holds
Fib_macro(b1,b2) = ((((((2 -thRWNotIn UsedIntLoc swap(b2,1 -thRWNotIn {b1,b2})) := b1) ';' SubFrom(b2,b2)) ';' ((1 -thRWNotIn {b1,b2}) := intloc 0)) ';' ((1 -thRWNotIn UsedIntLoc swap(b2,1 -thRWNotIn {b1,b2})) := (2 -thRWNotIn UsedIntLoc swap(b2,1 -thRWNotIn {b1,b2})))) ';' Times(1 -thRWNotIn UsedIntLoc swap(b2,1 -thRWNotIn {b1,b2}),(AddTo(b2,1 -thRWNotIn {b1,b2})) ';' swap(b2,1 -thRWNotIn {b1,b2}))) ';' (b1 := (2 -thRWNotIn UsedIntLoc swap(b2,1 -thRWNotIn {b1,b2})));

:: SFMASTR1:th 24
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;