reserve x,a,b,c for Real,
  n for Nat,
  Z for open Subset of REAL,
  f, f1,f2 for PartFunc of REAL,REAL;

theorem
  (Z c= dom ((-1/a)(#)(cosec*f)-id Z) & for x st x in Z holds f.x=a*x &
a<>0) implies (-1/a)(#)(cosec*f)-id Z is_differentiable_on Z & for x st x in Z
holds (((-1/a)(#)(cosec*f)-id Z)`|Z).x= (cos.(a*x)-(sin.(a*x))^2)/(sin.(a*x))^2
proof
  assume that
A1: Z c= dom ((-1/a)(#)(cosec*f)-id Z) and
A2: for x st x in Z holds f.x=a*x & a<>0;
A3: Z c= dom ((-1/a)(#)(cosec*f)) /\ dom (id Z) by A1,VALUED_1:12;
  then
A4: Z c= dom ((-1/a)(#)(cosec*f)) by XBOOLE_1:18;
  then
A5: Z c= dom (cosec*f) by VALUED_1:def 5;
A6: for x st x in Z holds f.x=a*x+0 by A2;
  then
A7: cosec*f is_differentiable_on Z by A5,Th7;
  then
A8: (-1/a)(#)(cosec*f) is_differentiable_on Z by A4,FDIFF_1:20;
  set g = (-1/a)(#)(cosec*f);
A9: for x st x in Z holds (id Z).x = 1*x+0 by FUNCT_1:18;
A10: Z c= dom (id Z) by A3,XBOOLE_1:18;
  then
A11: id Z is_differentiable_on Z by A9,FDIFF_1:23;
A12: for x st x in Z holds sin.(f.x)<>0
  proof
    let x;
    assume x in Z;
    then f.x in dom cosec by A5,FUNCT_1:11;
    hence thesis by RFUNCT_1:3;
  end;
  for x st x in Z holds (((-1/a)(#)(cosec*f)-id Z)`|Z).x= (cos.(a*x)-(sin
  .(a*x))^2)/(sin.(a*x))^2
  proof
    let x;
    assume
A13: x in Z;
    then
A14: f.x=a*x+0 by A2;
    sin.(f.x)<>0 by A12,A13;
    then
A15: (sin.(a*x))^2>0 by A14,SQUARE_1:12;
    ((g-id Z)`|Z).x=diff(g,x)-diff(id Z,x) by A1,A8,A11,A13,FDIFF_1:19
      .=(g`|Z).x-diff(id Z,x) by A8,A13,FDIFF_1:def 7
      .=(-1/a)*diff(cosec*f,x)-diff(id Z,x) by A4,A7,A13,FDIFF_1:20
      .=(-1/a)*((cosec*f)`|Z).x-diff(id Z,x) by A7,A13,FDIFF_1:def 7
      .=(-1/a)*((cosec*f)`|Z).x-((id Z)`|Z).x by A11,A13,FDIFF_1:def 7
      .=(-1/a)*(-a*cos.(a*x)/(sin.(a*x))^2)-((id Z)`|Z).x by A5,A6,A13,A14,Th7
      .=((-1)/a)*((a*(-cos.(a*x)))/(sin.(a*x))^2) -1 by A10,A9,A13,FDIFF_1:23
      .=((-1)*(a*(-cos.(a*x))))/(a*(sin.(a*x))^2) -1 by XCMPLX_1:76
      .=(cos.(a*x)*a)/((sin.(a*x))^2*a) -1
      .=cos.(a*x)/(sin.(a*x))^2 -1 by A2,A13,XCMPLX_1:91
      .=cos.(a*x)/(sin.(a*x))^2-(sin.(a*x))^2/(sin.(a*x))^2 by A15,XCMPLX_1:60
      .=(cos.(a*x)-(sin.(a*x))^2)/(sin.(a*x))^2;
    hence thesis;
  end;
  hence thesis by A1,A8,A11,FDIFF_1:19;
end;
