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 Th49:
  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, P2 = P +* pI,
  s3 = Initialize s, P3 = P +* pIF,
  s4 = Comput(P3,s3,1), P4 = P3;
  set i = (a,k1)<>0_goto 2, j = goto (card I + 1);
A1: IF = i ';' (j ';' I) by SCMPDS_4:16;
A2: 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 A1,Th3;
  for a holds s2.a = s4.a by A2,SCMPDS_2:55;
  then
A3: DataPart s2 = DataPart s4 by SCMPDS_4:8;
A4: 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
A5: s3.DataLoc(s3.a,k1)=s3.b by FUNCT_4:11
    .= s.b by A4,FUNCT_4:11;
A6: IC s3 = 0 by MEMSTR_0:47;
  assume
  s.b <> 0;
  then
A7: IC s4 = ICplusConst(s3,2) by A2,A5,SCMPDS_2:55
    .= (0+2) by A6,Th4;
  assume
A8: I is_closed_on s,P;
  then
A9: I is_closed_on s2,P2;
  assume
  I is_halting_on s,P;
  then
A10: P2 halts_on s2;
A11: Start-At(0,SCMPDS) c= s2 & Shift(pI,2) c= P4 by Lm7,FUNCT_4:25;
A12:  stop I c= P2 by 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 A8;
      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 A9,A11,A7,A3,Th22,A12;
      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,A6,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 A9,A11,A7,A3,Th22,A12
    .= halt SCMPDS by A10,EXTPRO_1:def 15;
  then P3 halts_on s3 by EXTPRO_1:29;
  hence thesis;
end;
