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 Th12:
  Z c= dom (f1+c(#)f2) & (for x st x in Z holds f1.x=a+b*x) & f2=
#Z 2 implies f1+c(#)f2 is_differentiable_on Z & for x st x in Z holds ((f1+c(#)
  f2)`|Z).x = b+2*c*x
proof
  assume that
A1: Z c= dom (f1+c(#)f2) and
A2: for x st x in Z holds f1.x=a+b*x and
A3: f2=#Z 2;
A4: for x st x in Z holds f2 is_differentiable_in x by A3,TAYLOR_1:2;
A5: Z c= dom f1 /\ dom (c(#)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=b*x+a by A2;
  then
A8: f1 is_differentiable_on Z by A6,FDIFF_1:23;
A9: Z c= dom (c(#)f2) by A5,XBOOLE_1:18;
  then Z c= dom f2 by VALUED_1:def 5;
  then
A10: f2 is_differentiable_on Z by A4,FDIFF_1:9;
  then
A11: (c(#)f2) is_differentiable_on Z by A9,FDIFF_1:20;
A12: for x st x in Z holds (f2`|Z).x=2*x
  proof
    let x;
    2 * (x #Z (2-1))=2 * x by PREPOWER:35;
    then
A13: diff(f2,x) =2 * x by A3,TAYLOR_1:2;
    assume x in Z;
    hence thesis by A10,A13,FDIFF_1:def 7;
  end;
A14: for x st x in Z holds ((c(#)f2)`|Z).x=2*c*x
  proof
    let x;
    assume
A15: x in Z;
    hence ((c(#)f2)`|Z).x=c*diff(f2,x) by A9,A10,FDIFF_1:20
      .=c*(f2`|Z).x by A10,A15,FDIFF_1:def 7
      .=c*(2*x) by A12,A15
      .=2*c*x;
  end;
  for x st x in Z holds ((f1+c(#)f2)`|Z).x = b+2*c*x
  proof
    let x;
    assume
A16: x in Z;
    then ((f1+c(#)f2)`|Z).x =diff(f1,x) + diff(c(#)f2,x) by A1,A8,A11,
FDIFF_1:18
      .=(f1`|Z).x+ diff((c(#)f2),x) by A8,A16,FDIFF_1:def 7
      .=(f1`|Z).x+((c(#)f2)`|Z).x by A11,A16,FDIFF_1:def 7
      .=b+((c(#)f2)`|Z).x by A6,A7,A16,FDIFF_1:23
      .=b+2*c*x by A14,A16;
    hence thesis;
  end;
  hence thesis by A1,A8,A11,FDIFF_1:18;
end;
