reserve x for object;
reserve x0,r,r1,r2,g,g1,g2,p,y0 for Real;
reserve n,m,k,l for Element of NAT;
reserve a,b,d for Real_Sequence;
reserve h,h1,h2 for non-zero 0-convergent Real_Sequence;
reserve c,c1 for constant Real_Sequence;
reserve A for open Subset of REAL;
reserve f,f1,f2 for PartFunc of REAL,REAL;
reserve L for LinearFunc;
reserve R for RestFunc;

theorem
  for A being Subset of REAL holds
  f is_differentiable_on A implies
    f|A is_differentiable_on A & f`|A = (f|A) `| A
proof
  let A be Subset of REAL;
  assume
A1: f is_differentiable_on A;
  then A c= dom f;
  then A c= dom f /\ A by XBOOLE_1:19;
  then
A2: A c= dom (f|A) by RELAT_1:61;
  now
    let x0;
    assume x0 in A;
    then f|A is_differentiable_in x0 by A1;
    hence (f|A)|A is_differentiable_in x0 by RELAT_1:72;
  end;
  hence
A3: f|A is_differentiable_on A by A2;
  then
A4: dom((f|A)`|A) = A by FDIFF_1:def 7;
a5: A is open by A1,FDIFF_1:10;
A5: now
    let x0 be Element of REAL;
    assume
A6: x0 in A;
    then consider N2 being Neighbourhood of x0 such that
A7: N2 c= A by a5,RCOMP_1:18;
A8: f|A is_differentiable_in x0 by A1,A6;
A9: f is_differentiable_in x0 by a5,A1,A6,FDIFF_1:9;
    then consider N1 being Neighbourhood of x0 such that
A10: N1 c= dom f and
A11: ex L,R st for r st r in N1 holds f.r - f.x0 = L.(r - x0) + R.(r -
    x0);
    consider L,R such that
A12: for r st r in N1 holds f.r - f.x0 = L.(r - x0) + R.(r - x0) by A11;
    consider N being Neighbourhood of x0 such that
A13: N c= N1 and
A14: N c= N2 by RCOMP_1:17;
A15: N c= A by A7,A14;
    then
A16: N c= dom (f|A) by A2;
A17: now
      let r be Real;
      assume
A18:  r in N;
      then
A19:  r in A by A15;
      thus (f|A).r - (f|A).x0 = (f|A).r - f.x0 by A2,A6,FUNCT_1:47
        .= f.r - f.x0 by A2,A19,FUNCT_1:47
        .= L.(r-x0) + R.(r-x0) by A12,A13,A18;
    end;
    thus (f`|A).x0 = diff(f,x0) by A1,A6,FDIFF_1:def 7
      .= L.1 by A9,A10,A12,FDIFF_1:def 5
      .= diff(f|A,x0) by A8,A16,A17,FDIFF_1:def 5
      .= ((f|A)`|A).x0 by A3,A6,FDIFF_1:def 7;
  end;
  dom (f`|A) = A by A1,FDIFF_1:def 7;
  hence thesis by A4,A5,PARTFUN1:5;
end;
