 reserve n,m,i,p for Nat,
         h,k,r,r1,r2,x,x0,x1,x2,x3 for Real;
 reserve f,f1,f2,g for Function of REAL,REAL;

theorem
  x in dom cot & x-h in dom cot implies
  bD(cot(#)cot,h).x = (1/2)*(cos(2*x)-cos(2*(h-x)))/((sin(x)*sin(x-h))^2)
proof
  set f=cot(#)cot;
  assume
A1:x in dom cot & x-h in dom cot;
A2:sin(x)<>0 & sin(x-h)<>0 by A1,FDIFF_8:2;
  x in dom f & x-h in dom f
  proof
    x in dom cot /\ dom cot & x-h in dom cot /\ dom cot by A1;
    hence thesis by VALUED_1:def 4;
  end; then
  bD(f,h).x = (cot(#)cot).x - (cot(#)cot).(x-h) by DIFF_1:38
    .= cot.x*cot.x-(cot(#)cot).(x-h) by VALUED_1:5
    .= cot.x*cot.x-cot.(x-h)*cot.(x-h) by VALUED_1:5
    .= cos.x*(sin.x)"*cot.x-cot.(x-h)*cot.(x-h) by A1,RFUNCT_1:def 1
    .= cos.x*(sin.x)"*(cos.x*(sin.x)")-cot.(x-h)*cot.(x-h)
                                                     by A1,RFUNCT_1:def 1
    .= cos.x*(sin.x)"*(cos.x*(sin.x)")
       -(cos.(x-h)*(sin.(x-h))")*cot.(x-h) by A1,RFUNCT_1:def 1
    .= (cot(x))^2-(cot(x-h))^2 by A1,RFUNCT_1:def 1
    .= (cot(x)-cot(x-h))*(cot(x)+cot(x-h))
    .= (-sin(x-(x-h))/(sin(x)*sin(x-h)))*(cot(x)+cot(x-h)) by A2,SIN_COS4:24
    .= -(sin(x-(x-h))/(sin(x)*sin(x-h)))*(cot(x)+cot(x-h))
    .= -(sin(h)/(sin(x)*sin(x-h)))*(sin(x+(x-h))/(sin(x)*sin(x-h)))
                                                         by A2,SIN_COS4:23
    .= -(sin(h)*sin(2*x-h))/((sin(x)*sin(x-h))^2) by XCMPLX_1:76
    .= -(-(1/2)*(cos(h+(2*x-h))-cos(h-(2*x-h))))/((sin(x)*sin(x-h))^2)
                                                          by SIN_COS4:29
    .= (1/2)*(cos(2*x)-cos(2*(h-x)))/((sin(x)*sin(x-h))^2);
  hence thesis;
end;
