reserve f,f1,f2,g for PartFunc of REAL,REAL;
reserve A for non empty closed_interval Subset of REAL;
reserve p,r,x,x0 for Real;
reserve n for Element of NAT;
reserve Z for open Subset of REAL;

theorem Th22:
  for f1,x0 st f1 is_differentiable_in x0 holds -f1
  is_differentiable_in x0 & diff(-f1,x0)=-diff(f1,x0)
proof
  let f1,x0;
  assume
A1: f1 is_differentiable_in x0;
  then consider N1 be Neighbourhood of x0 such that
A2: N1 c= dom f1 and
A3: ex L being LinearFunc,R being RestFunc st for x st x in N1 holds f1.x - f1.
  x0 = L.(x-x0) + R.(x-x0) by FDIFF_1:def 4;
  consider L1 being LinearFunc,R1 being RestFunc such that
A4: for x st x in N1 holds f1.x - f1.x0 = L1.(x-x0) + R1.(x-x0) by A3;
  reconsider R=-R1 as RestFunc by Th21;
  reconsider L=-L1 as LinearFunc by Th20;
A5: L1 is total by FDIFF_1:def 3;
  consider N be Neighbourhood of x0 such that
A6: N c= N1;
A7: R1 is total by FDIFF_1:def 2;
A8: now
    let x;
    assume
A9: x in N;
     reconsider xx=x, xx0=x0 as Element of REAL by XREAL_0:def 1;
    thus (-f1).x - (-f1).x0 = -(f1.x) - (-f1).x0 by VALUED_1:8
      .= -(f1.x) - -(f1.x0) by VALUED_1:8
      .= -((f1.x) -(f1.x0))
      .= -(L1.(x-x0) + R1.(x-x0)) by A4,A6,A9
      .= -L1.(x-x0) + -R1.(x-x0)
      .= L.(xx-xx0)+-R1.(x-x0) by A5,RFUNCT_1:58
      .= L.(x-x0)+R.(x-x0) by A7,RFUNCT_1:58;
  end;
  N c= dom f1 by A2,A6,XBOOLE_1:1;
  then
A10: N c= dom -f1 by VALUED_1:8;
  hence -f1 is_differentiable_in x0 by A8,FDIFF_1:def 4;
  hence diff(-f1,x0)=L.1 by A10,A8,FDIFF_1:def 5
    .=-L1.jj by A5,RFUNCT_1:58
    .=-diff(f1,x0) by A1,A2,A4,FDIFF_1:def 5;
end;
