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 (ln*cot) implies ln*cot is_differentiable_on Z & for x st x
  in Z holds ((ln*cot)`|Z).x = -1/(sin.x*cos.x)
proof
  assume
A1: Z c= dom (ln*cot);
A2: for x st x in Z holds cot.x>0
  proof
    let x;
    assume x in Z;
    then cot.x in right_open_halfline(0) by A1,FUNCT_1:11,TAYLOR_1:18;
    then ex g being Real st cot.x=g & 0<g by Lm1;
    hence thesis;
  end;
  dom (ln*cot) c= dom cot by RELAT_1:25;
  then
A3: Z c= dom cot by A1,XBOOLE_1:1;
A4: for x st x in Z holds sin.x<>0
  proof
    let x;
    assume x in Z;
    then x in dom (cos/sin) by A1,FUNCT_1:11;
    hence thesis by Th2;
  end;
A5: for x st x in Z holds cot is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then sin.x<>0 by A4;
    hence thesis by FDIFF_7:47;
  end;
A6: for x st x in Z holds ln*cot is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then cot is_differentiable_in x & cot.x>0 by A2,A5;
    hence thesis by TAYLOR_1:20;
  end;
  then
A7: ln*cot is_differentiable_on Z by A1,FDIFF_1:9;
  for x st x in Z holds ((ln*cot)`|Z).x =-1/(sin.x*cos.x)
  proof
    let x;
    assume
A8: x in Z;
    then
A9: sin.x<>0 by A4;
    cot is_differentiable_in x & cot.x>0 by A2,A5,A8;
    then diff(ln*cot,x) =diff(cot,x)/(cot.x) by TAYLOR_1:20
      .=(-1/(sin.x)^2)/(cot.x) by A9,FDIFF_7:47
      .=-1/(sin.x)^2/cot.x
      .=-1/((sin.x)^2*cot.x) by XCMPLX_1:78
      .=-1/((sin.x)^2*(cos.x/sin.x)) by A3,A8,RFUNCT_1:def 1
      .=-1/(((sin.x)^2*cos.x)/sin.x)
      .=-sin.x/((sin.x)^2*cos.x) by XCMPLX_1:57
      .=-sin.x/(sin.x)^2/cos.x by XCMPLX_1:78
      .=-sin.x/sin.x/sin.x/cos.x by XCMPLX_1:78
      .=-1/sin.x/cos.x by A4,A8,XCMPLX_1:60
      .=-1/(sin.x*cos.x) by XCMPLX_1:78;
    hence thesis by A7,A8,FDIFF_1:def 7;
  end;
  hence thesis by A1,A6,FDIFF_1:9;
end;
