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 Th51:
  for s being State of SCMPDS,I being halt-free 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 IExec(if<>0(a,k1,I),P,Initialize s) =
  IExec(I,P,Initialize s) +* Start-At((card I+2),SCMPDS)
proof
  let s be State of SCMPDS,I be halt-free shiftable Program of SCMPDS, a be
  Int_position,k1 be Integer;
  set b=DataLoc(s.a,k1);
  set IF=if<>0(a,k1,I), pI=stop I, pIF = stop IF,
   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);
  set SAl=Start-At((card I+2),SCMPDS);
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;
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;
A5: IC s3 = 0 by MEMSTR_0:47;
A6: Start-At(0,SCMPDS) c= s2 & Shift(pI,2) c= P4 by Lm7,FUNCT_4:25;
A7:  stop I c= P2 by FUNCT_4:25;
  for a holds s2.a = s4.a by A2,SCMPDS_2:55;
  then
A8: DataPart s2 = DataPart s4 by SCMPDS_4:8;
  assume
  s.b <> 0;
  then
A9: IC s4 = ICplusConst(s3,2) by A2,A4,SCMPDS_2:55
    .= (0+2) by A5,Th4;
  assume
A10: I is_closed_on s,P;
  then
A11: I is_closed_on s2,P2;
  assume
A12: I is_halting_on s,P;
  then
A13: P2 halts_on s2;
A14: Comput(P3,s3,LifeSpan(P2,s2)+1)
 = Comput(P3,Comput(P3,s3,1),LifeSpan(P2
,s2))
by EXTPRO_1:4;
A15: CurInstr(P3,
Comput(P3,s3,LifeSpan(P2,s2)+1))
 =CurInstr(P3,
 Comput(P3,s4,LifeSpan(P2,s2))) by A14
    .=CurInstr(P2,
    Comput(P2,s2,LifeSpan(P2,s2))) by A11,A6,A9,A8,Th22,A7
    .= halt SCMPDS by A13,EXTPRO_1:def 15;
  then
A16: P3 halts_on s3 by EXTPRO_1:29;
A17: CurInstr(P3,s3) = i by A1,Th3;
  now
    let l be Nat;
    assume
A18: l < LifeSpan(P2,s2) + 1;
A19: Comput(P3,s3,0) = s3 by EXTPRO_1:2;
    per cases;
    suppose
      l = 0;
      then CurInstr(P3,Comput(P3,s3,l))
       = CurInstr(P3,s3)
       by A19;
      hence CurInstr(P3,Comput(P3,s3,l))
       <> halt SCMPDS by A17;
    end;
    suppose
      l <> 0;
      then consider n be Nat such that
A20:  l = n + 1 by NAT_1:6;
      reconsider n as Nat;
A21:  n < LifeSpan(P2,s2) by A18,A20,XREAL_1:6;
      assume
A22:  CurInstr(P3,Comput(P3,s3,l)) = halt SCMPDS;
A23: Comput(P3,s3,n+1)
= Comput(P3,Comput(P3,s3,1),n) by EXTPRO_1:4;
      CurInstr(P2,Comput(P2,s2,n)) =
      CurInstr(P3,Comput(P3,s4,n)) by A11,A6,A9,A8,Th22,A7
        .= halt SCMPDS by A20,A22,A23;
      hence contradiction by A13,A21,EXTPRO_1:def 15;
    end;
  end;
  then for l be Nat st CurInstr(P3,
  Comput(P3,s3,l)) = halt SCMPDS
  holds LifeSpan(P2,s2) + 1 <= l;
  then
A24: LifeSpan(P3,s3) = LifeSpan(P2,s2) + 1 by A15,A16,EXTPRO_1:def 15;
A25: DataPart Result(P2,s2) = DataPart Comput(P2, s2
,LifeSpan(P2,s2)) by A13,EXTPRO_1:23
    .= DataPart Comput(P3, s4,LifeSpan(P2,s2)) by A11,A6,A9,A8,Th22,A7
    .= DataPart Comput(P3, s3,LifeSpan(P2,s2) + 1)
by EXTPRO_1:4
    .= DataPart Result(P3,s3) by A16,A24,EXTPRO_1:23;
A26: now
    let x be object;
A27: dom Start-At((card I+2),SCMPDS) = {IC SCMPDS} by FUNCOP_1:13;
    assume
A28: x in dom IExec(IF,P,Initialize s);
    per cases by A28,SCMPDS_4:6;
    suppose
A29:  x is Int_position;
      then x <> IC SCMPDS by SCMPDS_2:43;
      then
A30:  not x in dom SAl by A27,TARSKI:def 1;
      thus IExec(IF,P,Initialize s).x = (Result(P3,s3)).x
        .= (Result(P2,s2)).x by A25,A29,SCMPDS_4:8
        .= IExec(I,P,Initialize s).x
        .= (IExec(I,P,Initialize s) +* SAl).x by A30,FUNCT_4:11;
    end;
    suppose
A31:  x = IC SCMPDS;
A32:  IC Result(P2,s2) = IC IExec(I,P,Initialize s)
        .=  card I by A10,A12,Th25;
A33:  x in dom SAl by A27,A31,TARSKI:def 1;
      thus IExec(IF,P,Initialize s).x = (Result(P3,s3)).x
        .= Comput(P3, s3,LifeSpan(P2,s2) + 1).x by A16,A24,EXTPRO_1:23
        .= IC Comput(P3, s4,LifeSpan(P2,s2)) by A31,EXTPRO_1:4
        .= IC Comput(P2, s2,LifeSpan(P2,s2)) + 2
        by A11,A6,A9,A8,Th22,A7
        .= IC Result(P2,s2) + 2 by A13,EXTPRO_1:23
        .= IC SAl by A32,FUNCOP_1:72
        .= (IExec(I,P,Initialize s) +* SAl).x by A31,A33,FUNCT_4:13;
    end;
  end;
  dom IExec(IF,P,Initialize s) = the carrier of SCMPDS by PARTFUN1:def 2
    .= dom (IExec(I,P,Initialize s) +* Start-At((card I+2),SCMPDS))
     by PARTFUN1:def 2;
  hence thesis by A26,FUNCT_1:2;
end;
