 reserve j for set;
 reserve p,r for Real;
 reserve S,T,F for RealNormSpace;
 reserve x0 for Point of S;
 reserve g for PartFunc of S,T;
 reserve c for constant sequence of S;
 reserve R for RestFunc of S,T;
 reserve G for RealNormSpace-Sequence;
 reserve i for Element of dom G;
 reserve f for PartFunc of product G,F;
 reserve x for Element of product G;

theorem Th20:
for S,T be RealNormSpace, f be PartFunc of S,T,
    p,q be Point of S, M be Real,
    L be Point of R_NormSpace_of_BoundedLinearOperators(S,T)
  st [.p,q.] c= dom f
   & (for x be Point of S st x in [.p,q.] holds f is_continuous_in x)
   & (for x be Point of S st x in ].p,q.[ holds f is_differentiable_in x)
   & (for x be Point of S st x in ].p,q.[ holds ||. diff(f,x) - L .|| <= M)
holds ||. f/.q - f/.p -L.(q-p).|| <= M*||. q-p .||
proof
   let S,T be RealNormSpace,
       f be PartFunc of S,T,
       p,q be Point of S,
       M be Real,
       L be Point of R_NormSpace_of_BoundedLinearOperators(S,T);
   assume that
A1: [.p,q.] c= dom f and
A2: (for x be Point of S st x in [.p,q.] holds f is_continuous_in x)
  & (for x be Point of S st x in ].p,q.[ holds f is_differentiable_in x)
  & (for x be Point of S st x in ].p,q.[ holds ||. diff(f,x) - L .|| <= M);

   reconsider LP=L as Lipschitzian LinearOperator of S,T by LOPBAN_1:def 9;

   deffunc LL(Point of S) = L.($1-p);

   consider L0 be Function of the carrier of S,the carrier of T such that
A3: for t being Element of the carrier of S
      holds L0.t = LL(t)  from FUNCT_2:sch 4;

A4:dom L0 = the carrier of S by FUNCT_2:def 1;

   now let x1,x2 be Point of S;
    assume x1 in dom L0 & x2 in dom L0;

    L0/.x1=L.(x1-p) & L0/.x2=L.(x2-p) by A3; then
    ||.L0/.x1-L0/.x2 .||
      = ||.LP.(x1-p)+(-1)*LP.(x2-p) .|| by RLVECT_1:16
     .= ||.LP.(x1-p)+LP.((-1)*(x2-p)) .|| by LOPBAN_1:def 5
     .= ||.LP.((x1-p)+(-1)*(x2-p)) .|| by VECTSP_1:def 20
     .= ||.LP.((x1-p)-(x2-p)) .|| by RLVECT_1:16
     .= ||. LP.(x1-((x2-p)+p)) .|| by RLVECT_1:27
     .= ||. LP.(x1-(x2-(p-p))) .|| by RLVECT_1:29
     .= ||. LP.(x1-(x2-0.S)) .|| by RLVECT_1:15
     .= ||. LP.(x1-x2) .|| by RLVECT_1:13; then
A5: ||.L0/.x1-L0/.x2 .|| <= ||.L.|| * ||.x1-x2.|| by LOPBAN_1:32;

    (0 qua Real) + ||.L.|| < 1 + ||.L.|| by XREAL_1:8; then
    ||.L.|| * ||.x1-x2.|| <= (||.L.||+1) * ||.x1-x2.|| by XREAL_1:64;
    hence
      ||.L0/.x1-L0/.x2 .|| <= (||.L.||+1) * ||.x1-x2.|| by A5,XXREAL_0:2;
   end; then
A6:L0 is_continuous_on (dom L0) by NFCONT_1:45,def 9;
   reconsider R = (the carrier of S) --> 0.T as PartFunc of S,T;
A7:dom R = the carrier of S;
   now let h be (0.S)-convergent sequence of S;
    assume  h is non-zero;
A8: now let n be Nat;
A9:  R/.(h.n) =R.(h.n) by A7,PARTFUN1:def 6
             .=0.T;
A10:  rng h c= dom R;
A11: n in NAT by ORDINAL1:def 12;
     thus ((||.h.||")(#)(R/*h)).n = (||.h.||".n)*((R/*h).n)
           by NDIFF_1:def 2
        .=(||.h.||".n)*(R/.(h.n)) by A11,A10,FUNCT_2:109
        .=0.T by A9,RLVECT_1:10;
    end; then
A12: (||.h.||")(#)(R/*h) is constant by VALUED_0:def 18;
    hence (||.h.||")(#)(R/*h) is convergent by NDIFF_1:18;
    ((||.h.||")(#)(R/*h)).0 = 0.T by A8;
    hence lim ((||.h.||")(#)(R/*h)) = 0.T by A12,NDIFF_1:18;
   end; then
   reconsider R as RestFunc of S,T by NDIFF_1:def 5;
A13:
   now let x0 be Point of S;
    set N = the Neighbourhood of x0;
A14:for x be Point of S st x in N holds L0/.x-L0/.x0=L.(x-x0)+R/.(x-x0)
    proof
     let x be Point of S;
A15: R/.(x-x0) =R.(x-x0) by A7,PARTFUN1:def 6
       .=0.T;
     assume x in N;
     thus L0/.x-L0/.x0 = L.(x-p)-L0/.x0 by A3
       .= L.(x-p)-L.(x0-p) by A3
       .= LP.(x-p)+(-1)*LP.(x0-p) by RLVECT_1:16
       .= LP.(x-p)+LP.((-1)*(x0-p)) by LOPBAN_1:def 5
       .= LP.((x-p)+(-1)*(x0-p)) by VECTSP_1:def 20
       .= LP.((x-p)-(x0-p)) by RLVECT_1:16
       .= LP.(x-((x0-p)+p)) by RLVECT_1:27
       .= LP.(x-(x0-(p-p))) by RLVECT_1:29
       .= LP.(x-(x0-0.S)) by RLVECT_1:15
       .= LP.(x-x0) by RLVECT_1:13
       .= L.(x-x0) + R/.(x-x0) by A15,RLVECT_1:4;
    end;
    hence L0 is_differentiable_in x0 by A4,NDIFF_1:def 6;
    hence diff(L0,x0) = L by A4,A14,NDIFF_1:def 7;
   end;

   set g= f - L0;

A16:dom g = dom f /\ dom L0 by VFUNCT_1:def 2
        .= dom f by A4,XBOOLE_1:28;

A17:for x be Point of S st x in dom g holds g/.x= f/.x - L.(x-p)
   proof
    let x be Point of S;
    assume x in dom g;
    hence g/.x= f/.x - L0/.x by VFUNCT_1:def 2
             .=f/.x - L.(x-p) by A3;
   end;

A18:for x be Point of S st x in [.p,q.] holds g is_continuous_in x
   proof
    let x be Point of S;
    assume x in [.p,q.]; then
A19:f is_continuous_in x by A2;
    L0 | (dom L0) is_continuous_in x by A4,A6,NFCONT_1:def 7;
    hence thesis by A19,NFCONT_1:15;
   end;

A20:for x be Point of S st x in ].p,q.[ holds g is_differentiable_in x
   proof
    let x be Point of S;
    assume x in ].p,q.[; then
    f is_differentiable_in x & L0 is_differentiable_in x by A2,A13;
    hence g is_differentiable_in x by NDIFF_1:36;
   end;

   for x be Point of S st x in ].p,q.[ holds ||. diff(g,x) .|| <= M
   proof
    let x be Point of S;
    assume A21: x in ].p,q.[; then
A22: f is_differentiable_in x by A2;
    L0 is_differentiable_in x & diff(L0,x) = L by A13; then
    diff(g,x) = diff(f,x) - L by A22,NDIFF_1:36;
    hence ||. diff(g,x) .|| <= M by A2,A21;
   end; then
A23:
   ||. g/.q - g/.p .|| <= M*||. q-p .|| by Th19,A1,A16,A18,A20;
   p in [.p,q.] by RLTOPSP1:68; then
   g/.p= f/.p - L.(p-p) by A1,A16,A17; then
A24:g/.p = f/.p - LP.(0.S) by RLVECT_1:15
       .=f/.p - LP.( 0 *p ) by RLVECT_1:10
       .=f/.p - 0 * LP.p by LOPBAN_1:def 5
       .=f/.p - 0.T by RLVECT_1:10
       .=f/.p by RLVECT_1:13;
   q in [.p,q.] by RLTOPSP1:68; then
   g/.q= f/.q - L.(q-p) by A1,A16,A17; then
   f/.q - (L.(q-p) +f/.p ) = g/.q - g/.p by A24,RLVECT_1:27;
   hence thesis by A23,RLVECT_1:27;
end;
