reserve F for RealNormSpace;
reserve G for RealNormSpace;
reserve X for set;
reserve x,x0,g,r,s,p 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 seq for sequence of G;
reserve f,f1,f2 for PartFunc of REAL,the carrier of F;
reserve h for 0-convergent non-zero Real_Sequence;
reserve c for constant Real_Sequence;
reserve R,R1,R2 for RestFunc of F;
reserve L,L1,L2 for LinearFunc of F;

theorem Th21:
  for r,p be Point of F,Z,f
  st Z c= dom f & (for x st x in Z holds f/.x = x*r + p)
  holds f is_differentiable_on Z
  & for x st x in Z holds (f`|Z).x = r
  proof
    let r,p be Point of F;
    let Z,f;
    set R = (REAL --> 0.F);
    defpred P[object] means $1 in REAL;
    A1: dom R = REAL;
    now let h;
      now let n be Nat;
        A2: rng h c= dom R;
        A3: 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 A3,A2,FUNCT_2:108
        .=0.F by RLVECT_1:10;
      end; then
      (h")(#)(R/*h) is constant
      & ((h")(#)(R/*h)).0 = 0.F by VALUED_0:def 18;
      hence (h")(#)(R/*h) is convergent &
      lim ((h")(#)(R/*h)) = 0.F by NDIFF_1:18;
    end;
    then reconsider R as RestFunc of F by Def1;
    assume that
    A4: Z c= dom f and
    A5: for x st x in Z holds f/.x = x*r + p;
    deffunc G(Real) = $1*r;
    consider L being PartFunc of REAL,the carrier of F such that
    A6: (for x being Element of REAL holds x in dom L iff P[x]) &
     for x being Element of REAL st x in dom L holds L.x=G(x) from SEQ_1:sch 3;
    for x being Real holds x in dom L iff P[x]
     by A6;
    then
A7:   dom L = REAL by FDIFF_1:1;
A8: for x being Element of REAL holds L/.x=G(x)
     proof let x be Element of REAL;
A9:     x in dom L by A7;
      L.x=G(x) by A6;
     hence thesis by PARTFUN1:def 6,A9;
     end;
    A10: L is total by PARTFUN1:def 2,A7;
A11: now
    let x;
     reconsider xx=x as Element of REAL by XREAL_0:def 1;
    thus L/.x = L/.xx
      .=x*r by A8;
  end;
  then reconsider L as LinearFunc of F by A10,Def2;
  A12: now
  let x0;
  assume
  A13: x0 in Z;
  then consider N being Neighbourhood of x0 such that
  A14: N c= Z by RCOMP_1:18;
  A15: for x st x in N holds f/.x-f/.x0=L/.(x-x0)+R/.(x-x0)
  proof
    let x be Real;
A16:  x-x0 in REAL by XREAL_0:def 1;
   then
    A17: R/.(x-x0)=R.(x-x0) by A1,PARTFUN1:def 6
    .= 0.F by FUNCOP_1:7,A16;
    assume x in N;
    hence f/.x-f/.x0=x*r+p-f/.x0 by A5,A14
    .=x*r+p - (x0*r+p) by A5,A13
    .=x*r+p - x0*r-p by RLVECT_1:27
    .=p+(x*r- x0*r)-p by RLVECT_1:28
    .=(x*r- x0*r)+(p-p) by RLVECT_1:28
    .=(x*r- x0*r)+0.F by RLVECT_1:15
    .=(x-x0)*r + 0.F by RLVECT_1:35
    .=L/.(x-x0) + R/.(x-x0) by A17,A11;
  end;
  N c= dom f by A4,A14;
  hence f is_differentiable_in x0 by A15;
end;
hence
A18: f is_differentiable_on Z by A4,Th10;
let x0;
assume
A19: x0 in Z;
then consider N being Neighbourhood of x0 such that
A20: N c= Z by RCOMP_1:18;
A21: for x st x in N holds f/.x-f/.x0=L/.(x-x0)+R/.(x-x0)
proof
  let x;
A22: x-x0 in REAL by XREAL_0:def 1;
  then
  A23: R/.(x-x0)=R.(x-x0) by A1,PARTFUN1:def 6
  .= 0.F by FUNCOP_1:7,A22;
  assume x in N;
  hence f/.x - f/.x0 = x*r+p - f/.x0 by A5,A20
  .=x*r+p - (x0*r+p) by A5,A19
  .=x*r+p - x0*r-p by RLVECT_1:27
  .=p+(x*r- x0*r)-p by RLVECT_1:28
  .=(x*r- x0*r)+(p-p) by RLVECT_1:28
  .=(x*r- x0*r)+0.F by RLVECT_1:15
  .=(x-x0)*r + 0.F by RLVECT_1:35
  .=L/.(x-x0) + R/.(x-x0) by A23,A11;
end;
A24: N c= dom f by A4,A20;
A25: f is_differentiable_in x0 by A12,A19;
thus (f`|Z).x0 = diff(f,x0) by A18,A19,Def6
.=L/.jj by A25,A24,A21,Def4
.=1*r by A11
.=r by RLVECT_1:def 8;
end;
