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 (tan(#)cosec) implies (tan(#)cosec) is_differentiable_on Z &
for x st x in Z holds ((tan(#)cosec)`|Z).x = 1/(cos.x)^2/sin.x-tan.x*cos.x/(sin
  .x)^2
proof
  assume
A1: Z c= dom (tan(#)cosec);
  then
A2: Z c= dom (tan) /\ dom cosec by VALUED_1:def 4;
  then
A3: Z c= dom (tan) by XBOOLE_1:18;
  for x st x in Z holds tan is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then cos.x<>0 by A3,FDIFF_8:1;
    hence thesis by FDIFF_7:46;
  end;
  then
A4: tan is_differentiable_on Z by A3,FDIFF_1:9;
A5: Z c= dom cosec by A2,XBOOLE_1:18;
A6: for x st x in Z holds cosec is_differentiable_in x & diff(cosec, x)=-cos
  .x/(sin.x)^2
  proof
    let x;
    assume x in Z;
    then sin.x<>0 by A5,RFUNCT_1:3;
    hence thesis by Th2;
  end;
  then for x st x in Z holds cosec is_differentiable_in x;
  then
A7: cosec is_differentiable_on Z by A5,FDIFF_1:9;
  for x st x in Z holds ((tan(#)cosec)`|Z).x = 1/(cos.x)^2/sin.x-tan.x*
  cos.x/(sin.x)^2
  proof
    let x;
    assume
A8: x in Z;
    then
A9: cos.x<>0 by A3,FDIFF_8:1;
    ((tan(#)cosec)`|Z).x = (cosec.x)*diff(tan,x)+(tan.x)*diff(cosec,x) by A1,A4
,A7,A8,FDIFF_1:21
      .=(cosec.x)*(1/(cos.x)^2)+(tan.x)*diff(cosec,x) by A9,FDIFF_7:46
      .=(cosec.x)*(1/(cos.x)^2)+(tan.x)*(-cos.x/(sin.x)^2) by A6,A8
      .=(1/(cos.x)^2)/sin.x+(tan.x)*(-cos.x/(sin.x)^2) by A5,A8,RFUNCT_1:def 2;
    hence thesis;
  end;
  hence thesis by A1,A4,A7,FDIFF_1:21;
end;
