 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 & Z c= dom (cot*f1) & f=(cos*f1)^2/(sin*f1)^2 &
 (for x st x in Z holds f1.x=a*x & a<>0) & Z = dom f
 implies
 integral(f,A)=((-1/a)(#)(cot*f1)-id Z).(upper_bound A)
              -((-1/a)(#)(cot*f1)-id Z).(lower_bound A)
proof
  assume
A1:A c= Z & Z c= dom (cot*f1) & f=(cos*f1)^2/(sin*f1)^2 &
 (for x st x in Z holds f1.x=a*x & a<>0) & Z = dom f;
then A2:Z c= dom ((-1/a)(#)(cot*f1)) by VALUED_1:def 5;
Z c= dom ((-1/a)(#)(cot*f1)) /\ dom id Z by A2,XBOOLE_1:19;
then A3:Z c= dom ((-1/a)(#)(cot*f1)-id Z) by VALUED_1:12;
A4:for x st x in Z holds f1.x=a*x+0 by A1;
Z = dom ((cos*f1)^2) /\ (dom ((sin*f1)^2) \ ((sin*f1)^2)"{0})
   by A1,RFUNCT_1:def 1;
then A5:Z c= dom ((cos*f1)^2) & Z c= dom ((sin*f1)^2) \ ((sin*f1)^2)"{0}
   by XBOOLE_1:18;
then A6:Z c= dom (cos*f1) by VALUED_1:11;
A7:Z c= dom (((sin*f1)^2)^) by A5,RFUNCT_1:def 2;
   dom (((sin*f1)^2)^) c= dom ((sin*f1)^2) by RFUNCT_1:1;then
Z c= dom ((sin*f1)^2) by A7;
then A8:Z c= dom (sin*f1) by VALUED_1:11;
then A9:sin*f1 is_differentiable_on Z by A4,FDIFF_4:37;
A10:cos*f1 is_differentiable_on Z by A4,A6,FDIFF_4:38;
A11:(sin*f1)^2 is_differentiable_on Z by A9,FDIFF_2:20;
A12:(cos*f1)^2 is_differentiable_on Z by A10,FDIFF_2:20;
x in Z implies ((sin*f1)^2).x<>0
    proof
    assume x in Z;
    then x in dom ((cos*f1)^2) /\ (dom ((sin*f1)^2) \ ((sin*f1)^2)"{0})
      by A1,RFUNCT_1:def 1;
    then x in dom ((sin*f1)^2) \ ((sin*f1)^2)"{0} by XBOOLE_0:def 4;
    then x in dom (((sin*f1)^2)^) by RFUNCT_1:def 2;
      hence thesis by RFUNCT_1:3;
    end;
then f is_differentiable_on Z by A1,A11,A12,FDIFF_2:21;
    then f|Z is continuous by FDIFF_1:25;then
f|A is continuous by A1,FCONT_1:16;
then A13:f is_integrable_on A & f|A is bounded by A1,INTEGRA5:10,11;
A14:((-1/a)(#)(cot*f1)-id Z) is_differentiable_on Z by A1,A3,FDIFF_8:27;
A15:for x st x in Z holds f.x =(cos.(a*x))^2/(sin.(a*x))^2
    proof
    let x;
     assume
A16:x in Z;
   then ((cos*f1)^2/(sin*f1)^2).x
    =((cos*f1)^2).x/((sin*f1)^2).x by A1,RFUNCT_1:def 1
   .=((cos*f1).x)^2/((sin*f1)^2).x by VALUED_1:11
   .=((cos*f1).x)^2/((sin*f1).x)^2 by VALUED_1:11
   .=(cos.(f1.x))^2/((sin*f1).x)^2 by A6,A16,FUNCT_1:12
   .=(cos.(f1.x))^2/(sin.(f1.x))^2 by A8,A16,FUNCT_1:12
   .=(cos.(a*x))^2/(sin.(f1.x))^2 by A16,A1
   .=(cos.(a*x))^2/(sin.(a*x))^2 by A16,A1;
     hence thesis by A1;
     end;
A17:for x being Element of REAL st x in dom(((-1/a)(#)(cot*f1)-id Z)`|Z) holds
   (((-1/a)(#)(cot*f1)-id Z)`|Z).x=f.x
   proof
      let x be Element of REAL;
      assume x in dom(((-1/a)(#)(cot*f1)-id Z)`|Z);then
A18: x in Z by A14,FDIFF_1:def 7; then
    (((-1/a)(#)(cot*f1)-id Z)`|Z).x
   =(cos.(a*x))^2/(sin.(a*x))^2 by A1,A3,FDIFF_8:27
  .=f.x by A15,A18;
   hence thesis;
   end;
   dom (((-1/a)(#)(cot*f1)-id Z)`|Z)=dom f by A1,A14,FDIFF_1:def 7;
   then (((-1/a)(#)(cot*f1)-id Z)`|Z)=f by A17,PARTFUN1:5;
   hence thesis by A1,A13,A14,INTEGRA5:13;
end;
