reserve x,x0, r,r1,r2 for Real,
      th for Real,

  rr for set,

  rseq for Real_Sequence;

theorem Th123:
  arccosec1 is_differentiable_on cosec.:].-PI/2,0.[
proof
  set X = cosec.:].-PI/2,0.[;
  set g1 = arccosec1|(cosec.:].-PI/2,0.[);
  set f = cosec|[.-PI/2,0.[;
  set g = f|].-PI/2,0.[;
A1: g = cosec|].-PI/2,0.[ by RELAT_1:74,XXREAL_1:22;
A2: dom ((g|].-PI/2,0.[)") = rng (g|].-PI/2,0.[) by FUNCT_1:33
    .= rng(cosec|].-PI/2,0.[) by A1,RELAT_1:72
    .= cosec.:].-PI/2,0.[ by RELAT_1:115;
A3: (g|].-PI/2,0.[)" = (f|].-PI/2,0.[)" by RELAT_1:72
    .= arccosec1|(f.:].-PI/2,0.[) by RFUNCT_2:17
    .= arccosec1|(rng(f|].-PI/2,0.[)) by RELAT_1:115
    .= arccosec1|(rng (cosec|].-PI/2,0.[)) by RELAT_1:74,XXREAL_1:22
    .= arccosec1|(cosec.:].-PI/2,0.[) by RELAT_1:115;
A4: g is_differentiable_on ].-PI/2,0.[ by A1,Th7,FDIFF_2:16;
  now
A5: for x0 st x0 in ].-PI/2,0.[ holds -cos.x0/(sin.x0)^2 < 0
    proof
      let x0;
      assume
A6:   x0 in ].-PI/2,0.[;
      then x0 < 0 by XXREAL_1:4;
      then
A7:   x0+2*PI < 0+2*PI by XREAL_1:8;
      ].-PI/2,0.[ \/ {-PI/2} = [.-PI/2,0.[ by XXREAL_1:131;
      then ].-PI/2,0.[ c= [.-PI/2,0.[ by XBOOLE_1:7;
      then ].-PI/2,0.[ c= ].-PI,0.[ by Lm3;
      then -PI < x0 by A6,XXREAL_1:4;
      then -PI+2*PI < x0+2*PI by XREAL_1:8;
      then x0+2*PI in ].PI,2*PI.[ by A7;
      then sin.(x0+2*PI) < 0 by COMPTRIG:9;
      then
A8:   sin.x0 < 0 by SIN_COS:78;
      ].-PI/2,0.[ c= ].-PI/2,PI/2.[ by XXREAL_1:46;
      then cos.x0 > 0 by A6,COMPTRIG:11;
      hence thesis by A8;
    end;
    let x0 such that
A9: x0 in ].-PI/2,0.[;
    diff(g,x0) = (g`|].-PI/2,0.[).x0 by A4,A9,FDIFF_1:def 7
      .= ((cosec|].-PI/2,0.[)`|].-PI/2,0.[).x0 by RELAT_1:74,XXREAL_1:22
      .= (cosec`|].-PI/2,0.[).x0 by Th7,FDIFF_2:16
      .= diff(cosec,x0) by A9,Th7,FDIFF_1:def 7
      .= -cos.x0/(sin.x0)^2 by A9,Th7;
    hence diff(g,x0) < 0 by A9,A5;
  end;
  then
A10: g1 is_differentiable_on X by A2,A4,A3,Lm23,FDIFF_2:48;
A11: for x st x in X holds arccosec1|X is_differentiable_in x
  proof
    let x;
    assume x in X;
    then g1|X is_differentiable_in x by A10,FDIFF_1:def 6;
    hence thesis by RELAT_1:72;
  end;
  X c= dom arccosec1 by A2,A3,RELAT_1:60;
  hence thesis by A11,FDIFF_1:def 6;
end;
