reserve x for Real,

  Z for open Subset of REAL;

theorem
  Z c= dom ((tan-cot)/exp_R) implies (tan-cot)/exp_R
is_differentiable_on Z & for x st x in Z holds (((tan-cot)/exp_R)`|Z).x = (1/(
  cos.x)^2+1/(sin.x)^2-tan.x+cot.x)/exp_R.x
proof
A1: for x st x in Z holds exp_R.x<>0 by SIN_COS:54;
  assume Z c= dom ((tan-cot)/exp_R);
  then Z c= dom (tan-cot) /\ (dom exp_R \ (exp_R)"{0}) by RFUNCT_1:def 1;
  then
A2: Z c= dom (tan-cot) by XBOOLE_1:18;
  then
A3: tan-cot is_differentiable_on Z by Th5;
A4: exp_R is_differentiable_on Z by FDIFF_1:26,TAYLOR_1:16;
  then
A5: (tan-cot)/exp_R is_differentiable_on Z by A3,A1,FDIFF_2:21;
  for x st x in Z holds (((tan-cot)/exp_R)`|Z).x =(1/(cos.x)^2+1/(sin.x)^2
  -tan.x+cot.x)/exp_R.x
  proof
    let x;
A6: exp_R is_differentiable_in x by SIN_COS:65;
A7: exp_R.x <>0 by SIN_COS:54;
    assume
A8: x in Z;
    then
A9: (tan-cot).x=tan.x-cot.x by A2,VALUED_1:13;
    tan-cot is_differentiable_in x by A3,A8,FDIFF_1:9;
    then diff((tan-cot)/exp_R,x) =(diff(tan-cot,x) *exp_R.x -diff(exp_R,x) *(
    tan-cot).x)/(exp_R.x)^2 by A6,A7,FDIFF_2:14
      .=(((tan-cot)`|Z).x *exp_R.x-diff(exp_R,x) *(tan-cot).x)/(exp_R.x)^2
    by A3,A8,FDIFF_1:def 7
      .=((1/(cos.x)^2+1/(sin.x)^2)*exp_R.x-diff(exp_R,x)*(tan-cot).x) /(
    exp_R.x)^2 by A2,A8,Th5
      .=((1/(cos.x)^2+1/(sin.x)^2)*exp_R.x-exp_R.x*(tan.x-cot.x)) /(exp_R.x*
    exp_R.x) by A9,SIN_COS:65
      .=(1/(cos.x)^2+1/(sin.x)^2-(tan.x-cot.x))* (exp_R.x/((exp_R.x)*(exp_R.
    x)))
      .=(1/(cos.x)^2+1/(sin.x)^2-(tan.x-cot.x))* ((exp_R.x)/(exp_R.x)/(exp_R
    .x)) by XCMPLX_1:78
      .=(1/(cos.x)^2+1/(sin.x)^2-(tan.x-cot.x))*(1/exp_R.x) by A7,XCMPLX_1:60
      .=(1/(cos.x)^2+1/(sin.x)^2-(tan.x-cot.x))/exp_R.x;
    hence thesis by A5,A8,FDIFF_1:def 7;
  end;
  hence thesis by A3,A4,A1,FDIFF_2:21;
end;
