 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 (ln*(f1+f2))
& r <> 0 & (for x st x in Z holds g.x=x/r & g.x > -1 & g.x < 1 & f1.x=1)
& f2=( #Z 2)*g & Z = dom f & f=arctan*g
implies
integral(f,A)=((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2))).(upper_bound A)
             -((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2))).(lower_bound A)
proof
  assume
A1:A c= Z & Z c= dom (ln*(f1+f2))
& r <> 0 & (for x st x in Z holds g.x=x/r & g.x > -1 & g.x < 1 & f1.x=1)
& f2=( #Z 2)*g & Z = dom f & f=arctan*g;
Z c= dom id Z /\ dom f by A1;
then A2:Z c= dom ((id Z)(#)(arctan*g)) by A1,VALUED_1:def 4;
Z c= dom ((r/2)(#)(ln*(f1+f2))) by A1,VALUED_1:def 5;
then Z c= dom ((id Z)(#)(arctan*g)) /\ dom ((r/2)(#)(ln*(f1+f2)))
   by A2,XBOOLE_1:19;
then A3:Z c= dom ((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2))) by VALUED_1:12;
     for x st x in Z holds g.x=(1/r)*x+0
     proof
       let x;
       assume x in Z;
       then g.x=x/r by A1;
       hence thesis;
     end; then
 for x st x in Z holds g.x=(1/r)*x+0 & g.x > -1 & g.x < 1 by A1;
then f is_differentiable_on Z by A1,SIN_COS9:87;
    then f|Z is continuous by FDIFF_1:25;then
f|A is continuous by A1,FCONT_1:16;
then A4:f is_integrable_on A & f|A is bounded by A1,INTEGRA5:10,11;
A5:(for x st x in Z holds g.x=x/r & g.x > -1 & g.x < 1)
    & (for x st x in Z holds f1.x=1)
    &(for x st x in Z holds g.x=x/r) by A1; then
A6:(id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)) is_differentiable_on Z
   by A1,A3,SIN_COS9:109;
A7:for x st x in Z holds f.x=arctan.(x/r)
   proof
   let x;
   assume
A8:x in Z;
   then (arctan*g).x=arctan.(g.x) by A1,FUNCT_1:12
              .=arctan.(x/r) by A1,A8;
   hence thesis by A1;
   end;
A9:for x being Element of REAL
   st x in dom(((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)))`|Z) holds
 (((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)))`|Z).x=f.x
  proof
   let x be Element of REAL;
   assume x in dom(((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)))`|Z);
   then
A10:x in Z by A6,FDIFF_1:def 7;then
 (((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)))`|Z).x=arctan.(x/r)
 by A1,A3,A5,SIN_COS9:109
                                                .=f.x by A7,A10;
   hence thesis;
   end;
  dom(((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)))`|Z)=dom f
  by A1,A6,FDIFF_1:def 7;
  then (((id Z)(#)(arctan*g)-(r/2)(#)(ln*(f1+f2)))`|Z) = f by A9,PARTFUN1:5;
   hence thesis by A1,A4,A6,INTEGRA5:13;
end;
