reserve x for set,
  m,n for Nat,
  a,b,c for Int_position,
  i for Instruction of SCMPDS,
  s,s1,s2 for State of SCMPDS,
  k1,k2 for Integer,
  loc,l1 for Nat,
  I,J for Program of SCMPDS,
  N for with_non-empty_elements set;
reserve P,P1,P2,Q for Instruction-Sequence of SCMPDS;

theorem Th22:
  for s being 0-started State of SCMPDS
  for I being parahalting halt-free Program of SCMPDS,J being
parahalting shiftable Program of SCMPDS holds IExec(I ';' J,P,s)
 = IncIC(IExec(J,P,Initialize IExec(I,P,s)),card I)
proof
  let s be 0-started State of SCMPDS;
  let I be parahalting halt-free Program of SCMPDS,J be parahalting
  shiftable Program of SCMPDS;
  set A = NAT, D = SCM-Data-Loc, sI = stop I,
   sIJ = stop (I ';' J), P1 = P +* stop I,
   m1 = LifeSpan(P1,s), P2 = P +* stop(I ';' J),
   s3 = Initialize Comput(P1,s,m1), P3 = P1 +* stop J,
   m3 = LifeSpan(P3,s3);
A1: stop J c= P3 by FUNCT_4:25;
  then
A2: P3 halts_on s3 by SCMPDS_4:def 7;
A3: stop J c= P +* stop J by FUNCT_4:25;
A4: stop I c= P1 by FUNCT_4:25;
  then
  P1 halts_on s by SCMPDS_4:def 7;
  then
A5: Initialize Comput(P1,s,m1)
      = Initialize IExec(I,P,s) by EXTPRO_1:23;
A6:  Result(P +* stop J,Initialize IExec(I,P,s))
   =  Result(P3,s3) by A1,A3,Th6,A5;
A7: stop I c= P2 +* stop I by FUNCT_4:25;
A8: P2 +* stop I +* sIJ = P2 +* (stop I +* sIJ) by FUNCT_4:14
      .= P2 +* sIJ by Th3;
A9: LifeSpan(P2 +* stop I,s) = m1 by A4,A7,Th6;
 set S1=s,
     E1 = P2 +* stop I;
A10:  Comput(P1,s,m1)
  =  Comput(P1 +* stop(I ';' J), s,m1) by Th8,FUNCT_4:25;
A11:  P +* stop I +* sIJ =  P +* (stop I +* sIJ) by FUNCT_4:14
        .= P +* (sIJ +* sIJ) by Th3
        .= P2 +* stop I +* sIJ by A8;
A12: DataPart(Comput(P2 +* stop I,s,m1))
      = DataPart Comput(P1, s,m1) by A11,A10,A9,Th8,FUNCT_4:25;
A13: sIJ c= P2 by FUNCT_4:25;
  then
A14: DataPart Comput(P2,s,m1)
     = DataPart(Initialize Comput(P2 +* stop I,s,m1)) by A9,Lm4
    .= DataPart(Comput(P2 +* stop I, s,m1)) by MEMSTR_0:45;
A15: Shift(stop J,card I) c= P2 by A13,A7,Lm4;
A16: IC Comput(P2,s,m1) =  card I by A13,A9,Lm4;
A17: DataPart Initialize Comput(P1,s,m1)
     = DataPart Comput(P2,s,m1) by A12,A14,MEMSTR_0:45;
  then
A18: IC Comput(P2, Comput(P2,s,m1),m3) = IC Comput(P3,s3,m3) + card I
        by A15,A1,A16,SCMPDS_4:29;
A19: DataPart Comput(P2, Comput(P2,s,m1),m3) = DataPart Comput(P3,s3,m3)
   by A16,A15,A1,A17,SCMPDS_4:29;
A20: P1 halts_on s by A4,SCMPDS_4:def 7;
   then
A21: s3 = Initialize Result(P1,s) by EXTPRO_1:23;
 set SS1 = Initialize Result(P1,s) +* stop J,
     SS2 = Initialize IExec(I,P,s) +* stop J;
A22: IC Result(P1 +* stop J,Initialize Result(P1,s))
= IC Result(P +* stop J,Initialize IExec(I,P,s)) by Th6,A1,A3;
A23: P2 halts_on s
     by A13,SCMPDS_4:def 7;
A24: IC IExec(I ';' J,P,s)
     = IC Comput(P2,s,LifeSpan(P2,s)) by A23,EXTPRO_1:23
    .= IC Comput(P2,s,m1+m3) by A21,Th21
    .= IC Comput(P3,s3,m3) + card I by A18,EXTPRO_1:4
    .= IC Result(P3,s3) + card I by A2,EXTPRO_1:23
    .= IC IExec(J,P,Initialize IExec(I,P,s)) + card I
          by A22,A20,EXTPRO_1:23;
  IExec(I ';' J,P,s) = Comput(P2,s,LifeSpan(P2,s))
    by A23,EXTPRO_1:23
    .= Comput(P2,s,m1+m3) by A21,Th21;
  then
A25: DataPart IExec(I ';' J,P,s)
     = DataPart Comput(P3,s3,m3) by A19,EXTPRO_1:4
    .= DataPart IExec(J,P,Initialize IExec(I,P,s))
      by A6,A2,EXTPRO_1:23;
  hereby
    reconsider l = IC IExec(J,P,Initialize IExec(I,P,s)) + card I
     as Nat;
A26: dom Start-At(l,SCMPDS) = {IC SCMPDS} by FUNCOP_1:13;
A27: now
      let x be object;
      assume
A28:  x in dom IExec(I ';' J,P,s);
      per cases by A28,SCMPDS_4:6;
      suppose
A29:    x is Int_position;
        then x <> IC SCMPDS by SCMPDS_2:43;
        then
A30:    not x in dom Start-At(l,SCMPDS) by A26,TARSKI:def 1;
        IExec(I ';' J,P,s).x
         = IExec(J,P,Initialize IExec(I,P,s)).x
        by A25,A29,SCMPDS_4:8;
        hence
        IExec(I ';' J,P,s).x
         = (IncIC(IExec(J,P,Initialize IExec(I,P,s)),card I)).x
           by A30,FUNCT_4:11;
      end;
      suppose
A31:    x = IC SCMPDS;
        then x in {IC SCMPDS} by TARSKI:def 1;
        then
A32:    x in dom Start-At(l,SCMPDS) by FUNCOP_1:13;
        thus IExec(I ';' J,P,s).x = (Start-At(l,SCMPDS)).IC SCMPDS
        by A24,A31,FUNCOP_1:72
          .= (IncIC(IExec(J,P,Initialize IExec(I,P,s)),card I)).x
           by A31,A32,FUNCT_4:13;
      end;
    end;
    dom IExec(I ';' J,P,s) = the carrier of SCMPDS by PARTFUN1:def 2
      .= dom IncIC(IExec(J,P,Initialize IExec(I,P,s)),card I)
                by PARTFUN1:def 2;
    hence thesis by A27,FUNCT_1:2;
  end;
end;
