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

theorem
  Z c= dom (( #Z 2)*(cos/sin)) & (for x st x in Z holds sin.x<>0)
implies ( #Z 2)*(cos/sin) is_differentiable_on Z & for x st x in Z holds ((( #Z
  2)*(cos/sin))`|Z).x =-2*cos.x/((sin.x) #Z 3)
proof
  assume that
A1: Z c= dom (( #Z 2)*(cos/sin)) and
A2: for x st x in Z holds sin.x<>0;
  for y being object st y in Z holds y in dom (cos/sin) by A1,FUNCT_1:11;
  then
A3: Z c= dom (cos/sin) by TARSKI:def 3;
A4: for x st x in Z holds ( #Z 2)*(cos/sin) is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then sin.x<>0 by A2;
    then cos/sin is_differentiable_in x by Th47;
    hence thesis by TAYLOR_1:3;
  end;
  then
A5: ( #Z 2)*(cos/sin) is_differentiable_on Z by A1,FDIFF_1:9;
  for x st x in Z holds ((( #Z 2)*(cos/sin))`|Z).x=-2*cos.x/((sin.x) #Z 3 )
  proof
    let x;
    assume
A6: x in Z;
    then
A7: (cos/sin).x = cos.x*(sin.x)" by A3,RFUNCT_1:def 1
      .=cos.x*(1/sin.x) by XCMPLX_1:215
      .=cos.x/sin.x by XCMPLX_1:99;
A8: sin.x<>0 by A2,A6;
    then
A9: cos/sin is_differentiable_in x by Th47;
    ((( #Z 2)*(cos/sin))`|Z).x=diff(( #Z 2)*(cos/sin),x) by A5,A6,FDIFF_1:def 7
      .=2*(((cos/sin).x) #Z (2-1)) * diff(cos/sin,x) by A9,TAYLOR_1:3
      .=2*(((cos/sin).x) #Z (2-1)) *(-1/(sin.x)^2) by A8,Th47
      .=-2*(((cos/sin).x) #Z (2-1)) *(1/(sin.x)^2)
      .=-2*(((cos/sin).x) #Z 1) /(sin.x)^2 by XCMPLX_1:99
      .=-2*(cos.x/sin.x)/(sin.x)^2 by A7,PREPOWER:35
      .=-2*cos.x/sin.x/(sin.x)^2 by XCMPLX_1:74
      .=-2*cos.x/(sin.x*(sin.x)^2) by XCMPLX_1:78
      .=-2*cos.x/(sin.x*((sin.x) #Z 2)) by Th1
      .=-2*cos.x/(((sin.x) #Z 1) *((sin.x) #Z 2)) by PREPOWER:35
      .=-2*cos.x/((sin.x) #Z (1+2)) by A2,A6,PREPOWER:44
      .=-2*cos.x/((sin.x) #Z 3);
    hence thesis;
  end;
  hence thesis by A1,A4,FDIFF_1:9;
end;
