reserve y for set;
reserve x,a,b,c for Real;
reserve n for Element of NAT;
reserve Z for open Subset of REAL;
reserve f,f1,f2 for PartFunc of REAL,REAL;

theorem Th20:
  Z c= dom (f1+f2) & (for x st x in Z holds f1.x=a) & f2=#Z 3
implies f1+f2 is_differentiable_on Z & for x st x in Z holds ((f1+f2)`|Z).x = 3
  *x |^2
proof
  assume that
A1: Z c= dom (f1+f2) and
A2: for x st x in Z holds f1.x=a and
A3: f2=#Z 3;
A4: for x st x in Z holds f2 is_differentiable_in x by A3,TAYLOR_1:2;
A5: Z c= dom f1 /\ dom f2 by A1,VALUED_1:def 1;
  then
A6: Z c= dom f1 by XBOOLE_1:18;
A7: for x st x in Z holds f1.x = 0*x+a by A2;
  then
A8: f1 is_differentiable_on Z by A6,FDIFF_1:23;
  Z c= dom f2 by A5,XBOOLE_1:18;
  then
A9: f2 is_differentiable_on Z by A4,FDIFF_1:9;
A10: for x st x in Z holds (f2`|Z).x = 3 * x #Z (3-1)
  proof
    let x;
    assume
A11: x in Z;
    diff(f2,x) = 3 * x #Z (3-1) by A3,TAYLOR_1:2;
    hence thesis by A9,A11,FDIFF_1:def 7;
  end;
  for x st x in Z holds ((f1+f2)`|Z).x = 3*x|^2
  proof
    let x;
    assume
A12: x in Z;
    then ((f1+f2)`|Z).x=diff(f1,x)+diff(f2,x) by A1,A8,A9,FDIFF_1:18;
    hence ((f1+f2)`|Z).x=(f1`|Z).x +diff(f2,x) by A8,A12,FDIFF_1:def 7
      .=(f1`|Z).x +(f2`|Z).x by A9,A12,FDIFF_1:def 7
      .=0+(f2`|Z).x by A6,A7,A12,FDIFF_1:23
      .=3 * x #Z (3-1) by A10,A12
      .=3*x |^2 by PREPOWER:36;
  end;
  hence thesis by A1,A8,A9,FDIFF_1:18;
end;
