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
  n<>0 implies integral(cos*(AffineMap(n,0)),A) = ((1/n)(#)(sin*(
  AffineMap(n,0)))).(upper_bound A) -((1/n)(#)(sin*(AffineMap(n,0)))).(
  lower_bound A)
proof
  assume
A1: n<>0;
A2: [#]REAL = dom (cos*(AffineMap(n,0))) by FUNCT_2:def 1;
A3: for x st x in REAL holds AffineMap(n,0).x=n*x
  proof
    let x;
    assume x in REAL;
    (AffineMap(n,0)).x = n*x + 0 by FCONT_1:def 4
      .=n*x;
    hence thesis;
  end;
A4: for x being Element of REAL
   st x in dom (((1/n)(#)(sin*(AffineMap(n,0))))`|REAL) holds (((1/n)
  (#)(sin*(AffineMap(n,0))))`|REAL).x = (cos*(AffineMap(n,0))).x
  proof
    let x be Element of REAL;
    assume
 x in dom (((1/n)(#)(sin*(AffineMap(n,0))))`|REAL);
    (((1/n)(#)(sin*(AffineMap(n,0))))`|REAL).x = cos(n*x) by A1,Th6
      .= cos.((AffineMap(n,0)).x) by A3
      .= (cos*(AffineMap(n,0))).x by A2,FUNCT_1:12;
    hence thesis;
  end;
  (1/n)(#)(sin*(AffineMap(n,0))) is_differentiable_on REAL by A1,Th6;
  then
  dom (((1/n)(#)(sin*(AffineMap(n,0))))`|REAL) = dom (cos*(AffineMap(n,0)
  )) by A2,FDIFF_1:def 7;
  then
A5: (((1/n)(#)(sin*(AffineMap(n,0))))`|REAL) = cos*(AffineMap(n,0)) by A4,
PARTFUN1:5;
  (cos*AffineMap(n,0))|A is continuous;
  then
A6: (cos*AffineMap(n,0)) is_integrable_on A by A2,INTEGRA5:11;
  (cos*AffineMap(n,0))|A is bounded by A2,INTEGRA5:10;
  hence thesis by A1,A6,A5,Th6,INTEGRA5:13;
end;
