theorem Th31:
  for F being Instruction-Sequence of S
  for s being State of S, k being Nat
   holds F.(IC Comput(F,s,k)) <> halt S &
   F.(IC Comput(F,s,k+1)) = halt S iff LifeSpan(F,s) = k+1 & F halts_on s
proof
  let F be Instruction-Sequence of S;
  let s be State of S, k be Nat;
A1:  dom F = NAT by PARTFUN1:def 2;
  hereby
    assume that
A2: F.(IC Comput(F,s,k)) <> halt S and
A3: F.(IC Comput(F,s,k+1)) = halt S;
A4: CurInstr(F,Comput(F,s,k)) <> halt S by A2,A1,PARTFUN1:def 6;
A5: now
      let i be Nat;
      assume that
A6:   CurInstr(F,Comput(F,s,i)) = halt S and
A7:   k+1 > i;
      i <= k by A7,NAT_1:13;
      hence contradiction by A4,A6,Th5;
    end;
A8:  F halts_on s by A3,Th30;
     CurInstr(F,Comput(F,s,k+1)) = halt S by A3,A1,PARTFUN1:def 6;
    hence LifeSpan(F,s) = k+1 & F halts_on s by A5,Def15,A8;
  end;
  assume
A9: LifeSpan(F,s) = k+1 & F halts_on s;
A10: now
    assume CurInstr(F,Comput(F,s,k)) = halt S;
    then k+1 <= k by A9,Def15;
    hence contradiction by NAT_1:13;
  end;
  CurInstr(F,Comput(F,s,k+1)) = halt S by A9,Def15;
  hence thesis by A10,A1,PARTFUN1:def 6;
end;
