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

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

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