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
  f1 is_differentiable_on A & f2 is_differentiable_on A implies
  f1 - f2 is_differentiable_on A & (f1 - f2)`|A = f1`|A - f2`|A
proof
  assume that
A1: f1 is_differentiable_on A and
A2: f2 is_differentiable_on A;
A3: A c= dom f2 by A2;
  A c= dom f1 by A1;
  then A c= dom f1 /\ dom f2 by A3,XBOOLE_1:19;
  then
A4: A c= dom (f1 - f2) by VALUED_1:12;
  then f1 - f2 is_differentiable_on A by A1,A2,FDIFF_1:19;
  then
A5: dom ((f1 - f2)`|A) = A by FDIFF_1:def 7;
A6: dom (f2`|A) = A by A2,FDIFF_1:def 7;
  dom (f1`|A) = A by A1,FDIFF_1:def 7;
  then dom (f1`|A) /\ dom (f2`|A) = A by A6;
  then
A7: dom ((f1`|A) - (f2`|A)) = A by VALUED_1:12;
  now
    let x0 be Element of REAL;
    assume
A8: x0 in A;
    hence ((f1 - f2)`|A).x0 = diff(f1,x0) - diff(f2,x0) by A1,A2,A4,FDIFF_1:19
      .= (f1`|A).x0 - diff(f2,x0) by A1,A8,FDIFF_1:def 7
      .= (f1`|A).x0 - (f2`|A).x0 by A2,A8,FDIFF_1:def 7
      .= ((f1`|A) - (f2`|A)).x0 by A7,A8,VALUED_1:13;
  end;
  hence thesis by A1,A2,A4,A5,A7,FDIFF_1:19,PARTFUN1:5;
end;
