 reserve A for non empty Subset of REAL;

theorem Th17:
  for A,B be non empty closed_interval Subset of REAL,
  f be Function of REAL,REAL st lower_bound B <> upper_bound B & B c= A &
  f is_integrable_on A & f | A is bounded &
  (for x be Real st x in (A \ B) holds f.x = 0) &
  f.(lower_bound B) = 0 & f.(upper_bound B) = 0
    holds
  centroid (f,A) = centroid (f,B)
proof
 let A,B be non empty closed_interval Subset of REAL,
     f be Function of REAL,REAL;
 assume that
 A0: lower_bound B <> upper_bound B and
 A1: B c= A and
 A4: f is_integrable_on A & f | A is bounded and
 A2: (for x be Real st x in (A \ B) holds f.x = 0) and
 A3: f.(lower_bound B) = 0 & f.(upper_bound B) = 0;
 AA: A = [.lower_bound A, upper_bound A .] by INTEGRA1:4
  .= [' lower_bound A, upper_bound A '] by INTEGRA5:def 3,SEQ_4:11;
 BB: B = [.lower_bound B, upper_bound B .] by INTEGRA1:4
  .= [' lower_bound B, upper_bound B '] by INTEGRA5:def 3,SEQ_4:11;
  lower_bound B <= upper_bound B by SEQ_4:11; then
 A7: lower_bound B < upper_bound B by A0,XXREAL_0:1;
 A8: lower_bound A <= lower_bound B &
     upper_bound B <= upper_bound A by Th12,A1;
 for x be Real st
  x in ['lower_bound A,lower_bound B'] \/ ['upper_bound B,upper_bound A']
 holds f.x = 0
 proof
  let x be Real;
  assume
  A9: x in ['lower_bound A,lower_bound B'] \/ ['upper_bound B,upper_bound A'];
  per cases by A9,XBOOLE_0:def 3;
   suppose x in ['lower_bound A,lower_bound B']; then
    x in [. lower_bound A,lower_bound B .] by INTEGRA5:def 3,Th12,A1;
    then
    x in [. lower_bound A,lower_bound B .[ \/ {lower_bound B}
                   by XXREAL_1:129,Th12,A1; then
    per cases by XBOOLE_0:def 3;
     suppose x in [. lower_bound A,lower_bound B .[; then
      X1: x in [. lower_bound A,lower_bound B .[
            \/ ]. upper_bound B,upper_bound A .] by XBOOLE_0:def 3;
      [. lower_bound A,lower_bound B .[ \/ ]. upper_bound B,upper_bound A .]
      c= [. lower_bound A,upper_bound A .] \ [. lower_bound B,upper_bound B .]
             by Th8X,A7,A8; then
      x in [. lower_bound A,upper_bound A .] \
            [. lower_bound B,upper_bound B .] by X1; then
      x in A \ [. lower_bound B,upper_bound B .] by INTEGRA1:4;
      then
      x in (A \ B) by INTEGRA1:4;
      hence thesis by A2;
     end;
     suppose x in {lower_bound B};
      hence thesis by TARSKI:def 1,A3;
     end;
   end;
   suppose x in ['upper_bound B,upper_bound A']; then
    x in [. upper_bound B,upper_bound A .] by INTEGRA5:def 3,Th12,A1;
    then
    x in {upper_bound B} \/ ]. upper_bound B,upper_bound A .]
                   by XXREAL_1:130,Th12,A1; then
    per cases by XBOOLE_0:def 3;
     suppose x in ]. upper_bound B,upper_bound A .]; then
      X1: x in [. lower_bound A,lower_bound B .[
            \/ ]. upper_bound B,upper_bound A .] by XBOOLE_0:def 3;
      [. lower_bound A,lower_bound B .[ \/ ]. upper_bound B,upper_bound A .]
      c= [. lower_bound A,upper_bound A .] \ [. lower_bound B,upper_bound B .]
             by Th8X,A8,A7; then
      x in [. lower_bound A,upper_bound A .] \
           [. lower_bound B,upper_bound B .] by X1; then
      x in A \ [. lower_bound B,upper_bound B .] by INTEGRA1:4; then
      x in (A \ B) by INTEGRA1:4;
      hence thesis by A2;
     end;
     suppose x in {upper_bound B};
      hence thesis by TARSKI:def 1,A3;
     end;
   end;
 end;
 hence centroid (f,A) = centroid (f,B) by BB,Th11X,A7,A8,AA,A4;
end;
