let Z be open Subset of REAL; :: thesis: ( Z c= dom (cot (#) cosec) implies ( cot (#) cosec is_differentiable_on Z & ( for x being Real st x in Z holds
((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2)) ) ) )

assume A1: Z c= dom (cot (#) cosec) ; :: thesis: ( cot (#) cosec is_differentiable_on Z & ( for x being Real st x in Z holds
((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2)) ) )

then A2: Z c= (dom cot) /\ (dom cosec) by VALUED_1:def 4;
then A3: Z c= dom cot by XBOOLE_1:18;
for x being Real st x in Z holds
cot is_differentiable_in x
proof end;
then A4: cot is_differentiable_on Z by A3, FDIFF_1:9;
A5: Z c= dom cosec by A2, XBOOLE_1:18;
A6: for x being Real st x in Z holds
( cosec is_differentiable_in x & diff (cosec,x) = - ((cos . x) / ((sin . x) ^2)) )
proof
let x be Real; :: thesis: ( x in Z implies ( cosec is_differentiable_in x & diff (cosec,x) = - ((cos . x) / ((sin . x) ^2)) ) )
assume x in Z ; :: thesis: ( cosec is_differentiable_in x & diff (cosec,x) = - ((cos . x) / ((sin . x) ^2)) )
then sin . x <> 0 by A5, RFUNCT_1:3;
hence ( cosec is_differentiable_in x & diff (cosec,x) = - ((cos . x) / ((sin . x) ^2)) ) by Th2; :: thesis: verum
end;
then for x being Real st x in Z holds
cosec is_differentiable_in x ;
then A7: cosec is_differentiable_on Z by A5, FDIFF_1:9;
for x being Real st x in Z holds
((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2))
proof
let x be Real; :: thesis: ( x in Z implies ((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2)) )
assume A8: x in Z ; :: thesis: ((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2))
then A9: sin . x <> 0 by A3, FDIFF_8:2;
((cot (#) cosec) `| Z) . x = ((cosec . x) * (diff (cot,x))) + ((cot . x) * (diff (cosec,x))) by A1, A4, A7, A8, FDIFF_1:21
.= ((cosec . x) * (- (1 / ((sin . x) ^2)))) + ((cot . x) * (diff (cosec,x))) by A9, FDIFF_7:47
.= ((cosec . x) * (- (1 / ((sin . x) ^2)))) + ((cot . x) * (- ((cos . x) / ((sin . x) ^2)))) by A6, A8
.= ((- (1 / ((sin . x) ^2))) / (sin . x)) + ((cot . x) * (- ((cos . x) / ((sin . x) ^2)))) by A5, A8, RFUNCT_1:def 2 ;
hence ((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2)) ; :: thesis: verum
end;
hence ( cot (#) cosec is_differentiable_on Z & ( for x being Real st x in Z holds
((cot (#) cosec) `| Z) . x = (- ((1 / ((sin . x) ^2)) / (sin . x))) - (((cot . x) * (cos . x)) / ((sin . x) ^2)) ) ) by A1, A4, A7, FDIFF_1:21; :: thesis: verum