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 Th14:
  s.intloc 0 = 1 implies for aux being read-write Int-Location st
aux = 1-stRWNotIn ({a, bb, cc} \/ UsedILoc I)
 holds DataPart IExec( aux := cc
";" SubFrom(aux, bb) ";" AddTo(aux, intloc 0) ";" (a := bb),p,s)
 = DataPart(s+*(aux, s.cc-s.bb+1)+*(a, s.bb))
proof
  assume
A1: s.intloc 0 = 1;
  cc = intloc 0 or cc is read-write by SCMFSA_M:def 2;
  then
A2: (Initialized s).cc = s.cc by A1,SCMFSA_M:9,37;
  set i3 = a := bb;
  let aux be read-write Int-Location such that
A3: aux = 1-stRWNotIn ({a, bb, cc} \/ UsedILoc I);
  bb in {a, bb, cc} by ENUMSET1:def 1;
  then bb in {a, bb, cc} \/ UsedILoc I by XBOOLE_0:def 3;
  then
A4: bb <> aux by A3,SCMFSA_M:25;
  set s2 = s+*(aux, s.cc-s.bb+1)+*(a, s.bb);
A5: aux in dom s by SCMFSA_2:42;
  a in {a, bb, cc} by ENUMSET1:def 1;
  then a in {a, bb, cc} \/ UsedILoc I by XBOOLE_0:def 3;
  then
A6: a <> aux by A3,SCMFSA_M:25;
  then
A7: s2.aux = (s+*(aux, s.cc-s.bb+1)).aux by FUNCT_7:32
    .= s.cc-s.bb+1 by A5,FUNCT_7:31;
  set i2 = AddTo(aux, intloc 0);
  set i1 = SubFrom(aux, bb);
  set i0 = aux := cc;
  set s1 = IExec(i0 ";" i1 ";" i2 ";" i3,p,s);
A8: IExec(i0 ";" i1,p,s).intloc 0
 = Exec(i1, Exec(i0, Initialized s)).intloc 0
  by SCMFSA6C:8
    .= Exec(i0, Initialized s).intloc 0 by SCMFSA_2:65
    .= (Initialized s).intloc 0 by SCMFSA_2:63
    .= 1 by SCMFSA_M:9;
A9: a in dom (s+*(aux, s.cc-s.bb+1)) by SCMFSA_2:42;
  bb = intloc 0 or bb is read-write by SCMFSA_M:def 2;
  then
A10: (Initialized s).bb = s.bb by A1,SCMFSA_M:9,37;
A11: s1.a = Exec(i3, IExec(i0 ";" i1 ";" i2,p,s)).a by SCMFSA6C:6
    .= IExec(i0 ";" i1 ";" i2,p,s).bb by SCMFSA_2:63
    .= Exec(i2, IExec(i0 ";" i1,p,s)).bb by SCMFSA6C:6
    .= IExec(i0 ";" i1,p,s).bb by A4,SCMFSA_2:64
    .= Exec(i1, Exec(i0, Initialized s)).bb by SCMFSA6C:8
    .= Exec(i0, Initialized s).bb by A4,SCMFSA_2:65
    .= s.bb by A4,A10,SCMFSA_2:63;
A12: s1.aux = Exec(i3, IExec(i0 ";" i1 ";" i2,p,s)).aux by SCMFSA6C:6
    .= IExec(i0 ";" i1 ";" i2,p,s).aux by A6,SCMFSA_2:63
    .= Exec(i2, IExec(i0 ";" i1,p,s)).aux by SCMFSA6C:6
    .= IExec(i0 ";" i1,p,s).aux + 1 by A8,SCMFSA_2:64
    .= Exec(i1, Exec(i0, Initialized s)).aux +1 by SCMFSA6C:8
    .= Exec(i0, Initialized s).aux - Exec(i0, Initialized s).bb +1
    by SCMFSA_2:65
    .= (Initialized s).cc - Exec(i0, Initialized s).bb +1 by SCMFSA_2:63
    .= s.cc-s.bb+1 by A4,A2,A10,SCMFSA_2:63;
  now
    hereby
      let x be Int-Location;
      per cases;
      suppose
        x = a;
        hence s1.x = s2.x by A11,A9,FUNCT_7:31;
      end;
      suppose
        x = aux;
        hence s1.x = s2.x by A12,A7;
      end;
      suppose
A13:    x <> aux & x <> a;
        then
A14:    s2.x = (s+*(aux, s.cc-s.bb+1)).x by FUNCT_7:32
          .= s.x by A13,FUNCT_7:32;
A15:    x = intloc 0 or x is read-write by SCMFSA_M:def 2;
        s1.x = Exec(i3, IExec(i0 ";" i1 ";" i2,p,s)).x by SCMFSA6C:6
          .= IExec(i0 ";" i1 ";" i2,p,s).x by A13,SCMFSA_2:63
          .= Exec(i2, IExec(i0 ";" i1,p,s)).x by SCMFSA6C:6
          .= IExec(i0 ";" i1,p,s).x by A13,SCMFSA_2:64
          .= Exec(i1, Exec(i0, Initialized s)).x by SCMFSA6C:8
          .= Exec(i0, Initialized s).x by A13,SCMFSA_2:65
          .= (Initialized s).x by A13,SCMFSA_2:63
          .= s.x by A1,A15,SCMFSA_M:9,37;
        hence s1.x = s2.x by A14;
      end;
    end;
    let x be FinSeq-Location;
    thus s1.x = Exec(i3, IExec(i0 ";" i1 ";" i2,p,s)).x by SCMFSA6C:7
      .= IExec(i0 ";" i1 ";" i2,p,s).x by SCMFSA_2:63
      .= Exec(i2, IExec(i0 ";" i1,p,s)).x by SCMFSA6C:7
      .= IExec(i0 ";" i1,p,s).x by SCMFSA_2:64
      .= Exec(i1, Exec(i0, Initialized s)).x by SCMFSA6C:9
      .= Exec(i0, Initialized s).x by SCMFSA_2:65
      .= (Initialized s).x by SCMFSA_2:63
      .= s.x by SCMFSA_M:37
      .= (s+*(aux, s.cc-s.bb+1)).x by FUNCT_7:32,SCMFSA_2:58
      .= s2.x by FUNCT_7:32,SCMFSA_2:58;
  end;
  hence thesis by SCMFSA_M:2;
end;
