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
  f is_right_convergent_in x0 & lim_right(f,x0)=0 & (ex r st 0<r & for g
  st g in dom f /\ ].x0,x0+r.[ holds f.g<0) implies f^
  is_right_divergent_to-infty_in x0
proof
  assume that
A1: f is_right_convergent_in x0 and
A2: lim_right(f,x0)=0;
  given r such that
A3: 0<r and
A4: for g st g in dom f/\].x0,x0+r.[ holds f.g<0;
  thus for r1 st x0<r1 ex g1 st g1<r1 & x0<g1 & g1 in dom(f^)
  proof
    let r1;
    assume x0<r1;
    then consider g1 such that
A5: g1<r1 and
A6: x0<g1 and
    g1 in dom f by A1;
    now
      per cases;
      suppose
A7:     g1<=x0+r;
        consider g2 such that
A8:     g2<g1 and
A9:     x0<g2 and
A10:    g2 in dom f by A1,A6;
        take g2;
        thus g2<r1 & x0<g2 by A5,A8,A9,XXREAL_0:2;
        g2<x0+r by A7,A8,XXREAL_0:2;
        then g2 in {r2: x0<r2 & r2<x0+r} by A9;
        then g2 in ].x0,x0+r.[ by RCOMP_1:def 2;
        then g2 in dom f/\].x0,x0+r.[ by A10,XBOOLE_0:def 4;
        then not f.g2 in {0} by A4;
        then not g2 in f"{0} by FUNCT_1:def 7;
        then g2 in dom f\f"{0} by A10,XBOOLE_0:def 5;
        hence g2 in dom(f^) by RFUNCT_1:def 2;
      end;
      suppose
A11:    x0+r<=g1;
        x0<x0+r by A3,Lm1;
        then consider g2 such that
A12:    g2<x0+r and
A13:    x0<g2 and
A14:    g2 in dom f by A1;
        take g2;
        g2<g1 by A11,A12,XXREAL_0:2;
        hence g2<r1 & x0<g2 by A5,A13,XXREAL_0:2;
        g2 in {r2: x0<r2 & r2<x0+r} by A12,A13;
        then g2 in ].x0,x0+r.[ by RCOMP_1:def 2;
        then g2 in dom f/\].x0,x0+r.[ by A14,XBOOLE_0:def 4;
        then not f.g2 in {0} by A4;
        then not g2 in f"{0} by FUNCT_1:def 7;
        then g2 in dom f\f"{0} by A14,XBOOLE_0:def 5;
        hence g2 in dom(f^) by RFUNCT_1:def 2;
      end;
    end;
    hence thesis;
  end;
  let s be Real_Sequence such that
A15: s is convergent and
A16: lim s=x0 and
A17: rng s c=dom(f^)/\right_open_halfline(x0);
  x0<x0+r by A3,Lm1;
  then consider k such that
A18: for n st k<=n holds s.n<x0+r by A15,A16,Th2;
A19: lim(s^\k)=x0 by A15,A16,SEQ_4:20;
  dom(f^)=dom f\f"{0} by RFUNCT_1:def 2;
  then
A20: dom(f^)c=dom f by XBOOLE_1:36;
A21: rng(s^\k)c=rng s by VALUED_0:21;
  dom(f^)/\right_open_halfline(x0)c=right_open_halfline(x0) by XBOOLE_1:17;
  then rng s c=right_open_halfline(x0) by A17,XBOOLE_1:1;
  then
A22: rng(s^\k)c=right_open_halfline(x0) by A21,XBOOLE_1:1;
A23: dom(f^)/\right_open_halfline(x0)c=dom(f^) by XBOOLE_1:17;
  then
A24: rng s c=dom(f^) by A17,XBOOLE_1:1;
  then
A25: rng s c=dom f by A20,XBOOLE_1:1;
  then
A26: rng(s^\k)c=dom f by A21,XBOOLE_1:1;
  then
A27: rng(s^\k)c=dom f/\right_open_halfline(x0) by A22,XBOOLE_1:19;
  then
A28: lim(f/*(s^\k))=0 by A1,A2,A15,A19,Def8;
  now
    let n;
A29: n in NAT by ORDINAL1:def 12;
    s.(n+k)<x0+r by A18,NAT_1:12;
    then
A30: (s^\k).n<x0+r by NAT_1:def 3;
A31: (s^\k).n in rng(s^\k) by VALUED_0:28;
    then (s^\k).n in right_open_halfline(x0) by A22;
    then (s^\k).n in {g1: x0<g1} by XXREAL_1:230;
    then ex g1 st g1=(s^\k).n & x0<g1;
    then (s^\k).n in {g2: x0<g2 & g2<x0+r} by A30;
    then (s^\k).n in ].x0,x0+r.[ by RCOMP_1:def 2;
    then (s^\k).n in dom f/\].x0,x0+r.[ by A26,A31,XBOOLE_0:def 4;
    then f.((s^\k).n)<0 by A4;
    hence (f/*(s^\k)).n<0 by A25,A21,FUNCT_2:108,XBOOLE_1:1,A29;
  end;
  then
A32: for n holds 0<=n implies (f/*(s^\k)).n<0;
  f/*(s^\k) is convergent by A1,A15,A19,A27;
  then
A33: (f/*(s^\k))" is divergent_to-infty by A28,A32,LIMFUNC1:36;
  (f/*(s^\k))"=((f/*s)^\k)" by A24,A20,VALUED_0:27,XBOOLE_1:1
    .=((f/*s)")^\k by SEQM_3:18
    .=((f^)/*s)^\k by A17,A23,RFUNCT_2:12,XBOOLE_1:1;
  hence thesis by A33,LIMFUNC1:7;
end;
