reserve x for Int_position,
  n,p0 for Nat;
reserve P,Q,V for Instruction-Sequence of SCMPDS;

theorem Th2:
  for s,sm be State of SCMPDS,I be halt-free shiftable Program of
  SCMPDS, a be Int_position,i be Integer, m be Nat st
  I is_closed_on s,P & I is_halting_on s,P & s.DataLoc(s.a,i) > 0 &
   m=LifeSpan(P +* stop I,Initialize s)+2 &
 sm=Comput(P +* stop while>0(a,i,I),Initialize s,m)
 holds DataPart sm = DataPart IExec(I,P,Initialize s) &
   Initialize sm=sm
proof
  let s,sm be State of SCMPDS,I be halt-free shiftable Program of SCMPDS, a
  be Int_position,i be Integer,m be Nat;
  set b=DataLoc(s.a,i);
  set WH =while>0(a,i,I), iWH= stop WH, IsI= stop I;
  set i1=(a,i)<=0_goto (card I+2), i2=goto -(card I+1);
  set s2 = Initialize s, P2 = P +* stop I,
  s3 = Initialize s, P3 = P +* stop WH,
  s4 = Comput(P3,s3,1), P4 = P3;
  assume that
A1: I is_closed_on s,P and
A2: I is_halting_on s,P and
A3: s.b > 0 and
A4: m=LifeSpan(P2,s2)+2 and
A5: sm= Comput(P3,s3,m);
A6: IsI c= P2 by FUNCT_4:25;
A7: iWH c= P3 by FUNCT_4:25;
  WH c= iWH by AFINSQ_1:74;
  then
A8: WH c= P3 by A7,XBOOLE_1:1;
  Shift(I,1) c= WH by Lm2;
  then
A9: Shift(I,1) c= P4 by A8,XBOOLE_1:1;
A10: WH = i1 ';' (I ';' i2) by Lm1;
A11: Comput(P3,s3,0+1) = Following(P3,Comput(P3,s3,0)) by EXTPRO_1:3
    .= Exec(i1,s3) by A10,SCMPDS_6:11;
  set m2=LifeSpan(P2,s2), s5= Comput(P4, s4,m2), P5 = P4,
  l1=
(card I + 1);
A12: IC s3 = 0 by MEMSTR_0:def 11;
A13:   not b in dom Start-At(0,SCMPDS) by SCMPDS_4:18;
   not a in dom Start-At(0,SCMPDS) by SCMPDS_4:18;
   then
A14: s3.DataLoc(s3.a,i)= s3.b by FUNCT_4:11
    .= s.b by A13,FUNCT_4:11;
  set m3=m2 +1;
  set s6= Comput(P3, s3,m3), P6 = P3;
A15: s6=s5 by EXTPRO_1:4;
  set s7= Comput(P3,s3,m3+1);
  card I + 1 < card I + 2 by XREAL_1:6;
  then
A16: l1 in dom WH by SCMPDS_8:18;
A17: I is_closed_on s2,P2 by A1,SCMPDS_6:24;
  for x holds s2.x = s4.x by A11,SCMPDS_2:56;
  then
A18: DataPart s2 = DataPart s4 by SCMPDS_4:8;
A19: P2 halts_on s2 by A2,SCMPDS_6:def 3;
  P2+*stop I halts_on Initialize s2
     by A2,SCMPDS_6:def 3;
  then
A20: I is_halting_on s2,P2 by SCMPDS_6:def 3;
A21: IC s4 = 0+1 by A3,A12,A11,A14,SCMPDS_2:56;
  then DataPart Comput(P2, s2,m2) = DataPart s5 by A6,A20,A17,A18,A9,
SCMPDS_7:18;
  then
A22: DataPart s5 = DataPart(Result(P2,s2)) by A19,EXTPRO_1:23
    .= DataPart IExec(I,P,Initialize s) by SCMPDS_4:def 5;
A23: IC s5=l1 by A6,A20,A17,A21,A18,A9,SCMPDS_7:18;
  then
A24: CurInstr(P6,s6)=P5.l1 by A15,PBOOLE:143
    .=WH.l1 by A16,A8,GRFUNC_1:2
    .=i2 by SCMPDS_8:19;
A25: s7 = Following(P3,s6) by EXTPRO_1:3
    .= Exec(i2,s6) by A24;
  now
    let x;
    thus sm.x=s6.x by A4,A5,A25,SCMPDS_2:54
      .=s5.x by EXTPRO_1:4;
  end;
  hence DataPart sm = DataPart IExec(I,P,Initialize s) by A22,SCMPDS_4:8;
  IC s7 =ICplusConst(s6,0-(card I+1)) by A25,SCMPDS_2:54
    .= 0 by A23,A15,SCMPDS_7:1;
  hence thesis by A4,A5,MEMSTR_0:46;
end;
