INTEGRA3

index · ← RFINSEQ2 · INTEGRA4 →
:: Darboux's Theorem
::  by Noboru Endou , Katsumi Wasaki and Yasunari Shidama
::
:: Received December 7, 1999
:: Copyright (c) 1999-2026 Association of Mizar Users
::           (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 3.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/3.0/.

environ

 vocabularies FINSEQ_1, ARYTM_1, INTEGRA1, RELAT_1, ORDINAL2, FUNCT_1, CARD_1,
      FUNCT_3, SEQ_2, JORDAN3, RFINSEQ, INTEGRA2, FDIFF_1, ARYTM_3, SEQ_4,
      CLASSES1, VALUED_0, XBOOLE_0, NUMBERS, MEASURE7, REAL_1, SUBSET_1,
      XXREAL_2, XXREAL_0, NAT_1, TARSKI, ORDINAL4, COMPLEX1, CARD_3, XXREAL_1,
      PARTFUN1, SEQ_1, MEASURE5, FUNCT_7, XCMPLX_0;
 notations TARSKI, XBOOLE_0, SUBSET_1, ORDINAL1, CARD_1, NUMBERS, XXREAL_0,
      XREAL_0, XCMPLX_0, COMPLEX1, REAL_1, NAT_1, NAT_D, RELAT_1, FUNCT_1,
      FUNCT_2, XXREAL_2, SEQ_4, VALUED_0, PARTFUN1, MEASURE6, FINSEQ_1,
      RFUNCT_1, RVSUM_1, INTEGRA1, SEQ_1, COMSEQ_2, SEQ_2, FINSEQ_6, RCOMP_1,
      FDIFF_1, CLASSES1, RFINSEQ, MEASURE5, INTEGRA2;
 constructors PARTFUN1, REAL_1, SQUARE_1, NAT_1, COMPLEX1, FINSOP_1, RFUNCT_1,
      FDIFF_1, RFINSEQ, BINARITH, MEASURE6, FINSEQ_6, INTEGRA2, BINOP_2,
      XXREAL_2, NAT_D, RVSUM_1, CLASSES1, SEQ_4, RELSET_1, SEQ_2, COMSEQ_2;
 registrations XBOOLE_0, RELAT_1, ORDINAL1, NUMBERS, XXREAL_0, XREAL_0, NAT_1,
      MEMBERED, FINSEQ_1, SEQM_3, INTEGRA1, VALUED_0, FUNCT_2, FINSET_1,
      XXREAL_2, CARD_1, SEQ_2, MEASURE5, RELSET_1;
 requirements REAL, NUMERALS, BOOLE, SUBSET, ARITHM;
 definitions TARSKI;
 equalities RVSUM_1;
 expansions TARSKI;
 theorems SEQ_4, SUBSET_1, PARTFUN1, INTEGRA1, RFUNCT_1, FUNCT_1, FINSEQ_1,
      RVSUM_1, SEQ_1, SEQ_2, FDIFF_1, ABSVALUE, NAT_1, RFINSEQ, TARSKI,
      FINSEQ_5, FINSEQ_3, FINSEQ_4, FINSEQ_6, INTEGRA2, RELAT_1, XREAL_0,
      FUNCT_2, XBOOLE_0, XBOOLE_1, XREAL_1, COMPLEX1, XXREAL_0, FINSOP_1,
      ORDINAL1, XXREAL_2, SEQM_3, CLASSES1, MEASURE5;
 schemes FINSEQ_2, NAT_1, SEQ_1;

begin :: Lemmas of Division

reserve a,b,e,r,x,y for Real,
  i,j,k,n,m for Element of NAT,
  x1 for set,
  p,q for FinSequence of REAL,
  A for non empty closed_interval Subset of REAL,
  D,D1,D2 for Division of A,
  f,g for Function of A,REAL,
  T for DivSequence of A;

Lm1: j-'j+1 = 1
proof
  j-'j=j-j by XREAL_1:233
    .= 0;
  hence thesis;
end;

Lm2: for n st 1 <= n & n <= 2 holds n = 1 or n = 2
proof
  let n;
  assume that
A1: 1<=n and
A2: n<=2;
  per cases by A1,XXREAL_0:1;
  suppose
    n=1;
    hence thesis;
  end;
  suppose
    n>1;
    then n >= 1+1 by NAT_1:13;
    hence thesis by A2,XXREAL_0:1;
  end;
end;

definition
  let A be non empty closed_interval Subset of REAL, D be Division of A;
  func delta(D) -> Real equals
  max rng upper_volume(chi(A,A),D);
  correctness;
end;

definition
  let A be non empty closed_interval Subset of REAL, T be DivSequence of A;
  func delta(T) -> Real_Sequence means :Def2:
  for i holds it.i = delta(T.i);
  existence
  proof
    deffunc F(Nat)=delta(T.In($1,NAT));
    consider IT being Real_Sequence such that
A1:   for i being Nat holds IT.i = F(i)
      from SEQ_1:sch 1;
   take IT;
   let i;
    IT.i = F(i) by A1;
   hence thesis;
  end;
  uniqueness
  proof
    let F1,F2 be Real_Sequence such that
A2: for i holds F1.i = delta(T.i) and
A3: for i holds F2.i = delta(T.i);
    for i holds F1.i = F2.i
    proof
      let i;
      F1.i = delta(T.i) by A2
        .= F2.i by A3;
      hence thesis;
    end;
    hence thesis by FUNCT_2:63;
  end;
end;

theorem
  D1 <= D2 implies delta(D1) >= delta(D2)
proof
  delta(D2) in rng upper_volume(chi(A,A),D2) by XXREAL_2:def 8;
  then consider j such that
A1: j in dom upper_volume(chi(A,A),D2) and
A2: delta(D2) = upper_volume(chi(A,A),D2).j by PARTFUN1:3;
  len upper_volume(chi(A,A),D2) = len D2 by INTEGRA1:def 6;
  then
A3: j in dom D2 by A1,FINSEQ_3:29;
  then
A4: delta(D2) = vol(divset(D2,j)) by A2,INTEGRA1:20;
  assume D1 <= D2;
  then consider i being Nat such that
A5: i in dom D1 and
A6: divset(D2,j) c= divset(D1,i) by A3,INTEGRA2:37;
A7: vol(divset(D1,i)) = upper_volume(chi(A,A),D1).i by A5,INTEGRA1:20;
  len upper_volume(chi(A,A),D1) = len D1 by INTEGRA1:def 6;
  then i in dom upper_volume(chi(A,A),D1) by A5,FINSEQ_3:29;
  then vol(divset(D1,i)) in rng upper_volume(chi(A,A),D1) by A7,FUNCT_1:def 3;
  then delta(D2) <= max rng upper_volume(chi(A,A),D1)
    by A4,A6,INTEGRA2:38,XXREAL_2:61;
  hence thesis;
end;

theorem Th2:
  vol(A) <> 0 implies ex i st i in dom D & vol(divset(D,i)) > 0
proof
  assume
A1: vol(A) <>0;
A2: len D in dom D by FINSEQ_5:6;
  assume
A3: for i st i in dom D holds vol(divset(D,i))<=0;
A4: i in dom D implies vol(divset(D,i))=0
  proof
    assume i in dom D;
    then vol(divset(D,i)) <= 0 by A3;
    hence thesis by INTEGRA1:9;
  end;
A5: i in dom D implies upper_bound divset(D,i)=lower_bound divset(D,i)
  proof
    assume i in dom D;
    then vol(divset(D,i))=0 by A4;
    then upper_bound divset(D,i)-lower_bound divset(D,i)=0 by INTEGRA1:def 5;
    hence thesis;
  end;
A6: len D = 1
  proof
    len D < len D+1 by NAT_1:13;
    then
A7: len D-1 < len D by XREAL_1:19;
    assume
A8: len D <> 1;
    then
A9: upper_bound divset(D,len D)=D.(len D) by A2,INTEGRA1:def 4;
A10: len D-1 in dom D by A2,A8,INTEGRA1:7;
    lower_bound divset(D,len D)=D.(len D-1) by A2,A8,INTEGRA1:def 4;
    then lower_bound divset(D,len D)<upper_bound divset(D,len D) by A2,A9,A10
,A7,SEQM_3:def 1;
    hence contradiction by A5,A2;
  end;
  then upper_bound divset(D,len D)=D.(len D) by A2,INTEGRA1:def 4;
  then
A11: upper_bound divset(D,len D)=upper_bound A by INTEGRA1:def 2;
  lower_bound divset(D,len D)=lower_bound A by A2,A6,INTEGRA1:def 4;
  then upper_bound A = lower_bound A+0 by A5,A2,A11;
  then upper_bound A- lower_bound A = 0;
  hence contradiction by A1,INTEGRA1:def 5;
end;

theorem Th3:
  x in A implies ex j st j in dom D & x in divset(D,j)
proof
  assume
A1: x in A;
  then
A2: lower_bound A <= x by INTEGRA2:1;
A3: x <= upper_bound A by A1,INTEGRA2:1;
A4: rng D <> {};
  then
A5: 1 in dom D by FINSEQ_3:32;
  per cases;
  suppose
    x in rng D;
    then consider j such that
A6: j in dom D and
A7: D.j = x by PARTFUN1:3;
    x in divset(D,j)
    proof
      per cases;
      suppose
A8:     j=1;
A9:     ex a,b st a <= b & a=lower_bound divset(D,j) & b= upper_bound
        divset(D,j) by SEQ_4:11;
        upper_bound divset(D,j)=D.j by A6,A8,INTEGRA1:def 4;
        hence thesis by A7,A9,INTEGRA2:1;
      end;
      suppose
A10:    j<>1;
A11:    ex a,b st a <= b & a=lower_bound divset(D,j) & b= upper_bound
        divset(D,j) by SEQ_4:11;
        upper_bound divset(D,j)=D.j by A6,A10,INTEGRA1:def 4;
        hence thesis by A7,A11,INTEGRA2:1;
      end;
    end;
    hence thesis by A6;
  end;
  suppose
A12: not x in rng D;
    defpred MIN[Nat] means x < upper_bound divset(D,$1) & $1 in dom D;
A13: len D in dom D by FINSEQ_5:6;
    upper_bound divset(D,len D)=D.(len D)
    proof
      per cases;
      suppose
        len D=1;
        hence thesis by A13,INTEGRA1:def 4;
      end;
      suppose
        len D<>1;
        hence thesis by A13,INTEGRA1:def 4;
      end;
    end;
    then
A14: upper_bound divset(D,len D) = upper_bound A by INTEGRA1:def 2;
    x <> upper_bound A
    proof
      assume x = upper_bound A;
      then x = D.(len D) by INTEGRA1:def 2;
      hence contradiction by A12,A13,FUNCT_1:def 3;
    end;
    then x < upper_bound divset(D,len D) by A3,A14,XXREAL_0:1;
    then
A15: ex k be Nat st MIN[k] by A13;
    consider k be Nat such that
A16: MIN[k] & for n be Nat st MIN[n] holds k <= n from NAT_1:sch 5(A15
    );
    defpred MAX[Nat] means x >= lower_bound divset(D,$1) & $1 in dom D;
    lower_bound divset(D,1)=lower_bound A by A5,INTEGRA1:def 4;
    then
A17: ex k be Nat st MAX[k] by A2,A4,FINSEQ_3:32;
A18: for k be Nat holds MAX[k] implies k <= len D by FINSEQ_3:25;
    consider j be Nat such that
A19: MAX[j] & for n be Nat st MAX[n] holds n <= j from NAT_1:sch 6(A18
    ,A17);
    k=j
    proof
      assume
A20:  k<>j;
      per cases by A20,XXREAL_0:1;
      suppose
A21:    k < j;
A22:    upper_bound divset(D,k)=D.k
        proof
          per cases;
          suppose
            k=1;
            hence thesis by A16,INTEGRA1:def 4;
          end;
          suppose
            k<>1;
            hence thesis by A16,INTEGRA1:def 4;
          end;
        end;
A23:    1 <= k by A16,FINSEQ_3:25;
        then D.(j-1) <= x by A19,A21,INTEGRA1:def 4;
        then
A24:    D.(j-1) < D.k by A16,A22,XXREAL_0:2;
        j-1 in dom D by A19,A21,A23,INTEGRA1:7;
        then j-1 < k by A16,A24,SEQ_4:137;
        then j < k+1 by XREAL_1:19;
        hence contradiction by A21,NAT_1:13;
      end;
      suppose
A25:    k > j;
        x < upper_bound divset(D,j)
        proof
A26:      upper_bound divset(D,j)=D.j
          proof
            per cases;
            suppose
              j=1;
              hence thesis by A19,INTEGRA1:def 4;
            end;
            suppose
              j<>1;
              hence thesis by A19,INTEGRA1:def 4;
            end;
          end;
          assume
A27:      x >= upper_bound divset(D,j);
A28:      j+1 <= k by A25,NAT_1:13;
A29:      1 <= j by A19,FINSEQ_3:25;
          then
A30:      1 <= j+1 by NAT_1:13;
          k <= len D by A16,FINSEQ_3:25;
          then j+1 <= len D by A28,XXREAL_0:2;
          then
A31:      j+1 in dom D by A30,FINSEQ_3:25;
          j+1 > 1 by A29,NAT_1:13;
          then lower_bound divset(D,j+1) = D.(j+1-1) by A31,INTEGRA1:def 4
            .=D.j;
          then j+1 <= j by A19,A27,A26,A31;
          hence contradiction by NAT_1:13;
        end;
        hence contradiction by A16,A19,A25;
      end;
    end;
    then x in divset(D,k) by A16,A19,INTEGRA2:1;
    hence thesis by A16;
  end;
end;

theorem Th4:
  ex D st D1 <= D & D2 <= D & rng D = rng D1 \/ rng D2
proof
  consider D being FinSequence of REAL such that
A1: rng D = rng(D1^D2) and
A2: len D = card rng(D1^D2) and
A3: D is increasing by SEQ_4:140;
  reconsider D as increasing FinSequence of REAL by A3;
  reconsider D as non empty increasing FinSequence of REAL by A1;
A4: rng D2 c= A by INTEGRA1:def 2;
A5: rng(D1^D2) = rng D1 \/ rng D2 by FINSEQ_1:31;
  then
A6: rng D1 c= rng(D1^D2) by XBOOLE_1:7;
  rng D1 c= A by INTEGRA1:def 2;
  then
A7: rng D c= A by A1,A5,A4,XBOOLE_1:8;
  D.len D = upper_bound A
  proof
    len D1 in dom D1 by FINSEQ_5:6;
    then D1.len D1 in rng D1 by FUNCT_1:def 3;
    then consider k such that
A8: k in dom D and
A9: D1.len D1=D.k by A1,A6,PARTFUN1:3;
    assume
A10: D.len D <> upper_bound A;
A11: len D in dom D by FINSEQ_5:6;
    then D.len D in rng D by FUNCT_1:def 3;
    then D.len D <= upper_bound A by A7,INTEGRA2:1;
    then
A12: D.len D < upper_bound A by A10,XXREAL_0:1;
    D1.len D1 = upper_bound A by INTEGRA1:def 2;
    then k > len D by A11,A12,A8,A9,SEQ_4:137;
    hence contradiction by A8,FINSEQ_3:25;
  end;
  then reconsider D as Division of A by A7,INTEGRA1:def 2;
  take D;
  card rng D1 <= len D by A2,A5,NAT_1:43,XBOOLE_1:7;
  then len D1 <= len D by FINSEQ_4:62;
  hence D1 <= D by A1,A6,INTEGRA1:def 18;
A13: rng D2 c= rng(D1^D2) by A5,XBOOLE_1:7;
  card rng D2 <= len D by A2,A5,NAT_1:43,XBOOLE_1:7;
  then len D2 <= len D by FINSEQ_4:62;
  hence D2 <= D by A1,A13,INTEGRA1:def 18;
  thus thesis by A1,FINSEQ_1:31;
end;

theorem Th5:
  delta(D1) < min rng upper_volume(chi(A,A),D) implies for x,y,i st
i in dom D1 & x in rng D /\ divset(D1,i) & y in rng D /\ divset(D1,i) holds x=y
proof
  assume
A1: delta(D1)<min rng upper_volume(chi(A,A),D);
  let x,y,i;
  assume
A2: i in dom D1;
  assume
A3: x in rng D /\ divset(D1,i);
  then x in rng D by XBOOLE_0:def 4;
  then consider n such that
A4: n in dom D and
A5: x=D.n by PARTFUN1:3;
  assume
A6: y in rng D /\ divset(D1,i);
  then y in rng D by XBOOLE_0:def 4;
  then consider m such that
A7: m in dom D and
A8: y=D.m by PARTFUN1:3;
  assume
A9: x<>y;
A10: |.D.n-D.m.| >= min rng upper_volume(chi(A,A),D)
  proof
    per cases by A9,A5,A8,XXREAL_0:1;
    suppose
      n<m;
      then
A11:  n+1<=m by NAT_1:13;
A12:  1<=n+1 by NAT_1:12;
      m in Seg len D by A7,FINSEQ_1:def 3;
      then m<=len D by FINSEQ_1:1;
      then n+1<=len D by A11,XXREAL_0:2;
      then
A13:  n+1 in Seg len D by A12,FINSEQ_1:1;
      then
A14:  n+1 in dom D by FINSEQ_1:def 3;
      then D.m>=D.(n+1) by A7,A11,SEQ_4:137;
      then D.n-D.m <= D.n-D.(n+1) by XREAL_1:10;
      then
A15:  -(D.n-D.m) >= -(D.n-D.(n+1)) by XREAL_1:24;
      n+1 in Seg len upper_volume(chi(A,A),D) by A13,INTEGRA1:def 6;
      then n+1 in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
      then
A16:  (upper_volume(chi(A,A),D)).(n+1) in rng upper_volume(chi(A,A),D) by
FUNCT_1:def 3;
      n in Seg len D by A4,FINSEQ_1:def 3;
      then 1<=n by FINSEQ_1:1;
      then
A17:  n+1 <> 1 by NAT_1:13;
      then
A18:  upper_bound divset(D,n+1)=D.(n+1) by A14,INTEGRA1:def 4;
      -|.D.n-D.m.| <= D.n-D.m by ABSVALUE:4;
      then
A19:  |.D.n-D.m.| >= -(D.n-D.m) by XREAL_1:26;
      lower_bound divset(D,n+1)=D.((n+1)-1) by A14,A17,INTEGRA1:def 4;
      then vol(divset(D,n+1))=D.(n+1)-D.n by A18,INTEGRA1:def 5;
      then D.(n+1)-D.n=(upper_volume(chi(A,A),D)).(n+1) by A14,INTEGRA1:20;
      then D.(n+1)-D.n>=min rng upper_volume(chi(A,A),D) by A16,XXREAL_2:def 7;
      then -(D.n-D.m) >= min rng upper_volume(chi(A,A),D) by A15,XXREAL_0:2;
      hence thesis by A19,XXREAL_0:2;
    end;
    suppose
      n>m;
      then
A20:  m+1<=n by NAT_1:13;
      n in Seg len D by A4,FINSEQ_1:def 3;
      then n<=len D by FINSEQ_1:1;
      then
A21:  m+1<=len D by A20,XXREAL_0:2;
A22:  1<=m+1 by NAT_1:12;
      then
A23:  m+1 in dom D by A21,FINSEQ_3:25;
      then D.(m+1)<=D.n by A4,A20,SEQ_4:137;
      then
A24:  D.n-D.m >= D.(m+1)-D.m by XREAL_1:9;
      m+1 in Seg len D by A22,A21,FINSEQ_1:1;
      then m+1 in Seg len upper_volume(chi(A,A),D) by INTEGRA1:def 6;
      then m+1 in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
      then
A25:  (upper_volume(chi(A,A),D)).(m+1) in rng upper_volume(chi(A,A),D) by
FUNCT_1:def 3;
      m in Seg len D by A7,FINSEQ_1:def 3;
      then 1<=m by FINSEQ_1:1;
      then
A26:  1 < m+1 by NAT_1:13;
      then
A27:  upper_bound divset(D,m+1)=D.(m+1) by A23,INTEGRA1:def 4;
      lower_bound divset(D,m+1)=D.((m+1)-1) by A23,A26,INTEGRA1:def 4;
      then vol(divset(D,m+1))=D.(m+1)-D.m by A27,INTEGRA1:def 5;
      then D.(m+1)-D.m=(upper_volume(chi(A,A),D)).(m+1) by A23,INTEGRA1:20;
      then D.(m+1)-D.m>=min rng upper_volume(chi(A,A),D) by A25,XXREAL_2:def 7;
      then
A28:  D.n-D.m >= min rng upper_volume(chi(A,A),D) by A24,XXREAL_0:2;
      |.D.n-D.m.| >= D.n-D.m by ABSVALUE:4;
      hence thesis by A28,XXREAL_0:2;
    end;
  end;
  |.D.n-D.m.| <= delta D1
  proof
    per cases by A9,A5,A8,XXREAL_0:1;
    suppose
A29:  n<m;
      i in Seg len D1 by A2,FINSEQ_1:def 3;
      then i in Seg len upper_volume(chi(A,A),D1) by INTEGRA1:def 6;
      then i in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
      then upper_volume(chi(A,A),D1).i in rng upper_volume(chi(A,A),D1) by
FUNCT_1:def 3;
      then
      upper_volume(chi(A,A),D1).i <= max rng upper_volume(chi(A,A),D1) by
XXREAL_2:def 8;
      then
A30:  upper_volume(chi(A,A),D1).i<=delta(D1);
      D.m in divset(D1,i) by A6,A8,XBOOLE_0:def 4;
      then D.m <= upper_bound divset(D1,i) by INTEGRA2:1;
      then
A31:  D.m-lower_bound divset(D1,i)<= upper_bound divset(D1,i)-lower_bound
      divset(D1,i) by XREAL_1:9;
      D.n in divset(D1,i) by A3,A5,XBOOLE_0:def 4;
      then D.n >= lower_bound divset(D1,i) by INTEGRA2:1;
      then D.m-D.n <= D.m-lower_bound divset(D1,i) by XREAL_1:10;
      then D.m-D.n <= upper_bound divset(D1,i)- lower_bound divset(D1,i) by A31
,XXREAL_0:2;
      then D.m-D.n <= vol(divset(D1,i)) by INTEGRA1:def 5;
      then
A32:  D.m-D.n <= upper_volume(chi(A,A),D1).i by A2,INTEGRA1:20;
      D.n<D.m by A4,A7,A29,SEQM_3:def 1;
      then D.n-D.m<0 by XREAL_1:49;
      then |.D.n-D.m.|=-(D.n-D.m) by ABSVALUE:def 1
        .= D.m-D.n;
      hence thesis by A32,A30,XXREAL_0:2;
    end;
    suppose
A33:  n>m;
      i in Seg len D1 by A2,FINSEQ_1:def 3;
      then i in Seg len upper_volume(chi(A,A),D1) by INTEGRA1:def 6;
      then i in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
      then upper_volume(chi(A,A),D1).i in rng upper_volume(chi(A,A),D1) by
FUNCT_1:def 3;
      then
      upper_volume(chi(A,A),D1).i <= max rng upper_volume(chi(A,A),D1) by
XXREAL_2:def 8;
      then
A34:  upper_volume(chi(A,A),D1).i<=delta(D1);
      D.n in divset(D1,i) by A3,A5,XBOOLE_0:def 4;
      then D.n <= upper_bound divset(D1,i) by INTEGRA2:1;
      then
A35:  D.n-lower_bound divset(D1,i)<= upper_bound divset(D1,i)-
      lower_bound divset(D1,i) by XREAL_1:9;
      D.m in divset(D1,i) by A6,A8,XBOOLE_0:def 4;
      then D.m >= lower_bound divset(D1,i) by INTEGRA2:1;
      then D.n-D.m <= D.n-lower_bound divset(D1,i) by XREAL_1:10;
      then
      D.n-D.m <= upper_bound divset(D1,i)-lower_bound divset(D1,i) by A35,
XXREAL_0:2;
      then D.n-D.m <= vol(divset(D1,i)) by INTEGRA1:def 5;
      then
A36:  D.n-D.m <= upper_volume(chi(A,A),D1).i by A2,INTEGRA1:20;
      D.n>D.m by A4,A7,A33,SEQM_3:def 1;
      then D.n-D.m>0 by XREAL_1:50;
      then |.D.n-D.m.|=D.n-D.m by ABSVALUE:def 1;
      hence thesis by A36,A34,XXREAL_0:2;
    end;
  end;
  hence contradiction by A1,A10,XXREAL_0:2;
end;

theorem Th6:
  for p,q st rng p = rng q & p is increasing & q is increasing
  holds p = q
proof
  let p,q;
  assume
A1: rng p = rng q;
  assume that
A2: p is increasing and
A3: q is increasing;
A4: q is one-to-one by A3;
  p is one-to-one by A2;
  then len p = len q by A1,A4,FINSEQ_1:48;
  hence thesis by A1,A2,A3,SEQ_4:141;
end;

theorem Th7:
  D <= D1 & i in dom D & j in dom D & i <= j implies indx(D1,D,i)
  <= indx(D1,D,j) & indx(D1,D,i) in dom D1
proof
  assume that
A1: D <= D1 and
A2: i in dom D and
A3: j in dom D and
A4: i <= j;
A5: D.i = D1.indx(D1,D,i) by A1,A2,INTEGRA1:def 19;
A6: indx(D1,D,j) in dom D1 by A1,A3,INTEGRA1:def 19;
A7: D.j = D1.indx(D1,D,j) by A1,A3,INTEGRA1:def 19;
A8: indx(D1,D,i) in dom D1 by A1,A2,INTEGRA1:def 19;
  D.i <= D.j by A2,A3,A4,SEQ_4:137;
  hence thesis by A5,A8,A7,A6,SEQM_3:def 1;
end;

theorem Th8:
  D <= D1 & i in dom D & j in dom D & i < j implies indx(D1,D,i) <
  indx(D1,D,j)
proof
  assume that
A1: D <= D1 and
A2: i in dom D and
A3: j in dom D and
A4: i < j;
A5: D.i = D1.indx(D1,D,i) by A1,A2,INTEGRA1:def 19;
A6: indx(D1,D,j) in dom D1 by A1,A3,INTEGRA1:def 19;
A7: D.j = D1.indx(D1,D,j) by A1,A3,INTEGRA1:def 19;
A8: indx(D1,D,i) in dom D1 by A1,A2,INTEGRA1:def 19;
  D.i < D.j by A2,A3,A4,SEQM_3:def 1;
  hence thesis by A5,A8,A7,A6,SEQ_4:137;
end;

theorem Th9:
  delta(D) >= 0
proof
  consider y being Element of REAL such that
A1: y in rng D by SUBSET_1:4;
  consider n such that
A2: n in dom D and
  y=D.n by A1,PARTFUN1:3;
  n in Seg len D by A2,FINSEQ_1:def 3;
  then n in Seg len upper_volume(chi(A,A),D) by INTEGRA1:def 6;
  then n in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
  then upper_volume(chi(A,A),D).n in rng upper_volume(chi(A,A),D) by
FUNCT_1:def 3;
  then
A3: upper_volume(chi(A,A),D).n <= max rng upper_volume(chi(A,A),D) by
XXREAL_2:def 8;
  vol(divset(D,n))=upper_volume(chi(A,A),D).n by A2,INTEGRA1:20;
  then upper_volume(chi(A,A),D).n >= 0 by INTEGRA1:9;
  hence thesis by A3;
end;

Lm3: for A be non empty closed_interval Subset of REAL,
  g be Function of A,REAL st g|A
is bounded holds upper_bound rng g >= lower_bound rng g
proof
  let A be non empty closed_interval Subset of REAL;
  let g be Function of A,REAL;
  assume
A1: g|A is bounded;
  then
A2: rng g is bounded_below by INTEGRA1:11;
  rng g is bounded_above by A1,INTEGRA1:13;
  hence thesis by A2,SEQ_4:11;
end;

Lm4: for A,B be non empty closed_interval Subset of REAL,
 f be Function of A,REAL st f|A
is bounded & B c= A holds lower_bound rng(f|B) >= lower_bound rng f &
lower_bound rng f <= upper_bound rng(f|B) & upper_bound rng(f|B) <= upper_bound
rng f & lower_bound rng(f|B) <= upper_bound rng f
proof
  let A,B be non empty closed_interval Subset of REAL, f be Function of A,REAL;
  assume that
A1: f|A is bounded and
A2: B c= A;
  B c=dom f by A2,FUNCT_2:def 1;
  then
A3: dom(f|B)=B by RELAT_1:62;
  then
A4: rng(f|B) <> {} by RELAT_1:42;
  consider x being Element of REAL such that
A5: x in B by SUBSET_1:4;
A6: (f|B).x in rng(f|B) by A5,A3,FUNCT_1:def 3;
A7: rng f is bounded_below by A1,INTEGRA1:11;
  hence
A8: lower_bound rng(f|B) >= lower_bound rng f by A4,RELAT_1:70,SEQ_4:47;
  rng(f|B) is bounded_below by A7,RELAT_1:70,XXREAL_2:44;
  then
A9: lower_bound rng(f|B)<=(f|B).x by A6,SEQ_4:def 2;
A10: rng f is bounded_above by A1,INTEGRA1:13;
  then rng(f|B) is bounded_above by RELAT_1:70,XXREAL_2:43;
  then upper_bound rng(f|B)>=(f|B).x by A6,SEQ_4:def 1;
  then
A11: lower_bound rng(f|B) <= upper_bound rng(f|B) by A9,XXREAL_0:2;
  hence upper_bound rng(f|B) >= lower_bound rng f by A8,XXREAL_0:2;
  thus upper_bound rng(f|B) <= upper_bound rng f by A10,A4,RELAT_1:70,SEQ_4:48;
  hence thesis by A11,XXREAL_0:2;
end;

Lm5: j in dom D1 implies vol(divset(D1,j)) <= delta D1
proof
  assume
A1: j in dom D1;
  then j in Seg len D1 by FINSEQ_1:def 3;
  then j in Seg len upper_volume(chi(A,A),D1) by INTEGRA1:def 6;
  then j in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
  then upper_volume(chi(A,A),D1).j in rng upper_volume(chi(A,A),D1) by
FUNCT_1:def 3;
  then upper_volume(chi(A,A),D1).j <= max rng upper_volume(chi(A,A),D1) by
XXREAL_2:def 8;
  then vol(divset(D1,j)) <= max rng upper_volume(chi(A,A),D1) by A1,INTEGRA1:20
;
  hence thesis;
end;

Lm6: for j1 be Element of NAT st j1 = len D1 - 1 & x in divset(D1,len D1) &
len D1 >= 2 & D1 <= D2 & rng D2 = rng D1 \/ {x} holds rng (D2|indx(D2,D1,j1)) =
rng (D1|j1)
proof
  let j1 be Element of NAT;
  assume that
A1: j1 = len D1 - 1 and
A2: x in divset(D1,len D1) and
A3: len D1 >= 2;
A4: len D1 in dom D1 by FINSEQ_5:6;
  assume that
A5: D1<=D2 and
A6: rng D2 = rng D1 \/ {x};
A7: len D1 <> 1 by A3;
  then
A8: len D1-1 in dom D1 by A4,INTEGRA1:7;
  then
A9: indx(D2,D1,j1) in dom D2 by A1,A5,INTEGRA1:def 19;
  then
A10: indx(D2,D1,j1) <= len D2 by FINSEQ_3:25;
A11: j1 in dom D1 by A1,A4,A7,INTEGRA1:7;
  then
A12: 1 <= j1 by FINSEQ_3:25;
A13: j1 <= len D1 by A11,FINSEQ_3:25;
  lower_bound divset(D1,len D1) <= x by A2,INTEGRA2:1;
  then
A14: D1.j1 <= x by A1,A4,A7,INTEGRA1:def 4;
  for x1 being object st x1 in rng(D2|indx(D2,D1,j1)) holds x1 in rng(D1|j1)
  proof
    let x1 be object;
    assume x1 in rng(D2|indx(D2,D1,j1));
    then consider k such that
A15: k in dom(D2|indx(D2,D1,j1)) and
A16: x1=(D2|indx(D2,D1,j1)).k by PARTFUN1:3;
    k in Seg len(D2|indx(D2,D1,j1)) by A15,FINSEQ_1:def 3;
    then
A17: k in Seg indx(D2,D1,j1) by A10,FINSEQ_1:59;
    then
A18: k in dom D2 by A9,RFINSEQ:6;
A19: len(D1|j1) = j1 by A13,FINSEQ_1:59;
    k <= indx(D2,D1,j1) by A17,FINSEQ_1:1;
    then D2.k <= D2.indx(D2,D1,j1) by A9,A18,SEQ_4:137;
    then
A20: D2.k <= D1.j1 by A1,A5,A8,INTEGRA1:def 19;
A21: D2.k in rng D1 implies D2.k in rng(D1|j1)
    proof
      assume D2.k in rng D1;
      then consider m such that
A22:  m in dom D1 and
A23:  D2.k = D1.m by PARTFUN1:3;
      m in Seg len D1 by A22,FINSEQ_1:def 3;
      then
A24:  1 <= m by FINSEQ_1:1;
A25:  m <= j1 by A11,A20,A22,A23,SEQM_3:def 1;
      then m in Seg j1 by A24,FINSEQ_1:1;
      then
A26:  D2.k = (D1|j1).m by A11,A23,RFINSEQ:6;
      m in dom (D1|j1) by A19,A24,A25,FINSEQ_3:25;
      hence thesis by A26,FUNCT_1:def 3;
    end;
A27: D2.k in {x} implies D2.k = D1.j1
    proof
      assume D2.k in {x};
      then D1.j1 <= D2.k by A14,TARSKI:def 1;
      hence thesis by A20,XXREAL_0:1;
    end;
A28: D2.k in {x} implies D2.k in rng(D1|j1)
    proof
      j1 in dom(D1|j1) by A12,A19,FINSEQ_3:25;
      then
A29:  (D1|j1).j1 in rng(D1|j1) by FUNCT_1:def 3;
      assume
A30:  D2.k in {x};
      j1 in Seg j1 by A12,FINSEQ_1:1;
      hence thesis by A11,A27,A30,A29,RFINSEQ:6;
    end;
    D2.k in rng D2 by A18,FUNCT_1:def 3;
    hence thesis by A6,A9,A16,A17,A28,A21,RFINSEQ:6,XBOOLE_0:def 3;
  end;
  then
A31: rng(D2|indx(D2,D1,j1)) c= rng (D1|j1);
  for x1 being object st x1 in rng(D1|j1) holds x1 in rng(D2|indx(D2,D1,j1))
  proof
    let x1 be object;
    assume x1 in rng(D1|j1);
    then consider k such that
A32: k in dom(D1|j1) and
A33: x1=(D1|j1).k by PARTFUN1:3;
    k in Seg len(D1|j1) by A32,FINSEQ_1:def 3;
    then
A34: k in Seg j1 by A13,FINSEQ_1:59;
    then
A35: k in dom D1 by A11,RFINSEQ:6;
    k <= j1 by A34,FINSEQ_1:1;
    then D1.k <= D1.j1 by A1,A8,A35,SEQ_4:137;
    then D2.indx(D2,D1,k) <= D1.j1 by A5,A35,INTEGRA1:def 19;
    then
A36: D2.indx(D2,D1,k)<=D2.indx(D2,D1,j1) by A1,A5,A8,INTEGRA1:def 19;
A37: (D1|j1).k = D1.k by A11,A34,RFINSEQ:6;
    D1.k in rng D1 by A35,FUNCT_1:def 3;
    then x1 in rng D2 by A6,A33,A37,XBOOLE_0:def 3;
    then consider n such that
A38: n in dom D2 and
A39: x1=D2.n by PARTFUN1:3;
    D2.indx(D2,D1,k)=D2.n by A5,A33,A37,A35,A39,INTEGRA1:def 19;
    then
A40: n <= indx(D2,D1,j1) by A9,A38,A36,SEQM_3:def 1;
    1 <= n by A38,FINSEQ_3:25;
    then
A41: n in Seg indx(D2,D1,j1) by A40,FINSEQ_1:1;
    then n in Seg len(D2|indx(D2,D1,j1)) by A10,FINSEQ_1:59;
    then
A42: n in dom(D2|indx(D2,D1,j1)) by FINSEQ_1:def 3;
    D2.n = (D2|indx(D2,D1,j1)).n by A9,A41,RFINSEQ:6;
    hence thesis by A39,A42,FUNCT_1:def 3;
  end;
  then rng(D1|j1) c= rng(D2|indx(D2,D1,j1));
  hence thesis by A31,XBOOLE_0:def 10;
end;

theorem Th10:
  x in divset(D1,len D1) & len D1 >= 2 & D1<=D2 & rng D2 = rng D1
\/ {x} & g|A is bounded implies Sum lower_volume(g,D2) - Sum lower_volume(g,D1)
  <= (upper_bound rng g-lower_bound rng g)*delta(D1)
proof
  assume that
A1: x in divset(D1,len D1) and
A2: len D1 >= 2;
  set j = len D1;
  assume that
A3: D1<=D2 and
A4: rng D2 = rng D1 \/ {x};
A5: len D1 in dom D1 by FINSEQ_5:6;
  then
A6: indx(D2,D1,j) in dom D2 by A3,INTEGRA1:def 19;
A7: len D1 <> 1 by A2;
  then reconsider j1=len D1-1 as Element of NAT by A5,INTEGRA1:7;
A8: j1 in dom D1 by A5,A7,INTEGRA1:7;
  then
A9: j1 <= len D1 by FINSEQ_3:25;
A10: 1 <= j1 by A8,FINSEQ_3:25;
  then mid(D1,1,j1) is increasing by A5,A7,INTEGRA1:7,35;
  then
A11: D1|j1 is increasing by A10,FINSEQ_6:116;
A12: len D1-1 in dom D1 by A5,A7,INTEGRA1:7;
  then
A13: indx(D2,D1,j1) in dom D2 by A3,INTEGRA1:def 19;
  then
A14: 1 <= indx(D2,D1,j1) by FINSEQ_3:25;
  then mid(D2,1,indx(D2,D1,j1)) is increasing by A13,INTEGRA1:35;
  then
A15: D2|indx(D2,D1,j1) is increasing by A14,FINSEQ_6:116;
A16: indx(D2,D1,j1) <= len D2 by A13,FINSEQ_3:25;
  then
A17: len (D2|indx(D2,D1,j1))=indx(D2,D1,j1) by FINSEQ_1:59;
A18: rng (D2|indx(D2,D1,j1)) = rng (D1|j1) by A1,A2,A3,A4,Lm6;
  then
A19: D2|indx(D2,D1,j1)=D1|j1 by A15,A11,Th6;
A20: for k st 1 <= k & k <= j1 holds k=indx(D2,D1,k)
  proof
    let k;
    assume that
A21: 1 <= k and
A22: k <= j1;
    assume
A23: k<>indx(D2,D1,k);
    per cases by A23,XXREAL_0:1;
    suppose
A24:  k > indx(D2,D1,k);
      k <= len D1 by A9,A22,XXREAL_0:2;
      then
A25:  k in dom D1 by A21,FINSEQ_3:25;
      then indx(D2,D1,k) in dom D2 by A3,INTEGRA1:def 19;
      then indx(D2,D1,k) in Seg len D2 by FINSEQ_1:def 3;
      then
A26:  1<=indx(D2,D1,k) by FINSEQ_1:1;
A27:  indx(D2,D1,k) < j1 by A22,A24,XXREAL_0:2;
      then
A28:  indx(D2,D1,k) in Seg j1 by A26,FINSEQ_1:1;
      indx(D2,D1,k)<=indx(D2,D1,j1) by A3,A8,A22,A25,Th7;
      then indx(D2,D1,k) in Seg indx(D2,D1,j1) by A26,FINSEQ_1:1;
      then
A29:  (D2|indx(D2,D1,j1)).indx(D2,D1,k)=D2.indx(D2,D1,k) by A13,RFINSEQ:6;
      indx(D2,D1,k) <= len D1 by A9,A27,XXREAL_0:2;
      then indx(D2,D1,k) in dom D1 by A26,FINSEQ_3:25;
      then
A30:  D1.k > D1.indx(D2,D1,k) by A24,A25,SEQM_3:def 1;
      D1.k=D2.indx(D2,D1,k) by A3,A25,INTEGRA1:def 19;
      hence contradiction by A8,A19,A29,A30,A28,RFINSEQ:6;
    end;
    suppose
A31:  k < indx(D2,D1,k);
      k <= len D1 by A9,A22,XXREAL_0:2;
      then
A32:  k in dom D1 by A21,FINSEQ_3:25;
      then indx(D2,D1,k) <= indx(D2,D1,j1) by A3,A8,A22,Th7;
      then
A33:  k <= indx(D2,D1,j1) by A31,XXREAL_0:2;
      then k <= len D2 by A16,XXREAL_0:2;
      then
A34:  k in dom D2 by A21,FINSEQ_3:25;
      k in Seg j1 by A21,A22,FINSEQ_1:1;
      then
A35:  D1.k = (D1|j1).k by A12,RFINSEQ:6;
      indx(D2,D1,k) in dom D2 by A3,A32,INTEGRA1:def 19;
      then
A36:  D2.k < D2.indx(D2,D1,k) by A31,A34,SEQM_3:def 1;
A37:  k in Seg indx(D2,D1,j1) by A21,A33,FINSEQ_1:1;
      D1.k=D2.indx(D2,D1,k) by A3,A32,INTEGRA1:def 19;
      hence contradiction by A13,A19,A35,A36,A37,RFINSEQ:6;
    end;
  end;
A38: for k be Nat st 1 <= k & k <= len(lower_volume(g,D1)|j1) holds (
  lower_volume(g,D1)|j1).k = (lower_volume(g,D2)|indx(D2,D1,j1)).k
  proof
    indx(D2,D1,j1) in Seg len D2 by A13,FINSEQ_1:def 3;
    then indx(D2,D1,j1) in Seg len lower_volume(g,D2) by INTEGRA1:def 7;
    then
A39: indx(D2,D1,j1) in dom lower_volume(g,D2) by FINSEQ_1:def 3;
    let k be Nat;
    assume that
A40: 1 <= k and
A41: k <= len(lower_volume(g,D1)|j1);
    reconsider k as Element of NAT by ORDINAL1:def 12;
A42: len(lower_volume(g,D1)) = len D1 by INTEGRA1:def 7;
    then
A43: k <= j1 by A9,A41,FINSEQ_1:59;
    then k <= len D1 by A9,XXREAL_0:2;
    then k in Seg len D1 by A40,FINSEQ_1:1;
    then
A44: k in dom D1 by FINSEQ_1:def 3;
    then
A45: indx(D2,D1,k) in dom D2 by A3,INTEGRA1:def 19;
A46: k in Seg j1 by A40,A43,FINSEQ_1:1;
    then indx(D2,D1,k) in Seg j1 by A20,A40,A43;
    then
A47: indx(D2,D1,k) in Seg indx(D2,D1,j1) by A10,A20;
    then indx(D2,D1,k)<=indx(D2,D1,j1) by FINSEQ_1:1;
    then
A48: indx(D2,D1,k)<=len D2 by A16,XXREAL_0:2;
A49: D1.k=D2.indx(D2,D1,k) by A3,A44,INTEGRA1:def 19;
A50: lower_bound divset(D1,k)=lower_bound divset(D2,indx(D2,D1,k)) &
    upper_bound divset(D1,k)=upper_bound divset(D2,indx(D2,D1,k))
    proof
      per cases;
      suppose
A51:    k=1;
        then
A52:    upper_bound divset(D1,k)=D1.k by A44,INTEGRA1:def 4;
A53:    lower_bound divset(D1,k)=lower_bound A by A44,A51,INTEGRA1:def 4;
        indx(D2,D1,k)=1 by A10,A20,A51;
        hence thesis by A45,A49,A53,A52,INTEGRA1:def 4;
      end;
      suppose
A54:    k<>1;
        then reconsider k1=k-1 as Element of NAT by A44,INTEGRA1:7;
A55:    k-1 in dom D1 by A44,A54,INTEGRA1:7;
        then
A56:    1 <= k1 by FINSEQ_3:25;
        k <= k+1 by NAT_1:11;
        then k1 <= k by XREAL_1:20;
        then
A57:    k1 <= j1 by A43,XXREAL_0:2;
A58:    indx(D2,D1,k)<>1 by A20,A40,A43,A54;
        then
A59:    lower_bound divset(D2,indx(D2,D1,k))=D2.(indx(D2,D1,k)-1) by A45,
INTEGRA1:def 4;
A60:    upper_bound divset(D1,k)=D1.k by A44,A54,INTEGRA1:def 4;
A61:    lower_bound divset(D1,k)=D1.(k-1) by A44,A54,INTEGRA1:def 4;
A62:    upper_bound divset(D2,indx(D2,D1,k))=D2.indx(D2,D1,k) by A45,A58,
INTEGRA1:def 4;
        D2.(indx(D2,D1,k)-1)=D2.(k-1) by A20,A40,A43
          .= D2.indx(D2,D1,k1) by A20,A57,A56;
        hence thesis by A3,A44,A61,A60,A55,A59,A62,INTEGRA1:def 19;
      end;
    end;
    divset(D1,k)=[. lower_bound divset(D1,k), upper_bound divset(D1,k) .]
    by INTEGRA1:4;
    then
A63: divset(D1,k)=divset(D2,indx(D2,D1,k)) by A50,INTEGRA1:4;
    j1 in Seg len(lower_volume(g,D1)) by A8,A42,FINSEQ_1:def 3;
    then j1 in dom(lower_volume(g,D1)) by FINSEQ_1:def 3;
    then
A64: (lower_volume(g,D1)|j1).k = lower_volume(g,D1).k by A46,RFINSEQ:6
      .=(lower_bound(rng(g|divset(D2,indx(D2,D1,k)))))* vol(divset(D2,indx(
    D2,D1,k))) by A44,A63,INTEGRA1:def 7;
    1<=indx(D2,D1,k) by A20,A40,A43;
    then
A65: indx(D2,D1,k) in dom D2 by A48,FINSEQ_3:25;
    (lower_volume(g,D2)|indx(D2,D1,j1)).k =(lower_volume(g,D2)|indx(D2,
    D1,j1)).indx(D2,D1,k) by A20,A40,A43
      .=lower_volume(g,D2).indx(D2,D1,k) by A47,A39,RFINSEQ:6
      .=(lower_bound(rng(g|divset(D2,indx(D2,D1,k)))))* vol(divset(D2,indx(
    D2,D1,k))) by A65,INTEGRA1:def 7;
    hence thesis by A64;
  end;
A66: len D2 in dom D2 by FINSEQ_5:6;
  deffunc LVg(Division of A) = lower_volume(g,$1);
  deffunc PLg(Division of A,Nat) = (PartSums(lower_volume(g,$1))).$2;
A67: j >= len lower_volume(g,D1) by INTEGRA1:def 7;
A68: j <= len LVg(D1) by INTEGRA1:def 7;
A69: len D1 in Seg len D1 by FINSEQ_1:3;
  then
A70: 1 <= j by FINSEQ_1:1;
  then
A71: j in dom LVg(D1) by A68,FINSEQ_3:25;
  assume
A72: g|A is bounded;
  j < j+1 by NAT_1:13;
  then
A73: j1 < j by XREAL_1:19;
  then j1 < len LVg(D1) by INTEGRA1:def 7;
  then j1 in dom LVg(D1) by A10,FINSEQ_3:25;
  then PLg(D1,j1)=Sum(LVg(D1)|j1) by INTEGRA1:def 20;
  then PLg(D1,j1)+Sum mid(LVg(D1),j,j) =Sum((LVg(D1)|j1)^mid(LVg(D1),j,j)) by
RVSUM_1:75
    .=Sum(mid(LVg(D1),1,j1)^mid(LVg(D1),j1+1,j)) by A10,FINSEQ_6:116
    .=Sum(mid(LVg(D1),1,j)) by A10,A68,A73,INTEGRA2:4
    .=Sum(LVg(D1)|j) by A70,FINSEQ_6:116;
  then
A74: PLg(D1,j1)+Sum mid(lower_volume(g,D1),j,j)=PLg(D1,j) by A71,
INTEGRA1:def 20;
A75: indx(D2,D1,j) in dom D2 by A3,A5,INTEGRA1:def 19;
  then
A76: indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
  then
A77: 1 <= indx(D2,D1,j) by FINSEQ_1:1;
  len D1 < len D1+1 by NAT_1:13;
  then j1 < len D1 by XREAL_1:19;
  then
A78: indx(D2,D1,j1) < indx(D2,D1,len D1) by A3,A5,A8,Th8;
  then
A79: indx(D2,D1,j1)+1 <= indx(D2,D1,len D1) by NAT_1:13;
A80: j1 in dom D1 by A5,A7,INTEGRA1:7;
A81: Sum mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,len D1)) -Sum
mid(lower_volume(g,D1),len D1,len D1) <= (upper_bound rng g-lower_bound rng g)*
  delta(D1)
  proof
A82: indx(D2,D1,j)-indx(D2,D1,j1) <= 2
    proof
      set ID1=indx(D2,D1,j1)+1;
      set ID2=ID1+1;
      assume indx(D2,D1,j)-indx(D2,D1,j1) > 2;
      then
A83:  indx(D2,D1,j1)+(1+1)<indx(D2,D1,j) by XREAL_1:20;
A84:  ID1 < ID2 by NAT_1:13;
      then indx(D2,D1,j1) <= ID2 by NAT_1:13;
      then
A85:  1 <= ID2 by A14,XXREAL_0:2;
A86:  indx(D2,D1,j) in dom D2 by A3,A5,INTEGRA1:def 19;
      then
A87:  indx(D2,D1,j) <= len D2 by FINSEQ_3:25;
      then ID2 <= len D2 by A83,XXREAL_0:2;
      then
A88:  ID2 in dom D2 by A85,FINSEQ_3:25;
      then
A89:  D2.ID2<D2.indx(D2, D1,j) by A83,A86,SEQM_3:def 1;
A90:  1 <= ID1 by A14,NAT_1:13;
A91:  D1.j1 = D2.indx(D2,D1,j1) by A3,A8,INTEGRA1:def 19;
      ID1 <= indx(D2,D1,j) by A83,A84,XXREAL_0:2;
      then ID1 <= len D2 by A87,XXREAL_0:2;
      then
A92:  ID1 in dom D2 by A90,FINSEQ_3:25;
A93:  D1.j = D2.indx(D2,D1,j) by A3,A5,INTEGRA1:def 19;
      indx(D2,D1,j1) < ID1 by NAT_1:13;
      then
A94:  D2.indx(D2,D1,j1)<D2.ID1 by A13,A92,SEQM_3:def 1;
A95:  D2.ID1<D2.ID2 by A84,A92,A88,SEQM_3:def 1;
A96:  not D2.ID1 in rng D1 & not D2.ID2 in rng D1
      proof
        assume
A97:    D2.ID1 in rng D1 or D2.ID2 in rng D1;
        per cases by A97;
        suppose
          D2.ID1 in rng D1;
          then consider n such that
A98:      n in dom D1 and
A99:      D1.n=D2.ID1 by PARTFUN1:3;
          j1<n by A80,A94,A91,A98,A99,SEQ_4:137;
          then
A100:     j<n+1 by XREAL_1:19;
          D2.ID1<D2.indx(D2,D1,j) by A95,A89,XXREAL_0:2;
          then n<j by A5,A93,A98,A99,SEQ_4:137;
          hence contradiction by A100,NAT_1:13;
        end;
        suppose
          D2.ID2 in rng D1;
          then consider n such that
A101:     n in dom D1 and
A102:     D1.n=D2.ID2 by PARTFUN1:3;
          D2.indx(D2,D1,j1)<D2.ID2 by A94,A95,XXREAL_0:2;
          then j1<n by A8,A91,A101,A102,SEQ_4:137;
          then
A103:     j<n+1 by XREAL_1:19;
          n<j by A5,A89,A93,A101,A102,SEQ_4:137;
          hence contradiction by A103,NAT_1:13;
        end;
      end;
      D2.ID1 in rng D2 by A92,FUNCT_1:def 3;
      then D2.ID1 in {x} by A4,A96,XBOOLE_0:def 3;
      then
A104: D2.ID1 = x by TARSKI:def 1;
      D2.ID2 in rng D2 by A88,FUNCT_1:def 3;
      then D2.ID2 in {x} by A4,A96,XBOOLE_0:def 3;
      then D2.ID1=D2.ID2 by A104,TARSKI:def 1;
      hence contradiction by A84,A92,A88,SEQ_4:138;
    end;
A105: j <= len lower_volume(g,D1) by INTEGRA1:def 7;
A106: 1 <= j by A69,FINSEQ_1:1;
    then
A107: mid(lower_volume(g,D1),j,j).1 = lower_volume(g,D1).j by A105,FINSEQ_6:118
;
    reconsider lv = lower_volume(g,D1).j as Element of REAL by XREAL_0:def 1;
    j-'j+1 = 1 by Lm1;
    then len mid(lower_volume(g,D1),j,j)=1 by A106,A105,FINSEQ_6:118;
    then
A108: mid(lower_volume(g,D1),j,j)=<*lv*> by A107,FINSEQ_1:40;
A109: 1 <= indx(D2,D1,j1)+1 by A14,NAT_1:13;
    indx(D2,D1,j) in dom D2 by A3,A5,INTEGRA1:def 19;
    then
A110: indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
    then
A111: 1 <= indx(D2,D1,j) by FINSEQ_1:1;
    indx(D2,D1,j) in Seg len lower_volume(g,D2) by A110,INTEGRA1:def 7;
    then
A112: indx(D2,D1,j) <= len lower_volume(g,D2) by FINSEQ_1:1;
    then
A113: indx(D2,D1,j1)+1 <= len lower_volume(g,D2 ) by A79,XXREAL_0:2;
    then indx(D2,D1,j1)+1 in Seg len lower_volume(g,D2) by A109,FINSEQ_1:1;
    then
A114: indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 7;
    indx(D2,D1,j)-'(indx(D2,D1,j1)+1) =indx(D2,D1,j)-(indx(D2,D1,j1)+1)
    by A79,XREAL_1:233;
    then indx(D2,D1,j)-'(indx(D2,D1,j1) +1)+1 <= 2 by A82;
    then
A115: len mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))<=2 by A79
,A111,A112,A109,A113,FINSEQ_6:118;
    len lower_volume(g,D2) = len D2 by INTEGRA1:def 7;
    then
A116: indx(D2,D1,j1)+1 in dom D2 by A109,A113,FINSEQ_3:25;
    indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 >= 0+1 by XREAL_1:6;
    then
A117: 1 <= len mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) by A79
,A111,A112,A109,A113,FINSEQ_6:118;
    now
      per cases by A117,A115,Lm2;
      suppose
A118:   len mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))
        =1;
        upper_bound divset(D1,j)=D1.j by A5,A7,INTEGRA1:def 4;
        then
A119:   upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A3,A5,INTEGRA1:def 19;
        lower_bound divset(D1,j)=D1.j1 by A5,A7,INTEGRA1:def 4;
        then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A3,A8,
INTEGRA1:def 19;
        then
A120:   divset(D1,j)=[. D2.indx(D2,D1,j1),D2.indx(D2,D1,j).] by A119,INTEGRA1:4
;
A121:   delta(D1) >= 0 by Th9;
A122:   upper_bound rng g - lower_bound rng g >= 0 by A72,Lm3,XREAL_1:48;
A123:   indx(D2,D1,j) in dom D2 by A3,A5,INTEGRA1:def 19;
        len mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =
indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 by A79,A111,A112,A109,A113,FINSEQ_6:118;
        then
A124:   indx(D2,D1,j)-(indx(D2,D1,j1)+1)=0 by A79,A118,XREAL_1:233;
        then indx(D2,D1,j)<>1 by A13,FINSEQ_3:25;
        then
A125:   upper_bound divset(D2,indx(D2,D1,j))=D2.indx(D2,D1,j) by A123,
INTEGRA1:def 4;
        lower_bound divset(D2,indx(D2,D1,j))=D2.(indx(D2,D1,j)-1) by A14,A124
,A123,INTEGRA1:def 4;
        then
A126:   divset(D2,indx(D2,D1,j))=divset(D1,j) by A124,A120,A125,INTEGRA1:4;
        reconsider li = lower_volume(g,D2).(indx(D2,D1,j1)+1)
           as Element of REAL
                   by XREAL_0:def 1;
        mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)).1 =
lower_volume(g,D2).(indx(D2,D1,j1)+1) by A111,A112,A109,A113,FINSEQ_6:118;
        then mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =
          <*li*> by A118,FINSEQ_1:40;
        then Sum mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j )) =
        lower_volume(g,D2).(indx(D2,D1,j1)+1) by FINSOP_1:11
          .=(lower_bound(rng(g|divset(D2,(indx(D2,D1,j1)+1))))) *vol(divset(
        D2,(indx(D2,D1,j1)+1))) by A116,INTEGRA1:def 7
          .=lower_volume(g,D1).j by A5,A124,A126,INTEGRA1:def 7
          .=Sum mid(lower_volume(g,D1),j,j) by A108,FINSOP_1:11;
        hence thesis by A121,A122;
      end;
      suppose
A127:   len mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))
        =2;
A128:   mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)).1 =
lower_volume(g,D2).(indx(D2,D1,j1)+1) by A111,A112,A109,A113,FINSEQ_6:118;
A129:   2+(indx(D2,D1,j1)+1)>=0+1 by XREAL_1:7;
        mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)).2 =LVg(
D2).(2+(indx(D2,D1,j1)+1)-'1) by A79,A111,A112,A109,A113,A127,FINSEQ_6:118
          .=LVg(D2).(2+(indx(D2,D1,j1)+1)-1) by A129,XREAL_1:233
          .=LVg(D2).(indx(D2,D1,j1)+(1+1));
        then mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =<*
lower_volume(g,D2).(indx(D2,D1,j1)+1), lower_volume(g,D2).(indx(D2,D1,j1)+2)*>
        by A127,A128,FINSEQ_1:44;
        then
A130:   Sum mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j )) =
lower_volume(g,D2).(indx(D2,D1,j1)+1) +lower_volume(g,D2).(indx(D2,D1,j1)+2)
by RVSUM_1:77;
A131:   vol(divset(D2,indx(D2,D1,j1)+1))>=0 by INTEGRA1:9;
        upper_bound divset(D1,j)=D1.j by A5,A7,INTEGRA1:def 4;
        then
A132:   upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A3,A5,INTEGRA1:def 19;
A133:   vol(divset(D2,indx(D2,D1,j1)+2))>=0 by INTEGRA1:9;
        indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A79,A111,A112,A109,A113,A127,
FINSEQ_6:118;
        then
A134:   indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1=2 by A79,XREAL_1:233;
        then
A135:   indx(D2,D1,j1)+2 in dom D2 by A3,A5,INTEGRA1:def 19;
        lower_bound divset(D1,j)=D1.j1 by A5,A7,INTEGRA1:def 4;
        then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A3,A8,
INTEGRA1:def 19;
        then
A136:   vol(divset(D1,j))=D2.(indx(D2,D1,j1)+2)-D2.(indx(D2,D1,j1)+1) +
        D2.(indx(D2,D1,j1)+1)-D2.indx(D2,D1,j1) by A132,A134,INTEGRA1:def 5;
        indx(D2,D1,j1)+1 in Seg len lower_volume(g,D2) by A109,A113,FINSEQ_1:1;
        then indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 7;
        then
A137:   indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
A138:   indx(D2,D1,j1)+1 <> 1 by A14,NAT_1:13;
        then
A139:   upper_bound divset(D2,(indx( D2,D1,j1)+1))=D2.(indx(D2,D1,j1)+1)
        by A137,INTEGRA1:def 4;
        indx(D2,D1,j1)+1-1=indx(D2,D1,j1)+0;
        then
A140:   lower_bound divset(D2,(indx(D2,D1,j1)+1))=D2.indx(D2,D1,j1) by A137
,A138,INTEGRA1:def 4;
A141:   indx(D2,D1,j1)+1+1 > 1 by A109,NAT_1:13;
        indx(D2,D1,j1)+2-1=indx(D2,D1,j1)+1;
        then
A142:   lower_bound divset(D2,(indx(D2,D1,j1)+2))=D2.(indx(D2,D1,j1)+1)
        by A135,A141,INTEGRA1:def 4;
        upper_bound divset(D2,(indx(D2,D1,j1)+2))=D2.(indx(D2,D1,j1)+2)
        by A135,A141,INTEGRA1:def 4;
        then vol(divset(D1,j))=vol(divset(D2,indx(D2,D1,j1)+2)) +D2.(indx(D2,
        D1,j1)+1)-D2.indx(D2,D1,j1) by A142,A136,INTEGRA1:def 5
          .=vol(divset(D2,indx(D2,D1,j1)+2)) +(upper_bound divset(D2,indx(D2
        ,D1,j1)+1)- lower_bound divset(D2,indx(D2,D1,j1)+1)) by A140,A139;
        then
A143:   vol(divset(D1,j)) =vol(divset(D2,indx(D2,D1,j1)+1))+vol(divset(
        D2,indx(D2,D1,j1)+2)) by INTEGRA1:def 5;
        then
A144:   lower_volume(g,D1).j=(lower_bound(rng(g|divset(D1,j))))* (vol(
        divset(D2,indx(D2,D1,j1)+1))+vol(divset(D2,indx(D2,D1,j1)+2))) by A5,
INTEGRA1:def 7;
A145:   Sum mid(LVg(D2),indx(D2,D1,j1)+1,indx(D2,D1,j))-Sum mid(LVg(D1),
j,j) <=(upper_bound rng g - lower_bound rng g)* (vol(divset(D2,indx(D2,D1,j1)+2
        )) +vol(divset(D2,indx(D2,D1,j1)+1)))
        proof
          set ID1=indx(D2,D1,j1)+1, ID2=indx(D2,D1,j1)+2;
          set IR = (lower_bound rng g)*vol(divset(D2,ID2));
          divset(D1,j)c=A by A5,INTEGRA1:8;
          then
A146:     lower_bound rng(g|divset(D1,j)) >= lower_bound rng g by A72,Lm4;
          Sum mid(LVg(D1),j,j)=(lower_bound rng(g|divset(D1,j)))* vol(
divset(D2,indx(D2, D1,j1)+2)) +(lower_bound rng(g|divset(D1,j)))*vol(divset(D2
          ,indx(D2,D1,j1)+1)) by A108,A144,FINSOP_1:11;
          then Sum mid(LVg(D1),j,j)-(lower_bound rng(g|divset(D1,j)))*vol(
          divset(D2,ID1)) >=IR by A133,A146,XREAL_1:64;
          then Sum mid(LVg(D1),j,j)>=(lower_bound rng(g|divset(D1,j)))* vol(
          divset(D2,ID1)) +IR by XREAL_1:19;
          then
A147:     Sum mid(LVg(D1),j,j)-(lower_bound rng g)*vol(divset(D2,ID2))
>=(lower_bound rng(g|divset(D1,j)))*vol(divset(D2,ID1)) by XREAL_1:19;
          (lower_bound rng(g|divset(D1,j)))*vol(divset(D2,ID1)) >=(
          lower_bound rng g)*vol(divset(D2,ID1)) by A131,A146,XREAL_1:64;
          then Sum mid(LVg(D1),j,j)-(lower_bound rng g)*vol(divset(D2,ID2))
          >=(lower_bound rng g)*vol(divset(D2,ID1)) by A147,XXREAL_0:2;
          then
A148:     Sum mid(LVg(D1),j,j) >=IR+(lower_bound rng g)* vol(divset(D2,
          ID1)) by XREAL_1:19;
          indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A79,A111,A112,A109,A113,A127
,FINSEQ_6:118;
          then
A149:     indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1=2 by A79,XREAL_1:233;
          ID1 in dom D2 by A114,FINSEQ_1:def 3;
          then divset(D2,ID1) c= A by INTEGRA1:8;
          then lower_bound rng(g|divset(D2,ID1)) <= upper_bound rng g by A72
,Lm4;
          then
A150:     (lower_bound rng(g|divset(D2,ID1)))*vol(divset(D2,ID1)) <=(
          upper_bound rng g)*vol(divset(D2,ID1)) by A131,XREAL_1:64;
A151:     indx(D2,D1,j) in dom D2 by A3,A5,INTEGRA1:def 19;
          then divset(D2,ID2)c=A by A149,INTEGRA1:8;
          then
A152:     lower_bound rng(g|divset(D2,ID2)) <= upper_bound rng g by A72,Lm4;
          Sum mid(LVg(D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =(
lower_bound rng(g|divset(D2,indx(D2,D1,j1)+2))) *vol(divset(D2,indx(D2,D1,j1)+2
          )) +LVg(D2).(indx(D2,D1,j1)+1) by A130,A151,A149,INTEGRA1:def 7
            .=(lower_bound rng(g|divset(D2,indx(D2,D1,j1)+2))) *vol(divset(
D2,indx(D2,D1,j1)+2)) +(lower_bound rng(g|divset(D2,indx(D2,D1,j1)+1))) *vol(
          divset(D2,indx(D2,D1,j1)+1)) by A116,INTEGRA1:def 7;
          then Sum mid(LVg(D2),ID1,indx(D2,D1,j)) -(lower_bound rng(g|divset(
D2,ID1)))*vol(divset(D2,ID1)) <=(upper_bound rng g)*vol(divset(D2,ID2)) by A133
,A152,XREAL_1:64;
          then Sum mid(LVg(D2),ID1,indx(D2,D1,j)) <=(upper_bound rng g)*vol(
divset(D2,ID2)) +(lower_bound rng(g|divset(D2,ID1)))*vol(divset(D2,ID1)) by
XREAL_1:20;
          then Sum mid(LVg(D2),ID1,indx(D2,D1,j))-(upper_bound rng g)*vol(
divset(D2,ID2)) <=(lower_bound rng(g|divset(D2,ID1)))*vol(divset(D2,ID1)) by
XREAL_1:20;
          then Sum mid(LVg(D2),ID1,indx(D2,D1,j))-(upper_bound rng g)*vol(
divset(D2,ID2)) <=(upper_bound rng g)*vol(divset(D2,ID1)) by A150,XXREAL_0:2;
          then Sum mid(LVg(D2),ID1,indx(D2,D1,j))<= (upper_bound rng g)*vol(
divset(D2,ID2)) + (upper_bound rng g)*vol(divset(D2,ID1)) by XREAL_1:20;
          then Sum mid(LVg(D2),ID1,indx(D2,D1,j))-Sum mid(LVg(D1),j,j) <=(
upper_bound rng g)*vol(divset(D2,ID2))+(upper_bound rng g)* vol(divset(D2,ID1))
          -(IR+(lower_bound rng g)*vol(divset(D2,ID1))) by A148,XREAL_1:13;
          hence thesis;
        end;
        upper_bound rng g - lower_bound rng g >= 0 by A72,Lm3,XREAL_1:48;
        then (upper_bound rng g - lower_bound rng g)*(vol(divset(D1,j))) <=(
        upper_bound rng g - lower_bound rng g)*delta(D1) by A5,Lm5,XREAL_1:64;
        hence thesis by A143,A145,XXREAL_0:2;
      end;
    end;
    hence thesis;
  end;
  indx(D2,D1,j1) in dom D2 by A3,A12,INTEGRA1:def 19;
  then indx(D2,D1,j1) <= len D2 by FINSEQ_3:25;
  then
A153: indx(D2,D1,j1) <= len lower_volume(g,D2) by INTEGRA1:def 7;
  j1 <= len D1 by A12,FINSEQ_3:25;
  then
A154: j1 <= len lower_volume(g,D1) by INTEGRA1:def 7;
A155: D2.indx(D2,D1,j)=D1.(len D1) by A3,A5,INTEGRA1:def 19;
A156: indx(D2,D1,j) >= len lower_volume(g,D2)
  proof
    assume indx(D2,D1,j) < len lower_volume(g,D2);
    then indx(D2,D1,j) < len D2 by INTEGRA1:def 7;
    then
A157: D1.(len D1) < D2.(len D2) by A66,A6,A155,SEQM_3:def 1;
A158: not D2.(len D2) in rng D1
    proof
      assume D2.(len D2) in rng D1;
      D2.(len D2) <= upper_bound A by INTEGRA1:def 2;
      hence contradiction by A157,INTEGRA1:def 2;
    end;
    D2.(len D2) in rng D2 by A66,FUNCT_1:def 3;
    then D2.(len D2) in rng D1 or D2.(len D2) in {x} by A4,XBOOLE_0:def 3;
    then D2.(len D2) = x by A158,TARSKI:def 1;
    then D2.(len D2) <= upper_bound divset(D1,len D1) by A1,INTEGRA2:1;
    hence contradiction by A5,A7,A157,INTEGRA1:def 4;
  end;
  indx(D2,D1,j) in Seg len D2 by A6,FINSEQ_1:def 3;
  then indx(D2,D1,j) in Seg len lower_volume(g,D2) by INTEGRA1:def 7;
  then indx(D2,D1,j) in dom lower_volume(g,D2) by FINSEQ_1:def 3;
  then
A159: PLg(D2,indx(D2,D1,j))=Sum(lower_volume(g,D2)|indx(D2,D1,j)) by
INTEGRA1:def 20
    .=Sum lower_volume(g,D2) by A156,FINSEQ_1:58;
  j in Seg len lower_volume(g,D1) by A69,INTEGRA1:def 7;
  then j in dom lower_volume(g,D1) by FINSEQ_1:def 3;
  then
A160: PLg(D1,j)=Sum(lower_volume(g,D1)|j) by INTEGRA1:def 20
    .=Sum lower_volume(g,D1) by A67,FINSEQ_1:58;
  len D1 = len lower_volume(g,D1) by INTEGRA1:def 7;
  then
A161: j1 in dom lower_volume(g,D1) by A8,FINSEQ_3:29;
  len (D2|indx(D2,D1,j1))=len (D1|j1) by A15,A11,A18,Th6;
  then indx(D2,D1,j1) =j1 by A9,A17,FINSEQ_1:59;
  then len(lower_volume(g,D1)|j1)=indx(D2,D1,j1) by A154,FINSEQ_1:59;
  then len(lower_volume(g,D1)|j1)=len(lower_volume(g,D2)|indx(D2,D1,j1)) by
A153,FINSEQ_1:59;
  then
A162: lower_volume(g,D2)|indx(D2,D1,j1)=lower_volume(g,D1)|j1 by A38,
FINSEQ_1:14;
  len D2 = len lower_volume(g,D2) by INTEGRA1:def 7;
  then indx(D2,D1,j1) in dom lower_volume(g,D2) by A13,FINSEQ_3:29;
  then
A163: PLg(D2,indx(D2,D1,j1))=Sum(lower_volume(g,D2)|indx(D2,D1,j1)) by
INTEGRA1:def 20
    .=PLg(D1,j1) by A162,A161,INTEGRA1:def 20;
  indx(D2,D1,j) <= len D2 by A76,FINSEQ_1:1;
  then
A164: indx(D2,D1,j) <= len LVg(D2) by INTEGRA1:def 7;
A165: len D2 = len LVg(D2) by INTEGRA1:def 7;
  then
A166: indx(D2,D1,j) in dom LVg(D2) by A75,FINSEQ_3:29;
  indx(D2,D1,j1) in dom LVg(D2) by A13,A165,FINSEQ_3:29;
  then PLg(D2,indx(D2,D1,j1)) =Sum(LVg(D2)|indx(D2,D1,j1)) by INTEGRA1:def 20;
  then PLg(D2,indx(D2,D1,j1)) +Sum mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),
indx(D2,D1,j)) =Sum(LVg(D2)|indx(D2,D1,j1) ^mid(LVg(D2),(indx(D2,D1,j1)+1),indx
  (D2,D1,j))) by RVSUM_1:75
    .=Sum(mid(LVg(D2),1,indx(D2,D1,j1)) ^mid(LVg(D2),indx(D2,D1,j1)+1,indx(
  D2,D1,j))) by A14,FINSEQ_6:116
    .=Sum(mid(LVg(D2),1,indx(D2,D1,j))) by A14,A78,A164,INTEGRA2:4
    .=Sum(LVg(D2)|indx(D2,D1,j)) by A77,FINSEQ_6:116;
  then PLg(D2,indx(D2,D1,j1)) +Sum mid(lower_volume(g,D2),(indx(D2,D1,j1)+1),
  indx(D2,D1,j)) =PLg(D2,indx(D2,D1,j)) by A166,INTEGRA1:def 20;
  hence thesis by A163,A81,A74,A159,A160;
end;

theorem Th11:
  x in divset(D1,len D1) & len D1 >= 2 & D1<=D2 & rng D2 = rng D1
\/ {x} & g|A is bounded implies Sum upper_volume(g,D1) - Sum upper_volume(g,D2)
  <= (upper_bound rng g-lower_bound rng g)*delta(D1)
proof
  assume that
A1: x in divset(D1,len D1) and
A2: len D1 >= 2;
  set j = len D1;
  assume that
A3: D1<=D2 and
A4: rng D2 = rng D1 \/ {x};
A5: len D1 in Seg len D1 by FINSEQ_1:3;
  then
A6: len D1 in dom D1 by FINSEQ_1:def 3;
  then
A7: indx(D2,D1,j) in dom D2 by A3,INTEGRA1:def 19;
  deffunc UVg(Division of A) = upper_volume(g,$1);
  deffunc PUg(Division of A,Nat) = (PartSums(upper_volume(g,$1))).$2;
A8: j >= len upper_volume(g,D1) by INTEGRA1:def 6;
A9: len D1 <> 1 by A2;
  then
A10: len D1-1 in dom D1 by A6,INTEGRA1:7;
  reconsider j1=len D1-1 as Element of NAT by A6,A9,INTEGRA1:7;
A11: indx(D2,D1,j1) in dom D2 by A3,A10,INTEGRA1:def 19;
  then
A12: 1 <= indx(D2,D1,j1) by FINSEQ_3:25;
  then mid(D2,1,indx(D2,D1,j1)) is increasing by A11,INTEGRA1:35;
  then
A13: D2|indx(D2,D1,j1) is increasing by A12,FINSEQ_6:116;
  len D1 < len D1+1 by NAT_1:13;
  then j1 < len D1 by XREAL_1:19;
  then
A14: indx(D2,D1,j1) < indx(D2,D1,len D1) by A3,A6,A10,Th8;
  then
A15: indx(D2,D1,j1)+1 <= indx(D2,D1,len D1) by NAT_1:13;
  len D2 in Seg len D2 by FINSEQ_1:3;
  then
A16: len D2 in dom D2 by FINSEQ_1:def 3;
A17: D2.indx(D2,D1,j)=D1.(len D1) by A3,A6,INTEGRA1:def 19;
A18: indx(D2,D1,j) >= len upper_volume(g,D2)
  proof
    assume indx(D2,D1,j) < len upper_volume(g,D2);
    then indx(D2,D1,j) < len D2 by INTEGRA1:def 6;
    then
A19: D1.(len D1) < D2.(len D2) by A16,A7,A17,SEQM_3:def 1;
A20: not D2.(len D2) in rng D1
    proof
      assume D2.(len D2) in rng D1;
      D2.(len D2) <= upper_bound A by INTEGRA1:def 2;
      hence contradiction by A19,INTEGRA1:def 2;
    end;
    D2.(len D2) in rng D2 by A16,FUNCT_1:def 3;
    then D2.(len D2) in rng D1 or D2.(len D2) in {x} by A4,XBOOLE_0:def 3;
    then D2.(len D2) = x by A20,TARSKI:def 1;
    then D2.(len D2) <= upper_bound divset(D1,len D1) by A1,INTEGRA2:1;
    hence contradiction by A6,A9,A19,INTEGRA1:def 4;
  end;
  indx(D2,D1,j) in Seg len D2 by A7,FINSEQ_1:def 3;
  then indx(D2,D1,j) in Seg len upper_volume(g,D2) by INTEGRA1:def 6;
  then indx(D2,D1,j) in dom upper_volume(g,D2) by FINSEQ_1:def 3;
  then
A21: PUg(D2,indx(D2,D1,j))=Sum(upper_volume(g,D2)|indx(D2,D1,j)) by
INTEGRA1:def 20
    .=Sum upper_volume(g,D2) by A18,FINSEQ_1:58;
  indx(D2,D1,j) in dom D2 by A3,A6,INTEGRA1:def 19;
  then
A22: indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
  then
A23: 1 <= indx(D2,D1,j) by FINSEQ_1:1;
A24: indx(D2,D1,j1) <= len D2 by A11,FINSEQ_3:25;
  then
A25: len (D2|indx(D2,D1,j1))=indx(D2,D1,j1) by FINSEQ_1:59;
A26: j1 <= len D1 by A10,FINSEQ_3:25;
  assume
A27: g|A is bounded;
A28: Sum mid(upper_volume(g,D1),len D1,len D1) -Sum mid(upper_volume(g,D2),
(indx(D2,D1,j1)+1),indx(D2,D1,len D1)) <= (upper_bound rng g-lower_bound rng g)
  *delta(D1)
  proof
A29: indx(D2,D1,j)-indx(D2,D1,j1) <= 2
    proof
      reconsider ID1=indx(D2,D1,j1)+1 as Element of NAT;
      reconsider ID2=ID1+1 as Element of NAT;
      assume indx(D2,D1,j)-indx(D2,D1,j1) > 2;
      then
A30:  indx(D2,D1,j1)+(1+1)<indx(D2,D1,j) by XREAL_1:20;
A31:  ID1 < ID2 by NAT_1:13;
      then indx(D2,D1,j1) <= ID2 by NAT_1:13;
      then
A32:  1 <= ID2 by A12,XXREAL_0:2;
A33:  indx(D2,D1,j) in dom D2 by A3,A6,INTEGRA1:def 19;
      then
A34:  indx(D2,D1,j) <= len D2 by FINSEQ_3:25;
      then ID2 <= len D2 by A30,XXREAL_0:2;
      then
A35:  ID2 in dom D2 by A32,FINSEQ_3:25;
      then
A36:  D2.ID2<D2.indx(D2, D1,j) by A30,A33,SEQM_3:def 1;
A37:  1 <= ID1 by A12,NAT_1:13;
A38:  D1.j1 = D2.indx(D2,D1,j1) by A3,A10,INTEGRA1:def 19;
      ID1 <= indx(D2,D1,j) by A30,A31,XXREAL_0:2;
      then ID1 <= len D2 by A34,XXREAL_0:2;
      then
A39:  ID1 in dom D2 by A37,FINSEQ_3:25;
A40:  D1.j = D2.indx(D2,D1,j) by A3,A6,INTEGRA1:def 19;
      indx(D2,D1,j1) < ID1 by NAT_1:13;
      then
A41:  D2.indx(D2,D1,j1)<D2.ID1 by A11,A39,SEQM_3:def 1;
A42:  D2.ID1<D2.ID2 by A31,A39,A35,SEQM_3:def 1;
A43:  not D2.ID1 in rng D1 & not D2.ID2 in rng D1
      proof
        assume
A44:    D2.ID1 in rng D1 or D2.ID2 in rng D1;
        now
          per cases by A44;
          suppose
            D2.ID1 in rng D1;
            then consider n such that
A45:        n in dom D1 and
A46:        D1.n=D2.ID1 by PARTFUN1:3;
            j1<n by A10,A41,A38,A45,A46,SEQ_4:137;
            then
A47:        j<n+1 by XREAL_1:19;
            D2.ID1<D2.indx(D2,D1,j) by A42,A36,XXREAL_0:2;
            then n<j by A6,A40,A45,A46,SEQ_4:137;
            hence contradiction by A47,NAT_1:13;
          end;
          suppose
            D2.ID2 in rng D1;
            then consider n such that
A48:        n in dom D1 and
A49:        D1.n=D2.ID2 by PARTFUN1:3;
            D2.indx(D2,D1,j1)<D2.ID2 by A41,A42,XXREAL_0:2;
            then j1<n by A10,A38,A48,A49,SEQ_4:137;
            then
A50:        j<n+1 by XREAL_1:19;
            n<j by A6,A36,A40,A48,A49,SEQ_4:137;
            hence contradiction by A50,NAT_1:13;
          end;
        end;
        hence thesis;
      end;
      D2.ID1 in rng D2 by A39,FUNCT_1:def 3;
      then D2.ID1 in {x} by A4,A43,XBOOLE_0:def 3;
      then
A51:  D2.ID1 = x by TARSKI:def 1;
      D2.ID2 in rng D2 by A35,FUNCT_1:def 3;
      then D2.ID2 in {x} by A4,A43,XBOOLE_0:def 3;
      then D2.ID1=D2.ID2 by A51,TARSKI:def 1;
      hence contradiction by A31,A39,A35,SEQ_4:138;
    end;
A52: j <= len upper_volume(g,D1) by INTEGRA1:def 6;
A53: 1 <= j by A5,FINSEQ_1:1;
    then
A54: mid(upper_volume(g,D1),j,j).1 = upper_volume(g,D1).j by A52,FINSEQ_6:118;
    reconsider uv = upper_volume(g,D1).j as Element of REAL by XREAL_0:def 1;
    j-'j+1 = 1 by Lm1;
    then len mid(upper_volume(g,D1),j,j)=1 by A53,A52,FINSEQ_6:118;
    then mid(upper_volume(g,D1),j,j)=<*uv*> by A54,FINSEQ_1:40;
    then
A55: Sum mid(upper_volume(g,D1),j,j)=upper_volume(g,D1).j by FINSOP_1:11;
A56: 1 <= indx(D2,D1,j1)+1 by A12,NAT_1:13;
    indx(D2,D1,j) in dom D2 by A3,A6,INTEGRA1:def 19;
    then
A57: indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
    then
A58: 1 <= indx(D2,D1,j) by FINSEQ_1:1;
    indx(D2,D1,j) in Seg len upper_volume(g,D2) by A57,INTEGRA1:def 6;
    then
A59: indx(D2,D1,j) <= len upper_volume(g,D2) by FINSEQ_1:1;
    then
A60: indx(D2,D1,j1)+1 <= len upper_volume(g,D2 ) by A15,XXREAL_0:2;
    then indx(D2,D1,j1)+1 in Seg len upper_volume(g,D2) by A56,FINSEQ_1:1;
    then
A61: indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 6;
    then
A62: indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
    indx(D2,D1,j)-'(indx(D2,D1,j1)+1) =indx(D2,D1,j)-(indx(D2,D1,j1)+1)
    by A15,XREAL_1:233;
    then indx(D2,D1,j)-'(indx(D2,D1,j1) +1)+1 <= 2 by A29;
    then
A63: len mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))<=2 by A15,A58
,A59,A56,A60,FINSEQ_6:118;
    indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 >= 0+1 by XREAL_1:6;
    then
A64: 1 <= len mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) by A15
,A58,A59,A56,A60,FINSEQ_6:118;
    now
      per cases by A64,A63,Lm2;
      suppose
A65:    len mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))
        =1;
        upper_bound divset(D1,j)=D1.j by A6,A9,INTEGRA1:def 4;
        then
A66:    upper_bound divset(D1,j)=D2.indx(D2,D1,j) by A3,A6,INTEGRA1:def 19;
        lower_bound divset(D1,j)=D1.j1 by A6,A9,INTEGRA1:def 4;
        then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A3,A10,
INTEGRA1:def 19;
        then
A67:    divset(D1,j)=[. D2.indx(D2,D1,j1),D2.indx(D2,D1,j).] by A66,INTEGRA1:4;
A68:    delta(D1) >= 0 by Th9;
A69:    upper_bound rng g - lower_bound rng g >= 0 by A27,Lm3,XREAL_1:48;
A70:    indx(D2,D1,j) in dom D2 by A3,A6,INTEGRA1:def 19;
        len mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =
        indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 by A15,A58,A59,A56,A60,FINSEQ_6:118
;
        then
A71:    indx(D2,D1,j)-(indx(D2,D1,j1)+1)=0 by A15,A65,XREAL_1:233;
        then indx(D2,D1,j)<>1 by A11,FINSEQ_3:25;
        then
A72:    upper_bound divset(D2,indx(D2,D1,j))=D2.indx(D2,D1,j) by A70,
INTEGRA1:def 4;
        lower_bound divset(D2,indx(D2,D1,j))=D2.(indx(D2,D1,j)-1) by A12,A71
,A70,INTEGRA1:def 4;
        then
A73:    divset(D2,indx(D2,D1,j))=divset(D1,j) by A71,A67,A72,INTEGRA1:4;
        reconsider uv =upper_volume(g,D2).(indx(D2,D1,j1)+1)
           as Element of REAL
           by XREAL_0:def 1;
        mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)).1 =
        upper_volume(g,D2).(indx(D2,D1,j1)+1) by A58,A59,A56,A60,FINSEQ_6:118;
        then mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))
               = <*uv*> by A65,FINSEQ_1:40;
        then Sum mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j )) =
        upper_volume(g,D2).(indx(D2,D1,j1)+1) by FINSOP_1:11
          .=(upper_bound(rng(g|divset(D2,(indx(D2,D1,j1)+1))))) *vol(divset(
        D2,(indx(D2,D1,j1)+1))) by A62,INTEGRA1:def 6
          .=Sum mid(upper_volume(g,D1),j,j) by A6,A55,A71,A73,INTEGRA1:def 6;
        hence thesis by A68,A69;
      end;
      suppose
A74:    len mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))
        =2;
A75:    mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)).1 =
        upper_volume(g,D2).(indx(D2,D1,j1)+1) by A58,A59,A56,A60,FINSEQ_6:118;
A76:    2+(indx(D2,D1,j1)+1)>=0+1 by XREAL_1:7;
        mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)).2 =UVg(
        D2).(2+(indx(D2,D1,j1)+1)-'1) by A15,A58,A59,A56,A60,A74,FINSEQ_6:118
          .=UVg(D2).(2+(indx(D2,D1,j1)+1)-1) by A76,XREAL_1:233
          .=UVg(D2).(indx(D2,D1,j1)+(1+1));
        then mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =<*
upper_volume(g,D2).(indx(D2,D1,j1)+1), upper_volume(g,D2).(indx(D2,D1,j1)+2)*>
        by A74,A75,FINSEQ_1:44;
        then
A77:    Sum mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j )) =
upper_volume(g,D2).(indx(D2,D1,j1)+1) +upper_volume(g,D2).(indx(D2,D1,j1)+2)
by RVSUM_1:77;
A78:    vol(divset(D2,indx(D2,D1,j1)+1))>=0 by INTEGRA1:9;
        upper_bound divset(D1,j)=D1.j by A6,A9,INTEGRA1:def 4;
        then
A79:    upper_bound divset(D1,j) =D2. indx(D2,D1,j) by A3,A6,INTEGRA1:def 19;
A80:    vol(divset(D2,indx(D2,D1,j1)+2))>=0 by INTEGRA1:9;
        indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A15,A58,A59,A56,A60,A74,
FINSEQ_6:118;
        then
A81:    indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1=2 by A15,XREAL_1:233;
        then
A82:    indx(D2,D1,j1)+2 in dom D2 by A3,A6,INTEGRA1:def 19;
        lower_bound divset(D1,j)=D1.j1 by A6,A9,INTEGRA1:def 4;
        then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A3,A10,
INTEGRA1:def 19;
        then
A83:    vol(divset(D1,j)) =D2.(indx(D2,D1,j1)+2)-D2.(indx(D2,D1,j1)+1) +
        D2.(indx(D2,D1,j1)+1)-D2.indx(D2,D1,j1) by A79,A81,INTEGRA1:def 5;
        indx(D2,D1,j1)+1 in Seg len upper_volume(g,D2) by A56,A60,FINSEQ_1:1;
        then indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 6;
        then
A84:    indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
A85:    indx(D2,D1,j1)+1 <> 1 by A12,NAT_1:13;
        then
A86:    upper_bound divset(D2,(indx( D2,D1,j1)+1))=D2.(indx(D2,D1,j1)+1)
        by A84,INTEGRA1:def 4;
        indx(D2,D1,j1)+1-1=indx(D2,D1,j1)+0;
        then
A87:    lower_bound divset(D2,(indx(D2,D1,j1)+1))=D2.indx(D2,D1,j1) by A84,A85,
INTEGRA1:def 4;
A88:    indx(D2,D1,j1)+1+1 > 1 by A56,NAT_1:13;
        indx(D2,D1,j1)+2-1=indx(D2,D1,j1)+1;
        then
A89:    lower_bound divset(D2,(indx(D2,D1,j1)+2))=D2.(indx(D2,D1,j1)+1)
        by A82,A88,INTEGRA1:def 4;
        upper_bound divset(D2,(indx(D2,D1,j1)+2))=D2.(indx(D2,D1,j1)+2)
        by A82,A88,INTEGRA1:def 4;
        then vol(divset(D1,j)) =vol(divset(D2,indx(D2,D1,j1)+2)) +D2.(indx(D2
        ,D1,j1)+1)-D2.indx(D2,D1,j1) by A89,A83,INTEGRA1:def 5
          .=vol(divset(D2,indx(D2,D1,j1)+2)) +(upper_bound divset(D2,indx(D2
        ,D1,j1)+1)-lower_bound divset(D2,indx(D2,D1,j1)+1)) by A87,A86;
        then
A90:    vol(divset(D1,j)) =vol(divset(D2,indx(D2,D1,j1)+1))+vol(divset(
        D2,indx(D2,D1,j1)+2)) by INTEGRA1:def 5;
        then
A91:    upper_volume(g,D1).j=(upper_bound(rng(g|divset(D1,j))))* (vol(
        divset(D2,indx(D2,D1,j1)+1))+vol(divset(D2,indx(D2,D1,j1)+2))) by A6,
INTEGRA1:def 6;
A92:    Sum mid(UVg(D1),j,j)-Sum mid(UVg(D2),indx(D2,D1,j1)+1,indx(D2,D1
,j)) <=(upper_bound rng g - lower_bound rng g)*(vol(divset(D2, indx(D2,D1,j1)+2
        )) +vol(divset(D2,indx(D2,D1,j1)+1)))
        proof
          set ID1=indx(D2,D1,j1)+1, ID2=indx(D2,D1,j1)+2;
A93:      Sum mid(UVg(D1),j,j)-(upper_bound rng(g|divset(D1,j)))* vol(
divset(D2,ID1)) = (upper_bound rng(g|divset(D1,j)))*vol(divset(D2,ID2)) by A55
,A91;
          divset(D1,j)c=A by A6,INTEGRA1:8;
          then
A94:      upper_bound rng(g|divset(D1,j)) <= upper_bound rng g by A27,Lm4;
          then (upper_bound rng(g|divset(D1,j)))*vol(divset(D2,ID2)) <=(
          upper_bound rng g)*vol(divset(D2,ID2)) by A80,XREAL_1:64;
          then Sum mid(UVg(D1),j,j)<=(upper_bound rng(g|divset(D1,j)))* vol(
divset(D2,ID1)) +(upper_bound rng g)*vol(divset(D2,ID2)) by A93,XREAL_1:20;
          then
A95:      Sum mid(UVg(D1),j,j)-(upper_bound rng g)*vol(divset(D2,ID2))
<=(upper_bound rng(g|divset(D1,j)))*vol(divset(D2,ID1)) by XREAL_1:20;
          (upper_bound rng(g|divset(D1,j)))*vol(divset(D2,ID1)) <=(
          upper_bound rng g)*vol(divset(D2,ID1)) by A78,A94,XREAL_1:64;
          then Sum mid(UVg(D1),j,j)-(upper_bound rng g)*vol(divset(D2,ID2))
          <=(upper_bound rng g)*vol(divset(D2,ID1)) by A95,XXREAL_0:2;
          then
A96:      Sum mid(UVg(D1),j,j) <=(upper_bound rng g)*vol(divset(D2,ID2))
          +(upper_bound rng g)* vol(divset(D2,ID1)) by XREAL_1:20;
          ID1 in dom D2 by A61,FINSEQ_1:def 3;
          then divset(D2,ID1)c=A by INTEGRA1:8;
          then upper_bound rng(g|divset(D2,ID1)) >= lower_bound rng g by A27
,Lm4;
          then
A97:      (upper_bound rng(g|divset(D2,ID1)))*vol(divset(D2,ID1)) >=(
          lower_bound rng g)*vol(divset(D2,ID1)) by A78,XREAL_1:64;
          indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A15,A58,A59,A56,A60,A74,
FINSEQ_6:118;
          then
A98:      indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1=2 by A15,XREAL_1:233;
A99:      indx(D2,D1,j) in dom D2 by A3,A6,INTEGRA1:def 19;
          then divset(D2,ID2)c=A by A98,INTEGRA1:8;
          then
A100:     upper_bound rng(g|divset(D2,ID2)) >= lower_bound rng g by A27,Lm4;
          Sum mid(UVg(D2),(indx(D2,D1,j1)+1),indx(D2,D1,j)) =(
upper_bound rng(g|divset(D2,indx(D2,D1,j1)+2))) *vol(divset(D2,indx(D2,D1,j1)+2
          )) +UVg(D2).(indx(D2,D1,j1)+1) by A77,A99,A98,INTEGRA1:def 6
            .=(upper_bound rng(g|divset(D2,indx(D2,D1,j1)+2))) *vol(divset(
D2,indx(D2,D1,j1)+2)) +(upper_bound rng(g|divset(D2,indx(D2,D1,j1)+1))) *vol(
          divset(D2,indx(D2,D1,j1)+1)) by A62,INTEGRA1:def 6;
          then Sum mid(UVg(D2),ID1,indx(D2,D1,j)) -(upper_bound rng(g|divset(
D2,ID1)))*vol(divset(D2,ID1)) >=(lower_bound rng g)*vol(divset(D2,ID2)) by A80
,A100,XREAL_1:64;
          then Sum mid(UVg(D2),ID1,indx(D2,D1,j)) >=(lower_bound rng g)*vol(
divset(D2,ID2)) +(upper_bound rng(g|divset(D2,ID1)))*vol(divset(D2,ID1)) by
XREAL_1:19;
          then Sum mid(UVg(D2),ID1,indx(D2,D1,j))-(lower_bound rng g)*vol(
divset(D2,ID2)) >=(upper_bound rng(g|divset(D2,ID1)))*vol(divset(D2,ID1)) by
XREAL_1:19;
          then Sum mid(UVg(D2),ID1,indx(D2,D1,j))-(lower_bound rng g)*vol(
divset(D2,ID2)) >=(lower_bound rng g)*vol(divset(D2,ID1)) by A97,XXREAL_0:2;
          then Sum mid(UVg(D2),ID1,indx(D2,D1,j)) >= (lower_bound rng g)*vol(
divset(D2,ID2) ) + (lower_bound rng g)*vol(divset(D2,ID1)) by XREAL_1:19;
          then Sum mid(UVg(D1),j,j)-Sum mid(UVg(D2),ID1,indx(D2,D1,j)) <=(
upper_bound rng g)*vol(divset(D2,ID2))+(upper_bound rng g)* vol(divset(D2,ID1))
-((lower_bound rng g)*vol(divset(D2,ID2))+(lower_bound rng g)* vol(divset(D2,
          ID1))) by A96,XREAL_1:13;
          hence thesis;
        end;
        upper_bound rng g - lower_bound rng g >= 0 by A27,Lm3,XREAL_1:48;
        then (upper_bound rng g - lower_bound rng g)*(vol(divset(D1,j))) <=(
        upper_bound rng g - lower_bound rng g)*delta(D1) by A6,Lm5,XREAL_1:64;
        hence thesis by A90,A92,XXREAL_0:2;
      end;
    end;
    hence thesis;
  end;
  j in Seg len upper_volume(g,D1) by A5,INTEGRA1:def 6;
  then j in dom upper_volume(g,D1) by FINSEQ_1:def 3;
  then
A101: PUg(D1,j)=Sum(upper_volume(g,D1)|j) by INTEGRA1:def 20
    .=Sum upper_volume(g,D1) by A8,FINSEQ_1:58;
A102: j <= len UVg(D1) by INTEGRA1:def 6;
A103: 1 <= j1 by A10,FINSEQ_3:25;
  then mid(D1,1,j1) is increasing by A6,A9,INTEGRA1:7,35;
  then
A104: D1|j1 is increasing by A103,FINSEQ_6:116;
A105: rng (D2|indx(D2,D1,j1)) = rng (D1|j1) by A1,A2,A3,A4,Lm6;
  then
A106: D2|indx(D2,D1,j1)=D1|j1 by A13,A104,Th6;
A107: for k st 1 <= k & k <= j1 holds k=indx(D2,D1,k)
  proof
    let k;
    assume that
A108: 1 <= k and
A109: k <= j1;
    assume
A110: k<>indx(D2,D1,k);
    now
      per cases by A110,XXREAL_0:1;
      suppose
A111:   k > indx(D2,D1,k);
        k <= len D1 by A26,A109,XXREAL_0:2;
        then
A112:   k in dom D1 by A108,FINSEQ_3:25;
        then indx(D2,D1,k) in dom D2 by A3,INTEGRA1:def 19;
        then indx(D2,D1,k) in Seg len D2 by FINSEQ_1:def 3;
        then
A113:   1<=indx(D2,D1,k) by FINSEQ_1:1;
A114:   indx(D2,D1,k) < j1 by A109,A111,XXREAL_0:2;
        then
A115:   indx(D2,D1,k) in Seg j1 by A113,FINSEQ_1:1;
        indx(D2,D1,k)<=indx(D2,D1,j1) by A3,A10,A109,A112,Th7;
        then indx(D2,D1,k) in Seg indx(D2,D1,j1) by A113,FINSEQ_1:1;
        then
A116:   (D2|indx(D2,D1,j1)).indx(D2,D1,k)=D2.indx(D2,D1,k) by A11,RFINSEQ:6;
        indx(D2,D1,k) <= len D1 by A26,A114,XXREAL_0:2;
        then indx(D2,D1,k) in Seg len D1 by A113,FINSEQ_1:1;
        then indx(D2,D1,k) in dom D1 by FINSEQ_1:def 3;
        then
A117:   D1.k > D1.indx(D2,D1,k) by A111,A112,SEQM_3:def 1;
        D1.k=D2.indx(D2,D1,k) by A3,A112,INTEGRA1:def 19;
        hence contradiction by A10,A106,A116,A117,A115,RFINSEQ:6;
      end;
      suppose
A118:   k < indx(D2,D1,k);
        k <= len D1 by A26,A109,XXREAL_0:2;
        then
A119:   k in dom D1 by A108,FINSEQ_3:25;
        then indx(D2,D1,k) <= indx(D2,D1,j1) by A3,A10,A109,Th7;
        then
A120:   k <= indx(D2,D1,j1) by A118,XXREAL_0:2;
        then k <= len D2 by A24,XXREAL_0:2;
        then
A121:   k in dom D2 by A108,FINSEQ_3:25;
        k in Seg j1 by A108,A109,FINSEQ_1:1;
        then
A122:   D1.k = (D1|j1).k by A10,RFINSEQ:6;
        indx(D2,D1,k) in dom D2 by A3,A119,INTEGRA1:def 19;
        then
A123:   D2.k < D2.indx(D2,D1,k) by A118,A121,SEQM_3:def 1;
A124:   k in Seg indx(D2,D1,j1) by A108,A120,FINSEQ_1:1;
        D1.k=D2.indx(D2,D1,k) by A3,A119,INTEGRA1:def 19;
        hence contradiction by A11,A106,A122,A123,A124,RFINSEQ:6;
      end;
    end;
    hence contradiction;
  end;
A125: for k be Nat st 1 <= k & k <= len(upper_volume(g,D1)|j1) holds (
  upper_volume(g,D1)|j1).k = (upper_volume(g,D2)|indx(D2,D1,j1)).k
  proof
    indx(D2,D1,j1) in Seg len D2 by A11,FINSEQ_1:def 3;
    then indx(D2,D1,j1) in Seg len upper_volume(g,D2) by INTEGRA1:def 6;
    then
A126: indx(D2,D1,j1) in dom upper_volume(g,D2) by FINSEQ_1:def 3;
    let k be Nat;
    assume that
A127: 1 <= k and
A128: k <= len(upper_volume(g,D1)|j1);
    reconsider k as Element of NAT by ORDINAL1:def 12;
A129: len(upper_volume(g,D1)) = len D1 by INTEGRA1:def 6;
    then
A130: k <= j1 by A26,A128,FINSEQ_1:59;
    then
A131: k <= len D1 by A26,XXREAL_0:2;
    then k in Seg len D1 by A127,FINSEQ_1:1;
    then
A132: k in dom D1 by FINSEQ_1:def 3;
    then
A133: indx(D2,D1,k) in dom D2 by A3,INTEGRA1:def 19;
A134: k in Seg j1 by A127,A130,FINSEQ_1:1;
    then indx(D2,D1,k) in Seg j1 by A107,A127,A130;
    then
A135: indx(D2,D1,k) in Seg indx(D2,D1,j1) by A103,A107;
    then indx(D2,D1,k)<=indx(D2,D1,j1) by FINSEQ_1:1;
    then
A136: indx(D2,D1,k)<=len D2 by A24,XXREAL_0:2;
A137: D1.k=D2.indx(D2,D1,k) by A3,A132,INTEGRA1:def 19;
A138: lower_bound divset(D1,k)=lower_bound divset(D2,indx(D2,D1,k)) &
    upper_bound divset(D1,k)=upper_bound divset(D2,indx(D2,D1,k))
    proof
      per cases;
      suppose
A139:   k=1;
        then
A140:   upper_bound divset(D1,k)=D1.k by A132,INTEGRA1:def 4;
A141:   lower_bound divset(D1,k)=lower_bound A by A132,A139,INTEGRA1:def 4;
        indx(D2,D1,k)=1 by A103,A107,A139;
        hence thesis by A133,A137,A141,A140,INTEGRA1:def 4;
      end;
      suppose
A142:   k<>1;
        then reconsider k1=k-1 as Element of NAT by A132,INTEGRA1:7;
        k <= k+1 by NAT_1:11;
        then k1 <= k by XREAL_1:20;
        then
A143:   k1 <= j1 by A130,XXREAL_0:2;
A144:   k-1 in dom D1 by A132,A142,INTEGRA1:7;
        then 1 <= k1 by FINSEQ_3:25;
        then k1=indx(D2,D1,k1) by A107,A143;
        then
A145:   D2.(indx(D2,D1,k)-1)= D2.indx(D2,D1,k1) by A107,A127,A130;
A146:   indx(D2,D1,k)<>1 by A107,A127,A130,A142;
        then
A147:   lower_bound divset(D2,indx(D2,D1,k))=D2.(indx(D2,D1,k)-1) by A133,
INTEGRA1:def 4;
A148:   upper_bound divset(D2,indx(D2,D1,k))=D2.indx(D2,D1,k) by A133,A146,
INTEGRA1:def 4;
A149:   upper_bound divset(D1,k)=D1.k by A132,A142,INTEGRA1:def 4;
        lower_bound divset(D1,k)=D1.(k-1) by A132,A142,INTEGRA1:def 4;
        hence thesis by A3,A132,A149,A144,A147,A148,A145,INTEGRA1:def 19;
      end;
    end;
    divset(D1,k)=[. lower_bound divset(D1,k), upper_bound divset(D1,k) .]
    by INTEGRA1:4;
    then
A150: divset(D1,k)=divset(D2,indx(D2,D1,k)) by A138,INTEGRA1:4;
A151: k in dom D1 by A127,A131,FINSEQ_3:25;
    j1 in Seg len(upper_volume(g,D1)) by A10,A129,FINSEQ_1:def 3;
    then j1 in dom(upper_volume(g,D1)) by FINSEQ_1:def 3;
    then
A152: (upper_volume(g,D1)|j1).k = upper_volume(g,D1).k by A134,RFINSEQ:6
      .=(upper_bound(rng(g|divset(D2,indx(D2,D1,k)))))*vol(divset(D2, indx(
    D2,D1,k))) by A151,A150,INTEGRA1:def 6;
    1<=indx(D2,D1,k) by A107,A127,A130;
    then
A153: indx(D2,D1,k) in dom D2 by A136,FINSEQ_3:25;
    (upper_volume(g,D2)|indx(D2,D1,j1)).k =(upper_volume(g,D2)|indx(D2,
    D1,j1)).indx(D2,D1,k) by A107,A127,A130
      .=upper_volume(g,D2).indx(D2,D1,k) by A135,A126,RFINSEQ:6
      .=(upper_bound(rng(g|divset(D2,indx(D2,D1,k)))))*vol(divset(D2, indx(
    D2,D1,k))) by A153,INTEGRA1:def 6;
    hence thesis by A152;
  end;
  indx(D2,D1,j1) in dom D2 by A3,A10,INTEGRA1:def 19;
  then indx(D2,D1,j1) <= len D2 by FINSEQ_3:25;
  then
A154: indx(D2,D1,j1) <= len upper_volume(g,D2) by INTEGRA1:def 6;
  j1 in Seg len D1 by A10,FINSEQ_1:def 3;
  then j1 <= len D1 by FINSEQ_1:1;
  then
A155: j1 <= len upper_volume(g,D1) by INTEGRA1:def 6;
  len (D2|indx(D2,D1,j1))=len (D1|j1) by A13,A104,A105,Th6;
  then indx(D2,D1,j1) =j1 by A26,A25,FINSEQ_1:59;
  then len(upper_volume(g,D1)|j1)=indx(D2,D1,j1) by A155,FINSEQ_1:59;
  then len(upper_volume(g,D1)|j1)=len(upper_volume(g,D2)|indx(D2,D1,j1)) by
A154,FINSEQ_1:59;
  then
A156: upper_volume(g,D2)|indx(D2,D1,j1)=upper_volume(g,D1)|j1 by A125,
FINSEQ_1:14;
  j1 in Seg len D1 by A10,FINSEQ_1:def 3;
  then j1 in Seg len upper_volume(g,D1) by INTEGRA1:def 6;
  then
A157: j1 in dom upper_volume(g,D1) by FINSEQ_1:def 3;
  j < j+1 by NAT_1:13;
  then
A158: j1 < j by XREAL_1:19;
  indx(D2,D1,j) <= len D2 by A22,FINSEQ_1:1;
  then
A159: indx(D2,D1,j) <= len UVg(D2) by INTEGRA1:def 6;
  then
A160: indx(D2,D1,j) in dom UVg(D2) by A23,FINSEQ_3:25;
  indx(D2,D1,j1) in Seg len D2 by A11,FINSEQ_1:def 3;
  then indx(D2,D1,j1) in Seg len UVg(D2) by INTEGRA1:def 6;
  then indx(D2,D1,j1) in dom UVg(D2) by FINSEQ_1:def 3;
  then PUg(D2,indx(D2,D1,j1)) =Sum(UVg(D2)|indx(D2,D1,j1)) by INTEGRA1:def 20;
  then PUg(D2,indx(D2,D1,j1)) +Sum mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),
indx(D2,D1,j)) =Sum(UVg(D2)|indx(D2,D1,j1) ^mid(UVg(D2),(indx(D2,D1,j1)+1),indx
  (D2,D1,j))) by RVSUM_1:75
    .=Sum(mid(UVg(D2),1,indx(D2,D1,j1)) ^mid(UVg(D2),indx(D2,D1,j1)+1,indx(
  D2,D1,j))) by A12,FINSEQ_6:116
    .=Sum(mid(UVg(D2),1,indx(D2,D1,j))) by A12,A14,A159,INTEGRA2:4
    .=Sum(UVg(D2)|indx(D2,D1,j)) by A23,FINSEQ_6:116;
  then
A161: PUg(D2,indx(D2,D1,j1)) +Sum mid(upper_volume(g,D2),(indx(D2,D1,j1)+1),
  indx(D2,D1,j)) =PUg(D2,indx(D2,D1,j)) by A160,INTEGRA1:def 20;
A162: 1 <= j by A5,FINSEQ_1:1;
  then
A163: j in dom UVg(D1) by A102,FINSEQ_3:25;
  j1 in Seg len D1 by A10,FINSEQ_1:def 3;
  then j1 in Seg len UVg(D1) by INTEGRA1:def 6;
  then j1 in dom UVg(D1) by FINSEQ_1:def 3;
  then PUg(D1,j1)=Sum(UVg(D1)|j1) by INTEGRA1:def 20;
  then PUg(D1,j1)+Sum mid(UVg(D1),j,j) =Sum((UVg(D1)|j1)^mid(UVg(D1),j,j)) by
RVSUM_1:75
    .=Sum(mid(UVg(D1),1,j1)^mid(UVg(D1),j1+1,j)) by A103,FINSEQ_6:116
    .=Sum(mid(UVg(D1),1,j)) by A103,A102,A158,INTEGRA2:4
    .=Sum(UVg(D1)|j) by A162,FINSEQ_6:116;
  then
A164: PUg(D1,j1)+Sum mid(upper_volume(g,D1),j,j)=PUg(D1,j) by A163,
INTEGRA1:def 20;
  indx(D2,D1,j1) in Seg len D2 by A11,FINSEQ_1:def 3;
  then indx(D2,D1,j1) in Seg len upper_volume(g,D2) by INTEGRA1:def 6;
  then indx(D2,D1,j1) in dom upper_volume(g,D2) by FINSEQ_1:def 3;
  then PUg(D2,indx(D2,D1,j1))=Sum(upper_volume(g,D2)|indx(D2,D1,j1)) by
INTEGRA1:def 20
    .=PUg(D1,j1) by A156,A157,INTEGRA1:def 20;
  hence thesis by A28,A161,A164,A21,A101;
end;

Lm7: vol(A)<>0 & y in rng lower_sum_set(f) implies ex D being Division of A st
D in dom lower_sum_set(f) & y=(lower_sum_set(f)).D & D.1 > lower_bound A
proof
  assume
A1: vol(A)<>0;
  assume y in rng lower_sum_set(f);
  then consider D3 being Element of divs A such that
A2: D3 in dom lower_sum_set(f) and
A3: y=(lower_sum_set(f)).D3 by PARTFUN1:3;
  reconsider D3 as Division of A by INTEGRA1:def 3;
  rng D3 <> {};
  then
A4: 1 in dom D3 by FINSEQ_3:32;
A5: len D3 in Seg len D3 by FINSEQ_1:3;
  now
    per cases;
    suppose
A6:   D3.1 <> lower_bound A;
      D3.1 in A by A4,INTEGRA1:6;
      then lower_bound A <= D3.1 by INTEGRA2:1;
      then D3.1 > lower_bound A by A6,XXREAL_0:1;
      hence thesis by A2,A3;
    end;
    suppose
A7:   D3.1 = lower_bound A;
      ex D being Division of A st D in dom lower_sum_set(f) & y=(
      lower_sum_set(f)).D & D.1 > lower_bound A
      proof
A8:     lower_volume(f,D3).1=(lower_bound rng(f|divset(D3,1)))* vol(
        divset(D3,1)) by A4,INTEGRA1:def 7;
        vol(A) >= 0 by INTEGRA1:9;
        then
A9:     upper_bound A - lower_bound A > 0 by A1,INTEGRA1:def 5;
A10:    y=lower_sum(f,D3) by A3,INTEGRA1:def 11
          .=Sum(lower_volume(f,D3)) by INTEGRA1:def 9
          .=Sum((lower_volume(f,D3)|1)^(lower_volume(f,D3)/^1)) by RFINSEQ:8;
A11:    D3.(len D3) = upper_bound A by INTEGRA1:def 2;
        len D3 in dom D3 by A5,FINSEQ_1:def 3;
        then
A12:    len D3 > 1 by A4,A7,A11,A9,SEQ_4:137,XREAL_1:47;
        then reconsider D=D3/^1 as increasing FinSequence of REAL by
INTEGRA1:34;
A13:    len D = len D3 - 1 by A12,RFINSEQ:def 1;
        upper_bound A > lower_bound A by A9,XREAL_1:47;
        then len D <> 0 by A7,A13,INTEGRA1:def 2;
        then reconsider D as non empty increasing FinSequence of REAL;
A14:    len D in dom D by FINSEQ_5:6;
        len D+1=len D3 by A13;
        then
A15:    D.(len D)=upper_bound A by A11,A12,A14,RFINSEQ:def 1;
A16:    len D3 >= 1+1 by A12,NAT_1:13;
        then
A17:    2 <= len lower_volume(f,D3) by INTEGRA1:def 7;
        1+1 <= len D3 by A12,NAT_1:13;
        then 2 in dom D3 by FINSEQ_3:25;
        then
A18:    D3.1 < D3.2 by A4,SEQM_3:def 1;
A19:    rng D3 c= A by INTEGRA1:def 2;
        rng D c= rng D3 by FINSEQ_5:33;
        then rng D c= A by A19;
        then reconsider D as Division of A by A15,INTEGRA1:def 2;
A20:    1 in Seg 1 by FINSEQ_1:1;
A21:    1 <= len lower_volume(f,D3) by A12,INTEGRA1:def 7;
A22:    len (lower_volume(f,D3)|1)=1;
        1 <= len lower_volume(f,D3) by A12,INTEGRA1:def 7;
        then
A23:    len(mid(lower_volume(f,D3),2,len lower_volume(f,D3))) =len
        lower_volume(f,D3)-'2+1 by A17,FINSEQ_6:118
          .=len D3-'2+1 by INTEGRA1:def 7
          .=len D3-2+1 by A16,XREAL_1:233
          .=len D3-1;
A24:    for i be Nat st 1<=i&i<=len mid(lower_volume(f,D3),2,len
lower_volume(f,D3)) holds mid(lower_volume(f,D3),2,len lower_volume(f,D3)).i =
        lower_volume(f,D).i
        proof
          let i be Nat;
          assume that
A25:      1<=i and
A26:      i<=len mid(lower_volume(f,D3),2,len lower_volume(f,D3));
A27:      1 <= i+1 by NAT_1:12;
          i+1 <= len D3 by A23,A26,XREAL_1:19;
          then
A28:      i+1 in Seg len D3 by A27,FINSEQ_1:1;
          then
A29:      i+1 in dom D3 by FINSEQ_1:def 3;
A30:      divset(D3,i+1)=divset(D,i)
          proof
A31:        i+1 in dom D3 by A28,FINSEQ_1:def 3;
A32:        1<>i+1 by A25,NAT_1:13;
            then
A33:        upper_bound divset(D3,i+1)=D3.(i+1) by A31,INTEGRA1:def 4;
A34:        i in dom D by A13,A23,A25,A26,FINSEQ_3:25;
            then
A35:        D.i=D3.(i+1) by A12,RFINSEQ:def 1;
A36:        lower_bound divset( D3,i+1)=D3.(i+1- 1) by A32,A31,INTEGRA1:def 4;
            per cases;
            suppose
A37:          i=1;
              then
A38:          upper_bound divset(D,i )=D.i by A34,INTEGRA1:def 4;
A39:          lower_bound divset(D,i)=lower_bound A by A34,A37,INTEGRA1:def 4;
              divset(D3,i+1)=[.lower_bound A, D.i.] by A7,A33,A36,A35,A37,
INTEGRA1:4;
              hence thesis by A39,A38,INTEGRA1:4;
            end;
            suppose
A40:          i<>1;
              then i-1 in dom D by A34,INTEGRA1:7;
              then
A41:          D.(i-1)=D3.(i-1+1) by A12,RFINSEQ:def 1
                .=D3.i;
A42:          upper_bound divset(D,i)=D.i by A34,A40,INTEGRA1:def 4;
              lower_bound divset(D,i)=D.(i-1) by A34,A40,INTEGRA1:def 4;
              then divset(D3,i+1)=[.lower_bound divset(D,i), upper_bound
              divset(D,i).] by A33,A36,A35,A42,A41,INTEGRA1:4;
              hence thesis by INTEGRA1:4;
            end;
          end;
          i<=len lower_volume(f,D3) - 1 by A23,A26,INTEGRA1:def 7;
          then
A43:      i <= len lower_volume(f,D3)-2+1;
          mid(lower_volume(f,D3),2,len lower_volume(f,D3 )).i =
          lower_volume(f,D3).(i+2-1) by A17,A25,A43,FINSEQ_6:122
            .=lower_volume(f,D3).(i+1);
          then
A44:      mid(lower_volume(f,D3),2,len lower_volume(f,D3 )).i =(
lower_bound rng(f|divset(D3,i+1)))*vol(divset(D3,i+1)) by A29,INTEGRA1:def 7;
          i in Seg len D by A13,A23,A25,A26,FINSEQ_1:1;
          then i in dom D by FINSEQ_1:def 3;
          hence thesis by A44,A30,INTEGRA1:def 7;
        end;
        1 in dom lower_volume(f,D3) by A21,FINSEQ_3:25;
        then (lower_volume(f,D3)|1).1 = lower_volume(f,D3).1 by A20,RFINSEQ:6;
        then
A45:    lower_volume(f,D3)|1 = <*lower_volume(f,D3).1*> by A22,FINSEQ_1:40;
A46:    2-'1=2-1 by XREAL_1:233
          .= 1;
        rng D <> {};
        then 1 in dom D by FINSEQ_3:32;
        then
A47:    D.1=D3.(1+1) by A12,RFINSEQ:def 1
          .=D3.2;
        D in divs A by INTEGRA1:def 3;
        then
A48:    D in dom lower_sum_set(f) by FUNCT_2:def 1;
        len lower_volume(f,D3) >= 2 by A16,INTEGRA1:def 7;
        then
A49:    mid(lower_volume(f,D3),2,len lower_volume(f,D3)) =lower_volume(f,
        D3)/^1 by A46,FINSEQ_6:117;
        len(mid(lower_volume(f,D3),2,len lower_volume(f,D3))) =len
        lower_volume(f, D) by A13,A23,INTEGRA1:def 7;
        then
A50:    lower_volume(f,D3)/^1 = lower_volume(f,D) by A49,A24,FINSEQ_1:14;
        vol(divset(D3,1))=upper_bound divset(D3,1)-lower_bound divset(D3,
        1) by INTEGRA1:def 5
          .=upper_bound divset(D3,1) - lower_bound A by A4,INTEGRA1:def 4
          .=D3.1 - lower_bound A by A4,INTEGRA1:def 4
          .=0 by A7;
        then y=0+Sum(lower_volume(f,D)) by A10,A45,A8,A50,RVSUM_1:76
          .=lower_sum(f,D) by INTEGRA1:def 9;
        then y=(lower_sum_set(f)).D by INTEGRA1:def 11;
        hence thesis by A7,A48,A47,A18;
      end;
      hence thesis;
    end;
  end;
  hence thesis;
end;

theorem Th12:
  i in dom D & j in dom D & i<=j & r < mid(D,i,j).1 implies
  ex B be non empty closed_interval Subset of REAL st r = lower_bound B &
  upper_bound B=mid(D,i,j).(len mid(D,i,j)) &  mid(D,i,j) is Division of B
proof
  assume
A1: i in dom D;
  assume
A2: j in dom D;
  assume i <= j;
  then consider C being non empty closed_interval Subset of REAL such that
A3: lower_bound C=mid(D,i,j).1 and
A4: upper_bound C=mid(D,i,j).(len mid(D,i,j)) and
A5: mid(D,i,j) is Division of C by A1,A2,INTEGRA1:36;
  reconsider MD=mid(D,i,j) as non empty increasing FinSequence of REAL by A5;
  assume
A6: r < mid(D,i,j).1;
  reconsider rr=r, ub=upper_bound C as Real;
  ex a,b st a <= b & a = lower_bound C & b = upper_bound C by SEQ_4:11;
  then r <= upper_bound C by A6,A3,XXREAL_0:2;
  then reconsider B=[.rr,ub.]
   as non empty closed_interval Subset of REAL by MEASURE5:14;
A7: B=[.lower_bound B,upper_bound B.] by INTEGRA1:4;
  then
A8: lower_bound B = r by INTEGRA1:5;
A9: upper_bound B = upper_bound C by A7,INTEGRA1:5;
  for x being Element of REAL holds x in C implies x in B
  proof let x be Element of REAL;
    assume
A10: x in C;
    then lower_bound C <= x by INTEGRA2:1;
    then
A11: r <= x by A6,A3,XXREAL_0:2;
    x <= upper_bound C by A10,INTEGRA2:1;
    hence thesis by A8,A9,A11,INTEGRA2:1;
  end;
  then
A12: C c= B;
  rng mid(D,i,j) c= C by A5,INTEGRA1:def 2;
  then rng mid(D,i,j) c= B by A12;
  then MD is Division of B by A4,A9,INTEGRA1:def 2;
  hence thesis by A4,A8,A9;
end;

Lm8: vol(A)<>0 & len D1 = 1 implies <*lower_bound A*>^D1 is non empty
increasing FinSequence of REAL
proof
  assume
A1: vol(A)<>0;
  reconsider lb = lower_bound A as Element of REAL by XREAL_0:def 1;
  set MD1 = <*lb*>^D1;
A2: vol(A) >= 0 by INTEGRA1:9;
  assume len D1 = 1;
  then D1.1=upper_bound A by INTEGRA1:def 2;
  then
A3: D1.1 - lower_bound A > 0 by A1,A2,INTEGRA1:def 5;
  then
A4: lower_bound A < D1.1 by XREAL_1:47;
  for n,m being Nat holds
  n in dom MD1 & m in dom MD1 & n<m implies MD1.n < MD1.m
  proof let n,m be Nat;
    assume that
A5: n in dom MD1 and
A6: m in dom MD1 and
A7: n<m;
A8: not m in dom <*lower_bound A*>
    proof
      assume m in dom <*lower_bound A*>;
      then m in Seg len <*lower_bound A*> by FINSEQ_1:def 3;
      then m in {1} by FINSEQ_1:2,39;
      then
A9:   n < 1 by A7,TARSKI:def 1;
      n in Seg len MD1 by A5,FINSEQ_1:def 3;
      hence contradiction by A9,FINSEQ_1:1;
    end;
A10: not MD1.m in rng <*lower_bound A*>
    proof
      assume MD1.m in rng <*lower_bound A*>;
      then MD1.m in {lower_bound A} by FINSEQ_1:38;
      then
A11:  MD1.m = lower_bound A by TARSKI:def 1;
      rng D1 <> {};
      then
A12:  1 in dom D1 by FINSEQ_3:32;
      consider n being Nat such that
A13:  n in dom D1 and
A14:  m=len <*lower_bound A*>+n by A6,A8,FINSEQ_1:25;
      n in Seg len D1 by A13,FINSEQ_1:def 3;
      then
A15:  1 <= n by FINSEQ_1:1;
      D1.n=MD1.m by A13,A14,FINSEQ_1:def 7;
      hence contradiction by A3,A11,A13,A15,A12,SEQ_4:137,XREAL_1:47;
    end;
    MD1.m in rng MD1 by A6,FUNCT_1:def 3;
    then MD1.m in rng <*lower_bound A*> \/ rng D1 by FINSEQ_1:31;
    then
A16: MD1.m in rng D1 by A10,XBOOLE_0:def 3;
    now
      per cases by A5,FINSEQ_1:25;
      suppose
A17:    n in dom <*lower_bound A*>;
        then n in Seg len <*lower_bound A*> by FINSEQ_1:def 3;
        then n in {1} by FINSEQ_1:2,39;
        then
A18:    n = 1 by TARSKI:def 1;
A19:    MD1.n = <*lower_bound A*>.n by A17,FINSEQ_1:def 7
          .= lower_bound A by A18;
        rng D1 <> {};
        then
A20:    1 in dom D1 by FINSEQ_3:32;
        consider k such that
A21:    k in dom D1 and
A22:    MD1.m = D1.k by A16,PARTFUN1:3;
        1 <= k by A21,FINSEQ_3:25;
        then D1.1 <= MD1.m by A21,A22,A20,SEQ_4:137;
        hence thesis by A4,A19,XXREAL_0:2;
      end;
      suppose
        ex i be Nat st i in dom D1 & n = len <*lower_bound A*> + i;
        then consider i such that
A23:    i in dom D1 and
A24:    n=len <*lower_bound A*> + i;
A25:    D1.i=MD1.n by A23,A24,FINSEQ_1:def 7;
        consider j be Nat such that
A26:    j in dom D1 and
A27:    m=len <*lower_bound A*> + j by A6,A8,FINSEQ_1:25;
A28:    D1.j=MD1.m by A26,A27,FINSEQ_1:def 7;
        i < j by A7,A24,A27,XREAL_1:6;
        hence thesis by A23,A26,A25,A28,SEQM_3:def 1;
      end;
    end;
    hence thesis;
  end;
  hence thesis by SEQM_3:def 1;
end;

Lm9: lower_bound A < D2.1 implies <*lower_bound A*>^D2 is non empty increasing
FinSequence of REAL
proof
  reconsider lb = lower_bound A as Element of REAL by XREAL_0:def 1;
  set MD2=<*lb*>^D2;
  assume
A1: lower_bound A < D2.1;
  for n,m being Nat holds
  n in dom MD2 & m in dom MD2 & n<m implies MD2.n < MD2.m
  proof let n,m be Nat;
    assume that
A2: n in dom MD2 and
A3: m in dom MD2 and
A4: n<m;
A5: not m in dom <*lower_bound A*>
    proof
      assume m in dom <*lower_bound A*>;
      then m in Seg len <*lower_bound A*> by FINSEQ_1:def 3;
      then m in {1} by FINSEQ_1:2,39;
      then
A6:   n < 1 by A4,TARSKI:def 1;
      n in Seg len MD2 by A2,FINSEQ_1:def 3;
      hence contradiction by A6,FINSEQ_1:1;
    end;
A7: not MD2.m in rng <*lower_bound A*>
    proof
      assume MD2.m in rng <*lower_bound A*>;
      then MD2.m in {lower_bound A} by FINSEQ_1:38;
      then
A8:   MD2.m = lower_bound A by TARSKI:def 1;
      rng D2 <> {};
      then
A9:   1 in dom D2 by FINSEQ_3:32;
      consider n be Nat such that
A10:  n in dom D2 and
A11:  m=len <*lower_bound A*>+n by A3,A5,FINSEQ_1:25;
      n in Seg len D2 by A10,FINSEQ_1:def 3;
      then
A12:  1 <= n by FINSEQ_1:1;
      D2.n=MD2.m by A10,A11,FINSEQ_1:def 7;
      hence contradiction by A1,A8,A10,A12,A9,SEQ_4:137;
    end;
    MD2.m in rng MD2 by A3,FUNCT_1:def 3;
    then MD2.m in rng <*lower_bound A*> \/ rng D2 by FINSEQ_1:31;
    then
A13: MD2.m in rng <*lower_bound A*> or MD2.m in rng D2 by XBOOLE_0:def 3;
    now
      per cases by A2,FINSEQ_1:25;
      suppose
A14:    n in dom <*lower_bound A*>;
        then n in Seg len <*lower_bound A*> by FINSEQ_1:def 3;
        then n in {1} by FINSEQ_1:2,39;
        then
A15:    n = 1 by TARSKI:def 1;
A16:    MD2.n = <*lower_bound A*>.n by A14,FINSEQ_1:def 7
          .= lower_bound A by A15;
        rng D2 <> {};
        then
A17:    1 in dom D2 by FINSEQ_3:32;
        consider k such that
A18:    k in dom D2 and
A19:    MD2.m = D2.k by A13,A7,PARTFUN1:3;
        k in Seg len D2 by A18,FINSEQ_1:def 3;
        then 1 <= k by FINSEQ_1:1;
        then D2.1 <= MD2.m by A18,A19,A17,SEQ_4:137;
        hence thesis by A1,A16,XXREAL_0:2;
      end;
      suppose
        ex i be Nat st i in dom D2 & n = len <*lower_bound A*> + i;
        then consider i such that
A20:    i in dom D2 and
A21:    n=len <*lower_bound A*> + i;
A22:    D2.i=MD2.n by A20,A21,FINSEQ_1:def 7;
        consider j be Nat such that
A23:    j in dom D2 and
A24:    m=len <*lower_bound A*> + j by A3,A5,FINSEQ_1:25;
A25:    D2.j=MD2.m by A23,A24,FINSEQ_1:def 7;
        i < j by A4,A21,A24,XREAL_1:6;
        hence thesis by A20,A23,A22,A25,SEQM_3:def 1;
      end;
    end;
    hence thesis;
  end;
  hence thesis by SEQM_3:def 1;
end;

theorem Lm10:
for MD1 be Division of A holds MD1 = <*lower_bound A*>^D1 implies (for i
st i in Seg len D1 holds divset(MD1,i+1)=divset(D1,i)) & upper_volume(f,D1)=
upper_volume(f,MD1)/^1 & lower_volume(f,D1)=lower_volume(f,MD1)/^1
proof
  let MD1 be Division of A;
  assume
A1: MD1 = <*lower_bound A*>^D1;
  thus
A2: for i st i in Seg len D1 holds divset(MD1,i+1)=divset(D1,i)
  proof
    let i;
    assume
A3: i in Seg len D1;
    then
A4: i in dom D1 by FINSEQ_1:def 3;
    i <= len D1 by A3,FINSEQ_1:1;
    then i+1 <= len D1+1 by XREAL_1:6;
    then i+1 <= len D1 + len<*lower_bound A*> by FINSEQ_1:39;
    then
A5: i+1 <= len MD1 by A1,FINSEQ_1:22;
    1 <= i+1 by NAT_1:11;
    then
A6: i+1 in dom MD1 by A5,FINSEQ_3:25;
A7: 1 <= i by A3,FINSEQ_1:1;
A8: lower_bound divset(D1,i)=lower_bound divset(MD1,i+1) & upper_bound
    divset(D1,i)=upper_bound divset(MD1,i+1)
    proof
      per cases;
      suppose
A9:     i=1;
A10:    i+1 > 1 by A7,NAT_1:13;
        then lower_bound divset(MD1,i+1)=MD1.(i+1-1) by A6,INTEGRA1:def 4;
        then
A11:    lower_bound divset(MD1,i+1) = lower_bound A by A1,A9,FINSEQ_1:41;
A12:    MD1.(i+1) = MD1.(i+len <*lower_bound A*>) by FINSEQ_1:40
          .= D1.i by A1,A4,FINSEQ_1:def 7;
        upper_bound divset(MD1,i+1)=MD1. (i+1) by A6,A10,INTEGRA1:def 4;
        hence thesis by A4,A9,A11,A12,INTEGRA1:def 4;
      end;
      suppose
A13:    i<>1;
A14:    i+1 > 1 by A7,NAT_1:13;
        MD1.(i+1) = MD1.(i+len <*lower_bound A*>) by FINSEQ_1:40
          .= D1.i by A1,A4,FINSEQ_1:def 7;
        then
A15:    upper_bound divset(MD1,i+1)=D1.i by A6,A14,INTEGRA1:def 4
          .= upper_bound divset(D1,i) by A4,A13,INTEGRA1:def 4;
        i-1 in dom D1 by A4,A13,INTEGRA1:7;
        then D1.(i-1) = MD1.(i-1+len <*lower_bound A*>) by A1,FINSEQ_1:def 7
          .=MD1.(i-1+1) by FINSEQ_1:39
          .=MD1.(i+1-1);
        then lower_bound divset(D1,i)=MD1.(i+1-1) by A4,A13,INTEGRA1:def 4
          .=lower_bound divset(MD1,i+1) by A6,A14,INTEGRA1:def 4;
        hence thesis by A15;
      end;
    end;
    divset(D1,i)=[.lower_bound divset(D1,i), upper_bound divset(D1,i).]
    by INTEGRA1:4;
    hence thesis by A8,INTEGRA1:4;
  end;
A16: len MD1=len <*lower_bound A*> + len D1 by A1,FINSEQ_1:22
    .= 1+len D1 by FINSEQ_1:39;
  thus upper_volume(f,D1)=upper_volume(f,MD1)/^1
  proof
    set D2 = D1, MD2 = MD1;
    rng upper_volume(f,MD2) <> {};
    then 1 in dom upper_volume(f,MD2) by FINSEQ_3:32;
    then 1 <= len upper_volume(f,MD2) by FINSEQ_3:25;
    then len (upper_volume(f,MD2)/^1)=len upper_volume(f,MD2)-1 by
RFINSEQ:def 1
      .=len MD2 -1 by INTEGRA1:def 6
      .=len D2 by A16;
    then
A17: len upper_volume(f,D2)=len (upper_volume(f,MD2)/^1) by INTEGRA1:def 6;
    for k be Nat holds 1 <= k & k <= len upper_volume(f,D2) implies
    upper_volume(f,D2).k = (upper_volume(f,MD2)/^1).k
    proof
      let k be Nat;
      assume that
A18:  1 <= k and
A19:  k <= len upper_volume(f,D2);
      k+1 <= len upper_volume(f,D2)+1 by A19,XREAL_1:6;
      then
A20:  k+1 <= len D2+1 by INTEGRA1:def 6;
      k in Seg len upper_volume(f,D2) by A18,A19,FINSEQ_1:1;
      then
A21:  k in Seg len D2 by INTEGRA1:def 6;
      then k in dom D2 by FINSEQ_1:def 3;
      then
A22:  upper_volume(f,D2).k=(upper_bound rng(f|divset(D2,k)))*vol(divset(
      D2,k )) by INTEGRA1:def 6
        .=(upper_bound rng(f|divset(MD2,k+1)))*vol(divset(D2,k)) by A2,A21
        .=(upper_bound rng(f|divset(MD2,k+1)))*vol(divset(MD2,k+1)) by A2,A21;
A23:  len (upper_volume(f,MD2)/^1) <= len upper_volume(f,MD2) by FINSEQ_5:25;
      1 <= k+1 by NAT_1:11;
      then k+1 in Seg len MD2 by A16,A20,FINSEQ_1:1;
      then
A24:  k+1 in dom MD2 by FINSEQ_1:def 3;
      1 <= len upper_volume(f,D2) by A18,A19,XXREAL_0:2;
      then
A25:  1 <= len upper_volume(f,MD2) by A17,A23,XXREAL_0:2;
      k in dom (upper_volume(f,MD2)/^1) by A17,A18,A19,FINSEQ_3:25;
      then (upper_volume(f,MD2)/^1).k=upper_volume(f,MD2).(k+1) by A25,
RFINSEQ:def 1
        .=(upper_bound rng(f|divset(MD2,k+1)))*vol(divset(MD2,k+1)) by A24,
INTEGRA1:def 6;
      hence thesis by A22;
    end;
    hence thesis by A17,FINSEQ_1:14;
  end;
  rng lower_volume(f,MD1) <> {};
  then 1 in dom lower_volume(f,MD1) by FINSEQ_3:32;
  then 1 <= len lower_volume(f,MD1) by FINSEQ_3:25;
  then len (lower_volume(f,MD1)/^1)=len lower_volume(f,MD1)-1 by RFINSEQ:def 1
    .=len MD1 -1 by INTEGRA1:def 7
    .=len D1 by A16;
  then
A26: len lower_volume(f,D1)=len (lower_volume(f,MD1)/^1) by INTEGRA1:def 7;
  for k be Nat holds 1 <= k & k <= len lower_volume(f,D1) implies
  lower_volume(f,D1).k = (lower_volume(f,MD1)/^1).k
  proof
    let k be Nat;
    assume that
A27: 1 <= k and
A28: k <= len lower_volume(f,D1);
A29: 1 <= k+1 by NAT_1:11;
    k in Seg len lower_volume(f,D1) by A27,A28,FINSEQ_1:1;
    then
A30: k in Seg len D1 by INTEGRA1:def 7;
    then k in dom D1 by FINSEQ_1:def 3;
    then
A31: lower_volume(f,D1).k=(lower_bound rng(f|divset(D1,k)))*vol(divset(D1,
    k)) by INTEGRA1:def 7
      .=(lower_bound rng(f|divset(MD1,k+1)))*vol(divset(D1,k)) by A2,A30
      .=(lower_bound rng(f|divset(MD1,k+1)))*vol(divset(MD1,k+1)) by A2,A30;
A32: len (lower_volume(f,MD1)/^1) <= len lower_volume(f,MD1) by FINSEQ_5:25;
    k+1 <= len lower_volume(f,D1)+1 by A28,XREAL_1:6;
    then
A33: k+1 <= len D1+1 by INTEGRA1:def 7;
    len MD1=len <*lower_bound A*>+len D1 by A1,FINSEQ_1:22
      .=len D1 + 1 by FINSEQ_1:39;
    then k+1 in Seg len MD1 by A29,A33,FINSEQ_1:1;
    then
A34: k+1 in dom MD1 by FINSEQ_1:def 3;
    1 <= len (lower_volume(f,MD1)/^1) by A26,A27,A28,XXREAL_0:2;
    then
A35: 1 <= len lower_volume(f,MD1) by A32,XXREAL_0:2;
    k in dom (lower_volume(f,MD1)/^1) by A26,A27,A28,FINSEQ_3:25;
    then (lower_volume(f,MD1)/^1).k=lower_volume(f,MD1).(k+1) by A35,
RFINSEQ:def 1
      .=(lower_bound rng(f|divset(MD1,k+1)))*vol(divset(MD1,k+1)) by A34,
INTEGRA1:def 7;
    hence thesis by A31;
  end;
  hence thesis by A26,FINSEQ_1:14;
end;

Lm11: for MD2 being Division of A st MD2 = <*lower_bound A*>^D2 holds vol(
divset(MD2,1))=0
proof
  let MD2 be Division of A;
  assume
A1: MD2 = <*lower_bound A*>^D2;
  rng MD2 <> {};
  then
A2: 1 in dom MD2 by FINSEQ_3:32;
  then
A3: upper_bound divset(MD2,1) = MD2.1 by INTEGRA1:def 4;
  lower_bound divset(MD2,1) = lower_bound A by A2,INTEGRA1:def 4;
  then vol(divset(MD2,1)) = MD2.1 - lower_bound A by A3,INTEGRA1:def 5
    .=lower_bound A-lower_bound A by A1,FINSEQ_1:41;
  hence thesis;
end;

Lm12: for MD1 be Division of A holds MD1 = <*lower_bound A*>^D1 implies delta(
MD1)=delta(D1)
proof
  let MD1 be Division of A;
  assume
A1: MD1 = <*lower_bound A*>^D1;
  then
A2: vol(divset(MD1,1))=0 by Lm11;
  delta(D1) in rng upper_volume(chi(A,A),D1) by XXREAL_2:def 8;
  then consider i such that
A3: i in dom upper_volume(chi(A,A),D1) and
A4: upper_volume(chi(A,A),D1).i=delta(D1) by PARTFUN1:3;
  delta(MD1) in rng upper_volume(chi(A,A),MD1) by XXREAL_2:def 8;
  then consider j such that
A5: j in dom upper_volume(chi(A,A),MD1) and
A6: upper_volume(chi(A,A),MD1).j=delta(MD1 ) by PARTFUN1:3;
  j in Seg len upper_volume(chi(A,A),MD1) by A5,FINSEQ_1:def 3;
  then
A7: j in Seg len MD1 by INTEGRA1:def 6;
  then
A8: j in dom MD1 by FINSEQ_1:def 3;
  then
A9: delta(MD1)=(upper_bound rng(chi(A,A)|divset(MD1,j)))*vol(divset(MD1,j))
  by A6,INTEGRA1:def 6;
A10: delta(MD1) <= delta(D1)
  proof
    per cases;
    suppose
      j=1;
      hence thesis by A2,A9,Th9;
    end;
    suppose
      j<>1;
      then not j in Seg 1 by FINSEQ_1:2,TARSKI:def 1;
      then not j in Seg len <*lower_bound A*> by FINSEQ_1:39;
      then
A11:  not j in dom <*lower_bound A*> by FINSEQ_1:def 3;
      j in dom MD1 by A7,FINSEQ_1:def 3;
      then consider k be Nat such that
A12:  k in dom D1 and
A13:  j=len <*lower_bound A*>+k by A1,A11,FINSEQ_1:25;
A14:  k in Seg len D1 by A12,FINSEQ_1:def 3;
      then divset(D1,k)=divset(MD1,k+1) by A1,Lm10
        .=divset(MD1,j) by A13,FINSEQ_1:39;
      then delta(MD1) = (upper_bound rng(chi(A,A)|divset(D1,k)))* vol(divset(
      D1,k)) by A6,A8,INTEGRA1:def 6;
      then
A15:  delta(MD1)=upper_volume(chi(A,A),D1).k by A12,INTEGRA1:def 6;
      k in Seg len upper_volume(chi(A,A),D1) by A14,INTEGRA1:def 6;
      then k in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
      then delta(MD1) in rng upper_volume(chi(A,A),D1) by A15,FUNCT_1:def 3;
      hence thesis by XXREAL_2:def 8;
    end;
  end;
  i in Seg len upper_volume(chi(A,A),D1) by A3,FINSEQ_1:def 3;
  then
A16: i in Seg len D1 by INTEGRA1:def 6;
  then i in dom D1 by FINSEQ_1:def 3;
  then len <*lower_bound A*>+i in dom MD1 by A1,FINSEQ_1:28;
  then
A17: i+1 in dom MD1 by FINSEQ_1:39;
  then i+1 in Seg len MD1 by FINSEQ_1:def 3;
  then i+1 in Seg len upper_volume(chi(A,A),MD1) by INTEGRA1:def 6;
  then
A18: i+1 in dom upper_volume(chi(A,A),MD1) by FINSEQ_1:def 3;
  i in dom D1 by A16,FINSEQ_1:def 3;
  then delta(D1)=(upper_bound rng (chi(A,A)|divset(D1,i)))*vol(divset(D1,i))
  by A4,INTEGRA1:def 6
    .=(upper_bound rng(chi(A,A)|divset(MD1,i+1)))*vol(divset(D1,i)) by A1,A16
,Lm10
    .=(upper_bound rng (chi(A,A)|divset(MD1,i+1)))*vol(divset(MD1,i+1)) by A1
,A16,Lm10;
  then delta(D1)=upper_volume(chi(A,A),MD1).(i+1) by A17,INTEGRA1:def 6;
  then delta(D1) in rng upper_volume(chi(A,A),MD1) by A18,FUNCT_1:def 3;
  then delta(D1) <= delta(MD1) by XXREAL_2:def 8;
  hence thesis by A10,XXREAL_0:1;
end;

theorem Th13:
  x in divset(D1,len D1) & vol(A)<>0 & D1<=D2 & rng D2 = rng D1 \/
  {x} & f|A is bounded & x > lower_bound A implies Sum lower_volume(f,D2)-Sum
  lower_volume(f,D1)<=(upper_bound rng f-lower_bound rng f)*delta(D1)
proof
  assume that
A1: x in divset(D1,len D1) and
A2: vol(A)<>0 and
A3: D1 <= D2 and
A4: rng D2 = rng D1 \/ {x} and
A5: f|A is bounded and
A6: x > lower_bound A;
  len D1 in Seg len D1 by FINSEQ_1:3;
  then
A7: 1 <= len D1 by FINSEQ_1:1;
  then len D1 = 1 or len D1 > 1 by XXREAL_0:1;
  then
A8: len D1 = 1 or len D1 >= 1+1 by NAT_1:13;
  now
    per cases by A8;
    suppose
A9:   len D1 = 1;
      then reconsider MD1 = <*lower_bound A*>^D1 as non empty increasing
      FinSequence of REAL by A2,Lm8;
A10:  len MD1 = len <*lower_bound A*> + len D1 by FINSEQ_1:22;
      len <*lower_bound A*> + 1 <= len <*lower_bound A*> + len D1 by A7,
XREAL_1:6;
      then
      MD1.(len MD1)=D1.(len <*lower_bound A*>+ len D1-len <*lower_bound A
      *>) by A10,FINSEQ_1:23
        .=D1.(len D1);
      then
A11:  MD1.(len MD1) = upper_bound A by INTEGRA1:def 2;
      for y being Element of REAL holds y in rng MD1 implies y in A
      proof let y be Element of REAL;
        assume y in rng MD1;
        then
A12:    y in rng <*lower_bound A*> \/ rng D1 by FINSEQ_1:31;
        per cases by A12,XBOOLE_0:def 3;
        suppose
          y in rng <*lower_bound A*>;
          then y in {lower_bound A} by FINSEQ_1:38;
          then
A13:      y = lower_bound A by TARSKI:def 1;
          ex a,b st a <= b & a = lower_bound A & b = upper_bound A by SEQ_4:11;
          hence thesis by A13,INTEGRA2:1;
        end;
        suppose
A14:      y in rng D1;
          rng D1 c= A by INTEGRA1:def 2;
          hence thesis by A14;
        end;
      end;
      then rng MD1 c= A;
      then reconsider MD1 as Division of A by A11,INTEGRA1:def 2;
A15:  len MD1=len <*lower_bound A*> + len D1 by FINSEQ_1:22
        .= 1+len D1 by FINSEQ_1:39;
A16:  vol(A) >= 0 by INTEGRA1:9;
      D1.1=upper_bound A by A9,INTEGRA1:def 2;
      then D1.1 - lower_bound A > 0 by A2,A16,INTEGRA1:def 5;
      then
A17:  lower_bound A < D1.1 by XREAL_1:47;
      lower_volume(f,D1)=lower_volume(f,MD1)/^1 by Lm10;
      then
      lower_volume(f,MD1)=<*(lower_volume(f,MD1))/.1*>^lower_volume(f,D1)
      by FINSEQ_5:29;
      then
A18:  Sum lower_volume(f,MD1)=((lower_volume(f,MD1))/.1)+Sum lower_volume
      (f, D1) by RVSUM_1:76;
A19:  len D1 in dom D1 by FINSEQ_5:6;
A20:  1+len D1 >= 1+1 by A7,XREAL_1:6;
      then
A21:  len MD1 <> 1 by A15;
A22:  len MD1 in dom MD1 by FINSEQ_5:6;
      len MD1 - 1 =len D1 by A15;
      then lower_bound divset(MD1,len MD1) = MD1.(len D1) by A22,A21,
INTEGRA1:def 4
        .=lower_bound A by A9,FINSEQ_1:41;
      then
A23:  lower_bound divset(D1,len D1) = lower_bound divset(MD1,len MD1) by A9,A19
,INTEGRA1:def 4;
      set MD2=<*lower_bound A*>^D2;
      rng MD1 <> {};
      then
A24:  1 in dom MD1 by FINSEQ_3:32;
      then
A25:  lower_volume(f,MD1).1 = (lower_bound rng(f|divset(MD1,1)))* vol(
      divset( MD1,1)) by INTEGRA1:def 7;
      1 in Seg len MD1 by A24,FINSEQ_1:def 3;
      then 1 in Seg len lower_volume(f,MD1) by INTEGRA1:def 7;
      then
A26:  1 in dom lower_volume(f,MD1) by FINSEQ_1:def 3;
      rng D2 <> {};
      then
A27:  1 in dom D2 by FINSEQ_3:32;
      then 1 <= len D2 by FINSEQ_3:25;
      then
A28:  len <*lower_bound A*> + 1 <= len <*lower_bound A*> + len D2 by XREAL_1:6;
A29:  D2.1 in rng D2 by A27,FUNCT_1:def 3;
      lower_bound A < D2.1
      proof
        per cases by A4,A29,XBOOLE_0:def 3;
        suppose
A30:      D2.1 in rng D1;
          rng D1 <> {};
          then
A31:      1 in dom D1 by FINSEQ_3:32;
          consider k such that
A32:      k in dom D1 and
A33:      D1.k = D2.1 by A30,PARTFUN1:3;
          1 <= k by A32,FINSEQ_3:25;
          then D1.1 <= D2.1 by A32,A33,A31,SEQ_4:137;
          hence thesis by A17,XXREAL_0:2;
        end;
        suppose
          D2.1 in {x};
          hence thesis by A6,TARSKI:def 1;
        end;
      end;
      then reconsider MD2 as non empty increasing FinSequence of REAL by Lm9;
      len MD2 = len <*lower_bound A*> + len D2 by FINSEQ_1:22;
      then
      MD2.(len MD2)=D2.(len <*lower_bound A*>+len D2- len <*lower_bound A
      *>) by A28,FINSEQ_1:23
        .=D2.(len D2);
      then
A34:  MD2.(len MD2) = upper_bound A by INTEGRA1:def 2;
      for y being Element of REAL holds y in rng MD2 implies y in A
      proof let y be Element of REAL;
        assume y in rng MD2;
        then
A35:    y in rng <*lower_bound A*> \/ rng D2 by FINSEQ_1:31;
        per cases by A35,XBOOLE_0:def 3;
        suppose
          y in rng <*lower_bound A*>;
          then y in {lower_bound A} by FINSEQ_1:38;
          then
A36:      y = lower_bound A by TARSKI:def 1;
          ex a,b st a <= b & a = lower_bound A & b = upper_bound A by SEQ_4:11;
          hence thesis by A36,INTEGRA2:1;
        end;
        suppose
A37:      y in rng D2;
          rng D2 c= A by INTEGRA1:def 2;
          hence thesis by A37;
        end;
      end;
      then rng MD2 c= A;
      then reconsider MD2 as Division of A by A34,INTEGRA1:def 2;
A38:  x <= upper_bound divset(D1,len D1) by A1,INTEGRA2:1;
      rng MD2 = rng D2 \/ rng <*lower_bound A*> by FINSEQ_1:31
        .=rng D1 \/ rng <*lower_bound A*> \/ {x} by A4,XBOOLE_1:4;
      then
A39:  rng MD2 = rng MD1 \/ {x} by FINSEQ_1:31;
      MD1.(len MD1) = MD1.(len <*lower_bound A*> + len D1) by FINSEQ_1:22
        .=D1.(len D1) by A19,FINSEQ_1:def 7;
      then
A40:  upper_bound divset(MD1,len MD1)=D1.(len D1) by A22,A21,INTEGRA1:def 4
        .= upper_bound divset(D1,len D1) by A9,A19,INTEGRA1:def 4;
      rng D1 c= rng D2 by A3,INTEGRA1:def 18;
      then rng D1 \/ rng<*lower_bound A*> c= rng D2 \/ rng <*lower_bound A*>
      by XBOOLE_1:9;
      then rng MD1 c= rng D2 \/ rng <*lower_bound A*> by FINSEQ_1:31;
      then
A41:  rng MD1 c= rng MD2 by FINSEQ_1:31;
      len D1 <= len D2 by A3,INTEGRA1:def 18;
      then
len D1+len <*lower_bound A*> <= len D2+len <*lower_bound A*> by XREAL_1:6;
      then len MD1 <= len D2+len <*lower_bound A*> by FINSEQ_1:22;
      then len MD1 <= len MD2 by FINSEQ_1:22;
      then
A42:  MD1<=MD2 by A41,INTEGRA1:def 18;
      lower_bound divset(D1,len D1) <= x by A1,INTEGRA2:1;
      then x in divset(MD1,len MD1) by A38,A23,A40,INTEGRA2:1;
      then
A43:  Sum lower_volume(f,MD2)-Sum lower_volume(f,MD1)<=(upper_bound rng f
      -lower_bound rng f)*delta(MD1) by A5,A15,A20,A42,A39,Th10;
      rng MD2 <> {};
      then
A44:  1 in dom MD2 by FINSEQ_3:32;
      then
A45:  lower_volume(f,MD2).1 = (lower_bound rng(f|divset(MD2,1)))* vol(
      divset( MD2,1)) by INTEGRA1:def 7;
      1 in Seg len MD2 by A44,FINSEQ_1:def 3;
      then 1 in Seg len lower_volume(f,MD2) by INTEGRA1:def 7;
      then
A46:  1 in dom lower_volume(f,MD2) by FINSEQ_1:def 3;
      vol(divset(MD2,1))=0 by Lm11;
      then
A47:  lower_volume(f,MD2)/.1 = 0 by A45,A46,PARTFUN1:def 6;
      lower_volume(f,D2)=lower_volume(f,MD2)/^1 by Lm10;
      then
      lower_volume(f,MD2)=<*(lower_volume(f,MD2))/.1*>^lower_volume(f,D2)
      by FINSEQ_5:29;
      then
A48:  Sum lower_volume(f,MD2)=(lower_volume(f,MD2))/.1+Sum lower_volume(f
      ,D2 ) by RVSUM_1:76;
      vol(divset(MD1,1))=0 by Lm11;
      then lower_volume(f,MD1)/.1 = 0 by A25,A26,PARTFUN1:def 6;
      hence thesis by A43,A18,A48,A47,Lm12;
    end;
    suppose
      len D1 >= 2;
      hence thesis by A1,A3,A4,A5,Th10;
    end;
  end;
  hence thesis;
end;

theorem Th14:
  x in divset(D1,len D1) & vol(A)<>0 & D1<=D2 & rng D2 = rng D1 \/
  {x} & f|A is bounded & x > lower_bound A implies Sum upper_volume(f,D1)-Sum
  upper_volume(f,D2)<=(upper_bound rng f-lower_bound rng f)*delta(D1)
proof
  assume that
A1: x in divset(D1,len D1) and
A2: vol(A)<>0 and
A3: D1 <= D2 and
A4: rng D2 = rng D1 \/ {x} and
A5: f|A is bounded and
A6: x > lower_bound A;
  len D1 in Seg len D1 by FINSEQ_1:3;
  then
A7: 1 <= len D1 by FINSEQ_1:1;
  then len D1 = 1 or len D1 > 1 by XXREAL_0:1;
  then
A8: len D1 = 1 or len D1 >= 1+1 by NAT_1:13;
  now
    per cases by A8;
    suppose
A9:   len D1 = 1;
      then reconsider MD1 = <*lower_bound A*>^D1 as non empty increasing
      FinSequence of REAL by A2,Lm8;
A10:  len MD1 = len <*lower_bound A*> + len D1 by FINSEQ_1:22;
      len <*lower_bound A*> + 1 <= len <*lower_bound A*> + len D1 by A7,
XREAL_1:6;
      then
      MD1.(len MD1)=D1.(len <*lower_bound A*>+len D1- len <*lower_bound A
      *>) by A10,FINSEQ_1:23
        .=D1.(len D1);
      then
A11:  MD1.(len MD1) = upper_bound A by INTEGRA1:def 2;
      for y being Element of REAL holds y in rng MD1 implies y in A
      proof let y be Element of REAL;
        assume y in rng MD1;
        then
A12:    y in rng <*lower_bound A*> \/ rng D1 by FINSEQ_1:31;
        per cases by A12,XBOOLE_0:def 3;
        suppose
          y in rng <*lower_bound A*>;
          then y in {lower_bound A} by FINSEQ_1:38;
          then
A13:      y = lower_bound A by TARSKI:def 1;
          ex a,b st a <= b & a = lower_bound A & b = upper_bound A by SEQ_4:11;
          hence thesis by A13,INTEGRA2:1;
        end;
        suppose
A14:      y in rng D1;
          rng D1 c= A by INTEGRA1:def 2;
          hence thesis by A14;
        end;
      end;
      then rng MD1 c= A;
      then reconsider MD1 as Division of A by A11,INTEGRA1:def 2;
A15:  len MD1=len <*lower_bound A*> + len D1 by FINSEQ_1:22
        .= 1+len D1 by FINSEQ_1:39;
A16:  vol(A) >= 0 by INTEGRA1:9;
      D1.1=upper_bound A by A9,INTEGRA1:def 2;
      then D1.1 - lower_bound A > 0 by A2,A16,INTEGRA1:def 5;
      then
A17:  lower_bound A < D1.1 by XREAL_1:47;
      upper_volume(f,D1)=upper_volume(f,MD1)/^1 by Lm10;
      then upper_volume(f,MD1)=<*upper_volume(f,MD1)/.1*>^upper_volume(f,D1)
      by FINSEQ_5:29;
      then
A18:  Sum upper_volume(f,MD1)=(upper_volume(f,MD1)/.1)+Sum upper_volume(f
      ,D1 ) by RVSUM_1:76;
A19:  len D1 in dom D1 by FINSEQ_5:6;
A20:  1+len D1 >= 1+1 by A7,XREAL_1:6;
      then
A21:  len MD1 <> 1 by A15;
A22:  len MD1 in dom MD1 by FINSEQ_5:6;
      len MD1 - 1 = len D1 by A15;
      then lower_bound divset(MD1,len MD1) = MD1.(len D1) by A22,A21,
INTEGRA1:def 4
        .=lower_bound A by A9,FINSEQ_1:41;
      then
A23:  lower_bound divset(D1,len D1) = lower_bound divset(MD1,len MD1) by A9,A19
,INTEGRA1:def 4;
      set MD2=<*lower_bound A*>^D2;
      rng MD1 <> {};
      then
A24:  1 in dom MD1 by FINSEQ_3:32;
      then
A25:  upper_volume(f,MD1).1 = (upper_bound rng(f|divset(MD1,1)))* vol(
      divset( MD1,1)) by INTEGRA1:def 6;
      1 in Seg len MD1 by A24,FINSEQ_1:def 3;
      then 1 in Seg len upper_volume(f,MD1) by INTEGRA1:def 6;
      then
A26:  1 in dom upper_volume(f,MD1) by FINSEQ_1:def 3;
      rng D2 <> {};
      then
A27:  1 in dom D2 by FINSEQ_3:32;
      then 1 <= len D2 by FINSEQ_3:25;
      then
A28:  len <*lower_bound A*> + 1 <= len <*lower_bound A*> + len D2 by XREAL_1:6;
A29:  D2.1 in rng D2 by A27,FUNCT_1:def 3;
      lower_bound A < D2.1
      proof
        per cases by A4,A29,XBOOLE_0:def 3;
        suppose
A30:      D2.1 in rng D1;
          rng D1 <> {};
          then
A31:      1 in dom D1 by FINSEQ_3:32;
          consider k such that
A32:      k in dom D1 and
A33:      D1.k = D2.1 by A30,PARTFUN1:3;
          1 <= k by A32,FINSEQ_3:25;
          then D1.1 <= D2.1 by A32,A33,A31,SEQ_4:137;
          hence thesis by A17,XXREAL_0:2;
        end;
        suppose
          D2.1 in {x};
          hence thesis by A6,TARSKI:def 1;
        end;
      end;
      then reconsider MD2 as non empty increasing FinSequence of REAL by Lm9;
      len MD2 = len <*lower_bound A*> + len D2 by FINSEQ_1:22;
      then
      MD2.(len MD2)=D2.(len <*lower_bound A*>+len D2- len <*lower_bound A
      *>) by A28,FINSEQ_1:23
        .=D2.(len D2);
      then
A34:  MD2.(len MD2) = upper_bound A by INTEGRA1:def 2;
      for y being Element of REAL holds y in rng MD2 implies y in A
      proof let y be Element of REAL;
        assume y in rng MD2;
        then
A35:    y in rng <*lower_bound A*> \/ rng D2 by FINSEQ_1:31;
        per cases by A35,XBOOLE_0:def 3;
        suppose
          y in rng <*lower_bound A*>;
          then y in {lower_bound A} by FINSEQ_1:38;
          then
A36:      y = lower_bound A by TARSKI:def 1;
          ex a,b st a <= b & a = lower_bound A & b = upper_bound A by SEQ_4:11;
          hence thesis by A36,INTEGRA2:1;
        end;
        suppose
A37:      y in rng D2;
          rng D2 c= A by INTEGRA1:def 2;
          hence thesis by A37;
        end;
      end;
      then rng MD2 c= A;
      then reconsider MD2 as Division of A by A34,INTEGRA1:def 2;
A38:  x <= upper_bound divset(D1,len D1) by A1,INTEGRA2:1;
      rng MD2 = rng D2 \/ rng <*lower_bound A*> by FINSEQ_1:31
        .=rng D1 \/ rng <*lower_bound A*> \/ {x} by A4,XBOOLE_1:4;
      then
A39:  rng MD2 = rng MD1 \/ {x} by FINSEQ_1:31;
      MD1.(len MD1) = MD1.(len <*lower_bound A*> + len D1) by FINSEQ_1:22
        .=D1.(len D1) by A19,FINSEQ_1:def 7;
      then
A40:  upper_bound divset(MD1,len MD1)=D1.(len D1) by A22,A21,INTEGRA1:def 4
        .= upper_bound divset(D1,len D1) by A9,A19,INTEGRA1:def 4;
      rng D1 c= rng D2 by A3,INTEGRA1:def 18;
      then rng D1 \/ rng<*lower_bound A*> c= rng D2 \/ rng <*lower_bound A*>
      by XBOOLE_1:9;
      then rng MD1 c= rng D2 \/ rng <*lower_bound A*> by FINSEQ_1:31;
      then
A41:  rng MD1 c= rng MD2 by FINSEQ_1:31;
      len D1 <= len D2 by A3,INTEGRA1:def 18;
      then
len D1+len <*lower_bound A*> <= len D2+len <*lower_bound A*> by XREAL_1:6;
      then len MD1 <= len D2+len <*lower_bound A*> by FINSEQ_1:22;
      then len MD1 <= len MD2 by FINSEQ_1:22;
      then
A42:  MD1<=MD2 by A41,INTEGRA1:def 18;
      lower_bound divset(D1,len D1) <= x by A1,INTEGRA2:1;
      then x in divset(MD1,len MD1) by A38,A23,A40,INTEGRA2:1;
      then
A43:  Sum upper_volume(f,MD1)-Sum upper_volume(f,MD2) <=(upper_bound rng
      f-lower_bound rng f)*delta(MD1) by A5,A15,A20,A42,A39,Th11;
      rng MD2 <> {};
      then
A44:  1 in dom MD2 by FINSEQ_3:32;
      then
A45:  upper_volume(f,MD2).1 = (upper_bound rng(f|divset(MD2,1)))* vol(
      divset( MD2,1)) by INTEGRA1:def 6;
      1 in Seg len MD2 by A44,FINSEQ_1:def 3;
      then 1 in Seg len upper_volume(f,MD2) by INTEGRA1:def 6;
      then
A46:  1 in dom upper_volume(f,MD2) by FINSEQ_1:def 3;
      vol(divset(MD2,1))=0 by Lm11;
      then
A47:  upper_volume(f,MD2)/.1 = 0 by A45,A46,PARTFUN1:def 6;
      upper_volume(f,D2)=upper_volume(f,MD2)/^1 by Lm10;
      then upper_volume(f,MD2)=<*upper_volume(f,MD2)/.1*>^upper_volume(f,D2)
      by FINSEQ_5:29;
      then
A48:  Sum upper_volume(f,MD2)=(upper_volume(f,MD2)/.1)+Sum upper_volume(f
      ,D2 ) by RVSUM_1:76;
      vol(divset(MD1,1))=0 by Lm11;
      then upper_volume(f,MD1)/.1 = 0 by A25,A26,PARTFUN1:def 6;
      hence thesis by A43,A18,A48,A47,Lm12;
    end;
    suppose
      len D1 >= 2;
      hence thesis by A1,A3,A4,A5,Th11;
    end;
  end;
  hence thesis;
end;

theorem Th15:
  i in dom D1 & j in dom D1 & i<=j & D1 <= D2 & r < mid(D2,indx(D2
,D1,i),indx(D2,D1,j)).1 implies
 ex B be non empty closed_interval Subset of REAL, MD1,MD2
be Division of B st r=lower_bound B & upper_bound B=MD2.(len MD2) & upper_bound
B=MD1.(len MD1) & MD1 <= MD2 & MD1=mid(D1,i,j) & MD2=mid(D2,indx(D2,D1,i),indx(
  D2,D1,j))
proof
  set MD1=mid(D1,i,j);
  set MD2=mid(D2,indx(D2,D1,i),indx(D2,D1,j));
  assume
A1: i in dom D1;
  then
A2: 1 <= i by FINSEQ_3:25;
  assume
A3: j in dom D1;
  assume
A4: i <= j;
  then j-i >= 0 by XREAL_1:48;
  then
A5: j-i+1 >= 0+1 by XREAL_1:6;
A6: j <= len D1 by A3,FINSEQ_3:25;
  then
A7: MD1.1 = D1.(1+i-1) by A4,A5,A2,FINSEQ_6:122
    .= D1.i;
  assume
A8: D1 <= D2;
  then
A9: D2.indx(D2,D1,i)=D1.i by A1,INTEGRA1:def 19;
A10: D2.indx(D2,D1,j)=D1.j by A3,A8,INTEGRA1:def 19;
A11: indx(D2,D1,i) in dom D2 by A1,A8,INTEGRA1:def 19;
  then
A12: 1 <= indx(D2,D1,i) by FINSEQ_3:25;
A13: indx(D2,D1,j) in dom D2 by A3,A8,INTEGRA1:def 19;
  then
A14: indx(D2,D1,j) <= len D2 by FINSEQ_3:25;
  D1.i <= D1.j by A1,A3,A4,SEQ_4:137;
  then
A15: indx(D2,D1,i) <= indx(D2,D1,j) by A11,A9,A13,A10,SEQM_3:def 1;
  assume
A16: r < mid(D2,indx(D2,D1,i),indx(D2,D1,j)).1;
  then consider B being non empty closed_interval Subset of REAL such that
A17: r = lower_bound B and
A18: upper_bound B=MD2.(len MD2) and
A19: MD2 is Division of B by A11,A13,A15,Th12;
A20: len MD2=indx(D2,D1,j)-indx(D2,D1,i)+1 by A11,A13,A15,INTEGRA1:58;
  reconsider MD2 as Division of B by A19;
  indx(D2,D1,j)-indx(D2,D1,i) >= 0 by A15,XREAL_1:48;
  then
A21: indx(D2,D1,j)-indx(D2,D1,i)+1 >= 0+1 by XREAL_1:6;
  then
A22: MD2.(len MD2)=D2.(indx(D2,D1,j)-indx(D2,D1,i)+1-1+indx(D2,D1,i)) by A15
,A20,A12,A14,FINSEQ_6:122
    .= D1.j by A3,A8,INTEGRA1:def 19;
  MD2.1=D2.(1+indx(D2,D1,i)-1) by A15,A21,A12,A14,FINSEQ_6:122
    .=D1.i by A1,A8,INTEGRA1:def 19;
  then consider C being non empty closed_interval Subset of REAL such that
A23: r = lower_bound C and
A24: upper_bound C=MD1.(len MD1) and
A25: MD1 is Division of C by A1,A3,A4,A16,A7,Th12;
 len MD1=j-i+1 by A1,A3,A4,INTEGRA1:58;
then A26: MD1.(len MD1)=D1.(j-i+1-1+i) by A4,A5,A2,A6,FINSEQ_6:122
    .=D1.j;
A27: B=[.lower_bound B,upper_bound B.] by INTEGRA1:4
    .=C by A17,A18,A23,A24,A26,A22,INTEGRA1:4;
  then reconsider MD1 as Division of B by A25;
A28: rng MD1 c= rng MD2
  proof
    let x1 be object;
A29: rng MD1 c= rng D1 by FINSEQ_6:119;
    assume
A30: x1 in rng MD1;
    then consider k1 being Element of NAT such that
A31: k1 in dom MD1 and
A32: MD1.k1=x1 by PARTFUN1:3;
    rng D1 c= rng D2 by A8,INTEGRA1:def 18;
    then rng MD1 c= rng D2 by A29;
    then consider k2 being Element of NAT such that
A33: k2 in dom D2 and
A34: D2.k2=x1 by A30,PARTFUN1:3;
A35: k1 <= len MD1 by A31,FINSEQ_3:25;
A36: 1 <= k1 by A31,FINSEQ_3:25;
    then 1 <= len MD1 by A35,XXREAL_0:2;
    then 1 in dom MD1 by FINSEQ_3:25;
    then MD1.1<=MD1.k1 by A31,A36,SEQ_4:137;
    then
A37: indx(D2,D1,i) <= k2 by A11,A9,A7,A33,A34,A32,SEQM_3:def 1;
    then consider k3 being Nat such that
A38: k2+1 = indx(D2,D1,i)+k3 by NAT_1:10,12;
    len MD1 in dom MD1 by FINSEQ_5:6;
    then MD1.k1<=MD1.(len MD1) by A31,A35,SEQ_4:137;
    then k2 <= indx(D2,D1,j) by A13,A10,A26,A33,A34,A32,SEQM_3:def 1;
    then k2+1<=indx(D2,D1,j)+1 by XREAL_1:6;
    then
A39: k2+1-indx(D2,D1,i)<=indx(D2,D1,j)+1-indx( D2, D1,i) by XREAL_1:9;
    indx(D2,D1,i)+1<=k2+1 by A37,XREAL_1:6;
    then
A40: 1<=k2+1-indx(D2,D1,i) by XREAL_1:19;
    then
A41: k3 in dom MD2 by A20,A39,A38,FINSEQ_3:25;
    MD2.k3 = D2.(k3+indx(D2,D1,i)-1) by A15,A12,A14,A40,A39,A38,
FINSEQ_6:122;
    hence thesis by A34,A38,A41,FUNCT_1:def 3;
  end;
A42: card(rng MD2) = len MD2 by FINSEQ_4:62;
  card(rng MD1) = len MD1 by FINSEQ_4:62;
  then len MD1 <= len MD2 by A28,A42,NAT_1:43;
  then MD1 <= MD2 by A28,INTEGRA1:def 18;
  hence thesis by A17,A18,A24,A27;
end;

theorem Th16:
  x in rng D implies D.1 <= x & x <= D.(len D)
proof
  assume x in rng D;
  then consider i such that
A1: i in dom D and
A2: x=D.i by PARTFUN1:3;
A3: i <= len D by A1,FINSEQ_3:25;
A4: 1 <= i by A1,FINSEQ_3:25;
  then
A5: 1 <= len D by A3,XXREAL_0:2;
  then
A6: len D in dom D by FINSEQ_3:25;
  1 in dom D by A5,FINSEQ_3:25;
  hence thesis by A1,A2,A4,A3,A6,SEQ_4:137;
end;

theorem Th17:
  for p be FinSequence of REAL, i,j,k st p is increasing & i in
dom p & j in dom p & k in dom p & p.i <= p.k & p.k <= p.j holds p.k in rng mid(
  p,i,j)
proof
  let p be FinSequence of REAL;
  let i,j,k;
  assume that
A1: p is increasing and
A2: i in dom p and
A3: j in dom p and
A4: k in dom p and
A5: p.i <= p.k and
A6: p.k <= p.j;
A7: 1 <= i by A2,FINSEQ_3:25;
A8: 1 <= j by A3,FINSEQ_3:25;
A9: j <= len p by A3,FINSEQ_3:25;
A10: i <= k by A1,A2,A4,A5,SEQM_3:def 1;
  then consider n being Nat such that
A11: k+1=i+n by NAT_1:10,12;
A12: k <= j by A1,A3,A4,A6,SEQM_3:def 1;
  then k-i <= j-i by XREAL_1:9;
  then
A13: k-i+1 <= j-i+1 by XREAL_1:6;
  k-i >= 0 by A10,XREAL_1:48;
  then
A14: k-i+1 >= 0+1 by XREAL_1:6;
A15: i <= j by A10,A12,XXREAL_0:2;
  i <= len p by A2,FINSEQ_3:25;
  then len mid(p,i,j) = j-'i+1 by A7,A8,A9,A15,FINSEQ_6:118;
  then len mid(p,i,j) = j-i+1 by A10,A12,XREAL_1:233,XXREAL_0:2;
  then
A16: n in dom mid(p,i,j) by A11,A14,A13,FINSEQ_3:25;
  mid(p,i,j).n = p.(n+i-1) by A7,A9,A15,A11,A14,A13,FINSEQ_6:122
    .=p.k by A11;
  hence thesis by A16,FUNCT_1:def 3;
end;

theorem Th18:
  f|A is bounded & i in dom D implies lower_bound rng(f|divset(D,i
  )) <= upper_bound rng f
proof
  assume
A1: f|A is bounded;
  assume i in dom D;
  then divset(D,i) c= A by INTEGRA1:8;
  hence thesis by A1,Lm4;
end;

theorem Th19:
  f|A is bounded & i in dom D implies upper_bound rng(f|divset(D,i
  )) >= lower_bound rng f
proof
  assume
A1: f|A is bounded;
  assume i in dom D;
  then divset(D,i) c= A by INTEGRA1:8;
  hence thesis by A1,Lm4;
end;

begin :: Darboux's Theorem

theorem Th20:
  f|A is bounded implies
  for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D &
    0 <= lower_sum(f,D2)-lower_sum(f,D) & 0<=lower_sum(f,D2)-lower_sum(f,D1)
  proof
    assume
A1: f|A is bounded;
    for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D &
    0 <= lower_sum(f,D2)-lower_sum(f,D) & 0<=lower_sum(f,D2)-lower_sum(f,D1)
    proof
      let D,D1;
      consider D2 such that
A6:   D<=D2 and
A7:   D1<=D2 and
A8:   rng D2=rng D1 \/ rng D by Th4;
A9:   lower_sum(f,D2)-lower_sum(f,D1)>=0 by A1,A7,INTEGRA1:46,XREAL_1:48;
      lower_sum(f,D2)-lower_sum(f,D)>=0 by A1,A6,INTEGRA1:46,XREAL_1:48;
      hence thesis by A6,A7,A8,A9;
    end;
    hence thesis;
  end;

theorem Th21:
  f|A is bounded implies
  for D,D1 st delta(D1)<min rng upper_volume(chi(A,A),D) ex D2 st D<=D2 &
  D1<=D2 & rng D2=rng D1 \/ rng D & lower_sum(f,D2)-lower_sum(f,D1) <=
  (len D)*(upper_bound(rng f)-lower_bound(rng f))*delta(D1)
  proof
    assume
A1: f|A is bounded;
    then
A5: for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D &
    0 <= lower_sum(f,D2)-lower_sum(f,D) & 0<=lower_sum(f,D2)-lower_sum(f,D1)
      by Th20;
    for D,D1 st delta(D1)<min rng upper_volume(chi(A,A),D) ex D2 st D<=D2 &
D1<=D2 & rng D2=rng D1 \/ rng D & lower_sum(f,D2)-lower_sum(f,D1) <= (len D)*(
  upper_bound(rng f)-lower_bound(rng f))*delta(D1)
  proof
    let D,D1;
    assume
A11: delta(D1)<min rng upper_volume(chi(A,A),D);
    ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & lower_sum(f,D2)-
    lower_sum(f,D1)<=(len D)*(upper_bound(rng f)- lower_bound(rng f))*delta(D1)
    proof
      consider D2 such that
A12:  D<=D2 and
A13:  D1<=D2 and
A14:  rng D2=rng D1 \/ rng D and
      0<=lower_sum(f,D2)-lower_sum(f,D) and
      0<=lower_sum(f,D2)-lower_sum(f,D1) by A5;
      lower_sum(f,D2)-lower_sum(f,D1) <= (len D)*(upper_bound(rng f)-
      lower_bound(rng f))*delta(D1)
      proof
        deffunc LVf(Division of A) = lower_volume(f,$1);
        deffunc PLf(Division of A,Nat) = (PartSums(lower_volume(f,$1))).$2;
A15:    len D2 in dom D2 by FINSEQ_5:6;
A16:    for i st i in dom D holds ex j st j in dom D1 & D.i in divset(D1,
j) & PLf(D2,indx(D2,D1,j))-PLf(D1,j)<=i*(upper_bound(rng f)- lower_bound(rng f)
        )*delta(D1)
        proof
          defpred P[non zero Nat] means $1 in dom D implies ex j st j in dom
D1 & D.$1 in divset(D1,j) & PLf(D2,indx(D2,D1,j))-PLf(D1,j)<= $1*(upper_bound
          rng f-lower_bound rng f)*delta(D1);
          let i;
          assume
A17:      i in dom D;
          then
A18:      i in Seg len D by FINSEQ_1:def 3;
A19:      for i,j st i in dom D & j in dom D1 & D.i in divset(D1,j) holds
          j >= 2
          proof
            let i,j;
            assume
A20:        i in dom D;
            assume that
A21:        j in dom D1 and
A22:        D.i in divset(D1,j);
            assume j<2;
            then j<1+1;
            then
A23:        j <= 1 by NAT_1:13;
            j in Seg len D1 by A21,FINSEQ_1:def 3;
            then j >= 1 by FINSEQ_1:1;
            then j = 1 by A23,XXREAL_0:1;
            then
A24:        lower_bound divset(D1,j)=lower_bound A by A21,INTEGRA1:def 4;
A25:        D.i<=upper_bound divset(D1,j) by A22,INTEGRA2:1;
            delta(D1) >= min rng upper_volume(chi(A,A),D)
            proof
              per cases;
              suppose
A26:            i=1;
                len D in Seg len D by FINSEQ_1:3;
                then 1 <= len D by FINSEQ_1:1;
                then
A27:            1 in Seg len D by FINSEQ_1:1;
                then
A28:            1 in dom D by FINSEQ_1:def 3;
                then
A29:            lower_bound divset(D,1)=lower_bound A by INTEGRA1:def 4;
                1 in Seg len upper_volume(chi(A,A),D) by A27,INTEGRA1:def 6;
                then
A30:            1 in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
                vol(divset(D,1)) = upper_volume(chi(A,A),D).1 by A28,
INTEGRA1:20;
                then vol(divset(D,1)) in rng upper_volume(chi(A,A),D) by A30,
FUNCT_1:def 3;
                then
A31:            vol
(divset(D,1))>=min rng upper_volume(chi(A,A),D) by XXREAL_2:def 7;
A32:            upper_bound divset(D,1)=D. 1 by A28,INTEGRA1:def 4;
                upper_bound divset(D1,j)-lower_bound A >= D.1-lower_bound
                A by A25,A26,XREAL_1:9;
                then vol(divset(D1,j)) >= upper_bound divset(D,1)-lower_bound
                divset(D,1) by A24,A29,A32,INTEGRA1:def 5;
                then
A33:            vol(divset(D1,j)) >= vol(divset(D,1)) by INTEGRA1:def 5;
                vol(divset(D1,j)) <= delta(D1) by A21,Lm5;
                then delta(D1) >= vol(divset(D,1)) by A33,XXREAL_0:2;
                hence thesis by A31,XXREAL_0:2;
              end;
              suppose
A34:            i<>1;
                then D.(i-1) in A by A20,INTEGRA1:7;
                then
A35:            lower_bound A <= D.(i-1) by INTEGRA2:1;
                lower_bound divset(D,i)=D.(i-1) by A20,A34,INTEGRA1:def 4;
                then
A36:            upper_bound divset(D,i)-lower_bound A >= upper_bound
                divset(D,i)-lower_bound divset(D,i) by A35,XREAL_1:10;
                upper_bound divset(D,i)= D.i by A20,A34,INTEGRA1:def 4;
                then upper_bound divset(D1,j)-lower_bound divset(D1,j) >=
                upper_bound divset(D,i)-lower_bound A by A25,A24,XREAL_1:9;
                then upper_bound divset(D1,j)-lower_bound divset(D1,j) >=
upper_bound divset(D,i)-lower_bound divset( D,i) by A36,XXREAL_0:2;
                then vol(divset(D1,j)) >= upper_bound divset(D,i)-lower_bound
                divset(D,i) by INTEGRA1:def 5;
                then
A37:            vol(divset(D1,j)) >= vol(divset(D,i)) by INTEGRA1:def 5;
                i in Seg len D by A20,FINSEQ_1:def 3;
                then i in Seg len upper_volume(chi(A,A),D) by INTEGRA1:def 6;
                then
A38:            i in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
                vol(divset(D,i)) = upper_volume(chi(A,A),D).i by A20,
INTEGRA1:20;
                then vol(divset(D,i)) in rng upper_volume(chi(A,A),D) by A38,
FUNCT_1:def 3;
                then
A39:            vol
(divset(D,i))>=min rng upper_volume(chi(A,A),D) by XXREAL_2:def 7;
                vol(divset(D1,j)) <= delta(D1) by A21,Lm5;
                then delta(D1) >= vol(divset(D,i)) by A37,XXREAL_0:2;
                hence thesis by A39,XXREAL_0:2;
              end;
            end;
            hence contradiction by A11;
          end;
A40:      P[1]
          proof
            len D in Seg len D by FINSEQ_1:3;
            then 1 <= len D by FINSEQ_1:1;
            then
A41:        1 in dom D by FINSEQ_3:25;
            then consider j such that
A42:        j in dom D1 and
A43:        D.1 in divset(D1,j) by Th3,INTEGRA1:6;
            PLf(D2,indx(D2,D1,j))-PLf(D1,j) <=1*(upper_bound rng f-
            lower_bound rng f)*delta(D1)
            proof
A44:          j <> 1 by A19,A41,A42,A43;
              then reconsider j1=j-1 as Element of NAT by A42,INTEGRA1:7;
A45:          j1 in dom D1 by A42,A44,INTEGRA1:7;
              then j1 in Seg len D1 by FINSEQ_1:def 3;
              then j1 in Seg len lower_volume(f,D1) by INTEGRA1:def 7;
              then
A46:          j1 in dom lower_volume(f,D1) by FINSEQ_1:def 3;
A47:          j-1 in dom D1 by A42,A44,INTEGRA1:7;
              then
A48:          indx(D2,D1,j1) in dom D2 by A13,INTEGRA1:def 19;
              then
A49:          indx(D2,D1,j1) in Seg len D2 by FINSEQ_1:def 3;
              then
A50:          1 <= indx(D2,D1,j1) by FINSEQ_1:1;
              then mid(D2,1,indx(D2,D1,j1)) is increasing by A48,INTEGRA1:35;
              then
A51:          D2|indx(D2,D1,j1) is increasing by A50,FINSEQ_6:116;
              j < j+1 by NAT_1:13;
              then j1 < j by XREAL_1:19;
              then
A52:          indx(D2,D1,j1) < indx(D2,D1,j) by A13,A42,A45,Th8;
              then
A53:          indx(D2,D1,j1)+1 <= indx(D2,D1,j) by NAT_1:13;
A54:          Sum mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1,j
)) -Sum mid(lower_volume(f,D1),j,j) <= (upper_bound rng f-lower_bound rng f)*
              delta(D1)
              proof
A55:            indx(D2,D1,j)-indx(D2,D1,j1) <= 2
                proof
                  reconsider ID1=indx(D2,D1,j1)+1 as Element of NAT;
                  reconsider ID2=ID1+1 as Element of NAT;
                  assume indx(D2,D1,j)-indx(D2,D1,j1) > 2;
                  then
A56:              indx(D2,D1,j1)+(1+1)<indx(D2,D1,j) by XREAL_1:20;
A57:              ID1 < ID2 by NAT_1:13;
                  then indx(D2,D1,j1) <= ID2 by NAT_1:13;
                  then
A58:              1 <= ID2 by A50,XXREAL_0:2;
A59:              indx(D2,D1,j) in dom D2 by A13,A42,INTEGRA1:def 19;
                  then
A60:              indx(D2,D1,j) <= len D2 by FINSEQ_3:25;
                  then ID2 <= len D2 by A56,XXREAL_0:2;
                  then ID2 in Seg len D2 by A58,FINSEQ_1:1;
                  then
A61:              ID2 in dom D2 by FINSEQ_1:def 3;
                  then
A62:              D2.ID2<D2.indx(D2,D1, j) by A56,A59,SEQM_3:def 1;
A63:              1 <= ID1 by A50,NAT_1:13;
A64:              D1.j = D2.indx(D2,D1,j) by A13,A42,INTEGRA1:def 19;
                  ID1 <= indx(D2,D1,j) by A56,A57,XXREAL_0:2;
                  then ID1 <= len D2 by A60,XXREAL_0:2;
                  then ID1 in Seg len D2 by A63,FINSEQ_1:1;
                  then
A65:              ID1 in dom D2 by FINSEQ_1:def 3;
                  then
A66:              D2.ID1<D2.ID2 by A57,A61,SEQM_3:def 1;
                  indx(D2,D1,j1) < ID1 by NAT_1:13;
                  then
A67:              D2 .indx(D2,D1,j1)<D2.ID1 by A48,A65,SEQM_3:def 1;
A68:              D1.j1 = D2.indx(D2,D1,j1) by A13,A45,INTEGRA1:def 19;
A69:              not D2.ID1 in rng D1 & not D2.ID2 in rng D1
                  proof
                    assume
A70:                D2.ID1 in rng D1 or D2.ID2 in rng D1;
                    per cases by A70;
                    suppose
                      D2.ID1 in rng D1;
                      then consider n such that
A71:                  n in dom D1 and
A72:                  D1.n=D2.ID1 by PARTFUN1:3;
                      j1<n by A45,A67,A68,A71,A72,SEQ_4:137;
                      then
A73:                  j<n+1 by XREAL_1:19;
                      D2.ID1<D2.indx(D2,D1,j) by A66,A62,XXREAL_0:2;
                      then n<j by A42,A64,A71,A72,SEQ_4:137;
                      hence contradiction by A73,NAT_1:13;
                    end;
                    suppose
                      D2.ID2 in rng D1;
                      then consider n such that
A74:                  n in dom D1 and
A75:                  D1.n=D2.ID2 by PARTFUN1:3;
                      D2.indx(D2,D1,j1)<D2.ID2 by A67,A66,XXREAL_0:2;
                      then j1<n by A45,A68,A74,A75,SEQ_4:137;
                      then
A76:                  j<n+1 by XREAL_1:19;
                      n<j by A42,A62,A64,A74,A75,SEQ_4:137;
                      hence contradiction by A76,NAT_1:13;
                    end;
                  end;
                  upper_bound divset(D1,j)=D1.j by A42,A44,INTEGRA1:def 4;
                  then
A77:              upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A13,A42,
INTEGRA1:def 19;
                  lower_bound divset(D1,j)=D1.j1 by A42,A44,INTEGRA1:def 4;
                  then
A78:              lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A13,A45,
INTEGRA1:def 19;
                  D2.ID2 in rng D \/ rng D1 by A14,A61,FUNCT_1:def 3;
                  then
A79:              D2.ID2 in rng D by A69,XBOOLE_0:def 3;
                  D2.ID1 in rng D \/ rng D1 by A14,A65,FUNCT_1:def 3;
                  then
A80:              D2.ID1 in rng D by A69,XBOOLE_0:def 3;
                  D2.indx(D2,D1,j1)<=D2.ID2 by A67,A66,XXREAL_0:2;
                  then D2.ID2 in divset(D1,j) by A62,A78,A77,INTEGRA2:1;
                  then
A81:              D2.ID2 in rng D /\ divset(D1,j) by A79,XBOOLE_0:def 4;
                  D2.ID1<=D2.indx(D2,D1,j) by A66,A62,XXREAL_0:2;
                  then D2.ID1 in divset(D1,j) by A67,A78,A77,INTEGRA2:1;
                  then D2.ID1 in rng D /\ divset(D1,j) by A80,XBOOLE_0:def 4;
                  hence contradiction by A11,A42,A57,A65,A61,A81,Th5,SEQ_4:138;
                end;
A82:            1 <= indx(D2,D1,j1)+1 by A50,NAT_1:13;
                j <= len D1 by A42,FINSEQ_3:25;
                then
A83:            j <= len lower_volume(f,D1) by INTEGRA1:def 7;
A84:            1 <= j by A42,FINSEQ_3:25;
                then
A85:            mid(lower_volume(f,D1),j,j).1 = lower_volume(f,D1).j by A83,
FINSEQ_6:118;
           reconsider lv = lower_volume(f,D1).j as Element of REAL
                 by XREAL_0:def 1;
                j-'j+1 = 1 by Lm1;
                then len mid(lower_volume(f,D1),j,j)= 1 by A84,A83,FINSEQ_6:118
;
                then mid(lower_volume(f,D1),j,j) =<*lv*> by A85,FINSEQ_1:40;
                then
A86:            Sum mid(lower_volume(f,D1),j,j)= lower_volume(f,D1).j by
FINSOP_1:11;
                indx(D2,D1,j) in dom D2 by A13,A42,INTEGRA1:def 19;
                then
A87:            indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
                then
A88:            1 <= indx(D2,D1,j) by FINSEQ_1:1;
                indx(D2,D1,j) in Seg len lower_volume(f,D2) by A87,
INTEGRA1:def 7;
                then
A89:            indx(D2,D1,j) <= len lower_volume(f,D2) by FINSEQ_1:1;
                then
A90:            indx(D2,D1,j1)+1 <= len lower_volume(f, D2) by A53,XXREAL_0:2;
                then indx(D2,D1,j1)+1 in Seg len lower_volume(f,D2) by A82,
FINSEQ_1:1;
                then
A91:            indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 7;
                then
A92:            indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
                indx(D2,D1,j)-'(indx(D2,D1,j1)+1) =indx(D2,D1,j)-(indx(
                D2,D1,j1)+1) by A53,XREAL_1:233;
                then indx(D2,D1,j)-'(indx(D2,D1,j1) +1)+1 <= 2 by A55;
                then
A93:            len mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
                ,j))<=2 by A53,A88,A89,A82,A90,FINSEQ_6:118;
                indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 >= 0+1 by XREAL_1:6;
                then
A94:            1 <= len mid(lower_volume(f,D2),(indx(D2, D1,j1)+1),indx
                (D2,D1,j )) by A53,A88,A89,A82,A90,FINSEQ_6:118;
                now
                  per cases by A94,A93,Lm2;
                  suppose
A95:                len mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),
                    indx(D2,D1,j))=1;
                    upper_bound divset(D1,j)=D1.j by A42,A44,INTEGRA1:def 4;
                    then
A96:                upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A13,A42,
INTEGRA1:def 19;
                    lower_bound divset(D1,j)=D1.j1 by A42,A44,INTEGRA1:def 4;
                    then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A13,A45,
INTEGRA1:def 19;
                    then
A97:                divset(D1,j)=[. D2.indx(D2,D1, j1),D2.indx(D2,D1,j)
                    .] by A96,INTEGRA1:4;
A98:                delta(D1) >= 0 by Th9;
A99:                upper_bound rng f - lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
A100:               indx(D2,D1,j) in dom D2 by A13,A42,INTEGRA1:def 19;
                    indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=1 by A53,A88,A89,A82
,A90,A95,FINSEQ_6:118;
                    then
A101:               indx(D2,D1,j)-(indx(D2,D1,j1)+1)=0 by A53,XREAL_1:233;
                    then indx(D2,D1,j)<>1 by A49,FINSEQ_1:1;
                    then
A102:               upper_bound divset(D2,indx(D2,D1,j))=D2.indx(D2,D1,j
                    ) by A100,INTEGRA1:def 4;
                    indx(D2,D1,j)-1=indx(D2,D1,j1) by A101;
                    then lower_bound divset(D2,indx(D2,D1,j)) =D2.indx(D2,D1,
                    j1) by A50,A101,A100,INTEGRA1:def 4;
                    then
A103:               divset(D2,indx(D2,D1,j))=divset(D1,j) by A97,A102,
INTEGRA1:4;
           reconsider lv = lower_volume(f,D2).(indx(D2,D1,j1)+1)
as Element of REAL
                    by XREAL_0:def 1;
                    mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)).1 =lower_volume(f,D2).(indx(D2,D1,j1)+1) by A88,A89,A82,A90,FINSEQ_6:118;
                    then mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)) =<*lv*> by A95,FINSEQ_1:40;
                    then Sum mid(lower_volume(f,D2),(indx( D2,D1,j1)+1),indx(
D2,D1,j )) =lower_volume(f,D2).(indx(D2,D1,j1)+1) by FINSOP_1:11
                      .=(lower_bound(rng(f|divset(D2,(indx(D2,D1,j1)+1)))))
                    *vol(divset(D2,(indx(D2,D1,j1)+1))) by A92,INTEGRA1:def 7
                      .=Sum mid(lower_volume(f,D1),j,j) by A42,A86,A101,A103,
INTEGRA1:def 7;
                    hence thesis by A98,A99;
                  end;
                  suppose
A104:               len mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),
                    indx(D2,D1,j))=2;
A105:               mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)).1 =lower_volume(f,D2).(indx(D2,D1,j1)+1) by A88,A89,A82,A90,FINSEQ_6:118;
A106:               2+(indx(D2,D1,j1)+1)>=0+1 by XREAL_1:7;
                    mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)).2 =LVf(D2).(2+(indx(D2,D1,j1)+1)-'1) by A53,A88,A89,A82,A90,A104,
FINSEQ_6:118
                      .=LVf(D2).(2+(indx(D2,D1,j1)+1)-1) by A106,XREAL_1:233
                      .=LVf(D2).(indx(D2,D1,j1)+(1+1));
                    then mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)) =<*lower_volume(f,D2).(indx(D2,D1,j1)+1), lower_volume(f,D2).(indx(D2,D1,
                    j1)+2)*> by A104,A105,FINSEQ_1:44;
                    then
A107:               Sum mid(lower_volume(f,D2),(indx(D2,D1,j1)+1),indx(
D2,D1,j)) =lower_volume(f,D2).(indx(D2,D1,j1)+1) +lower_volume(f,D2).(indx(D2,
                    D1,j1)+2) by RVSUM_1:77;
A108:               vol(divset(D2,indx(D2,D1,j1)+1))>=0 by INTEGRA1:9;
                    upper_bound divset(D1,j)=D1.j by A42,A44,INTEGRA1:def 4;
                    then
A109:               upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A13,A42,
INTEGRA1:def 19;
A110:               vol(divset(D2,indx(D2,D1,j1)+2))>=0 by INTEGRA1:9;
                    indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A53,A88,A89,A82
,A90,A104,FINSEQ_6:118;
                    then
A111:               indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1=2 by A53,XREAL_1:233;
                    then
A112:               indx (D2,D1,j1)+2 in dom D2 by A13,A42,INTEGRA1:def 19;
                    lower_bound divset(D1,j)=D1.j1 by A42,A44,INTEGRA1:def 4;
                    then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A13,A45,
INTEGRA1:def 19;
                    then
A113:               vol(divset(D1,j)) =D2.(indx(D2,D1,j1)+2)-D2.(indx(D2
,D1,j1)+1) +D2.(indx(D2,D1,j1)+1)-D2.indx(D2,D1,j1) by A109,A111,INTEGRA1:def 5
;
                    indx(D2,D1,j1)+1 in Seg len lower_volume(f,D2) by A82,A90,
FINSEQ_1:1;
                    then indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 7;
                    then
A114:               indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
A115:               indx(D2,D1,j1)+1 <> 1 by A50,NAT_1:13;
                    then
A116:               upper_bound divset(D2,(indx( D2,D1,j1)+1))= D2.(indx
                    (D2,D1,j1)+1) by A114,INTEGRA1:def 4;
                    indx(D2,D1,j1)+1-1=indx(D2,D1,j1)+0;
                    then
A117:               lower_bound divset(D2,(indx(D2,D1,j1)+1))= D2.indx(
                    D2,D1,j1) by A114,A115,INTEGRA1:def 4;
A118:               indx(D2,D1,j1)+1+1 > 1 by A82,NAT_1:13;
                    indx(D2,D1,j1)+2-1=indx(D2,D1,j1)+1;
                    then
A119:               lower_bound divset(D2,(indx(D2,D1,j1)+2))= D2.(indx(
                    D2,D1,j1)+1) by A112,A118,INTEGRA1:def 4;
                    upper_bound divset(D2,(indx(D2,D1,j1)+2))= D2.(indx(
                    D2,D1,j1)+2) by A112,A118,INTEGRA1:def 4;
                    then vol(divset(D1,j)) =vol(divset(D2,indx(D2,D1,j1)+2))
+D2.(indx(D2,D1,j1)+1)-D2.indx(D2,D1,j1) by A119,A113,INTEGRA1:def 5
                      .=vol(divset(D2,indx(D2,D1,j1)+2)) +(upper_bound
divset(D2,indx(D2,D1,j1)+1)-lower_bound divset(D2,indx(D2,D1,j1)+1)) by A117
,A116;
                    then
A120:               vol(divset(D1,j)) =vol(divset(D2,indx(D2,D1,j1)+1))+
                    vol(divset(D2,indx(D2,D1,j1)+2)) by INTEGRA1:def 5;
                    then
A121:               lower_volume(f,D1).j=(lower_bound(rng(f| divset(D1,j
))))* (vol(divset(D2,indx(D2,D1,j1)+1))+vol(divset(D2,indx(D2,D1,j1)+2))) by
A42,INTEGRA1:def 7;
A122:               Sum mid(LVf(D2),indx(D2,D1,j1)+1,indx(D2,D1,j))-Sum
mid(LVf(D1) ,j,j) <=(upper_bound rng f - lower_bound rng f)*(vol(divset(D2,
                    indx(D2,D1,j1)+2)) +vol(divset(D2,indx(D2,D1,j1)+1)))
                    proof
                      set ID2=indx(D2,D1,j1)+2;
                      set ID1=indx(D2,D1,j1)+1;
                      set B = vol(divset(D2,ID1));
                      set C = vol(divset(D2,ID2));
                      divset(D1,j) c=A by A42,INTEGRA1:8;
                      then
A123:                 lower_bound rng(f|divset(D1,j)) >= lower_bound rng
                      f by A1,Lm4;
                      ID1 in dom D2 by A91,FINSEQ_1:def 3;
                      then divset(D2,ID1)c=A by INTEGRA1:8;
                      then lower_bound rng(f|divset(D2,ID1)) <= upper_bound
                      rng f by A1,Lm4;
                      then
A124:                 (lower_bound rng(f|divset(D2,ID1)))* vol(divset(D2
,ID1)) <=(upper_bound rng f)*vol(divset(D2,ID1)) by A108,XREAL_1:64;
                      indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A53,A88,A89,A82
,A90,A104,FINSEQ_6:118;
                      then
A125:                 indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1=2 by A53,XREAL_1:233;
A126:                 indx(D2,D1,j) in dom D2 by A13,A42,INTEGRA1:def 19;
                      then divset(D2,ID2)c=A by A125,INTEGRA1:8;
                      then
A127:                 lower_bound rng(f|divset(D2,ID2)) <= upper_bound
                      rng f by A1,Lm4;
                      reconsider A = lower_bound(rng(f|divset(D1,j))) as Real;
A128:                 lower_volume(f,D1).j-A*B=A*C by A121;
                      (lower_bound rng(f|divset(D1,j)))*vol( divset(D2,
ID2)) >=(lower_bound rng f)*vol(divset(D2,ID2)) by A110,A123,XREAL_1:64;
                      then Sum mid(LVf(D1),j,j)>=(lower_bound rng(f|divset(D1
,j)))* vol(divset(D2, ID1)) +(lower_bound rng f)*vol(divset(D2,ID2)) by A86
,A128,XREAL_1:19;
                      then
A129:                 Sum mid(LVf(D1),j,j)-(lower_bound rng f)* vol(
divset(D2,ID2) ) >=(lower_bound rng(f|divset(D1,j)))*vol(divset(D2,ID1)) by
XREAL_1:19;
                      (lower_bound rng(f|divset(D1,j)))*vol(divset(D2,
ID1)) >=(lower_bound rng f)*vol(divset(D2,ID1)) by A108,A123,XREAL_1:64;
                      then Sum mid(LVf(D1),j,j)-(lower_bound rng f)* vol(
divset(D2,ID2) ) >=(lower_bound rng f)*vol(divset(D2,ID1)) by A129,XXREAL_0:2;
                      then
A130:                 Sum mid(LVf(D1),j,j) >=(lower_bound rng f)*vol(
divset(D2,ID2))+(lower_bound rng f)* vol(divset(D2,ID1)) by XREAL_1:19;
                      Sum mid(LVf(D2),(indx(D2,D1,j1)+1),indx(D2,D1,j))
=(lower_bound rng(f|divset(D2,indx(D2,D1,j1)+2))) *vol(divset(D2,indx(D2,D1,j1)
+2)) +LVf(D2).(indx(D2,D1,j1)+1) by A107,A126,A125,INTEGRA1:def 7
                        .=(lower_bound rng(f|divset(D2,indx(D2,D1,j1)+2))) *
vol(divset(D2,indx(D2,D1,j1)+2)) +(lower_bound rng(f|divset(D2,indx(D2,D1,j1)+1
))) *vol(divset(D2,indx(D2,D1,j1)+1)) by A92,INTEGRA1:def 7;
                      then Sum mid(LVf(D2),ID1,indx(D2,D1,j)) -(lower_bound
rng(f|divset(D2,ID1)))*vol(divset(D2,ID1)) <=(upper_bound rng f)*vol(divset(D2,
                      ID2)) by A110,A127,XREAL_1:64;
                      then Sum mid(LVf(D2),ID1,indx(D2,D1,j)) <=(upper_bound
rng f)*vol(divset(D2,ID2)) +(lower_bound rng(f|divset(D2,ID1)))*vol(divset(D2,
                      ID1)) by XREAL_1:20;
                      then Sum mid(LVf(D2),ID1,indx(D2,D1,j))-(upper_bound
rng f)* vol(divset(D2, ID2)) <=(lower_bound rng(f|divset(D2,ID1)))*vol(divset(
                      D2,ID1)) by XREAL_1:20;
                      then Sum mid(LVf(D2),ID1,indx(D2,D1,j))-(upper_bound
rng f)* vol(divset(D2, ID2)) <=(upper_bound rng f)*vol(divset(D2,ID1)) by A124,
XXREAL_0:2;
                      then Sum mid(LVf(D2),ID1,indx(D2,D1,j))<=(upper_bound
rng f)*vol(divset(D2,ID2 ))+ (upper_bound rng f)*vol(divset(D2,ID1)) by
XREAL_1:20;
                      then Sum mid(LVf(D2),ID1,indx(D2,D1,j))-Sum mid(LVf(D1)
,j,j) <=(upper_bound rng f)*vol(divset(D2,ID2))+(upper_bound rng f)* vol(divset
(D2,ID1)) -((lower_bound rng f)*vol(divset(D2,ID2))+(lower_bound rng f)* vol(
                      divset(D2,ID1))) by A130,XREAL_1:13;
                      hence thesis;
                    end;
                    upper_bound rng f - lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
                    then (upper_bound rng f - lower_bound rng f)*( vol(divset
(D1,j))) <=(upper_bound rng f - lower_bound rng f)*delta(D1) by A42,Lm5,
XREAL_1:64;
                    hence thesis by A120,A122,XXREAL_0:2;
                  end;
                end;
                hence thesis;
              end;
              j < j+1 by NAT_1:13;
              then
A131:         j1 < j by XREAL_1:19;
              indx(D2,D1,j) in dom D2 by A13,A42,INTEGRA1:def 19;
              then
A132:         indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
              then
A133:         1 <= indx(D2,D1,j) by FINSEQ_1:1;
A134:         indx(D2,D1,j1) <= len D2 by A49,FINSEQ_1:1;
              then
A135:         len (D2|indx(D2,D1,j1))=indx(D2,D1,j1) by FINSEQ_1:59;
A136:         j1 in Seg len D1 by A47,FINSEQ_1:def 3;
              then
A137:         j1 <= len D1 by FINSEQ_1:1;
              for x1 being object st x1 in rng(D1|j1)
               holds x1 in rng(D2|indx(D2,D1,j1))
              proof
                let x1 be object;
                assume x1 in rng(D1|j1);
                then consider k such that
A138:           k in dom(D1|j1) and
A139:           x1=(D1|j1).k by PARTFUN1:3;
                k in Seg len(D1|j1) by A138,FINSEQ_1:def 3;
                then
A140:           k in Seg j1 by A137,FINSEQ_1:59;
                then
A141:           k in dom D1 by A45,RFINSEQ:6;
                k <= j1 by A140,FINSEQ_1:1;
                then D1.k <= D1.j1 by A47,A141,SEQ_4:137;
                then D2.indx(D2,D1,k) <= D1.j1 by A13,A141,INTEGRA1:def 19;
                then
A142:           D2.indx(D2,D1,k)<=D2.indx(D2,D1,j1) by A13,A47,INTEGRA1:def 19;
A143:           (D1|j1).k = D1.k by A45,A140,RFINSEQ:6;
                D1.k in rng D1 by A141,FUNCT_1:def 3;
                then x1 in rng D2 by A14,A139,A143,XBOOLE_0:def 3;
                then consider n such that
A144:           n in dom D2 and
A145:           x1=D2.n by PARTFUN1:3;
                D2.indx(D2,D1,k)=D2.n by A13,A139,A143,A141,A145,
INTEGRA1:def 19;
                then
A146:           n <= indx(D2,D1,j1) by A48,A144,A142,SEQM_3:def 1;
                1 <= n by A144,FINSEQ_3:25;
                then
A147:           n in Seg indx(D2,D1,j1) by A146,FINSEQ_1:1;
                then n in Seg len(D2|indx(D2,D1,j1)) by A134,FINSEQ_1:59;
                then
A148:           n in dom(D2|indx(D2,D1,j1)) by FINSEQ_1:def 3;
                D2.n = (D2|indx(D2,D1,j1)).n by A48,A147,RFINSEQ:6;
                hence thesis by A145,A148,FUNCT_1:def 3;
              end;
              then
A149:         rng(D1|j1) c= rng(D2|indx(D2,D1,j1));
A150:         1 <= j1 by A136,FINSEQ_1:1;
              lower_bound divset(D1,j) <= D.1 by A43,INTEGRA2:1;
              then
A151:         D1.j1 <= D.1 by A42,A44,INTEGRA1:def 4;
              for x1 being object st x1 in rng(D2|indx(D2,D1,j1))
                holds x1 in rng(D1|j1)
              proof
                let x1 be object;
                assume x1 in rng(D2|indx(D2,D1,j1));
                then consider k such that
A152:           k in dom(D2|indx(D2,D1,j1)) and
A153:           x1=(D2|indx(D2,D1,j1)).k by PARTFUN1:3;
                k in Seg len(D2|indx(D2,D1,j1)) by A152,FINSEQ_1:def 3;
                then
A154:           k in Seg indx(D2,D1,j1) by A134,FINSEQ_1:59;
                then
A155:           k in dom D2 by A48,RFINSEQ:6;
A156:           len(D1|j1) = j1 by A137,FINSEQ_1:59;
                k <= indx(D2,D1,j1) by A154,FINSEQ_1:1;
                then D2.k <= D2.indx(D2,D1,j1) by A48,A155,SEQ_4:137;
                then
A157:           D2.k <= D1.j1 by A13,A47,INTEGRA1:def 19;
A158:           D2.k in rng D1 implies D2.k in rng(D1|j1)
                proof
                  assume D2.k in rng D1;
                  then consider m such that
A159:             m in dom D1 and
A160:             D2.k = D1.m by PARTFUN1:3;
                  m in Seg len D1 by A159,FINSEQ_1:def 3;
                  then
A161:             1 <= m by FINSEQ_1:1;
A162:             m <= j1 by A45,A157,A159,A160,SEQM_3:def 1;
                  then m in Seg j1 by A161,FINSEQ_1:1;
                  then
A163:             D2.k = (D1|j1).m by A45,A160,RFINSEQ:6;
                  m in dom (D1|j1) by A156,A161,A162,FINSEQ_3:25;
                  hence thesis by A163,FUNCT_1:def 3;
                end;
A164:           D2.k in rng D implies D2.k = D1.j1
                proof
                  assume D2.k in rng D;
                  then consider n such that
A165:             n in dom D and
A166:             D2.k=D.n by PARTFUN1:3;
                  1 <= n by A165,FINSEQ_3:25;
                  then D.1 <= D2.k by A41,A165,A166,SEQ_4:137;
                  then D1.j1 <= D2.k by A151,XXREAL_0:2;
                  hence thesis by A157,XXREAL_0:1;
                end;
A167:           D2.k in rng D implies D2.k in rng(D1|j1)
                proof
                  j1 in Seg len(D1|j1) by A150,A156,FINSEQ_1:1;
                  then j1 in dom(D1|j1) by FINSEQ_1:def 3;
                  then
A168:             (D1|j1).j1 in rng(D1|j1) by FUNCT_1:def 3;
                  assume
A169:             D2.k in rng D;
                  j1 in Seg j1 by A150,FINSEQ_1:1;
                  hence thesis by A45,A164,A169,A168,RFINSEQ:6;
                end;
                D2.k in rng D2 by A155,FUNCT_1:def 3;
                hence thesis by A14,A48,A153,A154,A167,A158,RFINSEQ:6
,XBOOLE_0:def 3;
              end;
              then rng(D2|indx(D2,D1,j1)) c= rng (D1|j1);
              then
A170:         rng (D2|indx(D2,D1,j1)) = rng (D1|j1) by A149,XBOOLE_0:def 10;
              mid(D1,1,j1) is increasing by A42,A44,A150,INTEGRA1:7,35;
              then
A171:         D1|j1 is increasing by A150,FINSEQ_6:116;
              then
A172:         D2|indx(D2,D1,j1)=D1|j1 by A51,A170,Th6;
A173:         for k st 1 <= k & k <= j1 holds k=indx(D2,D1,k)
              proof
                let k;
                assume that
A174:           1 <= k and
A175:           k <= j1;
                assume
A176:           k<>indx(D2,D1,k);
                now
                  per cases by A176,XXREAL_0:1;
                  suppose
A177:               k > indx(D2,D1,k);
                    k <= len D1 by A137,A175,XXREAL_0:2;
                    then
A178:               k in dom D1 by A174,FINSEQ_3:25;
                    then indx(D2,D1,k) in dom D2 by A13,INTEGRA1:def 19;
                    then indx(D2,D1,k) in Seg len D2 by FINSEQ_1:def 3;
                    then
A179:               1<=indx(D2,D1,k) by FINSEQ_1:1;
A180:               indx(D2,D1,k) < j1 by A175,A177,XXREAL_0:2;
                    then
A181:               indx(D2,D1,k) in Seg j1 by A179,FINSEQ_1:1;
                    indx(D2,D1,k)<= indx(D2,D1,j1) by A13,A45,A175,A178,Th7;
                    then indx(D2,D1,k) in Seg indx(D2,D1,j1) by A179,FINSEQ_1:1
;
                    then
A182:               (D2|indx(D2,D1,j1)).indx(D2,D1,k)= D2.indx(D2,D1,k)
                    by A48,RFINSEQ:6;
                    indx(D2,D1,k) <= len D1 by A137,A180,XXREAL_0:2;
                    then indx(D2,D1,k) in dom D1 by A179,FINSEQ_3:25;
                    then
A183:               D1.k > D1.indx(D2,D1,k) by A177,A178,SEQM_3:def 1;
                    D1.k=D2. indx(D2,D1,k) by A13,A178,INTEGRA1:def 19;
                    hence contradiction by A45,A172,A182,A183,A181,RFINSEQ:6;
                  end;
                  suppose
A184:               k < indx(D2,D1,k);
                    k <= len D1 by A137,A175,XXREAL_0:2;
                    then
A185:               k in dom D1 by A174,FINSEQ_3:25;
                    then indx(D2,D1,k) <= indx(D2,D1,j1) by A13,A45,A175,Th7;
                    then
A186:               k <= indx(D2,D1,j1) by A184,XXREAL_0:2;
                    then k <= len D2 by A134,XXREAL_0:2;
                    then
A187:               k in dom D2 by A174,FINSEQ_3:25;
                    k in Seg j1 by A174,A175,FINSEQ_1:1;
                    then
A188:               D1.k = (D1|j1).k by A47,RFINSEQ:6;
                    indx(D2,D1,k) in dom D2 by A13,A185,INTEGRA1:def 19;
                    then
A189:               D2.k < D2.indx(D2,D1,k) by A184,A187,SEQM_3:def 1;
A190:               k in Seg indx(D2,D1,j1) by A174,A186,FINSEQ_1:1;
                    D1.k=D2. indx(D2,D1,k) by A13,A185,INTEGRA1:def 19;
                    hence contradiction by A48,A172,A188,A189,A190,RFINSEQ:6;
                  end;
                end;
                hence contradiction;
              end;
A191:         for k be Nat st 1 <= k & k <= len(lower_volume(f,D1)|j1)
holds (lower_volume(f,D1)|j1).k = (lower_volume(f,D2)|indx(D2,D1,j1)).k
              proof
                indx(D2,D1,j1) in Seg len D2 by A48,FINSEQ_1:def 3;
                then indx(D2,D1,j1) in Seg len lower_volume(f,D2) by
INTEGRA1:def 7;
                then
A192:           indx(D2,D1,j1) in dom lower_volume(f,D2) by FINSEQ_1:def 3;
                let k be Nat;
                assume that
A193:           1 <= k and
A194:           k <= len(lower_volume(f,D1)|j1);
                reconsider k as Element of NAT by ORDINAL1:def 12;
A195:           len(lower_volume(f,D1)) = len D1 by INTEGRA1:def 7;
                then
A196:           k <= j1 by A137,A194,FINSEQ_1:59;
                then k <= len D1 by A137,XXREAL_0:2;
                then
A197:           k in Seg len D1 by A193,FINSEQ_1:1;
                then
A198:           k in dom D1 by FINSEQ_1:def 3;
                then
A199:           indx(D2,D1,k) in dom D2 by A13,INTEGRA1:def 19;
A200:           k in Seg j1 by A193,A196,FINSEQ_1:1;
                then indx(D2,D1,k) in Seg j1 by A173,A193,A196;
                then
A201:           indx(D2,D1,k) in Seg indx(D2,D1,j1) by A150,A173;
                then indx(D2,D1,k)<=indx(D2,D1,j1) by FINSEQ_1:1;
                then
A202:           indx(D2,D1,k)<=len D2 by A134,XXREAL_0:2;
A203:           D1.k=D2.indx (D2,D1,k) by A13,A198,INTEGRA1:def 19;
A204:           lower_bound divset(D1,k)= lower_bound divset(D2,indx(D2,
D1,k)) & upper_bound divset(D1,k)=upper_bound divset(D2,indx(D2,D1,k))
                proof
                  per cases;
                  suppose
A205:               k=1;
                    then
A206:               upper_bound divset(D1,k)=D1.k by A198,INTEGRA1:def 4;
A207:               lower_bound divset(D1,k)= lower_bound A by A198,A205,
INTEGRA1:def 4;
                    indx(D2,D1,k)=1 by A150,A173,A205;
                    hence thesis by A199,A203,A207,A206,INTEGRA1:def 4;
                  end;
                  suppose
A208:               k<>1;
                    then reconsider k1=k-1 as Element of NAT by A198,INTEGRA1:7
;
                    k <= k+1 by NAT_1:11;
                    then k1 <= k by XREAL_1:20;
                    then
A209:               k1 <= j1 by A196,XXREAL_0:2;
A210:               k-1 in dom D1 by A198,A208,INTEGRA1:7;
                    then k1 in Seg len D1 by FINSEQ_1:def 3;
                    then 1 <= k1 by FINSEQ_1:1;
                    then k1=indx(D2,D1,k1) by A173,A209;
                    then
A211:               D2.(indx(D2,D1,k)-1)= D2.indx(D2,D1,k1) by A173,A193,A196;
A212:               indx(D2,D1,k)<>1 by A173,A193,A196,A208;
                    then
A213:               lower_bound divset(D2,indx(D2,D1,k))= D2.(indx(D2,D1
                    ,k)-1) by A199,INTEGRA1:def 4;
A214:               upper_bound divset(D2,indx(D2,D1,k))=D2.indx(D2,D1,k
                    ) by A199,A212,INTEGRA1:def 4;
A215:               upper_bound divset(D1,k)=D1.k by A198,A208,INTEGRA1:def 4;
                    lower_bound divset(D1,k)=D1.(k-1) by A198,A208,
INTEGRA1:def 4;
                    hence thesis by A13,A198,A215,A210,A213,A214,A211,
INTEGRA1:def 19;
                  end;
                end;
                divset(D2,indx(D2,D1,k))= [. lower_bound divset(D2,indx(
D2,D1,k)), upper_bound divset(D2,indx(D2,D1,k)).] by INTEGRA1:4;
                then
A216:           divset(D1,k)=divset(D2,indx(D2,D1,k)) by A204,INTEGRA1:4;
A217:           k in dom D1 by A197,FINSEQ_1:def 3;
                j1 in Seg len(lower_volume(f,D1)) by A45,A195,FINSEQ_1:def 3;
                then j1 in dom(lower_volume(f,D1)) by FINSEQ_1:def 3;
                then
A218:           (lower_volume(f,D1)|j1).k = lower_volume(f,D1).k by A200,
RFINSEQ:6
                  .=(lower_bound(rng(f|divset(D2,indx(D2,D1,k)))))*vol(
                divset(D2,indx(D2,D1,k))) by A217,A216,INTEGRA1:def 7;
                1<=indx(D2,D1,k) by A173,A193,A196;
                then indx(D2,D1,k) in Seg len D2 by A202,FINSEQ_1:1;
                then
A219:           indx(D2,D1,k) in dom D2 by FINSEQ_1:def 3;
                (lower_volume(f,D2)|indx(D2,D1,j1)).k =(lower_volume(f,
                D2)|indx(D2,D1,j1)).indx(D2,D1,k) by A173,A193,A196
                  .=lower_volume(f,D2).indx(D2,D1,k) by A201,A192,RFINSEQ:6
                  .=(lower_bound(rng(f|divset(D2,indx(D2,D1,k)))))*vol(
                divset(D2,indx(D2,D1,k))) by A219,INTEGRA1:def 7;
                hence thesis by A218;
              end;
              indx(D2,D1,j1) in dom D2 by A13,A47,INTEGRA1:def 19;
              then indx(D2,D1,j1) <= len D2 by FINSEQ_3:25;
              then
A220:         indx(D2,D1,j1) <= len lower_volume(f,D2) by INTEGRA1:def 7;
              j1 <= len D1 by A47,FINSEQ_3:25;
              then
A221:         j1 <= len lower_volume(f,D1) by INTEGRA1:def 7;
              len (D2|indx(D2,D1,j1))=len (D1|j1) by A51,A171,A170,Th6;
              then indx(D2,D1,j1) =j1 by A137,A135,FINSEQ_1:59;
              then len(lower_volume(f,D1)|j1)=indx(D2,D1,j1) by A221,
FINSEQ_1:59;
              then len(lower_volume(f,D1)|j1)=len(lower_volume(f, D2)|indx(D2
              ,D1,j1)) by A220,FINSEQ_1:59;
              then
A222:         lower_volume(f,D2)|indx(D2,D1,j1)=lower_volume (f,D1)|j1
              by A191,FINSEQ_1:14;
A223:         j in Seg len D1 by A42,FINSEQ_1:def 3;
              then
A224:         1 <= j by FINSEQ_1:1;
              indx(D2,D1,j) in Seg len LVf(D2) by A132,INTEGRA1:def 7;
              then
A225:         indx(D2,D1,j) in dom LVf(D2) by FINSEQ_1:def 3;
              indx(D2,D1,j) <= len D2 by A132,FINSEQ_1:1;
              then
A226:         indx(D2,D1,j) <= len LVf(D2) by INTEGRA1:def 7;
              j in Seg len LVf(D1) by A223,INTEGRA1:def 7;
              then
A227:         j in dom LVf(D1) by FINSEQ_1:def 3;
              j <= len D1 by A223,FINSEQ_1:1;
              then
A228:         j <= len LVf(D1) by INTEGRA1:def 7;
              j1 in Seg len D1 by A45,FINSEQ_1:def 3;
              then j1 in Seg len LVf(D1) by INTEGRA1:def 7;
              then j1 in dom LVf(D1) by FINSEQ_1:def 3;
              then PLf(D1,j1)=Sum(LVf(D1)|j1) by INTEGRA1:def 20;
              then PLf(D1,j1)+Sum mid(LVf(D1),j,j) =Sum((LVf(D1)|j1)^mid(LVf(
              D1),j,j)) by RVSUM_1:75
                .=Sum(mid(LVf(D1),1,j1)^mid(LVf(D1),j1+1,j)) by A150,
FINSEQ_6:116
                .=Sum(mid(LVf(D1),1,j)) by A150,A228,A131,INTEGRA2:4
                .=Sum(LVf(D1)|j) by A224,FINSEQ_6:116;
              then
A229:         PLf(D1,j1)+Sum mid(lower_volume(f,D1),j,j)=PLf(D1,j) by A227,
INTEGRA1:def 20;
              indx(D2,D1,j1) in Seg len D2 by A48,FINSEQ_1:def 3;
              then indx(D2,D1,j1) in Seg len LVf(D2) by INTEGRA1:def 7;
              then indx(D2,D1,j1) in dom LVf(D2) by FINSEQ_1:def 3;
              then PLf(D2,indx(D2,D1,j1)) =Sum(LVf(D2)|indx(D2,D1,j1)) by
INTEGRA1:def 20;
              then PLf(D2,indx(D2,D1,j1)) +Sum mid(lower_volume(f,D2),(indx(
D2,D1,j1)+1),indx(D2,D1,j)) =Sum(LVf(D2)|indx(D2,D1,j1) ^mid(LVf(D2),(indx(D2,
              D1,j1)+1),indx(D2,D1,j))) by RVSUM_1:75
                .=Sum(mid(LVf(D2),1,indx(D2,D1,j1)) ^mid(LVf(D2),indx(D2,D1,
              j1)+1,indx(D2,D1,j))) by A50,FINSEQ_6:116
                .=Sum(mid(LVf(D2),1,indx(D2,D1,j))) by A50,A52,A226,INTEGRA2:4
                .=Sum(LVf(D2)|indx(D2,D1,j)) by A133,FINSEQ_6:116;
              then
A230:         PLf(D2,indx(D2,D1,j1)) +Sum mid(lower_volume(f,D2),(indx(
D2,D1,j1)+1), indx(D2,D1,j)) =PLf(D2,indx(D2,D1,j)) by A225,INTEGRA1:def 20;
              indx(D2,D1,j1) in Seg len D2 by A48,FINSEQ_1:def 3;
              then indx(D2,D1,j1) in Seg len lower_volume(f,D2) by
INTEGRA1:def 7;
              then indx(D2,D1,j1) in dom lower_volume(f,D2) by FINSEQ_1:def 3;
              then PLf(D2,indx(D2,D1,j1))=Sum(lower_volume(f,D2)|indx(D2,D1,
              j1)) by INTEGRA1:def 20
                .=PLf(D1,j1) by A222,A46,INTEGRA1:def 20;
              hence thesis by A54,A230,A229;
            end;
            hence thesis by A42,A43;
          end;
          reconsider i as non zero Element of NAT by A18,FINSEQ_1:1;
A231:     for i being non zero Nat st P[i] holds P[i+1]
          proof
            let i be non zero Nat;
A232:       i>=1 by NAT_1:14;
            assume
A233:       P[i];
            P[i+1]
            proof
A234:         i <= i+1 by NAT_1:11;
              assume
A235:         i+1 in dom D;
              then consider j such that
A236:         j in dom D1 and
A237:         D.(i+1) in divset(D1,j) by Th3,INTEGRA1:6;
A238:         D2.indx(D2,D1,j)=D1.j by A13,A236,INTEGRA1:def 19;
              i+1 <= len D by A235,FINSEQ_3:25;
              then i <= len D by A234,XXREAL_0:2;
              then
A239:         i in Seg len D by A232,FINSEQ_1:1;
              then
A240:         i in dom D by FINSEQ_1:def 3;
              consider n1 being Element of NAT such that
A241:         n1 in dom D1 and
A242:         D.i in divset(D1,n1) and
A243:         PLf(D2,indx(D2,D1,n1))-PLf(D1,n1)<=i*(upper_bound rng
              f- lower_bound rng f)*delta(D1) by A233,A239,FINSEQ_1:def 3;
A244:         1 <= n1+1 by NAT_1:12;
A245:         n1 < j
              proof
                assume
A246:           n1 >= j;
                now
                  per cases by A246,XXREAL_0:1;
                  suppose
A247:               n1=j;
                    D.i in rng D by A240,FUNCT_1:def 3;
                    then
A248:               D.i in rng D /\ divset(D1,j) by A242,A247,XBOOLE_0:def 4;
                    D.(i+1) in rng D by A235,FUNCT_1:def 3;
                    then
A249:               D.(i+1) in rng D /\ divset(D1,j) by A237,XBOOLE_0:def 4;
                    i+1 > i by XREAL_1:29;
                    hence contradiction by A11,A235,A236,A240,A248,A249,Th5,
SEQ_4:138;
                  end;
                  suppose
                    n1>j;
                    then
A250:               n1>=j+1 by NAT_1:13;
                    then
A251:               n1-1 >= j by XREAL_1:19;
                    1 <= j by A236,FINSEQ_3:25;
                    then 1+1 <= j+1 by XREAL_1:6;
                    then
A252:               n1 <> 1 by A250,XXREAL_0:2;
                    lower_bound divset(D1,n1) <= D.i by A242,INTEGRA2:1;
                    then
A253:               D.i >= D1.(n1-1) by A241,A252,INTEGRA1:def 4;
                    n1-1 in dom D1 by A241,A252,INTEGRA1:7;
                    then D1.j <= D1.(n1-1) by A236,A251,SEQ_4:137;
                    then
A254:               D.i >= D1.j by A253,XXREAL_0:2;
A255:               i < i+1 by XREAL_1:29;
A256:               upper_bound divset(D1,j)=D1.j
                    proof
                      per cases;
                      suppose
                        j=1;
                        hence thesis by A236,INTEGRA1:def 4;
                      end;
                      suppose
                        j<>1;
                        hence thesis by A236,INTEGRA1:def 4;
                      end;
                    end;
                    D.(i+1)<=upper_bound divset(D1,j) by A237,INTEGRA2:1;
                    then D.i >= D.(i+1) by A256,A254,XXREAL_0:2;
                    hence contradiction by A235,A240,A255,SEQM_3:def 1;
                  end;
                end;
                hence thesis;
              end;
              then
A257:         n1+1 <= j by NAT_1:13;
A258:         1 <= n1 by A241,FINSEQ_3:25;
A259:         indx(D2,D1,n1) in dom D2 by A13,A241,INTEGRA1:def 19;
              then
A260:         1 <= indx(D2,D1,n1) by FINSEQ_3:25;
A261:         indx(D2,D1,j) in dom D2 by A13,A236,INTEGRA1:def 19;
              then
A262:         1 <= indx(D2,D1,j) by FINSEQ_3:25;
A263:         indx(D2,D1,j) <= len D2 by A261,FINSEQ_3:25;
              then
A264:         indx(D2,D1,j) <= len LVf(D2) by INTEGRA1:def 7;
A265:         1 <= j by A236,FINSEQ_3:25;
A266:         j <= len D1 by A236,FINSEQ_3:25;
              then
A267:         n1+1 <= len D1 by A257,XXREAL_0:2;
              then
A268:         n1+1 in dom D1 by A244,FINSEQ_3:25;
              then
A269:         indx(D2,D1,n1+1) in dom D2 by A13,INTEGRA1:def 19;
              then
A270:         1 <= indx(D2,D1,n1+1) by FINSEQ_3:25;
A271:         D2.indx(D2,D1,n1+ 1)=D1.(n1+1) by A13,A268,INTEGRA1:def 19;
              then D2.indx(D2,D1,n1+1) <= D2.indx(D2,D1,j) by A236,A257,A268
,A238,SEQ_4:137;
              then
A272:         indx(D2,D1,n1+1) <= indx(D2,D1,j) by A269,A261,SEQM_3:def 1;
              then 1+indx(D2,D1,n1+1) <= indx(D2,D1,j)+1 by XREAL_1:6;
              then 1 <= indx(D2,D1,j)+1-indx(D2,D1,n1+1) by XREAL_1:19;
              then
A273:         mid(D2,indx(D2,D1,n1+1),indx(D2,D1,j)).1 =D2.(1-1+indx(D2,
              D1,n1+1)) by A272,A270,A263,FINSEQ_6:122
                .=D1.(n1+1) by A13,A268,INTEGRA1:def 19;
A274:         D2.indx(D2,D1,n1) = D1.n1 by A13,A241,INTEGRA1:def 19;
A275:         j <= len LVf(D1) by A266,INTEGRA1:def 7;
              then j in Seg len LVf(D1) by A265,FINSEQ_1:1;
              then
A276:         j in dom LVf(D1) by FINSEQ_1:def 3;
A277:         indx(D2,D1,n1+1) <= len D2 by A269,FINSEQ_3:25;
              n1 in Seg len D1 by A241,FINSEQ_1:def 3;
              then n1 in Seg len LVf(D1) by INTEGRA1:def 7;
              then n1 in dom LVf(D1) by FINSEQ_1:def 3;
              then PLf(D1,n1)=Sum(LVf(D1)|n1) by INTEGRA1:def 20
                .=Sum mid(LVf(D1),1,n1) by A258,FINSEQ_6:116;
              then PLf(D1,n1)+Sum mid(LVf(D1),n1+1,j) =Sum(mid(LVf(D1),1,n1)
              ^mid(LVf(D1),n1+1,j)) by RVSUM_1:75
                .=Sum mid(LVf(D1),1,j) by A245,A258,A275,INTEGRA2:4
                .=Sum(LVf(D1)|j) by A265,FINSEQ_6:116;
              then
A278:         PLf(D1,j)=PLf(D1,n1)+Sum mid(LVf(D1),n1+1,j) by A276,
INTEGRA1:def 20;
              indx(D2,D1,j) in Seg len D2 by A261,FINSEQ_1:def 3;
              then indx(D2,D1,j) in Seg len LVf(D2) by INTEGRA1:def 7;
              then
A279:         indx(D2,D1,j) in dom LVf(D2) by FINSEQ_1:def 3;
A280:         n1 >= 1 by A241,FINSEQ_3:25;
A281:         j-n1 >= 1 by A257,XREAL_1:19;
              Sum mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) -Sum mid(
LVf(D1),n1+1,j) <= (upper_bound rng f-lower_bound rng f)*delta(D1)
              proof
                now
                  per cases by A257,XXREAL_0:1;
                  suppose
A282:               n1+1=j;
A283:               indx(D2,D1,j)-indx(D2,D1,n1)<=2
                    proof
A284:                 upper_bound divset(D1,j) = D1.j by A236,A245,A280,
INTEGRA1:def 4;
A285:                 lower_bound divset(D1,j) = D1.(j-1) by A236,A245,A280,
INTEGRA1:def 4;
A286:                 1 <= indx(D2,D1,n1)+1 by A260,NAT_1:13;
                      assume indx(D2,D1,j) - indx(D2,D1,n1) > 2;
                      then
A287:                 indx(D2,D1,n1)+2 < indx(D2,D1, j) by XREAL_1:20;
                      then
A288:                 indx(D2,D1,n1)+2 <= len D2 by A263,XXREAL_0:2;
A289:                 indx(D2,D1,n1)+1 < indx(D2,D1,n1)+2 by XREAL_1:6;
                      then
A290:                 indx(D2,D1,n1) < indx(D2,D1,n1)+2 by NAT_1:13;
                      then 1 <= indx(D2,D1,n1)+2 by A260,XXREAL_0:2;
                      then
A291:                 indx(D2,D1,n1)+2 in dom D2 by A288,FINSEQ_3:25;
                      then
A292:                 D2.indx(D2,D1,j) >= D2.(indx(D2,D1,n1)+2) by A261,A287,
SEQ_4:137;
A293:                 not D2.(indx(D2,D1,n1)+2) in rng D1
                      proof
                        assume D2.(indx(D2,D1,n1)+2) in rng D1;
                        then consider k1 being Element of NAT such that
A294:                   k1 in dom D1 and
A295:                   D2.(indx(D2,D1,n1)+2) = D1.k1 by PARTFUN1:3;
                        D2.(indx(D2,D1,n1)+2) < D2.indx(D2,D1,j) by A261,A287
,A291,SEQM_3:def 1;
                        then
A296:                   k1 < j by A236,A238,A294,A295,SEQ_4:137;
                        D2.indx(D2,D1,n1) < D2.(indx(D2,D1,n1)+2) by A259,A290
,A291,SEQM_3:def 1;
                        then n1 < k1 by A241,A274,A294,A295,SEQ_4:137;
                        hence contradiction by A282,A296,NAT_1:13;
                      end;
                      D2.(indx(D2,D1,n1)+2) in rng D2 by A291,FUNCT_1:def 3;
                      then
A297:                 D2.(indx(D2,D1,n1)+2) in rng D by A14,A293,XBOOLE_0:def 3
;
A298:                 lower_bound divset(D1,j) = D1.(j-1) by A236,A245,A280,
INTEGRA1:def 4;
A299:                 upper_bound divset(D1,j) = D1.j by A236,A245,A280,
INTEGRA1:def 4;
                      D2.(indx(D2,D1,n1)+2) >= D2.indx(D2,D1,n1) by A259,A290
,A291,SEQ_4:137;
                      then D2.(indx(D2,D1,n1)+2) in divset(D1,j) by A274,A238
,A282,A298,A284,A292,INTEGRA2:1;
                      then
A300:                 D2.(indx(D2,D1,n1)+2) in rng D /\ divset(D1,j) by A297,
XBOOLE_0:def 4;
A301:                 indx(D2,D1,n1)+1 < indx(D2,D1,j) by A287,A289,XXREAL_0:2;
                      then indx(D2,D1,n1)+1 <= len D2 by A263,XXREAL_0:2;
                      then
A302:                 indx(D2,D1,n1)+1 in dom D2 by A286,FINSEQ_3:25;
                      then
A303:                 D2.indx(D2,D1,j) >= D2.(indx(D2,D1,n1)+1) by A261,A301,
SEQ_4:137;
A304:                 indx(D2,D1,n1) < indx(D2,D1,n1)+1 by NAT_1:13;
A305:                 not D2.(indx(D2,D1,n1)+1) in rng D1
                      proof
                        assume D2.(indx(D2,D1,n1)+1) in rng D1;
                        then consider k1 being Element of NAT such that
A306:                   k1 in dom D1 and
A307:                   D2.(indx(D2,D1,n1)+1) = D1.k1 by PARTFUN1:3;
                        D2.(indx(D2,D1,n1)+1) < D2.indx(D2,D1,j) by A261,A301
,A302,SEQM_3:def 1;
                        then
A308:                   k1 < j by A236,A238,A306,A307,SEQ_4:137;
                        D2.indx(D2,D1,n1) < D2.(indx(D2,D1,n1)+1) by A259,A304
,A302,SEQM_3:def 1;
                        then n1 < k1 by A241,A274,A306,A307,SEQ_4:137;
                        hence contradiction by A282,A308,NAT_1:13;
                      end;
                      D2.(indx(D2,D1,n1)+1) in rng D2 by A302,FUNCT_1:def 3;
                      then
A309:                 D2.(indx(D2,D1,n1)+1) in rng D by A14,A305,XBOOLE_0:def 3
;
                      D2.(indx(D2,D1,n1)+1) >= D2.indx(D2,D1,n1) by A259,A304
,A302,SEQ_4:137;
                      then D2.(indx(D2,D1,n1)+1) in divset(D1,j) by A274,A238
,A282,A285,A299,A303,INTEGRA2:1;
                      then D2.(indx(D2,D1,n1)+1) in rng D /\ divset(D1,j) by
A309,XBOOLE_0:def 4;
                      then D2.(indx(D2,D1,n1)+1) = D2.(indx(D2,D1,n1)+2) by A11
,A236,A300,Th5;
                      hence contradiction by A289,A302,A291,SEQM_3:def 1;
                    end;
A310:               indx(D2,D1,n1)+1<indx(D2,D1,j) implies indx(D2,D1,n1
                    )+2=indx(D2, D1, j )
                    proof
                      assume indx(D2,D1,n1)+1 < indx(D2,D1,j);
                      then
A311:                 indx(D2,D1,n1)+1+1 <= indx (D2,D1,j) by NAT_1:13;
                      indx(D2,D1,n1)+2 >= indx(D2,D1,j) by A283,XREAL_1:20;
                      hence thesis by A311,XXREAL_0:1;
                    end;
A312:               1<=indx(D2,D1,n1)+1 by NAT_1:12;
A313:               indx(D2,D1,j) <= len LVf(D2) by A263,INTEGRA1:def 7;
                    D1.n1 < D1.j by A236,A241,A245,SEQM_3:def 1;
                    then
A314:               indx(D2,D1,n1)<indx(D2,D1,j) by A259,A274,A261,A238,
SEQ_4:137;
                    then
A315:               indx(D2,D1,n1)+1 <= indx(D2,D1,j) by NAT_1:13;
                    then indx(D2,D1,n1)+1 <= len D2 by A263,XXREAL_0:2;
                    then indx(D2,D1,n1)+1 <= len LVf(D2) by INTEGRA1:def 7;
                    then
A316:               len mid(LVf(D2),indx(D2,D1,n1)+1, indx(D2,D1,j)) =
indx(D2,D1,j)-'(indx(D2,D1,n1)+1)+1 by A262,A315,A312,A313,FINSEQ_6:118
                      .=indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1 by A315,XREAL_1:233
                      .=indx(D2,D1,j)-indx(D2,D1,n1);
                    indx(D2,D1,n1)+1 <= indx(D2,D1,j) by A314,NAT_1:13;
                    then
A317:               indx(D2,D1,n1)+1 = indx(D2,D1, j) or indx(D2,D1,n1)+
                    1 < indx(D2,D1,j) by XXREAL_0:1;
A318:               Sum mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) <=(
                    upper_bound rng f)*vol(divset(D1,n1+1))
                    proof
                      per cases by A317,A310;
                      suppose
A319:                   indx(D2,D1,j)-indx(D2,D1,n1)=1;
A320:                   indx(D2,D1,n1)+1 > 1 by A260,NAT_1:13;
                        then upper_bound divset(D2,indx(D2,D1,n1)+1)=D2.(indx
                        (D2,D1,n1)+1) by A261,A319,INTEGRA1:def 4;
                        then
A321:                   upper_bound divset(D2,indx(D2,D1,n1)+1)=D1.j by A13
,A236,A319,INTEGRA1:def 19;
                        lower_bound divset(D2,indx(D2,D1,n1)+1)=D2.(indx
                        (D2,D1,n1)+1-1) by A261,A319,A320,INTEGRA1:def 4;
                        then
A322:                   lower_bound divset(D2,indx(D2, D1,n1)+1)=D1.n1
                        by A13,A241,INTEGRA1:def 19;
                        lower_bound divset(D1,n1+1)=D1.(n1+1-1) by A245,A280
,A268,A282,INTEGRA1:def 4;
                        then
A323:                   divset(D2,indx(D2,D1,n1)+1)=divset(D1,n1+1) by A245
,A280,A268,A282,A322,A321,INTEGRA1:def 4;
A324:                   vol(divset(D2,indx(D2,D1,n1)+1))>=0 by INTEGRA1:9;
        reconsider LV = LVf(D2).(indx(D2,D1,n1)+1) as Element of REAL
              by XREAL_0:def 1;
                        1=indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1 by A319;
                        then mid(LVf(D2),indx(D2,D1,n1) +1,indx(D2,D1,j)).1 =
LVf(D2).(1+(indx(D2,D1,n1)+1)-1) by A312,A313,FINSEQ_6:122
                          .=LVf(D2).(indx(D2,D1,n1)+1);
                        then
A325:                   mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))
            =<*LV*> by A316,A319,FINSEQ_1:40;
                        LVf(D2).(indx(D2,D1,n1)+1) =(lower_bound rng(f|
divset(D2,indx(D2,D1,n1)+1))) *vol(divset(D2,indx(D2,D1,n1)+1)) by A261,A319,
INTEGRA1:def 7;
                        then LVf(D2).(indx(D2,D1,n1)+1) <=(upper_bound rng f)
*vol(divset(D1,n1+1)) by A1,A261,A319,A323,A324,Th18,XREAL_1:64;
                        hence thesis by A325,FINSOP_1:11;
                      end;
                      suppose
A326:                   indx(D2,D1,j)-indx(D2,D1,n1)=2;
                        indx(D2,D1,n1)+2 >= 2+1 by A260,XREAL_1:6;
                        then
A327:                   indx(D2,D1,n1)+2 <> 1;
                        then
A328:                   upper_bound divset(D2,indx(D2,D1,n1)+2)= D2.indx
                        (D2,D1,j) by A261,A326,INTEGRA1:def 4;
                        indx(D2,D1,n1)+2-1=indx(D2,D1,n1)+1;
                        then lower_bound divset(D2,indx(D2,D1,n1)+2) = D2.(
                        indx(D2,D1,n1)+1) by A261,A326,A327,INTEGRA1:def 4;
                        then
A329:                   vol(divset(D2,indx(D2,D1,n1)+2)) =D1.j-D2.(indx(
                        D2,D1,n1)+1) by A238,A328,INTEGRA1:def 5;
A330:                   upper_bound divset(D1,n1+1)=D1.(n1+1) by A245,A280,A268
,A282,INTEGRA1:def 4;
                        lower_bound divset(D1,n1+1)=D1.(n1+1-1) by A245,A280
,A268,A282,INTEGRA1:def 4;
                        then
A331:                   vol(divset(D1,n1+1))=D1.(n1+1)-D1.n1 by A330,
INTEGRA1:def 5;
A332:                   vol(divset(D2,indx(D2,D1,n1)+2)) >= 0 by INTEGRA1:9;
A333:                   indx(D2,D1,j) <= len LVf(D2) by A263,INTEGRA1:def 7;
A334:                   vol(divset(D2,indx(D2,D1,n1)+1)) >= 0 by INTEGRA1:9;
A335:                   1 <= indx(D2,D1,n1)+1 by NAT_1:12;
A336:                   indx(D2,D1,n1)+1 <= indx(D2,D1,n1)+2 by XREAL_1:6;
                        then indx(D2,D1,n1)+1 <= len D2 by A263,A326,XXREAL_0:2
;
                        then
A337:                   indx(D2,D1,n1)+1 in dom D2 by A335,FINSEQ_3:25;
                        then LVf(D2).(indx(D2,D1,n1 )+1) =(lower_bound rng(f|
divset(D2,indx(D2,D1,n1)+1))) *vol(divset(D2,indx(D2,D1,n1)+1)) by
INTEGRA1:def 7;
                        then
A338:                   LVf(D2).(indx(D2,D1,n1)+1) <= (upper_bound rng f
)*vol(divset(D2,indx(D2, D1,n1)+1)) by A1,A337,A334,Th18,XREAL_1:64;
                        indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1=1+1 by A326;
                        then
A339:                   mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).2 =
LVf(D2).(2+(indx(D2,D1,n1)+1)-1) by A335,A336,A333,FINSEQ_6:122
                          .=LVf(D2).(indx(D2,D1,n1)+0+2);
                        indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1>=1 by A326;
                        then mid(LVf(D2),indx(D2,D1,n1) +1,indx(D2,D1,j)).1 =
LVf(D2).(1+(indx(D2,D1,n1)+1)-1) by A326,A335,A336,A333,FINSEQ_6:122
                          .=LVf(D2).(indx(D2,D1,n1)+1);
                        then mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) =<*
LVf(D2).(indx(D2,D1,n1)+1),LVf(D2).(indx(D2,D1,n1)+2)*> by A316,A326,A339,
FINSEQ_1:44;
                        then
A340:                   Sum mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))
=LVf(D2).(indx(D2,D1,n1)+1)+LVf(D2).(indx(D2,D1,n1)+2) by RVSUM_1:77;
A341:                   indx(D2,D1,n1)+1 > 1 by A260,NAT_1:13;
                        then
A342:                   upper_bound divset(D2,indx(D2,D1,n1)+1)=D2.(indx
                        (D2,D1,n1)+1) by A337,INTEGRA1:def 4;
                        lower_bound divset(D2,indx(D2,D1,n1)+1) = D2.(
                        indx(D2,D1,n1)+1-1) by A337,A341,INTEGRA1:def 4;
                        then
A343:                   vol(divset(D2,indx(D2,D1,n1)+1)) =D2.(indx(D2,D1
                        ,n1)+1)-D1.n1 by A274,A342,INTEGRA1:def 5;
                        LVf(D2).(indx(D2,D1,n1 )+2) =(lower_bound rng(f|
divset(D2,indx(D2,D1,n1)+2))) *vol(divset(D2,indx(D2,D1,n1)+2)) by A261,A326,
INTEGRA1:def 7;
                        then LVf(D2).(indx(D2,D1,n1)+2) <= (upper_bound rng f
)*vol(divset(D2,indx(D2, D1,n1)+2)) by A1,A261,A326,A332,Th18,XREAL_1:64;
                        then Sum mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))
<= (upper_bound rng f)*vol(divset(D2,indx(D2,D1,n1)+1)) + (upper_bound rng f)*
vol(divset(D2,indx(D2,D1,n1)+2)) by A340,A338,XREAL_1:7;
                        hence thesis by A282,A343,A329,A331;
                      end;
                    end;
A344:               n1+1 <= len LVf(D1) by A267,INTEGRA1:def 7;
                    then
A345:               len mid(LVf(D1),n1+1,j)=j-'(n1+1)+1 by A244,A282,
FINSEQ_6:118
                      .=j-j+1 by A282,XREAL_1:233
                      .= 1;
   reconsider lv =(lower_bound rng(f|divset(D1,
                    n1+1)))* vol(divset(D1,n1+1)) as Element of REAL
           by XREAL_0:def 1;
                    (n1+1)+1 <= j+1 by A257,XREAL_1:6;
                    then 1 <= j+1-(n1+1) by XREAL_1:19;
                    then mid(LVf(D1),n1+1,j).1 =LVf(D1).(1-1+(n1+1)) by A244
,A282,A344,FINSEQ_6:122
                      .=(lower_bound rng(f|divset(D1,n1+1)))* vol(divset(D1,
                    n1+1)) by A268,INTEGRA1:def 7;
                    then mid(LVf(D1),n1+1,j) =<*lv
*> by A345,FINSEQ_1:40;
                    then
A346:               Sum mid(LVf(D1),n1+1,j) =(lower_bound rng(f|divset(
                    D1,n1+1)))*vol(divset(D1,n1+1)) by FINSOP_1:11;
                    divset(D1,n1+1) c= A by A268,INTEGRA1:8;
                    then
A347:               lower_bound rng(f|divset(D1,n1+1)) >= lower_bound
                    rng f by A1,Lm4;
                    n1+1 in Seg len D1 by A268,FINSEQ_1:def 3;
                    then n1+1 in Seg len upper_volume(chi(A,A),D1) by
INTEGRA1:def 6;
                    then
A348:               n1+1 in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
                    vol(divset(D1,n1+1))= upper_volume(chi(A,A),D1).(n1+
                    1) by A268,INTEGRA1:20;
                    then vol(divset(D1,n1+1)) in rng upper_volume(chi(A,A),D1
                    ) by A348,FUNCT_1:def 3;
                    then
A349:               vol(divset(D1,n1+1))<=delta(D1) by XXREAL_2:def 8;
                    upper_bound rng f-lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
                    then
A350:               (upper_bound rng f-lower_bound rng f)* vol(divset(D1
,n1+1)) <=(upper_bound rng f-lower_bound rng f)*delta(D1) by A349,XREAL_1:64;
                    vol(divset(D1,n1+1)) >= 0 by INTEGRA1:9;
                    then Sum mid(LVf(D1),n1+1,j) >=(lower_bound rng f)*vol(
                    divset(D1,n1+1)) by A346,A347,XREAL_1:64;
                    then Sum mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))-Sum
mid(LVf(D1),n1+1 ,j) <=(upper_bound rng f)*vol(divset(D1,n1+1))-(lower_bound
                    rng f)* vol(divset(D1,n1+1)) by A318,XREAL_1:13;
                    hence thesis by A350,XXREAL_0:2;
                  end;
                  suppose
A351:               n1+1 < j;
A352:               n1 < n1+1 by NAT_1:13;
                    then
A353:               D1.n1 < D1.(n1+1) by A241,A268,SEQM_3:def 1;
                    then consider
                    B being non empty closed_interval Subset of REAL, MD1,MD2
                    being Division of B such that
A354:               D1.n1=lower_bound B and
                    upper_bound B=MD2.(len MD2) and
A355:               upper_bound B=MD1.(len MD1) and
A356:               MD1 <= MD2 and
A357:               MD1=mid(D1,n1+1,j) and
A358:               MD2=mid(D2,indx(D2,D1,n1+1),indx(D2,D1,j)) by A13,A236,A257
,A268,A273,Th15;
A359:               delta(MD1) >= 0 by Th9;
A360:               len MD1 = j-'(n1+1)+1 by A257,A265,A266,A244,A267,A357,
FINSEQ_6:118;
                    then
A361:               len MD1+(n1+1)-1 = j-(n1+1)+1+(n1+1)-1 by A257,XREAL_1:233
                      .=j;
                    j-'(n1+1) = j-(n1+1) by A257,XREAL_1:233;
                    then
A362:               j-'(n1+1)+1=j-n1;
                    then
A363:               len MD1 = j-n1 by A257,A265,A266,A244,A267,A357,
FINSEQ_6:118;
A364:               B c= A
                    proof
                      let x1 be object;
A365:                 rng D1 c= A by INTEGRA1:def 2;
                      D1.n1 in rng D1 by A241,FUNCT_1:def 3;
                      then
A366:                 lower_bound A <= D1.n1 by A365,INTEGRA2:1;
                      assume
A367:                 x1 in B;
                      then reconsider x1 as Real;
A368:                 x1 <= MD1.(len MD1) by A355,A367,INTEGRA2:1;
                      D1.j in rng D1 by A236,FUNCT_1:def 3;
                      then
A369:                 D1.j <= upper_bound A by A365,INTEGRA2:1;
                      D1 .n1 <= x1 by A354,A367,INTEGRA2:1;
                      then
A370:                 lower_bound A <= x1 by A366,XXREAL_0:2;
                      MD1.(len MD1)=D1.(j-n1-1+(n1+1)) by A257,A281,A266,A244
,A357,A362,A363,FINSEQ_6:122
                        .=D1.j;
                      then x1 <= upper_bound A by A368,A369,XXREAL_0:2;
                      hence thesis by A370,INTEGRA2:1;
                    end;
                    then reconsider g=f|B as Function of B,REAL by FUNCT_2:32;
A371:               len lower_volume(g,MD1)=len MD1 by INTEGRA1:def 7
                      .=j-'(n1+1)+1 by A257,A265,A266,A244,A267,A357,
FINSEQ_6:118
                      .=j-(n1+1)+1 by A257,XREAL_1:233;
A372:               len MD1 in dom MD1 by FINSEQ_5:6;
                    then
A373:               1 <= len MD1 by FINSEQ_3:25;
A374:               lower_bound divset(MD1,len MD1)=lower_bound divset(
D1,j) & upper_bound divset(MD1,len MD1)=upper_bound divset(D1,j)
                    proof
                      per cases;
                      suppose
A375:                   len MD1=1;
                        then
A376:                   upper_bound divset(MD1,len MD1)=MD1.(len MD1) by A372,
INTEGRA1:def 4;
A377:                   upper_bound divset(D1,j)=D1.j by A236,A245,A280,
INTEGRA1:def 4;
                        lower_bound divset(D1,j)=D1.(j-1) by A236,A245,A280,
INTEGRA1:def 4;
                        hence
                        thesis by A265,A266,A354,A357,A361,A372,A375,A376,A377,
FINSEQ_6:118,INTEGRA1:def 4;
                      end;
                      suppose
A378:                   len MD1<>1;
                        then len MD1-1 in dom MD1 by A372,INTEGRA1:7;
                        then
A379:                   len MD1-1 >= 1 by FINSEQ_3:25;
                        len MD1 <= len MD1+1 by NAT_1:11;
                        then
A380:                   len MD1 -1 <= len MD1 by XREAL_1:20;
                        upper_bound divset(MD1,len MD1)=MD1.(len MD1) by A372
,A378,INTEGRA1:def 4;
                        then
A381:                   upper_bound divset(MD1,len MD1) =D1.j by A257,A266,A244
,A357,A360,A361,A373,FINSEQ_6:122;
A382:                   len MD1-1+(n1+1)-1=j-1 by A363;
                        lower_bound divset(MD1,len MD1)= MD1.(len MD1-1)
                        by A372,A378,INTEGRA1:def 4;
                        then lower_bound divset(MD1,len MD1)=D1.(j-1) by A257
,A266,A244,A357,A360,A382,A379,A380,FINSEQ_6:122;
                        hence thesis by A236,A245,A280,A381,INTEGRA1:def 4;
                      end;
                    end;
A383:               len MD1 in dom MD1 by FINSEQ_5:6;
A384:               upper_bound divset(MD1,len MD1)=MD1.(len MD1)
                    proof
                      per cases;
                      suppose
                        len MD1 = 1;
                        hence thesis by A383,INTEGRA1:def 4;
                      end;
                      suppose
                        len MD1 <> 1;
                        hence thesis by A383,INTEGRA1:def 4;
                      end;
                    end;
                    D1.n1 < D1.(n1+1) by A241,A268,A352,SEQM_3:def 1;
                    then indx(D2,D1,n1) < indx(D2,D1,n1+1) by A259,A274,A269
,A271,SEQ_4:137;
                    then
A385:               indx(D2,D1,n1)+1 <= indx(D2,D1,n1+ 1) by NAT_1:13;
                    then
A386:               indx(D2,D1,n1)+1 <= len D2 by A277,XXREAL_0:2;
                    vol(B)=upper_bound B-D1.n1 by A354,INTEGRA1:def 5;
                    then vol(B)=D1.j-D1.n1 by A236,A245,A280,A355,A374,A384,
INTEGRA1:def 4;
                    then
A387:               vol(B)<>0 by A236,A241,A245,SEQM_3:def 1;
A388:               1 <= indx(D2,D1,n1)+1 by A260,NAT_1:13;
A389:               indx(D2,D1,n1) < indx(D2,D1,n1)+1 by NAT_1:13;
A390:               indx(D2,D1,n1+1)=indx(D2,D1,n1)+1
                    proof
                      assume indx(D2,D1,n1+1)<> indx(D2,D1,n1)+1;
                      then
A391:                 indx(D2,D1,n1+1)>indx(D2,D1,n1 )+1 by A385,XXREAL_0:1;
A392:                 indx(D2,D1,n1)+1 in dom D2 by A388,A386,FINSEQ_3:25;
                      then
A393:                 D2.(indx(D2,D1,n1)+1) in rng D2 by FUNCT_1:def 3;
                      now
                        per cases by A14,A393,XBOOLE_0:def 3;
                        suppose
                          D2.(indx(D2,D1,n1)+1) in rng D1;
                          then consider n2 being Element of NAT such that
A394:                     n2 in dom D1 and
A395:                     D2.(indx(D2,D1,n1)+1) = D1.n2 by PARTFUN1:3;
                          D2.indx(D2,D1,n1) < D2.(indx(D2,D1,n1)+1) by A259
,A389,A392,SEQM_3:def 1;
                          then n1 < n2 by A241,A274,A394,A395,SEQ_4:137;
                          then
A396:                     n1+1 <= n2 by NAT_1:13;
                          D1.n2 < D1.(n1+1) by A269,A271,A391,A392,A395,
SEQM_3:def 1;
                          hence contradiction by A268,A394,A396,SEQ_4:137;
                        end;
                        suppose
A397:                     D2.(indx(D2,D1,n1)+1) in rng D;
A398:                     D.i <= upper_bound divset(D1,n1) by A242,INTEGRA2:1;
A399:                     upper_bound divset(D1,n1)=D1.n1
                          proof
                            per cases;
                            suppose
                              n1=1;
                              hence thesis by A241,INTEGRA1:def 4;
                            end;
                            suppose
                              n1<>1;
                              hence thesis by A241,INTEGRA1:def 4;
                            end;
                          end;
                          consider n2 being Element of NAT such that
A400:                     n2 in dom D and
A401:                     D2.(indx(D2,D1,n1)+1) = D.n2 by A397,PARTFUN1:3;
                          D1.n1 < D.n2 by A259,A274,A389,A392,A401,SEQM_3:def 1
;
                          then D.i < D.n2 by A398,A399,XXREAL_0:2;
                          then i < n2 by A240,A400,SEQ_4:137;
                          then
A402:                     i+1 <= n2 by NAT_1:13;
                          n1+1 +1 <= j by A351,NAT_1:13;
                          then
A403:                     n1+1 <= j-1 by XREAL_1:19;
                          j -1 in dom D1 by A236,A245,A280,INTEGRA1:7;
                          then
A404:                     D1.(n1+1) <= D1.(j-1) by A268,A403,SEQ_4:137;
A405:                     lower_bound divset(D1,j) <= D.(i+1) by A237,
INTEGRA2:1;
                          lower_bound divset(D1,j) = D1.(j-1) by A236,A245,A280
,INTEGRA1:def 4;
                          then
A406:                     D1.(n1+1) <= D.(i+1) by A404,A405,XXREAL_0:2;
                          D .n2 < D1.(n1+1) by A269,A271,A391,A392,A401,
SEQM_3:def 1;
                          then D.n2 < D.(i+1) by A406,XXREAL_0:2;
                          hence contradiction by A235,A400,A402,SEQ_4:137;
                        end;
                      end;
                      hence contradiction;
                    end;
A407:               j <= len LVf(D1) by A266,INTEGRA1:def 7;
A408:               for k be Nat st 1<=k & k<=len lower_volume(g,MD1)
                    holds lower_volume(g,MD1).k=mid(LVf(D1),n1+1,j).k
                    proof
                      let k be Nat;
                      assume that
A409:                 1 <= k and
A410:                 k <= len lower_volume(g,MD1);
                 k in Seg len lower_volume(g,MD1) by A409,A410,FINSEQ_1:1;
                      then
A411:                 k in Seg len MD1 by INTEGRA1:def 7;
                      then
A412:                 k in dom MD1 by FINSEQ_1:def 3;
                      k in dom MD1 by A411,FINSEQ_1:def 3;
                      then
A413:                 lower_volume(g,MD1).k =(lower_bound rng(g|divset(
                      MD1,k)))*vol(divset(MD1,k)) by INTEGRA1:def 7;
                      consider k2 being Element of NAT such that
A414:                 n1+1=1+k2;
A415:                 1 <= k+k2 by A409,NAT_1:12;
                      k <= j-((n1+1)-1) by A371,A410;
                      then k+((n1+1)-1) <= j by XREAL_1:19;
                      then k+k2 <= len D1 by A266,A414,XXREAL_0:2;
                      then
A416:                 k+k2 in Seg len D1 by A415,FINSEQ_1:1;
                      then
A417:                 k+k2 in dom D1 by FINSEQ_1:def 3;
                      1+1 <= k+k2 by A258,A409,A414,XREAL_1:7;
                      then
A418:                 1 < k+k2 by NAT_1:13;
A419:                 k2=(n1+1)-1 by A414;
A420:                 lower_bound divset(D1,k+k2)= lower_bound divset(
MD1,k) & upper_bound divset(D1,k+k2)= upper_bound divset(MD1,k)
                      proof
                        per cases;
                        suppose
A421:                     k=1;
                          then upper_bound divset(MD1,k) =MD1.k by A412,
INTEGRA1:def 4;
                          then
A422:                     upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A257
,A266,A244,A357,A371,A409,A410,FINSEQ_6:122;
                          lower_bound divset(MD1,k)=D1.n1 by A354,A412,A421,
INTEGRA1:def 4;
                          hence thesis by A419,A418,A417,A421,A422,
INTEGRA1:def 4;
                        end;
                        suppose
A423:                     k<>1;
                          then upper_bound divset(MD1,k)=MD1.k by A412,
INTEGRA1:def 4;
                          then
A424:                     upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A257
,A266,A244,A357,A371,A409,A410,FINSEQ_6:122;
A425:                     k -1 <= j-(n1+1)+1 by A371,A410,XREAL_1:146
,XXREAL_0:2;
A426:                     lower_bound divset(MD1,k)=MD1.(k-1) by A412,A423,
INTEGRA1:def 4;
A427:                     k-1 in dom MD1 by A412,A423,INTEGRA1:7;
                          then 1 <= k-1 by FINSEQ_3:25;
                          then lower_bound divset(MD1,k) =D1.(k-1+(n1+1)-1)
                          by A257,A266,A244,A357,A427,A425,A426,FINSEQ_6:122;
                          hence thesis by A414,A418,A417,A424,INTEGRA1:def 4;
                        end;
                      end;
                      divset(MD1,k)=[.lower_bound divset(MD1,k),
                      upper_bound divset(MD1,k).] by INTEGRA1:4;
                      then
A428:                 divset(D1,k+k2)=divset(MD1,k) by A420,INTEGRA1:4;
A429:                 k+k2 in dom D1 by A416,FINSEQ_1:def 3;
A430:                 mid(LVf(D1),n1+1,j).k =LVf(D1).(k+(n1+1)-1) by A257,A244
,A371,A407,A409,A410,FINSEQ_6:122
                        .=(lower_bound rng(f|divset(D1,k+k2)))* vol(divset(
                      D1,k+k2)) by A414,A429,INTEGRA1:def 7;
                      k in dom MD1 by A411,FINSEQ_1:def 3;
                      then divset(D1,k+k2) c= B by A428,INTEGRA1:8;
                      hence thesis by A413,A430,A428,FUNCT_1:51;
                    end;
A431:               g|B is bounded
                    proof
                      consider a be Real such that
A432:                 for x being object st x in A /\ dom f holds a<=f.
                      x by A1,RFUNCT_1:71;
                      for x being object st x in B /\ dom g holds a<=g.x
                      proof
                        let x be object;
A433:                   dom f /\ B c= dom f /\ A by A364,XBOOLE_1:26;
                        assume x in B /\ dom g;
                        then
A434:                   x in dom g by XBOOLE_0:def 4;
                        then x in dom f /\ B by RELAT_1:61;
                        then a <= f.x by A432,A433;
                        hence thesis by A434,FUNCT_1:47;
                      end;
                      then
A435:                 g|B is bounded_below by RFUNCT_1:71;
                      consider a be Real such that
A436:                 for x being object st x in A /\ dom f holds f.x<=
                      a by A1,RFUNCT_1:70;
                      for x being object st x in B /\ dom g holds g.x<=a
                      proof
                        let x be object;
A437:                   dom f /\ B c= dom f /\ A by A364,XBOOLE_1:26;
                        assume x in B /\ dom g;
                        then
A438:                   x in dom g by XBOOLE_0:def 4;
                        then x in dom f /\ B by RELAT_1:61;
                        then a >= f.x by A436,A437;
                        hence thesis by A438,FUNCT_1:47;
                      end;
                      then g|B is bounded_above by RFUNCT_1:70;
                      hence thesis by A435;
                    end;
                    rng f is bounded_below by A1,INTEGRA1:11;
                    then
A439:               lower_bound rng f <= lower_bound rng g by RELAT_1:70
,SEQ_4:47;
                    rng f is bounded_above by A1,INTEGRA1:13;
                    then upper_bound rng f >= upper_bound rng g by RELAT_1:70
,SEQ_4:48;
                    then upper_bound rng f-lower_bound rng f>= upper_bound
                    rng g - lower_bound rng g by A439,XREAL_1:13;
                    then
A440:               (upper_bound rng f-lower_bound rng f)*delta(MD1)>= (
upper_bound rng g-lower_bound rng g)*delta(MD1 ) by A359,XREAL_1:64;
A441:               n1 < j-1 by A351,XREAL_1:20;
A442:               indx(D2,D1,j) <= len LVf(D2) by A263,INTEGRA1:def 7;
A443:               len MD2=indx(D2,D1,j)-'indx(D2,D1,n1+1)+1 by A272,A270,A277
,A262,A263,A358,FINSEQ_6:118;
                    then
A444:               len MD2 = indx(D2,D1,j)-indx(D2,D1,n1+1)+1 by A272,
XREAL_1:233;
                    then
A445:               len lower_volume(g,MD2)=indx(D2,D1,j)-(indx(D2,D1,n1
                    )+1)+1 by A390,INTEGRA1:def 7;
                    for x1 being object holds
                    x1 in (rng MD1 \/ {D.(i+1)}) implies x1 in rng MD2
                    proof let x1 be object;
                      assume
A446:                 x1 in rng MD1 \/ {D.(i+1)};
                      then reconsider x1 as Real;
                      now
                        per cases by A446,XBOOLE_0:def 3;
                        suppose
A447:                     x1 in rng MD1;
                          rng MD1 <> {};
                          then 1 in dom MD1 by FINSEQ_3:32;
                          then
A448:                     1 <= len MD1 by FINSEQ_3:25;
                          rng MD1 c= rng D1 by A357,FINSEQ_6:119;
                          then
A449:                     x1 in rng D1 by A447;
                          rng D1 c= rng D2 by A13,INTEGRA1:def 18;
                          then consider k such that
A450:                     k in dom D2 and
A451:                     D2.k = x1 by A449,PARTFUN1:3;
                          MD1.1=D1.(n1+1) by A265,A266,A244,A267,A357,
FINSEQ_6:118;
                          then D2.indx(D2,D1,n1+1 ) <= x1 by A271,A447,Th16;
                          then
A452:                     indx(D2,D1,n1+1)<=k by A269,A450,A451,SEQM_3:def 1;
                          then consider n being Nat such that
A453:                     k+1 = indx(D2,D1,n1+1)+n by NAT_1:10,12;
A454:                     len MD1=j-'(n1+1)+1 by A257,A265,A266,A244,A267,A357,
FINSEQ_6:118;
                          then len MD1+(n1+1)-1=j-(n1+1)+1+(n1+1)-1 by A257,
XREAL_1:233
                            .=j;
                          then MD1.(len MD1) =D1.j by A257,A266,A244,A357,A448
,A454,FINSEQ_6:122;
                          then x1 <= D2.indx(D2,D1,j) by A238,A447,Th16;
                          then k<=indx(D2,D1,j) by A261,A450,A451,SEQM_3:def 1;
                          then k-indx(D2,D1,n1+1)<=indx(D2,D1,j)-indx(D2,D1,
                          n1+1) by XREAL_1:9;
                          then
A455:                     k -indx(D2,D1,n1+1)+1<=indx(D2,D1,j)-indx(D2,
                          D1,n1+1)+1 by XREAL_1:6;
                          indx(D2,D1,n1+1)+1<=k+1 by A452,XREAL_1:6;
                          then
A456:                     1 <= k+1-indx(D2, D1,n1+1) by XREAL_1:19;
                          then
A457:                     n in dom MD2 by A444,A455,A453,FINSEQ_3:25;
                          MD2.n=D2.(n+indx(D2,D1,n1+1)-1) by A272,A270
,A263,A358,A456,A455,A453,FINSEQ_6:122
                            .=D2.k by A453;
                          hence x1 in rng MD2 by A451,A457,FUNCT_1:def 3;
                        end;
                        suppose
                          x1 in {D.(i+1)};
                          then
A458:                     x1 = D.(i+1) by TARSKI:def 1;
                          reconsider j1 = j-1 as Element of NAT by A236,A245
,A280,INTEGRA1:7;
A459:                     rng D c= rng D2 by A12,INTEGRA1:def 18;
                          D.(i+1) in rng D by A235,FUNCT_1:def 3;
                          then consider k such that
A460:                     k in dom D2 and
A461:                     x1 = D2.k by A458,A459,PARTFUN1:3;
                          D.(i+1) <= upper_bound divset(D1,j) by A237,
INTEGRA2:1;
                          then x1 <= D1.j by A236,A245,A280,A458,INTEGRA1:def 4
;
                          then
A462:                     D2
.k <= D2.indx(D2,D1,j) by A13,A236,A461,INTEGRA1:def 19;
                          n1<j1 by A351,XREAL_1:20;
                          then
A463:                     n1+1 <= j1 by NAT_1:13;
                          j -1 in dom D1 by A236,A245,A280,INTEGRA1:7;
                          then
A464:                     D1.(n1+1) <= D1.(j-1) by A268,A463,SEQ_4:137;
                          lower_bound divset(D1,j) <= D.(i+1) by A237,
INTEGRA2:1;
                          then D1.(j-1) <= x1 by A236,A245,A280,A458,
INTEGRA1:def 4;
                          then D2.indx(D2,D1,n1+1) <= D2.k by A271,A461,A464,
XXREAL_0:2;
                          hence x1 in rng MD2 by A269,A261,A358,A460,A461,A462
,Th17;
                        end;
                      end;
                      hence thesis;
                    end;
                    then
A465:               rng MD1 \/ {D.(i+1)} c= rng MD2;
                    rng MD2 <> {};
                    then 1 in dom MD2 by FINSEQ_3:32;
                    then
A466:               1 <= len MD2 by FINSEQ_3:25;
A467:               len MD2-1+indx(D2,D1,n1+1)=indx(D2,D1,j) by A444;
                  for x1 being object holds
                    x1 in rng MD2 implies x1 in (rng MD1 \/ {D.(i+1)})
                    proof let x1 be object;
                      assume
A468:                 x1 in rng MD2;
                      then reconsider x1 as Real;
                      MD2.1=D2.indx(D2,D1,n1+1) by A270,A277,A262,A263,A358,
FINSEQ_6:118;
                      then
A469:                 D1 .(n1+1) <= x1 by A271,A468,Th16;
                      MD2.(len MD2)=D2.indx(D2,D1,j) by A272,A270,A263,A358
,A466,A443,A467,FINSEQ_6:122;
                      then
A470:                 x1 <= D1.j by A238,A468,Th16;
A471:                 rng MD2 c= rng D2 by A358,FINSEQ_6:119;
                      now
                        per cases by A14,A468,A471,XBOOLE_0:def 3;
                        suppose
                          x1 in rng D1;
                          then consider k such that
A472:                     k in dom D1 and
A473:                     D1.k = x1 by PARTFUN1:3;
A474:                     n1 +1 <= k by A268,A469,A472,A473,SEQM_3:def 1;
                          then
A475:                     1 <= k-n1 by XREAL_1:19;
                          n1 <= n1+1 by NAT_1:11;
                          then consider n being Nat such that
A476:                     k=n1+n by A474,NAT_1:10,XXREAL_0:2;
A477:                     k <= j by A236,A470,A472,A473,SEQM_3:def 1;
                          then k-n1 <= len MD1 by A363,XREAL_1:9;
                          then n in dom MD1 by A475,A476,FINSEQ_3:25;
                          then
A478:                     MD1.n in rng MD1 by FUNCT_1:def 3;
                          j-(n1+1)+1=j-n1;
                          then
A479:                     k-n1 <= j-(n1+1)+1 by A477,XREAL_1:9;
                          MD1.n = D1.(k-n1-1+(n1+1)) by A257,A266,A244
,A357,A475,A479,A476,FINSEQ_6:122
                            .= D1.k;
                          hence x1 in (rng MD1 \/ {D.(i+1)}) by A473,A478,
XBOOLE_0:def 3;
                        end;
                        suppose
                          x1 in rng D;
                          then consider n such that
A480:                     n in dom D and
A481:                     D.n = x1 by PARTFUN1:3;
A482:                     not i+1 < n
                          proof
A483:                       upper_bound divset(D1,j)=D1.j
                            proof
                              per cases;
                              suppose
                                j=1;
                                hence thesis by A236,INTEGRA1:def 4;
                              end;
                              suppose
                                j<>1;
                                hence thesis by A236,INTEGRA1:def 4;
                              end;
                            end;
                            reconsider y1=D.(i+1) as Real;
A484:                       D.n in rng D by A480,FUNCT_1:def 3;
                            assume i+1 < n;
                            then
A485:                       D.(i+1) < D.n by A235,A480,SEQM_3:def 1;
                            lower_bound divset(D1,j) <= D.(i+1) by A237,
INTEGRA2:1;
                            then lower_bound divset(D1, j) <= D.n by A485,
XXREAL_0:2;
                            then D.n in divset(D1,j) by A470,A481,A483,
INTEGRA2:1;
                            then
A486:                       x1 in rng D /\ divset(D1,j) by A481,A484,
XBOOLE_0:def 4;
                            D.(i+1) in rng D by A235,FUNCT_1:def 3;
                            then y1 in rng D /\ divset(D1,j) by A237,
XBOOLE_0:def 4;
                            hence
                            contradiction by A11,A236,A481,A485,A486,Th5;
                          end;
A487:                     upper_bound divset(D1,n1)=D1.n1
                          proof
                            per cases;
                            suppose
                              n1=1;
                              hence thesis by A241,INTEGRA1:def 4;
                            end;
                            suppose
                              n1<>1;
                              hence thesis by A241,INTEGRA1:def 4;
                            end;
                          end;
                          D.i <= upper_bound divset(D1,n1) by A242,INTEGRA2:1;
                          then D.i < D1.(n1+1) by A353,A487,XXREAL_0:2;
                          then D.i < D.n by A469,A481,XXREAL_0:2;
                          then i < n by A240,A480,SEQ_4:137;
                          then i+1 <= n by NAT_1:13;
                          then i+1 = n or i+1 < n by XXREAL_0:1;
                          then x1 in {D.(i+1)} by A481,A482,TARSKI:def 1;
                          hence x1 in (rng MD1 \/ {D.(i+1)}) by XBOOLE_0:def 3;
                        end;
                      end;
                      hence thesis;
                    end;
                    then rng MD2 c= rng MD1 \/ {D.(i+1) };
                    then
A488:               rng MD2 = rng MD1 \/ {D.(i+1)} by A465,XBOOLE_0:def 10;
delta(MD1) in rng upper_volume(chi(B,B),MD1) by XXREAL_2:def 8;
                    then consider k such that
A489:               k in dom upper_volume(chi(B,B),MD1) and
A490:               upper_volume(chi(B,B),MD1).k = delta(MD1) by PARTFUN1:3;
A491:               k in Seg len upper_volume(chi(B,B),MD1) by A489,
FINSEQ_1:def 3;
                    then
A492:               k in Seg len MD1 by INTEGRA1:def 6;
                    then
A493:               k in dom MD1 by FINSEQ_1:def 3;
A494:               k <= len MD1 by A492,FINSEQ_1:1;
                    then k+n1 <= j by A363,XREAL_1:19;
                    then
A495:               k+n1 <= len D1 by A266,XXREAL_0:2;
A496:               1 <= k by A491,FINSEQ_1:1;
A497:               n1+1>1 by A280,NAT_1:13;
                    then n1>1-1 by XREAL_1:19;
                    then
A498:               k < k+n1 by XREAL_1:29;
                    then 1 < k+n1 by A496,XXREAL_0:2;
                    then
A499:               k+n1 in dom D1 by A495,FINSEQ_3:25;
                    lower_bound divset(MD1,k)=lower_bound divset(D1,k+n1
                    ) & upper_bound divset(MD1,k)=upper_bound divset(D1,k+n1)
                    proof
                      per cases;
                      suppose
A500:                   k=1;
                        then upper_bound divset(MD1,k)=MD1.k by A493,
INTEGRA1:def 4;
                        then
A501:                   upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A257,A266
,A244,A357,A360,A496,A494,FINSEQ_6:122;
                        lower_bound divset(D1,k+n1)=D1.(k+n1-1) by A496,A498
,A499,INTEGRA1:def 4;
                        hence thesis by A354,A497,A493,A499,A500,A501,
INTEGRA1:def 4;
                      end;
                      suppose
A502:                   k<>1;
                        then upper_bound divset(MD1,k)=MD1. k by A493,
INTEGRA1:def 4;
                        then
A503:                   upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A257,A266
,A244,A357,A360,A496,A494,FINSEQ_6:122;
A504:                   lower_bound divset(MD1,k)=MD1.(k-1) by A493,A502,
INTEGRA1:def 4;
A505:                   k-1 in dom MD1 by A493,A502,INTEGRA1:7;
                        then
A506:                   k-1 <= len MD1 by FINSEQ_3:25;
                        1 <= k-1 by A505,FINSEQ_3:25;
                        then lower_bound divset(MD1,k)=D1.(k-1+(n1+1)-1) by
A257,A266,A244,A357,A360,A505,A506,A504,FINSEQ_6:122;
                        hence thesis by A496,A498,A499,A503,INTEGRA1:def 4;
                      end;
                    end;
                    then divset(MD1,k)=[.lower_bound divset(D1,k+n1),
                    upper_bound divset(D1,k+n1).] by INTEGRA1:4;
                    then
A507:               divset(MD1,k)=divset(D1,k+n1) by INTEGRA1:4;
                    k+n1 in Seg len D1 by A499,FINSEQ_1:def 3;
                    then k+n1 in Seg len upper_volume(chi(A,A),D1) by
INTEGRA1:def 6;
                    then
A508:               k+n1 in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
                    k in dom MD1 by A492,FINSEQ_1:def 3;
                    then delta(MD1) = vol(divset(MD1,k)) by A490,INTEGRA1:20;
                    then
delta(MD1)=upper_volume(chi(A,A), D1).(k+n1) by A499,A507,INTEGRA1:20;
                    then delta(MD1) in rng upper_volume(chi(A,A),D1) by A508,
FUNCT_1:def 3;
                    then delta(MD1) <= max rng upper_volume(chi(A,A),D1) by
XXREAL_2:def 8;
                    then
A509:               delta(MD1) <= delta(D1);
                    upper_bound rng f - lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
                    then
A510:               (upper_bound rng f-lower_bound rng f)*delta(MD1) <=
(upper_bound rng f-lower_bound rng f)* delta(D1) by A509,XREAL_1:64;
                    lower_bound divset(D1,j) <= D.(i+1) by A237,INTEGRA2:1;
                    then
A511:               D1.(j-1) <= D.(i+1) by A236,A245,A280,INTEGRA1:def 4;
A512:               D.(i+1)<=upper_bound divset(D1,j) by A237,INTEGRA2:1;
A513:               indx (D2,D1,n1)+1 <= indx(D2,D1,j) by A272,A385,XXREAL_0:2;
A514:               for k be Nat st 1<=k & k<=len lower_volume(g,MD2)
holds lower_volume(g,MD2).k=mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).k
                    proof
                      let k be Nat;
                      assume that
A515:                 1 <= k and
A516:                 k <= len lower_volume(g,MD2);
A517:                 k in Seg len lower_volume(g,MD2) by A515,A516,FINSEQ_1:1;
A518:                 mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).k =LVf
(D2).(k+(indx(D2,D1,n1)+1)-1) by A388,A445,A442,A513,A515,A516,FINSEQ_6:122;
                      1<=indx(D2,D1,n1)+1 by NAT_1:12;
                      then 1+1<=k+(indx(D2,D1,n1)+1) by A515,XREAL_1:7;
                      then
A519:                 1 <= k+(indx(D2,D1,n1) +1)-1 by XREAL_1:19;
                      consider k2 being Element of NAT such that
A520:                 indx(D2,D1,n1)+1=1+k2;
                      k <= indx(D2,D1,j)-((indx(D2,D1,n1)+1)-1) by A444,A390
,A516,INTEGRA1:def 7;
                      then k+((indx(D2,D1,n1)+1)-1) <= indx(D2,D1,j) by
XREAL_1:19;
                      then k +(indx(D2,D1,n1)+1)-1 <= len LVf(D2) by A442,
XXREAL_0:2;
                      then k+k2 in Seg len LVf(D2) by A519,A520,FINSEQ_1:1;
                      then
A521:                 k+k2 in Seg len D2 by INTEGRA1:def 7;
                      then k+k2 in dom D2 by FINSEQ_1:def 3;
                      then
A522:                 mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).k =(
lower_bound rng(f|divset(D2,k+k2)))* vol(divset(D2,k+k2)) by A518,A520,
INTEGRA1:def 7;
A523:                 k in Seg len MD2 by A517,INTEGRA1:def 7;
A524:                 lower_bound divset(MD2,k)=lower_bound divset(D2,k+
k2) & upper_bound divset(MD2,k)= upper_bound divset(D2,k+k2)
                      proof
                        k+k2>=1+1 by A260,A515,A520,XREAL_1:7;
                        then
A525:                   k+k2>1 by NAT_1:13;
A526:                   k in dom MD2 by A523,FINSEQ_1:def 3;
A527:                   k+k2 in dom D2 by A521,FINSEQ_1:def 3;
                        per cases;
                        suppose
A528:                     k=1;
                          then upper_bound divset(MD2,k)= MD2.k by A526,
INTEGRA1:def 4;
                          then
A529:                     upper_bound divset(MD2,k)=D2.(k+( indx(D2,D1,
n1)+1)-1) by A272,A263,A358,A388,A390,A445,A515,A516,FINSEQ_6:122;
A530:                     lower_bound divset(D2,k+k2)=D2.(k+k2-1) by A525,A527,
INTEGRA1:def 4;
                          lower_bound divset(MD2,k)=D1.n1 by A354,A526,A528,
INTEGRA1:def 4;
                          hence thesis by A13,A241,A520,A525,A527,A528,A529
,A530,INTEGRA1:def 4,def 19;
                        end;
                        suppose
A531:                     k<>1;
                          then upper_bound divset(MD2,k)=MD2.k by A526,
INTEGRA1:def 4;
                          then
A532:                     upper_bound divset(MD2,k)=D2.(k+( indx(D2,D1,
n1)+1)-1) by A272,A263,A358,A388,A390,A445,A515,A516,FINSEQ_6:122;
A533:                     k -1 <= indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1 by A445
,A516,XREAL_1:146,XXREAL_0:2;
A534:                     lower_bound divset(MD2,k)=MD2.(k-1) by A526,A531,
INTEGRA1:def 4;
A535:                     k-1 in dom MD2 by A526,A531,INTEGRA1:7;
                          then 1 <= k-1 by FINSEQ_3:25;
                          then lower_bound divset(MD2,k)=D2.(k-1+(indx(D2,D1,
n1)+1)-1) by A272,A263,A358,A388,A390,A535,A533,A534,FINSEQ_6:122;
                          hence thesis by A520,A525,A527,A532,INTEGRA1:def 4;
                        end;
                      end;
                      divset (MD2,k)=[.lower_bound divset(MD2,k),
                      upper_bound divset(MD2,k).] by INTEGRA1:4;
                      then
A536:                 divset(MD2,k)=divset( D2,k+k2) by A524,INTEGRA1:4;
                      k in dom MD2 by A523,FINSEQ_1:def 3;
                      then divset(D2,k+k2) c= B by A536,INTEGRA1:8;
                      then
A537:                 rng(f|divset(D2,k+k2))=rng(g|divset(D2,k+k2)) by
FUNCT_1:51;
                      k in dom MD2 by A523,FINSEQ_1:def 3;
                      hence thesis by A522,A536,A537,INTEGRA1:def 7;
                    end;
                    lower_bound divset(D1,j)<=D.(i+1) by A237,INTEGRA2:1;
                    then
A538:               D.(i+1) in divset(MD1,len MD1) by A374,A512,INTEGRA2:1;
                    j-1 in dom D1 by A236,A245,A280,INTEGRA1:7;
                    then D1.n1 <D1.(j-1) by A241,A441,SEQM_3:def 1;
                    then D.(i+1) > lower_bound B by A354,A511,XXREAL_0:2;
                    then Sum lower_volume(g,MD2)-Sum lower_volume(g,MD1)<= (
upper_bound rng g- lower_bound rng g)*delta(MD1) by A356,A431,A488,A538,A387
,Th13;
                    then
A539:               Sum lower_volume(g,MD2)-Sum lower_volume(g,MD1)<= (
upper_bound rng f-lower_bound rng f)*delta(MD1) by A440,XXREAL_0:2;
                    indx(D2,D1,n1)+1 <= len LVf(D2) by A386,INTEGRA1:def 7;
                    then len mid(LVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) =
indx(D2,D1,j)-'(indx(D2,D1,n1)+1)+1 by A262,A388,A442,A513,FINSEQ_6:118;
                    then len lower_volume(g,MD2) =len mid(LVf(D2),indx(D2,D1,
n1)+1,indx(D2,D1,j)) by A272,A385,A445,XREAL_1:233,XXREAL_0:2;
                    then
A540:               Sum lower_volume(g,MD2)=Sum mid(LVf(D2),indx(D2,D1,
                    n1)+1,indx(D2,D1,j)) by A514,FINSEQ_1:14;
                    n1+1 <= len LVf(D1) by A267,INTEGRA1:def 7;
                    then len mid(LVf(D1),n1+1,j) =j-'(n1+1)+1 by A257,A265,A244
,A407,FINSEQ_6:118
                      .=j-(n1+1)+1 by A257,XREAL_1:233;
                    then Sum lower_volume(g,MD1)=Sum mid(LVf(D1),n1+1,j) by
A371,A408,FINSEQ_1:14;
                    hence thesis by A539,A510,A540,XXREAL_0:2;
                  end;
                end;
                hence thesis;
              end;
              then
A541:         (PLf(D2,indx(D2,D1,n1))-PLf(D1,n1))+ (Sum mid(LVf(D2),
indx(D2,D1,n1)+1,indx(D2,D1,j)) -Sum mid(LVf(D1),n1+1,j)) <=i*(upper_bound rng
f-lower_bound rng f)*delta(D1)+ (upper_bound rng f-lower_bound rng f)*delta(D1)
              by A243,XREAL_1:7;
              n1 < n1+1 by NAT_1:13;
              then D1.n1 < D1.(n1+1) by A241,A268,SEQM_3:def 1;
              then indx(D2,D1,n1) < indx(D2,D1,n1+1) by A259,A274,A269,A271,
SEQ_4:137;
              then
A542:         indx(D2,D1,n1)<indx(D2,D1,j) by A272,XXREAL_0:2;
              indx(D2,D1,n1) in Seg len D2 by A259,FINSEQ_1:def 3;
              then indx(D2,D1,n1) in Seg len LVf(D2) by INTEGRA1:def 7;
              then indx(D2,D1,n1) in dom LVf(D2) by FINSEQ_1:def 3;
              then PLf(D2,indx(D2,D1,n1))=Sum(LVf(D2)|indx(D2,D1,n1)) by
INTEGRA1:def 20
                .=Sum mid(LVf(D2),1,indx(D2,D1,n1)) by A260,FINSEQ_6:116;
              then PLf(D2,indx(D2,D1,n1))+Sum mid(LVf(D2),indx(D2,D1,n1)+1,
indx(D2, D1,j)) =Sum(mid(LVf(D2),1,indx(D2,D1,n1))^ mid(LVf(D2),indx(D2,D1,n1)+
              1,indx(D2,D1,j))) by RVSUM_1:75
                .=Sum mid(LVf(D2),1,indx(D2,D1,j)) by A260,A542,A264,INTEGRA2:4
                .=Sum(LVf(D2)|indx(D2,D1,j)) by A262,FINSEQ_6:116;
              then PLf(D2,indx(D2,D1,j))= PLf(D2,indx(D2,D1,n1))+Sum mid(LVf
              (D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) by A279,INTEGRA1:def 20;
              then (PLf(D2,indx(D2,D1,n1))-PLf(D1,n1))+ (Sum mid(LVf(D2),
indx(D2,D1,n1)+1,indx(D2,D1,j)) -Sum mid(LVf(D1),n1+1,j)) =PLf(D2,indx(D2,D1,j)
              )-PLf(D1,j) by A278;
              hence thesis by A236,A237,A541;
            end;
            hence thesis;
          end;
          for k being non zero Nat holds P[k] from NAT_1:sch 10(A40,
          A231);
          then P[i];
          hence thesis by A17;
        end;
A543:   len D1 in dom D1 by FINSEQ_5:6;
        then D1.(len D1) = D2.indx(D2,D1,len D1) by A13,INTEGRA1:def 19;
        then upper_bound A = D2.indx(D2,D1,len D1) by INTEGRA1:def 2;
        then
A544:   D2.(len D2) = D2.indx(D2,D1,len D1) by INTEGRA1:def 2;
        len D in dom D by FINSEQ_5:6;
        then consider j such that
A545:   j in dom D1 and
A546:   D.(len D) in divset(D1,j) and
A547:   PLf(D2,indx(D2,D1,j))-PLf(D1,j) <= (len D)*(upper_bound(rng
        f)- lower_bound(rng f))*delta(D1) by A16;
A548:   j = len D1
        proof
          assume
A549:     j<>len D1;
          j <= len D1 by A545,FINSEQ_3:25;
          then j < len D1 by A549,XXREAL_0:1;
          then D1.j < D1.(len D1) by A545,A543,SEQM_3:def 1;
          then
A550:     D1.j < upper_bound A by INTEGRA1:def 2;
A551:     upper_bound divset(D1,j) < upper_bound A
          proof
            per cases;
            suppose
              j=1;
              hence thesis by A545,A550,INTEGRA1:def 4;
            end;
            suppose
              j<>1;
              hence thesis by A545,A550,INTEGRA1:def 4;
            end;
          end;
          D.(len D) <= upper_bound divset(D1,j) by A546,INTEGRA2:1;
          hence contradiction by A551,INTEGRA1:def 2;
        end;
        indx(D2,D1,len D1) in dom D2 by A13,A543,INTEGRA1:def 19;
        then indx(D2,D1,len D1)=len D2 by A15,A544,SEQ_4:138;
        then PLf(D2,len D2)-lower_sum(f,D1)<=(len D)* (upper_bound(rng f)-
        lower_bound(rng f))* delta(D1) by A547,A548,INTEGRA1:43;
        hence thesis by INTEGRA1:43;
      end;
      hence thesis by A12,A13,A14;
    end;
    hence thesis;
  end;
  hence thesis;
end;

theorem Th22:
  f|A is bounded implies
    for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & 0<=
  upper_sum(f,D)-upper_sum(f,D2) & 0<=upper_sum(f,D1)-upper_sum(f,D2)
  proof
    assume
A1: f|A is bounded;
    let D,D1;
    consider D2 such that
A3: D<=D2 and
A4: D1<=D2 and
A5: rng D2=rng D1 \/ rng D by Th4;
A6: upper_sum(f,D1)-upper_sum(f,D2)>=0 by A1,A4,INTEGRA1:45,XREAL_1:48;
    upper_sum(f,D)-upper_sum(f,D2)>=0 by A1,A3,INTEGRA1:45,XREAL_1:48;
    hence thesis by A3,A4,A5,A6;
  end;

theorem Th23:
  f|A is bounded implies
  for D,D1 st delta(D1)<min rng upper_volume(chi(A,A),D) holds
  ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D &
  upper_sum(f,D1)-upper_sum(f,D2) <=
    (len D)*(upper_bound(rng f)-lower_bound(rng f))*delta(D1)
  proof
  assume
A1: f|A is bounded; then
A2: for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & 0<=
    upper_sum(f,D)-upper_sum(f,D2) & 0<=upper_sum(f,D1)-upper_sum(f,D2)
      by Th22;
    let D,D1;
    assume
A8: delta(D1)<min rng upper_volume(chi(A,A),D);
    ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & upper_sum(f,D1)-
    upper_sum(f,D2)<=(len D)*(upper_bound(rng f)- lower_bound(rng f))*delta(D1)
    proof
      consider D2 be Division of A such that
A9:   D<=D2 and
A10:  D1<=D2 and
A11:  rng D2=rng D1 \/ rng D and
      0<=upper_sum(f,D)-upper_sum(f,D2) and
      0<=upper_sum(f,D1)-upper_sum(f,D2) by A2;
      upper_sum(f,D1)-upper_sum(f,D2) <= (len D)*(upper_bound(rng f)-
      lower_bound(rng f))*delta(D1)
      proof
        deffunc UVf(Division of A) = upper_volume(f,$1);
        deffunc PUf(Division of A,Nat) = (PartSums(upper_volume(f,$1))).$2;
A12:    len D2 in dom D2 by FINSEQ_5:6;
A13:    for i st i in dom D holds ex j st j in dom D1 & D.i in divset(D1,
j) & PUf(D1,j)-PUf(D2,indx(D2,D1,j))<=i*(upper_bound(rng f)- lower_bound(rng f)
        )*delta(D1)
        proof
          defpred P[non zero Nat] means $1 in dom D implies ex j st j in dom
D1 & D.$1 in divset(D1,j) & PUf(D1,j)-PUf(D2,indx(D2,D1,j))<=$1*(upper_bound
          rng f-lower_bound rng f) *delta(D1);
          let i;
          assume
A14:      i in dom D;
          then
A15:      i in Seg len D by FINSEQ_1:def 3;
A16:      for i,j st i in dom D & j in dom D1 & D.i in divset(D1,j) holds
          j >= 2
          proof
            let i,j;
            assume
A17:        i in dom D;
            assume that
A18:        j in dom D1 and
A19:        D.i in divset(D1,j);
            assume j<2;
            then j<1+1;
            then
A20:        j <= 1 by NAT_1:13;
            j in Seg len D1 by A18,FINSEQ_1:def 3;
            then j >= 1 by FINSEQ_1:1;
            then j = 1 by A20,XXREAL_0:1;
            then
A21:        lower_bound divset(D1,j)=lower_bound A by A18,INTEGRA1:def 4;
A22:        D.i<=upper_bound divset(D1,j) by A19,INTEGRA2:1;
            delta(D1) >= min rng upper_volume(chi(A,A),D)
            proof
              per cases;
              suppose
A23:            i=1;
                len D in Seg len D by FINSEQ_1:3;
                then 1 <= len D by FINSEQ_1:1;
                then
A24:            1 in dom D by FINSEQ_3:25;
                then
A25:            lower_bound divset(D,1)=lower_bound A by INTEGRA1:def 4;
                1 in Seg len D by A24,FINSEQ_1:def 3;
                then 1 in Seg len upper_volume(chi(A,A),D) by INTEGRA1:def 6;
                then
A26:            1 in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
                vol(divset(D,1)) = upper_volume(chi(A,A),D).1 by A24,
INTEGRA1:20;
                then vol(divset(D,1)) in rng upper_volume(chi(A,A),D) by A26,
FUNCT_1:def 3;
                then
A27:            vol
(divset(D,1))>=min rng upper_volume(chi(A,A),D) by XXREAL_2:def 7;
A28:            upper_bound divset(D,1)=D. 1 by A24,INTEGRA1:def 4;
                upper_bound divset(D1,j)-lower_bound A >= D.1-lower_bound
                A by A22,A23,XREAL_1:9;
                then
                vol(divset(D1,j)) >= upper_bound divset(D,1)- lower_bound
                divset(D,1) by A21,A25,A28,INTEGRA1:def 5;
                then
A29:            vol(divset(D1,j)) >= vol(divset(D,1)) by INTEGRA1:def 5;
                vol(divset(D1,j)) <= delta(D1) by A18,Lm5;
                then delta(D1) >= vol(divset(D,1)) by A29,XXREAL_0:2;
                hence thesis by A27,XXREAL_0:2;
              end;
              suppose
A30:            i<>1;
                then D.(i-1) in A by A17,INTEGRA1:7;
                then
A31:            lower_bound A <= D.(i-1) by INTEGRA2:1;
                lower_bound divset(D,i)=D.(i-1) by A17,A30,INTEGRA1:def 4;
                then
A32:            upper_bound divset(D,i)-lower_bound A >= upper_bound
                divset(D,i)-lower_bound divset(D,i) by A31,XREAL_1:10;
                upper_bound divset(D,i) = D.i by A17,A30,INTEGRA1:def 4;
                then upper_bound divset(D1,j)-lower_bound divset(D1,j) >=
                upper_bound divset(D,i)- lower_bound A by A22,A21,XREAL_1:9;
                then upper_bound divset(D1,j)-lower_bound divset(D1,j) >=
upper_bound divset(D,i)-lower_bound divset( D,i) by A32,XXREAL_0:2;
                then vol(divset(D1,j)) >= upper_bound divset(D,i)-lower_bound
                divset(D,i) by INTEGRA1:def 5;
                then
A33:            vol(divset(D1,j)) >= vol(divset(D,i)) by INTEGRA1:def 5;
                i in Seg len D by A17,FINSEQ_1:def 3;
                then i in Seg len upper_volume(chi(A,A),D) by INTEGRA1:def 6;
                then
A34:            i in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
                vol(divset(D,i)) = upper_volume(chi(A,A),D).i by A17,
INTEGRA1:20;
                then vol(divset(D,i)) in rng upper_volume(chi(A,A),D) by A34,
FUNCT_1:def 3;
                then
A35:            vol
(divset(D,i))>=min rng upper_volume(chi(A,A),D) by XXREAL_2:def 7;
                vol(divset(D1,j)) <= delta(D1) by A18,Lm5;
                then delta(D1) >= vol(divset(D,i)) by A33,XXREAL_0:2;
                hence thesis by A35,XXREAL_0:2;
              end;
            end;
            hence contradiction by A8;
          end;
A36:      P[1]
          proof
            len D in Seg len D by FINSEQ_1:3;
            then 1 <= len D by FINSEQ_1:1;
            then
A37:        1 in dom D by FINSEQ_3:25;
            then consider j such that
A38:        j in dom D1 and
A39:        D.1 in divset(D1,j) by Th3,INTEGRA1:6;
            PUf(D1,j)-PUf(D2,indx(D2,D1,j))<= 1*(upper_bound rng f-
            lower_bound rng f)*delta(D1)
            proof
A40:          j <> 1 by A16,A37,A38,A39;
              then reconsider j1=j-1 as Element of NAT by A38,INTEGRA1:7;
A41:          j1 in dom D1 by A38,A40,INTEGRA1:7;
              then j1 in Seg len D1 by FINSEQ_1:def 3;
              then j1 in Seg len upper_volume(f,D1) by INTEGRA1:def 6;
              then
A42:          j1 in dom upper_volume(f,D1) by FINSEQ_1:def 3;
A43:          j-1 in dom D1 by A38,A40,INTEGRA1:7;
              then
A44:          indx(D2,D1,j1) in dom D2 by A10,INTEGRA1:def 19;
              then
A45:          indx(D2,D1,j1) in Seg len D2 by FINSEQ_1:def 3;
              then
A46:          1 <= indx(D2,D1,j1) by FINSEQ_1:1;
              then mid(D2,1,indx(D2,D1,j1)) is increasing by A44,INTEGRA1:35;
              then
A47:          D2|indx(D2,D1,j1) is increasing by A46,FINSEQ_6:116;
              j < j+1 by NAT_1:13;
              then j1 < j by XREAL_1:19;
              then
A48:          indx(D2,D1,j1) < indx(D2,D1,j) by A10,A38,A41,Th8;
              then
A49:          indx(D2,D1,j1)+1 <= indx(D2,D1,j) by NAT_1:13;
A50:          Sum mid(upper_volume(f,D1),j,j) -Sum mid(upper_volume(f,D2
),(indx(D2,D1,j1)+1),indx(D2,D1,j)) <= (upper_bound rng f-lower_bound rng f)*
              delta(D1)
              proof
A51:            indx(D2,D1,j)-indx(D2,D1,j1) <= 2
                proof
                  reconsider ID1=indx(D2,D1,j1)+1 as Element of NAT;
                  reconsider ID2=ID1+1 as Element of NAT;
                  assume indx(D2,D1,j)-indx(D2,D1,j1) > 2;
                  then
A52:              indx(D2,D1,j1)+(1+1)<indx(D2,D1,j) by XREAL_1:20;
A53:              ID1 < ID2 by NAT_1:13;
                  then indx (D2,D1,j1) <= ID2 by NAT_1:13;
                  then
A54:              1 <= ID2 by A46,XXREAL_0:2;
A55:              indx(D2,D1,j) in dom D2 by A10,A38,INTEGRA1:def 19;
                  then
A56:              indx(D2,D1,j) <= len D2 by FINSEQ_3:25;
                  then ID2 <= len D2 by A52,XXREAL_0:2;
                  then
A57:              ID2 in dom D2 by A54,FINSEQ_3:25;
                  then
A58:              D2.ID2<D2.indx(D2,D1, j) by A52,A55,SEQM_3:def 1;
A59:              1 <= ID1 by A46,NAT_1:13;
A60:              D1.j = D2.indx(D2,D1,j) by A10,A38,INTEGRA1:def 19;
                  ID1 <= indx(D2,D1,j) by A52,A53,XXREAL_0:2;
                  then ID1 <= len D2 by A56,XXREAL_0:2;
                  then
A61:              ID1 in dom D2 by A59,FINSEQ_3:25;
                  then
A62:              D2.ID1<D2.ID2 by A53,A57,SEQM_3:def 1;
                  indx(D2,D1,j1) < ID1 by NAT_1:13;
                  then
A63:              D2 .indx(D2,D1,j1)<D2.ID1 by A44,A61,SEQM_3:def 1;
A64:              D1.j1 = D2.indx(D2,D1,j1) by A10,A41,INTEGRA1:def 19;
A65:              not D2.ID1 in rng D1 & not D2.ID2 in rng D1
                  proof
                    assume
A66:                D2.ID1 in rng D1 or D2.ID2 in rng D1;
                    per cases by A66;
                    suppose
                      D2.ID1 in rng D1;
                      then consider n such that
A67:                  n in dom D1 and
A68:                  D1.n=D2.ID1 by PARTFUN1:3;
                      j1<n by A41,A63,A64,A67,A68,SEQ_4:137;
                      then
A69:                  j<n+1 by XREAL_1:19;
                      D2.ID1<D2.indx(D2,D1,j) by A62,A58,XXREAL_0:2;
                      then n<j by A38,A60,A67,A68,SEQ_4:137;
                      hence contradiction by A69,NAT_1:13;
                    end;
                    suppose
                      D2.ID2 in rng D1;
                      then consider n such that
A70:                  n in dom D1 and
A71:                  D1.n=D2.ID2 by PARTFUN1:3;
                      D2.indx(D2,D1,j1)<D2.ID2 by A63,A62,XXREAL_0:2;
                      then j1<n by A41,A64,A70,A71,SEQ_4:137;
                      then
A72:                  j<n+1 by XREAL_1:19;
                      n<j by A38,A58,A60,A70,A71,SEQ_4:137;
                      hence contradiction by A72,NAT_1:13;
                    end;
                  end;
                  upper_bound divset(D1,j)=D1.j by A38,A40,INTEGRA1:def 4;
                  then
A73:              upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A10,A38,
INTEGRA1:def 19;
                  lower_bound divset(D1,j)=D1.j1 by A38,A40,INTEGRA1:def 4;
                  then
A74:              lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A10,A41,
INTEGRA1:def 19;
                  D2.ID2 in rng D2 by A57,FUNCT_1:def 3;
                  then
A75:              D2.ID2 in rng D by A11,A65,XBOOLE_0:def 3;
                  D2 .ID1 in rng D2 by A61,FUNCT_1:def 3;
                  then
A76:              D2.ID1 in rng D by A11,A65,XBOOLE_0:def 3;
                  D2.indx(D2,D1,j1)<=D2.ID2 by A63,A62,XXREAL_0:2;
                  then D2.ID2 in divset(D1,j) by A58,A74,A73,INTEGRA2:1;
                  then
A77:              D2.ID2 in rng D /\ divset(D1,j) by A75,XBOOLE_0:def 4;
                  D2.ID1<=D2.indx(D2,D1,j) by A62,A58,XXREAL_0:2;
                  then D2.ID1 in divset(D1,j) by A63,A74,A73,INTEGRA2:1;
                  then D2.ID1 in rng D /\ divset(D1,j) by A76,XBOOLE_0:def 4;
                  hence contradiction by A8,A38,A53,A61,A57,A77,Th5,SEQ_4:138;
                end;
A78:            1 <= indx(D2,D1,j1)+1 by A46,NAT_1:13;
                j <= len D1 by A38,FINSEQ_3:25;
                then
A79:            j <= len upper_volume(f,D1) by INTEGRA1:def 6;
A80:            1 <= j by A38,FINSEQ_3:25;
                then
A81:            mid(upper_volume(f,D1),j,j).1 = upper_volume(f,D1).j by A79,
FINSEQ_6:118;
                reconsider uv = upper_volume(f,D1).j as Element of REAL
                        by XREAL_0:def 1;
                j-'j+1 = 1 by Lm1;
                then len mid(upper_volume(f,D1),j,j) = 1 by A80,A79,
FINSEQ_6:118;
                then mid(upper_volume(f,D1),j,j) =<*uv*> by A81,FINSEQ_1:40;
                then
A82:            Sum mid(upper_volume(f,D1),j,j)= upper_volume(f,D1).j by
FINSOP_1:11;
                indx(D2,D1,j) in dom D2 by A10,A38,INTEGRA1:def 19;
                then
A83:            indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
                then
A84:            1 <= indx(D2,D1,j) by FINSEQ_1:1;
                indx(D2,D1,j) in Seg len upper_volume(f,D2) by A83,
INTEGRA1:def 6;
                then
A85:            indx(D2,D1,j) <= len upper_volume(f,D2) by FINSEQ_1:1;
                then
A86:            indx(D2,D1,j1)+1 <= len upper_volume(f,D2 ) by A49,XXREAL_0:2;
                then indx(D2,D1,j1)+1 in Seg len upper_volume(f,D2) by A78,
FINSEQ_1:1;
                then
A87:            indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 6;
                then
A88:            indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
                indx(D2,D1,j)-'(indx(D2,D1,j1)+1) =indx(D2,D1,j)-(indx(
                D2,D1,j1)+1) by A49,XREAL_1:233;
                then indx(D2,D1,j)-'(indx(D2,D1,j1) +1)+1 <= 2 by A51;
                then
A89:            len mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
                ,j))<=2 by A49,A84,A85,A78,A86,FINSEQ_6:118;
                indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 >= 0+1 by XREAL_1:6;
                then
A90:            1 <= len mid(upper_volume(f,D2),(indx(D2, D1,j1)+1),indx
                (D2,D1,j )) by A49,A84,A85,A78,A86,FINSEQ_6:118;
                now
                  per cases by A90,A89,Lm2;
                  suppose
A91:                len mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),
                    indx(D2,D1,j))=1;
                    upper_bound divset(D1,j)=D1.j by A38,A40,INTEGRA1:def 4;
                    then
A92:                upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A10,A38,
INTEGRA1:def 19;
                    lower_bound divset(D1,j)=D1.j1 by A38,A40,INTEGRA1:def 4;
                    then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A10,A41,
INTEGRA1:def 19;
                    then
A93:                divset(D1,j)=[. D2.indx(D2,D1, j1),D2.indx(D2,D1,j)
                    .] by A92,INTEGRA1:4;
A94:                delta(D1) >= 0 by Th9;
A95:                upper_bound rng f - lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
A96:                indx(D2,D1,j) in dom D2 by A10,A38,INTEGRA1:def 19;
                    len mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(
D2,D1,j)) = indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1 by A49,A84,A85,A78,A86,
FINSEQ_6:118;
                    then
A97:                indx(D2,D1,j)-(indx(D2,D1,j1)+1)=0 by A49,A91,XREAL_1:233;
                    then indx(D2,D1,j)<>1 by A45,FINSEQ_1:1;
                    then
A98:                upper_bound divset(D2,indx(D2,D1,j))=D2.indx(D2,D1,j
                    ) by A96,INTEGRA1:def 4;
                    indx(D2,D1,j)-1=indx(D2,D1,j1) by A97;
                    then lower_bound divset(D2,indx(D2,D1,j))= D2.indx(D2,D1,
                    j1) by A46,A97,A96,INTEGRA1:def 4;
                    then
A99:                divset(D2,indx(D2,D1,j))=divset(D1,j) by A93,A98,INTEGRA1:4
;
               reconsider uv = upper_volume(f,D2).(indx(D2,D1,j1)+1)
                       as Element of REAL
                  by XREAL_0:def 1;
                    mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)).1 =upper_volume(f,D2).(indx(D2,D1,j1)+1) by A84,A85,A78,A86,FINSEQ_6:118;
                    then mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)) =<*uv*> by A91,FINSEQ_1:40;
                    then Sum mid(upper_volume(f,D2),(indx( D2,D1,j1)+1),indx(
D2,D1,j )) =upper_volume(f,D2).(indx(D2,D1,j1)+1) by FINSOP_1:11
                      .=(upper_bound(rng(f|divset(D2,(indx(D2,D1,j1)+1)))))
                    *vol(divset(D2,(indx(D2,D1,j1)+1))) by A88,INTEGRA1:def 6
                      .=Sum mid(upper_volume(f,D1),j,j) by A38,A82,A97,A99,
INTEGRA1:def 6;
                    hence thesis by A94,A95;
                  end;
                  suppose
A100:               len mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),
                    indx(D2,D1,j))=2;
A101:               mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)).1 =upper_volume(f,D2).(indx(D2,D1,j1)+1) by A84,A85,A78,A86,FINSEQ_6:118;
A102:               2+(indx(D2,D1,j1)+1)>=0+1 by XREAL_1:7;
                    mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)).2 =UVf(D2).(2+(indx(D2,D1,j1)+1)-'1) by A49,A84,A85,A78,A86,A100,
FINSEQ_6:118
                      .=UVf(D2).(2+(indx(D2,D1,j1)+1)-1) by A102,XREAL_1:233
                      .=UVf(D2).(indx(D2,D1,j1)+(1+1));
                    then mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(D2,D1
,j)) =<*upper_volume(f,D2).(indx(D2,D1,j1)+1), upper_volume(f,D2).(indx(D2,D1,
                    j1)+2)*> by A100,A101,FINSEQ_1:44;
                    then
A103:               Sum mid(upper_volume(f,D2),(indx(D2,D1,j1)+1),indx(
D2,D1,j)) =upper_volume(f,D2).(indx(D2,D1,j1)+1) +upper_volume(f,D2).(indx(D2,
                    D1,j1)+2) by RVSUM_1:77;
A104:               vol(divset(D2,indx(D2,D1,j1)+1))>=0 by INTEGRA1:9;
                    upper_bound divset(D1,j)=D1.j by A38,A40,INTEGRA1:def 4;
                    then
A105:               upper_bound divset(D1,j)=D2. indx(D2,D1,j) by A10,A38,
INTEGRA1:def 19;
A106:               vol(divset(D2,indx(D2,D1,j1)+2))>=0 by INTEGRA1:9;
                    indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A49,A84,A85,A78
,A86,A100,FINSEQ_6:118;
                    then
A107:               2=indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1 by A49,XREAL_1:233
                      .=indx(D2,D1,j)-indx(D2,D1,j1);
                    then
A108:               indx (D2,D1,j1)+2 in dom D2 by A10,A38,INTEGRA1:def 19;
                    lower_bound divset(D1,j)=D1.j1 by A38,A40,INTEGRA1:def 4;
                    then lower_bound divset(D1,j)=D2.indx(D2,D1,j1) by A10,A41,
INTEGRA1:def 19;
                    then
A109:               vol(divset(D1,j)) =D2.(indx(D2,D1,j1)+2)-D2.(indx(D2
,D1,j1)+1) +D2.(indx(D2,D1,j1)+1)-D2.indx(D2,D1,j1) by A105,A107,INTEGRA1:def 5
;
                    indx(D2,D1,j1)+1 in Seg len upper_volume(f,D2) by A78,A86,
FINSEQ_1:1;
                    then indx(D2,D1,j1)+1 in Seg len D2 by INTEGRA1:def 6;
                    then
A110:               indx(D2,D1,j1)+1 in dom D2 by FINSEQ_1:def 3;
A111:               indx(D2,D1,j1)+1 <> 1 by A46,NAT_1:13;
                    then
A112:               upper_bound divset(D2,(indx( D2,D1,j1)+1))= D2.(indx
                    (D2,D1,j1)+1) by A110,INTEGRA1:def 4;
                    indx(D2,D1,j1)+1-1=indx(D2,D1,j1)+0;
                    then
A113:               lower_bound divset(D2,(indx(D2,D1,j1)+1))= D2.indx(
                    D2,D1,j1) by A110,A111,INTEGRA1:def 4;
A114:               indx(D2,D1,j1)+1+1 > 1 by A78,NAT_1:13;
                    indx(D2,D1,j1)+2-1=indx(D2,D1,j1)+1;
                    then
A115:               lower_bound divset(D2,(indx(D2,D1,j1)+2))= D2.(indx(
                    D2,D1,j1)+1) by A108,A114,INTEGRA1:def 4;
                    upper_bound divset(D2,(indx(D2,D1,j1)+2))= D2.(indx(
                    D2,D1,j1)+2) by A108,A114,INTEGRA1:def 4;
                    then vol(divset(D1,j))=vol(divset(D2,indx(D2,D1,j1)+2)) +
D2.(indx(D2,D1,j1)+1)-D2.indx(D2,D1,j1) by A115,A109,INTEGRA1:def 5
                      .=vol(divset(D2,indx(D2,D1,j1)+2)) +(upper_bound
divset(D2,indx(D2,D1,j1)+1)-lower_bound divset(D2, indx(D2,D1,j1)+1)) by A113
,A112;
                    then
A116:               vol(divset(D1,j)) =vol(divset(D2,indx(D2,D1,j1)+1))+
                    vol(divset(D2,indx(D2,D1,j1)+2)) by INTEGRA1:def 5;
                    then
A117:               upper_volume(f,D1).j=(upper_bound(rng(f| divset(D1,j
))))* (vol(divset(D2,indx(D2,D1,j1)+1))+vol(divset(D2,indx(D2,D1,j1)+2))) by
A38,INTEGRA1:def 6;
A118:               Sum mid(UVf(D1),j,j)-Sum mid(UVf(D2),indx(D2,D1,j1)+
1,indx(D2, D1,j)) <=(upper_bound rng f - lower_bound rng f)* (vol(divset(D2,
                    indx(D2,D1,j1)+2)) +vol(divset(D2,indx(D2,D1,j1)+1)))
                    proof
                      set ID2=indx(D2,D1,j1)+2;
                      set ID1=indx(D2,D1,j1)+1;
                      set SR = upper_bound rng(f|divset(D2,ID1)), VR = vol(
                      divset(D2,ID1));
                      set B = vol(divset(D2,ID1));
                      set C = vol(divset(D2,ID2));
                      divset(D1,j)c=A by A38,INTEGRA1:8;
                      then
A119:                 upper_bound rng(f|divset(D1,j)) <= upper_bound rng
                      f by A1,Lm4;
                      ID1 in dom D2 by A87,FINSEQ_1:def 3;
                      then divset(D2,ID1)c=A by INTEGRA1:8;
                      then upper_bound rng(f|divset(D2,ID1)) >= lower_bound
                      rng f by A1,Lm4;
                      then
A120:                 (upper_bound rng(f|divset(D2,ID1)))* vol(divset(D2
,ID1)) >=(lower_bound rng f)*vol(divset(D2,ID1)) by A104,XREAL_1:64;
                      indx(D2,D1,j)-'(indx(D2,D1,j1)+1)+1=2 by A49,A84,A85,A78
,A86,A100,FINSEQ_6:118;
                      then
A121:                 2=indx(D2,D1,j)-(indx(D2,D1,j1)+1)+1 by A49,XREAL_1:233
                        .=indx(D2,D1,j)-indx(D2,D1,j1);
A122:                 indx(D2,D1,j) in dom D2 by A10,A38,INTEGRA1:def 19;
                      then divset(D2,ID2) c= A by A121,INTEGRA1:8;
                      then
A123:                 upper_bound rng(f|divset(D2,ID2)) >= lower_bound
                      rng f by A1,Lm4;
                      reconsider A = upper_bound rng(f|divset(D1,j)) as Real;
A124:                 upper_volume(f,D1).j-A*B = A*C by A117;
                      (upper_bound rng(f|divset(D1,j)))*vol( divset(D2,
ID2)) <=(upper_bound rng f)*vol(divset(D2,ID2)) by A106,A119,XREAL_1:64;
                      then Sum mid(UVf(D1),j,j)<=(upper_bound rng(f|divset(D1
,j)))* vol(divset(D2, ID1)) +(upper_bound rng f)*vol(divset(D2,ID2)) by A82
,A124,XREAL_1:20;
                      then
A125:                 Sum mid(UVf(D1),j,j)-(upper_bound rng f)* vol(
divset(D2,ID2) ) <=(upper_bound rng(f|divset(D1,j)))*vol(divset(D2,ID1)) by
XREAL_1:20;
                      (upper_bound rng(f|divset(D1,j)))*vol(divset(D2,
ID1)) <=(upper_bound rng f)*vol(divset(D2,ID1)) by A104,A119,XREAL_1:64;
                      then Sum mid(UVf(D1),j,j)-(upper_bound rng f)* vol(
divset(D2,ID2) ) <=(upper_bound rng f)*vol(divset(D2,ID1)) by A125,XXREAL_0:2;
                      then
A126:                 Sum mid(UVf(D1),j,j) <=(upper_bound rng f)*vol(
divset(D2,ID2))+(upper_bound rng f)* vol(divset(D2,ID1)) by XREAL_1:20;
                      Sum mid(UVf(D2),ID1,indx(D2,D1,j)) =(upper_bound
rng(f|divset(D2,ID2)))*vol(divset(D2,ID2)) +UVf(D2).ID1 by A103,A122,A121,
INTEGRA1:def 6
                        .=(upper_bound rng(f|divset(D2,ID2)))* vol(divset(D2
,ID2)) +(upper_bound rng(f|divset(D2,ID1))) *vol(divset(D2,ID1)) by A88,
INTEGRA1:def 6;
                      then Sum mid(UVf(D2),ID1,indx(D2,D1,j)) - SR*VR >=(
lower_bound rng f)*vol(divset(D2,ID2)) by A106,A123,XREAL_1:64;
                      then Sum mid(UVf(D2),ID1,indx(D2,D1,j)) >=(lower_bound
                      rng f)*vol(divset(D2,ID2))+SR*VR by XREAL_1:19;
                      then Sum mid(UVf(D2),ID1,indx(D2,D1,j))-(lower_bound
                      rng f)* vol(divset(D2, ID2)) >=SR*VR by XREAL_1:19;
                      then Sum mid(UVf(D2),ID1,indx(D2,D1,j))-(lower_bound
rng f)* vol(divset(D2, ID2)) >=(lower_bound rng f)*VR by A120,XXREAL_0:2;
                      then Sum mid(UVf(D2),ID1,indx(D2,D1,j))>=(lower_bound
rng f)*vol(divset(D2, ID2))+ (lower_bound rng f)*VR by XREAL_1:19;
                      then Sum mid(UVf(D1),j,j)-Sum mid(UVf(D2),ID1,indx(D2,
D1,j)) <=(upper_bound rng f)*vol(divset(D2,ID2))+(upper_bound rng f)* vol(
divset(D2,ID1)) -((lower_bound rng f)*vol(divset(D2,ID2))+(lower_bound rng f)*
                      vol(divset(D2,ID1))) by A126,XREAL_1:13;
                      hence thesis;
                    end;
                    upper_bound rng f - lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
                    then (upper_bound rng f - lower_bound rng f)*( vol(divset
(D1,j))) <=(upper_bound rng f - lower_bound rng f)*delta(D1) by A38,Lm5,
XREAL_1:64;
                    hence thesis by A116,A118,XXREAL_0:2;
                  end;
                end;
                hence thesis;
              end;
              j < j+1 by NAT_1:13;
              then
A127:         j1 < j by XREAL_1:19;
              indx(D2,D1,j) in dom D2 by A10,A38,INTEGRA1:def 19;
              then
A128:         indx(D2,D1,j) in Seg len D2 by FINSEQ_1:def 3;
              then
A129:         1 <= indx(D2,D1,j) by FINSEQ_1:1;
A130:         indx(D2,D1,j1) <= len D2 by A45,FINSEQ_1:1;
              then
A131:         len (D2|indx(D2,D1,j1))=indx(D2,D1,j1) by FINSEQ_1:59;
A132:         j1 in Seg len D1 by A43,FINSEQ_1:def 3;
              then
A133:         j1 <= len D1 by FINSEQ_1:1;
              for x1 being object st x1 in rng(D1|j1)
                 holds x1 in rng(D2|indx(D2,D1,j1))
              proof
                let x1 be object;
                assume x1 in rng(D1|j1);
                then consider k such that
A134:           k in dom(D1|j1) and
A135:           x1=(D1|j1).k by PARTFUN1:3;
                k in Seg len(D1|j1) by A134,FINSEQ_1:def 3;
                then
A136:           k in Seg j1 by A133,FINSEQ_1:59;
                then
A137:           k in dom D1 by A41,RFINSEQ:6;
                k <= j1 by A136,FINSEQ_1:1;
                then D1.k <= D1.j1 by A43,A137,SEQ_4:137;
                then D2.indx(D2,D1,k) <= D1.j1 by A10,A137,INTEGRA1:def 19;
                then
A138:           D2.indx(D2,D1,k)<=D2.indx(D2,D1,j1) by A10,A43,INTEGRA1:def 19;
A139:           (D1|j1).k = D1.k by A41,A136,RFINSEQ:6;
                D1.k in rng D1 by A137,FUNCT_1:def 3;
                then x1 in rng D2 by A11,A135,A139,XBOOLE_0:def 3;
                then consider n such that
A140:           n in dom D2 and
A141:           x1=D2.n by PARTFUN1:3;
                D2.indx(D2,D1,k)=D2.n by A10,A135,A139,A137,A141,
INTEGRA1:def 19;
                then
A142:           n <= indx(D2,D1,j1) by A44,A140,A138,SEQM_3:def 1;
                1 <= n by A140,FINSEQ_3:25;
                then
A143:           n in Seg indx(D2,D1,j1) by A142,FINSEQ_1:1;
                then n in Seg len(D2|indx(D2,D1,j1)) by A130,FINSEQ_1:59;
                then
A144:           n in dom(D2|indx(D2,D1,j1)) by FINSEQ_1:def 3;
                D2.n = (D2|indx(D2,D1,j1)).n by A44,A143,RFINSEQ:6;
                hence thesis by A141,A144,FUNCT_1:def 3;
              end;
              then
A145:         rng(D1|j1) c= rng(D2|indx(D2,D1,j1));
A146:         1 <= j1 by A132,FINSEQ_1:1;
              lower_bound divset(D1,j) <= D.1 by A39,INTEGRA2:1;
              then
A147:         D1.j1 <= D.1 by A38,A40,INTEGRA1:def 4;
              for x1 being object st x1 in rng(D2|indx(D2,D1,j1))
                holds x1 in rng(D1|j1)
              proof
                let x1 be object;
                assume x1 in rng(D2|indx(D2,D1,j1));
                then consider k such that
A148:           k in dom(D2|indx(D2,D1,j1)) and
A149:           x1=(D2|indx(D2,D1,j1)).k by PARTFUN1:3;
                k in Seg len(D2|indx(D2,D1,j1)) by A148,FINSEQ_1:def 3;
                then
A150:           k in Seg indx(D2,D1,j1) by A130,FINSEQ_1:59;
                then
A151:           k in dom D2 by A44,RFINSEQ:6;
A152:           len(D1|j1) = j1 by A133,FINSEQ_1:59;
                k <= indx(D2,D1,j1) by A150,FINSEQ_1:1;
                then D2.k <= D2.indx(D2,D1,j1) by A44,A151,SEQ_4:137;
                then
A153:           D2.k <= D1.j1 by A10,A43,INTEGRA1:def 19;
A154:           D2.k in rng D1 implies D2.k in rng(D1|j1)
                proof
                  assume D2.k in rng D1;
                  then consider m such that
A155:             m in dom D1 and
A156:             D2.k = D1.m by PARTFUN1:3;
                  m in Seg len D1 by A155,FINSEQ_1:def 3;
                  then
A157:             1 <= m by FINSEQ_1:1;
A158:             m <= j1 by A41,A153,A155,A156,SEQM_3:def 1;
                  then m in Seg len(D1|j1) by A152,A157,FINSEQ_1:1;
                  then
A159:             m in dom (D1|j1) by FINSEQ_1:def 3;
                  m in Seg j1 by A157,A158,FINSEQ_1:1;
                  then D2.k = (D1|j1).m by A41,A156,RFINSEQ:6;
                  hence thesis by A159,FUNCT_1:def 3;
                end;
A160:           D2.k in rng D implies D2.k = D1.j1
                proof
                  assume D2.k in rng D;
                  then consider n such that
A161:             n in dom D and
A162:             D2.k=D.n by PARTFUN1:3;
                  1 <= n by A161,FINSEQ_3:25;
                  then D.1 <= D2.k by A37,A161,A162,SEQ_4:137;
                  then D1.j1 <= D2.k by A147,XXREAL_0:2;
                  hence thesis by A153,XXREAL_0:1;
                end;
A163:           D2.k in rng D implies D2.k in rng(D1|j1)
                proof
                  j1 in Seg len(D1|j1) by A146,A152,FINSEQ_1:1;
                  then j1 in dom(D1|j1) by FINSEQ_1:def 3;
                  then
A164:             (D1|j1).j1 in rng(D1|j1) by FUNCT_1:def 3;
                  assume
A165:             D2.k in rng D;
                  j1 in Seg j1 by A146,FINSEQ_1:1;
                  hence thesis by A41,A160,A165,A164,RFINSEQ:6;
                end;
                D2.k in rng D2 by A151,FUNCT_1:def 3;
                hence thesis by A11,A44,A149,A150,A163,A154,RFINSEQ:6
,XBOOLE_0:def 3;
              end;
              then rng(D2|indx(D2,D1,j1)) c= rng (D1|j1);
              then
A166:         rng (D2|indx(D2,D1,j1)) = rng (D1|j1) by A145,XBOOLE_0:def 10;
              mid(D1,1,j1) is increasing by A38,A40,A146,INTEGRA1:7,35;
              then
A167:         D1|j1 is increasing by A146,FINSEQ_6:116;
              then
A168:         D2|indx(D2,D1,j1)=D1|j1 by A47,A166,Th6;
A169:         for k st 1 <= k & k <= j1 holds k=indx(D2,D1,k)
              proof
                let k;
                assume that
A170:           1 <= k and
A171:           k <= j1;
                assume
A172:           k<>indx(D2,D1,k);
                now
                  per cases by A172,XXREAL_0:1;
                  suppose
A173:               k > indx(D2,D1,k);
                    k <= len D1 by A133,A171,XXREAL_0:2;
                    then
A174:               k in dom D1 by A170,FINSEQ_3:25;
                    then indx(D2,D1,k) in dom D2 by A10,INTEGRA1:def 19;
                    then indx(D2,D1,k) in Seg len D2 by FINSEQ_1:def 3;
                    then
A175:               1<=indx(D2,D1,k) by FINSEQ_1:1;
A176:               indx(D2,D1,k) < j1 by A171,A173,XXREAL_0:2;
                    then
A177:               indx(D2,D1,k) in Seg j1 by A175,FINSEQ_1:1;
                    indx(D2,D1,k)<= indx(D2,D1,j1) by A10,A41,A171,A174,Th7;
                    then indx(D2,D1,k) in Seg indx(D2,D1,j1) by A175,FINSEQ_1:1
;
                    then
A178:               (D2|indx(D2,D1,j1)).indx(D2,D1,k)= D2.indx(D2,D1,k)
                    by A44,RFINSEQ:6;
                    indx(D2,D1,k) <= len D1 by A133,A176,XXREAL_0:2;
                    then indx(D2,D1,k) in dom D1 by A175,FINSEQ_3:25;
                    then
A179:               D1.k > D1.indx(D2,D1,k) by A173,A174,SEQM_3:def 1;
                    D1.k=D2. indx(D2,D1,k) by A10,A174,INTEGRA1:def 19;
                    hence contradiction by A41,A168,A178,A179,A177,RFINSEQ:6;
                  end;
                  suppose
A180:               k < indx(D2,D1,k);
                    k <= len D1 by A133,A171,XXREAL_0:2;
                    then
A181:               k in dom D1 by A170,FINSEQ_3:25;
                    then indx(D2,D1,k) <= indx(D2,D1,j1) by A10,A41,A171,Th7;
                    then
A182:               k <= indx(D2,D1,j1) by A180,XXREAL_0:2;
                    then k <= len D2 by A130,XXREAL_0:2;
                    then
A183:               k in dom D2 by A170,FINSEQ_3:25;
                    k in Seg j1 by A170,A171,FINSEQ_1:1;
                    then
A184:               D1.k = (D1|j1).k by A43,RFINSEQ:6;
                    indx(D2,D1,k) in dom D2 by A10,A181,INTEGRA1:def 19;
                    then
A185:               D2.k < D2.indx(D2,D1,k) by A180,A183,SEQM_3:def 1;
A186:               k in Seg indx(D2,D1,j1) by A170,A182,FINSEQ_1:1;
                    D1.k=D2. indx(D2,D1,k) by A10,A181,INTEGRA1:def 19;
                    hence contradiction by A44,A168,A184,A185,A186,RFINSEQ:6;
                  end;
                end;
                hence contradiction;
              end;
A187:         for k be Nat st 1 <= k & k <= len(upper_volume(f,D1)|j1)
holds (upper_volume(f,D1)|j1).k = (upper_volume(f,D2)|indx(D2,D1,j1)).k
              proof
                indx(D2,D1,j1) in Seg len D2 by A44,FINSEQ_1:def 3;
                then indx(D2,D1,j1) in Seg len upper_volume(f,D2) by
INTEGRA1:def 6;
                then
A188:           indx(D2,D1,j1) in dom upper_volume(f,D2) by FINSEQ_1:def 3;
                let k be Nat;
                assume that
A189:           1 <= k and
A190:           k <= len(upper_volume(f,D1)|j1);
A191:           len(upper_volume(f,D1)) = len D1 by INTEGRA1:def 6;
                then
A192:           k <= j1 by A133,A190,FINSEQ_1:59;
                then
A193:           k in Seg j1 by A189,FINSEQ_1:1;
                then indx(D2,D1,k) in Seg j1 by A169,A189,A192;
                then
A194:           indx(D2,D1,k) in Seg indx(D2,D1,j1) by A146,A169;
                then indx(D2,D1,k)<=indx(D2,D1,j1) by FINSEQ_1:1;
                then
A195:           indx(D2,D1,k)<=len D2 by A130,XXREAL_0:2;
                k <= len D1 by A133,A192,XXREAL_0:2;
                then
A196:           k in Seg len D1 by A189,FINSEQ_1:1;
                then
A197:           k in dom D1 by FINSEQ_1:def 3;
                then
A198:           indx(D2,D1,k) in dom D2 by A10,INTEGRA1:def 19;
A199:           D1.k=D2.indx (D2,D1,k) by A10,A197,INTEGRA1:def 19;
A200:           lower_bound divset(D1,k)=lower_bound divset(D2, indx(D2,
D1,k)) & upper_bound divset(D1,k)=upper_bound divset(D2,indx(D2,D1,k))
                proof
                  per cases;
                  suppose
A201:               k=1;
                    then
A202:               upper_bound divset(D1,k)=D1.k by A197,INTEGRA1:def 4;
A203:               lower_bound divset(D1,k)=lower_bound A by A197,A201,
INTEGRA1:def 4;
                    indx(D2,D1,k)=1 by A146,A169,A201;
                    hence thesis by A198,A199,A203,A202,INTEGRA1:def 4;
                  end;
                  suppose
A204:               k<>1;
                    then reconsider k1=k-1 as Element of NAT by A197,INTEGRA1:7
;
                    k <= k+1 by NAT_1:11;
                    then k1 <= k by XREAL_1:20;
                    then
A205:               k1 <= j1 by A192,XXREAL_0:2;
A206:               k-1 in dom D1 by A197,A204,INTEGRA1:7;
                    then 1 <= k1 by FINSEQ_3:25;
                    then k1=indx(D2,D1,k1) by A169,A205;
                    then
A207:               D2.(indx(D2,D1,k)-1)= D2.indx(D2,D1,k1) by A169,A189,A192
,A193;
A208:               indx(D2,D1,k)<>1 by A169,A189,A192,A193,A204;
                    then
A209:               lower_bound divset(D2,indx(D2,D1,k))= D2.(indx(D2,D1
                    ,k)-1) by A198,INTEGRA1:def 4;
A210:               upper_bound divset(D2,indx(D2,D1,k))=D2.indx(D2,D1,k
                    ) by A198,A208,INTEGRA1:def 4;
A211:               upper_bound divset(D1,k)=D1.k by A197,A204,INTEGRA1:def 4;
                    lower_bound divset(D1,k)=D1.(k-1) by A197,A204,
INTEGRA1:def 4;
                    hence thesis by A10,A197,A211,A206,A209,A210,A207,
INTEGRA1:def 19;
                  end;
                end;
                divset(D2,indx(D2,D1,k))= [. lower_bound divset(D2, indx
(D2,D1,k)), upper_bound divset(D2,indx(D2,D1,k)).] by INTEGRA1:4;
                then
A212:           divset(D1,k)=divset(D2,indx(D2,D1,k)) by A200,INTEGRA1:4;
A213:           k in dom D1 by A196,FINSEQ_1:def 3;
                j1 in Seg len(upper_volume(f,D1)) by A41,A191,FINSEQ_1:def 3;
                then j1 in dom(upper_volume(f,D1)) by FINSEQ_1:def 3;
                then
A214:           (upper_volume(f,D1)|j1).k = upper_volume(f,D1).k by A193,
RFINSEQ:6
                  .=(upper_bound(rng(f|divset(D2,indx(D2,D1,k)))))*vol(
                divset(D2,indx(D2,D1,k))) by A213,A212,INTEGRA1:def 6;
                1<=indx(D2,D1,k) by A169,A189,A192,A193;
                then indx(D2,D1,k) in Seg len D2 by A195,FINSEQ_1:1;
                then
A215:           indx(D2,D1,k) in dom D2 by FINSEQ_1:def 3;
                (upper_volume(f,D2)|indx(D2,D1,j1)).k =(upper_volume(f,
                D2)|indx(D2,D1,j1)).indx(D2,D1,k) by A169,A189,A192,A193
                  .=upper_volume(f,D2).indx(D2,D1,k) by A194,A188,RFINSEQ:6
                  .=(upper_bound(rng(f|divset(D2,indx(D2,D1,k)))))*vol(
                divset(D2,indx(D2,D1,k))) by A215,INTEGRA1:def 6;
                hence thesis by A214;
              end;
              indx(D2,D1,j1) in dom D2 by A10,A43,INTEGRA1:def 19;
              then indx(D2,D1,j1) <= len D2 by FINSEQ_3:25;
              then
A216:         indx(D2,D1,j1) <= len upper_volume(f,D2) by INTEGRA1:def 6;
              j1 <= len D1 by A43,FINSEQ_3:25;
              then
A217:         j1 <= len upper_volume(f,D1) by INTEGRA1:def 6;
              len (D2|indx(D2,D1,j1))=len (D1|j1) by A47,A167,A166,Th6;
              then indx(D2,D1,j1) =j1 by A133,A131,FINSEQ_1:59;
              then len(upper_volume(f,D1)|j1)=indx(D2,D1,j1) by A217,
FINSEQ_1:59;
              then len(upper_volume(f,D1)|j1)=len(upper_volume(f, D2)|indx(D2
              ,D1,j1)) by A216,FINSEQ_1:59;
              then
A218:         upper_volume(f,D2)|indx(D2,D1,j1)=upper_volume (f,D1)|j1
              by A187,FINSEQ_1:14;
A219:         j in Seg len D1 by A38,FINSEQ_1:def 3;
              then
A220:         1 <= j by FINSEQ_1:1;
              indx(D2,D1,j) in Seg len UVf(D2) by A128,INTEGRA1:def 6;
              then
A221:         indx(D2,D1,j) in dom UVf(D2) by FINSEQ_1:def 3;
              indx(D2,D1,j) <= len D2 by A128,FINSEQ_1:1;
              then
A222:         indx(D2,D1,j) <= len UVf(D2) by INTEGRA1:def 6;
              j in Seg len UVf(D1) by A219,INTEGRA1:def 6;
              then
A223:         j in dom UVf(D1) by FINSEQ_1:def 3;
              j <= len D1 by A219,FINSEQ_1:1;
              then
A224:         j <= len UVf(D1) by INTEGRA1:def 6;
              j1 in Seg len D1 by A41,FINSEQ_1:def 3;
              then j1 in Seg len UVf(D1) by INTEGRA1:def 6;
              then j1 in dom UVf(D1) by FINSEQ_1:def 3;
              then PUf(D1,j1)=Sum(UVf(D1)|j1) by INTEGRA1:def 20;
              then PUf(D1,j1)+Sum mid(UVf(D1),j,j) =Sum((UVf(D1)|j1)^mid(UVf(
              D1),j,j)) by RVSUM_1:75
                .=Sum(mid(UVf(D1),1,j1)^mid(UVf(D1),j1+1,j)) by A146,
FINSEQ_6:116
                .=Sum(mid(UVf(D1),1,j)) by A146,A224,A127,INTEGRA2:4
                .=Sum(UVf(D1)|j) by A220,FINSEQ_6:116;
              then
A225:         PUf(D1,j1)+Sum mid(upper_volume(f,D1),j,j)=PUf(D1,j) by A223,
INTEGRA1:def 20;
              indx(D2,D1,j1) in Seg len D2 by A44,FINSEQ_1:def 3;
              then indx(D2,D1,j1) in Seg len UVf(D2) by INTEGRA1:def 6;
              then indx(D2,D1,j1) in dom UVf(D2) by FINSEQ_1:def 3;
              then PUf(D2,indx(D2,D1,j1)) =Sum(UVf(D2)|indx(D2,D1,j1)) by
INTEGRA1:def 20;
              then PUf(D2,indx(D2,D1,j1)) +Sum mid(upper_volume(f,D2),(indx(
D2,D1,j1)+1),indx(D2,D1,j)) =Sum(UVf(D2)|indx(D2,D1,j1) ^mid(UVf(D2),(indx(D2,
              D1,j1)+1),indx(D2,D1,j))) by RVSUM_1:75
                .=Sum(mid(UVf(D2),1,indx(D2,D1,j1)) ^mid(UVf(D2),indx(D2,D1,
              j1)+1,indx(D2,D1,j))) by A46,FINSEQ_6:116
                .=Sum(mid(UVf(D2),1,indx(D2,D1,j))) by A46,A48,A222,INTEGRA2:4
                .=Sum(UVf(D2)|indx(D2,D1,j)) by A129,FINSEQ_6:116;
              then
A226:         PUf(D2,indx(D2,D1,j1)) +Sum mid(upper_volume(f,D2),(indx(
D2,D1,j1)+1), indx(D2,D1,j)) =PUf(D2,indx(D2,D1,j)) by A221,INTEGRA1:def 20;
              indx(D2,D1,j1) in Seg len D2 by A44,FINSEQ_1:def 3;
              then indx(D2,D1,j1) in Seg len upper_volume(f,D2) by
INTEGRA1:def 6;
              then indx(D2,D1,j1) in dom upper_volume(f,D2) by FINSEQ_1:def 3;
              then PUf(D2,indx(D2,D1,j1))=Sum(upper_volume(f,D2)|indx(D2,D1,
              j1)) by INTEGRA1:def 20
                .=PUf(D1,j1) by A218,A42,INTEGRA1:def 20;
              hence thesis by A50,A226,A225;
            end;
            hence thesis by A38,A39;
          end;
          reconsider i as non zero Element of NAT by A15,FINSEQ_1:1;
A227:     for i being non zero Nat st P[i] holds P[i+1]
          proof
            let i be non zero Nat;
A228:       i>=1 by NAT_1:14;
            assume
A229:       P[i];
            P[i+1]
            proof
A230:         i <= i+1 by NAT_1:11;
              assume
A231:         i+1 in dom D;
              then consider j such that
A232:         j in dom D1 and
A233:         D.(i+1) in divset(D1,j) by Th3,INTEGRA1:6;
A234:         D2.indx(D2,D1,j)=D1.j by A10,A232,INTEGRA1:def 19;
              i+1 in Seg len D by A231,FINSEQ_1:def 3;
              then i+1 <= len D by FINSEQ_1:1;
              then i <= len D by A230,XXREAL_0:2;
              then
A235:         i in Seg len D by A228,FINSEQ_1:1;
              then
A236:         i in dom D by FINSEQ_1:def 3;
A237:         indx(D2,D1,j) in dom D2 by A10,A232,INTEGRA1:def 19;
              then
A238:         1 <= indx(D2,D1,j) by FINSEQ_3:25;
A239:         indx(D2,D1,j) <= len D2 by A237,FINSEQ_3:25;
              then
A240:         indx(D2,D1,j) <= len UVf(D2) by INTEGRA1:def 6;
              consider n1 being Element of NAT such that
A241:         n1 in dom D1 and
A242:         D.i in divset(D1,n1) and
A243:         PUf(D1,n1)-PUf(D2,indx(D2,D1,n1))<= i*(upper_bound rng
              f- lower_bound rng f)*delta(D1) by A229,A235,FINSEQ_1:def 3;
A244:         1 <= n1+1 by NAT_1:12;
A245:         n1 < j
              proof
                assume
A246:           n1 >= j;
                now
                  per cases by A246,XXREAL_0:1;
                  suppose
A247:               n1=j;
                    D.i in rng D by A236,FUNCT_1:def 3;
                    then
A248:               D.i in rng D /\ divset(D1,j) by A242,A247,XBOOLE_0:def 4;
                    D.(i+1) in rng D by A231,FUNCT_1:def 3;
                    then
A249:               D.(i+1) in rng D /\ divset(D1,j) by A233,XBOOLE_0:def 4;
                    i+1 > i by XREAL_1:29;
                    hence contradiction by A8,A231,A232,A236,A248,A249,Th5,
SEQ_4:138;
                  end;
                  suppose
                    n1>j;
                    then
A250:               n1>=j+1 by NAT_1:13;
                    then
A251:               n1-1 >= j by XREAL_1:19;
                    1 <= j by A232,FINSEQ_3:25;
                    then 1+1 <= j+1 by XREAL_1:6;
                    then
A252:               n1 <> 1 by A250,XXREAL_0:2;
                    then n1-1 in dom D1 by A241,INTEGRA1:7;
                    then
A253:               D1.j <= D1.(n1-1) by A232,A251,SEQ_4:137;
A254:               upper_bound divset(D1,j)=D1.j
                    proof
                      per cases;
                      suppose
                        j=1;
                        hence thesis by A232,INTEGRA1:def 4;
                      end;
                      suppose
                        j<>1;
                        hence thesis by A232,INTEGRA1:def 4;
                      end;
                    end;
A255:               lower_bound divset(D1,n1) <= D.i by A242,INTEGRA2:1;
                    lower_bound divset(D1,n1)=D1.(n1-1) by A241,A252,
INTEGRA1:def 4;
                    then
A256:               D.i >= D1.j by A255,A253,XXREAL_0:2;
A257:               i < i+1 by XREAL_1:29;
                    D.(i+1)<=upper_bound divset(D1,j) by A233,INTEGRA2:1;
                    then D.i >= D.(i+1) by A254,A256,XXREAL_0:2;
                    hence contradiction by A231,A236,A257,SEQM_3:def 1;
                  end;
                end;
                hence thesis;
              end;
              then
A258:         n1+1 <= j by NAT_1:13;
A259:         1 <= n1 by A241,FINSEQ_3:25;
A260:         D2.indx(D2,D1,n1) = D1.n1 by A10,A241,INTEGRA1:def 19;
A261:         1 <= j by A232,FINSEQ_3:25;
A262:         indx(D2,D1,n1) in dom D2 by A10,A241,INTEGRA1:def 19;
              then
A263:         1 <= indx(D2,D1,n1) by FINSEQ_3:25;
A264:         j <= len D1 by A232,FINSEQ_3:25;
              then
A265:         n1+1 <= len D1 by A258,XXREAL_0:2;
              then
A266:         n1+1 in dom D1 by A244,FINSEQ_3:25;
              then
A267:         D2.indx(D2,D1,n1+ 1)=D1.(n1+1) by A10,INTEGRA1:def 19;
A268:         j <= len UVf(D1) by A264,INTEGRA1:def 6;
              then j in Seg len UVf(D1) by A261,FINSEQ_1:1;
              then
A269:         j in dom UVf(D1) by FINSEQ_1:def 3;
A270:         indx(D2,D1,n1+1) in dom D2 by A10,A266,INTEGRA1:def 19;
              then
A271:         1 <= indx(D2,D1,n1+1) by FINSEQ_3:25;
              n1 in Seg len D1 by A241,FINSEQ_1:def 3;
              then n1 in Seg len UVf(D1) by INTEGRA1:def 6;
              then n1 in dom UVf(D1) by FINSEQ_1:def 3;
              then PUf(D1,n1)=Sum(UVf(D1)|n1) by INTEGRA1:def 20
                .=Sum mid(UVf(D1),1,n1) by A259,FINSEQ_6:116;
              then PUf(D1,n1)+Sum mid(UVf(D1),n1+1,j) =Sum(mid(UVf(D1),1,n1)
              ^mid(UVf(D1),n1+1,j)) by RVSUM_1:75
                .=Sum mid(UVf(D1),1,j) by A245,A259,A268,INTEGRA2:4
                .=Sum(UVf(D1)|j) by A261,FINSEQ_6:116;
              then
A272:         PUf(D1,j)=PUf(D1,n1)+Sum mid(UVf(D1),n1+1,j) by A269,
INTEGRA1:def 20;
              indx(D2,D1,j) in Seg len D2 by A237,FINSEQ_1:def 3;
              then indx(D2,D1,j) in Seg len UVf(D2) by INTEGRA1:def 6;
              then
A273:         indx(D2,D1,j) in dom UVf(D2) by FINSEQ_1:def 3;
A274:         indx(D2,D1,n1+1) <= len D2 by A270,FINSEQ_3:25;
              D1.(n1+1) <= D1.j by A232,A258,A266,SEQ_4:137;
              then
A275:         indx(D2,D1,n1+1) <= indx(D2,D1,j) by A270,A267,A237,A234,
SEQM_3:def 1;
              then 1+indx(D2,D1,n1+1) <= indx(D2,D1,j)+1 by XREAL_1:6;
              then 1 <= indx(D2,D1,j)+1-indx(D2,D1,n1+1) by XREAL_1:19;
              then
A276:         mid(D2,indx(D2,D1,n1+1),indx(D2,D1,j)).1 =D2.(1-1+indx(D2,
              D1,n1+1)) by A275,A271,A239,FINSEQ_6:122
                .=D1.(n1+1) by A10,A266,INTEGRA1:def 19;
A277:         n1 >= 1 by A241,FINSEQ_3:25;
A278:         j-n1 >= 1 by A258,XREAL_1:19;
              Sum mid(UVf(D1),n1+1,j)-Sum mid(UVf(D2),indx(D2,D1,n1)+1,
              indx(D2,D1,j)) <= (upper_bound rng f-lower_bound rng f)*delta(D1)
              proof
                per cases by A258,XXREAL_0:1;
                suppose
A279:             n1+1=j;
A280:             indx(D2,D1,j)-indx(D2,D1,n1)<=2
                  proof
A281:               upper_bound divset(D1,j) = D1.j by A232,A245,A277,
INTEGRA1:def 4;
A282:               lower_bound divset(D1,j) = D1.(j-1) by A232,A245,A277,
INTEGRA1:def 4;
A283:               1 <= indx(D2,D1,n1)+1 by A263,NAT_1:13;
                    assume indx(D2,D1,j) - indx(D2,D1,n1) > 2;
                    then
A284:               indx(D2,D1,n1)+2 < indx(D2,D1,j) by XREAL_1:20;
                    then
A285:               indx(D2,D1,n1)+2 <= len D2 by A239,XXREAL_0:2;
A286:               indx(D2,D1,n1)+1 < indx(D2,D1,n1)+2 by XREAL_1:6;
                    then
A287:               indx(D2,D1,n1) < indx(D2,D1,n1)+2 by NAT_1:13;
                    then 1 <= indx(D2,D1,n1)+2 by A263,XXREAL_0:2;
                    then
A288:               indx(D2,D1,n1)+2 in dom D2 by A285,FINSEQ_3:25;
                    then
A289:               D2.indx(D2,D1,j) >= D2.(indx(D2,D1,n1)+2) by A237,A284,
SEQ_4:137;
A290:               not D2.(indx(D2,D1,n1)+2) in rng D1
                    proof
                      assume D2.(indx(D2,D1,n1)+2) in rng D1;
                      then consider k1 being Element of NAT such that
A291:                 k1 in dom D1 and
A292:                 D2.(indx(D2,D1,n1)+2) = D1.k1 by PARTFUN1:3;
                      D2.(indx(D2,D1,n1)+2) < D2.indx(D2,D1,j) by A237,A284
,A288,SEQM_3:def 1;
                      then
A293:                 k1 < j by A232,A234,A291,A292,SEQ_4:137;
                      D2.indx(D2,D1,n1) < D2.(indx(D2,D1,n1)+2) by A262,A287
,A288,SEQM_3:def 1;
                      then n1 < k1 by A241,A260,A291,A292,SEQ_4:137;
                      hence contradiction by A279,A293,NAT_1:13;
                    end;
                    D2.(indx(D2,D1,n1)+2) in rng D2 by A288,FUNCT_1:def 3;
                    then
A294:               D2.(indx(D2,D1,n1)+2) in rng D by A11,A290,XBOOLE_0:def 3;
A295:               lower_bound divset(D1,j) = D1.(j-1) by A232,A245,A277,
INTEGRA1:def 4;
A296:               upper_bound divset(D1,j) = D1.j by A232,A245,A277,
INTEGRA1:def 4;
                    D2.(indx(D2,D1,n1)+2) >= D2.indx(D2,D1,n1) by A262,A287
,A288,SEQ_4:137;
                    then D2.(indx(D2,D1,n1)+2) in divset(D1,j) by A260,A234
,A279,A295,A281,A289,INTEGRA2:1;
                    then
A297:               D2.(indx(D2,D1,n1)+2) in rng D /\ divset(D1,j) by A294,
XBOOLE_0:def 4;
A298:               indx(D2,D1,n1)+1 < indx(D2,D1,j) by A284,A286,XXREAL_0:2;
                    then indx(D2,D1,n1)+1 <= len D2 by A239,XXREAL_0:2;
                    then
A299:               indx(D2,D1,n1)+1 in dom D2 by A283,FINSEQ_3:25;
                    then
A300:               D2.indx(D2,D1,j) >= D2.(indx(D2,D1,n1)+1) by A237,A298,
SEQ_4:137;
A301:               indx(D2,D1,n1) < indx(D2,D1,n1)+1 by NAT_1:13;
A302:               not D2.(indx(D2,D1,n1)+1) in rng D1
                    proof
                      assume D2.(indx(D2,D1,n1)+1) in rng D1;
                      then consider k1 being Element of NAT such that
A303:                 k1 in dom D1 and
A304:                 D2.(indx(D2,D1,n1)+1) = D1.k1 by PARTFUN1:3;
                      D2.(indx(D2,D1,n1)+1) < D2.indx(D2,D1,j) by A237,A298
,A299,SEQM_3:def 1;
                      then
A305:                 k1 < j by A232,A234,A303,A304,SEQ_4:137;
                      D2.indx(D2,D1,n1) < D2.(indx(D2,D1,n1)+1) by A262,A301
,A299,SEQM_3:def 1;
                      then n1 < k1 by A241,A260,A303,A304,SEQ_4:137;
                      hence contradiction by A279,A305,NAT_1:13;
                    end;
                    D2.(indx(D2,D1,n1)+1) in rng D2 by A299,FUNCT_1:def 3;
                    then
A306:               D2.(indx(D2,D1,n1)+1) in rng D by A11,A302,XBOOLE_0:def 3;
                    D2.(indx(D2,D1,n1)+1) >= D2.indx(D2,D1,n1) by A262,A301
,A299,SEQ_4:137;
                    then D2.(indx(D2,D1,n1)+1) in divset(D1,j) by A260,A234
,A279,A282,A296,A300,INTEGRA2:1;
                    then D2.(indx(D2,D1,n1)+1) in rng D /\ divset(D1,j) by A306
,XBOOLE_0:def 4;
                    then D2.(indx(D2,D1,n1)+1) = D2.(indx(D2,D1,n1)+2) by A8
,A232,A297,Th5;
                    hence contradiction by A286,A299,A288,SEQM_3:def 1;
                  end;
A307:             indx(D2,D1,n1)+1<indx(D2,D1,j) implies indx(D2,D1,n1)+
                  2=indx(D2, D1, j )
                  proof
                    assume indx(D2,D1,n1)+1 < indx(D2,D1,j);
                    then
A308:               indx(D2,D1,n1)+1+1 <= indx(D2, D1,j) by NAT_1:13;
                    indx(D2,D1,n1)+2 >= indx(D2,D1,j) by A280,XREAL_1:20;
                    hence thesis by A308,XXREAL_0:1;
                  end;
A309:             1<=indx(D2,D1,n1)+1 by NAT_1:12;
A310:             indx(D2,D1,j) <= len UVf(D2) by A239,INTEGRA1:def 6;
                  D1.n1 < D1.j by A232,A241,A245,SEQM_3:def 1;
                  then
A311:             indx(D2,D1,n1)<indx(D2,D1,j) by A262,A260,A237,A234,SEQ_4:137
;
                  then
A312:             indx(D2,D1,n1)+1 <= indx(D2,D1,j) by NAT_1:13;
                  then indx(D2,D1,n1)+1 <= len D2 by A239,XXREAL_0:2;
                  then indx(D2,D1,n1)+1 <= len UVf(D2) by INTEGRA1:def 6;
                  then
A313:             len mid(UVf(D2),indx(D2,D1,n1)+1,indx( D2,D1,j)) =indx
(D2,D1,j)-'(indx(D2,D1,n1)+1)+1 by A238,A312,A309,A310,FINSEQ_6:118
                    .=indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1 by A312,XREAL_1:233
                    .=indx(D2,D1,j)-indx(D2,D1,n1);
                  indx(D2,D1,n1)+1 <= indx(D2,D1,j) by A311,NAT_1:13;
                  then
A314:             indx(D2,D1,n1)+1 = indx(D2,D1,j) or indx(D2,D1,n1)+1 <
                  indx(D2,D1,j) by XXREAL_0:1;
A315:             Sum mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) >=(
                  lower_bound rng f)*vol(divset(D1,n1+1))
                  proof
                    now
                      per cases by A314,A307;
                      suppose
A316:                   indx(D2,D1,j)-indx(D2,D1,n1)=1;
                        indx(D2,D1,n1)+1 >= 1+1 by A263,XREAL_1:6;
                        then
A317:                   indx(D2,D1,n1)+1 <>1;
                        then upper_bound divset(D2,indx(D2,D1,n1)+1)=D2.(indx
                        (D2,D1,n1)+1) by A237,A316,INTEGRA1:def 4;
                        then
A318:                   upper_bound divset(D2,indx(D2,D1,n1)+1)=D1.j by A10
,A232,A316,INTEGRA1:def 19;
                        lower_bound divset(D2,indx(D2,D1,n1)+1)=D2.(indx
                        (D2,D1,n1)+1-1) by A237,A316,A317,INTEGRA1:def 4;
                        then
A319:                   lower_bound divset(D2,indx(D2, D1,n1)+1)=D1.n1
                        by A10,A241,INTEGRA1:def 19;
                        lower_bound divset(D1,n1+1)=D1.(n1+1-1) by A245,A277
,A266,A279,INTEGRA1:def 4;
                        then
A320:                   divset(D2,indx(D2,D1,n1)+1)=divset(D1,n1+1) by A245
,A277,A266,A279,A319,A318,INTEGRA1:def 4;
A321:                   vol(divset(D2,indx(D2,D1,n1)+1))>=0 by INTEGRA1:9;
           reconsider UV = UVf(D2).(indx(D2,D1,n1)+1) as Element of REAL
                     by XREAL_0:def 1;
                        1=indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1 by A316;
                        then mid(UVf(D2),indx(D2,D1,n1) +1,indx(D2,D1,j)).1 =
UVf(D2).(1+(indx(D2,D1,n1)+1)-1) by A309,A310,FINSEQ_6:122
                          .=UVf(D2).(indx(D2,D1,n1)+1);
                        then
A322:                   mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))
                    =<*UV*> by A313,A316,FINSEQ_1:40;
                        UVf(D2).(indx(D2,D1,n1)+1) =(upper_bound rng(f|
divset(D2,indx(D2,D1,n1)+1))) *vol(divset(D2,indx(D2,D1,n1)+1)) by A237,A316,
INTEGRA1:def 6;
                        then UVf(D2).(indx(D2,D1,n1)+1) >=(lower_bound rng f)
*vol(divset(D1,n1+1)) by A1,A237,A316,A320,A321,Th19,XREAL_1:64;
                        hence thesis by A322,FINSOP_1:11;
                      end;
                      suppose
A323:                   indx(D2,D1,j)-indx(D2,D1,n1)=2;
                        indx(D2,D1,n1)+2 >= 2+1 by A263,XREAL_1:6;
                        then
A324:                   indx(D2,D1,n1)+2 <> 1;
                        then
A325:                   upper_bound divset(D2,indx(D2,D1,n1)+2)= D2.indx
                        (D2,D1,j) by A237,A323,INTEGRA1:def 4;
                        indx(D2,D1,n1)+2-1=indx(D2,D1,n1)+1;
                        then lower_bound divset(D2,indx(D2,D1,n1)+2) = D2.(
                        indx(D2,D1,n1)+1) by A237,A323,A324,INTEGRA1:def 4;
                        then
A326:                   vol(divset(D2,indx(D2,D1,n1)+2)) =D1.j-D2.(indx(
                        D2,D1,n1)+1) by A234,A325,INTEGRA1:def 5;
A327:                   upper_bound divset(D1,n1+1)=D1.(n1+1) by A245,A277,A266
,A279,INTEGRA1:def 4;
                        lower_bound divset(D1,n1+1)=D1.(n1+1-1) by A245,A277
,A266,A279,INTEGRA1:def 4;
                        then
A328:                   vol(divset(D1,n1+1))=D1.(n1+1)-D1.n1 by A327,
INTEGRA1:def 5;
A329:                   vol(divset(D2,indx(D2,D1,n1)+2)) >= 0 by INTEGRA1:9;
A330:                   indx(D2,D1,j) <= len UVf(D2) by A239,INTEGRA1:def 6;
A331:                   vol(divset(D2,indx(D2,D1,n1)+1)) >= 0 by INTEGRA1:9;
A332:                   1 <= indx(D2,D1,n1)+1 by NAT_1:12;
A333:                   indx(D2,D1,n1)+1 <= indx(D2,D1,n1)+2 by XREAL_1:6;
                        then indx(D2,D1,n1)+1 <= len D2 by A239,A323,XXREAL_0:2
;
                        then
A334:                   indx(D2,D1,n1)+1 in dom D2 by A332,FINSEQ_3:25;
                        then UVf(D2).(indx(D2,D1,n1 )+1) =(upper_bound rng(f|
divset(D2,indx(D2,D1,n1)+1))) *vol(divset(D2,indx(D2,D1,n1)+1)) by
INTEGRA1:def 6;
                        then
A335:                   UVf(D2).(indx(D2,D1,n1)+1) >= (lower_bound rng f
)*vol(divset(D2,indx(D2, D1,n1)+1)) by A1,A334,A331,Th19,XREAL_1:64;
                        indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1=1+1 by A323;
                        then
A336:                   mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).2 =
UVf(D2).(2+(indx(D2,D1,n1)+1)-1) by A332,A333,A330,FINSEQ_6:122
                          .=UVf(D2).(indx(D2,D1,n1)+0+2);
                        indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1>=1 by A323;
                        then mid(UVf(D2),indx(D2,D1,n1) +1,indx(D2,D1,j)).1 =
UVf(D2).(1+(indx(D2,D1,n1)+1)-1) by A323,A332,A333,A330,FINSEQ_6:122
                          .=UVf(D2).(indx(D2,D1,n1)+1);
                        then mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) =<*
UVf(D2).(indx(D2,D1,n1)+1),UVf(D2).(indx(D2,D1,n1)+2)*> by A313,A323,A336,
FINSEQ_1:44;
                        then
A337:                   Sum mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))
=UVf(D2).(indx(D2,D1,n1)+1)+UVf(D2).(indx(D2,D1,n1)+2) by RVSUM_1:77;
A338:                   indx(D2,D1,n1)+1 > 1 by A263,NAT_1:13;
                        then
A339:                   upper_bound divset(D2,indx(D2,D1,n1)+1)=D2.(indx
                        (D2,D1,n1)+1) by A334,INTEGRA1:def 4;
                        lower_bound divset(D2,indx(D2,D1,n1)+1) = D2.(
                        indx(D2,D1,n1)+1-1) by A334,A338,INTEGRA1:def 4;
                        then
A340:                   vol(divset(D2,indx(D2,D1,n1)+1)) =D2.(indx(D2,D1
                        ,n1)+1)-D1.n1 by A260,A339,INTEGRA1:def 5;
                        UVf(D2).(indx(D2,D1,n1 )+2) =(upper_bound rng(f|
divset(D2,indx(D2,D1,n1)+2))) *vol(divset(D2,indx(D2,D1,n1)+2)) by A237,A323,
INTEGRA1:def 6;
                        then UVf(D2).(indx(D2,D1,n1)+2) >= (lower_bound rng f
)*vol(divset(D2,indx(D2, D1,n1)+2)) by A1,A237,A323,A329,Th19,XREAL_1:64;
                        then Sum mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))
>= (lower_bound rng f)*vol(divset(D2,indx(D2,D1,n1)+1)) + (lower_bound rng f)*
vol(divset(D2,indx(D2,D1,n1)+2)) by A337,A335,XREAL_1:7;
                        hence thesis by A279,A340,A326,A328;
                      end;
                    end;
                    hence thesis;
                  end;
A341:             n1+1 <= len UVf(D1) by A265,INTEGRA1:def 6;
                  j-'(n1+1)+1=j-(n1+1)+1 by A279,XREAL_1:233;
                  then
A342:             len mid(UVf(D1),n1+1,j)= 1 by A244,A279,A341,FINSEQ_6:118;
 reconsider uv =(upper_bound rng(f|divset(D1,n1
                  +1)))* vol(divset(D1,n1+1)) as Element of REAL
                      by XREAL_0:def 1;
                  (n1+1)+1 <= j+1 by A258,XREAL_1:6;
                  then 1 <= j+1-(n1+1) by XREAL_1:19;
                  then mid(UVf(D1),n1+1,j).1 = UVf(D1).(1+(n1+1)-1) by A244
,A279,A341,FINSEQ_6:122
                    .=(upper_bound rng(f|divset(D1,n1+1)))*vol(divset(D1,n1+
                  1)) by A266,INTEGRA1:def 6;
                  then mid(UVf(D1),n1+1,j) =<*uv*> by A342,FINSEQ_1:40;
                  then
A343:             Sum mid(UVf(D1),n1+1,j) =(upper_bound rng(f|divset(D1,
                  n1+1)))*vol(divset(D1,n1+1)) by FINSOP_1:11;
                  divset(D1,n1+1) c= A by A266,INTEGRA1:8;
                  then
A344:             upper_bound rng(f|divset(D1,n1+1)) <= upper_bound rng
                  f by A1,Lm4;
                  n1+1 in Seg len D1 by A266,FINSEQ_1:def 3;
                  then n1+1 in Seg len upper_volume(chi(A,A),D1) by
INTEGRA1:def 6;
                  then
A345:             n1+1 in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
                  vol(divset(D1,n1+1))=upper_volume( chi(A,A),D1).(n1+1)
                  by A266,INTEGRA1:20;
                  then vol(divset(D1,n1+1)) in rng upper_volume(chi(A,A),D1)
                  by A345,FUNCT_1:def 3;
                  then
A346:             vol(divset(D1,n1+1))<=delta(D1) by XXREAL_2:def 8;
                  upper_bound rng f-lower_bound rng f >= 0 by A1,Lm3,XREAL_1:48
;
                  then
A347:             (upper_bound rng f-lower_bound rng f)* vol(divset(D1,
n1+1)) <=(upper_bound rng f-lower_bound rng f)*delta(D1) by A346,XREAL_1:64;
                  vol(divset(D1,n1+1)) >= 0 by INTEGRA1:9;
                  then Sum mid(UVf(D1),n1+1,j) <=(upper_bound rng f)*vol(
                  divset(D1,n1+1)) by A343,A344,XREAL_1:64;
                  then Sum mid(UVf(D1),n1+1,j)-Sum mid(UVf(D2 ),indx(D2,D1,n1
)+1, indx(D2, D1,j)) <=(upper_bound rng f)*vol(divset(D1,n1+1))-(lower_bound
                  rng f)* vol(divset(D1,n1+1)) by A315,XREAL_1:13;
                  hence thesis by A347,XXREAL_0:2;
                end;
                suppose
A348:             n1+1 < j;
A349:             j-'(n1+1) = j-(n1+1) by A258,XREAL_1:233;
                  then
A350:             j-'(n1+1)+1=j-n1;
A351:             n1 < n1+1 by NAT_1:13;
                  then
A352:             D1.n1 < D1.(n1+1) by A241,A266,SEQM_3:def 1;
                  then consider
                  B being non empty closed_interval Subset of REAL, MD1,MD2
                  being Division of B such that
A353:             D1 .n1=lower_bound B and
                  upper_bound B=MD2.(len MD2) and
A354:             upper_bound B=MD1.(len MD1) and
A355:             MD1 <= MD2 and
A356:             MD1=mid(D1,n1+1,j) and
A357:             MD2=mid(D2,indx(D2,D1,n1+1),indx(D2,D1,j)) by A10,A232,A258
,A266,A276,Th15;
A358:             len MD1 = j-'(n1+1)+1 by A258,A261,A264,A244,A265,A356,
FINSEQ_6:118;
                  then
A359:             len MD1 = j-(n1+1)+1 by A258,XREAL_1:233;
                  then
A360:             len MD1+(n1+1)-1 =j;
A361:             len MD1 in dom MD1 by FINSEQ_5:6;
                  then
A362:             1 <= len MD1 by FINSEQ_3:25;
A363:             lower_bound divset(MD1,len MD1)=lower_bound divset(D1,
                  j) & upper_bound divset(MD1,len MD1)=upper_bound divset(D1,j)
                  proof
                    per cases;
                    suppose
A364:                 len MD1=1;
                      then
A365:                 upper_bound divset(MD1,len MD1)=MD1.(len MD1) by A361,
INTEGRA1:def 4;
A366:                 upper_bound divset(D1,j)=D1.j by A232,A245,A277,
INTEGRA1:def 4;
                      lower_bound divset(D1,j)=D1.(j-1) by A232,A245,A277,
INTEGRA1:def 4;
                      hence
                      thesis by A261,A264,A353,A356,A359,A361,A364,A365,A366,
FINSEQ_6:118,INTEGRA1:def 4;
                    end;
                    suppose
A367:                 len MD1<>1;
                      then len MD1-1 in dom MD1 by A361,INTEGRA1:7;
                      then
A368:                 len MD1-1 >= 1 by FINSEQ_3:25;
                      len MD1 <= len MD1+1 by NAT_1:11;
                      then
A369:                 len MD1 -1 <= len MD1 by XREAL_1:20;
                      upper_bound divset(MD1,len MD1)=MD1.(len MD1) by A361
,A367,INTEGRA1:def 4;
                      then
A370:                 upper_bound divset(MD1,len MD1)=D1.j by A258,A264,A244
,A356,A358,A360,A362,FINSEQ_6:122;
A371:                 len MD1-1+(n1+1)-1=j-1 by A358,A349;
                      lower_bound divset(MD1,len MD1)=MD1.( len MD1-1)
                      by A361,A367,INTEGRA1:def 4;
                      then lower_bound divset(MD1,len MD1) = D1.( j-1) by A258
,A264,A244,A356,A358,A371,A368,A369,FINSEQ_6:122;
                      hence thesis by A232,A245,A277,A370,INTEGRA1:def 4;
                    end;
                  end;
A372:             B c= A
                  proof
                    let x1 be object;
A373:               rng D1 c= A by INTEGRA1:def 2;
                    D1.n1 in rng D1 by A241,FUNCT_1:def 3;
                    then
A374:               lower_bound A <= D1.n1 by A373,INTEGRA2:1;
                    assume
A375:               x1 in B;
                    then reconsider x1 as Real;
A376:               x1 <= MD1.(len MD1) by A354,A375,INTEGRA2:1;
                    D1.j in rng D1 by A232,FUNCT_1:def 3;
                    then
A377:               D1.j <= upper_bound A by A373,INTEGRA2:1;
                    D1.n1 <= x1 by A353,A375,INTEGRA2:1;
                    then
A378:               lower_bound A <= x1 by A374,XXREAL_0:2;
                    MD1.(len MD1)=D1.(j-n1-1+(n1+1)) by A258,A278,A264,A244
,A356,A358,A349,FINSEQ_6:122
                      .=D1.j;
                    then x1 <= upper_bound A by A376,A377,XXREAL_0:2;
                    hence thesis by A378,INTEGRA2:1;
                  end;
                  then reconsider g=f|B as Function of B,REAL by FUNCT_2:32;
A379:             delta(MD1) >= 0 by Th9;
A380:             g|B is bounded
                  proof
                    consider a be Real such that
A381:               for x being object st x in A /\ dom f holds a<=f.x
                    by A1,RFUNCT_1:71;
                    for x being object st x in B /\ dom g holds a<=g.x
                    proof
                      let x be object;
A382:                 dom f /\ B c= dom f /\ A by A372,XBOOLE_1:26;
                      assume x in B /\ dom g;
                      then
A383:                 x in dom g by XBOOLE_0:def 4;
                      then x in dom f /\ B by RELAT_1:61;
                      then a <= f.x by A381,A382;
                      hence thesis by A383,FUNCT_1:47;
                    end;
                    then
A384:               g|B is bounded_below by RFUNCT_1:71;
                    consider a be Real such that
A385:               for x being object st x in A /\ dom f holds f.x<=a
                    by A1,RFUNCT_1:70;
                    for x being object st x in B /\ dom g holds g.x<=a
                    proof
                      let x be object;
A386:                 dom f /\ B c= dom f /\ A by A372,XBOOLE_1:26;
                      assume x in B /\ dom g;
                      then
A387:                 x in dom g by XBOOLE_0:def 4;
                      then x in dom f /\ B by RELAT_1:61;
                      then a >= f.x by A385,A386;
                      hence thesis by A387,FUNCT_1:47;
                    end;
                    then g|B is bounded_above by RFUNCT_1:70;
                    hence thesis by A384;
                  end;
                  lower_bound divset(D1,j) <= D.(i+1) by A233,INTEGRA2:1;
                  then
A388:             D1.(j-1) <= D.(i+1) by A232,A245,A277,INTEGRA1:def 4;
A389:             j-'(n1+1)+1=j-(n1+1)+1 by A258,XREAL_1:233;
A390:             len upper_volume(g,MD1)=len MD1 by INTEGRA1:def 6
                    .=j-(n1+1)+1 by A258,A261,A264,A244,A265,A356,A389,
FINSEQ_6:118;
A391:             j <= len UVf(D1) by A264,INTEGRA1:def 6;
A392:             for k be Nat st 1<=k & k<=len upper_volume(g,MD1)
                  holds upper_volume(g,MD1).k=mid(UVf(D1),n1+1,j).k
                  proof
                    let k be Nat;
                    assume that
A393:               1 <= k and
A394:               k <= len upper_volume(g,MD1);
               k in Seg len upper_volume( g,MD1) by A393,A394,FINSEQ_1:1;
                    then
A395:               k in Seg len MD1 by INTEGRA1:def 6;
                    then
A396:               k in dom MD1 by FINSEQ_1:def 3;
                    k in dom MD1 by A395,FINSEQ_1:def 3;
                    then
A397:               upper_volume(g,MD1).k =(upper_bound rng(g|divset(MD1
                    ,k)))*vol(divset(MD1,k)) by INTEGRA1:def 6;
                    consider k2 being Element of NAT such that
A398:               n1+1=1+k2;
A399:               1 <= k+k2 by A393,NAT_1:12;
                    k <= j-((n1+1)-1) by A390,A394;
                    then k+((n1+1)-1) <= j by XREAL_1:19;
                    then k+k2 <= len D1 by A264,A398,XXREAL_0:2;
                    then
A400:               k+k2 in Seg len D1 by A399,FINSEQ_1:1;
                    then
A401:               k+k2 in dom D1 by FINSEQ_1:def 3;
                    1+1 <= k+k2 by A259,A393,A398,XREAL_1:7;
                    then
A402:               1 < k+k2 by NAT_1:13;
A403:               k2=(n1+1)-1 by A398;
A404:               lower_bound divset(D1,k+k2)=lower_bound divset(MD1,
                    k) & upper_bound divset(D1,k+k2)= upper_bound divset(MD1,k)
                    proof
                      per cases;
                      suppose
A405:                   k=1;
                        then upper_bound divset(MD1,k)=MD1.k by A396,
INTEGRA1:def 4;
                        then
A406:                   upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A258,A264
,A244,A356,A390,A393,A394,FINSEQ_6:122;
                        lower_bound divset(MD1,k)=D1.n1 by A353,A396,A405,
INTEGRA1:def 4;
                        hence thesis by A403,A402,A401,A405,A406,INTEGRA1:def 4
;
                      end;
                      suppose
A407:                   k<>1;
                        then upper_bound divset(MD1,k)=MD1.k by A396,
INTEGRA1:def 4;
                        then
A408:                   upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A258,A264
,A244,A356,A390,A393,A394,FINSEQ_6:122;
A409:                   k -1 <= j-(n1+1)+1 by A390,A394,XREAL_1:146,XXREAL_0:2;
A410:                   lower_bound divset(MD1,k)=MD1.(k-1) by A396,A407,
INTEGRA1:def 4;
A411:                   k-1 in dom MD1 by A396,A407,INTEGRA1:7;
                        then 1 <= k-1 by FINSEQ_3:25;
                        then lower_bound divset(MD1,k)=D1.(k-1+(n1+1)-1) by
A258,A264,A244,A356,A411,A409,A410,FINSEQ_6:122;
                        hence thesis by A398,A402,A401,A408,INTEGRA1:def 4;
                      end;
                    end;
                    divset(MD1,k)= [.lower_bound divset(MD1,k),
                    upper_bound divset(MD1,k).] by INTEGRA1:4;
                    then
A412:               divset(D1,k+k2)=divset(MD1,k) by A404,INTEGRA1:4;
A413:               k+k2 in dom D1 by A400,FINSEQ_1:def 3;
A414:               mid(UVf(D1),n1+1,j).k =UVf(D1).(k+(n1+1)-1) by A258,A244
,A390,A391,A393,A394,FINSEQ_6:122
                      .=(upper_bound rng(f|divset(D1,k+k2)))* vol(divset(D1,
                    k+k2)) by A398,A413,INTEGRA1:def 6;
                    k in dom MD1 by A395,FINSEQ_1:def 3;
                    then divset(D1,k+k2) c= B by A412,INTEGRA1:8;
                    hence thesis by A397,A414,A412,FUNCT_1:51;
                  end;
                  n1+1 <= len UVf(D1) by A265,INTEGRA1:def 6;
                  then len upper_volume(g,MD1)=len mid(UVf(D1),n1+1,j) by A258
,A261,A244,A389,A390,A391,FINSEQ_6:118;
                  then
A415:             Sum upper_volume(g,MD1)=Sum mid(UVf(D1),n1+1,j) by A392,
FINSEQ_1:14;
A416:             n1 < j-1 by A348,XREAL_1:20;
A417:             1 <= indx(D2,D1,n1)+1 by A263,NAT_1:13;
A418:             len MD1 in dom MD1 by FINSEQ_5:6;
A419:             upper_bound divset(MD1,len MD1)=MD1.(len MD1)
                  proof
                    per cases;
                    suppose
                      len MD1 = 1;
                      hence thesis by A418,INTEGRA1:def 4;
                    end;
                    suppose
                      len MD1 <> 1;
                      hence thesis by A418,INTEGRA1:def 4;
                    end;
                  end;
                  vol(B)=upper_bound B-D1.n1 by A353,INTEGRA1:def 5;
                  then vol(B)=D1.j-D1.n1 by A232,A245,A277,A354,A363,A419,
INTEGRA1:def 4;
                  then
A420:             vol(B)<>0 by A232,A241,A245,SEQM_3:def 1;
                  rng f is bounded_below by A1,INTEGRA1:11;
                  then
A421:             lower_bound rng f <= lower_bound rng g by RELAT_1:70,SEQ_4:47
;
                  rng f is bounded_above by A1,INTEGRA1:13;
                  then upper_bound rng f >= upper_bound rng g by RELAT_1:70
,SEQ_4:48;
                  then upper_bound rng f-lower_bound rng f>= upper_bound rng
                  g - lower_bound rng g by A421,XREAL_1:13;
                  then
A422:             (upper_bound rng f-lower_bound rng f)*delta(MD1)>= (
upper_bound rng g-lower_bound rng g)*delta(MD1 ) by A379,XREAL_1:64;
                  D1.n1 < D1.(n1+1) by A241,A266,A351,SEQM_3:def 1;
                  then indx(D2,D1,n1) < indx(D2,D1,n1+1) by A262,A260,A270,A267
,SEQ_4:137;
                  then
A423:             indx(D2,D1,n1)+1 <= indx(D2,D1,n1+1) by NAT_1:13;
                  then
A424:             indx(D2,D1,n1)+1 <= len D2 by A274,XXREAL_0:2;
A425:             indx(D2,D1,n1) < indx(D2,D1,n1)+1 by NAT_1:13;
A426:             indx(D2,D1,n1+1)=indx(D2,D1,n1)+1
                  proof
                    assume indx(D2,D1,n1+1)<> indx(D2,D1,n1)+1;
                    then
A427:               indx(D2,D1,n1+1)>indx(D2,D1,n1)+1 by A423,XXREAL_0:1;
A428:               indx(D2,D1,n1)+1 in dom D2 by A417,A424,FINSEQ_3:25;
                    then
A429:               D2.(indx(D2,D1,n1)+1) in rng D2 by FUNCT_1:def 3;
                    now
                      per cases by A11,A429,XBOOLE_0:def 3;
                      suppose
                        D2.(indx(D2,D1,n1)+1) in rng D1;
                        then consider n2 being Element of NAT such that
A430:                   n2 in dom D1 and
A431:                   D2.(indx(D2,D1,n1)+1) = D1.n2 by PARTFUN1:3;
                        D2.indx(D2,D1,n1) < D2.(indx(D2,D1,n1)+1) by A262,A425
,A428,SEQM_3:def 1;
                        then n1 < n2 by A241,A260,A430,A431,SEQ_4:137;
                        then
A432:                   n1+1 <= n2 by NAT_1:13;
                        D1.n2 < D1.(n1+1) by A270,A267,A427,A428,A431,
SEQM_3:def 1;
                        hence contradiction by A266,A430,A432,SEQ_4:137;
                      end;
                      suppose
A433:                   D2.(indx(D2,D1,n1)+1) in rng D;
A434:                   D.i <= upper_bound divset(D1,n1) by A242,INTEGRA2:1;
A435:                   upper_bound divset(D1,n1)=D1.n1
                        proof
                          per cases;
                          suppose
                            n1=1;
                            hence thesis by A241,INTEGRA1:def 4;
                          end;
                          suppose
                            n1<>1;
                            hence thesis by A241,INTEGRA1:def 4;
                          end;
                        end;
                        consider n2 being Element of NAT such that
A436:                   n2 in dom D and
A437:                   D2.(indx(D2,D1,n1)+1) = D.n2 by A433,PARTFUN1:3;
                        D1.n1 < D.n2 by A262,A260,A425,A428,A437,SEQM_3:def 1;
                        then D.i < D.n2 by A434,A435,XXREAL_0:2;
                        then i < n2 by A236,A436,SEQ_4:137;
                        then
A438:                   i+1 <= n2 by NAT_1:13;
                        n1+1 +1 <= j by A348,NAT_1:13;
                        then
A439:                   n1+1 <= j-1 by XREAL_1:19;
                        j -1 in dom D1 by A232,A245,A277,INTEGRA1:7;
                        then
A440:                   D1.(n1+1) <= D1.(j-1) by A266,A439,SEQ_4:137;
A441:                   lower_bound divset(D1,j) <= D.(i+1) by A233,INTEGRA2:1;
                        lower_bound divset(D1,j) = D1.(j-1) by A232,A245,A277,
INTEGRA1:def 4;
                        then
A442:                   D1.(n1+1) <= D.(i+1) by A440,A441,XXREAL_0:2;
                        D.n2 < D1.(n1+1) by A270,A267,A427,A428,A437,
SEQM_3:def 1;
                        then D.n2 < D.(i+1) by A442,XXREAL_0:2;
                        hence contradiction by A231,A436,A438,SEQ_4:137;
                      end;
                    end;
                    hence contradiction;
                  end;
A443:             len MD2=indx(D2,D1,j)-'indx(D2,D1,n1+1)+1 by A275,A271,A274
,A238,A239,A357,FINSEQ_6:118;
                  then
A444:             len MD2 = indx(D2,D1,j)-indx(D2,D1,n1+1)+1 by A275,
XREAL_1:233;
                  then
A445:             len upper_volume(g,MD2)=indx(D2,D1,j)-(indx(D2,D1,n1)+
                  1)+1 by A426,INTEGRA1:def 6;
                 for x1 being object holds
                  x1 in rng MD1 \/ {D.(i+1)} implies x1 in rng MD2
                  proof let x1 be object;
                    assume
A446:               x1 in rng MD1 \/ {D.(i+1)};
                    then reconsider x1 as Real;
                    now
                      per cases by A446,XBOOLE_0:def 3;
                      suppose
A447:                   x1 in rng MD1;
                        rng MD1 <> {};
                        then 1 in dom MD1 by FINSEQ_3:32;
                        then
A448:                   1 <= len MD1 by FINSEQ_3:25;
A449:                   len MD1=j-'(n1+1)+1 by A258,A261,A264,A244,A265,A356,
FINSEQ_6:118;
                        then len MD1+(n1+1)-1=j-(n1+1)+1+(n1+1)-1 by A258,
XREAL_1:233
                          .=j;
                        then
A450:                   MD1.(len MD1)=D1.j by A258,A264,A244,A356,A448,A449,
FINSEQ_6:122;
                        rng MD1 c= rng D1 by A356,FINSEQ_6:119;
                        then
A451:                   x1 in rng D1 by A447;
                        rng D1 c= rng D2 by A10,INTEGRA1:def 18;
                        then consider k such that
A452:                   k in dom D2 and
A453:                   D2.k = x1 by A451,PARTFUN1:3;
                        x1 <= MD1.(len MD1) by A447,Th16;
                        then k<=indx(D2,D1,j) by A237,A234,A450,A452,A453,
SEQM_3:def 1;
                        then k-indx(D2,D1,n1+1)<=indx(D2,D1,j)-indx(D2,D1,n1+
                        1) by XREAL_1:9;
                        then
A454:                   k -indx(D2,D1,n1+1)+1<=indx(D2,D1,j)-indx(D2,D1,
                        n1+1)+1 by XREAL_1:6;
A455:                   MD1.1 <= x1 by A447,Th16;
                        MD1.1=D1.(n1+1) by A261,A264,A244,A265,A356,
FINSEQ_6:118;
                        then
A456:                   indx(D2,D1,n1+1)<=k by A270,A267,A455,A452,A453,
SEQM_3:def 1;
                        then consider n being Nat such that
A457:                   k+1 = indx(D2,D1,n1+1)+n by NAT_1:10,12;
A458:                   n+indx(D2,D1,n1+1)-1=k by A457;
                        indx(D2,D1,n1+1)+1<=k+1 by A456,XREAL_1:6;
                        then
A459:                   1 <= k+1-indx(D2,D1,n1 +1) by XREAL_1:19;
                        then n in dom MD2 by A444,A454,A457,FINSEQ_3:25;
                        then MD2.n in rng MD2 by FUNCT_1:def 3;
                        hence x1 in rng MD2 by A275,A271,A239,A357,A453,A459
,A454,A458,FINSEQ_6:122;
                      end;
                      suppose
                        x1 in {D.(i+1)};
                        then
A460:                   x1 = D.(i+1) by TARSKI:def 1;
                        reconsider j1 = j-1 as Element of NAT by A232,A245,A277
,INTEGRA1:7;
A461:                   rng D c= rng D2 by A9,INTEGRA1:def 18;
                        D.(i+1) in rng D by A231,FUNCT_1:def 3;
                        then consider k such that
A462:                   k in dom D2 and
A463:                   x1 = D2.k by A460,A461,PARTFUN1:3;
                        D.(i+1)<= upper_bound divset(D1,j ) by A233,INTEGRA2:1;
                        then x1 <= D1.j by A232,A245,A277,A460,INTEGRA1:def 4;
                        then
A464:                   D2.k <= D2.indx(D2,D1,j) by A10,A232,A463,
INTEGRA1:def 19;
                        n1<j1 by A348,XREAL_1:20;
                        then
A465:                   n1+1 <= j1 by NAT_1:13;
                        j -1 in dom D1 by A232,A245,A277,INTEGRA1:7;
                        then
A466:                   D1.(n1+1) <= D1.(j-1) by A266,A465,SEQ_4:137;
                        lower_bound divset(D1,j)<=D.(i+1) by A233,INTEGRA2:1;
                        then D1.(j-1) <= x1 by A232,A245,A277,A460,
INTEGRA1:def 4;
                        then D2.indx(D2,D1,n1+1) <= D2.k by A267,A463,A466,
XXREAL_0:2;
                        hence x1 in rng MD2 by A270,A237,A357,A462,A463,A464
,Th17;
                      end;
                    end;
                    hence thesis;
                  end;
                  then
A467:             rng MD1 \/ {D.(i+1)} c= rng MD2;
                  rng MD2 <> {};
                  then 1 in dom MD2 by FINSEQ_3:32;
                  then
A468:             1 <= len MD2 by FINSEQ_3:25;
A469:             len MD2-1+indx(D2,D1,n1+1)=indx(D2,D1, j) by A444;
                  for x1 being object holds
                  x1 in rng MD2 implies x1 in (rng MD1 \/ {D.(i+1)})
                  proof let x1 be object;
                    assume
A470:               x1 in rng MD2;
                    then reconsider x1 as Real;
A471:               MD2.1 <= x1 by A470,Th16;
A472:               MD2 .(len MD2)=D2.indx(D2,D1,j) by A275,A271,A239,A357,A468
,A443,A469,FINSEQ_6:122;
A473:               rng MD2 c= rng D2 by A357,FINSEQ_6:119;
A474:               MD2.1=D2.indx(D2,D1,n1+1) by A271,A274,A238,A239,A357,
FINSEQ_6:118;
A475:               x1 <= MD2.(len MD2) by A470,Th16;
                    then
A476:               x1 <= D1.j by A234,A275,A271,A239,A357,A468,A443,A469,
FINSEQ_6:122;
                    now
                      per cases by A11,A470,A473,XBOOLE_0:def 3;
                      suppose
                        x1 in rng D1;
                        then consider k such that
A477:                   k in dom D1 and
A478:                   D1.k = x1 by PARTFUN1:3;
A479:                   n1 +1 <= k by A266,A267,A471,A474,A477,A478,
SEQM_3:def 1;
                        then
A480:                   1 <= k-n1 by XREAL_1:19;
                        n1 <= n1+1 by NAT_1:11;
                        then consider n being Nat such that
A481:                   k=n1+n by A479,NAT_1:10,XXREAL_0:2;
A482:                   k <= j by A232,A234,A475,A472,A477,A478,SEQM_3:def 1;
                        then
A483:                   k-n1 <= j- n1 by XREAL_1:9;
A484:                   1 <= k-n1 by A479,XREAL_1:19;
A485:                   j-(n1+1)+1=j-n1;
                        k-n1 <= len MD1 by A358,A350,A482,XREAL_1:9;
                        then n in dom MD1 by A484,A481,FINSEQ_3:25;
                        then
A486:                   MD1.n in rng MD1 by FUNCT_1:def 3;
                        MD1.n = D1.(k-n1-1+(n1+1)) by A258,A264,A244,A356
,A480,A483,A485,A481,FINSEQ_6:122
                          .= D1.k;
                        hence x1 in (rng MD1 \/ {D.(i+1)}) by A478,A486,
XBOOLE_0:def 3;
                      end;
                      suppose
                        x1 in rng D;
                        then consider n such that
A487:                   n in dom D and
A488:                   D.n = x1 by PARTFUN1:3;
A489:                   not i+1 < n
                        proof
                         j=1 or j <> 1;
                         then
A490:                     upper_bound divset(D1,j)=D1.j by A232,INTEGRA1:def 4;
                          reconsider y1=D.(i+1)as Real;
A491:                     D.n in rng D by A487,FUNCT_1:def 3;
                          assume i+1 < n;
                          then
A492:                     D.(i+1) < D.n by A231,A487,SEQM_3:def 1;
                          lower_bound divset(D1,j) <= D.(i+1) by A233,
INTEGRA2:1;
                          then lower_bound divset(D1,j) <= D.n by A492,
XXREAL_0:2;
                          then D.n in divset(D1,j) by A476,A488,A490,INTEGRA2:1
;
                          then
A493:                     x1 in rng D /\ divset(D1,j) by A488,A491,
XBOOLE_0:def 4;
                          D.(i+1) in rng D by A231,FUNCT_1:def 3;
                          then y1 in rng D /\ divset(D1,j) by A233,
XBOOLE_0:def 4;
                          hence contradiction by A8,A232,A488,A492,A493,Th5;
                        end;
A494:                   upper_bound divset(D1,n1)=D1.n1
                        proof
                          per cases;
                          suppose
                            n1=1;
                            hence thesis by A241,INTEGRA1:def 4;
                          end;
                          suppose
                            n1<>1;
                            hence thesis by A241,INTEGRA1:def 4;
                          end;
                        end;
                        D.i <= upper_bound divset(D1,n1) by A242,INTEGRA2:1;
                        then D.i < D1.(n1+1) by A352,A494,XXREAL_0:2;
                        then D.i < D.n by A267,A471,A474,A488,XXREAL_0:2;
                        then i < n by A236,A487,SEQ_4:137;
                        then i+1 <= n by NAT_1:13;
                        then i+1 = n or i+1 < n by XXREAL_0:1;
                        then x1 in {D.(i+1)} by A488,A489,TARSKI:def 1;
                        hence x1 in (rng MD1 \/ {D.(i+1)}) by XBOOLE_0:def 3;
                      end;
                    end;
                    hence thesis;
                  end;
                  then rng MD2 c= rng MD1 \/ {D.(i+1)};
                  then
A495:             rng MD2 = rng MD1 \/ {D.(i+1)} by A467,XBOOLE_0:def 10;
                  delta(MD1) in rng upper_volume(chi(B,B),MD1) by
XXREAL_2:def 8;
                  then consider k such that
A496:             k in dom upper_volume(chi(B,B),MD1) and
A497:             upper_volume(chi(B,B),MD1).k = delta(MD1) by PARTFUN1:3;
A498:             k in Seg len upper_volume(chi(B,B),MD1) by A496,
FINSEQ_1:def 3;
                  then
A499:             k in Seg len MD1 by INTEGRA1:def 6;
                  then
A500:             k in dom MD1 by FINSEQ_1:def 3;
A501:             k <= len MD1 by A499,FINSEQ_1:1;
                  then k+n1 <= j by A358,A350,XREAL_1:19;
                  then
A502:             k+n1 <= len D1 by A264,XXREAL_0:2;
A503:             1 <= k by A498,FINSEQ_1:1;
A504:             n1+1>1 by A277,NAT_1:13;
                  then n1>1-1 by XREAL_1:19;
                  then
A505:             k < k+n1 by XREAL_1:29;
                  then 1 < k+n1 by A503,XXREAL_0:2;
                  then
A506:             k+n1 in dom D1 by A502,FINSEQ_3:25;
                  lower_bound divset(MD1,k)=lower_bound divset(D1,k+n1)
                  & upper_bound divset(MD1,k)=upper_bound divset(D1,k+n1)
                  proof
                    per cases;
                    suppose
A507:                 k=1;
                      then upper_bound divset(MD1,k)=MD1.k by A500,
INTEGRA1:def 4;
                      then
A508:                 upper_bound divset(MD1,k)= D1.(k+(n1+1)-1) by A258,A264
,A244,A356,A358,A503,A501,FINSEQ_6:122;
                      lower_bound divset(D1,k+n1)=D1.(k+n1-1) by A503,A505,A506
,INTEGRA1:def 4;
                      hence thesis by A353,A504,A500,A506,A507,A508,
INTEGRA1:def 4;
                    end;
                    suppose
A509:                 k<>1;
                      then upper_bound divset(MD1,k)=MD1.k by A500,
INTEGRA1:def 4;
                      then
A510:                 upper_bound divset(MD1,k)=D1.(k+(n1+1)-1) by A258,A264
,A244,A356,A358,A503,A501,FINSEQ_6:122;
A511:                 lower_bound divset(MD1,k)=MD1.(k-1) by A500,A509,
INTEGRA1:def 4;
A512:                 k-1 in dom MD1 by A500,A509,INTEGRA1:7;
                      then
A513:                 k-1 <= len MD1 by FINSEQ_3:25;
                      1 <= k-1 by A512,FINSEQ_3:25;
                      then lower_bound divset(MD1,k)=D1.(k-1+(n1+1)-1) by A258
,A264,A244,A356,A358,A512,A513,A511,FINSEQ_6:122;
                      hence thesis by A503,A505,A506,A510,INTEGRA1:def 4;
                    end;
                  end;
                  then divset(MD1,k)=[.lower_bound divset(D1,k+n1),
                  upper_bound divset(D1,k+n1).] by INTEGRA1:4;
                  then
A514:             divset(MD1,k)=divset(D1,k+n1) by INTEGRA1:4;
                  k+n1 in Seg len D1 by A506,FINSEQ_1:def 3;
                  then k+n1 in Seg len upper_volume(chi(A,A),D1) by
INTEGRA1:def 6;
                  then
A515:             k+n1 in dom upper_volume(chi(A,A),D1) by FINSEQ_1:def 3;
                  k in dom MD1 by A499,FINSEQ_1:def 3;
                  then delta(MD1) = vol(divset(MD1,k)) by A497,INTEGRA1:20;
                  then delta(MD1)=upper_volume(chi(A,A),D1).( k+n1) by A506
,A514,INTEGRA1:20;
                  then delta(MD1) in rng upper_volume(chi(A,A),D1) by A515,
FUNCT_1:def 3;
                  then delta(MD1) <= max rng upper_volume(chi(A,A),D1) by
XXREAL_2:def 8;
                  then
A516:             delta(MD1) <= delta(D1);
A517:             D.(i+1)<= upper_bound divset(D1,j) by A233,INTEGRA2:1;
                  lower_bound divset(D1,j)<=D.(i+1) by A233,INTEGRA2:1;
                  then
A518:             D.(i+1) in divset(MD1,len MD1) by A363,A517,INTEGRA2:1;
                  j-1 in dom D1 by A232,A245,A277,INTEGRA1:7;
                  then D1.n1 <D1.(j-1) by A241,A416,SEQM_3:def 1;
                  then D.(i+1) > lower_bound B by A353,A388,XXREAL_0:2;
                  then Sum upper_volume(g,MD1)-Sum upper_volume(g,MD2)<= (
upper_bound rng g- lower_bound rng g)*delta(MD1) by A355,A380,A495,A518,A420
,Th14;
                  then
A519:             Sum upper_volume(g,MD1)-Sum upper_volume(g,MD2)<= (
upper_bound rng f-lower_bound rng f)*delta(MD1) by A422,XXREAL_0:2;
A520:             indx(D2,D1,j) <= len UVf(D2) by A239,INTEGRA1:def 6;
A521:             indx (D2,D1,n1)+1 <= indx(D2,D1,j) by A275,A423,XXREAL_0:2;
A522:             for k be Nat st 1<=k & k<=len upper_volume(g,MD2)
holds upper_volume(g,MD2).k=mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).k
                  proof
                    let k be Nat;
                    assume that
A523:               1 <= k and
A524:               k <= len upper_volume(g,MD2);
A525:               k in Seg len upper_volume( g,MD2) by A523,A524,FINSEQ_1:1;
A526:               mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)).k =UVf(
D2).(k+(indx(D2,D1,n1)+1)-1) by A417,A445,A520,A521,A523,A524,FINSEQ_6:122;
A527:               k in Seg len MD2 by A525,INTEGRA1:def 6;
                    then k in dom MD2 by FINSEQ_1:def 3;
                    then
A528:               upper_volume(g,MD2).k =(upper_bound rng(g|divset(MD2
                    ,k)))*vol(divset(MD2,k)) by INTEGRA1:def 6;
                    1<=indx(D2,D1,n1)+1 by NAT_1:12;
                    then 1+1<=k+(indx(D2,D1,n1)+1) by A523,XREAL_1:7;
                    then
A529:               1 <= k+(indx(D2,D1,n1)+1)- 1 by XREAL_1:19;
                    consider k2 being Element of NAT such that
A530:               indx(D2,D1,n1)+1=1+k2;
                    k <= indx(D2,D1,j)-((indx(D2,D1,n1)+1)-1) by A444,A426,A524
,INTEGRA1:def 6;
                    then k+((indx(D2,D1,n1)+1)-1) <= indx(D2,D1,j) by
XREAL_1:19;
                    then k +(indx(D2,D1,n1)+1)-1 <= len UVf(D2) by A520,
XXREAL_0:2;
                    then k+k2 in Seg len UVf(D2) by A529,A530,FINSEQ_1:1;
                    then
A531:               k+k2 in Seg len D2 by INTEGRA1:def 6;
                    then k+k2 in dom D2 by FINSEQ_1:def 3;
                    then
A532:               mid(UVf(D2),indx(D2,D1,n1) +1,indx(D2,D1,j)).k =(
upper_bound rng(f|divset(D2,k+k2)))* vol(divset(D2,k+k2)) by A526,A530,
INTEGRA1:def 6;
A533:               lower_bound divset(MD2,k)=lower_bound divset(D2,k+k2
                    ) & upper_bound divset(MD2,k)=upper_bound divset(D2,k+k2)
                    proof
                      k+k2>=1+1 by A263,A523,A530,XREAL_1:7;
                      then
A534:                 k+k2>1 by NAT_1:13;
A535:                 k in dom MD2 by A527,FINSEQ_1:def 3;
A536:                 k+k2 in dom D2 by A531,FINSEQ_1:def 3;
                      per cases;
                      suppose
A537:                   k=1;
                        then
A538:                   upper_bound divset(D2,k+k2)=D2.(1+ k2 ) by A534,A536,
INTEGRA1:def 4;
A539:                   lower_bound divset(MD2,k)= lower_bound B by A535,A537,
INTEGRA1:def 4;
                        upper_bound divset(MD2,k)=MD2.k by A535,A537,
INTEGRA1:def 4;
                        then
A540:                   upper_bound divset(MD2,k)= D2.(1+indx(D2,D1,n1+1
)-1) by A275,A239,A357,A417,A426,A445,A524,A537,FINSEQ_6:122
                          .=D1.(n1+1) by A10,A266,INTEGRA1:def 19;
                        lower_bound divset(D2,k+k2)=D2.(1+k2-1) by A534,A536
,A537,INTEGRA1:def 4;
                        hence
                        thesis by A10,A241,A266,A353,A426,A530,A539,A540,A538,
INTEGRA1:def 19;
                      end;
                      suppose
A541:                   k<>1;
                        then upper_bound divset(MD2,k)=MD2.k by A535,
INTEGRA1:def 4;
                        then
A542:                   upper_bound divset(MD2,k)= D2.(k+(indx(D2,D1,n1)
+1)-1) by A275,A239,A357,A417,A426,A445,A523,A524,FINSEQ_6:122;
A543:                   k -1 <= indx(D2,D1,j)-(indx(D2,D1,n1)+1)+1 by A445,A524
,XREAL_1:146,XXREAL_0:2;
A544:                   lower_bound divset(MD2,k)=MD2.(k-1) by A535,A541,
INTEGRA1:def 4;
A545:                   k-1 in dom MD2 by A535,A541,INTEGRA1:7;
                        then 1 <= k-1 by FINSEQ_3:25;
                        then lower_bound divset(MD2,k)=D2.(k-1+(indx(D2,D1,n1
)+1)-1) by A275,A239,A357,A417,A426,A545,A543,A544,FINSEQ_6:122;
                        hence thesis by A530,A534,A536,A542,INTEGRA1:def 4;
                      end;
                    end;
                    divset (MD2,k)=[.lower_bound divset(MD2,k),
                    upper_bound divset(MD2,k).] by INTEGRA1:4;
                    then
A546:               divset(MD2,k)=divset(D2,k+ k2) by A533,INTEGRA1:4;
                    k in dom MD2 by A527,FINSEQ_1:def 3;
                    then divset(D2,k+k2) c= B by A546,INTEGRA1:8;
                    hence thesis by A528,A532,A546,FUNCT_1:51;
                  end;
                  indx(D2,D1,n1)+1 <= len UVf(D2) by A424,INTEGRA1:def 6;
                  then len mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) = indx
(D2,D1,j)-'(indx(D2,D1,n1)+1)+1 by A238,A417,A520,A521,FINSEQ_6:118;
                  then len upper_volume(g,MD2) =len mid(UVf(D2),indx(D2,D1,n1
                  )+1,indx(D2,D1,j)) by A275,A423,A445,XREAL_1:233,XXREAL_0:2;
                  then
A547:             Sum upper_volume(g,MD2)=Sum mid(UVf(D2),indx(D2,D1,n1)
                  +1,indx(D2,D1,j)) by A522,FINSEQ_1:14;
                  upper_bound rng f - lower_bound rng f >= 0 by A1,Lm3,
XREAL_1:48;
                  then (upper_bound rng f-lower_bound rng f)*delta(MD1) <= (
upper_bound rng f-lower_bound rng f)* delta(D1) by A516,XREAL_1:64;
                  hence thesis by A519,A547,A415,XXREAL_0:2;
                end;
              end;
              then
A548:         (PUf(D1,n1)-PUf(D2,indx(D2,D1,n1)))+ (Sum mid(UVf(D1),n1+
1,j)-Sum mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))) <=i*(upper_bound rng f-
lower_bound rng f)*delta(D1)+(upper_bound rng f- lower_bound rng f)*delta(D1)
              by A243,XREAL_1:7;
              n1 < n1+1 by NAT_1:13;
              then D1.n1 < D1.(n1+1) by A241,A266,SEQM_3:def 1;
              then indx(D2,D1,n1) < indx(D2,D1,n1+1) by A262,A260,A270,A267,
SEQ_4:137;
              then
A549:         indx(D2,D1,n1)<indx(D2,D1,j) by A275,XXREAL_0:2;
              indx(D2,D1,n1) in Seg len D2 by A262,FINSEQ_1:def 3;
              then indx(D2,D1,n1) in Seg len UVf(D2) by INTEGRA1:def 6;
              then indx(D2,D1,n1) in dom UVf(D2) by FINSEQ_1:def 3;
              then PUf(D2,indx(D2,D1,n1))=Sum(UVf(D2)|indx(D2,D1,n1)) by
INTEGRA1:def 20
                .=Sum mid(UVf(D2),1,indx(D2,D1,n1)) by A263,FINSEQ_6:116;
              then PUf(D2,indx(D2,D1,n1))+Sum mid(UVf(D2),indx(D2,D1,n1)+1,
indx(D2, D1,j)) =Sum(mid(UVf(D2),1,indx(D2,D1,n1))^ mid(UVf(D2),indx(D2,D1,n1)+
              1,indx(D2,D1,j))) by RVSUM_1:75
                .=Sum mid(UVf(D2),1,indx(D2,D1,j)) by A263,A549,A240,INTEGRA2:4
                .=Sum(UVf(D2)|indx(D2,D1,j)) by A238,FINSEQ_6:116;
              then PUf(D2,indx(D2,D1,j))= PUf(D2,indx(D2,D1,n1))+Sum mid(UVf
              (D2),indx(D2,D1,n1)+1,indx(D2,D1,j)) by A273,INTEGRA1:def 20;
              then (PUf(D1,n1)-PUf(D2,indx(D2,D1,n1)))+ (Sum mid(UVf(D1),n1+
1,j)-Sum mid(UVf(D2),indx(D2,D1,n1)+1,indx(D2,D1,j))) =PUf(D1,j)-PUf(D2,indx(D2
              ,D1,j)) by A272;
              hence thesis by A232,A233,A548;
            end;
            hence thesis;
          end;
          for k being non zero Nat holds P[k] from NAT_1:sch 10(A36,
          A227);
          then P[i];
          hence thesis by A14;
        end;
A550:   len D1 in dom D1 by FINSEQ_5:6;
        then D1.(len D1) = D2.indx(D2,D1,len D1) by A10,INTEGRA1:def 19;
        then upper_bound A = D2.indx(D2,D1,len D1) by INTEGRA1:def 2;
        then
A551:   D2.(len D2) = D2.indx(D2,D1,len D1) by INTEGRA1:def 2;
        len D in dom D by FINSEQ_5:6;
        then consider j such that
A552:   j in dom D1 and
A553:   D.(len D) in divset(D1,j) and
A554:   PUf(D1,j)-PUf(D2,indx(D2,D1,j)) <= (len D)*(upper_bound(rng
        f)- lower_bound(rng f))*delta(D1) by A13;
A555:   j = len D1
        proof
          j in Seg len D1 by A552,FINSEQ_1:def 3;
          then
A556:     j <= len D1 by FINSEQ_1:1;
          assume j<>len D1;
          then j < len D1 by A556,XXREAL_0:1;
          then D1.j < D1.(len D1) by A552,A550,SEQM_3:def 1;
          then
A557:     D1.j < upper_bound A by INTEGRA1:def 2;
A558:     upper_bound divset(D1,j) < upper_bound A
          proof
            per cases;
            suppose
              j=1;
              hence thesis by A552,A557,INTEGRA1:def 4;
            end;
            suppose
              j<>1;
              hence thesis by A552,A557,INTEGRA1:def 4;
            end;
          end;
          D.(len D) <= upper_bound divset(D1,j) by A553,INTEGRA2:1;
          hence contradiction by A558,INTEGRA1:def 2;
        end;
        indx(D2,D1,len D1) in dom D2 by A10,A550,INTEGRA1:def 19;
        then indx(D2,D1,len D1)=len D2 by A12,A551,SEQ_4:138;
        then upper_sum(f,D1)-PUf(D2,len D2)<= (len D)*(upper_bound(rng f)-
        lower_bound(rng f))* delta(D1) by A554,A555,INTEGRA1:42;
        hence thesis by INTEGRA1:42;
      end;
      hence thesis by A9,A10,A11;
    end;
    hence thesis;
  end;

::$N Darboux's Theorem
theorem
  f|A is bounded & delta(T) is 0-convergent non-zero & vol(A)<>0 implies
  lower_sum(f,T) is convergent & lim lower_sum(f,T) = lower_integral(f)
proof
  assume that
A1: f|A is bounded and
A2: delta(T) is 0-convergent non-zero and
A3: vol(A)<>0;
A4: delta(T) is convergent by A2,FDIFF_1:def 1;
A5: for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & 0<=
  lower_sum(f,D2)-lower_sum(f,D) & 0<=lower_sum(f,D2)-lower_sum(f,D1)
    by A1,Th20;
A10: for D,D1 st delta(D1)<min rng upper_volume(chi(A,A),D) ex D2 st D<=D2 &
D1<=D2 & rng D2=rng D1 \/ rng D & lower_sum(f,D2)-lower_sum(f,D1) <= (len D)*(
  upper_bound(rng f)-lower_bound(rng f))*delta(D1) by A1,Th21;
A552: lim delta(T) = 0 by A2,FDIFF_1:def 1;
A553: delta(T) is non-zero by A2;
A554: for e st e>0
  ex n being Nat st
   for m being Nat st n<=m holds 0 < (delta(T)).m & (delta(T)).m < e
  proof
    let e;
    assume e>0;
    then consider n being Nat such that
A555: for m being Nat  st n<=m holds |.(delta(T)).m-0.|<e
      by A4,A552,SEQ_2:def 7;
    take n;
    let m be Nat;
    reconsider mm=m as Element of NAT by ORDINAL1:def 12;
A556: (delta(T)).m = delta(T.mm) by Def2;
      delta(T.mm) in rng upper_volume(chi(A,A),T.mm) by XXREAL_2:def 8;
      then consider i such that
A557: i in dom upper_volume(chi(A,A),T.mm) and
A558: delta(T.mm)=upper_volume(chi(A,A),T.mm).i by PARTFUN1:3;
      consider D being Division of A such that
A559: D = T.mm;
      i in Seg len upper_volume(chi(A,A),T.mm) by A557,FINSEQ_1:def 3;
      then i in Seg len D by A559,INTEGRA1:def 6;
      then i in dom D by FINSEQ_1:def 3;
      then
A560: delta(T.mm)=vol(divset(T.mm,i)) by A558,A559,INTEGRA1:20;
      assume n<=m;
      then |.(delta(T)).m-0.|<e by A555;
      then
A561: (delta(T)).m+|.(delta(T)).m-0.|<e+|.(delta(T)).m-0.| by ABSVALUE:4
,XREAL_1:8;
      (delta(T)).m<>0 by A553,SEQ_1:5;
      hence thesis by A561,A556,A560,INTEGRA1:9,XREAL_1:6;
  end;
A562: for e be Real st e>0
  ex n being Nat st for m being Nat st n<=m holds |.(
  lower_sum(f,T)).m-lower_integral(f).|<e
  proof
    set h=lower_bound rng f;
    set H=upper_bound rng f;
    let e be Real;
    assume
A563: e>0;
    then
A564: e/2>0 by XREAL_1:139;
    reconsider e as Real;
A565: H-h >= 0 by A1,Lm3,XREAL_1:48;
A566: rng lower_sum_set(f) is bounded_above by A1,INTEGRA2:36;
    lower_integral(f) = upper_bound rng lower_sum_set(f) by INTEGRA1:def 15;
    then consider y be Real such that
A567: y in rng lower_sum_set(f) and
A568: lower_integral(f)-e/2<y by A564,A566,SEQ_4:def 1;
    consider D being Division of A such that
 D in dom lower_sum_set(f) and
A569: y=(lower_sum_set(f)).D and
A570: D.1>lower_bound A by A3,A567,Lm7;
    deffunc F(Nat)=In(vol(divset(D,$1)),REAL);
    set p=len D;
    consider v being FinSequence of REAL such that
A571: len v = len D & for j be Nat st j in dom v holds v.j=F(j) from
    FINSEQ_2:sch 1;
    consider v1 being non-decreasing FinSequence of REAL such that
A572: v,v1 are_fiberwise_equipotent by INTEGRA2:3;
    defpred P[Nat] means $1 in dom v1 & v1.$1>0;
A573: dom v = Seg len D by A571,FINSEQ_1:def 3;
A574: ex k be Nat st P[k]
    proof
      consider H being Function such that
      dom H = dom v and
      rng H = dom v1 and
      H is one-to-one and
A575: v=v1*H by A572,CLASSES1:77;
      consider k such that
A576: k in dom D and
A577: vol(divset(D,k)) > 0 by A3,Th2;
A578: dom D = Seg len v by A571,FINSEQ_1:def 3;
      then H.k in dom v1 by A571,A573,A575,A576,FUNCT_1:11;
      then reconsider Hk = H.k as Nat;
      v.k = F(k) by A571,A578,A573,A576;
      then v.k > 0 by A577;
      then P[Hk] by A571,A573,A575,A576,A578,FUNCT_1:11,12;
      hence thesis;
    end;
    consider k be Nat such that
A579: P[k] & for n be Nat st P[n] holds k<=n from NAT_1:sch 5(A574);
A580: 2*p >0 by XREAL_1:129;
    then
A581: 2*p*(H-h+1) > 0 by A565,XREAL_1:129;
    min(v1.k,e/(2*p*(H-h+1))) > 0
    proof
      per cases by XXREAL_0:15;
      suppose
        min(v1.k,e/(2*p*(H-h+1))) = v1.k;
        hence thesis by A579;
      end;
      suppose
        min(v1.k,e/(2*p*(H-h+1))) = e/(2*p*(H-h+1));
        hence thesis by A563,A581,XREAL_1:139;
      end;
    end;
    then consider n being Nat such that
A582: for m being Nat st n<=m
holds 0 < (delta(T)).m & (delta(T)).m < min(v1.k,
    e/(2*p*(H-h+1))) by A554;
    take n;
A583: y=lower_sum(f,D) by A569,INTEGRA1:def 11;
A584: v1.1 > 0
      proof
A585:   for n1 be Element of NAT st n1 in dom D holds vol(divset(D,n1))
        >0
        proof
          let n1 be Element of NAT;
          assume
A586:     n1 in dom D;
          then
A587:     1 <= n1 by FINSEQ_3:25;
          per cases by A587,XXREAL_0:1;
          suppose
A588:       n1=1;
            then
A589:       upper_bound divset(D,n1)=D.n1 by A586,INTEGRA1:def 4;
            lower_bound divset(D,n1)=lower_bound A by A586,A588,INTEGRA1:def 4;
            then vol(divset(D,n1))=D.n1-lower_bound A by A589,INTEGRA1:def 5;
            hence thesis by A570,A588,XREAL_1:50;
          end;
          suppose
A590:       n1>1;
            then
A591:       upper_bound divset(D,n1)=D.n1 by A586,INTEGRA1:def 4;
            lower_bound divset(D,n1)=D.(n1-1) by A586,A590,INTEGRA1:def 4;
            then
A592:       vol(divset(D,n1))=D.n1-D.(n1-1) by A591,INTEGRA1:def 5;
            n1 < n1+1 by XREAL_1:29;
            then
A593:       n1-1 < n1 by XREAL_1:19;
            n1-1 in dom D by A586,A590,INTEGRA1:7;
            then D.(n1-1)<D.n1 by A586,A593,SEQM_3:def 1;
            hence thesis by A592,XREAL_1:50;
          end;
        end;
A594:   k <= len v1 by A579,FINSEQ_3:25;
        1 <= k by A579,FINSEQ_3:25;
        then 1 <= len v1 by A594,XXREAL_0:2;
        then
    1 in dom v1 by FINSEQ_3:25;
        then
A595:   v1.1 in rng v1 by FUNCT_1:def 3;
        rng v = rng v1 by A572,CLASSES1:75;
        then consider n1 being Element of NAT such that
A596:   n1 in dom v and
A597:   v1.1 = v.n1 by A595,PARTFUN1:3;
        n1 in Seg len D by A571,A596,FINSEQ_1:def 3;
        then
A598:   n1 in dom D by FINSEQ_1:def 3;
        v1.1 = F(n1)by A571,A596,A597
          .= vol(divset(D,n1));
        hence thesis by A585,A598;
      end;
A599: v1.k = min rng upper_volume(chi(A,A),D)
      proof
A600:   k=1
        proof
          len v1 = len v by A572,RFINSEQ:3;
          then k in Seg len v by A579,FINSEQ_1:def 3;
          then
A601:     1 <= k by FINSEQ_1:1;
          k in Seg len v1 by A579,FINSEQ_1:def 3;
          then k <= len v1 by FINSEQ_1:1;
          then 1 <= len v1 by A601,XXREAL_0:2;
          then
A602:     1 in dom v1 by FINSEQ_3:25;
          assume k <> 1;
          then k > 1 by A601,XXREAL_0:1;
          hence contradiction by A579,A584,A602;
        end;
        min rng upper_volume(chi(A,A),D) in rng upper_volume(chi(A,A),D
        ) by XXREAL_2:def 7;
        then consider m such that
A603:   m in dom upper_volume(chi(A,A),D) and
A604:   min rng upper_volume(chi(A,A),D)=upper_volume(chi(A,A),D).m
        by PARTFUN1:3;
        m in Seg len upper_volume(chi(A,A),D) by A603,FINSEQ_1:def 3;
        then
A605:   m in Seg len D by INTEGRA1:def 6;
        then m in dom D by FINSEQ_1:def 3;
        then
A606:        min rng upper_volume(chi(A,A),D)=vol(divset(D,m)) by A604,
INTEGRA1:20;
A607:   v.m = F(m) by A571,A573,A605
          .=min rng upper_volume(chi(A,A),D) by A606;
A608:   rng v = rng v1 by A572,CLASSES1:75;
        m in dom v by A571,A605,FINSEQ_1:def 3;
        then min rng upper_volume(chi(A,A),D) in rng v by A607,FUNCT_1:def 3;
        then consider m1 being Element of NAT such that
A609:   m1 in dom v1 and
A610:   min rng upper_volume(chi(A,A),D)=v1.m1 by A608,PARTFUN1:3;
        v1.k in rng v1 by A579,FUNCT_1:def 3;
        then consider k2 being Element of NAT such that
A611:   k2 in dom v and
A612:   v1.k = v.k2 by A608,PARTFUN1:3;
A613:   k2 in Seg len D by A571,A611,FINSEQ_1:def 3;
        then
A614:   k2 in dom D by FINSEQ_1:def 3;
        k2 in Seg len upper_volume(chi(A,A),D) by A613,INTEGRA1:def 6;
        then
A615:   k2 in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
        v1.k = F(k2) by A571,A611,A612
          .= vol(divset(D,k2));
        then v1.k = upper_volume(chi(A,A),D).k2 by A614,INTEGRA1:20;
        then v1.k in rng upper_volume(chi(A,A),D) by A615,FUNCT_1:def 3;
        then
A616:   v1.k >= min rng upper_volume(chi(A,A),D) by XXREAL_2:def 7;
        m1 >= 1 by A609,FINSEQ_3:25;
        then v1.1 <= min rng upper_volume(chi(A,A),D) by A579,A600,A609,A610,
INTEGRA2:2;
        hence thesis by A600,A616,XXREAL_0:1;
      end;
      H-h <= H-h+1 by XREAL_1:29;
      then
A617: p*(H-h)<=p*(H-h+1) by XREAL_1:64;
      set sD=lower_sum(f,D);
      set s=lower_integral(f);
      let m be Nat;
       reconsider mm=m as Element of NAT by ORDINAL1:def 12;
      reconsider D1 = T.mm as Division of A;
A618: min(v1.k,e/(2*p*(H-h+1))) <= e/(2*p*(H-h+1)) by XXREAL_0:17;
      assume
A619: n<=m;
      then (delta(T)).m < min(v1.k,e/(2*p*(H-h+1))) by A582;
      then
A620: delta(D1)<min (v1.k,e/(2*p*(H-h+1))) by Def2;
      (delta(T)).m < min(v1.k,e/(2*p*(H-h+1))) by A582,A619;
      then (delta(T)).m < e/(2*p*(H-h+1)) by A618,XXREAL_0:2;
      then (delta(T)).m*(2*p*(H-h+1))<e by A580,A565,XREAL_1:79,129;
      then ((delta(T)).m*(p*(H-h+1)))*2<e;
      then
A621: p*(H-h+1)*(delta(T)).m < e/2 by XREAL_1:81;
      T.mm in divs A by INTEGRA1:def 3;
      then
A622: T.mm in dom lower_sum_set(f) by FUNCT_2:def 1;
      (lower_sum(f,T)).mm = lower_sum(f,T.mm) by INTEGRA2:def 3;
      then (lower_sum(f,T)).m = (lower_sum_set(f)).(T.m) by INTEGRA1:def 11;
      then (lower_sum(f,T)).m in rng lower_sum_set(f) by A622,FUNCT_1:def 3;
      then upper_bound rng lower_sum_set(f)>=(lower_sum(f,T)).m by A566,
SEQ_4:def 1;
      then lower_integral(f)>=(lower_sum(f,T)).m by INTEGRA1:def 15;
      then
A623: lower_integral(f)-(lower_sum(f,T)).m >= 0 by XREAL_1:48;
      0 < (delta(T)).m by A582,A619;
      then
A624: p*(H-h)*(delta(T)).m <= p*(H-h+1)*(delta(T)).m by A617,XREAL_1:64;
      set sD1=lower_sum(f,T.mm);
      consider D2 being Division of A such that
A625: D <= D2 and
      D1 <= D2 and
A626: rng D2 = rng D1 \/ rng D and
      0 <= lower_sum(f,D2)-lower_sum(f,D) and
      0 <= lower_sum(f,D2)-lower_sum(f,D1) by A5;
      set sD2=lower_sum(f,D2);
A627: (sD-sD1) - (sD2-sD1) = (sD-sD2);
      min (v1.k,e/(2*p*(H-h+1))) <= v1.k by XXREAL_0:17;
      then delta(D1)<v1.k by A620,XXREAL_0:2;
      then ex D3 being Division of A st D<=D3 & D1<=D3 & rng D3= rng D1
      \/ rng D & lower_sum(f,D3)-lower_sum(f,D1) <=(len D)*(upper_bound rng f -
      lower_bound rng f)*delta(D1) by A10,A599;
      then
A628: lower_sum(f,D2)-lower_sum(f,D1)<=(len D)*(upper_bound rng f-
      lower_bound rng f)*delta(D1) by A626,Th6;
      lower_sum(f,D)-lower_sum(f,D2)<=0 by A1,A625,INTEGRA1:46,XREAL_1:47;
      then
A629: sD-sD1 <= sD2-sD1 by A627,XREAL_1:50;
      delta(D1)=(delta(T)).m by Def2;
      then lower_sum(f,D2)-lower_sum(f,T.mm)
     <= p*(H-h+1)*(delta(T)).m by A628
,A624,XXREAL_0:2;
      then sD-sD1 <= p*(H-h+1)*(delta(T)).m by A629,XXREAL_0:2;
      then sD-sD1 < e/2 by A621,XXREAL_0:2;
      then
A630: sD-sD1+e/2 < e/2+e/2 by XREAL_1:6;
      s-sD1+sD1 < sD+e/2 by A568,A583,XREAL_1:19;
      then s-sD1 < sD+e/2-sD1 by XREAL_1:20;
      then s-sD1 < e by A630,XXREAL_0:2;
      then lower_integral(f)-(lower_sum(f,T)).m < e by INTEGRA2:def 3;
      then |.lower_integral(f)-(lower_sum(f,T)).m.| < e by A623,ABSVALUE:def 1;
      then |.-(lower_integral(f)-(lower_sum(f,T)).m).| < e by COMPLEX1:52;
      hence thesis;
  end;
  hence lower_sum(f,T) is convergent by SEQ_2:def 6;
  hence thesis by A562,SEQ_2:def 7;
end;

theorem
  f|A is bounded & delta(T) is 0-convergent non-zero & vol(A)<>0 implies
  upper_sum(f,T) is convergent & lim upper_sum(f,T) = upper_integral(f)
  proof
    assume
A1: f|A is bounded;
    then
A2: for D,D1 ex D2 st D<=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & 0<=
  upper_sum(f,D)-upper_sum(f,D2) & 0<=upper_sum(f,D1)-upper_sum(f,D2) by Th22;
A7: for D,D1 st delta(D1)<min rng upper_volume(chi(A,A),D) holds ex D2 st D
  <=D2 & D1<=D2 & rng D2=rng D1 \/ rng D & upper_sum(f,D1)-upper_sum(f,D2) <= (
  len D)*(upper_bound(rng f)-lower_bound(rng f))*delta(D1) by A1,Th23;
  assume
A559: delta(T) is 0-convergent non-zero;
  then
A560: delta(T) is convergent by FDIFF_1:def 1;
A561: lim delta(T) = 0 by A559,FDIFF_1:def 1;
  assume
A562: vol(A)<>0;
A563: delta(T) is non-zero by A559;
A564: for e st e>0
   ex n being Nat st
  for m being Nat st n<=m holds 0 < (delta(T)).m & (delta(T)).m
  < e
  proof
    let e;
    assume e>0;
    then consider n being Nat such that
A565: for m being Nat st n<=m
holds |.(delta(T)).m-0.|<e by A560,A561,SEQ_2:def 7;
    take n;
    let m be Nat;
     reconsider mm =m as Element of NAT by ORDINAL1:def 12;
    assume n<=m;
    then |.(delta(T)).m-0.|<e by A565;
    then
A566: (delta(T)).m+|.(delta(T)).m-0.|<e+|.(delta(T)).m-0.| by ABSVALUE:4
,XREAL_1:8;
    reconsider D = T.mm as Division of A;
A567: (delta(T)).m = delta(T.mm) by Def2;
    delta(T.mm) in rng upper_volume(chi(A,A),T.mm) by XXREAL_2:def 8;
    then consider i such that
A568: i in dom upper_volume(chi(A,A),T.mm) and
A569: delta(T.mm)=upper_volume(chi(A,A),T.mm).i by PARTFUN1:3;
    i in Seg len upper_volume(chi(A,A),T.mm) by A568,FINSEQ_1:def 3;
    then i in Seg len D by INTEGRA1:def 6;
    then i in dom D by FINSEQ_1:def 3;
    then
A570: delta(T.mm)=vol(divset(T.mm,i)) by A569,INTEGRA1:20;
    (delta(T)).m<>0 by A563,SEQ_1:5;
    hence thesis by A566,A567,A570,INTEGRA1:9,XREAL_1:6;
  end;
A571: for e be Real st e>0
  ex n being Nat st for m being Nat st n<=m holds |.(
  upper_sum(f,T)).m-upper_integral(f).|<e
  proof
    let e be Real;
    assume
A572: e>0;
    then
A573: e/2>0 by XREAL_1:139;
    reconsider e as Real;
A574: rng upper_sum_set(f) is bounded_below by A1,INTEGRA2:35;
    upper_integral(f) = lower_bound rng upper_sum_set(f) by INTEGRA1:def 14;
    then consider y be Real such that
A575: y in rng upper_sum_set(f) and
A576: upper_integral(f)+e/2>y by A573,A574,SEQ_4:def 2;
    ex D being Division of A st D in dom upper_sum_set(f) & y=(
    upper_sum_set(f)).D & D.1 > lower_bound A
    proof
      consider D3 being Element of divs A such that
A577: D3 in dom upper_sum_set(f) and
A578: y=(upper_sum_set(f)).D3 by A575,PARTFUN1:3;
      reconsider D3 as Division of A by INTEGRA1:def 3;
A579: len D3 in Seg len D3 by FINSEQ_1:3;
      then 1 <= len D3 by FINSEQ_1:1;
      then 1 in Seg len D3 by FINSEQ_1:1;
      then
A580: 1 in dom D3 by FINSEQ_1:def 3;
      per cases;
      suppose
A581:   D3.1 <> lower_bound A;
        D3.1 in A by A580,INTEGRA1:6;
        then lower_bound A <= D3.1 by INTEGRA2:1;
        then D3.1 > lower_bound A by A581,XXREAL_0:1;
        hence thesis by A577,A578;
      end;
      suppose
A582:   D3.1 = lower_bound A;
        ex D being Division of A st D in dom upper_sum_set(f) & y=(
        upper_sum_set(f)).D & D.1 > lower_bound A
        proof
A583:     upper_volume(f,D3).1= (upper_bound rng(f|divset(D3,1)))*vol(
          divset(D3,1)) by A580,INTEGRA1:def 6;
          vol(A) >= 0 by INTEGRA1:9;
          then
A584:     upper_bound A - lower_bound A > 0 by A562,INTEGRA1:def 5;
A585:     y=upper_sum(f,D3) by A578,INTEGRA1:def 10
            .=Sum(upper_volume(f,D3)) by INTEGRA1:def 8
            .=Sum((upper_volume(f,D3)|1)^(upper_volume(f,D3)/^1)) by RFINSEQ:8;
A586:     D3.(len D3) = upper_bound A by INTEGRA1:def 2;
          len D3 in dom D3 by A579,FINSEQ_1:def 3;
          then
A587:     len D3 > 1 by A580,A582,A586,A584,SEQ_4:137,XREAL_1:47;
          then reconsider D=D3/^1 as increasing FinSequence of REAL by
INTEGRA1:34;
A588:     len D = len D3 - 1 by A587,RFINSEQ:def 1;
          upper_bound A > lower_bound A by A584,XREAL_1:47;
          then len D <> 0 by A582,A588,INTEGRA1:def 2;
          then reconsider D as non empty increasing FinSequence of REAL;
A589:     len D in dom D by FINSEQ_5:6;
          len D+1=len D3 by A588;
          then
A590:     D.(len D)=upper_bound A by A586,A587,A589,RFINSEQ:def 1;
A591:     len D in Seg len D by FINSEQ_1:3;
          1+1 <= len D3 by A587,NAT_1:13;
          then 2 in dom D3 by FINSEQ_3:25;
          then
A592:     D3.1 < D3.2 by A580,SEQM_3:def 1;
A593:     rng D3 c= A by INTEGRA1:def 2;
          rng D c= rng D3 by FINSEQ_5:33;
          then rng D c= A by A593;
          then reconsider D as Division of A by A590,INTEGRA1:def 2;
A594:     1 in Seg 1 by FINSEQ_1:1;
A595:     len D3 >= 1+1 by A587,NAT_1:13;
          then
A596:     2 <= len upper_volume(f,D3) by INTEGRA1:def 6;
          1 <= len upper_volume(f,D3) by A587,INTEGRA1:def 6;
          then
A597:     len(mid(upper_volume(f,D3),2,len upper_volume( f,D3))) =len
          upper_volume(f,D3)-'2+1 by A596,FINSEQ_6:118
            .=len D3-'2+1 by INTEGRA1:def 6
            .=len D3-2+1 by A595,XREAL_1:233
            .=len D3-1;
A598:     for i be Nat st 1<=i&i<=len mid(upper_volume(f,D3),2,len
upper_volume(f,D3)) holds mid(upper_volume(f,D3),2,len upper_volume(f,D3)).i =
          upper_volume(f,D).i
          proof
            let i be Nat;
            assume that
A599:       1<=i and
A600:       i<=len mid(upper_volume(f,D3),2,len upper_volume(f,D3));
A601:       1 <= i+1 by NAT_1:12;
            i+1 <= len D3 by A597,A600,XREAL_1:19;
            then
A602:       i+1 in Seg len D3 by A601,FINSEQ_1:1;
            then
A603:       i+1 in dom D3 by FINSEQ_1:def 3;
A604:       divset(D3,i+1)=divset(D,i)
            proof
A605:         i+1 in dom D3 by A602,FINSEQ_1:def 3;
A606:         1<>i+1 by A599,NAT_1:13;
              then
A607:         upper_bound divset(D3,i+1)=D3.(i+1) by A605,INTEGRA1:def 4;
A608:         i in dom D by A588,A597,A599,A600,FINSEQ_3:25;
              then
A609:         D.i=D3.(i+1) by A587,RFINSEQ:def 1;
A610:         lower_bound divset(D3,i+1)=D3.(i+1 -1) by A606,A605,
INTEGRA1:def 4;
              per cases;
              suppose
A611:           i=1;
                then
A612:           upper_bound divset (D,i)=D.i by A608,INTEGRA1:def 4;
A613:           lower_bound divset(D,i)=lower_bound A by A608,A611,
INTEGRA1:def 4;
                divset(D3,i+1)=[.lower_bound A, D.i.] by A582,A607,A610,A609
,A611,INTEGRA1:4;
                hence thesis by A613,A612,INTEGRA1:4;
              end;
              suppose
A614:           i<>1;
                then i-1 in dom D by A608,INTEGRA1:7;
                then
A615:           D.(i-1)=D3.(i-1+1) by A587,RFINSEQ:def 1
                  .=D3.i;
A616:           upper_bound divset(D,i)=D.i by A608,A614,INTEGRA1:def 4;
                lower_bound divset(D,i)=D.(i-1) by A608,A614,INTEGRA1:def 4;
                then divset(D3,i+1)=[.lower_bound divset(D,i), upper_bound
                divset(D,i).] by A607,A610,A609,A616,A615,INTEGRA1:4;
                hence thesis by INTEGRA1:4;
              end;
            end;
            i <= len upper_volume(f,D3) - 1 by A597,A600,INTEGRA1:def 6;
            then
A617:       i <= len upper_volume(f,D3)-2+1;
            mid(upper_volume(f,D3),2,len upper_volume( f,D3)).i =
            upper_volume(f,D3).(i+2-1) by A596,A599,A617,FINSEQ_6:122
              .=upper_volume(f,D3).(i+1);
            then
A618:       mid(upper_volume(f,D3),2,len upper_volume( f,D3)).i =(
upper_bound rng(f|divset(D3,i+1)))*vol(divset(D3,i+1)) by A603,INTEGRA1:def 6;
            i in Seg len D by A588,A597,A599,A600,FINSEQ_1:1;
            then i in dom D by FINSEQ_1:def 3;
            hence thesis by A618,A604,INTEGRA1:def 6;
          end;
A619:     1 <= len upper_volume(f,D3) by A587,INTEGRA1:def 6;
A620:     len (upper_volume(f,D3)|1)=1;
          1 in dom upper_volume(f,D3) by A619,FINSEQ_3:25;
          then (upper_volume(f,D3)|1).1 = upper_volume(f,D3).1 by A594,
RFINSEQ:6;
          then
A621:     upper_volume(f,D3)|1 = <*upper_volume(f,D3).1*> by A620,FINSEQ_1:40;
A622:     2-'1=2-1 by XREAL_1:233
            .= 1;
          1 <= len D by A591,FINSEQ_1:1;
          then 1 in dom D by FINSEQ_3:25;
          then
A623:     D.1=D3.(1+1) by A587,RFINSEQ:def 1
            .=D3.2;
          D in divs A by INTEGRA1:def 3;
          then
A624:     D in dom upper_sum_set(f) by FUNCT_2:def 1;
          len upper_volume(f,D3) >= 2 by A595,INTEGRA1:def 6;
          then
A625:     mid(upper_volume(f,D3),2,len upper_volume(f,D3 )) =
          upper_volume(f,D3)/^1 by A622,FINSEQ_6:117;
          len(mid(upper_volume(f,D3),2,len upper_volume( f,D3))) =len
          upper_volume(f,D) by A588,A597,INTEGRA1:def 6;
          then
A626:     upper_volume(f,D3)/^1 = upper_volume(f,D) by A625,A598,FINSEQ_1:14;
          vol (divset(D3,1))=upper_bound divset(D3,1)-lower_bound
          divset(D3,1) by INTEGRA1:def 5
            .=upper_bound divset(D3,1) - lower_bound A by A580,INTEGRA1:def 4
            .=D3.1 - lower_bound A by A580,INTEGRA1:def 4
            .=0 by A582;
          then y=0+Sum(upper_volume(f,D)) by A585,A621,A583,A626,RVSUM_1:76
            .=upper_sum(f,D) by INTEGRA1:def 8;
          then y=(upper_sum_set(f)).D by INTEGRA1:def 10;
          hence thesis by A582,A624,A623,A592;
        end;
        hence thesis;
      end;
    end;
    then consider D being Division of A such that
 D in dom upper_sum_set(f) and
A627: y=(upper_sum_set(f)).D and
A628: D.1>lower_bound A;
    deffunc F(Nat)=In(vol(divset(D,$1)),REAL);
    set p=len D, H=upper_bound rng f, h=lower_bound rng f;
    consider v being FinSequence of REAL such that
A629: len v = len D & for j be Nat st j in dom v holds v.j=F(j) from
    FINSEQ_2:sch 1;
A630: 2*p >0 by XREAL_1:129;
    consider v1 being non-decreasing FinSequence of REAL such that
A631: v,v1 are_fiberwise_equipotent by INTEGRA2:3;
    defpred P[Nat] means $1 in dom v1 & v1.$1 > 0;
A632: dom v = Seg len D by A629,FINSEQ_1:def 3;
A633: ex k be Nat st P[k]
    proof
      consider H being Function such that
      dom H = dom v and
      rng H = dom v1 and
      H is one-to-one and
A634: v=v1*H by A631,CLASSES1:77;
      consider k such that
A635: k in dom D and
A636: vol(divset(D,k)) > 0 by A562,Th2;
A637: dom D = Seg len D by FINSEQ_1:def 3;
      then H.k in dom v1 by A632,A634,A635,FUNCT_1:11;
      then reconsider Hk = H.k as Element of NAT;
      v.k = F(k) by A629,A632,A635,A637;
      then v.k > 0 by A636;
      then P[Hk] by A632,A634,A635,A637,FUNCT_1:11,12;
      hence thesis;
    end;
    consider k be Nat such that
A638: P[k] & for n be Nat st P[n] holds k<=n from NAT_1:sch 5(A633);
A639: H-h >= 0 by A1,Lm3,XREAL_1:48;
    then
A640: 2*p*(H-h+1) > 0 by A630,XREAL_1:129;
    min(v1.k,e/(2*p*(H-h+1))) > 0
    proof
      per cases by XXREAL_0:15;
      suppose
        min(v1.k,e/(2*p*(H-h+1))) = v1.k;
        hence thesis by A638;
      end;
      suppose
        min(v1.k,e/(2*p*(H-h+1))) = e/(2*p*(H-h+1));
        hence thesis by A572,A640,XREAL_1:139;
      end;
    end;
    then consider n being Nat such that
A641: for m being Nat st n<=m
  holds 0 < (delta(T)).m & (delta(T)).m < min(v1.k,
    e/(2*p*(H-h+1))) by A564;
    take n;
A642: y=upper_sum(f,D) by A627,INTEGRA1:def 10;
A643: v1.1 > 0
      proof
A644:   for n1 be Element of NAT st n1 in dom D holds vol(divset(D,n1))
        >0
        proof
          let n1 be Element of NAT;
          assume
A645:     n1 in dom D;
          then
A646:     1 <= n1 by FINSEQ_3:25;
          per cases by A646,XXREAL_0:1;
          suppose
A647:       n1=1;
            then
A648:       upper_bound divset(D,n1)=D.n1 by A645,INTEGRA1:def 4;
            lower_bound divset(D,n1)=lower_bound A by A645,A647,INTEGRA1:def 4;
            then vol(divset(D,n1))=D.n1-lower_bound A by A648,INTEGRA1:def 5;
            hence thesis by A628,A647,XREAL_1:50;
          end;
          suppose
A649:       n1>1;
            then
A650:       upper_bound divset(D,n1)=D.n1 by A645,INTEGRA1:def 4;
            lower_bound divset(D,n1)=D.(n1-1) by A645,A649,INTEGRA1:def 4;
            then
A651:       vol(divset(D,n1))=D.n1-D.(n1-1) by A650,INTEGRA1:def 5;
            n1 < n1+1 by XREAL_1:29;
            then
A652:       n1-1 < n1 by XREAL_1:19;
            n1-1 in dom D by A645,A649,INTEGRA1:7;
            then D.(n1-1)<D.n1 by A645,A652,SEQM_3:def 1;
            hence thesis by A651,XREAL_1:50;
          end;
        end;
A653:   k <= len v1 by A638,FINSEQ_3:25;
        1 <= k by A638,FINSEQ_3:25;
        then 1 <= len v1 by A653,XXREAL_0:2;
        then 1 in dom v1 by FINSEQ_3:25;
        then
A654:   v1.1 in rng v1 by FUNCT_1:def 3;
        rng v = rng v1 by A631,CLASSES1:75;
        then consider n1 being Element of NAT such that
A655:   n1 in dom v and
A656:   v1.1 = v.n1 by A654,PARTFUN1:3;
        n1 in Seg len D by A629,A655,FINSEQ_1:def 3;
        then
A657:   n1 in dom D by FINSEQ_1:def 3;
        v1.1 = F(n1) by A629,A655,A656
          .= vol(divset(D,n1));
        hence thesis by A644,A657;
      end;
A658: v1.k = min rng upper_volume(chi(A,A),D)
      proof
A659:   k=1
        proof
          len v1 = len v by A631,RFINSEQ:3;
          then k in Seg len v by A638,FINSEQ_1:def 3;
          then
A660:     1 <= k by FINSEQ_1:1;
          k in Seg len v1 by A638,FINSEQ_1:def 3;
          then k <= len v1 by FINSEQ_1:1;
          then 1 <= len v1 by A660,XXREAL_0:2;
          then
A661:     1 in dom v1 by FINSEQ_3:25;
          assume k <> 1;
          then k > 1 by A660,XXREAL_0:1;
          hence contradiction by A638,A643,A661;
        end;
A662:   rng v = rng v1 by A631,CLASSES1:75;
        v1.k in rng upper_volume(chi(A,A),D)
        proof
          v1.k in rng v by A638,A662,FUNCT_1:def 3;
          then consider k2 being Element of NAT such that
A663:     k2 in dom v and
A664:     v1.k = v.k2 by PARTFUN1:3;
A665:     k2 in Seg len D by A629,A663,FINSEQ_1:def 3;
          then
A666:     k2 in dom D by FINSEQ_1:def 3;
          k2 in Seg len upper_volume(chi(A,A),D) by A665,INTEGRA1:def 6;
          then
A667:     k2 in dom upper_volume(chi(A,A),D) by FINSEQ_1:def 3;
          v1.k = F(k2) by A629,A663,A664
             .= vol(divset(D,k2));
          then v1.k = upper_volume(chi(A,A),D).k2 by A666,INTEGRA1:20;
          hence thesis by A667,FUNCT_1:def 3;
        end;
        then
A668:   v1.k >= min rng upper_volume(chi(A,A),D) by XXREAL_2:def 7;
        min rng upper_volume(chi(A,A),D) in rng upper_volume(chi(A,A),D
        ) by XXREAL_2:def 7;
        then consider m such that
A669:   m in dom upper_volume(chi(A,A),D) and
A670:   min rng upper_volume(chi(A,A),D)=upper_volume(chi(A,A),D).m
        by PARTFUN1:3;
        m in Seg len upper_volume(chi(A,A),D) by A669,FINSEQ_1:def 3;
        then
A671:   m in Seg len D by INTEGRA1:def 6;
        then m in dom D by FINSEQ_1:def 3;
        then
A672:      min rng upper_volume(chi(A,A),D)=vol(divset(D,m)) by A670,
INTEGRA1:20;
A673:   v.m = F(m) by A629,A632,A671
          .=min rng upper_volume(chi(A,A),D) by A672;
        m in dom v by A629,A671,FINSEQ_1:def 3;
        then min rng upper_volume(chi(A,A),D) in rng v by A673,FUNCT_1:def 3;
        then consider m1 being Element of NAT such that
A674:   m1 in dom v1 and
A675:   min rng upper_volume(chi(A,A),D)=v1.m1 by A662,PARTFUN1:3;
        m1 >= 1 by A674,FINSEQ_3:25;
        then v1.1 <= min rng upper_volume(chi(A,A),D) by A638,A659,A674,A675,
INTEGRA2:2;
        hence thesis by A659,A668,XXREAL_0:1;
      end;
A676: min (v1.k,e/(2*p*(H-h+1))) <= v1.k by XXREAL_0:17;
      set s=upper_integral(f), sD=upper_sum(f,D);
      let m be Nat;
       reconsider mm=m as Element of NAT by ORDINAL1:def 12;
      reconsider D1 = T.mm as Division of A;
A677: delta(D1)=(delta(T)).m by Def2;
      consider D2 being Division of A such that
A678: D <= D2 and
      D1 <= D2 and
A679: rng D2 = rng D1 \/ rng D and
      0 <= upper_sum(f,D)-upper_sum(f,D2) and
      0 <= upper_sum(f,D1)-upper_sum(f,D2) by A2;
      set sD1=upper_sum(f,T.mm), sD2=upper_sum(f,D2);
      upper_sum(f,D2) <= upper_sum(f,D) by A1,A678,INTEGRA1:45;
      then
A680: sD1-sD <= sD1-sD2 by XREAL_1:10;
      sD+sD1-sD1-s < e/2 by A576,A642,XREAL_1:19;
      then sD1-s+sD-sD1 < e/2;
      then sD1-s+sD < sD1+e/2 by XREAL_1:19;
      then
A681: sD1-s < sD1+e/2-sD by XREAL_1:20;
      T.mm in divs A by INTEGRA1:def 3;
      then
A682: T.m in dom upper_sum_set(f) by FUNCT_2:def 1;
      (upper_sum(f,T)).m = upper_sum(f,T.mm) by INTEGRA2:def 2;
      then (upper_sum(f,T)).m = (upper_sum_set(f)).(T.m) by INTEGRA1:def 10;
      then (upper_sum(f,T)).m in rng upper_sum_set(f) by A682,FUNCT_1:def 3;
      then lower_bound rng upper_sum_set(f)<=(upper_sum(f,T)).m by A574,
SEQ_4:def 2;
      then upper_integral(f)<=(upper_sum(f,T)).m by INTEGRA1:def 14;
      then
A683: (upper_sum(f,T)).m-upper_integral(f) >= 0 by XREAL_1:48;
      H-h <= H-h+1 by XREAL_1:29;
      then
A684: p*(H-h)<=p*(H-h+1) by XREAL_1:64;
A685: min(v1.k,e/(2*p*(H-h+1))) <= e/(2*p*(H-h+1)) by XXREAL_0:17;
      assume
A686: n<=m;
      then (delta(T)).m < min(v1.k,e/(2*p*(H-h+1))) by A641;
      then (delta(T)).m < e/(2*p*(H-h+1)) by A685,XXREAL_0:2;
      then (delta(T)).m*(2*p*(H-h+1))<e by A630,A639,XREAL_1:79,129;
      then ((delta(T)).m*(p*(H-h+1)))*2<e;
      then
A687: p*(H-h+1)*(delta(T)).m < e/2 by XREAL_1:81;
      (delta(T)).m < min(v1.k,e/(2*p*(H-h+1))) by A641,A686;
      then delta(D1)<v1.k by A677,A676,XXREAL_0:2;
      then ex D3 being Division of A st D<=D3 & D1<=D3 & rng D3= rng D1
      \/ rng D & upper_sum(f,D1)-upper_sum(f,D3) <=(len D)*(upper_bound rng f -
      lower_bound rng f)*delta(D1) by A7,A658;
      then
A688: upper_sum(f,D1)-upper_sum(f,D2)<= (len D)*(upper_bound rng f-
      lower_bound rng f)*delta(D1) by A679,Th6;
      0 < (delta(T)).m by A641,A686;
      then p*(H-h)*(delta(T)).m <= p*(H-h+1)*(delta(T)).m by A684,XREAL_1:64;
      then upper_sum(f,T.mm)-upper_sum(f,D2)
<= p*(H-h+1)*(delta(T)).m by A677
,A688,XXREAL_0:2;
      then sD1-sD <= p*(H-h+1)*(delta(T)).m by A680,XXREAL_0:2;
      then sD1-sD < e/2 by A687,XXREAL_0:2;
      then sD1-sD+e/2 < e/2+e/2 by XREAL_1:6;
      then sD1-s < e by A681,XXREAL_0:2;
      then (upper_sum(f,T)).m-upper_integral(f) < e by INTEGRA2:def 2;
      hence thesis by A683,ABSVALUE:def 1;
  end;
  hence upper_sum(f,T) is convergent by SEQ_2:def 6;
  hence thesis by A571,SEQ_2:def 7;
end;