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 Th42:
  for s being State of SCMPDS,I being Program of SCMPDS,a being
  Int_position, i being Integer,n be Nat st s.DataLoc(s.a,i) <= 0
  holds for-down(a,i,n,I) is_closed_on s,P
   & for-down(a,i,n,I) is_halting_on s,P
proof
  let s be State of SCMPDS,I be Program of SCMPDS,a be Int_position, i be
  Integer,n be Nat;
  set d1=DataLoc(s.a,i);
  assume
A1: s.d1 <= 0;
  set i1=(a,i)<=0_goto (card I+3), i2=AddTo(a,i,-n), i3=goto -(card I+2);
  set FOR=for-down(a,i,n,I), pFOR=stop FOR,
  s3 = Initialize s, P3 = P +* pFOR,
  s4 = Comput(P3,s3,1), P4 = P3;
A2: IC s3 = 0 by MEMSTR_0:def 11;
A3: not d1 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,i)=s3.d1 by FUNCT_4:11
    .= s.d1 by A3,FUNCT_4:11;
A5: FOR = i1 ';' (I ';' i2 ';' i3) by Th2;
  Comput(P3, s3,(0 qua Nat)+1) = Following(P3,
  Comput(P3,s3,0)) by EXTPRO_1:3
    .= Exec(i1,s3) by A5,SCMPDS_6:11;
  then
A6: IC s4 = ICplusConst(s3,(card I+3)) by A1,A4,SCMPDS_2:56
    .= ((0 qua Nat)+(card I+3)) by A2,SCMPDS_6:12;
A7: card FOR=card I+3 by Th39;
  then
A8: (card I+3) in dom pFOR by COMPOS_1:64;
  pFOR c= P3 by FUNCT_4:25;
  then P4.(card I+3) = pFOR.(card I+3) by A8,GRFUNC_1:2
    .=halt SCMPDS by A7,COMPOS_1:64;
  then
A9: CurInstr(P4,s4) = halt SCMPDS by A6,PBOOLE:143;
  now
    let k be Nat;
    per cases;
    suppose
      0 < k;
      then 1+(0 qua Nat) <= k by INT_1:7;
      hence IC Comput(P3,s3,k) in dom pFOR
      by A8,A6,A9,EXTPRO_1:5;
    end;
    suppose
      k = 0;
      then Comput(P3,s3,k) = s3;
      hence IC Comput(P3,s3,k) in dom pFOR by A2,COMPOS_1:36;
    end;
  end;
  hence FOR is_closed_on s,P by SCMPDS_6:def 2;
  P3 halts_on s3 by A9,EXTPRO_1:29;
  hence thesis by SCMPDS_6:def 3;
end;
