reserve y for object, X for set;
reserve x,x0,x1,x2,g,g1,g2,r,r1,s,p,p1 for Real;
reserve n,m,k for Element of NAT;
reserve Y for Subset of REAL;
reserve Z for open Subset of REAL;
reserve s1,s3 for Real_Sequence;
reserve f,f1,f2 for PartFunc of REAL,REAL;
reserve h for non-zero 0-convergent Real_Sequence;
reserve c for constant Real_Sequence;
reserve R,R1,R2 for RestFunc;
reserve L,L1,L2 for LinearFunc;

theorem ::AN
::  f is_differentiable_in x0 implies
ex R st R.0=0 & R is_continuous_in 0
proof
  A1: {} REAL is closed
  by XBOOLE_1:3;
  ([#] REAL)` = {} REAL & REAL c= REAL & [#]REAL = REAL by XBOOLE_1:37;
  then
  reconsider Z = [#]REAL as open Subset of REAL by A1,RCOMP_1:def 5;
  reconsider cf = REAL --> In(0,REAL) as Function of REAL, REAL;
  set R = cf;
  reconsider f=R as PartFunc of REAL,REAL;
  now
    let h;
A3: now
      let n be Nat;
A4:   rng h c= dom R;
A6:   n in NAT by ORDINAL1:def 12;
      thus ((h")(#)(R/*h)).n = (h".n)*((R/*h).n) by SEQ_1:8
        .= (h".n)*(R.(h.n)) by A6,A4,FUNCT_2:108
        .= (h".n)*0
        .= 0;
    end;
    then
A7: (h")(#)(R/*h) is constant by VALUED_0:def 18;
    hence (h")(#)(R/*h) is convergent;
    ((h")(#)(R/*h)).0 = 0 by A3;
    hence lim ((h")(#)(R/*h)) = 0 by A7,SEQ_4:25;
  end;
  then reconsider R as RestFunc by Def2;
  set L = cf;
  for p holds L.p=0*p;
  then reconsider L as LinearFunc by Def3;
  f|Z is constant;
  then consider r being Element of REAL such that
A8: for x being Element of REAL st x in Z/\dom f holds f.x=r by PARTFUN2:57;
A9:
now
    let x0;
     reconsider xx0 = x0 as Element of REAL by XREAL_0:def 1;
    assume x0 in Z;
    set N = the Neighbourhood of x0;
A11: xx0 in Z/\dom f;
    for x st x in N holds f.x-f.x0=L.(x-x0)+R.(x-x0)
    proof
      let x;
     reconsider xx = x as Element of REAL by XREAL_0:def 1;
      assume x in N;
      then x in Z/\dom f;
      hence f.x-f.x0=r-f.x0 by A8
        .=r - r by A8,A11
        .=L.(xx-xx0)+0
        .=L.(x-x0)+R.(x-x0);
    end;
    hence f is_differentiable_in x0;
  end;
  set x0 = the Element of REAL;
  f is_differentiable_in x0 by A9; then
  consider N being Neighbourhood of x0 such that
  N c= dom f and
A12: ex L,R st for x st x in N holds f.x - f.x0 = L.(x-x0) + R.(x-x0);
  consider L,R such that
A13: for x st x in N holds f.x - f.x0 = L.(x-x0) + R.(x-x0) by A12;
  take R;
  consider p such that
A14: for r holds L.r = p*r by Def3;
  f.x0 - f.x0 = L.(x0-x0) + R.(x0-x0) by A13,RCOMP_1:16;
  then
A15: 0 = p*0 + R.0 by A14;
  hence R.0=0;
A16: now
    set s3 = cs;
    let h;
A17: s3.1 = 0;
    (h")(#)(R/*h) is convergent by Def2;
    then (h")(#)(R/*h) is bounded;
    then consider M being Real such that
    M>0 and
A18: for n being Nat holds |.((h")(#)(R/*h)).n.|<M by SEQ_2:3;
A19: now
      let n be Nat;
      |.((h")(#)(R/*h)).n.|=|.((h").n)*(R/*h).n.| by SEQ_1:8
        .=|.(h.n)"*(R/*h).n.| by VALUED_1:10;
      then
A20:  |.(h.n)"*(R/*h).n.|<=M by A18;
      0<=|.(R/*h).n.| by COMPLEX1:46;
      then 0<=abs((R/*h)).n by SEQ_1:12;
      hence s3.n<=abs((R/*h)).n;
      |.h.n.|>=0 by COMPLEX1:46;
      then |.h.n.|*|.(h.n)"*(R/*h).n.|<=M*|.h.n.| by A20,XREAL_1:64;
      then |.(h.n)*((h.n)"*(R/*h).n).|<=M*|.h.n.| by COMPLEX1:65;
      then
A21:  |.(h.n)*(h.n)"*(R/*h).n.|<=M*|.h.n.|;
      h.n <>0 by SEQ_1:5;
      then |.1*(R/*h).n.|<=M*|.h.n.| by A21,XCMPLX_0:def 7;
      then |.(R/*h).n.|<=M*abs(h).n by SEQ_1:12;
      then |.(R/*h).n.|<=(M(#)abs(h)).n by SEQ_1:9;
      hence abs((R/*h)).n<=(M(#)abs (h)).n by SEQ_1:12;
    end;
    lim h=0;
    then lim abs(h) = |.0 .| by SEQ_4:14
      .=0 by ABSVALUE:2;
    then
A22: lim (M(#)abs(h)) = M*0 by SEQ_2:8
      .=lim s3 by A17,SEQ_4:25;
A23: abs(R/*h) is convergent by A22,A19,SEQ_2:19;
    lim s3 = 0 by A17,SEQ_4:25;
    then lim abs(R/*h)=0 by A22,A19,SEQ_2:20;
    hence R/*h is convergent & lim (R/*h)=R.0 by A15,A23,SEQ_4:15;
  end;
  now
    let s1;
    assume that
    rng s1 c= dom R and
A24: s1 is convergent & lim s1 = 0 and
A25: for n being Nat holds s1.n<>0;
    s1 is 0-convergent by A24;
    then s1 is 0-convergent non-zero Real_Sequence by A25,SEQ_1:5;
    hence R/*s1 is convergent & lim (R/*s1)=R.0 by A16;
  end;
  hence thesis by FCONT_1:2;
end;
