reserve r,x,x0,a,b for Real;
reserve n,m for Element of NAT;
reserve A for non empty closed_interval Subset of REAL;
reserve Z for open Subset of REAL;

theorem
  a*(n+1) <> 0 implies integral( #Z n*AffineMap(a,b),A) = ((1/(a*(n+1)))
(#)( #Z (n+1)*AffineMap(a,b))).(upper_bound A) -
((1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a
  ,b))).(lower_bound A)
proof
  assume
A1: a*(n+1) <> 0;
A2: [#]REAL=dom (AffineMap(a,b)) by FUNCT_2:def 1;
A3: for x being Element of REAL
 st x in dom (((1/(a*(n+1))) (#)( #Z (n+1)*AffineMap(a,b)))`|REAL)
holds (((1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a,b)))`|REAL).x = ( #Z n*AffineMap
  (a,b)).x
  proof
    let x be Element of REAL;
    assume x in dom (((1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a,b)))`|REAL);
    (((1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a,b)))`|REAL).x =(a*x+b) #Z n
    by A1,Th12
      .= (AffineMap(a,b).x) #Z n by FCONT_1:def 4
      .= ( #Z n).(AffineMap(a,b).x) by TAYLOR_1:def 1
      .=( #Z n*AffineMap(a,b)).x by A2,FUNCT_1:13;
    hence thesis;
  end;
A4: [#]REAL=dom ( #Z n*AffineMap(a,b)) by FUNCT_2:def 1;
  for x st x in REAL holds AffineMap(a,b).x=a*x + b by FCONT_1:def 4;
  then
A5: AffineMap(a,b) is_differentiable_on REAL by A2,FDIFF_1:23;
  #Z n*AffineMap(a,b) is_differentiable_in x
  proof
    x in REAL by XREAL_0:def 1;
    then AffineMap(a,b) is_differentiable_in x by A2,A5,FDIFF_1:9;
    hence thesis by TAYLOR_1:3;
  end;
  then for x st x in REAL holds #Z n*AffineMap(a,b) is_differentiable_in x;
  then #Z n*AffineMap(a,b) is_differentiable_on REAL by A4,FDIFF_1:9;
  then
A6: ( #Z n*AffineMap(a,b))|REAL is continuous by FDIFF_1:25;
  then ( #Z n*AffineMap(a,b))|A is continuous by FCONT_1:16;
  then
A7: #Z n*AffineMap(a,b) is_integrable_on A by A4,INTEGRA5:11;
  (1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a,b)) is_differentiable_on REAL by A1
,Th12;
  then dom (((1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a,b)))`|REAL) = dom ( #Z n*
  AffineMap(a,b)) by A4,FDIFF_1:def 7;
  then
A8: (((1/(a*(n+1)))(#)( #Z (n+1)*AffineMap(a,b)))`|REAL) = #Z n*AffineMap(a
  ,b) by A3,PARTFUN1:5;
  ( #Z n*AffineMap(a,b))|A is bounded by A4,A6,INTEGRA5:10;
  hence thesis by A1,A7,A8,Th12,INTEGRA5:13;
end;
