reserve Y for RealNormSpace;
reserve X,Y for RealBanachSpace;
reserve Z for open Subset of REAL;
reserve a,b,c,d,e,r,x0 for Real;
reserve y0 for VECTOR of X;
reserve G for Function of X,X;

theorem Th1955:
for X be RealBanachSpace, F be PartFunc of REAL,the carrier of X,
    f be continuous PartFunc of REAL,the carrier of X
   st [.a,b.] c= dom f & ].a,b.[ c= dom F
    & (for x be Real st x in ].a,b.[ holds F/.x = integral(f,a,x))
    & x0 in ].a,b.[ & f is_continuous_in x0 holds
  F is_differentiable_in x0 & diff(F,x0)=f/.x0
proof
   let X be RealBanachSpace,
       F be PartFunc of REAL,the carrier of X,
       f be continuous PartFunc of REAL,the carrier of X;
   deffunc F2(object) = 0.X;
   assume that
A4: [.a,b.] c= dom f and
A5: ].a,b.[ c= dom F and
A6: for x be Real st x in ].a,b.[ holds F/.x = integral(f,a,x) and
A7: x0 in ].a,b.[ and
A8: f is_continuous_in x0;
   per cases;
   suppose A1: a <= b; then
X5: ['a,b'] = [.a,b.] by INTEGRA5:def 3;
    defpred C1[object] means x0+In($1,REAL) in ].a,b.[;
    deffunc F0(Real)=$1*(f/.x0);
    consider L be Function of REAL,the carrier of X such that
B9:  for h be Element of REAL holds L.h=F0(h) from FUNCT_2:sch 4;
A9: for h be Real holds L.h=F0(h)
    proof
     let h be Real;
     h is Element of REAL by XREAL_0:def 1;
     hence thesis by B9;
    end;
C9: for h be Real holds L/.h=F0(h)
    proof
     let h be Real;
     reconsider h as Element of REAL by XREAL_0:def 1;
     L/.h = F0(h) by B9;
     hence thesis;
    end;
    then reconsider L as LinearFunc of X by NDIFF_3:def 2;
    deffunc F1(object) = F/.(x0+In($1,REAL))-F/.x0-L.(In($1,REAL));
    consider R be Function such that
A10: dom R=REAL
   & for x be object st x in REAL holds
      ( C1[x] implies R.x = F1(x) )
    & ( not C1[x] implies R.x = F2(x) ) from PARTFUN1:sch 1;
    rng R c= the carrier of X
    proof
     let y be object;
     assume y in rng R;
     then consider x be object such that
A11:  x in dom R & y=R.x by FUNCT_1:def 3;
     (C1[x] implies R.x = F1(x)) & (not C1[x] implies R.x = F2(x)) by A10,A11;
     hence thesis by A11;
    end;
    then reconsider R as PartFunc of REAL,the carrier of X by A10,RELSET_1:4;
A14:R is total by A10,PARTFUN1:def 2;
A15:['a,b'] = [.a,b.] by A1,INTEGRA5:def 3; then
X1: ].a,b.[ c= ['a,b'] by XXREAL_1:25;
A16:for h be 0-convergent non-zero Real_Sequence holds
       (h")(#)(R/*h) is convergent & lim ((h")(#)(R/*h)) = 0.X
    proof
     let h be 0-convergent non-zero Real_Sequence;
     set Z0 = 0.X;
A17: for e be Real st 0<e
      ex n be Nat st
       for m be Nat st n <= m holds ||.((h")(#)(R/*h)).m - Z0 .|| < e
     proof
      set g = REAL --> (f/.x0);
      let e0 be Real;
      set e = e0/2;
A18:  h is convergent & lim h = 0;
      assume
A19:   0 < e0;
      then consider p be Real such that
A20:   0 < p and
A21:   for t be Real st t in dom f & |.t - x0.| < p holds
        ||.f/.t - f/.x0.|| < e by A8,NFCONT_3:8,XREAL_1:215;
A22:  e0/2 < e0 & 0 < p/2 & p/2 < p by A19,A20,XREAL_1:215,216;
      consider N be Neighbourhood of x0 such that
A24:   N c= ].a,b.[ by A7,RCOMP_1:18;
      consider q be Real such that
A25:   0<q and
A26:   N = ].x0-q,x0+q.[ by RCOMP_1:def 6;
      set r=min(p/2,q/2);
A27:  0 < q/2 & q/2 < q by A25,XREAL_1:215,216;
      then 0 < r by A22,XXREAL_0:15;
      then consider n0 be Nat such that
A28:   for m be Nat st n0 <= m holds |.h.m - 0 .|<r by A18,SEQ_2:def 7;
      reconsider n0 as Element of NAT by ORDINAL1:def 12;
      take n0;
      let m be Nat;
A40:  r <= p/2 & r <= q/2 by XXREAL_0:17;
      then
A29:  ].x0-r,x0+r.[ c= ].x0-q,x0+q.[ by A27,INTEGRA6:2,XXREAL_0:2;
      assume n0 <= m; then
A30:  |.h.m - 0 .| < r by A28;
      then |.(x0 + h.m)-x0.| < r; then
A31:  x0 + h.m in ].x0-q,x0+q.[ by A29,RCOMP_1:1; then
X2:   x0+h.m in ].a,b.[ by A24,A26;
A32:  R.(h.m)=F/.(x0+h.m)-F/.x0-L.In(h.m,REAL) by A10,A24,A26,A31;
      F/.x0 =integral(f,a,x0) & F/.(x0+h.m) =integral(f,a,x0+h.m)
        by A6,A7,A24,A26,A31; then
A35:  R.(h.m) =integral(f,a,x0+h.m) -integral(f,a,x0) -h.m*(f/.x0) by A9,A32;
A36:  dom g = REAL;
      ['a,b'] /\ ['a,b'] c= dom f /\ dom g by A4,X5,XBOOLE_1:27;
      then
A37:  ['a,b'] c= dom (f-g) by VFUNCT_1:def 2;
A39:  integral(f,a,x0+h.m) = integral(f,a,x0) +integral(f,x0,x0+h.m)
            by A1,X5,A4,A7,X1,X2,INTEGR21:29;
A41:  for x be Real st x in ['min(x0,x0+h.m),max(x0,x0+h.m)']
        holds ||.(f-g)/.x .|| <= e
      proof
       let x be Real;
A42:   min(x0,x0+h.m) <= x0 & x0 <= max(x0,x0+h.m) by XXREAL_0:17,25;
       assume x in ['min(x0,x0+h.m),max(x0,x0+h.m)']; then
A43:   x in [. min(x0,x0+h.m),max(x0,x0+h.m) .]
        by A42,INTEGRA5:def 3,XXREAL_0:2;
       |.x-x0.| <=|.h.m.|
       proof
        per cases;
        suppose x0<= x0+h.m;
         then x0 = min(x0,x0+h.m) & x0+h.m = max(x0,x0+h.m)
                by XXREAL_0:def 9,def 10; then
A44:     ex z be Real st x=z & x0<=z & z<=x0+h.m by A43;
         then
A45:     |.x-x0.| = x-x0 by ABSVALUE:def 1,XREAL_1:48;
A46:     x-x0 <= x0+h.m - x0 by A44,XREAL_1:9;
         then 0 <= h.m by A44,XREAL_1:48;
         hence thesis by A46,A45,ABSVALUE:def 1;
        end;
        suppose
A47:     not x0<=x0 +h.m;
         then x0 = max(x0,x0+h.m) & x0+h.m = min(x0,x0+h.m)
              by XXREAL_0:def 9,def 10;
         then
A48:     ex z be Real st x=z & x0+h.m<=z & z<=x0 by A43;
         then
A49:     x0 +h.m -x0 <= x-x0 by XREAL_1:9;
         per cases;
         suppose x-x0 <> 0; then
          x-x0 < 0 by A48,XREAL_1:47; then
A50:      |.x-x0.| = -(x-x0) by ABSVALUE:def 1;
          |.h.m.| = -(h.m) by A47,XREAL_1:31,ABSVALUE:def 1;
          hence thesis by A49,A50,XREAL_1:24;
         end;
         suppose x-x0 = 0;
          then |.x-x0.| = 0 by ABSVALUE:def 1;
          hence thesis by COMPLEX1:46;
         end;
        end;
       end; then
A52:   |.x-x0.| < r by A30,XXREAL_0:2; then
       x in ].x0-q,x0+q.[ by A29,RCOMP_1:1; then
A53:   x in [.a,b.] by X1,A15,A24,A26;
       reconsider xx = x as Element of REAL by XREAL_0:def 1;
       |.x-x0.| < p/2 by A40,A52,XXREAL_0:2;
       then |.x-x0.| < p by A22,XXREAL_0:2;
       then ||. f/.x- f/.x0 .|| <= e by A4,A21,A53;
       then ||. f/.x- g/.xx .|| <= e;
       hence thesis by A15,A37,A53,VFUNCT_1:def 2;
      end;
B54:  now let x be Real;
       assume B1:x in ['a,b'];
       thus g/.x = g.x by A36,XREAL_0:def 1,PARTFUN1:def 6
                .= f/.x0 by B1,FUNCOP_1:7;
      end;
XX:   m in NAT by ORDINAL1:def 12;
      rng h c= dom R by A10;
      then (h.m)"*(R/.(h.m)) =(h.m)"*(R/*h).m  by FUNCT_2:109,XX;
      then (h.m)"*(R/.(h.m)) =((h").m)*((R/*h).m) by VALUED_1:10;
      then
A57:  (h.m)"*(R/.(h.m)) = ((h")(#)(R/*h)).m by NDIFF_1:def 2;
A58:  0 < |.h.m.| by COMPLEX1:47,SEQ_1:5;
A60:  ||. integral(f-g,x0,x0+h.m) .|| <= e*|.x0+h.m-x0.|
         by A1,A7,X1,X2,A37,A41,INTEGR21:25;
A61:  integral(g,x0,x0+h.m)=((x0+h.m)-x0)*(f/.x0)
         by A1,A7,X1,X2,A36,B54,INTEGR21:28
       .= (h.m)*(f/.x0);
A62:  integral(f-g,x0,x0+h.m) = integral(f,x0,x0+h.m)
        - integral(g,x0,x0+h.m) by A1,X5,A4,A7,X1,X2,A36,INTEGR21:30;
      R.(h.m) = integral(f,x0,x0+h.m)
       + (integral(f,a,x0)-integral(f,a,x0)) -h.m*(f/.x0)
         by A35,A39,RLVECT_1:28
       .= integral(f,x0,x0+h.m) + Z0 -(h.m)*(f/.x0) by RLVECT_1:15
       .= integral(f,x0,x0+h.m) - integral(g,x0,x0+h.m) by A61;
      then R/.(h.m) =integral(f-g,x0,x0+h.m) by A62,A10,PARTFUN1:def 6;
      then ||.(h.m)"*(R/.(h.m)) .|| = ||.(R/.(h.m)).|| /|.h.m.| &
      ||.(R/.(h.m)).|| /|.h.m.|
        <= e*|.h.m.|/|.h.m.| by A60,A58,Lm17,XREAL_1:72;
      then ||.(h.m)"*(R/.(h.m)).|| <= e0/2 by A58,XCMPLX_1:89;
      hence thesis by A22,A57,XXREAL_0:2;
     end;
     hence (h")(#)(R/*h) is convergent;
     hence thesis by A17,NORMSP_1:def 7;
    end;
    consider N be Neighbourhood of x0 such that
A64: N c= ].a,b.[ by A7,RCOMP_1:18;
    reconsider R as RestFunc of X by A14,A16,NDIFF_3:def 1;
A65:for x be Real st x in N holds F/.x-F/.x0 = L/.(x-x0) + R/.(x-x0)
    proof
     let x be Real;
     assume x in N; then
     x0+In(x-x0,REAL) = x0 + (x-x0) & R.(x-x0) = F1(x-x0) by A10,A64; then
     R/.(x-x0) = F/.(x0+In(x-x0,REAL))-F/.x0-L/.(In(x-x0,REAL))
              by A10,PARTFUN1:def 6;
     then R/.(x-x0) + L/.(x-x0) = F/.x-F/.x0 - (L/.(x-x0) - L/.(x-x0))
        by RLVECT_1:29; then
     R/.(x-x0) + L/.(x-x0) = F/.x-F/.x0 - 0.X by RLVECT_1:15;
     hence thesis;
    end;
A66:N c= dom F by A5,A64;
    hence A67: F is_differentiable_in x0 by A65;
    reconsider N1=1 as Real;
    L/.1 = N1*(f/.x0) by C9; then
    L/.1 = f/.x0 by RLVECT_1:def 8;
    hence thesis by A66,A65,A67,NDIFF_3:def 4;
   end;
   suppose a > b;
    hence thesis by A7,XXREAL_1:28;
   end;
end;
