 reserve a,b,x,r for Real;
 reserve y for set;
 reserve n for Element of NAT;
 reserve A for non empty closed_interval Subset of REAL;
 reserve f,g,f1,f2,g1,g2 for PartFunc of REAL,REAL;
 reserve Z for open Subset of REAL;

theorem
 A c= Z & f=(n(#)(( #Z (n-1))*cos))/(( #Z (n+1))*sin)
 & 1<=n & Z c= dom (( #Z n)*cot) & Z = dom f
 implies
 integral(f,A)=(-( #Z n)*cot).(upper_bound A)-(-( #Z n)*cot).(lower_bound A)
proof
  assume
A1:A c= Z & f=(n(#)(( #Z (n-1))*cos))/(( #Z (n+1))*sin)
 & 1<=n & Z c= dom (( #Z n)*cot) & Z = dom f;
then Z = dom (n(#)(( #Z (n-1))*cos)) /\
                (dom (( #Z (n+1))*sin) \ (( #Z (n+1))*sin)"{0})
   by RFUNCT_1:def 1;
then A2:Z c= dom (n(#)(( #Z (n-1))*cos)) &
   Z c= dom (( #Z (n+1))*sin) \ (( #Z (n+1))*sin)"{0} by XBOOLE_1:18;
then A3:Z c= dom ((( #Z (n+1))*sin)^) by RFUNCT_1:def 2;
    dom ((( #Z (n+1))*sin)^) c= dom (( #Z (n+1))*sin) by RFUNCT_1:1;then
A4:Z c= dom (( #Z (n+1))*sin) by A3;
A5: x in Z implies (( #Z (n+1))*sin).x <> 0
    proof
    assume x in Z;
   then x in dom (n(#)(( #Z (n-1))*cos)) /\
                (dom (( #Z (n+1))*sin) \ (( #Z (n+1))*sin)"{0})
        by A1,RFUNCT_1:def 1;
   then x in dom (( #Z (n+1))*sin) \ (( #Z (n+1))*sin)"{0}
        by XBOOLE_0:def 4; then
   x in dom ((( #Z (n+1))*sin)^) by RFUNCT_1:def 2;
     hence thesis by RFUNCT_1:3;
   end;
A6:Z c= dom (( #Z (n-1))*cos) by A2,VALUED_1:def 5;
A7:#Z (n-1)*cos is_differentiable_in x
   proof
   consider m being Nat such that
A8: n = m + 1 by A1,NAT_1:6;
    cos is_differentiable_in x by SIN_COS:63;
   hence thesis by A8,TAYLOR_1:3;
   end;
 #Z (n-1)*cos is_differentiable_on Z
   proof
   for x st x in Z holds #Z (n-1)*cos is_differentiable_in x by A7;
   hence thesis by A6,FDIFF_1:9;
   end;
then A9:(n(#)(( #Z (n-1))*cos)) is_differentiable_on Z by A2,FDIFF_1:20;
A10: #Z (n+1)*sin is_differentiable_in x
    proof
    sin is_differentiable_in x by SIN_COS:64;
    hence thesis by TAYLOR_1:3;
    end;
(( #Z (n+1))*sin) is_differentiable_on Z
   proof
   for x st x in Z holds ( #Z (n+1))*sin is_differentiable_in x by A10;
   hence thesis by A4,FDIFF_1:9;
   end;
then f|Z is continuous by A1,A5,A9,FDIFF_1:25,FDIFF_2:21;
then f|A is continuous by A1,FCONT_1:16;
then A11:f is_integrable_on A & f|A is bounded by A1,INTEGRA5:10,11;
A12:( #Z n)*cot is_differentiable_on Z by A1,FDIFF_8:21;
A13:dom (( #Z n)*cot) c= dom cot by RELAT_1:25;
A14:Z c= dom (-( #Z n)*cot) by A1,VALUED_1:8;
then A15:(-1)(#)(( #Z n)*cot) is_differentiable_on Z by A12,FDIFF_1:20;
A16:for x st x in Z holds sin.x<>0
  proof
    let x;
    assume x in Z;
    then x in dom (cos/sin) by A1,FUNCT_1:11;
    hence thesis by FDIFF_8:2;
  end;
A17:for x st x in Z holds ((-( #Z n)*cot)`|Z).x
                              =n*(cos.x) #Z (n-1)/(sin.x) #Z (n+1)
    proof
      let x;
      assume
A18:x in Z;then
A19: sin.x<>0 by A16; then
A20: cot is_differentiable_in x by FDIFF_7:47;
    consider m being Nat such that
A21: n = m + 1 by A1,NAT_1:6;
    set m = n-1;
A22:( #Z n)*cot is_differentiable_in x by A12,A18,FDIFF_1:9;
   ((-( #Z n)*cot)`|Z).x=diff(-( #Z n)*cot,x) by A15,A18,FDIFF_1:def 7
                     .=(-1)*diff(( #Z n)*cot,x) by A22,FDIFF_1:15
                     .=(-1)*(n*(cot.x) #Z (n-1) * diff(cot,x))
by A20,TAYLOR_1:3
                     .=(-1)*(n*(cot.x) #Z (n-1) *(-1/(sin.x)^2))
by A19,FDIFF_7:47
                     .=(-1)*(-(n*(cot.x) #Z (n-1))/(sin.x)^2)
                     .=(-1)*(-n*((cos.x) #Z m/(sin.x) #Z m)/(sin.x)^2)
                                    by A1,A13,A18,A21,FDIFF_8:3,XBOOLE_1:1
                     .=(-1)*(-n*(cos.x) #Z (n-1)/(sin.x) #Z (n-1)/(sin.x)^2)
                     .=(-1)*(-n*(cos.x) #Z (n-1)/((sin.x) #Z (n-1)*(sin.x)^2))
by XCMPLX_1:78
                .=(-1)*(-n*((cos.x) #Z (n-1))/((sin.x) #Z (n-1)*(sin.x) #Z 2))
by FDIFF_7:1
                     .=(-1)*(-n*((cos.x) #Z (n-1))/((sin.x) #Z (n-1+2)))
by A16,A18,PREPOWER:44
                     .=n*((cos.x) #Z (n-1))/(sin.x) #Z (n+1);
    hence thesis;
    end;
A23:for x st x in Z holds f.x = n*(cos.x) #Z (n-1)/(sin.x) #Z (n+1)
   proof
   let x;
   assume
A24:x in Z;
     then ((n(#)(( #Z (n-1))*cos))/(( #Z (n+1))*sin)).x
    =(n(#)(( #Z (n-1))*cos)).x/(( #Z (n+1))*sin).x by A1,RFUNCT_1:def 1
   .=n*(( #Z (n-1))*cos).x/(( #Z (n+1))*sin).x by VALUED_1:6
   .=n*(( #Z (n-1)).(cos.x))/(( #Z (n+1))*sin).x by A6,A24,FUNCT_1:12
   .=n*(cos.x) #Z (n-1)/(( #Z (n+1))*sin).x by TAYLOR_1:def 1
   .=n*(cos.x) #Z (n-1)/(( #Z (n+1)).(sin.x)) by A4,A24,FUNCT_1:12
   .=n*(cos.x) #Z (n-1)/(sin.x) #Z (n+1) by TAYLOR_1:def 1;
   hence thesis by A1;
   end;
A25:for x being Element of REAL
      st x in dom ((-( #Z n)*cot)`|Z) holds ((-( #Z n)*cot)`|Z).x = f.x
   proof
      let x be Element of REAL;
      assume x in dom ((-( #Z n)*cot)`|Z);then
A26:x in Z by A15,FDIFF_1:def 7; then
    ((-( #Z n)*cot)`|Z).x = n*(cos.x) #Z (n-1)/(sin.x) #Z (n+1) by A17
    .=f.x by A23,A26;
    hence thesis;
   end;
   dom ((-( #Z n)*cot)`|Z) = dom f by A1,A15,FDIFF_1:def 7;
   then ((-( #Z n)*cot)`|Z)=f by A25,PARTFUN1:5;
   hence thesis by A1,A11,A12,A14,FDIFF_1:20,INTEGRA5:13;
end;
