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

theorem Th100:
  for s being State of SCMPDS,I being Program of SCMPDS, a being
  Int_position, k1 being Integer st s.DataLoc(s.a,k1) >= 0 holds if<0(a,k1,I)
  is_closed_on s,P & if<0(a,k1,I) is_halting_on s,P
proof
  let s be State of SCMPDS,I be Program of SCMPDS, a be Int_position,k1 be
  Integer;
  set b=DataLoc(s.a,k1);
  assume
A1: s.b >= 0;
  set i = (a,k1)>=0_goto (card I + 1);
  set IF=if<0(a,k1,I), pIF=stop IF, s3 = Initialize s,
  P3 = P +* pIF,
  s4 = Comput(P3,s3,1), P4 = P3;
A2: IC s3 = 0 by MEMSTR_0:47;
A3: 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
A4: s3.DataLoc(s3.a,k1)=s3.b by FUNCT_4:11
    .= s.b by A3,FUNCT_4:11;
  Comput(P3, s3,0 + 1) = Following(P3,Comput(P3,s3,0)) by EXTPRO_1:3
    .= Following(P3,s3) by EXTPRO_1:2
    .= Exec(i,s3) by Th3;
  then
A5: IC s4 = ICplusConst(s3,card I + 1) by A1,A4,SCMPDS_2:57
    .= (0+(card I + 1)) by A2,Th4;
A6: card IF=card I+1 by Th1;
  then
A7: (card I+1) in dom pIF by COMPOS_1:64;
A8:  P3/.IC s4
 = P3.IC s4 by PBOOLE:143;
  pIF c= P3 by FUNCT_4:25;
  then pIF c= P4;
  then P4.(card I+1) = pIF.(card I+1) by A7,GRFUNC_1:2
    .=halt SCMPDS by A6,COMPOS_1:64;
  then
A9: CurInstr(P3,s4) = halt SCMPDS by A5,A8;
  now
    let k be Nat;
    per cases;
    suppose
      0 < k;
      then 1+0 <= k by INT_1:7;
      hence IC Comput(P3,s3,k) in dom pIF by A7,A5,A9,EXTPRO_1:5;
    end;
    suppose
      k = 0;
      then Comput(P3,s3,k) = s3 by EXTPRO_1:2;
      hence IC Comput(P3,s3,k) in dom pIF by A2,COMPOS_1:36;
    end;
  end;
  hence IF is_closed_on s,P;
  P3 halts_on s3 by A9,EXTPRO_1:29;
  hence thesis;
end;
