let Z be open Subset of REAL ; :: thesis: ( Z c= dom ((- cot ) - cosec ) & ( for x being Real st x in Z holds
( 1 + (cos . x) <> 0 & 1 - (cos . x) <> 0 ) ) implies ( (- cot ) - cosec is_differentiable_on Z & ( for x being Real st x in Z holds
(((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x)) ) ) )

assume that
A1: Z c= dom ((- cot ) - cosec ) and
A2: for x being Real st x in Z holds
( 1 + (cos . x) <> 0 & 1 - (cos . x) <> 0 ) ; :: thesis: ( (- cot ) - cosec is_differentiable_on Z & ( for x being Real st x in Z holds
(((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x)) ) )

Z c= (dom (- cot )) /\ (dom (sin ^ )) by A1, VALUED_1:12;
then A3: Z c= dom (- cot ) by XBOOLE_1:18;
then A4: Z c= dom cot by VALUED_1:8;
for x being Real st x in Z holds
cot is_differentiable_in x
proof end;
then A5: cot is_differentiable_on Z by A4, FDIFF_1:16;
then A6: (- 1) (#) cot is_differentiable_on Z by A3, FDIFF_1:28;
A7: for x being Real st x in Z holds
sin . x <> 0 by A4, FDIFF_8:2;
then A8: sin ^ is_differentiable_on Z by FDIFF_4:40;
for x being Real st x in Z holds
(((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x))
proof
let x be Real; :: thesis: ( x in Z implies (((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x)) )
assume A9: x in Z ; :: thesis: (((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x))
then A10: sin . x <> 0 by A4, FDIFF_8:2;
A11: 1 + (cos . x) <> 0 by A2, A9;
(((- cot ) - cosec ) `| Z) . x = (diff (- cot ),x) - (diff (sin ^ ),x) by A1, A8, A6, A9, FDIFF_1:27
.= ((((- 1) (#) cot ) `| Z) . x) - (diff (sin ^ ),x) by A6, A9, FDIFF_1:def 8
.= ((- 1) * (diff cot ,x)) - (diff (sin ^ ),x) by A3, A5, A9, FDIFF_1:28
.= ((- 1) * (- (1 / ((sin . x) ^2 )))) - (diff (sin ^ ),x) by A10, FDIFF_7:47
.= (1 / ((sin . x) ^2 )) - (((sin ^ ) `| Z) . x) by A8, A9, FDIFF_1:def 8
.= (1 / ((sin . x) ^2 )) - (- ((cos . x) / ((sin . x) ^2 ))) by A7, A9, FDIFF_4:40
.= (1 / ((sin . x) ^2 )) + ((cos . x) / ((sin . x) ^2 ))
.= (1 + (cos . x)) / ((((sin . x) ^2 ) + ((cos . x) ^2 )) - ((cos . x) ^2 )) by XCMPLX_1:63
.= (1 + (cos . x)) / (1 - ((cos . x) ^2 )) by SIN_COS:31
.= (1 + (cos . x)) / ((1 + (cos . x)) * (1 - (cos . x)))
.= ((1 + (cos . x)) / (1 + (cos . x))) / (1 - (cos . x)) by XCMPLX_1:79
.= 1 / (1 - (cos . x)) by A11, XCMPLX_1:60 ;
hence (((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x)) ; :: thesis: verum
end;
hence ( (- cot ) - cosec is_differentiable_on Z & ( for x being Real st x in Z holds
(((- cot ) - cosec ) `| Z) . x = 1 / (1 - (cos . x)) ) ) by A1, A8, A6, FDIFF_1:27; :: thesis: verum