reserve r,p,x for Real;
reserve n for Element of NAT;
reserve A for non empty closed_interval Subset of REAL;
reserve Z for open Subset of REAL;

theorem
  A c= Z implies integral(-cos+(id Z)(#)sin,A) = ((-id Z)(#)cos).(
  upper_bound A)-((-id Z)(#)cos).(lower_bound A)
proof
  assume
A1: A c= Z;
  dom (-cos+(id Z)(#)sin) = dom (-cos) /\ dom((id Z)(#)sin) by VALUED_1:def 1
    .= REAL /\ dom((id Z)(#)sin) by SIN_COS:24,VALUED_1:8
    .= dom((id Z)(#)sin) by XBOOLE_1:28
    .= dom (id Z) /\ REAL by SIN_COS:24,VALUED_1:def 4
    .= dom (id Z) by XBOOLE_1:28;
  then
A2: Z = dom (-cos+(id Z)(#)sin) by RELAT_1:45;
  (-cos+(id Z)(#)sin)|A is continuous;
  then
A3: -cos+(id Z)(#)sin is_integrable_on A by A1,A2,INTEGRA5:11;
  dom ((-id Z)(#)cos) = dom (-id Z) /\ REAL by SIN_COS:24,VALUED_1:def 4
    .= dom (-id Z) by XBOOLE_1:28
    .= dom (id Z) by VALUED_1:8;
  then
A4: dom ((-id Z)(#)cos) = Z by RELAT_1:45;
  then
A5: (-id Z)(#)cos is_differentiable_on Z by FDIFF_4:44;
A6: for x st x in Z holds (-cos+(id Z)(#)sin).x = -cos.x+x*sin.x
  proof
    let x;
    assume
A7: x in Z;
    then (-cos+(id Z)(#)sin).x = (-cos).x+((id Z)(#)sin).x by A2,VALUED_1:def 1
      .= (-cos).x+((id Z).x)*(sin.x) by VALUED_1:5
      .= (-cos).x+x*sin.x by A7,FUNCT_1:18
      .= -cos.x+x*sin.x by VALUED_1:8;
    hence thesis;
  end;
A8: for x being Element of REAL
st x in dom (((-id Z)(#)cos)`|Z) holds (((-id Z)(#)cos)`|Z).x = (
  -cos+(id Z)(#)sin).x
  proof
    let x be Element of REAL;
    assume x in dom (((-id Z)(#)cos)`|Z);
    then
A9: x in Z by A5,FDIFF_1:def 7;
    then (((-id Z)(#)cos)`|Z).x =-cos.x+x*sin.x by A4,FDIFF_4:44
      .= (-cos+(id Z)(#)sin).x by A6,A9;
    hence thesis;
  end;
  dom (((-id Z)(#)cos)`|Z) = dom (-cos+(id Z)(#)sin) by A2,A5,FDIFF_1:def 7;
  then
A10: (((-id Z)(#)cos)`|Z) = -cos+(id Z)(#)sin by A8,PARTFUN1:5;
  (-cos+(id Z)(#)sin)|A is bounded by A1,A2,INTEGRA5:10;
  hence thesis by A1,A4,A3,A10,FDIFF_4:44,INTEGRA5:13;
end;
