reserve f,f1,f2,g for PartFunc of REAL,REAL;
reserve A for non empty closed_interval Subset of REAL;
reserve p,r,x,x0 for Real;
reserve n for Element of NAT;
reserve Z for open Subset of REAL;

theorem
  A c= Z & dom cot = Z & dom cot = dom f2 & (for x st x in Z holds f2.x
= -1/(sin.x)^2 & sin.x <> 0) & f2|A is continuous implies integral(f2,A) = cot.
  (upper_bound A)-cot.(lower_bound A)
proof
  assume that
A1: A c= Z and
A2: dom cot = Z and
A3: dom cot = dom f2 and
A4: for x st x in Z holds f2.x = -1/(sin.x)^2 & sin.x <> 0 and
A5: f2|A is continuous;
A6: f2 is_integrable_on A by A1,A2,A3,A5,INTEGRA5:11;
A7: cot is_differentiable_on Z by A2,Th34;
A8: for x being Element of REAL st x in dom (cot`|Z) holds (cot`|Z).x = f2.x
  proof
    let x be Element of REAL;
    assume x in dom ((cot)`|Z);
    then
A9: x in Z by A7,FDIFF_1:def 7;
    then (cot`|Z).x = -1/(sin.x)^2 by A2,Th34
      .= f2.x by A4,A9;
    hence thesis;
  end;
  dom (cot`|Z) = dom f2 by A2,A3,A7,FDIFF_1:def 7;
  then (cot`|Z) = f2 by A8,PARTFUN1:5;
  hence thesis by A1,A2,A3,A5,A6,A7,INTEGRA5:10,13;
end;
