Article SCMFSA_7, MML version 4.99.1005

:: SCMFSA_7:funcnot 1 => SCMFSA_7:func 1
definition
  let a1 be FinSequence of the Instructions of SCM+FSA;
  func Load A1 -> finite Element of sproduct the Object-Kind of SCM+FSA means
    proj1 it = {b1 -' 1 where b1 is Element of NAT: b1 in dom a1} &
     (for b1 being Element of NAT
           st b1 in proj1 it
        holds it . b1 = a1 /. (b1 + 1));
end;

:: SCMFSA_7:def 1
theorem
for b1 being FinSequence of the Instructions of SCM+FSA
for b2 being finite Element of sproduct the Object-Kind of SCM+FSA holds
      b2 = Load b1
   iff
      proj1 b2 = {b3 -' 1 where b3 is Element of NAT: b3 in dom b1} &
       (for b3 being Element of NAT
             st b3 in proj1 b2
          holds b2 . b3 = b1 /. (b3 + 1));

:: SCMFSA_7:th 25
theorem
for b1 being FinSequence of the Instructions of SCM+FSA holds
   card Load b1 = len b1;

:: SCMFSA_7:th 26
theorem
for b1 being FinSequence of the Instructions of SCM+FSA
for b2 being Element of NAT holds
      b2 in proj1 Load b1
   iff
      b2 + 1 in dom b1;

:: SCMFSA_7:th 29
theorem
for b1 being FinSequence of the Instructions of SCM+FSA
for b2 being Element of NAT holds
      b2 in proj1 Load b1
   iff
      b2 < len b1;

:: SCMFSA_7:th 30
theorem
for b1 being non empty FinSequence of the Instructions of SCM+FSA holds
   1 in dom b1 & insloc 0 in proj1 Load b1;

:: SCMFSA_7:th 31
theorem
for b1, b2 being FinSequence of the Instructions of SCM+FSA holds
Load b1 c= Load (b1 ^ b2);

:: SCMFSA_7:th 32
theorem
for b1, b2 being FinSequence of the Instructions of SCM+FSA
      st b1 c= b2
   holds Load b1 c= Load b2;

:: SCMFSA_7:funcnot 2 => SCMFSA_7:func 2
definition
  let a1 be Int-Location;
  let a2 be integer set;
  func A1 := A2 -> finite Element of sproduct the Object-Kind of SCM+FSA means
    ex b1 being Element of NAT st
       b1 + 1 = a2 &
        it = Load ((<*a1 := intloc 0*> ^ (b1 |-> AddTo(a1,intloc 0))) ^ <*halt SCM+FSA*>)
    if 0 < a2
    otherwise ex b1 being Element of NAT st
       b1 + a2 = 1 &
        it = Load ((<*a1 := intloc 0*> ^ (b1 |-> SubFrom(a1,intloc 0))) ^ <*halt SCM+FSA*>);
end;

:: SCMFSA_7:def 2
theorem
for b1 being Int-Location
for b2 being integer set
for b3 being finite Element of sproduct the Object-Kind of SCM+FSA holds
   (b2 <= 0 or    (b3 = b1 := b2
    iff
       ex b4 being Element of NAT st
          b4 + 1 = b2 &
           b3 = Load ((<*b1 := intloc 0*> ^ (b4 |-> AddTo(b1,intloc 0))) ^ <*halt SCM+FSA*>))) &
    (b2 <= 0 implies    (b3 = b1 := b2
    iff
       ex b4 being Element of NAT st
          b4 + b2 = 1 &
           b3 = Load ((<*b1 := intloc 0*> ^ (b4 |-> SubFrom(b1,intloc 0))) ^ <*halt SCM+FSA*>)));

:: SCMFSA_7:funcnot 3 => SCMFSA_7:func 3
definition
  let a1 be Int-Location;
  let a2 be integer set;
  func aSeq(A1,A2) -> FinSequence of the Instructions of SCM+FSA means
    ex b1 being Element of NAT st
       b1 + 1 = a2 &
        it = <*a1 := intloc 0*> ^ (b1 |-> AddTo(a1,intloc 0))
    if 0 < a2
    otherwise ex b1 being Element of NAT st
       b1 + a2 = 1 &
        it = <*a1 := intloc 0*> ^ (b1 |-> SubFrom(a1,intloc 0));
end;

:: SCMFSA_7:def 3
theorem
for b1 being Int-Location
for b2 being integer set
for b3 being FinSequence of the Instructions of SCM+FSA holds
   (b2 <= 0 or    (b3 = aSeq(b1,b2)
    iff
       ex b4 being Element of NAT st
          b4 + 1 = b2 &
           b3 = <*b1 := intloc 0*> ^ (b4 |-> AddTo(b1,intloc 0)))) &
    (b2 <= 0 implies    (b3 = aSeq(b1,b2)
    iff
       ex b4 being Element of NAT st
          b4 + b2 = 1 &
           b3 = <*b1 := intloc 0*> ^ (b4 |-> SubFrom(b1,intloc 0))));

:: SCMFSA_7:th 33
theorem
for b1 being Int-Location
for b2 being integer set holds
   b1 := b2 = Load ((aSeq(b1,b2)) ^ <*halt SCM+FSA*>);

:: SCMFSA_7:funcnot 4 => SCMFSA_7:func 4
definition
  let a1 be FinSeq-Location;
  let a2 be FinSequence of INT;
  func aSeq(A1,A2) -> FinSequence of the Instructions of SCM+FSA means
    ex b1 being FinSequence of (the Instructions of SCM+FSA) * st
       len b1 = len a2 &
        (for b2 being Element of NAT
              st 1 <= b2 & b2 <= len a2
           holds ex b3 being integer set st
              b3 = a2 . b2 &
               b1 . b2 = ((aSeq(intloc 1,b2)) ^ aSeq(intloc 2,b3)) ^ <*(a1,intloc 1):= intloc 2*>) &
        it = FlattenSeq b1;
end;

:: SCMFSA_7:def 4
theorem
for b1 being FinSeq-Location
for b2 being FinSequence of INT
for b3 being FinSequence of the Instructions of SCM+FSA holds
      b3 = aSeq(b1,b2)
   iff
      ex b4 being FinSequence of (the Instructions of SCM+FSA) * st
         len b4 = len b2 &
          (for b5 being Element of NAT
                st 1 <= b5 & b5 <= len b2
             holds ex b6 being integer set st
                b6 = b2 . b5 &
                 b4 . b5 = ((aSeq(intloc 1,b5)) ^ aSeq(intloc 2,b6)) ^ <*(b1,intloc 1):= intloc 2*>) &
          b3 = FlattenSeq b4;

:: SCMFSA_7:funcnot 5 => SCMFSA_7:func 5
definition
  let a1 be FinSeq-Location;
  let a2 be FinSequence of INT;
  func A1 := A2 -> finite Element of sproduct the Object-Kind of SCM+FSA equals
    Load ((((aSeq(intloc 1,len a2)) ^ <*a1 :=<0,...,0> intloc 1*>) ^ aSeq(a1,a2)) ^ <*halt SCM+FSA*>);
end;

:: SCMFSA_7:def 5
theorem
for b1 being FinSeq-Location
for b2 being FinSequence of INT holds
   b1 := b2 = Load ((((aSeq(intloc 1,len b2)) ^ <*b1 :=<0,...,0> intloc 1*>) ^ aSeq(b1,b2)) ^ <*halt SCM+FSA*>);

:: SCMFSA_7:th 34
theorem
for b1 being Int-Location holds
   b1 := 1 = Load (<*b1 := intloc 0*> ^ <*halt SCM+FSA*>);

:: SCMFSA_7:th 35
theorem
for b1 being Int-Location holds
   b1 := 0 = Load ((<*b1 := intloc 0*> ^ <*SubFrom(b1,intloc 0)*>) ^ <*halt SCM+FSA*>);

:: SCMFSA_7:th 36
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
   st b1 . intloc 0 = 1
for b2 being Element of NAT
   st IC b1 = insloc b2
for b3 being Int-Location
for b4 being integer set
      st b3 <> intloc 0 &
         (for b5 being Element of NAT
               st b5 in dom aSeq(b3,b4)
            holds (aSeq(b3,b4)) . b5 = b1 . insloc ((b2 + b5) -' 1))
   holds (for b5 being Element of NAT
          st b5 <= len aSeq(b3,b4)
       holds IC Computation(b1,b5) = insloc (b2 + b5) &
        (for b6 being Int-Location
              st b6 <> b3
           holds (Computation(b1,b5)) . b6 = b1 . b6) &
        (for b6 being FinSeq-Location holds
           (Computation(b1,b5)) . b6 = b1 . b6)) &
    (Computation(b1,len aSeq(b3,b4))) . b3 = b4;

:: SCMFSA_7:th 37
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
   st IC b1 = insloc 0 & b1 . intloc 0 = 1
for b2 being Int-Location
for b3 being integer set
      st Load aSeq(b2,b3) c= b1 & b2 <> intloc 0
   holds (for b4 being Element of NAT
          st b4 <= len aSeq(b2,b3)
       holds IC Computation(b1,b4) = insloc b4 &
        (for b5 being Int-Location
              st b5 <> b2
           holds (Computation(b1,b4)) . b5 = b1 . b5) &
        (for b5 being FinSeq-Location holds
           (Computation(b1,b4)) . b5 = b1 . b5)) &
    (Computation(b1,len aSeq(b2,b3))) . b2 = b3;

:: SCMFSA_7:th 38
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
   st IC b1 = insloc 0 & b1 . intloc 0 = 1
for b2 being Int-Location
for b3 being integer set
      st b2 := b3 c= b1 & b2 <> intloc 0
   holds b1 is halting(NAT, {INT,INT *}, SCM+FSA) &
    (Result b1) . b2 = b3 &
    (for b4 being Int-Location
          st b4 <> b2
       holds (Result b1) . b4 = b1 . b4) &
    (for b4 being FinSeq-Location holds
       (Result b1) . b4 = b1 . b4);

:: SCMFSA_7:th 39
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
   st IC b1 = insloc 0 & b1 . intloc 0 = 1
for b2 being FinSeq-Location
for b3 being FinSequence of INT
      st b2 := b3 c= b1
   holds b1 is halting(NAT, {INT,INT *}, SCM+FSA) &
    (Result b1) . b2 = b3 &
    (for b4 being Int-Location
          st b4 <> intloc 1 & b4 <> intloc 2
       holds (Result b1) . b4 = b1 . b4) &
    (for b4 being FinSeq-Location
          st b4 <> b2
       holds (Result b1) . b4 = b1 . b4);