reserve s, s1, s2 for State of SCM+FSA,
  p, p1 for Instruction-Sequence of SCM+FSA,
  a, b for Int-Location,
  d for read-write Int-Location,
  f for FinSeq-Location,
  I for MacroInstruction of SCM+FSA,
  J for good MacroInstruction of SCM+FSA,
  k, m for Nat;

theorem Th13:
 for J being good really-closed MacroInstruction of SCM+FSA holds
  (s.intloc 0 = 1 or a is read-write) & ProperTimesBody a,J,s,p
  implies for k st k <= s.a holds StepTimes(a,J,p,s).k.(1-stRWNotIn({a} \/
  UsedILoc J))+k = s.a
proof let J be good really-closed MacroInstruction of SCM+FSA;
  set I = J;
  assume that
A1: s.intloc 0 = 1 or a is read-write and
A2: ProperTimesBody a,I,s,p;
  set Is = Initialized s;
  set au = 1-stRWNotIn ({a} \/ UsedILoc I);
  set ST = StepTimes(a,I,p,s);
  set SW = StepWhile>0(au, I ";" SubFrom(au, intloc 0),p,Exec(au := a, Is));
  defpred X[Nat] means $1 <= s.a implies StepTimes(a,I,p,s).$1.au+
  $1 = s.a;
A3: for k being Nat st X[k] holds X[k+1]
  proof
    not au in {a} \/ UsedILoc I by SCMFSA_M:25;
    then
A4: not au in UsedILoc I by XBOOLE_0:def 3;
    let k be Nat such that
A5: k <= s.a implies ST.k.au+k = s.a and
A6: k+1 <= s.a;
    reconsider sa = s.a as Element of NAT by A6,INT_1:3;
A7: k < sa by A6,NAT_1:13;
    then
A8: ST.k.intloc 0 = 1 by A2,Th12;
A9: now
      assume SW.k.au <= 0;
      then SW.k.au+k < s.a+0 by A7,XREAL_1:8;
      hence contradiction by A5,A7;
    end;
    I is_halting_on ST.k,p+*times*(a,I) by A2,A7;
    then
A10: I is_halting_on Initialized ST.k,p+*times*(a,I) by A8,SCMFSA8B:42;
    Macro SubFrom(au, intloc 0)
     is_halting_on IExec(I,p+*times*(a,I),ST.k),p+*times*(a,I) by SCMFSA7B:19;
    then
    I ";" SubFrom(au, intloc 0) is_halting_on Initialized ST.k,p+*times*(a,I)
     by A10,SFMASTR1:3;
    then
    DataPart SW.(k+1)
     = DataPart IExec(I ";" SubFrom(au,intloc 0),p+*times*(a,I),ST.k)
    by A8,A9,SCMFSA9A:32;
    then ST.(k+1).au = IExec(I ";" SubFrom(au,intloc 0),p+*times*(a,I),ST.k).au
            by SCMFSA_M:2
      .= Exec(SubFrom(au, intloc 0),
            IExec(I,p+*times*(a,I),ST.k)).au by A10,SFMASTR1:11
      .= IExec(I,p+*times*(a,I),ST.k).au -
       IExec(I,p+*times*(a,I),ST.k).intloc 0
       by SCMFSA_2:65
      .= IExec(I,p+*times*(a,I),ST.k).au - 1 by A10,SCMFSA8C:67
      .= (Initialized ST.k).au - 1 by A10,A4,Th1
      .= ST.k.au - 1 by SCMFSA_M:37;
    hence thesis by A5,A7;
  end;
A11: a = intloc 0 or a is read-write by SCMFSA_M:def 2;
A12: X[0]
  proof
    assume 0 <= s.a;
    thus ST.0.au+0 = Exec(au := a, Is).au by SCMFSA_9:def 5
      .= Is.a by SCMFSA_2:63
      .= s.a by A1,A11,SCMFSA_M:9,37;
  end;
  thus for k holds X[k] from NAT_1:sch 2(A12, A3);
end;
