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 Th15:
  f is_differentiable_in x0 implies r(#)f is_differentiable_in x0
  & diff((r(#)f),x0) = r*diff(f,x0)
proof
  reconsider j =1 as Element of REAL by XREAL_0:def 1;
  assume
A1: f is_differentiable_in x0;
  then consider N1 be Neighbourhood of x0 such that
A2: N1 c= dom f and
A3: ex L,R st for x st x in N1 holds f.x - f.x0 = L.(x-x0) + R.(x-x0);
  consider L1,R1 such that
A4: for x st x in N1 holds f.x - f.x0 = L1.(x-x0) + R1.(x-x0) by A3;
  reconsider R = r(#)R1 as RestFunc by Th5;
  reconsider L = r(#)L1 as LinearFunc by Th3;
A5: L1 is total by Def3;
A6: N1 c= dom(r(#)f) by A2,VALUED_1:def 5;
A7: R1 is total by Def2;
A8: now
    let x;
A9: x0 in N1 by RCOMP_1:16;
     reconsider xx = x, xx0 = x0 as Element of REAL by XREAL_0:def 1;
    assume
A10: x in N1;
    hence (r(#)f).x - (r(#)f).x0 = r*(f.x) - (r(#)f).x0 by A6,VALUED_1:def 5
      .= r*f.x - r*f.x0 by A6,A9,VALUED_1:def 5
      .= r*(f.x - f.x0)
      .= r*(L1.(x-x0) + R1.(x-x0)) by A4,A10
      .= r*L1.(x-x0) + r*R1.(x-x0)
      .= L.(xx-xx0) + r*R1.(xx-xx0) by A5,RFUNCT_1:57
      .= L.(x-x0) + R.(x-x0) by A7,RFUNCT_1:57;
  end;
  hence r(#)f is_differentiable_in x0 by A6;
  hence diff((r(#)f),x0) = L.1 by A6,A8,Def5
    .= r*L1.j by A5,RFUNCT_1:57
    .= r*diff(f,x0) by A1,A2,A4,Def5;
end;
