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 Th109:
  for s being State of SCMPDS, I being shiftable Program of
  SCMPDS, a being Int_position,k1 being Integer st s.DataLoc(s.a,k1) >= 0 & I
is_closed_on s,P & I is_halting_on s,P 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 shiftable Program of SCMPDS, a be
  Int_position,k1 be Integer;
  set b=DataLoc(s.a,k1);
  set IF=if>=0(a,k1,I), pIF=stop IF, pI=stop I,
   s2 = Initialize s, s3 = Initialize s,
   P2 = P +* pI, P3 = P +* pIF,
   s4 = Comput(P3,s3,1), P4 = P3;
  set i = (a,k1)>=0_goto 2, j = goto (card I + 1);
A1:  stop I c= P2 by FUNCT_4:25;
A2: IF = i ';' (j ';' I) by SCMPDS_4:16;
A3: 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 A2,Th3;
  for a holds s2.a = s4.a by A3,SCMPDS_2:57;
  then
A4: DataPart s2 = DataPart s4 by SCMPDS_4:8;
A5: 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
A6: s3.DataLoc(s3.a,k1)=s3.b by FUNCT_4:11
    .= s.b by A5,FUNCT_4:11;
A7: IC s3 = 0 by MEMSTR_0:47;
  assume
  s.b >= 0;
  then
A8: IC s4 = ICplusConst(s3,2) by A3,A6,SCMPDS_2:57
    .= (0+2) by A7,Th4;
  assume
A9: I is_closed_on s,P;
  then
A10: I is_closed_on s2,P2;
  assume
  I is_halting_on s,P;
  then
A11: P2 halts_on s2;
A12: Start-At(0,SCMPDS) c= s2 & Shift(pI,2) c= P4 by Lm7,FUNCT_4:25;
A13:  0 in dom pIF by COMPOS_1:36;
  now
    let k be Nat;
    per cases;
    suppose
      0 < k;
      then consider k1 being Nat such that
A14:  k1 + 1 = k by NAT_1:6;
      reconsider k1 as Nat;
      reconsider m = IC Comput(P2, s2,k1) as Nat;
A15:  card pIF = 1+ card IF by COMPOS_1:55
        .= 1+(card I +2) by Lm8
        .= 1+card I +2
        .=card pI+2 by COMPOS_1:55;
       m in dom pI by A9;
      then m < card pI by AFINSQ_1:66;
      then
A16:  m+2 < card pIF by A15,XREAL_1:6;
      IC Comput(P3,s3,k) = IC Comput(P3, s4,k1) by A14,EXTPRO_1:4
        .=  (m + 2) by A10,A12,A8,A4,Th22,A1;
      hence IC Comput(P3,s3,k) in dom pIF by A16,AFINSQ_1:66;
    end;
    suppose
      k = 0;
      hence IC Comput(P3,s3,k) in dom pIF by A13,A7,EXTPRO_1:2;
    end;
  end;
  hence IF is_closed_on s,P;
A17: Comput(P3,s3,LifeSpan(P2,s2)+1)
 = Comput(P3,Comput(P3,s3,1),LifeSpan(P2
,s2))
by EXTPRO_1:4;
  CurInstr(P3,
  Comput(P3,s3,LifeSpan(P2,s2)+1))
   =CurInstr(P3,
   Comput(P3,s4,LifeSpan(P2,s2))) by A17
    .=CurInstr(P2,
    Comput(P2,s2,LifeSpan(P2,s2))) by A10,A12,A8,A4,Th22,A1
    .= halt SCMPDS by A11,EXTPRO_1:def 15;
  then P3 halts_on s3 by EXTPRO_1:29;
  hence thesis;
end;
