reserve r,r1,r2,g,g1,g2,x0,t for Real;
reserve n,k for Nat;
reserve seq for Real_Sequence;
reserve f,f1,f2 for PartFunc of REAL,REAL;

theorem Th6:
  (for n holds x0<seq.n & seq.n<x0+1/(n+1) & seq.n in dom f)
implies seq is convergent & lim seq=x0 & rng seq c= dom f & rng seq c= dom f /\
  right_open_halfline(x0)
proof
  deffunc U(Nat) = 1/($1+1);
  consider s1 be Real_Sequence such that
A1: for n holds s1.n=U(n) from SEQ_1:sch 1;
  reconsider xx0 = x0 as Element of REAL by XREAL_0:def 1;
  set s2 = seq_const x0;
A2: s1 is convergent by A1,SEQ_4:31;
  then
A3: s2+s1 is convergent;
  assume
A4: for n holds x0<seq.n & seq.n<x0+1/(n+1) & seq.n in dom f;
A5: now
    let n;
A6: (s2+s1).n=s2.n+s1.n by SEQ_1:7
      .=x0+s1.n by SEQ_1:57
      .=x0+1/(n+1) by A1;
    x0<=seq.n by A4;
    hence s2.n<=seq.n & seq.n<=(s2+s1).n by A4,A6,SEQ_1:57;
  end;
  s2.0=x0 by SEQ_1:57;
  then
A7: lim s2=x0 by SEQ_4:25;
  lim s1=0 by A1,SEQ_4:31;
  then
A8: lim(s2+s1)=x0+0 by A7,A2,SEQ_2:6
    .=x0;
  hence seq is convergent by A7,A3,A5,SEQ_2:19;
  thus lim seq=x0 by A7,A3,A8,A5,SEQ_2:20;
  now
    let x be object;
    assume x in rng seq;
    then ex n being Element of NAT st seq.n=x by FUNCT_2:113;
    hence x in dom f by A4;
  end;
  hence
A9: rng seq c=dom f by TARSKI:def 3;
  now
    let x be object;
    assume x in rng seq;
    then consider n being Element of NAT such that
A10: x=seq.n by FUNCT_2:113;
    x0<seq.n by A4;
    then seq.n in {g2:x0<g2};
    hence x in right_open_halfline(x0) by A10,XXREAL_1:230;
  end;
  then rng seq c=right_open_halfline(x0) by TARSKI:def 3;
  hence thesis by A9,XBOOLE_1:19;
end;
