reserve f,f1,f2,g for PartFunc of REAL,REAL;
reserve A for non empty closed_interval Subset of REAL;
reserve p,r,x,x0 for Real;
reserve n for Element of NAT;
reserve Z for open Subset of REAL;

theorem Th34:
  Z c= dom cot implies cot is_differentiable_on Z &
  for x st x in Z holds (cot`|Z).x = - 1/(sin.x)^2
proof
  assume that
A1: Z c= dom cot;
A2: for x st x in Z holds cot is_differentiable_in x
  proof
    let x;
    assume x in Z; then
    x in dom cot by A1; then
A3: sin.x <> 0 by FDIFF_8:2;
    sin is_differentiable_in x & cos is_differentiable_in x by SIN_COS:63,64;
    hence thesis by A3,FDIFF_2:14;
  end;
  then
A4: cot is_differentiable_on Z by A1,FDIFF_1:9;
  for x st x in Z holds (cot`|Z).x = -1/(sin.x)^2
  proof
    let x;
A5: sin is_differentiable_in x & cos is_differentiable_in x by SIN_COS:63,64;
    assume
A6: x in Z; then
    x in dom cot by A1;
    then sin.x <> 0 by FDIFF_8:2;
    then diff (cot,x)=(diff(cos,x) * sin.x - diff(sin,x)*cos.x)/(sin.x)^2 by A5
,FDIFF_2:14
      .=((-sin.x)*sin.x - diff(sin,x)*cos.x)/(sin.x)^2 by SIN_COS:63
      .=(-(sin.x)*(sin.x)-(cos.x)*(cos.x))/(sin.x)^2 by SIN_COS:64
      .=(-((sin.x)*(sin.x) + (cos.x)*(cos.x) ))/(sin.x)^2
      .=(-((sin.x)*(sin.x) + (cos.x)^2 ))/(sin.x)^2
      .=(-((sin.x)^2 + (cos.x)^2 ))/(sin.x)^2
      .=-((cos.x)^2 + (sin.x)^2)/(sin.x)^2by XCMPLX_1:187
      .=-1/(sin.x)^2 by SIN_COS:28;
    hence thesis by A4,A6,FDIFF_1:def 7;
  end;
  hence thesis by A1,A2,FDIFF_1:9;
end;
