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