reserve s for State of SCM+FSA,
  a, c for read-write Int-Location,
  aa, bb, cc,
  dd, x for Int-Location,
  f for FinSeq-Location,
  I, J for MacroInstruction of SCM+FSA,
  Ig for good MacroInstruction of SCM+FSA,
  i, k for Nat,
  p for Instruction-Sequence of SCM+FSA;

theorem Th18:
 for Ig being good really-closed MacroInstruction of SCM+FSA holds
  s.intloc 0 = 1 & ProperForUpBody a,bb,cc,Ig,s,p implies for k
holds StepForUp(a,bb,cc,Ig,p,s).k.(1-stRWNotIn({a, bb, cc} \/ UsedILoc Ig))
  > 0 iff k < s.cc-s.bb+1
proof let Ig be good really-closed MacroInstruction of SCM+FSA;
  set I = Ig;
  set SF = StepForUp(a,bb,cc,I,p,s);
  set aux = (1-stRWNotIn ({a, bb, cc} \/ UsedILoc I));
  set s2 = s+*(aux, s.cc-s.bb+1)+*(a, s.bb),
      p2 = p;
  set IB = I ";" AddTo(a, intloc 0) ";" SubFrom(aux, intloc 0);
  set SW2 = StepWhile>0(aux,IB,p2,s2);
  set scb1 = s.cc-s.bb+1;
  defpred P[Nat] means SF.$1.aux > 0 implies $1 < scb1;
  assume
A1: s.intloc 0 = 1 & ProperForUpBody a,bb,cc,I,s,p;
A2: for k st P[k] holds P[k+1]
  proof
    let k such that
A3: P[k] and
A4: SF.(k+1).aux > 0;
A5: SF.k.aux > 0
    proof
      assume
A6:   SF.k.aux <= 0;
      then DataPart SF.(k+1) = DataPart SF.k by SCMFSA9A:31;
      hence contradiction by A4,A6,SCMFSA_M:2;
    end;
    then reconsider scb1 as Element of NAT by A3,INT_1:3;
    assume k+1 >= s.cc-s.bb+1;
    then
A7: SF.(k+1).aux+(k+1) > 0+scb1 by A4,XREAL_1:8;
    k+1 <= scb1 by A3,A5,NAT_1:13;
    hence contradiction by A1,A7,Th17;
  end;
  let k;
  a in {a, bb, cc} by ENUMSET1:def 1;
  then a in {a, bb, cc} \/ UsedILoc I by XBOOLE_0:def 3;
  then
A8: aux <> a by SCMFSA_M:25;
A9: aux in dom s by SCMFSA_2:42;
A10: P[0]
  proof
    SW2.0 = s2 by SCMFSA_9:def 5;
    then
A11: SF.0.aux = (s+*(aux, s.cc-s.bb+1)).aux by A8,FUNCT_7:32
      .= scb1 by A9,FUNCT_7:31;
    assume SF.0.aux > 0;
    hence thesis by A11;
  end;
  for k holds P[k] from NAT_1:sch 2(A10, A2);
  hence P[k];
  assume
A12: k < scb1;
  then
A13: k-k < scb1-k by XREAL_1:9;
  SF.k.aux + k = scb1 by A1,A12,Th17;
  hence thesis by A13;
end;
