reserve x for set,
  m,n for Nat,
  a,b for Int_position,
  i,j,k for Instruction of SCMPDS,
  s,s1,s2 for State of SCMPDS,
  k1,k2 for Integer,
  loc,l for Nat,
  I,J,K for Program of SCMPDS;
reserve P,P1,P2,Q for Instruction-Sequence of SCMPDS;

theorem Th27: :: SCMPDS_5:38
 for s being 0-started State of SCMPDS
  for I being halt-free Program of SCMPDS, J being shiftable
  Program of SCMPDS st I is_closed_on s,P & I is_halting_on s,P
   & J is_closed_on IExec(I,P,s),P & J is_halting_on IExec(I,P,s),P
 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 halt-free Program of SCMPDS,J be shiftable Program of SCMPDS;
  set
  IJ = I ';' J, s1 = s, P1 = P +* stop I,
  m1 = LifeSpan(P1,s1), P2 = P +* stop IJ,
  s3 = Initialize Comput(P1,s1,m1), P3 = P1 +* stop J,
  m3 = LifeSpan(P3,s3), sE = IExec(I,P,s);
  assume that
A1: I is_closed_on s,P and
A2: I is_halting_on s,P and
A3: J is_closed_on sE,P and
A4: J is_halting_on sE,P;
A5: Initialize s = s by MEMSTR_0:44;
A6: DataPart Comput(P2,s,m1) = DataPart(Initialize Comput(P1,s1,m1))
  by A1,A2,A3,A4,Lm1;
  J is_closed_on Comput(P1,s1,m1),P1 by A2,A3,A4,Th21,A5;
  then
A7: J is_closed_on s3,P3 by SCMPDS_6:24;
A8: stop J c= P3 by FUNCT_4:25;
A9: Shift(stop J,card I) c= P2 by A1,A2,A3,A4,Lm1;
A10: IC Comput(P2,s,m1) =  card I by A1,A2,A3,A4,Lm1;
  then
A11: IC Comput(P2, Comput(P2,s,m1),m3) = IC Comput(P3,s3,m3) + card I
  by A8,A6,A9,A7,SCMPDS_6:31;
A12: DataPart Comput(P2, Comput(
P2,s,m1),m3) = DataPart Comput(P3,s3,m3)
 by A8,A10,A6,A9,A7,SCMPDS_6:31;
  set R1=Initialize IExec(I,P,s),
      R2=Initialize Result(P1,s1);
A13: stop J c= P+*stop J by FUNCT_4:25;
A14: stop J c= P1+*stop J by FUNCT_4:25;
A15: P1 halts_on s1 by A2,A5,SCMPDS_6:def 3;
  then
A16: s3 = Initialize Result(P1,s1) by EXTPRO_1:23;
A17: DataPart sE = DataPart Initialize sE by MEMSTR_0:45;
  then
A18: J is_closed_on Initialize sE, P +* stop J by A3,A4,SCMPDS_6:23;
A19: J is_halting_on Initialize sE, P +* stop J
          by A3,A4,A17,SCMPDS_6:23;
  IJ is_halting_on s,P by A1,A2,A3,A4,Th22,A5;
  then
A20: P2 halts_on s by A5,SCMPDS_6:def 3;
  J is_halting_on Comput(P1,s1,m1), P1 by A2,A3,A4,Th21,A5;
  then
A21: P3 halts_on s3 by SCMPDS_6:def 3;
A22:  IExec(I,P,s) =  Comput(P1,s1,m1) by A15,EXTPRO_1:23;
  Result(P +* stop J,Initialize IExec(I,P,s))
   = Result(P3,s3) by A13,A14,A18,A19,Th8,A22;
  then
A23: IExec(J,P,Initialize IExec(I,P,s)) = Comput(P3,s3,m3)
 by A21,EXTPRO_1:23;
A24: IC IExec(I ';' J,P,s)
     = IC Comput(P2,s,LifeSpan(P2,s)) by A20,EXTPRO_1:23
    .= IC Comput(P2,s,m1+m3) by A1,A2,A3,A4,A16,Lm1
    .= IC Comput(P3,s3,m3) + card I by A11,EXTPRO_1:4
    .= IC Result(P3,s3) + card I by A21,EXTPRO_1:23
    .= IC Result(P1 +* stop J, Initialize Result(P1,s1)) + card I
     by A15,EXTPRO_1:23
    .= IC IExec(J,P,Initialize IExec(I,P,s)) + card I by A13,A14,A18,A19,Th8;
  IExec(I ';' J,P,s) = Comput(P2,s,LifeSpan(P2,s))
   by A20,EXTPRO_1:23
    .= Comput(P2,s,m1+m3) by A1,A2,A3,A4,A16,Lm1;
  then
A25: DataPart IExec(I ';' J,P,s)
    = DataPart IExec(J,P,Initialize IExec(I,P,s)) by A23,A12,EXTPRO_1:4;
  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;
