reserve m,n for Element of NAT,
  i,j for Instruction of SCMPDS,
  I for Program
  of SCMPDS,
  a for Int_position;
reserve Q,U,P for Instruction-Sequence of SCMPDS;

theorem Th13:
  for s being State of SCMPDS,I being Program of SCMPDS,a,c being
Int_position, i being Integer st s.DataLoc(s.a,i) = 0
 holds IExec(while<>0(a,i,I),P,Initialize s) = s +* Start-At((card I+3),SCMPDS)
proof
  let s be State of SCMPDS,I be Program of SCMPDS, a,c be Int_position, i be
  Integer;
  set b=DataLoc(s.a,i);
  assume
A1: s.b = 0;
  set i1=(a,i)<>0_goto 2, i2=goto (card I+2), i3=goto -(card I+2);
  set WHL=while<>0(a,i,I), pWH=stop WHL, iWH=pWH,
  s3 = Initialize s, P3 = P +* pWH,
  s4 = Comput(P3,s3,1), s5 = Comput(P3,s3,2), P4 = P3, P5 = P3;
A2: IC s3 = 0 by MEMSTR_0:47;
A3: iWH c= P3 by FUNCT_4:25;
  then
A4: pWH c= P4;
A5: pWH c= P5 by A3;
A6: not b in dom Start-At(0,SCMPDS) by SCMPDS_4:18;
A7: WHL = i1 ';' (i2 ';' I ';' i3 ) by Lm8;
A8: Comput(P3,s3,0+1) = Following(P3,
Comput(P3,s3,0)) by EXTPRO_1:3
    .= Following(P3,s3)
    .= Exec(i1,s3) by A7,SCMPDS_6:11;
A9:  1 in dom WHL by Th10;
  then  1 in dom pWH by COMPOS_1:62;
  then
A10: P4. 1 = pWH. 1 by A4,GRFUNC_1:2
    .=WHL. 1 by A9,COMPOS_1:63
    .=i2 by Th11;
  set SAl=Start-At((card I+3),SCMPDS);
  not a in dom Start-At(0,SCMPDS) by SCMPDS_4:18;
  then s3.DataLoc(s3.a,i)=s3.b by FUNCT_4:11
    .= 0 by A1,A6,FUNCT_4:11;
  then
A11: IC s4 = IC s3 + 1 by A8,SCMPDS_2:55
    .= (0+1) by A2;
A12: P3/.IC s4 = P4.IC s4 by PBOOLE:143;
A13: Comput(P3,s3,1+1) = Following(P3,s4) by EXTPRO_1:3
    .= Exec(i2,s4) by A11,A10,A12;
  then
A14: IC s5 = ICplusConst(s4,card I+2) by SCMPDS_2:54
    .= (card I+2+1) by A11,SCMPDS_6:12
    .= (card I+(2+1));
A15: P3/.IC s5 = P5.IC s5 by PBOOLE:143;
A16: card WHL=card I+3 by Th8;
  then (card I+3) in dom pWH by COMPOS_1:64;
  then P5.(card I+3) = pWH.(card I+3) by A5,GRFUNC_1:2
    .=halt SCMPDS by A16,COMPOS_1:64;
  then
A17: CurInstr(P3,s5) = halt SCMPDS by A14,A15;
  then P3 halts_on s3 by EXTPRO_1:29;
  then
A18: s5 = Result(P3,s3) by A17,EXTPRO_1:def 9;
A19: IExec(WHL,P,Initialize s) = Result(P3,s3) by SCMPDS_4:def 5;
A20: now
    let x be object;
A21: dom SAl = {IC SCMPDS} by FUNCOP_1:13;
    assume
A22: x in dom IExec(WHL,P,Initialize s);
    per cases by A22,SCMPDS_4:6;
    suppose
A23:  x is Int_position;
      then x <> IC SCMPDS by SCMPDS_2:43;
      then
A24:  not x in dom SAl by A21,TARSKI:def 1;
A25:   not x in dom Start-At(0,SCMPDS) by A23,SCMPDS_4:18;
      thus IExec(WHL,P,Initialize s).x = s5.x by A18,A19
        .= s4.x by A13,A23,SCMPDS_2:54
        .= s3.x by A8,A23,SCMPDS_2:55
        .= s.x by A25,FUNCT_4:11
        .= (s +* SAl).x by A24,FUNCT_4:11;
    end;
    suppose
A26:  x = IC SCMPDS;
      hence IExec(WHL,P,Initialize s).x = (card I + 3) by A14,A18,A19
        .= (s +* SAl).x by A26,FUNCT_4:113;
    end;
  end;
  dom IExec(WHL,P,Initialize s) = the carrier of SCMPDS by PARTFUN1:def 2
    .= dom (s +* SAl) by PARTFUN1:def 2;
  hence thesis by A20,FUNCT_1:2;
end;
