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
  Z c= dom (cos*f) & (for x st x in Z holds f.x=a*x+b) implies cos*f
is_differentiable_on Z & for x st x in Z holds ((cos*f)`|Z).x = -a* sin.(a*x+b)
proof
  assume that
A1: Z c= dom (cos*f) and
A2: for x st x in Z holds f.x=a*x+b;
  for y being object st y in Z holds y in dom f by A1,FUNCT_1:11;
  then
A3: Z c= dom f by TARSKI:def 3;
  then
A4: f is_differentiable_on Z by A2,FDIFF_1:23;
A5: for x st x in Z holds cos*f is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then
A6: f is_differentiable_in x by A4,FDIFF_1:9;
    cos is_differentiable_in f.x by SIN_COS:63;
    hence thesis by A6,FDIFF_2:13;
  end;
  then
A7: cos*f is_differentiable_on Z by A1,FDIFF_1:9;
  for x st x in Z holds ((cos*f)`|Z).x = -a* sin.(a*x+b)
  proof
    let x;
A8: diff(cos, f.x)=-sin.( f.x) by SIN_COS:63;
A9: cos is_differentiable_in f.x by SIN_COS:63;
    assume
A10: x in Z;
    then f is_differentiable_in x by A4,FDIFF_1:9;
    then diff(cos*f,x) = diff(cos, f.x)*diff(f,x) by A9,FDIFF_2:13
      .=-sin.( f.x)*diff(f,x) by A8
      .=-sin.(a*x+b)*diff(f,x) by A2,A10
      .=-sin.(a*x+b)*(f`|Z).x by A4,A10,FDIFF_1:def 7
      .=-a*sin.(a*x+b) by A2,A3,A10,FDIFF_1:23;
    hence thesis by A7,A10,FDIFF_1:def 7;
  end;
  hence thesis by A1,A5,FDIFF_1:9;
end;
