reserve x,x0, r, s, h for Real,

  n for Element of NAT,
  rr, y for set,
  Z for open Subset of REAL,

  f, f1, f2 for PartFunc of REAL,REAL;

theorem Th76:
  -1 <= r & r <= 1 implies diff(arccot,r) = -1/(1+r^2)
proof
  set g = arccot;
  set f = cot|].0,PI.[;
  set x = arccot.r;
  assume that
A1: -1 <= r and
A2: r <= 1;
A3: (sin.x)^2 + (cos.x)^2 = 1 by SIN_COS:28;
A4: f is_differentiable_on ].0,PI.[ by Lm2,FDIFF_2:16;
A5: now
A6: for x0 st x0 in ].0,PI.[ holds -1/(sin.x0)^2 < 0
    proof
      let x0;
      assume x0 in ].0,PI.[;
      then 0 < sin.x0 by COMPTRIG:7;
      then (sin.x0)^2 > 0;
      then 1/(sin.x0)^2 > 0 /(sin.x0)^2;
      then -1/(sin.x0)^2 < -0;
      hence thesis;
    end;
    let x0 such that
A7: x0 in ].0,PI.[;
    diff(f,x0) = (f`|].0,PI.[).x0 by A4,A7,FDIFF_1:def 7
      .= (cot`|].0,PI.[).x0 by Lm2,FDIFF_2:16
      .= diff(cot,x0) by A7,Lm2,FDIFF_1:def 7
      .= -1/(sin.x0)^2 by A7,Lm4;
    hence diff(f,x0) < 0 by A7,A6;
  end;
A8: r in [.-1,1.] by A1,A2,XXREAL_1:1;
  then
A9: x in [.PI/4,3/4*PI.] by Th50;
  x = arccot r;
  then
A10: r = cot x by A1,A2,Th52
    .= cos x/sin x by SIN_COS4:def 2;
  dom f = dom cot /\ ].0,PI.[ by RELAT_1:61;
  then
A11: ].0,PI.[ c= dom f by Th2,XBOOLE_1:19;
A12: f|].0,PI.[ = f by RELAT_1:72;
A13: [.PI/4,3/4*PI.] c= ].0,PI.[ by Lm9,Lm10,XXREAL_2:def 12;
  then sin x <> 0 by A9,COMPTRIG:7;
  then r * sin x = cos x by A10,XCMPLX_1:87;
  then
A14: 1 = (sin x)^2 * ( r^2 + 1 ) by A3;
  f is_differentiable_on ].0,PI.[ by Lm2,FDIFF_2:16;
  then diff(f,x) = (f`|].0,PI.[).x by A9,A13,FDIFF_1:def 7
    .= (cot`|].0,PI.[).x by Lm2,FDIFF_2:16
    .= diff(cot,x) by A9,A13,Lm2,FDIFF_1:def 7
    .= -1/(sin x)^2 by A9,A13,Lm4;
  then diff(g,r) = 1/(-(1/(sin x)^2)) by A8,A4,A5,A12,A11,Th24,FDIFF_2:48
    .= -1/(1/(sin x)^2) by XCMPLX_1:188
    .= -1/(r^2+1) by A14,XCMPLX_1:73;
  hence thesis;
end;
