reserve p,p1,p2,h for Instruction-Sequence of SCM+FSA;
reserve k, l, n for Nat,
  j for Integer,
  i,i1 for Instruction of SCM+FSA;
reserve s, s1, s2 for State of SCM+FSA,
  a for read-write Int-Location,
  b for Int-Location,
  I, J for MacroInstruction of SCM+FSA,
  Ig for good MacroInstruction of SCM+FSA,
  i, j, k, m, n for Nat;
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, n for Nat;
reserve a for read-write Int-Location;

theorem Th52:
 for J being good really-closed MacroInstruction of SCM+FSA holds
  J does not destroy a & ProperTimesBody a,J,s,p
  implies for k st k <= s.a holds StepTimes(a,J,p,s).k.a+k = s.a
proof let J be good really-closed MacroInstruction of SCM+FSA;
  set I = J;
  assume that
A1: J does not destroy a and
A2: ProperTimesBody a,I,s,p;
  set Is = Initialized s;
  set ST = StepTimes(a,I,p,s);
  set SW = StepWhile>0(a, I ";" SubFrom(a, intloc 0),p,Is);
  defpred X[Nat] means $1 <= s.a implies StepTimes(a,I,p,s).$1.a+
  $1 = s.a;
A3: for k being Nat st X[k] holds X[k+1]
  proof
    let k be Nat such that
A4: k <= s.a implies ST.k.a+k = s.a and
A5: k+1 <= s.a;
    reconsider sa = s.a as Element of NAT by A5,INT_1:3;
A6: k < sa by A5,NAT_1:13;
    then
A7: ST.k.intloc 0 = 1 by A1,A2,Th51;
A8: now
      assume SW.k.a <= 0;
      then SW.k.a+k < s.a+0 by A6,XREAL_1:8;
      hence contradiction by A4,A6;
    end;
    I is_halting_on ST.k,p+*Times(a,I) by A2,A6;
    then
A9: I is_halting_on Initialized ST.k,p+*Times(a,I) by A7,SCMFSA8B:42;
    Macro SubFrom(a, intloc 0)
     is_halting_on IExec(I,p+*Times(a,I),ST.k),p+*Times(a,I) by SCMFSA7B:19;
    then
    I ";" SubFrom(a, intloc 0) is_halting_on Initialized ST.k,p+*Times(a,I)
     by A9,SFMASTR1:3;
    then
    DataPart SW.(k+1)
     = DataPart IExec(I ";" SubFrom(a,intloc 0),p+*Times(a,I),ST.k)
    by A7,A8,Th32;
    then ST.(k+1).a = IExec(I ";" SubFrom(a,intloc 0),p+*Times(a,I),ST.k).a
            by SCMFSA_M:2
      .= Exec(SubFrom(a, intloc 0),
            IExec(I,p+*Times(a,I),ST.k)).a by A9,SFMASTR1:11
      .= IExec(I,p+*Times(a,I),ST.k).a -
       IExec(I,p+*Times(a,I),ST.k).intloc 0
       by SCMFSA_2:65
      .= IExec(I,p+*Times(a,I),ST.k).a - 1 by A9,SCMFSA8C:67
      .= (Initialized ST.k).a - 1 by A9,A1,SCMFSA8C:95
      .= ST.k.a - 1 by SCMFSA_M:37;
    hence thesis by A4,A6;
  end;
A10: X[0]
  proof
    assume 0 <= s.a;
    thus ST.0.a+0 = Is.a by SCMFSA_9:def 5
      .= s.a by SCMFSA_M:37;
  end;
  thus for k holds X[k] from NAT_1:sch 2(A10, A3);
end;
