 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 & g=f1-f2 & f2=#Z 2 & (for x st x in Z holds
 f.x=x*((a^2-x #Z 2) #R (-1/2)) & f1.x=a^2 & g.x >0)
 & Z c= dom (( #R (1/2))*g) & Z = dom f & f|A is continuous implies
 integral(f,A)
 =(-( #R (1/2))*g).(upper_bound A)-(-( #R (1/2))*g).(lower_bound A)
proof
   assume
A1:A c= Z & g=f1-f2 & f2=#Z 2 & (for x st x in Z  holds
   f.x=x*((a^2-x #Z 2) #R (-1/2)) & f1.x=a^2 & g.x >0)
   & Z c= dom (( #R (1/2))*g) & Z = dom f & f|A is continuous;then
A2:f is_integrable_on A & f|A is bounded by INTEGRA5:10,11;
A3:for x st x in Z holds f1.x=a^2 & g.x >0 by A1;
A4:Z c= dom (-( #R (1/2))*g) by A1,VALUED_1:8;
for y being object st y in Z holds y in dom g by A1,FUNCT_1:11;
then A5:Z c= dom ((f1+(-1)(#)f2)) by A1;
A6:(( #R (1/2))*g) is_differentiable_on Z by A1,A3,FDIFF_7:27;
then A7:(-1)(#)(( #R (1/2))*g) is_differentiable_on Z by A4,FDIFF_1:20;
A8:f2=#Z 2 & for x st x in Z holds f1.x=a^2+0*x by A1;
then A9:g is_differentiable_on Z &
  for x st x in Z holds (g`|Z).x =0+2*(-1)*x by A1,A5,FDIFF_4:12;
A10:for x st x in Z holds ((-( #R (1/2))*g)`|Z).x = x*(a^2-x #Z 2) #R (-1/2)
  proof
    let x;
    assume
A11:x in Z;then
A12:x in dom (f1-f2) by A1,FUNCT_1:11;
A13:g is_differentiable_in x by A9,A11,FDIFF_1:9;
A14:(f1-f2).x=f1.x - f2.x by A12,VALUED_1:13
            .=a^2 -(f2.x) by A1,A11
            .=a^2 -(x #Z 2) by A1,TAYLOR_1:def 1; then
A15:g.x = a^2-x #Z 2 & g.x >0 by A1,A11;
A16:( #R (1/2))*g is_differentiable_in x by A6,A11,FDIFF_1:9;
 ((-( #R (1/2))*g)`|Z).x = diff(-( #R (1/2))*g,x) by A7,A11,FDIFF_1:def 7
            .=(-1)*diff(( #R (1/2))*g,x) by A16,FDIFF_1:15
            .=(-1)*((1/2)*((g.x) #R (1/2-1)) * diff(g,x))
              by A13,A15,TAYLOR_1:22
            .=(-1)*((1/2)*((g.x) #R (1/2-1))*(g`|Z).x)
              by A9,A11,FDIFF_1:def 7
            .=(-1)*((1/2)*((g.x) #R (1/2-1))*(0+2*(-1)*x))
              by A1,A5,A8,A11,FDIFF_4:12
            .=x*(a^2-x #Z 2) #R (-1/2) by A1,A14;
     hence thesis;
   end;
A17:for x being Element of REAL
    st x in dom ((-( #R (1/2))*g)`|Z) holds ((-( #R (1/2))*g)`|Z).x=f.x
   proof
   let x be Element of REAL;
   assume x in dom ((-( #R (1/2))*g)`|Z);then
A18:x in Z by A7,FDIFF_1:def 7;then
   ((-( #R (1/2))*g)`|Z).x=x*(a^2-x #Z 2) #R (-1/2) by A10
   .=f.x by A1,A18;
   hence thesis;
   end;
  dom ((-( #R (1/2))*g)`|Z)=dom f by A1,A7,FDIFF_1:def 7;
  then((-( #R (1/2))*g)`|Z)= f by A17,PARTFUN1:5;
   hence thesis by A1,A2,A7,INTEGRA5:13;
end;
