MEASUR12

index · ← PRSUBSET · ROUGHIF2 →
:: Reconstruction of the One-Dimensional Lebesgue Measure
::  by Noboru Endou
::
:: Received January 13, 2020
:: Copyright (c) 2020-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 FUNCT_1, NUMBERS, SUBSET_1, SUPINF_2, ARYTM_3, CARD_1, RELAT_1,
      TARSKI, ORDINAL2, XXREAL_0, NAT_1, XXREAL_2, ORDINAL1, XBOOLE_0,
      ZFMISC_1, FUNCOP_1, MEASURE5, FUNCT_2, SUPINF_1, MCART_1, MEASURE4,
      REAL_1, PROB_1, MEASURE1, MEASURE7, FUNCT_7, XCMPLX_0, SETFAM_1, RCOMP_1,
      XXREAL_1, MEASUR10, ARYTM_1, CARD_3, FINSEQ_1, ORDINAL4, VALUED_0,
      SERIES_1, MESFUNC5, SEQ_2, CLASSES1, TOPMETR, STRUCT_0, FINSET_1,
      UPROOTS, MEASURE8, SRINGS_3, PROB_2, MEASURE9, NEWTON, COMPLEX1, SEQ_1,
      RFINSEQ2, RFINSEQ, MEASURE3, REWRITE1, MEASUR12;
 notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, ORDINAL1, MESFUNC9, CARD_1,
      SEQ_1, SETFAM_1, FUNCOP_1, RELAT_1, FUNCT_1, RELSET_1, PARTFUN1,
      FINSEQ_1, SEQ_2, SERIES_1, RFINSEQ, CARD_3, SEQ_4, CLASSES1, PROB_2,
      VALUED_0, FINSET_1, FUNCT_2, XXREAL_2, EXTREAL1, XXREAL_1, XXREAL_0,
      XXREAL_3, XCMPLX_0, COMPLEX1, XREAL_0, NUMBERS, MEASURE3, SUPINF_1,
      MEASUR10, SUPINF_2, NAT_1, RCOMP_1, RECDEF_1, MEASURE1, MEASURE4,
      MEASURE5, MEASURE7, MESFUNC5, PROB_1, MEASURE8, STRUCT_0, PRE_TOPC,
      COMPTS_1, TOPMETR, PROB_3, FUNCT_7, FINSEQ_7, FINSEQOP, SRINGS_3,
      MEASURE9, NEWTON;
 constructors MEASURE5, RECDEF_1, SUPINF_1, MEASURE6, RCOMP_1, MEASURE7,
      MESFUNC9, EXTREAL1, TOPS_2, COMPTS_1, TOPMETR, SIMPLEX0, PROB_3, RVSUM_1,
      FINSEQ_7, FINSEQOP, MEASUR11, MEASURE3, SEQ_4, NEWTON, COMSEQ_2, RFINSEQ;
 registrations XBOOLE_0, SUBSET_1, ORDINAL1, FUNCT_2, NUMBERS, XREAL_0,
      MEMBERED, MEASURE1, VALUED_0, XXREAL_2, FUNCT_1, RELSET_1, MEASURE5,
      NAT_1, SIMPLEX0, COMPTS_1, FINSEQ_1, RELAT_1, FINSET_1, XXREAL_0, CARD_1,
      MEASURE9, XXREAL_1, FUNCT_7, EXCHSORT, ZFMISC_1, ROUGHS_1, RFINSEQ,
      FUNCOP_1, XXREAL_3, DBLSEQ_3, MEASURE3;
 requirements NUMERALS, BOOLE, SUBSET, ARITHM, REAL;
 definitions TARSKI;
 equalities SUPINF_2;
 expansions TARSKI;
 theorems TARSKI, SUPINF_2, MEASURE1, FUNCT_1, MEASURE5, MEASURE6, ZFMISC_1,
      FUNCT_2, NAT_1, XBOOLE_0, XBOOLE_1, FUNCOP_1, XXREAL_0, ORDINAL1,
      XXREAL_2, XXREAL_3, MEASURE7, XXREAL_1, MEASURE8, MESFUNC5, MESFUNC9,
      RINFSUP2, XREAL_1, MEASUR10, XREAL_0, MEASURE4, VALUED_0, HEINE,
      COMPTS_1, TOPMETR, STRUCT_0, SETFAM_1, TOPS_2, BORSUK_5, FINSEQ_1,
      PARTFUN1, SRINGS_3, CARD_3, FINSEQ_3, RFINSEQ, CLASSES1, EXTREAL1,
      RELAT_1, MEMBERED, BORSUK_1, EXCHSORT, FUNCT_7, FINSEQ_2, FINSEQ_5,
      PROB_1, PROB_2, MEASURE9, XCMPLX_1, LIOUVIL1, SERIES_1, NEWTON, NUMBERS,
      MATRIX15, MEASURE3;
 schemes FUNCT_2, NAT_1, SUBSET_1, XBOOLE_0, XFAMILY, FINSEQ_2, SEQ_1;

begin :: Properties of intervals

theorem Th1:
for A,B be non empty Interval st A is open_interval & B is open_interval &
 A \/ B is Interval holds
 A \/ B is open_interval & A meets B & (inf A < sup B or inf B < sup A)
proof
    let A,B be non empty Interval;
    assume that
A1:  A is open_interval and
A2:  B is open_interval and
A3:  A \/ B is Interval;
    ex a1,a2 be R_eal st A = ].a1,a2.[ by A1,MEASURE5:def 2; then
A4: A = ].inf A,sup A.[ by XXREAL_2:78;
    ex b1,b2 be R_eal st B = ].b1,b2.[ by A2,MEASURE5:def 2; then
A5: B = ].inf B,sup B.[ by XXREAL_2:78;

A6: inf(A \/ B) = min(inf A,inf B) by XXREAL_2:9;
A7: sup(A \/ B) = max(sup A,sup B) by XXREAL_2:10;
    per cases;
    suppose A8: inf A <= inf B; then
A9:  inf(A \/ B) = inf A by A6,XXREAL_0:def 9;
     per cases;
     suppose A10: sup A <= sup B; then
A11:  A \/ B = ].inf A,sup B.[ \ [.sup A,inf B.] by A4,A5,A8,XXREAL_1:309;
A12:  sup(A \/ B) = sup B by A7,A10,XXREAL_0:def 10;
A13:  now assume sup A <= inf B; then
       [.sup A,inf B.] is non empty by XXREAL_1:30; then
       consider x be ExtReal such that
A14:    x in [.sup A,inf B.] by MEMBERED:8;
       sup A <= x & x <= inf B by A14,XXREAL_1:1; then
       inf A < x & x < sup B by A4,A5,XXREAL_1:28,XXREAL_0:2; then
       x in A \/ B by A3,A9,A12,XXREAL_2:83;
       hence contradiction by A11,A14,XBOOLE_0:def 5;
      end; then
      [.sup A,inf B.] = {} by XXREAL_1:29;
      hence A \/ B is open_interval by A11,MEASURE5:def 2;

      ].inf B,sup A.[ <> {} by A13,XXREAL_1:33; then
      consider y be ExtReal such that
A15:   y in ].inf B,sup A.[ by MEMBERED:8;
      inf B < y < sup A by A15,XXREAL_1:4; then
      inf A < y < sup A & inf B < y < sup B by A8,A10,XXREAL_0:2; then
      y in A & y in B by A4,A5,XXREAL_1:4;
      hence A meets B by XBOOLE_0:3;
      thus inf A < sup B or inf B < sup A by A13;
     end;
     suppose sup A > sup B;
      hence thesis by A1,A4,A5,A8,XXREAL_1:28,46,XBOOLE_1:12,69,XXREAL_0:2;
     end;
    end;

    suppose A16: inf A > inf B; then
A17: inf(A \/ B) = inf B by A6,XXREAL_0:def 9;

     per cases;
     suppose sup A <= sup B;
      hence thesis by A2,A4,A5,A16,XXREAL_1:28,46,XBOOLE_1:12,69,XXREAL_0:2;
     end;
     suppose A18: sup A > sup B; then
A19:  A \/ B = ].inf B,sup A.[ \ [.sup B,inf A.] by A4,A5,A16,XXREAL_1:309;
A20:  sup(A \/ B) = sup A by A7,A18,XXREAL_0:def 10;

A21:  now assume sup B <= inf A; then
       [.sup B,inf A.] is non empty by XXREAL_1:30; then
       consider x be ExtReal such that
A22:    x in [.sup B,inf A.] by MEMBERED:8;
       sup B <= x & x <= inf A by A22,XXREAL_1:1; then
       inf B < x & x < sup A by A4,A5,XXREAL_1:28,XXREAL_0:2; then
       x in A \/ B by A3,A17,A20,XXREAL_2:83;
       hence contradiction by A19,A22,XBOOLE_0:def 5;
      end; then
      [.sup B,inf A.] = {} by XXREAL_1:29;
      hence A \/ B is open_interval by A19,MEASURE5:def 2;
      ].inf A,sup B.[ <> {} by A21,XXREAL_1:33; then
      consider y be ExtReal such that
A23:  y in ].inf A,sup B.[ by MEMBERED:8;
      inf A < y < sup B by A23,XXREAL_1:4; then
      inf B < y < sup B & inf A < y < sup A by A16,A18,XXREAL_0:2; then
      y in A & y in B by A4,A5,XXREAL_1:4;
      hence A meets B by XBOOLE_0:3;
      thus inf A < sup B or inf B < sup A by A21;
     end;
    end;
end;

theorem Th2:
for A,B be open_interval Subset of REAL st
 A meets B holds A \/ B is open_interval Subset of REAL
proof
    let A,B be open_interval Subset of REAL;
    assume A meets B; then
    A <> {} & B <> {} & A \/ B is interval by XBOOLE_1:65,XXREAL_2:89;
    hence A \/ B is open_interval Subset of REAL by Th1;
end;

Lm1:
for A be closed_interval Subset of REAL, B,C be open_interval Subset of REAL
 st A c= B \/ C & A meets B & A meets C holds B meets C
proof
    let A be closed_interval Subset of REAL,
    B,C be open_interval Subset of REAL;
    assume that
A1:  A c= B \/ C and
A2:  A meets B and
A3:  A meets C;

    per cases;
    suppose A c= B or A c= C; then
     ex x be object st x in A & x in B /\ C by A2,A3,XBOOLE_1:77,XBOOLE_0:3;
     hence B meets C by XBOOLE_0:4;
    end;
    suppose A4: not A c= B & not A c= C;
A5:  A <> {} & B <> {} & C <> {} by A2,A3,XBOOLE_1:65; then
     consider a1,a2 be Real such that
A6:   a1 <= a2 & A = [.a1,a2.] by MEASURE5:14;
     consider b1,b2 be R_eal such that
A7:   B = ].b1,b2.[ by MEASURE5:def 2;
     consider c1,c2 be R_eal such that
A8:   C = ].c1,c2.[ by MEASURE5:def 2;
A9:  b1 < a2 & a1 < b2 by A2,A6,A7,XXREAL_1:89,93;

     per cases by A4,A6,A7,XXREAL_1:47;
     suppose a1 <= b1; then
A10:  b1 in B \/ C by A1,A6,A9,XXREAL_1:1;
      not b1 in B by A7,XXREAL_1:4; then
      b1 in C by A10,XBOOLE_0:def 3; then
A11:  c1 < b1 & b1 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A12:   b1 < x & x < c2 by XXREAL_3:3;
      per cases;
      suppose b2 < c2;
       hence B meets C by A5,A7,A8,A11,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose c2 <= b2; then
       x < b2 & c1 < x by A11,A12,XXREAL_0:2; then
       x in B & x in C by A7,A8,A12,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;
     suppose b2 <= a2; then
A13:  b2 in B \/ C by A1,A6,A9,XXREAL_1:1;
      not b2 in B by A7,XXREAL_1:4; then
      b2 in C by A13,XBOOLE_0:def 3; then
A14:  c1 < b2 & b2 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A15:   c1 < x & x < b2 by XXREAL_3:3;
      per cases;
      suppose c1 < b1;
       hence B meets C by A5,A7,A8,A14,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose b1 <= c1; then
       b1 < x & x < c2 by A14,A15,XXREAL_0:2; then
       x in B & x in C by A7,A8,A15,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;
    end;
end;

Lm2:
for A be open_interval Subset of REAL, B,C be open_interval Subset of REAL
 st A c= B \/ C & A meets B & A meets C holds B meets C
proof
    let A be open_interval Subset of REAL,
    B,C be open_interval Subset of REAL;
    assume that
A1:  A c= B \/ C and
A2:  A meets B and
A3:  A meets C;

    per cases;
    suppose A c= B or A c= C; then
     ex x be object st x in A & x in B /\ C by A2,A3,XBOOLE_1:77,XBOOLE_0:3;
     hence B meets C by XBOOLE_0:4;
    end;
    suppose A4: not A c= B & not A c= C;
A5:  A <> {} & B <> {} & C <> {} by A2,A3,XBOOLE_1:65;
     consider a1,a2 be R_eal such that
A6:   A = ].a1,a2.[ by MEASURE5:def 2;
     consider b1,b2 be R_eal such that
A7:   B = ].b1,b2.[ by MEASURE5:def 2;
     consider c1,c2 be R_eal such that
A8:   C = ].c1,c2.[ by MEASURE5:def 2;
A9:  b1 < a2 & a1 < b2 by A2,A6,A7,XXREAL_1:275;

     per cases by A4,A6,A7,XXREAL_1:46;
     suppose a1 < b1; then
A10:  b1 in B \/ C by A1,A6,A9,XXREAL_1:4;
      not b1 in B by A7,XXREAL_1:4; then
      b1 in C by A10,XBOOLE_0:def 3; then
A11:  c1 < b1 & b1 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A12:   b1 < x & x < c2 by XXREAL_3:3;
      per cases;
      suppose b2 < c2;
       hence B meets C by A5,A7,A8,A11,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose c2 <= b2; then
       x < b2 & c1 < x by A11,A12,XXREAL_0:2; then
       x in B & x in C by A7,A8,A12,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;

     suppose b2 < a2; then
A13:  b2 in B \/ C by A1,A6,A9,XXREAL_1:4;
      not b2 in B by A7,XXREAL_1:4; then
      b2 in C by A13,XBOOLE_0:def 3; then
A14:  c1 < b2 & b2 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A15:   c1 < x & x < b2 by XXREAL_3:3;
      per cases;
      suppose c1 < b1;
       hence B meets C by A5,A7,A8,A14,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose b1 <= c1; then
       b1 < x & x < c2 by A14,A15,XXREAL_0:2; then
       x in B & x in C by A7,A8,A15,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;
    end;
end;

Lm3:
for A be right_open_interval Subset of REAL,
 B,C be open_interval Subset of REAL
 st A c= B \/ C & A meets B & A meets C holds B meets C
proof
    let A be right_open_interval Subset of REAL,
    B,C be open_interval Subset of REAL;
    assume that
A1:  A c= B \/ C and
A2:  A meets B and
A3:  A meets C;

    per cases;
    suppose A c= B or A c= C; then
     ex x be object st x in A & x in B /\ C by A2,A3,XBOOLE_1:77,XBOOLE_0:3;
     hence B meets C by XBOOLE_0:4;
    end;
    suppose A4: not A c= B & not A c= C;
A5:  A <> {} & B <> {} & C <> {} by A2,A3,XBOOLE_1:65;
     consider a1 be Real, a2 be R_eal such that
A6:   A = [.a1,a2.[ by MEASURE5:def 4;
     consider b1,b2 be R_eal such that
A7:   B = ].b1,b2.[ by MEASURE5:def 2;
     consider c1,c2 be R_eal such that
A8:   C = ].c1,c2.[ by MEASURE5:def 2;
A9:  b1 < a2 & a1 < b2 by A2,A6,A7,XXREAL_1:94,273;
     per cases by A4,A6,A7,XXREAL_1:48;
     suppose a1 <= b1; then
A10:  b1 in B \/ C by A1,A6,A9,XXREAL_1:3;
      not b1 in B by A7,XXREAL_1:4; then
      b1 in C by A10,XBOOLE_0:def 3; then
A11:  c1 < b1 & b1 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A12:   b1 < x & x < c2 by XXREAL_3:3;
      per cases;
      suppose b2 < c2;
       hence B meets C by A5,A7,A8,A11,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose c2 <= b2; then
       x < b2 & c1 < x by A11,A12,XXREAL_0:2; then
       x in B & x in C by A7,A8,A12,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;

     suppose b2 < a2; then
A13:  b2 in B \/ C by A1,A6,A9,XXREAL_1:3;
      not b2 in B by A7,XXREAL_1:4; then
      b2 in C by A13,XBOOLE_0:def 3; then
A14:  c1 < b2 & b2 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A15:   c1 < x & x < b2 by XXREAL_3:3;
      per cases;
      suppose c1 < b1;
       hence B meets C by A5,A7,A8,A14,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose b1 <= c1; then
       b1 < x & x < c2 by A14,A15,XXREAL_0:2; then
       x in B & x in C by A7,A8,A15,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;
    end;
end;

Lm4:
for A be left_open_interval Subset of REAL,
 B,C be open_interval Subset of REAL
 st A c= B \/ C & A meets B & A meets C holds B meets C
proof
    let A be left_open_interval Subset of REAL,
    B,C be open_interval Subset of REAL;
    assume that
A1:  A c= B \/ C and
A2:  A meets B and
A3:  A meets C;

    per cases;
    suppose A c= B or A c= C; then
     ex x be object st x in A & x in B /\ C by A2,A3,XBOOLE_1:77,XBOOLE_0:3;
     hence B meets C by XBOOLE_0:4;
    end;
    suppose A4: not A c= B & not A c= C;
A5:  A <> {} & B <> {} & C <> {} by A2,A3,XBOOLE_1:65;
     consider a1 be R_eal, a2 be Real such that
A6:   A = ].a1,a2.] by MEASURE5:def 5;
     consider b1,b2 be R_eal such that
A7:   B = ].b1,b2.[ by MEASURE5:def 2;
     consider c1,c2 be R_eal such that
A8:   C = ].c1,c2.[ by MEASURE5:def 2;
A9:  b1 < a2 & a1 < b2 by A2,A6,A7,XXREAL_1:91,276;

     per cases by A4,A6,A7,XXREAL_1:49;
     suppose a1 < b1; then
A10:  b1 in B \/ C by A1,A6,A9,XXREAL_1:2;
      not b1 in B by A7,XXREAL_1:4; then
      b1 in C by A10,XBOOLE_0:def 3; then
A11:  c1 < b1 & b1 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A12:   b1 < x & x < c2 by XXREAL_3:3;
      per cases;
      suppose b2 < c2;
       hence B meets C by A5,A7,A8,A11,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose c2 <= b2; then
       x < b2 & c1 < x by A11,A12,XXREAL_0:2; then
       x in B & x in C by A7,A8,A12,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;

     suppose b2 <= a2; then
A13:  b2 in B \/ C by A1,A6,A9,XXREAL_1:2;
      not b2 in B by A7,XXREAL_1:4; then
      b2 in C by A13,XBOOLE_0:def 3; then
A14:  c1 < b2 & b2 < c2 by A8,XXREAL_1:4; then
      consider x be Real such that
A15:   c1 < x & x < b2 by XXREAL_3:3;
      per cases;
      suppose c1 < b1;
       hence B meets C by A5,A7,A8,A14,XXREAL_1:46,XBOOLE_1:69;
      end;
      suppose b1 <= c1; then
       b1 < x & x < c2 by A14,A15,XXREAL_0:2; then
       x in B & x in C by A7,A8,A15,XXREAL_1:4;
       hence B meets C by XBOOLE_0:3;
      end;
     end;
    end;
end;

theorem
for A be Interval, B,C be open_interval Subset of REAL
 st A c= B \/ C & A meets B & A meets C holds B meets C
proof
    let A be Interval, B,C be open_interval Subset of REAL;
    assume A1: A c= B \/ C & A meets B & A meets C;
    A is open_interval or A is closed_interval or
    A is right_open_interval or A is left_open_interval
      by MEASURE5:1;
    hence thesis by A1,Lm1,Lm2,Lm3,Lm4;
end;

theorem Th4:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.] & B = [.r,s.] & A misses B holds q < r or s < p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = [.r,s.] and
A3:  A misses B;

    assume
A4:  q >= r & s >= p;
    per cases by A3,A1,A2,XXREAL_1:34,XBOOLE_1:69;
    suppose r < p & s <= q; then
     A /\ B = [.p,s.] by A1,A2,XXREAL_1:143; then
     ex x be object st x in A /\ B by A4,XXREAL_1:30,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s > q; then
     A /\ B = [.r,q.] by A1,A2,XXREAL_1:143; then
     ex x be object st x in A /\ B by A4,XXREAL_1:30,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th5:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.] & B = [.r,s.[ & A misses B holds q < r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = [.r,s.[ and
A3:  A misses B;

    assume
A4:  q >= r & s > p;
    per cases by A3,A1,A2,XXREAL_1:35,43,XBOOLE_1:69;
    suppose r < p & s <= q; then
     A /\ B = [.p,s.[ by A1,A2,XXREAL_1:144; then
     ex x be object st x in A /\ B by A4,XXREAL_1:31,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s > q; then
     A /\ B = [.r,q.] by A1,A2,XXREAL_1:145; then
     ex x be object st x in A /\ B by A4,XXREAL_1:30,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th6:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.] & B = ].r,s.] & A misses B holds q <= r or s < p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = ].r,s.] and
A3:  A misses B;

    assume
A4:  q > r & s >= p;
    per cases by A3,A1,A2,XXREAL_1:36,39,XBOOLE_1:69;
    suppose r < p & s <= q; then
     A /\ B = [.p,s.] by A1,A2,XXREAL_1:146; then
     ex x be object st x in A /\ B by A4,XXREAL_1:30,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s > q; then
     A /\ B = ].r,q.] by A1,A2,XXREAL_1:147; then
     ex x be object st x in A /\ B by A4,XXREAL_1:32,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th7:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.] & B = ].r,s.[ & A misses B holds q <= r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = ].r,s.[ and
A3:  A misses B;

    assume
A4:  q > r & s > p;
    per cases by A3,A1,A2,XXREAL_1:37,47,XBOOLE_1:69;
    suppose r < p & s <= q; then
     A /\ B = [.p,s.[ by A1,A2,XXREAL_1:148; then
     ex x be object st x in A /\ B by A4,XXREAL_1:31,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s > q; then
     A /\ B = ].r,q.] by A1,A2,XXREAL_1:149; then
     ex x be object st x in A /\ B by A4,XXREAL_1:32,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th8:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.[ & B = [.r,s.[ & A misses B holds q <= r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.[ and
A2:  B = [.r,s.[ and
A3:  A misses B;

    assume
A4:  q > r & s > p;
    per cases by A3,A1,A2,XXREAL_1:38,XBOOLE_1:69;
    suppose r < p & s <= q; then
     A /\ B = [.p,s.[ by A1,A2,XXREAL_1:150; then
     ex x be object st x in A /\ B by A4,XXREAL_1:31,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s > q; then
     A /\ B = [.r,q.[ by A1,A2,XXREAL_1:151; then
     ex x be object st x in A /\ B by A4,XXREAL_1:31,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th9:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.[ & B = ].r,s.] & A misses B holds q <= r or s < p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.[ and
A2:  B = ].r,s.] and
A3:  A misses B;

    assume
A4:  q > r & s >= p;
    per cases by A3,A1,A2,XXREAL_1:40,44,XBOOLE_1:69;
    suppose r < p & s < q; then
     A /\ B = [.p,s.] by A1,A2,XXREAL_1:152; then
     ex x be object st x in A /\ B by A4,XXREAL_1:30,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s >= q; then
     A /\ B = ].r,q.[ by A1,A2,XXREAL_1:153; then
     ex x be object st x in A /\ B by A4,XXREAL_1:33,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th10:
for A,B be non empty set, p,q,r,s be R_eal st
 A = [.p,q.[ & B = ].r,s.[ & A misses B holds q <= r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.[ and
A2:  B = ].r,s.[ and
A3:  A misses B;

    assume
A4:  q > r & s > p;
    per cases by A3,A1,A2,XXREAL_1:45,48,XBOOLE_1:69;
    suppose r < p & s < q; then
     A /\ B = [.p,s.[ by A1,A2,XXREAL_1:154; then
     ex x be object st x in A /\ B by A4,XXREAL_1:31,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s >= q; then
     A /\ B = ].r,q.[ by A1,A2,XXREAL_1:155; then
     ex x be object st x in A /\ B by A4,XXREAL_1:33,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th11:
for A,B be non empty set, p,q,r,s be R_eal st
 A = ].p,q.] & B = ].r,s.] & A misses B holds q <= r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = ].p,q.] and
A2:  B = ].r,s.] and
A3:  A misses B;

    assume
A4:  q > r & s > p;
    per cases by A3,A1,A2,XXREAL_1:42,XBOOLE_1:69;
    suppose r < p & s < q; then
     A /\ B = ].p,s.] by A1,A2,XXREAL_1:157; then
     ex x be object st x in A /\ B by A4,XXREAL_1:32,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s >= q; then
     A /\ B = ].r,q.] by A1,A2,XXREAL_1:157; then
     ex x be object st x in A /\ B by A4,XXREAL_1:32,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th12:
for A,B be non empty set, p,q,r,s be R_eal st
 A = ].p,q.] & B = ].r,s.[ & A misses B holds q <= r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = ].p,q.] and
A2:  B = ].r,s.[ and
A3:  A misses B;

    assume
A4:  q > r & s > p;
    per cases by A3,A1,A2,XXREAL_1:41,49,XBOOLE_1:69;
    suppose r < p & s <= q; then
     A /\ B = ].p,s.[ by A1,A2,XXREAL_1:158; then
     ex x be object st x in A /\ B by A4,XXREAL_1:33,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r >= p & s > q; then
     A /\ B = ].r,q.] by A1,A2,XXREAL_1:159; then
     ex x be object st x in A /\ B by A4,XXREAL_1:32,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th13:
for A,B be non empty set, p,q,r,s be R_eal st
 A = ].p,q.[ & B = ].r,s.[ & A misses B holds q <= r or s <= p
proof
    let A,B be non empty set, p,q,r,s be R_eal;
    assume that
A1:  A = ].p,q.[ and
A2:  B = ].r,s.[ and
A3:  A misses B;

    assume
A4:  q > r & s > p;
    per cases by A3,A1,A2,XXREAL_1:46,XBOOLE_1:69;
    suppose r <= p & s <= q; then
     A /\ B = ].p,s.[ by A1,A2,XXREAL_1:160; then
     ex x be object st x in A /\ B by A4,XXREAL_1:33,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
    suppose r > p & s > q; then
     A /\ B = ].r,q.[ by A1,A2,XXREAL_1:160; then
     ex x be object st x in A /\ B by A4,XXREAL_1:33,XBOOLE_0:def 1;
     hence contradiction by A3,XBOOLE_0:4;
    end;
end;

theorem Th14:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.] & B = [.r,s.] & A misses B holds not A \/ B is Interval
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = [.r,s.] and
A3:  A misses B;

A4: p <= q & r <= s by A1,A2,XXREAL_1:29;

A5: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,XXREAL_1:29,MEASURE6:10,14;

    per cases by A1,A2,A3,Th4;
    suppose A6: q < r; then
     consider x be R_eal such that
A7:   q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A7,XXREAL_1:1; then
A8:  not x in A \/ B by XBOOLE_0:def 3;

A9: inf A < x & x < sup B by A7,A4,A5,XXREAL_0:2;
     now assume
A10:   A \/ B is Interval;
      inf(A \/ B) = min(inf A,inf B)
    & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10; then
      inf(A \/ B) = inf A & sup(A \/ B) = sup B
        by A6,A4,A5,XXREAL_0:2,def 9,def 10;
      hence contradiction by A8,A9,A10,XXREAL_2:83;
     end;
     hence not A \/ B is Interval;
    end;
    suppose A11: s < p; then
     consider x be R_eal such that
A12:   s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A12,XXREAL_1:1; then
A13:  not x in A \/ B by XBOOLE_0:def 3;

A14: inf B < x & x < sup A by A12,A4,A5,XXREAL_0:2;
     now assume
A15:   A \/ B is Interval;
      inf(A \/ B) = min(inf A,inf B)
    & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10; then
      inf(A \/ B) = inf B & sup(A \/ B) = sup A
        by A11,A4,A5,XXREAL_0:2,XXREAL_0:def 9,def 10;
      hence contradiction by A13,A14,A15,XXREAL_2:83;
     end;
     hence not A \/ B is Interval;
    end;
end;

theorem Th15:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.] & B = [.r,s.[ & A misses B & A \/ B is Interval
  holds p = s & A \/ B = [.r,q.]
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = [.r,s.[ and
A3:  A misses B and
A4:  A \/ B is Interval;

A5: p <= q & r < s by A1,A2,XXREAL_1:27,29; then
A6: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:10,14,11,15;

    now assume A7: q < r; then
     consider x be R_eal such that
A8:   q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A8,XXREAL_1:1,3; then
A9:  not x in A \/ B by XBOOLE_0:def 3;

     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf A & sup(A \/ B) = sup B
       by A5,A6,A7,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A5,A6,A8,XXREAL_0:2;
     hence contradiction by A9,A4,XXREAL_2:83;
    end; then
A10:s <= p by A1,A2,A3,Th5;

    now assume A11: s < p; then
     consider x be R_eal such that
A12:  s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A12,XXREAL_1:1,3; then
A13: not x in A \/ B by XBOOLE_0:def 3;

     min(inf A,inf B) = inf B & max(sup A,sup B) = sup A
       by A11,A6,A5,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) = inf B & sup(A \/ B) = sup A by XXREAL_2:9,10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A6,A5,A12,XXREAL_0:2;
     hence contradiction by A13,A4,XXREAL_2:83;
    end;
    hence p = s by A10,XXREAL_0:1;
    hence A \/ B = [.r,q.] by A1,A2,A5,XXREAL_1:166;
end;

theorem Th16:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.] & B = ].r,s.] & A misses B & A \/ B is Interval
  holds q = r & A \/ B = [.p,s.]
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = ].r,s.] and
A3:  A misses B and
A4:  A \/ B is Interval;

A5: p <= q & r < s by A1,A2,XXREAL_1:26,29; then
A6: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:10,14,9,13;

    now assume A7: s < p; then
     consider x be R_eal such that
A8:   s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A8,XXREAL_1:1,2; then
A9:  not x in A \/ B by XBOOLE_0:def 3;

     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf B & sup(A \/ B) = sup A
       by A5,A6,A7,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A5,A6,A8,XXREAL_0:2;
     hence contradiction by A9,A4,XXREAL_2:83;
    end; then
A10:q <= r by A1,A2,A3,Th6;

    now assume A11: q < r; then
     consider x be R_eal such that
A12:  q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A12,XXREAL_1:1,2; then
A13: not x in A \/ B by XBOOLE_0:def 3;

     min(inf A,inf B) = inf A & max(sup A,sup B) = sup B
       by A11,A6,A5,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) = inf A & sup(A \/ B) = sup B by XXREAL_2:9,10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A6,A5,A12,XXREAL_0:2;
     hence contradiction by A13,A4,XXREAL_2:83;
    end;
    hence q = r by A10,XXREAL_0:1;
    hence A \/ B = [.p,s.] by A1,A2,A5,XXREAL_1:167;
end;

theorem Th17:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.] & B = ].r,s.[ & A misses B & A \/ B is Interval
  holds (p = s & A \/ B = ].r,q.]) or (q = r & A \/ B = [.p,s.[)
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.] and
A2:  B = ].r,s.[ and
A3:  A misses B and
A4:  A \/ B is Interval;

A5: p <= q & r < s by A1,A2,XXREAL_1:28,29; then
A6: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:10,14,8,12;

A7: now assume A8: q < r; then
     consider x be R_eal such that
A9:   q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A9,XXREAL_1:1,4; then
A10:  not x in A \/ B by XBOOLE_0:def 3;

     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf A & sup(A \/ B) = sup B
       by A5,A6,A8,XXREAL_0:2,XXREAL_0:def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A5,A6,A9,XXREAL_0:2;
     hence contradiction by A10,A4,XXREAL_2:83;
    end;

A11: now assume A12: s < p; then
     consider x be R_eal such that
A13:   s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A13,XXREAL_1:1,4; then
A14:  not x in A \/ B by XBOOLE_0:def 3;

     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf B & sup(A \/ B) = sup A
       by A5,A6,A12,XXREAL_0:2,XXREAL_0:def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A5,A6,A13,XXREAL_0:2;
     hence contradiction by A14,A4,XXREAL_2:83;
    end;
A15: q <= r or s <= p by A1,A2,A3,Th7;

    per cases by A15,A7,A11,XXREAL_0:1;
    suppose q = r;
     hence thesis by A1,A2,A5,XXREAL_1:169;
    end;
    suppose A16: s = p;
     A = {p} \/ ].p,q.] by A1,XXREAL_1:29,130; then
     A \/ B = ].r,s.[ \/ {p} \/ ].p,q.] by A2,XBOOLE_1:4; then
     A \/ B = ].r,s.] \/ ].p,q.] by A16,A2,XXREAL_1:28,132;
     hence thesis by A5,A16,XXREAL_1:170;
    end;
end;

theorem Th18:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.[ & B = [.r,s.[ & A misses B & A \/ B is Interval
  holds (p = s & A \/ B = [.r,q.[) or (q = r & A \/ B = [.p,s.[)
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.[ and
A2:  B = [.r,s.[ and
A3:  A misses B and
A4:  A \/ B is Interval;

A5: p < q & r < s by A1,A2,XXREAL_1:27; then
A6: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:11,15;

A7: now assume A8: q < r; then
     consider x be R_eal such that
A9:   q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A9,XXREAL_1:3; then
A10:  not x in A \/ B by XBOOLE_0:def 3;

A11: inf A < inf B & sup A < sup B by A6,A8,A1,A2,XXREAL_1:27,XXREAL_0:2;

     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf A & sup(A \/ B) = sup B
       by A11,XXREAL_0:def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A6,A9,A1,A2,XXREAL_1:27,XXREAL_0:2;
     hence contradiction by A10,A4,XXREAL_2:83;
    end;

A12: now assume A13: s < p; then
     consider x be R_eal such that
A14:   s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A14,XXREAL_1:3; then
A15:  not x in A \/ B by XBOOLE_0:def 3;

A16: inf B < inf A & sup B < sup A by A6,A13,A1,A2,XXREAL_1:27,XXREAL_0:2;

     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf B & sup(A \/ B) = sup A
       by A16,XXREAL_0:def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A6,A14,A1,A2,XXREAL_1:27,XXREAL_0:2;
     hence contradiction by A15,A4,XXREAL_2:83;
    end;
    q <= r or s <= p by A1,A2,A3,Th8; then
    q = r or s = p by A7,A12,XXREAL_0:1;
    hence thesis by A1,A2,A5,XXREAL_1:168;
end;

theorem Th19:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.[ & B = ].r,s.] & A misses B holds not A \/ B is Interval
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.[ and
A2:  B = ].r,s.] and
A3:  A misses B;

    p < q & r < s by A1,A2,XXREAL_1:26,27; then
A4: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:11,15,9,13;

    per cases by A1,A2,A3,Th9;
    suppose A5: q <= r; then
A6:  inf A < inf B & sup A < sup B by A4,A1,A2,XXREAL_1:26,27,XXREAL_0:2;
     not q in A & not q in B by A1,A2,A5,XXREAL_1:2,3; then
A7:  not q in A \/ B by XBOOLE_0:def 3;
A8: inf A < q & q < sup B by A4,A5,A1,A2,XXREAL_1:26,27,XXREAL_0:2;
     now assume
A9:   A \/ B is Interval;
      inf(A \/ B) = min(inf A,inf B)
    & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10; then
      inf(A \/ B) = inf A & sup(A \/ B) = sup B
        by A6,XXREAL_0:def 9,def 10;
      hence contradiction by A7,A8,A9,XXREAL_2:83;
     end;
     hence not A \/ B is Interval;
    end;
    suppose A10: s < p; then
A11:  inf B < inf A & sup B < sup A by A4,A1,A2,XXREAL_1:26,27,XXREAL_0:2;
     consider x be R_eal such that
A12:   s < x & x < p & x in REAL by A10,MEASURE5:2;
     not x in A & not x in B by A1,A2,A12,XXREAL_1:2,3; then
A13:  not x in A \/ B by XBOOLE_0:def 3;
A14: inf B < x & x < sup A by A12,A4,A1,A2,XXREAL_1:26,27,XXREAL_0:2;
     now assume
A15:   A \/ B is Interval;
      inf(A \/ B) = min(inf A,inf B)
    & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10; then
      inf(A \/ B) = inf B & sup(A \/ B) = sup A
        by A11,XXREAL_0:def 9,def 10;
      hence contradiction by A13,A14,A15,XXREAL_2:83;
     end;
     hence not A \/ B is Interval;
    end;
end;

theorem Th20:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = [.p,q.[ & B = ].r,s.[ & A misses B & A \/ B is Interval
  holds p = s & A \/ B = ].r,q.[
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = [.p,q.[ and
A2:  B = ].r,s.[ and
A3:  A misses B and
A4:  A \/ B is Interval;
A5: p < q & r < s by A1,A2,XXREAL_1:27,28; then
A6: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:8,11,12,15;
    now assume A7: q <= r; then
     not q in A & not q in B by A1,A2,XXREAL_1:3,4; then
A8:  not q in A \/ B by XBOOLE_0:def 3;
A9: inf A < inf B & sup A < sup B by A6,A7,A1,A2,XXREAL_1:27,28,XXREAL_0:2;
     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) < q & q < sup(A \/ B) by A5,A6,A9,XXREAL_0:def 9,def 10;
     hence contradiction by A8,A4,XXREAL_2:83;
    end; then
A10:s <= p by A1,A2,A3,Th10;
    now assume A11: s < p; then
     consider x be R_eal such that
A12:  s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A12,XXREAL_1:3,4; then
A13: not x in A \/ B by XBOOLE_0:def 3;
     min(inf A,inf B) = inf B & max(sup A,sup B) = sup A
       by A11,A6,A5,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) = inf B & sup(A \/ B) = sup A by XXREAL_2:9,10; then
     inf(A \/ B) < x & x < sup(A \/ B)
       by A6,A12,A1,A2,XXREAL_1:27,28,XXREAL_0:2;
     hence contradiction by A13,A4,XXREAL_2:83;
    end;
    hence p = s by A10,XXREAL_0:1;
    hence A \/ B = ].r,q.[ by A1,A2,A5,XXREAL_1:173;
end;

theorem Th21:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = ].p,q.] & B = ].r,s.] & A misses B & A \/ B is Interval
  holds (p = s & A \/ B = ].r,q.]) or (q = r & A \/ B = ].p,s.])
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = ].p,q.] and
A2:  B = ].r,s.] and
A3:  A misses B and
A4:  A \/ B is Interval;
A5: p < q & r < s by A1,A2,XXREAL_1:26; then
A6: inf A = p & sup A = q & inf B = r & sup B = s by A1,A2,MEASURE6:9,13;
A7: now assume A8: q < r; then
     consider x be R_eal such that
A9:   q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A9,XXREAL_1:2; then
A10:  not x in A \/ B by XBOOLE_0:def 3;
     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf A & sup(A \/ B) = sup B
       by A5,A6,A8,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A6,A9,A1,A2,XXREAL_1:26,XXREAL_0:2;
     hence contradiction by A10,A4,XXREAL_2:83;
    end;

A11: now assume A12: s < p; then
     consider x be R_eal such that
A13:   s < x & x < p & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A13,XXREAL_1:2; then
A14:  not x in A \/ B by XBOOLE_0:def 3;
     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) = inf B & sup(A \/ B) = sup A
       by A5,A6,A12,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) < x & x < sup(A \/ B) by A6,A13,A1,A2,XXREAL_1:26,XXREAL_0:2;
     hence contradiction by A14,A4,XXREAL_2:83;
    end;
    q <= r or s <= p by A1,A2,A3,Th11; then
    q = r or s = p by A7,A11,XXREAL_0:1;
    hence thesis by A1,A2,A5,XXREAL_1:170;
end;

theorem Th22:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = ].p,q.] & B = ].r,s.[ & A misses B & A \/ B is Interval
  holds q = r & A \/ B = ].p,s.[
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = ].p,q.] and
A2:  B = ].r,s.[ and
A3:  A misses B and
A4:  A \/ B is Interval;
A5: p < q & r < s by A1,A2,XXREAL_1:26,28; then
A6: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:8,9,13,12;
    now assume A7: s <= p; then
     not s in A & not s in B by A1,A2,XXREAL_1:2,4; then
A8:  not s in A \/ B by XBOOLE_0:def 3;
A9: inf B < inf A & sup B < sup A by A6,A7,A1,A2,XXREAL_1:26,28,XXREAL_0:2;
     inf(A \/ B) = min(inf A,inf B) & sup(A \/ B) = max(sup A,sup B)
       by XXREAL_2:9,10; then
     inf(A \/ B) < s & s < sup(A \/ B) by A5,A6,A9,XXREAL_0:def 9,def 10;
     hence contradiction by A8,A4,XXREAL_2:83;
    end; then
A10:q <= r by A1,A2,A3,Th12;
    now assume A11: q < r; then
     consider x be R_eal such that
A12:  q < x & x < r & x in REAL by MEASURE5:2;
     not x in A & not x in B by A1,A2,A12,XXREAL_1:2,4; then
A13: not x in A \/ B by XBOOLE_0:def 3;
     min(inf A,inf B) = inf A & max(sup A,sup B) = sup B
       by A11,A6,A5,XXREAL_0:2,def 9,def 10; then
     inf(A \/ B) = inf A & sup(A \/ B) = sup B by XXREAL_2:9,10; then
     inf(A \/ B) < x & x < sup(A \/ B)
       by A6,A12,A1,A2,XXREAL_1:26,28,XXREAL_0:2;
     hence contradiction by A13,A4,XXREAL_2:83;
    end;
    hence q = r by A10,XXREAL_0:1;
    hence A \/ B = ].p,s.[ by A1,A2,A5,XXREAL_1:171;
end;

theorem Th23:
for A,B be non empty Interval, p,q,r,s be R_eal st
 A = ].p,q.[ & B = ].r,s.[ & A misses B holds not A \/ B is Interval
proof
    let A,B be non empty Interval, p,q,r,s be R_eal;
    assume that
A1:  A = ].p,q.[ and
A2:  B = ].r,s.[ and
A3:  A misses B;
A4: p < q & r < s by A1,A2,XXREAL_1:28; then
A5: inf A = p & sup A = q & inf B = r & sup B = s
      by A1,A2,MEASURE6:8,12;
    per cases by A1,A2,A3,Th13;
    suppose A6: q <= r; then
A7:  inf A < inf B & sup A < sup B by A5,A1,A2,XXREAL_1:28,XXREAL_0:2;
     not q in A & not q in B by A1,A2,A6,XXREAL_1:4; then
A8:  not q in A \/ B by XBOOLE_0:def 3;
     now assume
A9:   A \/ B is Interval;
      inf(A \/ B) = min(inf A,inf B)
    & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10; then
      inf(A \/ B) = inf A & sup(A \/ B) = sup B
        by A6,A4,A5,XXREAL_0:2,def 9,def 10;
      hence contradiction by A8,A5,A7,A4,A9,XXREAL_2:83;
     end;
     hence not A \/ B is Interval;
    end;
    suppose A10: s <= p;
     not s in A & not s in B by A1,A2,A10,XXREAL_1:4; then
A11:  not s in A \/ B by XBOOLE_0:def 3;

A12: inf B < s & s < sup A by A5,A10,A1,A2,XXREAL_1:28,XXREAL_0:2;
     now assume
A13:   A \/ B is Interval;
      inf(A \/ B) = min(inf A,inf B)
    & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10; then
      inf(A \/ B) = inf B & sup(A \/ B) = sup A
        by A10,A4,A5,XXREAL_0:2,def 9,def 10;
      hence contradiction by A11,A12,A13,XXREAL_2:83;
     end;
     hence not A \/ B is Interval;
    end;
end;

theorem Th24:
for a,b be Real, I be Subset of R^1 st I = [.a,b.] holds I is compact
proof
    let a,b be Real, I be Subset of R^1;
    assume A1: I = [.a,b.];
    per cases;
    suppose A2: a <= b; then
     Closed-Interval-TSpace(a,b) is compact by HEINE:4; then
A3:  [#]Closed-Interval-TSpace(a,b) is compact by COMPTS_1:1;
     [#]Closed-Interval-TSpace(a,b)
      = the carrier of Closed-Interval-TSpace(a,b) by STRUCT_0:def 3; then
     I = [#]Closed-Interval-TSpace(a,b) by A1,A2,TOPMETR:18;
     hence I is compact by A3,COMPTS_1:19;
    end;
    suppose a > b; then
     [.a,b.] = {} by XXREAL_1:29;
     hence I is compact by A1;
    end;
end;

begin :: Tools for extended real sequences

definition :: ExtREAL version of RFINSEQ2:def 1
  let f be FinSequence of ExtREAL;
  func max_p f -> Nat means
  :Def1:
  (len f = 0 implies it = 0) &
  (len f > 0 implies it in dom f &
   (for i being Nat st i in dom f holds f.i <= f.it) &
    for j being Nat st j in dom f & f.j = f.it holds it <= j);
  existence
  proof
A1: dom f=Seg len f by FINSEQ_1:def 3;
    per cases;
    suppose
      len f=0;
      hence thesis;
    end;
    suppose
A2:   len f<>0;
      defpred P[Nat] means (ex n being Nat st ($1<>0
implies n<=$1 & n in dom f) & (for i being Nat st
i<=$1 & i in dom f holds f.i<=f.n) &
    (for j being Nat
      st j<=$1 & j in dom f & f.j=f.n holds n<=j));
A3:   for k being Nat st P[k] holds P[k+1]
      proof
        let k be Nat;
        assume P[k];
        then consider n1 being Nat such that
A4:     k<>0 implies n1<=k & n1 in dom f and
A5:     for i being Nat st i<=k & i in dom
        f holds f.i<=f.n1 and
A6:     for j being Nat st j<=k & j in dom f & f.j=f.n1 holds n1<=j;
        per cases;
        suppose
A7:       k=0;
A8:       dom f=Seg len f by FINSEQ_1:def 3;
A9:       for i being Nat st i<=1 & i in dom f holds f.i<=f.1
          proof
            let i be Nat;
            assume that
A10:        i<=1 and
A11:        i in dom f;
            1<=i by A11,FINSEQ_3:25;
            hence thesis by A10,XXREAL_0:1;
          end;
A13:      len f>=0+1 by A2,NAT_1:13;
          for j being Nat st j<=1 & j in dom f & f.j=f.1 holds
          1<=j by A8,FINSEQ_1:1;
          hence thesis by A7,A13,A9,A8,FINSEQ_1:1;
        end;
        suppose
A14:      k<>0;
          now
            per cases;
            case
A15:          f.n1>=f.(k+1);
A16:          for i being Nat st i<=k+1 & i in dom f holds f.i<=f.n1
              proof
                let i be Nat;
                assume that
A17:            i<=k+1 and
A18:            i in dom f;
                per cases;
                suppose
                  i<k+1;
                  then i<=k by NAT_1:13;
                  hence thesis by A5,A18;
                end;
                suppose
                  i>=k+1;
                  hence thesis by A15,A17,XXREAL_0:1;
                end;
              end;
A20:          n1<=k+1 by A4,A14,NAT_1:13;
A21:          for j being Nat st j<=k+1 & j in dom f & f.j=f.n1 holds n1<=j
              proof
                let j be Nat;
                assume that
A22:            j<=k+1 and
A23:            j in dom f & f.j=f.n1;
                now
                  per cases;
                  case
                    j<k+1;
                    then j<=k by NAT_1:13;
                    hence thesis by A6,A23;
                  end;
                  case
                    j>=k+1;
                    hence thesis by A20,A22,XXREAL_0:1;
                  end;
                end;
                hence thesis;
              end;
              k+1<>0 implies n1<=k+1 & n1 in dom f by A4,A14,NAT_1:13;
              hence thesis by A16,A21;
            end;
            case
A24:          f.n1<f.(k+1);
              now
                per cases;
                case
A25:              k+1>len f;
A26:              for j being Nat st j<=k+1 & j in dom f & f.j
                  =f.n1 holds n1<=j
                  proof
                    let j be Nat;
                    assume that
                    j<=k+1 and
A27:                j in dom f & f.j=f.n1;
                    per cases;
                    suppose
                      j<k+1;
                      then j<=k by NAT_1:13;
                      hence thesis by A6,A27;
                    end;
                    suppose
                      j>=k+1;
                      then k<j by NAT_1:13;
                      hence thesis by A4,A14,XXREAL_0:2;
                    end;
                  end;
A28:              k>=len f by A25,NAT_1:13;
A29:              for i being Nat st i<=k+1 & i in dom f holds f.i<=f.n1
                  proof
                    let i be Nat;
                    assume that
                    i<=k+1 and
A30:                i in dom f;
                    i<=len f by A1,A30,FINSEQ_1:1;
                    then i<=k by A28,XXREAL_0:2;
                    hence thesis by A5,A30;
                  end;
                  n1<=len f by A1,A4,A14,FINSEQ_1:1;
                  hence thesis by A29,A26,A4,A14,A25,XXREAL_0:2;
                end;
                case
A32:              k+1<=len f;
                  set n2=k+1;
A33:              for i being Nat st i<=k+1 & i in dom f holds f.i<=f.n2
                  proof
                    let i be Nat;
                    assume that
A34:                i<=k+1 and
A35:                i in dom f;
                    set r1=f.i;
                    per cases;
                    suppose
A38:                  i<k+1;
                      reconsider r3=f.n1 as ExtReal;
                      i<=k by A38,NAT_1:13;
                      then r1<=r3 by A5,A35;
                      hence thesis by A24,XXREAL_0:2;
                    end;
                    suppose
                      i>=k+1;
                      hence thesis by A34,XXREAL_0:1;
                    end;
                  end;
A39:              for j being Nat st j<=k+1 & j in dom f & f.j
                  =f.n2 holds n2<=j
                  proof
                    let j be Nat;
                    assume that
                    j<=k+1 and
A40:                j in dom f & f.j=f.n2;
                    per cases;
                    suppose
                      j<k+1;
                      then j<=k by NAT_1:13;
                      hence thesis by A5,A24,A40;
                    end;
                    suppose
                      j>=k+1;
                      hence thesis;
                    end;
                  end;
                  1<=1+k by NAT_1:12;
                  hence thesis by A33,A39,A1,A32,FINSEQ_1:1;
                end;
              end;
              hence thesis;
            end;
          end;
          hence thesis;
        end;
      end;
      ( for i being Nat st i<=0 & i in dom f
       holds f.i<=f.1)& for j being Nat st j<=0 & j in dom f
      & f.j=f. 1 holds 1<=j by A1,FINSEQ_1:1;
      then
A41:  P[0];
      for k being Nat holds P[k] from NAT_1:sch 2(A41,A3);
      then consider n1 being Nat such that
A42:  len f<>0 implies n1<=len f & n1 in dom f and
A43:  for i being Nat st i<=len f & i in dom f holds f.i<=f.n1 and
A44:  for j being Nat st j<=len f & j in dom f & f.j=f.n1
      holds n1<=j;
A45:  for j being Nat st j in dom f & f.j=f.n1 holds n1<=j
      proof
        let j be Nat;
        assume that
A46:    j in dom f and
A47:    f.j=f.n1;
        j<=len f by A46,FINSEQ_3:25;
        hence thesis by A44,A46,A47;
      end;
      for i being Nat st i in dom f holds f.i<=f.n1
      proof
        let i be Nat;
        assume
A48:    i in dom f;
        i<=len f by A48,FINSEQ_3:25;
        hence thesis by A43,A48;
      end;
      hence thesis by A2,A42,A45;
    end;
  end;
  uniqueness
  proof
      let m1,m2 be Nat;
      assume
A50:  ( len f=0 implies m1=0)&( len f>0 implies m1 in dom f & (for i
being Nat st i in dom f holds f.i<=f.m1) &
         for j being Nat st j in dom f & f.j=f.m1 holds m1<=j) & (
len f=0 implies m2=0)&( len f>0 implies m2 in dom f &
  (for i being Nat st i in dom f holds f.i<=f.m2) & for j
      being Nat st j in dom f & f.j=f.m2 holds m2<=j);
      then f.m2<=f.m1 & f.m1<=f.m2;
      then f.m1=f.m2 by XXREAL_0:1;
      then m1<=m2 & m2<=m1 by A50;
      hence thesis by XXREAL_0:1;
    end;
end;

definition :: ExtREAL version of RFINSEQ2:def 2
  let f be FinSequence of ExtREAL;
  func min_p f -> Nat means
  :Def2:
  (len f = 0 implies it = 0) &
  (len f > 0 implies it in dom f &
  (for i being Nat st i in dom f holds f.i >= f.it) &
   for j being Nat st j in dom f & f.j = f.it holds it <= j);
  existence
  proof
A1: dom f=Seg len f by FINSEQ_1:def 3;
    now
      per cases;
      case
        len f=0;
        hence thesis;
      end;
      case
A2:     len f<>0;
        defpred P[Nat] means (ex n being Nat st ($1<>0
implies n<=$1 & n in dom f) &
(for i being Nat st i<=$1 & i in dom f holds f.i>=f.n) & (for j being Nat
        st j<=$1 & j in dom f & f.j=f.n holds n<=j));
A3:     for k being Nat st P[k] holds P[k+1]
        proof
          let k be Nat;
          assume P[k];
          then consider n1 being Nat such that
A4:       k<>0 implies n1<=k & n1 in dom f and
A5:       for i being Nat st i<=k & i in
          dom f holds f.i>=f.n1 and
A6:       for j being Nat st j<=k & j in dom f & f.j=f.n1
          holds n1<=j;
          now
            per cases;
            case
A7:           k=0;
A8:           dom f=Seg len f by FINSEQ_1:def 3;
A9:           for i being Nat st i<=1 & i in dom f holds f.i>=f.1
              proof
                let i be Nat;
                assume
A10:            i<=1;
                assume i in dom f;
                then 1<=i by FINSEQ_3:25;
                hence thesis by A10,XXREAL_0:1;
              end;
A13:          len f>=0+1 by A2,NAT_1:13;
              for j being Nat st j<=1 & j in dom f & f.j=f.1
              holds 1<=j by A8,FINSEQ_1:1;
              hence thesis by A7,A13,A9,A8,FINSEQ_1:1;
            end;
            case
A14:          k<>0;
              now
                per cases;
                case
A15:              f.n1<=f.(k+1);
A16:              for i being Nat st i<=k+1 & i in dom f holds f.i>=f.n1
                  proof
                    let i be Nat;
                    assume that
A17:                i<=k+1 and
A18:                i in dom f;
                    per cases;
                    suppose
                      i<k+1;
                      then i<=k by NAT_1:13;
                      hence thesis by A5,A18;
                    end;
                    suppose
                      i>=k+1;
                      hence thesis by A15,A17,XXREAL_0:1;
                    end;
                  end;
A20:              n1<=k+1 by A4,A14,NAT_1:13;
A21:              for j being Nat st j<=k+1 & j in dom f & f.j
                  =f.n1 holds n1<=j
                  proof
                    let j be Nat;
                    assume that
A22:                j<=k+1 and
A23:                j in dom f & f.j=f.n1;
                    per cases;
                    suppose
                      j<k+1;
                      then j<=k by NAT_1:13;
                      hence thesis by A6,A23;
                    end;
                    suppose
                      j>=k+1;
                      hence thesis by A20,A22,XXREAL_0:1;
                    end;
                  end;
                  k+1<>0 implies n1<=k+1 & n1 in dom f by A4,A14,NAT_1:13;
                  hence thesis by A16,A21;
                end;
                case
A24:              f.n1>f.(k+1);
                  now
                    per cases;
                    case
A25:                  k+1>len f;
A26:                  for j being Nat st j<=k+1 & j in dom f &
                      f.j=f.n1 holds n1<=j
                      proof
                        let j be Nat;
                        assume that
                        j<=k+1 and
A27:                    j in dom f & f.j=f.n1;
                        per cases;
                        suppose
                          j<k+1;
                          then j<=k by NAT_1:13;
                          hence thesis by A6,A27;
                        end;
                        suppose
                          j>=k+1;
                          then k<j by NAT_1:13;
                          hence thesis by A4,A14,XXREAL_0:2;
                        end;
                      end;
A28:                  k>=len f by A25,NAT_1:13;
A29:                  for i being Nat st i<=k+1 & i in dom f holds f.i>=f.n1
                      proof
                        let i be Nat;
                        assume that
                        i<=k+1 and
A30:                    i in dom f;
                        i<=len f by A1,A30,FINSEQ_1:1;
                        then i<=k by A28,XXREAL_0:2;
                        hence thesis by A5,A30;
                      end;
                      n1<=len f by A1,A4,A14,FINSEQ_1:1;
                      hence thesis by A29,A26,A4,A14,A25,XXREAL_0:2;
                    end;
                    case
A32:                  k+1<=len f;
                      set n2=k+1;
A33:                  for i being Nat st i<=k+1 & i in dom f holds f.i>=f.n2
                      proof
                        let i be Nat;
                        assume that
A34:                    i<=k+1 and
A35:                    i in dom f;
                        set r1=f.i;
                        per cases;
                        suppose
A38:                      i<k+1;
                          reconsider r3=f.n1 as ExtReal;
                          i<=k by A38,NAT_1:13;
                          then r1>=r3 by A5,A35;
                          hence thesis by A24,XXREAL_0:2;
                        end;
                        suppose
                          i>=k+1;
                          hence thesis by A34,XXREAL_0:1;
                        end;
                      end;
A39:                  for j being Nat st j<=k+1 & j in dom f &
                      f.j=f.n2 holds n2<=j
                      proof
                        let j be Nat;
                        assume that
                        j<=k+1 and
A40:                    j in dom f & f.j=f.n2;
                        per cases;
                        suppose
                          j<k+1;
                          then j<=k by NAT_1:13;
                          hence thesis by A5,A24,A40;
                        end;
                        suppose
                          j>=k+1;
                          hence thesis;
                        end;
                      end;
                      1<=1+k by NAT_1:12;
                      hence thesis by A33,A39,A1,A32,FINSEQ_1:1;
                    end;
                  end;
                  hence thesis;
                end;
              end;
              hence thesis;
            end;
          end;
          hence thesis;
        end;
        ( for i being Nat st i<=0 & i in dom f holds f.i>=f.1)&
         for j being Nat st j<=0 & j in dom
        f & f.j=f. 1 holds 1<=j by A1,FINSEQ_1:1;
        then
A41:    P[0];
        for k being Nat holds P[k] from NAT_1:sch 2(A41,A3 );
        then consider n1 being Nat such that
A42:    len f<>0 implies n1<=len f & n1 in dom f and
A43:    for i being Nat st i<=len f & i in dom f holds f.i>=f.n1 and
A44:    for j being Nat st j<=len f & j in dom f & f.j=f.
        n1 holds n1<=j;
A45:    for j being Nat st j in dom f & f.j=f.n1 holds n1<=j
        proof
          let j be Nat;
          assume that
A46:      j in dom f and
A47:      f.j=f.n1;
          j<=len f by A46,FINSEQ_3:25;
          hence thesis by A44,A46,A47;
        end;
        for i being Nat st i in dom f holds f.i>=f.n1
        proof
          let i be Nat;
          assume
A48:      i in dom f;
          i<=len f by A48,FINSEQ_3:25;
          hence thesis by A43,A48;
        end;
        hence thesis by A2,A42,A45;
      end;
    end;
    hence thesis;
  end;
  uniqueness
  proof
      let m1,m2 be Nat;
      assume
A50:  ( len f=0 implies m1=0)&( len f>0 implies m1 in dom f & (for i
being Nat st i in dom f holds f.i
>=f.m1) & for j being Nat st j in dom f & f.j=f.m1 holds m1<=j) & (
len f=0 implies m2=0)&( len f>0 implies m2 in dom f &
   (for i being Nat st i in dom f holds f.i>=f.m2) & for j
      being Nat st j in dom f & f.j=f.m2 holds m2<=j);
      then f.m2>=f.m1 & f.m1>=f.m2;
      then f.m1=f.m2 by XXREAL_0:1;
      then m1>=m2 & m2>=m1 by A50;
      hence thesis by XXREAL_0:1;
    end;
end;

definition :: ExtREAL version of RFINSEQ2:def 3,def 4
  let f be FinSequence of ExtREAL;
  func max f -> ExtReal equals
  f.(max_p f);
  correctness;
  func min f -> ExtReal equals
  f.(min_p f);
  correctness;
end;

theorem :: ExtREAL version of RFINSEQ2:1
  for f being FinSequence of ExtREAL,i being Nat st 1<=i &
  i<=len f holds f.i<=f.(max_p f) & f.i<=max f
proof
  let f be FinSequence of ExtREAL,i be Nat;
  assume
A1: 1<=i & i<=len f;
  then
A2: i in dom f by FINSEQ_3:25;
  hence f.i<=f.(max_p f) by A1,Def1;
  thus thesis by A1,A2,Def1;
end;

theorem Th26: :: ExtREAL version of RFINSEQ2:2
  for f being FinSequence of ExtREAL,i being Nat st 1<=i &
  i<=len f holds f.i>=f.(min_p f) & f.i>=min f
proof
  let f be FinSequence of ExtREAL,i be Nat;
  assume
A1: 1<=i & i<=len f;
  then
A2: i in dom f by FINSEQ_3:25;
  hence f.i>=f.(min_p f) by A1,Def2;
  thus thesis by A1,A2,Def2;
end;

theorem Th27: :: Function version for EXCHSORT:42
for F be Function, x,y be object st x in dom F & y in dom F
 holds Swap(F,x,y) = F*Swap(id dom F,x,y)
proof
    let F be Function, x,y be object;
    assume A1: x in dom F & y in dom F;

A2: dom(Swap(F,x,y)) = dom F & dom(Swap(id dom F,x,y)) = dom(id dom F)
      by FUNCT_7:99;
    rng(Swap(id dom F,x,y)) = rng(id dom F) by FUNCT_7:103; then
A3: dom(F*Swap(id dom F,x,y)) = dom(Swap(F,x,y)) by A2,RELAT_1:27;

A4: dom(id dom F) = dom F;

    now let z be object;
     assume A5: z in dom(Swap(F,x,y));

A6:  now assume A7: z = x; then
A8:   Swap(F,x,y).z = F.y by A1,EXCHSORT:29;
      Swap(id dom F,x,y).z = (id dom F).y by A1,A4,A7,EXCHSORT:29; then
      Swap(id dom F,x,y).z = y by A1,FUNCT_1:18;
      hence Swap(F,x,y).z = (F*Swap(id dom F,x,y)).z by A1,A2,A7,A8,FUNCT_1:13;
     end;
A9:  now assume A10: z = y; then
A11:  Swap(F,x,y).z = F.x by A1,EXCHSORT:31;
      Swap(id dom F,x,y).z = (id dom F).x by A1,A4,A10,EXCHSORT:31; then
      Swap(id dom F,x,y).z = x by A1,FUNCT_1:18;
      hence Swap(F,x,y).z = (F*Swap(id dom F,x,y)).z
        by A1,A2,A10,A11,FUNCT_1:13;
     end;
     now assume A12: z <> x & z <> y; then
A13:  Swap(F,x,y).z = F.z by EXCHSORT:33;
      Swap(id dom F,x,y).z = (id dom F).z by A12,EXCHSORT:33
       .= z by A2,A5,FUNCT_1:18;
      hence Swap(F,x,y).z = (F*Swap(id dom F,x,y)).z
        by A2,A5,A13,FUNCT_1:13;
     end;
     hence Swap(F,x,y).z = (F*Swap(id dom F,x,y)).z by A6,A9;
    end;
    hence thesis by A3,FUNCT_1:def 11;
end;

theorem Th28:
for F be Function, x,y be object st x in dom F & y in dom F holds
 F,Swap(F,x,y) are_fiberwise_equipotent
proof
    let F be Function, x,y be object;
    assume A1: x in dom F & y in dom F;
A2: dom(Swap(F,x,y)) = dom F by FUNCT_7:99;
A3: dom(Swap(id dom F,x,y)) = dom(id dom F) by FUNCT_7:99;
A4: rng(Swap(id dom F,x,y)) = rng(id dom F) by FUNCT_7:103;
    Swap(F,x,y) = F*Swap(id dom F,x,y) by A1,Th27;
    hence thesis by A1,A2,A3,A4,CLASSES1:77;
end;

theorem Th29:
for X be set, F be Function, x,y be object
 st not x in X & not y in X holds F|X = Swap(F,x,y)|X
proof
    let X be set, F be Function, x,y be object;
    assume A1: not x in X & not y in X;
    dom F = dom Swap(F,x,y) by FUNCT_7:99; then
    dom(F|X) = dom Swap(F,x,y) /\ X by RELAT_1:61; then
A2: dom(F|X) = dom(Swap(F,x,y)|X) by RELAT_1:61;

    now let z be object;
     assume z in dom(F|X); then
A3:  z in X by RELAT_1:57; then
     Swap(F,x,y).z = F.z by A1,EXCHSORT:33; then
     (F|X).z = Swap(F,x,y).z by A3,FUNCT_1:49;
     hence (F|X).z = (Swap(F,x,y)|X).z by A3,FUNCT_1:49;
    end;
    hence thesis by A2,FUNCT_1:2;
end;

begin :: Open covering of intervals

REAL in bool REAL by ZFMISC_1:def 1;
then reconsider G0 = NAT --> REAL as sequence of bool REAL by FUNCOP_1:45;

Lm5: rng G0 = {REAL} by FUNCOP_1:8;

Lm6: for n being Element of NAT holds G0.n is Interval;

Lm7:
REAL is open_interval Subset of REAL
proof
   REAL = ].-infty,+infty.[ by XXREAL_1:224;
   hence thesis by MEASURE5:def 2;
end;

definition
  let A be Subset of REAL;
  mode Open_Interval_Covering of A -> Interval_Covering of A means
    :Def5:
    for n being Element of NAT holds it.n is open_interval;
  existence
  proof
   A c= union rng G0 by Lm5; then
   reconsider G0 as Interval_Covering of A by Lm6,MEASURE7:def 2;
   take G0;
   thus thesis by Lm7;
  end;
end;

Lm8:
for A be Subset of REAL holds G0 is Open_Interval_Covering of A
proof
    let A be Subset of REAL;
    A c= union rng G0 by Lm5; then
    reconsider G0 as Interval_Covering of A by Lm6,MEASURE7:def 2;
    for n be Element of NAT holds G0.n is open_interval by Lm7;
    hence thesis by Def5;
end;

definition
  let A be Subset of REAL;
  let F be Open_Interval_Covering of A;
  let n be Element of NAT;
  redefine func F.n -> open_interval Subset of REAL;  :: redefines . (FUNCT_1, definition)
  correctness by Def5;
end;

definition
 let F be sequence of bool REAL;
 mode Open_Interval_Covering of F -> Interval_Covering of F means :Def6:
  for n being Element of NAT holds it.n is Open_Interval_Covering of F.n;
   existence
   proof
    reconsider G = G0 as Element of Funcs(NAT,bool REAL) by FUNCT_2:8;
    reconsider H = NAT --> G as sequence of Funcs(NAT,bool REAL);
    for n be Element of NAT holds H.n is Interval_Covering of F.n
      by Lm8; then
    reconsider H as Interval_Covering of F by MEASURE7:def 3;
    take H;
    thus for n being Element of NAT holds H.n is Open_Interval_Covering of F.n
       by Lm8;
   end;
end;

definition
  let F be sequence of bool REAL;
  let H be Open_Interval_Covering of F;
  let n be Element of NAT;
  redefine func H.n -> Open_Interval_Covering of F.n;  :: redefines . (FUNCT_1, definition)
  correctness by Def6;
end;

definition
 let A be Subset of REAL;
 defpred P[object] means
    ex F being Open_Interval_Covering of A st $1 = vol(F);
 func Svc2(A) -> Subset of ExtREAL means :Def7:
  for x being R_eal holds x in it
   iff ex F being Open_Interval_Covering of A st x = vol(F);
  existence
  proof
    consider D being set such that
A1: for x being object holds x in D iff x in ExtREAL & P[x]
      from XBOOLE_0:sch 1;
    for z being object holds z in D implies z in ExtREAL by A1;
    then reconsider D as Subset of ExtREAL by TARSKI:def 3;
    take D;
    thus thesis by A1;
  end;
  uniqueness
  proof
    let D1,D2 be Subset of ExtREAL such that
A2: for x being R_eal holds x in D1 iff P[x] and
A3: for x being R_eal holds x in D2 iff P[x];
    thus D1 = D2 from SUBSET_1:sch 2(A2,A3);
  end;
end;

registration
  let A be Subset of REAL;
  cluster Svc2(A) -> non empty;
  coherence
  proof
    REAL c= REAL;
    then consider F0 being sequence of bool REAL such that
A1: rng F0 = {REAL,{}REAL} and
A2: F0.0 = REAL & for n being Nat st 0 < n holds F0.n = {}REAL by MEASURE1:19;
    union{REAL,{}} = REAL \/ {}
  & for n being Element of NAT holds F0.n is Interval
      by A2,NAT_1:3,ZFMISC_1:75; then
    reconsider F0 as Interval_Covering of A by A1,MEASURE7:def 2;
    for n being Element of NAT holds F0.n is open_interval
    proof
     let n be Element of NAT;
     per cases;
     suppose n = 0;
      hence F0.n is open_interval by A2,Lm7;
     end;
     suppose n <> 0;
      hence F0.n is open_interval by A2;
     end;
    end;
    then reconsider F0 as Open_Interval_Covering of A by Def5;
    defpred P[set] means ex F being Open_Interval_Covering of A st $1 = vol(F);
    consider D being set such that
A3: for x being set holds x in D iff x in ExtREAL & P[x] from XFAMILY:sch 1;
    D c= ExtREAL by A3; then
    reconsider D as Subset of ExtREAL;
    vol F0 in D by A3; then
    reconsider D as non empty Subset of ExtREAL;
    for x be R_eal holds x in D iff
     ex F be Open_Interval_Covering of A st x = vol(F) by A3;
    hence thesis by Def7;
  end;
end;

reconsider D = NAT --> {}REAL as sequence of bool REAL;

theorem Th30:
for A be Subset of REAL holds Svc2 A c= Svc A & inf Svc A <= inf Svc2 A
proof
    let A be Subset of REAL;
    now let x be R_eal;
     assume x in Svc2(A); then
     ex F be Open_Interval_Covering of A st x = vol F by Def7;
     hence x in Svc(A) by MEASURE7:def 8;
    end;
    hence Svc2 A c= Svc A;
    hence inf Svc A <= inf Svc2 A by XXREAL_2:60;
end;

theorem Th31:
for F be sequence of bool REAL, G be Open_Interval_Covering of F,
 H be sequence of [:NAT,NAT:] st rng H = [:NAT,NAT:] holds
  On(G,H) is Open_Interval_Covering of union rng F
proof
    let F be sequence of bool REAL, G be Open_Interval_Covering of F,
    H be sequence of [:NAT,NAT:];
    assume A1: rng H = [:NAT,NAT:];
    for n be Element of NAT holds On(G,H).n is open_interval
    proof
     let n be Element of NAT;
     On(G,H).n = (G.(pr1(H).n)).(pr2(H).n) by A1,MEASURE7:def 11;
     hence thesis;
    end;
    hence On(G,H) is Open_Interval_Covering of union rng F by Def5;
end;

theorem Th32:
for A be Subset of REAL, G be sequence of bool REAL st
 A c= union rng G & (for n be Element of NAT holds G.n is open_interval)
 holds G is Open_Interval_Covering of A
proof
    let A be Subset of REAL, G be sequence of bool REAL;
    assume that
A1:  A c= union rng G and
A2:  for n be Element of NAT holds G.n is open_interval;
    now let n be Element of NAT;
     G.n is open_interval by A2;
     hence G.n is Interval;
    end; then
    G is Interval_Covering of A by A1,MEASURE7:def 2;
    hence G is Open_Interval_Covering of A by A2,Def5;
end;

theorem Th33:
for F be sequence of bool REAL, G be sequence of Funcs(NAT,bool REAL) st
 (for n be Element of NAT holds G.n is Open_Interval_Covering of F.n)
 holds G is Open_Interval_Covering of F
proof
    let F be sequence of bool REAL, G be sequence of Funcs(NAT,bool REAL);
    assume
A1:  for n be Element of NAT holds G.n is Open_Interval_Covering of F.n; then
    for n be Element of NAT holds G.n is Interval_Covering of F.n; then
    G is Interval_Covering of F by MEASURE7:def 3;
    hence thesis by A1,Def6;
end;

theorem Th34:
for H being sequence of [:NAT,NAT:] st H is one-to-one & rng H = [:NAT,NAT:]
 holds for k being Nat holds
  ex m being Element of NAT st
   for F being sequence of bool REAL holds
    for G being Open_Interval_Covering of F holds
     Ser((On(G,H)) vol).k <= Ser(vol(G)).m
proof
    reconsider y = D as Element of Funcs(NAT,bool REAL) by FUNCT_2:8;
    let H be sequence of [:NAT,NAT:];
    assume that
A1:  H is one-to-one and
A2:  rng H = [:NAT,NAT:];
    defpred P[Nat] means
      ex m being Element of NAT st
        for F being sequence of bool REAL holds
          for G being Open_Interval_Covering of F holds
            Ser((On(G,H)) vol).($1) <= Ser(vol(G)).m;
A3: for k being Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     set N0 = {s where s is Element of NAT : pr1(H).(k+1) = pr1(H).s};
A4:  N0 c= NAT
     proof
      let s1 be object;
      assume s1 in N0;
      then ex s being Element of NAT st s = s1 & pr1(H).(k+1) = pr1(H).s;
      hence thesis;
     end;
     k+1 in N0;
     then reconsider N0 as non empty Subset of NAT by A4;
     given m0 being Element of NAT such that
A5:   for F being sequence of bool REAL holds
        for G being Open_Interval_Covering of F holds
          Ser((On(G,H)) vol).k <= Ser(vol(G)).m0;
      take m = m0 + pr1(H).(k+1);
      let F be sequence of bool REAL;
      let G be Open_Interval_Covering of F;
      defpred QQ1[Element of NAT,Function] means
        (($1 <> pr1(H).(k+1) implies
          for m being Element of NAT holds $2.m = (G.$1).m)
      & ($1 = pr1(H).(k+1) implies
          for m being Element of NAT holds $2.m = {}));

A6:   for n being Element of NAT holds
       ex y being Element of Funcs(NAT,bool REAL) st QQ1[n,y]
      proof
       let n be Element of NAT;
       per cases;
       suppose
A7:     n <> pr1(H).(k+1);
        reconsider y = G.n as Element of Funcs(NAT,bool REAL) by FUNCT_2:8;
        take y;
        thus thesis by A7;
       end;
       suppose
A8:     n = pr1(H).(k+1);
        take y;
        thus thesis by A8;
       end;
     end;
     consider G1 being sequence of Funcs(NAT,bool REAL) such that
A9:   for n being Element of NAT holds QQ1[n,G1.n] from FUNCT_2:sch 3(A6);
A10: for n being Element of NAT holds G1.n is Open_Interval_Covering of D.n
     proof
      let n be Element of NAT;
      consider f0 being Function such that
A11:  G1.n = f0 and
A12:  dom f0 = NAT & rng f0 c= bool REAL by FUNCT_2:def 2;
      reconsider f0 as sequence of bool REAL by A12,FUNCT_2:2;
A13:  for s being Element of NAT holds f0.s is Interval
      proof
        let s be Element of NAT;
        per cases;
        suppose
          n <> pr1(H).(k+1);
          then f0.s = (G.n).s by A9,A11;
          hence thesis;
        end;
        suppose
          n = pr1(H).(k+1);
          hence thesis by A9,A11;
        end;
      end;
      D.n c= union(rng f0);
      then reconsider f0 as Interval_Covering of D.n by A13,MEASURE7:def 2;
      for m being Element of NAT holds f0.m is open_interval
      proof
       let m be Element of NAT;
       per cases;
       suppose n <> pr1(H).(k+1); then
        f0.m = (G.n).m by A9,A11;
        hence f0.m is open_interval;
       end;
       suppose n = pr1(H).(k+1);
        hence f0.m is open_interval by A9,A11;
       end;
      end;
      then reconsider f0 as Open_Interval_Covering of D.n by Def5;
      G1.n = f0 by A11;
      hence thesis;
     end;

     defpred SSS[Element of N0,Element of NAT] means $2 = pr2(H).$1;

     defpred QQ0[Element of NAT,Function] means
       (($1 = pr1(H).(k+1) implies
         for m being Element of NAT holds $2.m = (G.$1).m)
      & ($1 <> pr1(H).(k+1) implies
         for m being Element of NAT holds $2.m = {}));

A14: for n being Element of NAT holds
       ex y being Element of Funcs(NAT,bool REAL) st QQ0[n,y]
     proof
      let n be Element of NAT;
      per cases;
      suppose
A15:   n = pr1(H).(k+1);
       reconsider y = G.n as Element of Funcs(NAT,bool REAL) by FUNCT_2:8;
       take y;
       thus thesis by A15;
      end;
      suppose
A16:   n <> pr1(H).(k+1);
       take y;
       thus thesis by A16;
      end;
     end;
     consider G0 being sequence of Funcs(NAT,bool REAL) such that
A17:  for n being Element of NAT holds QQ0[n,G0.n] from FUNCT_2:sch 3(A14);

     for n being Element of NAT holds G0.n is Interval_Covering of D.n
     proof
      let n be Element of NAT;
      consider f0 being Function such that
A18:  G0.n = f0 and
A19:  dom f0 = NAT & rng f0 c= bool REAL by FUNCT_2:def 2;
      reconsider f0 as sequence of bool REAL by A19,FUNCT_2:2;
A20:  for s being Element of NAT holds f0.s is Interval
      proof
        let s be Element of NAT;
        per cases;
        suppose
          n = pr1(H).(k+1);
          then f0.s = (G.n).s by A17,A18;
          hence thesis;
        end;
        suppose
          n <> pr1(H).(k+1);
          hence thesis by A17,A18;
        end;
      end;
      D.n c= union(rng f0);
      then reconsider f0 as Interval_Covering of D.n by A20,MEASURE7:def 2;

      for s being Element of NAT holds f0.s is open_interval
      proof
       let s be Element of NAT;
       per cases;
       suppose
        n = pr1(H).(k+1);
        then f0.s = (G.n).s by A17,A18;
        hence thesis;
       end;
       suppose
        n <> pr1(H).(k+1);
        hence thesis by A17,A18;
       end;
      end;
      then reconsider f0 as Open_Interval_Covering of D.n by Def5;
      G0.n = f0 by A18;
      hence thesis;
     end;
     then reconsider G0 as Interval_Covering of D by MEASURE7:def 3;

     for n being Element of NAT holds G0.n is Open_Interval_Covering of D.n
     proof
      let n be Element of NAT;
      per cases;
      suppose A21: n = pr1(H).(k+1);
       for m be Element of NAT holds (G0.n).m is open_interval
       proof
        let m be Element of NAT;
        (G0.n).m = (G.n).m by A21,A17;
        hence thesis;
       end;
       hence G0.n is Open_Interval_Covering of D.n by Def5;
      end;
      suppose  n <> pr1(H).(k+1); then
       for m be Element of NAT holds (G0.n).m is open_interval by A17;
       hence G0.n is Open_Interval_Covering of D.n by Def5;
      end;
     end;
     then reconsider G0 as Open_Interval_Covering of D by Def6;

     set GG0 = On(G0,H);
     reconsider G1 as Open_Interval_Covering of D by A10,Th33;
     set GG1 = On(G1,H);
A22: (Ser(GG0 vol)).(k+1) <= SUM(GG0 vol) by MEASURE7:6,12;
     GG1.(k+1) = (G1.(pr1(H).(k+1))).(pr2(H).(k+1)) by A2,MEASURE7:def 11
      .= {} by A9;
     then
A23: (GG1 vol).(k+1) = 0. by MEASURE7:def 4,MEASURE5:10;
     (Ser (GG1 vol)).(k+1) = (Ser (GG1 vol)).k + (GG1 vol).(k+1)
       by SUPINF_2:def 11;
     then
A24: (Ser (GG1 vol)).(k+1) = (Ser (GG1 vol)).k by A23,XXREAL_3:4;
     for s being Element of NAT holds 0. <= (vol(G1)).s by MEASURE7:13;
     then vol(G1) is nonnegative by SUPINF_2:39;
     then
A25: (Ser vol(G1)).m0 <= (Ser vol(G1)).m by SUPINF_2:41;
A26: for n being Element of NAT holds
       ((On(G,H)) vol).n = (GG0 vol).n + (GG1 vol). n
     proof
      let n be Element of NAT;
A27:  (GG0 vol).n = diameter(GG0.n)
    & (GG1 vol).n = diameter(GG1.n) by MEASURE7:def 4;
      ((On(G,H)) vol).n = diameter((On(G,H)).n) by MEASURE7:def 4;
      then
A28:  ((On(G,H)) vol).n = diameter((G.(pr1(H).n)).(pr2(H).n))
        by A2,MEASURE7:def 11;
      per cases;
      suppose
A29:   pr1(H).n = pr1(H).(k+1);
A30:   GG1.n = (G1.(pr1(H).n)).(pr2(H).n) by A2,MEASURE7:def 11
          .= {} by A9,A29;
       GG0.n = (G0.(pr1(H).n)).(pr2(H).n) by A2,MEASURE7:def 11
          .= (G.(pr1(H).n)).(pr2(H).n) by A17,A29;
       hence thesis by A27,A28,A30,MEASURE5:10,XXREAL_3:4;
      end;
      suppose
A31:   pr1(H).n <> pr1(H).(k+1);
A32:   GG0.n = (G0.(pr1(H).n)).(pr2(H).n) by A2,MEASURE7:def 11
          .= {} by A17,A31;
       GG1.n = (G1.(pr1(H).n)).(pr2(H).n) by A2,MEASURE7:def 11
          .= (G.(pr1(H).n)).(pr2(H).n) by A9,A31;
       hence thesis by A27,A28,A32,MEASURE5:10,XXREAL_3:4;
      end;
     end;
     GG0 vol is nonnegative & GG1 vol is nonnegative by MEASURE7:12;
     then
A33: (Ser (On(G,H) vol)).(k+1)
       = (Ser (GG0 vol)).(k+1) + (Ser (GG1 vol)).(k+1) by A26,MEASURE7:3;
     for s being Element of NAT holds 0. <= (vol(G1)).s by MEASURE7:13;
     then
A34: vol(G1) is nonnegative by SUPINF_2:39;
     (Ser(GG1 vol)).k <= (Ser vol(G1)).m0 by A5;
     then
A35: (Ser (GG1 vol)).(k+1) <= (Ser vol(G1)).m by A24,A25,XXREAL_0:2;
A36: for s being Element of N0 holds ex y being Element of NAT st SSS[s,y];

     consider SOS being Function of N0,NAT such that
A37:  for s being Element of N0 holds SSS[s,SOS.s] from FUNCT_2:sch 3(A36);
A38: for n being Element of NAT holds (vol(G)).n = (vol(G0)).n + (vol(G1)) .n
     proof
      let n be Element of NAT;
A39:  vol(G.n) = vol(G0.n) + vol(G1.n)
      proof
       per cases;
       suppose
A40:    n = pr1(H).(k+1);
        for s being Element of NAT holds ((G.n) vol).s <= ((G0.n) vol). s
        proof
         let s be Element of NAT;
         ((G0.n) vol).s = diameter((G0.n).s) by MEASURE7:def 4
              .= diameter((G.n).s) by A17,A40
              .= ((G.n) vol).s by MEASURE7:def 4;
         hence thesis;
        end;
        then
A41:    SUM((G.n) vol) <= SUM((G0.n) vol) by SUPINF_2:43;
        for s being Element of NAT holds ((G1.n) vol).s = 0.
        proof
         let s be Element of NAT;
         diameter((G1.n).s) = 0. by A9,A40,MEASURE5:10;
         hence thesis by MEASURE7:def 4;
        end;
        then
A42:    SUM((G1.n) vol) = 0. by MEASURE7:1;
        for s being Element of NAT holds ((G0.n) vol).s <= ((G.n) vol). s
        proof
         let s be Element of NAT;
         ((G0.n) vol).s = diameter((G0.n).s) by MEASURE7:def 4
              .= diameter((G.n).s) by A17,A40
              .= ((G.n) vol).s by MEASURE7:def 4;
         hence thesis;
        end;
        then SUM((G0.n) vol) <= SUM((G.n) vol) by SUPINF_2:43;
        then SUM((G.n) vol) = SUM((G0.n) vol) by A41,XXREAL_0:1;
        then vol(G.n) = SUM((G0.n) vol) by MEASURE7:def 6;
        then vol(G.n) = vol(G0.n) by MEASURE7:def 6;
        then vol(G.n) = vol(G0.n) + SUM((G1.n) vol) by A42,XXREAL_3:4;
        hence vol(G.n) = vol(G0.n) + vol(G1.n) by MEASURE7:def 6;
       end;
       suppose
A43:    n <> pr1(H).(k+1);
A44:    for s being Element of NAT holds ((G1.n) vol).s = ((G.n) vol).s
        proof
         let s be Element of NAT;
         ((G1.n) vol).s = diameter((G1.n).s)
       & ((G.n) vol).s = diameter((G.n).s) by MEASURE7:def 4;
         hence thesis by A9,A43;
        end;
        then
        for s being Element of NAT holds ((G.n) vol).s <= ((G1.n) vol). s;
        then
A45:    SUM((G.n) vol) <= SUM((G1.n) vol) by SUPINF_2:43;
        for s being Element of NAT holds ((G0.n) vol).s = 0.
        proof
         let s be Element of NAT;
         diameter((G0.n).s) = 0. by A17,A43,MEASURE5:10;
         hence thesis by MEASURE7:def 4;
        end;
        then
A46:    SUM((G0.n) vol) = 0. by MEASURE7:1;
        for s being Element of NAT holds
          ((G1.n) vol).s <= ((G.n) vol).s by A44;
        then SUM((G1.n) vol) <= SUM((G.n) vol) by SUPINF_2:43;
        then SUM((G.n) vol) = SUM((G1.n) vol) by A45,XXREAL_0:1;
        then vol(G.n) = SUM((G1.n) vol) by MEASURE7:def 6;
        then vol(G.n) = vol(G1.n) by MEASURE7:def 6;
        then vol(G.n) = SUM((G0.n) vol) + vol(G1.n) by A46,XXREAL_3:4;
        hence vol(G.n) = vol(G0.n) + vol(G1.n)
          by MEASURE7:def 6;
       end;
      end;
      (vol(G)).n = vol(G.n) & (vol(G0)).n = vol(G0.n) by MEASURE7:def 7;
      hence thesis by A39,MEASURE7:def 7;
     end;
     for s being Element of NAT holds 0. <= (vol(G0)).s by MEASURE7:13;
     then vol(G0) is nonnegative by SUPINF_2:39;
     then
A47: (vol(G0)).(pr1(H).(k+1)) <= (Ser(vol(G0))).(pr1(H).(k+1 ))
   & (Ser vol(G0)).( pr1(H).(k+1)) <= (Ser vol(G0)).m
       by MEASURE7:2,SUPINF_2:41;
A48: for s being Element of NAT holds
       (s in N0 implies (GG0 vol).s = ((G0.(pr1(H).(k+1)) vol)*SOS).s)
     & (not s in N0 implies (GG0 vol).s = 0.)
     proof
      let s be Element of NAT;
      thus s in N0 implies (GG0 vol).s = ((G0.(pr1(H).(k+1)) vol)*SOS).s
      proof
       assume
A49:   s in N0;
       then
A50:   ex s1 being Element of NAT st s1 = s & pr1(H).(k+1) = pr1(H).s1;
A51:   pr2(H).s =SOS.s by A37,A49;
       (GG0 vol).s = diameter(GG0.s) by MEASURE7:def 4
        .= diameter((G0.(pr1(H).(k+1))).(pr2(H).s)) by A2,A50,MEASURE7:def 11
        .= (G0.(pr1(H).(k+1)) vol).(SOS.s) by A51,MEASURE7:def 4
        .= ((G0.(pr1(H).(k+1)) vol)*SOS).s by A49,FUNCT_2:15;
       hence thesis;
      end;
      assume not s in N0;
      then
A52:  not pr1(H).(k+1) = pr1(H).s;
      (GG0 vol).s = diameter(GG0.s) by MEASURE7:def 4
        .= diameter((G0.(pr1(H).s)).(pr2(H).s)) by A2,MEASURE7:def 11
        .= 0. by A17,A52,MEASURE5:10;
      hence thesis;
     end;
     for s1,s2 being object st s1 in N0 & s2 in N0 & SOS.s1 = SOS.s2
       holds s1 = s2
     proof
      let s1,s2 be object;
      assume that
A53:  s1 in N0 & s2 in N0 and
A54:  SOS.s1 = SOS.s2;
      reconsider s1,s2 as Element of NAT by A53;
A55:  (ex s11 being Element of NAT st s11 = s1 & pr1(H).(k+1) = pr1(H).s11 )
     & ex s22 being Element of NAT st s22 = s2 & pr1(H).(k+1) = pr1(H).s22
        by A53;
A56:  H.s1 = [pr1(H).s1,pr2(H).s1]
    & H.s2 = [pr1(H).s2,pr2(H).s2] by FUNCT_2:119;
      SOS.s1 = pr2(H).s1 & SOS.s2 = pr2(H).s2 by A37,A53;
      hence thesis by A1,A54,A55,A56,FUNCT_2:19;
     end;
     then SOS is one-to-one by FUNCT_2:19;
     then SUM(GG0 vol) <= SUM(G0.(pr1(H).(k+1)) vol) by A48,MEASURE7:11,12;
     then
A57: (Ser(GG0 vol)).(k+1) <= SUM(G0.(pr1(H).(k+1)) vol) by A22,XXREAL_0:2;
     SUM(G0.(pr1(H).(k+1)) vol) = vol(G0.(pr1(H).(k+1))) by MEASURE7:def 6
      .= (vol(G0)).(pr1(H).(k+1)) by MEASURE7:def 7;
     then SUM(G0.(pr1(H).(k+1)) vol) <= (Ser vol(G0)).m by A47,XXREAL_0:2;
     then
A58: (Ser (GG0 vol)).(k+1) <= (Ser vol(G0)).m by A57,XXREAL_0:2;
     for s being Element of NAT holds 0. <= (vol(G0)).s by MEASURE7:13;
     then vol(G0) is nonnegative by SUPINF_2:39;
     then (Ser vol(G)).m = (Ser vol(G0)).m + (Ser vol(G1)).m
       by A38,A34,MEASURE7:3;
     hence thesis by A58,A35,A33,XXREAL_3:36;
    end;

A59:P[0]
    proof
     take m = pr1(H).0;
     let F be sequence of bool REAL;
     let G be Open_Interval_Covering of F;
     reconsider GG = On(G,H) as Open_Interval_Covering of union rng F
       by A2,Th31;

     (GG vol).0 = diameter(GG.0)
   & ((G.(pr1(H).0)) vol).(pr2(H).0) = diameter((G. (pr1(H).0)).(pr2(H).0))
        by MEASURE7:def 4; then
     (GG vol).0 <= ((G.(pr1(H).0)) vol).(pr2(H).0) by A2,MEASURE7:def 11; then
     (GG vol).0 <= SUM((G.(pr1(H).0)) vol) by MEASURE7:12,MEASURE6:3; then
     (GG vol).0 <= vol(G.(pr1(H).0)) by MEASURE7:def 6;
     then
A60: Ser(GG vol).0 = (GG vol).0
   & (GG vol).0 <= (vol(G)).(pr1(H).0) by MEASURE7:def 7,SUPINF_2:def 11;
     for n being Element of NAT holds 0. <= (vol(G)).n by MEASURE7:13;
     then vol(G) is nonnegative by SUPINF_2:39;
     then (vol(G)).m <= Ser(vol(G)).m by MEASURE7:2;
     hence thesis by A60,XXREAL_0:2;
    end;
    thus for k being Nat holds P[k] from NAT_1:sch 2(A59,A3);
end;

theorem
  for F being sequence of bool REAL holds
  for G being Open_Interval_Covering of F
  holds inf Svc2(union rng F) <= SUM(vol(G))
proof
  let F be sequence of bool REAL;
  let G be Open_Interval_Covering of F;
  consider H being sequence of [:NAT,NAT:] such that
A1: H is one-to-one and
  dom H = NAT and
A2: rng H = [:NAT,NAT:] by MEASURE6:1;
  set GG = On(G,H);

A3: for x being ExtReal st x in rng Ser(GG vol) ex y being ExtReal
 st y in rng Ser(vol(G)) & x <= y
  proof
    let x be ExtReal;
    assume x in rng Ser(GG vol);
    then consider n being object such that
A4: n in dom Ser(GG vol) and
A5: x = Ser(GG vol).n by FUNCT_1:def 3;
    reconsider n as Element of NAT by A4;
    consider m being Element of NAT such that
A6: for F being sequence of bool REAL holds
     for G be Open_Interval_Covering of F holds
       Ser((On(G,H)) vol).n <= Ser(vol(G)).m by A1,A2,Th34;
    take Ser(vol(G)).m;
    dom Ser(vol(G)) = NAT by FUNCT_2:def 1;
    hence thesis by A5,A6,FUNCT_1:def 3;
  end;
  reconsider GG as Open_Interval_Covering of union rng F by A2,Th31;
  set Q = vol(GG);
  Q in Svc2(union rng F) by Def7; then
A7: inf Svc2(union rng F) <= Q by XXREAL_2:3;
  SUM(GG vol) <= SUM(vol G) by A3,XXREAL_2:63; then
  vol(GG) <= SUM(vol(G)) by MEASURE7:def 6;
  hence inf Svc2(union rng F) <= SUM(vol(G)) by A7,XXREAL_0:2;
end;

definition
  let F be non empty Subset-Family of REAL;
  redefine mode Element of F -> Subset of REAL;  :: redefines Element (SUBSET_1, definition)
  coherence
  proof
    let x be Element of F;
    thus x is Subset of REAL;
  end;
end;

Lm9:
for a1,b1 be Real, a2,b2 be R_eal st
 a1=a2 & b1=b2 holds a1-b1 = a2-b2
proof
    let a1,b1 be Real, a2, b2 be R_eal;
    assume A1: a1=a2 & b1=b2;
    a2-b2 = a2+(-b2) by XXREAL_3:def 4
     .= a2+(-b1) by A1,XXREAL_3:def 3
     .= a1+(-b1) by A1,XXREAL_3:def 2;
    hence thesis;
end;

theorem Th36:
for A being Element of Family_of_Intervals st A is open_interval holds
 ex F being Open_Interval_Covering of A st F.0 = A &
  (for n being Nat st n <> 0 holds F.n = {}) & union rng F = A
  & SUM(F vol) = diameter A
proof
    let A be Element of Family_of_Intervals;
    assume A1: A is open_interval;
    defpred P[Nat,set] means
     ($1 = 0 implies $2 = A) & ($1 <> 0 implies $2 = {}REAL);

A2: for n being Element of NAT ex E being Element of bool REAL st P[n,E]
    proof
     let n be Element of NAT;
     per cases;
     suppose A3: n = 0;
      take E = A;
      thus P[n,E] by A3;
     end;
     suppose A4: n <> 0;
      take E = {}REAL;
      thus P[n,E] by A4;
     end;
    end;
    consider F be Function of NAT,(bool REAL) such that
A5:  for n being Element of NAT holds P[n,F.n] from FUNCT_2:sch 3(A2);
    reconsider F as sequence of (bool REAL);
    0 in NAT; then
    0 in dom F & F.0 = A by A5,FUNCT_2:def 1; then
    A in rng F by FUNCT_1:def 3; then
A6: A c= union rng F by ZFMISC_1:74;

    now let z be object;
     assume z in union rng F; then
     consider Y be set such that
A7:   z in Y & Y in rng F by TARSKI:def 4;
     ex n be object st n in dom F & Y = F.n by A7,FUNCT_1:def 3;
     hence z in A by A7,A5;
    end; then
A8:union rng F c= A;
A9: for n be Element of NAT holds F.n is open_interval by A1,A5;
    reconsider F as Open_Interval_Covering of A by A6,A9,Th32;
    take F;
    thus F.0 = A by A5;
    thus for n being Nat st n <> 0 holds F.n = {}
    proof
     let n be Nat;
     assume A10: n <> 0;
     n is Element of NAT by ORDINAL1:def 12;
     hence F.n = {} by A5,A10;
    end;
    thus union rng F = A by A8,A6,XBOOLE_0:def 10;

    for n being object holds 0 <= (F vol).n
    proof
     let n be object;
     per cases;
     suppose n in NAT; then
      reconsider n1 = n as Element of NAT;
      (F vol).n = diameter(F.n1) by MEASURE7:def 4;
      hence 0 <= (F vol).n by MEASURE5:13;
     end;
     suppose not n in NAT; then
      not n in dom(F vol);
      hence 0 <= (F vol).n by FUNCT_1:def 2;
     end;
    end; then
A11: F vol is nonnegative by SUPINF_2:51;
    defpred P[Nat] means (Partial_Sums(F vol)).$1 = diameter A;
    (Partial_Sums(F vol)).0 = (F vol).0 by MESFUNC9:def 1; then
    (Partial_Sums(F vol)).0 = diameter(F.0) by MEASURE7:def 4; then
A12:P[0] by A5;
A13:for n be Nat st P[n] holds P[n+1]
    proof
     let n be Nat;
     assume A14: P[n];
A15: (Partial_Sums(F vol)).(n+1) = (Partial_Sums(F vol)).n + (F vol).(n+1)
       by MESFUNC9:def 1;
     (F vol).(n+1) = diameter(F.(n+1)) by MEASURE7:def 4;then
     (F vol).(n+1) = diameter {} by A5;
     hence P[n+1] by A14,A15,XXREAL_3:4,MEASURE5:10;
    end;

A16: for n be Nat holds P[n] from NAT_1:sch 2(A12,A13);

    thus SUM(F vol) = diameter A
    proof
     SUM(F vol) = Sum(F vol) by A11,MEASURE8:2; then
A17:  SUM(F vol) = lim Partial_Sums(F vol) by MESFUNC9:def 3;

     per cases;
     suppose A18: diameter A = +infty; then
   for n be Element of NAT holds +infty <= (Partial_Sums(F vol)).n
        by A16; then
      Partial_Sums(F vol) is convergent_to_+infty by RINFSUP2:32;
      hence SUM(F vol) = diameter A by A17,A18,MESFUNC5:def 12;
     end;
     suppose A19: diameter A <> +infty;
      0 <= diameter A by A1,MEASURE5:13; then
      diameter A in REAL by A19,XXREAL_0:14;
      hence SUM(F vol) = diameter A by A16,A17,MESFUNC5:52;
     end;
    end;
end;

theorem Th37:
for A,B be Subset of REAL, F be Interval_Covering of A st B c= A holds
 F is Interval_Covering of B
proof
    let A,B be Subset of REAL, F be Interval_Covering of A;
    assume
A1:  B c= A;
A2: A c= union rng F & for n be Element of NAT holds F.n is Interval
      by MEASURE7:def 2; then
    B c= union rng F by A1;
    hence F is Interval_Covering of B by A2,MEASURE7:def 2;
end;

theorem Th38:
for A,B be Subset of REAL, F be Open_Interval_Covering of A st B c= A holds
 F is Open_Interval_Covering of B
proof
    let A,B be Subset of REAL, F be Open_Interval_Covering of A;
    assume B c= A; then
A1: F is Interval_Covering of B by Th37;
    for n be Element of NAT holds F.n is open_interval;
    hence F is Open_Interval_Covering of B by A1,Def5;
end;

theorem Th39:
for A,B be Subset of REAL, F be Interval_Covering of A,
 G be Interval_Covering of B st F = G holds F vol = G vol
proof
    let A,B be Subset of REAL, F be Interval_Covering of A,
    G be Interval_Covering of B;
    assume
A1:  F = G;
    for n be Element of NAT holds (F vol).n = (G vol).n
    proof
     let n be Element of NAT;
     (F vol).n = diameter(F.n) by MEASURE7:def 4;
     hence (F vol).n = (G vol).n by A1,MEASURE7:def 4;
    end;
    hence F vol = G vol by FUNCT_2:def 8;
end;

theorem Th40:
for F be FinSequence of bool REAL,k be Nat st
  (for n be Nat st n in dom F holds F.n is open_interval Subset of REAL)
& (for n be Nat st 1 <= n < len F holds union rng(F|n) meets F.(n+1))
holds union rng(F|k) is open_interval Subset of REAL
proof
    let F be FinSequence of bool REAL,k be Nat;
    assume that
A1:  for n be Nat st n in dom F holds F.n is open_interval Subset of REAL and
A2:  for n be Nat st 1 <= n < len F holds union rng(F|n) meets F.(n+1);

A3: now let k be Nat;
     assume k = 0; then
     union rng(F|k) = {} by ZFMISC_1:2;
     hence union rng(F|k) is open_interval Subset of REAL;
    end;

    defpred P[Nat] means union rng(F|$1) is open_interval Subset of REAL;
A4: P[0] by A3;
A5: for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume A6: P[k];
     per cases;
     suppose A7: 1 <= k+1 <= len F; then
A8:   k < len F by NAT_1:13;
A9:   1 <= len F by A7,XXREAL_0:2;
A10:  F.(k+1) is open_interval Subset of REAL by A1,A7,FINSEQ_3:25;
A11:  F <> {} by A7;

      per cases;
      suppose k = 0; then
       F|(k+1) = <*F.1*> by A11,FINSEQ_5:20; then
       rng(F|(k+1)) = {F.1} by FINSEQ_1:38;
       hence union rng(F|(k+1)) is open_interval Subset of REAL
         by A1,A9,FINSEQ_3:25;
      end;
      suppose k <> 0; then
A12:   1 <= k by NAT_1:14;
       F|(k+1) = F|k ^ <*F.(k+1)*> by A7,NAT_1:13,FINSEQ_5:83; then
       rng(F|(k+1)) = rng(F|k) \/ rng <*F.(k+1)*> by FINSEQ_1:31
        .= rng(F|k) \/ {F.(k+1)} by FINSEQ_1:38; then
       union rng(F|(k+1)) = union rng(F|k) \/ union {F.(k+1)} by ZFMISC_1:78;
       hence union rng(F|(k+1)) is open_interval Subset of REAL
         by A12,A2,A6,A8,A10,Th2;
      end;
     end;
     suppose k+1 < 1 or len F < k+1; then
      k+1 = 0 or (F|(k+1) = F & len F <= k) by NAT_1:13,14,FINSEQ_1:58;
      hence union rng(F|(k+1)) is open_interval Subset of REAL
        by A6,FINSEQ_1:58;
     end;
    end;

    for k be Nat holds P[k] from NAT_1:sch 2(A4,A5);
    hence union rng(F|k) is open_interval Subset of REAL;
end;

theorem Th41:
for A be non empty closed_interval Subset of REAL,
 F be FinSequence of bool REAL
 st A c= union rng F
  & (for n be Nat st n in dom F holds A meets F.n)
  & (for n be Nat st n in dom F holds F.n is open_interval Subset of REAL)
ex G be FinSequence of bool REAL
 st F,G are_fiberwise_equipotent
  & (for n be Nat st 1 <= n < len G holds union rng(G|n) meets G.(n+1))
proof
    let A be non empty closed_interval Subset of REAL,
    F be FinSequence of bool REAL;
    assume that
A1:  A c= union rng F and
A2:  for n be Nat st n in dom F holds A meets F.n and
A3:  for n be Nat st n in dom F holds F.n is open_interval Subset of REAL;
    defpred P[Nat] means
     $1 <= len F implies
     ex G be FinSequence of bool REAL st
      F,G are_fiberwise_equipotent
    & (for n be Nat st 1 <= n < $1 holds union rng(G|n) meets G.(n+1));
    union rng F <> {} by A1; then
A4: F <> {} by ZFMISC_1:2;
    for n be Nat st 1 <= n < 1 holds union rng(F|n) meets F.(n+1); then
A5: P[1];

A6: for k be non zero Nat st P[k] holds P[k+1]
    proof
     let k be non zero Nat;
     assume A7: P[k];
     assume A8: k+1 <= len F; then
A9:  k < len F by NAT_1:13;
     consider G be FinSequence of bool REAL such that
A10:  F,G are_fiberwise_equipotent and
A11:  for n be Nat st 1 <= n < k holds union rng(G|n) meets G.(n+1)
        by A7,A8,NAT_1:13;

     set G1=G|k;
A12: rng F = rng G by A10,CLASSES1:75;
A13: len F = len G by A10,RFINSEQ:3; then
A14: len G1 = k by A9,FINSEQ_1:59;

     rng G1 = rng (G|Seg k) by FINSEQ_1:def 16; then
A15: rng G1 c= rng G by RELAT_1:70;

A16: for n be Nat st n in dom G1 holds G1.n is open_interval Subset of REAL
     proof
      let n be Nat;
      assume n in dom G1; then
      G1.n in rng G by A15,FUNCT_1:3; then
      ex m be Element of NAT st m in dom F & G1.n = F.m by A12,PARTFUN1:3;
      hence G1.n is open_interval Subset of REAL by A3;
     end;

A17: for n be Nat st 1 <= n < len G1 holds union rng(G1|n) meets G1.(n+1)
     proof
      let n be Nat;
      assume A18: 1 <= n < len G1; then
      n+1 <= len G1 by NAT_1:13; then
      G1.(n+1) = G.(n+1) & G1|n = G|n by A14,A18,FINSEQ_3:112,FINSEQ_1:82;
      hence union rng(G1|n) meets G1.(n+1) by A11,A14,A18;
     end;

     now assume
A19:  for m be Nat st m > k holds union rng(G|k) misses G.m;
      union rng(G1|(len G1)) is open_interval Subset of REAL
        by A16,A17,Th40; then
      union rng(G|k) is open_interval Subset of REAL by FINSEQ_1:58; then
      consider x,y be R_eal such that
A20:   union rng(G|k) = ].x,y.[ by MEASURE5:def 2;
      consider a1,a2 be Real such that
A21:   a1 <= a2 & A = [.a1,a2.] by MEASURE5:14;

A22:  G1.1 = G.1 by NAT_1:14,FINSEQ_3:112;
      1 <= len F by A4,FINSEQ_1:20; then
      1 in dom G by A13,FINSEQ_3:25; then
      ex m be Element of NAT st m in dom F & G1.1 = F.m
        by A12,A22,FUNCT_1:3,PARTFUN1:3; then
A23:  A meets G1.1 by A2;
      1 <= k by NAT_1:14; then
      1 in dom G1 by A14,FINSEQ_3:25; then
      G1.1 in rng G1 by FUNCT_1:3; then
A24:  A meets union rng(G|k) by A23,XBOOLE_1:63,ZFMISC_1:74; then
A25:  x < a2 & a1 < y by A20,A21,XXREAL_1:89,93;
A26:  union rng(G|k) <> {} by A24,XBOOLE_1:65; then
A27:  x < y by A20,XXREAL_1:28;
      per cases;
      suppose a1 <= x; then
       x in A by A21,A25,XXREAL_1:1; then
       consider P be set such that
A28:    x in P & P in rng F by A1,TARSKI:def 4;
       consider m be Element of NAT such that
A29:    m in dom G & P = G.m by A12,A28,PARTFUN1:3;
       ex i be Element of NAT st
        i in dom F & P = F.i by A28,PARTFUN1:3; then
       G.m is open_interval Subset of REAL by A3,A29; then
       consider p,q be R_eal such that
A30:    G.m = ].p,q.[ by MEASURE5:def 2;
A31:   p < x & x < q by A28,A29,A30,XXREAL_1:4;
A32:   not x in union rng(G|k) by A20,XXREAL_1:4;
A33:   now assume A34: m <= k; then
A35:    G.m = G1.m by FINSEQ_3:112;
        1 <= m by A29,FINSEQ_3:25; then
        m in dom G1 by A14,A34,FINSEQ_3:25; then
        P in rng G1 by A29,A35,FUNCT_1:3;
        hence contradiction by A28,A32,TARSKI:def 4;
       end;
       per cases;
       suppose q <= y; then
        max(x,p) = x & min(y,q) = q by A31,XXREAL_0:def 9,def 10; then
        union rng(G|k) /\ G.m = ].x,q.[ by A20,A30,XXREAL_1:142; then
        union rng(G|k) /\ G.m <> {} by A31,XXREAL_1:33;
        hence contradiction by A19,A33,XBOOLE_0:def 7;
       end;
       suppose q > y; then
        max(x,p) = x & min(y,q) = y by A31,XXREAL_0:def 9,def 10; then
        union rng(G|k) /\ G.m = ].x,y.[ by A20,A30,XXREAL_1:142;
        hence contradiction by A19,A20,A26,A33,XBOOLE_0:def 7;
       end;
      end;

      suppose x < a1 & y <= a2; then
       y in A by A21,A25,XXREAL_1:1; then
       consider P be set such that
A36:    y in P & P in rng F by A1,TARSKI:def 4;
       consider m be Element of NAT such that
A37:    m in dom G & P = G.m by A12,A36,PARTFUN1:3;
       ex i be Element of NAT st
        i in dom F & P = F.i by A36,PARTFUN1:3; then
       G.m is open_interval Subset of REAL by A3,A37; then
       consider p,q be R_eal such that
A38:    G.m = ].p,q.[ by MEASURE5:def 2;

A39:   not y in union rng(G|k) by A20,XXREAL_1:4;
A40:   now assume A41: m <= k; then
A42:    G.m = G1.m by FINSEQ_3:112;
        1 <= m by A37,FINSEQ_3:25; then
        m in dom G1 by A14,A41,FINSEQ_3:25; then
        P in rng G1 by A37,A42,FUNCT_1:3;
        hence contradiction by A36,A39,TARSKI:def 4;
       end;
A43:   p < y & y < q by A36,A37,A38,XXREAL_1:4; then
       min(y,q) = y by XXREAL_0:def 9; then
       union rng(G|k) /\ G.m = ].max(x,p),y.[ by A20,A38,XXREAL_1:142; then
       union rng(G|k) /\ G.m <> {} by A27,A43,XXREAL_0:29,XXREAL_1:33;
       hence contradiction by A19,A40,XBOOLE_0:def 7;
      end;
      suppose x < a1 & a2 < y; then
A44:   A c= union rng(G|k) by A20,A21,XXREAL_1:47;
       k+1 in dom G by A8,A13,FINSEQ_3:25,NAT_1:11; then
       ex m be Element of NAT st m in dom F & G.(k+1) = F.m
         by A12,FUNCT_1:3,PARTFUN1:3; then
       A meets G.(k+1) by A2; then
A45:   union rng(G|k) /\ G.(k+1) <> {} by A44,XBOOLE_1:65,77;
       k+1 > k by NAT_1:13;
       hence contradiction by A19,A45,XBOOLE_0:def 7;
      end;
     end; then
     consider M be Nat such that
A46:  M > k & union rng(G|k) meets G.M;
A47: now assume not M in dom G; then
      G.M = {} by FUNCT_1:def 2;
      hence contradiction by A46,XBOOLE_1:65;
     end;
     reconsider H = Swap(G,k+1,M) as FinSequence of bool REAL;
     k+1 in dom G by A8,A13,NAT_1:11,FINSEQ_3:25; then
A48: G,Swap(G,k+1,M) are_fiberwise_equipotent by A47,Th28;

     for n be Nat st 1 <= n < k+1 holds union rng(H|n) meets H.(n+1)
     proof
      let n be Nat;
      assume A49: 1 <= n < k+1;
      per cases;
      suppose A50: n < k; then
A51:   n+1 <= k by NAT_1:13;
       n+1 <> k+1 & n+1 <> M by A46,A50,NAT_1:13; then
       H.(n+1) = G.(n+1) by EXCHSORT:33; then
A52:   H.(n+1) = G1.(n+1) by A51,FINSEQ_3:112;
       n < M by A46,A50,XXREAL_0:2; then
       not k+1 in Seg n & not M in Seg n by A49,FINSEQ_1:1; then
       H|(Seg n) = G|(Seg n) by Th29; then
       H|n = G|(Seg n) by FINSEQ_1:def 16; then
A53:   H|n = G|n by FINSEQ_1:def 16;
       G1|n = G|k|n = G|n by A50,FINSEQ_1:82;
       hence union rng(H|n) meets H.(n+1) by A14,A17,A49,A50,A52,A53;
      end;
      suppose A54: n >= k;
       n <= k by A49,NAT_1:13; then
A55:   n = k by A54,XXREAL_0:1; then
       not k+1 in Seg n & not M in Seg n by A46,A49,FINSEQ_1:1; then
       H|(Seg n) = G|(Seg n) by Th29; then
       H|n = G|(Seg n) by FINSEQ_1:def 16; then
A56:   union rng(H|n) meets G.M by A46,A55,FINSEQ_1:def 16;

       1 <= k+1 <= len G by A8,A10,A49,RFINSEQ:3,XXREAL_0:2; then
       k+1 in dom G by FINSEQ_3:25;
       hence union rng(H|n) meets H.(n+1) by A47,A55,A56,EXCHSORT:29;
      end;
     end;
     hence thesis by A10,A48,CLASSES1:76;
    end;
    for k be non zero Nat holds P[k] from NAT_1:sch 10(A5,A6); then
    consider G be FinSequence of bool REAL such that
A57:  F,G are_fiberwise_equipotent
   & (for n be Nat st 1 <= n < len F holds union rng(G|n) meets G.(n+1))
       by A4;
    len F = len G by A57,RFINSEQ:3;
    hence thesis by A57;
end;

begin :: Measure of intervals by OS_Meas

theorem Th42:
  for I be Element of Family_of_Intervals st I is open_interval holds
    OS_Meas.I <= diameter I
proof
    let I be Element of Family_of_Intervals;
    assume
     I is open_interval; then
    consider F be Open_Interval_Covering of I such that
A1:  F.0 = I &
     (for n being Nat st n <> 0 holds F.n = {}) &
     union rng F = I &
     SUM(F vol) = diameter I by Th36;
    vol F = diameter I by A1,MEASURE7:def 6; then
A2: diameter I in Svc2(I) by Def7;
    inf(Svc2(I)) is LowerBound of Svc2(I) by XXREAL_2:def 4; then
A3: inf(Svc2(I)) <= diameter I by A2,XXREAL_2:def 2;
    inf(Svc I) <= inf(Svc2 I) by Th30; then
    inf(Svc I) <= diameter I by A3,XXREAL_0:2;
    hence thesis by MEASURE7:def 10;
end;

theorem Th43:
for I be Element of Family_of_Intervals st I <> {} & I is right_open_interval
  holds OS_Meas.I <= diameter I
proof
    let I be Element of Family_of_Intervals;
    assume that
A1:  I <> {} and
A2:  I is right_open_interval;
    consider a be Real, b be R_eal such that
A3:  I = [.a,b.[ by A2,MEASURE5:def 4;
A4: a < b by A1,A3,XXREAL_1:27;

    reconsider a1=a as R_eal by XXREAL_0:def 1;
    per cases;
    suppose b = +infty; then
     diameter I = +infty - a1 by A1,A3,XXREAL_1:27,MEASURE5:7
       .= +infty by XXREAL_3:13;
     hence OS_Meas.I <= diameter I by XXREAL_0:3;
    end;
    suppose A5: b <> +infty;
     -infty < a by XXREAL_0:12,XREAL_0:def 1; then
     b in REAL by A4,A5,XXREAL_0:14; then
     reconsider rb = b as Real;

A6:  diameter I = b - a1 by A1,A3,XXREAL_1:27,MEASURE5:7
       .= rb - a by Lm9; then
     reconsider DI = diameter I as Real;
A7:  for e be Real st 0 < e holds OS_Meas.I <= DI + e
     proof
      let e be Real;
      assume
A8:    0 < e;
      reconsider c = a-e as R_eal by XXREAL_0:def 1;
      reconsider J = ].c,b.[ as Subset of REAL;
A9:   J in Family_of_Intervals by MEASUR10:def 1;
      J is open_interval by MEASURE5:def 2; then
      consider F be Open_Interval_Covering of J such that
A10:   F.0 = J & (for n be Nat st n <> 0 holds F.n = {})
     & union rng F = J
     & SUM(F vol) = diameter J by A9,Th36;
A11:  c < a by A8,XREAL_1:44; then
      reconsider F1=F as Open_Interval_Covering of I by A3,Th38,XXREAL_1:48;
      F vol = F1 vol by Th39; then
      vol F1 = diameter J by A10,MEASURE7:def 6; then
A12:  diameter J in Svc2(I) by Def7;
      inf(Svc2(I)) is LowerBound of Svc2(I) by XXREAL_2:def 4; then
A13:  inf(Svc2(I)) <= diameter J by A12,XXREAL_2:def 2;
      inf Svc I <= inf Svc2 I by Th30; then
A14:  inf Svc I <= diameter J by A13,XXREAL_0:2;
      c < b by A1,A3,XXREAL_1:27,A11,XXREAL_0:2; then
      diameter J = b - c by MEASURE5:5; then
      diameter J = rb - (a - e) by Lm9;
      hence thesis by A6,A14,MEASURE7:def 10;
     end; then
A15: OS_Meas.I <= DI+1;
A16: 0 in REAL & DI+1 in REAL by XREAL_0:def 1;
     OS_Meas is nonnegative by MEASURE4:def 1; then
     0 <= OS_Meas.I by SUPINF_2:51; then
     OS_Meas.I in REAL by A15,A16,XXREAL_0:45; then
     reconsider LI = OS_Meas.I as Real;
     for e be Real st 0 < e holds LI <= DI + e by A7;
     hence OS_Meas.I <= diameter I by XREAL_1:41;
    end;
end;

Lm10:
for I be Element of Family_of_Intervals st I <> {} & I is left_open_interval
  holds OS_Meas.I <= diameter I
proof
    let I be Element of Family_of_Intervals;
    assume that
A1:  I <> {} and
A2:  I is left_open_interval;

    consider a be R_eal, b be Real such that
A3:  I = ].a,b.] by A2,MEASURE5:def 5;
A4: a < b by A1,A3,XXREAL_1:26;
A5: b < +infty by XXREAL_0:9,XREAL_0:def 1;

    reconsider b1=b as R_eal by XXREAL_0:def 1;
    per cases;
    suppose a = -infty; then
     diameter I = b1 - -infty by A1,A3,XXREAL_1:26,MEASURE5:8
       .= +infty by XXREAL_3:14;
     hence OS_Meas.I <= diameter I by XXREAL_0:3;
    end;
    suppose a <> -infty; then
     a in REAL by A4,A5,XXREAL_0:14; then
     reconsider ra = a as Real;

     diameter I = b1 - a by A1,A3,XXREAL_1:26,MEASURE5:8; then
A6:  diameter I = b - ra by Lm9; then
     reconsider DI = diameter I as Real;

A7:  for e be Real st 0 < e holds OS_Meas.I <= DI + e
     proof
      let e be Real;
      assume 0 < e; then
A8:   b < b+e by XREAL_1:29;

      reconsider c = b+e as R_eal by XXREAL_0:def 1;
      reconsider J = ]. a,c .[ as Subset of REAL;
A9:  J in Family_of_Intervals by MEASUR10:def 1;
      J is open_interval by MEASURE5:def 2; then
      consider F be Open_Interval_Covering of J such that
A10:   F.0 = J & (for n be Nat st n <> 0 holds F.n = {})
     & union rng F = J
     & SUM(F vol) = diameter J by A9,Th36;

      reconsider F1=F as Open_Interval_Covering of I
        by A3,A8,Th38,XXREAL_1:49;

      F vol = F1 vol by Th39; then
      vol F1 = diameter J by A10,MEASURE7:def 6; then
A11:  diameter J in Svc2(I) by Def7;
      inf(Svc2(I)) is LowerBound of Svc2(I) by XXREAL_2:def 4; then
A12:  inf(Svc2(I)) <= diameter J by A11,XXREAL_2:def 2;
      inf Svc I <= inf Svc2 I by Th30; then
A13:  inf Svc I <= diameter J by A12,XXREAL_0:2;

      a < b+e by A1,A3,A8,XXREAL_1:26,XXREAL_0:2; then
      diameter J = c - a by MEASURE5:5; then
      diameter J = b+e-ra by Lm9;
      hence thesis by A6,A13,MEASURE7:def 10;
     end; then
A14: OS_Meas.I <= DI+1;
A15:  0 in REAL & DI+1 in REAL by XREAL_0:def 1;
     OS_Meas is nonnegative by MEASURE4:def 1; then
     0 <= OS_Meas.I by SUPINF_2:51; then
     OS_Meas.I in REAL by A15,A14,XXREAL_0:45; then
     reconsider LI = OS_Meas.I as Real;
     for e be Real st 0 < e holds LI <= DI + e by A7;
     hence OS_Meas.I <= diameter I by XREAL_1:41;
    end;
end;

Lm11:
for I be Element of Family_of_Intervals st I <> {} & I is closed_interval
  holds OS_Meas.I <= diameter I
proof
    let I be Element of Family_of_Intervals;
    assume that
A1:  I <> {} and
A2:  I is closed_interval;

    consider a,b be Real such that
A3:  I = [.a,b.] by A2,MEASURE5:def 3;

    reconsider a1 = a, b1 = b as R_eal by XXREAL_0:def 1;

A4: diameter I = b1-a1 by A1,A3,XXREAL_1:29,MEASURE5:6; then
A5: diameter I = b - a by Lm9;
    reconsider DI = diameter I as Real by A4;

A6: for e be Real st 0 < e holds OS_Meas.I <= DI + e
    proof
     let e be Real;
     assume 0 < e; then
A7:  a - e/2 < a & b < b + e/2 by XREAL_1:29,44,215;

     reconsider p = a-e/2, q = b+e/2 as R_eal by XXREAL_0:def 1;
     reconsider J = ].p,q.[ as Subset of REAL;
A8:  J in Family_of_Intervals by MEASUR10:def 1;

     J is open_interval by MEASURE5:def 2; then
     consider F be Open_Interval_Covering of J such that
A9:   F.0 = J & (for n be Nat st n <> 0 holds F.n = {})
    & union rng F = J
    & SUM(F vol) = diameter J by A8,Th36;

     reconsider F1=F as Open_Interval_Covering of I
       by A3,A7,Th38,XXREAL_1:47;

     a <= b by A1,A3,XXREAL_1:29; then
     a-e/2 < b by A7,XXREAL_0:2; then
     a-e/2 < b+e/2 by A7,XXREAL_0:2; then
     diameter J = q - p by MEASURE5:5; then
A10:  diameter J = b+e/2 - (a-e/2) by Lm9;

     F vol = F1 vol by Th39; then
     vol F1 = diameter J by A9,MEASURE7:def 6; then
A11: diameter J in Svc2(I) by Def7;
     inf(Svc2(I)) is LowerBound of Svc2(I) by XXREAL_2:def 4; then
A12: inf(Svc2(I)) <= diameter J by A11,XXREAL_2:def 2;
     inf Svc I <= inf Svc2 I by Th30; then
     inf Svc I <= diameter J by A12,XXREAL_0:2;
     hence thesis by A5,A10,MEASURE7:def 10;
    end; then
A13:OS_Meas.I <= DI+1;
A14:0 in REAL & DI+1 in REAL by XREAL_0:def 1;
    OS_Meas is nonnegative by MEASURE4:def 1; then
    0 <= OS_Meas.I by SUPINF_2:51; then
    OS_Meas.I in REAL by A14,A13,XXREAL_0:45; then
    reconsider LI = OS_Meas.I as Real;
    for e be Real st 0 < e holds LI <= DI + e by A6;
    hence OS_Meas.I <= diameter I by XREAL_1:41;
end;

theorem Th44:
for I be Element of Family_of_Intervals st I is Interval
  holds OS_Meas.I <= diameter I
proof
    let I be Element of Family_of_Intervals;
    assume
A1:  I is Interval;
    per cases;
    suppose A2: I = {};
     OS_Meas is zeroed by MEASURE4:def 1; then
     OS_Meas.I = 0 by A2,VALUED_0:def 19;
     hence OS_Meas.I <= diameter I by A2,MEASURE5:def 6;
    end;
    suppose A3: I <> {};
     I is open_interval or I is closed_interval or
     I is right_open_interval or I is left_open_interval by A1,MEASURE5:1;
     hence OS_Meas.I <= diameter I
       by A3,Th42,Th43,Lm10,Lm11;
    end;
end;

Lm12:
for A,B be Interval st A is open_interval & B is open_interval
 & A \/ B is Interval holds diameter(A \/ B) <= diameter A + diameter B
proof
    let A,B be Interval;
    assume that
A1:  A is open_interval and
A2:  B is open_interval and
A3:  A \/ B is Interval;

    per cases;
    suppose A = {} or B = {};
     hence diameter(A \/ B) <= diameter A + diameter B
       by XXREAL_3:4,MEASURE5:10;
    end;
    suppose A4: A <> {} & B <> {}; then
A5:  diameter(A \/ B) = sup(A \/ B) - inf(A \/ B) by MEASURE5:def 6;

     ex a1,a2 be R_eal st A = ].a1,a2.[ by A1,MEASURE5:def 2; then
A6:  A = ].inf A,sup A.[ by A4,XXREAL_2:78;
     ex b1,b2 be R_eal st B = ].b1,b2.[ by A2,MEASURE5:def 2; then
A7:  B = ].inf B,sup B.[ by A4,XXREAL_2:78;
A8:  diameter A = sup A - inf A & diameter B = sup B - inf B
        by A4,MEASURE5:def 6;
A9:  inf(A \/ B) = min(inf A,inf B)
   & sup(A \/ B) = max(sup A,sup B) by XXREAL_2:9,10;
A10: sup A <> -infty & sup B <> -infty
   & inf A <> +infty & inf B <> +infty by A4,A6,A7,XXREAL_1:28,XXREAL_0:3,5;
A11: diameter A >= 0 & diameter B >= 0 & diameter(A \/ B) >= 0
       by A3,MEASURE5:13;
A12: sup A > inf B & sup B > inf A by A1,A2,A3,A4,A6,A7,Th1,XXREAL_1:275;

     per cases by A1,A2,A3,A4,Th1;
     suppose A13: inf A < sup B;
      per cases;
      suppose A14: inf A <= inf B; then
A15:   diameter(A \/ B) = sup(A \/ B) - inf A by A5,A9,XXREAL_0:def 9;
       per cases;
       suppose sup A >= sup B; then
        sup(A \/ B) = sup A by A9,XXREAL_0:def 10;
        hence diameter(A \/ B) <= diameter A + diameter B
          by A8,A15,MEASURE5:13,XXREAL_3:39;
       end;
       suppose A16: sup A < sup B; then
A17:    diameter(A \/ B) = sup B - inf A by A9,A15,XXREAL_0:def 10;

        per cases;
        suppose sup B = +infty or inf A = -infty; then
         diameter(A \/ B) = +infty
       & (diameter B = +infty or diameter A = +infty)
           by A8,A10,A17,XXREAL_3:13,14;
         hence diameter(A \/ B) <= diameter A + diameter B
           by MEASURE5:13,XXREAL_3:39;
        end;
        suppose A18: sup B <> +infty & inf A <> -infty; then
A19:     inf B <> -infty by A14,XXREAL_0:6;

A20:     sup A <> +infty by A16,XXREAL_0:3;

         sup A - inf B >= 0 by A12,XXREAL_3:40; then
         sup B - inf A <= sup B - inf A + (sup A - inf B)
           by XXREAL_3:39; then
         sup B - inf A <= sup B - inf A + sup A - inf B
           by A10,A19,A20,XXREAL_3:30; then
         sup B - inf A <= sup B - (inf A - sup A) - inf B
           by A18,A20,XXREAL_3:32; then
         sup B - inf A <= sup B + (-(inf A - sup A)) - inf B
           by XXREAL_3:def 4; then
         sup B - inf A <= sup B + diameter A - inf B
           by A8,XXREAL_3:26; then
         sup B - inf A <= sup B + (diameter A - inf B)
           by A10,A11,XXREAL_3:30; then
         sup B - inf A <= sup B + (-(inf B - diameter A)) by XXREAL_3:26; then
         sup B - inf A <= sup B - (inf B - diameter A) by XXREAL_3:def 4;
         hence diameter(A \/ B) <= diameter A + diameter B
           by A8,A10,A11,A17,XXREAL_3:32;
        end;
       end;
      end;
      suppose A21: inf A > inf B; then
A22:   diameter(A \/ B) = sup(A \/ B) - inf B by A5,A9,XXREAL_0:def 9;
       per cases;
       suppose A23: sup A > sup B; then
A24:    sup B <> +infty by XXREAL_0:3;
A25:    sup(A \/ B) = sup A by A9,A23,XXREAL_0:def 10;
        per cases;
        suppose sup A = +infty or inf B = -infty; then
         diameter(A \/ B) = +infty
       & (diameter A = +infty or diameter B = +infty)
           by A8,A10,A22,A25,XXREAL_3:13,14;
         hence diameter(A \/ B) <= diameter A + diameter B
           by MEASURE5:13,XXREAL_3:39;
        end;
        suppose A26: sup A <> +infty & inf B <> -infty;

A27:     inf A <> -infty by A21,XXREAL_0:5;
         sup B - inf A >= 0 by A13,XXREAL_3:40; then
         sup A - inf B <= sup A - inf B + (sup B - inf A)
           by XXREAL_3:39; then
         sup A - inf B <= sup A - inf B + sup B - inf A
           by A10,A24,A27,XXREAL_3:30; then
         sup A - inf B <= sup A - (inf B - sup B) - inf A
           by A24,A26,XXREAL_3:32; then
         sup A - inf B <= sup A + (-(inf B - sup B)) - inf A
           by XXREAL_3:def 4; then
         sup A - inf B <= sup A + diameter B - inf A
           by A8,XXREAL_3:26; then
         sup A - inf B <= sup A + (diameter B - inf A)
           by A10,A11,XXREAL_3:30; then
         sup A - inf B <= sup A + (-(inf A - diameter B)) by XXREAL_3:26; then
         sup A - inf B <= sup A - (inf A - diameter B) by XXREAL_3:def 4;
         hence diameter(A \/ B) <= diameter A + diameter B
           by A8,A10,A11,A22,A25,XXREAL_3:32;
        end;
       end;
       suppose sup A <= sup B; then
        A \/ B = B by A6,A7,A21,XXREAL_1:46,XBOOLE_1:12;
        hence diameter(A \/ B) <= diameter A + diameter B
          by MEASURE5:13,XXREAL_3:39;
       end;
      end;
     end;
     suppose A28: inf B < sup A;

      per cases;
      suppose A29: inf B <= inf A; then
A30:   diameter(A \/ B) = sup(A \/ B) - inf B by A5,A9,XXREAL_0:def 9;
       per cases;
       suppose sup B >= sup A; then
        sup(A \/ B) = sup B by A9,XXREAL_0:def 10;
        hence diameter(A \/ B) <= diameter A + diameter B
          by A8,A30,MEASURE5:13,XXREAL_3:39;
       end;
       suppose A31: sup B < sup A; then
A32:    diameter(A \/ B) = sup A - inf B by A9,A30,XXREAL_0:def 10;

        per cases;
        suppose sup A = +infty or inf B = -infty; then
         diameter(A \/ B) = +infty
       & (diameter A = +infty or diameter B = +infty)
           by A8,A10,A32,XXREAL_3:13,14;
         hence diameter(A \/ B) <= diameter A + diameter B
           by MEASURE5:13,XXREAL_3:39;
        end;
        suppose A33: sup A <> +infty & inf B <> -infty; then
A34:     inf A <> -infty by A29,XXREAL_0:6;

A35:     sup B <> +infty by A31,XXREAL_0:3;

         sup B - inf A >= 0 by A12,XXREAL_3:40; then
         sup A - inf B <= sup A - inf B + (sup B - inf A)
           by XXREAL_3:39; then
         sup A - inf B <= sup A - inf B + sup B - inf A
           by A10,A34,A35,XXREAL_3:30; then
         sup A - inf B <= sup A - (inf B - sup B) - inf A
           by A33,A35,XXREAL_3:32; then
         sup A - inf B <= sup A + (-(inf B - sup B)) - inf A
           by XXREAL_3:def 4; then
         sup A - inf B <= sup A + diameter B - inf A
           by A8,XXREAL_3:26; then
         sup A - inf B <= sup A + (diameter B - inf A)
           by A10,A11,XXREAL_3:30; then
         sup A - inf B <= sup A + (-(inf A - diameter B)) by XXREAL_3:26; then
         sup A - inf B <= sup A - (inf A - diameter B) by XXREAL_3:def 4;
         hence diameter(A \/ B) <= diameter A + diameter B
           by A8,A10,A11,A32,XXREAL_3:32;
        end;
       end;
      end;
      suppose A36: inf B > inf A; then
A37:   diameter(A \/ B) = sup(A \/ B) - inf A by A5,A9,XXREAL_0:def 9;
       per cases;
       suppose A38: sup B > sup A; then
A39:    sup A <> +infty by XXREAL_0:3;
A40:    sup(A \/ B) = sup B by A9,A38,XXREAL_0:def 10;
        per cases;
        suppose sup B = +infty or inf A = -infty; then
         diameter(A \/ B) = +infty
       & (diameter B = +infty or diameter A = +infty)
           by A8,A10,A37,A40,XXREAL_3:13,14;
         hence diameter(A \/ B) <= diameter A + diameter B
           by MEASURE5:13,XXREAL_3:39;
        end;
        suppose A41: sup B <> +infty & inf A <> -infty;

A42:     inf B <> -infty by A36,XXREAL_0:5;
         sup A - inf B >= 0 by A28,XXREAL_3:40; then
         sup B - inf A <= sup B - inf A + (sup A - inf B)
           by XXREAL_3:39; then
         sup B - inf A <= sup B - inf A + sup A - inf B
           by A10,A39,A42,XXREAL_3:30; then
         sup B - inf A <= sup B - (inf A - sup A) - inf B
           by A39,A41,XXREAL_3:32; then
         sup B - inf A <= sup B + (-(inf A - sup A)) - inf B
           by XXREAL_3:def 4; then
         sup B - inf A <= sup B + diameter A - inf B
           by A8,XXREAL_3:26; then
         sup B - inf A <= sup B + (diameter A - inf B)
           by A10,A11,XXREAL_3:30; then
         sup B - inf A <= sup B + (-(inf B - diameter A)) by XXREAL_3:26; then
         sup B - inf A <= sup B - (inf B - diameter A) by XXREAL_3:def 4;
         hence diameter(A \/ B) <= diameter A + diameter B
           by A8,A10,A11,A37,A40,XXREAL_3:32;
        end;
       end;
       suppose sup B <= sup A; then
        A \/ B = A by A6,A7,A36,XXREAL_1:46,XBOOLE_1:12;
        hence diameter(A \/ B) <= diameter A + diameter B
          by MEASURE5:13,XXREAL_3:39;
       end;
      end;
     end;
    end;
end;

theorem Th45:
for A be non empty closed_interval Subset of REAL,
 F be FinSequence of bool REAL,
 G be FinSequence of ExtREAL st A c= union rng F &
  len F = len G &
  (for n be Nat st n in dom F holds F.n is open_interval Subset of REAL) &
  (for n be Nat st n in dom F holds G.n = diameter(F.n)) &
  (for n be Nat st n in dom F holds A meets F.n)
 holds diameter A <= Sum G
proof
    let A be non empty closed_interval Subset of REAL,
    F be FinSequence of bool REAL,
    G be FinSequence of ExtREAL;
    assume that
A1:  A c= union rng F and
A2:  len F = len G and
A3:  for n be Nat st n in dom F holds F.n is open_interval Subset of REAL and
A4:  for n be Nat st n in dom F holds G.n = diameter(F.n) and
A5:  for n be Nat st n in dom F holds A meets F.n;

    consider F1 be FinSequence of bool REAL such that
A6:  F,F1 are_fiberwise_equipotent
   & (for n be Nat st 1 <= n < len F1 holds union rng(F1|n) meets F1.(n+1))
      by A1,A3,A5,Th41;

A7: dom F = dom F1 by A6,RFINSEQ:3; then
    consider P be Permutation of dom F such that
A8:  F = F1*P by A6,CLASSES1:80;

    union rng F <> {} by A1; then
A9: dom F <> {} by RELAT_1:42,ZFMISC_1:2;
A10:dom F = dom G by A2,FINSEQ_3:29; then
A11:dom P = dom G & rng P = dom G by A9,FUNCT_2:def 1,def 3;

    dom(P") = rng P & rng(P") = dom P by FUNCT_1:33; then
A12:dom(G*(P")) = dom G by A11,RELAT_1:27; then
A13:G,G*(P") are_fiberwise_equipotent by A10,CLASSES1:80;
    reconsider G1 = G*(P") as FinSequence of ExtREAL by A10,FINSEQ_2:47;

A14:now let r be ExtReal;
     assume r in rng G; then
     consider n be Element of NAT such that
A15:  n in dom G & r = G.n by PARTFUN1:3;
     r = diameter(F.n) & F.n is Interval by A3,A4,A10,A15;
     hence r <> -infty by MEASURE5:13;
    end; then
A16:Sum G1 = Sum G by A10,EXTREAL1:11;

A17:for n be Nat st n in dom F1 holds G1.n = diameter(F1.n)
    proof
     let n be Nat;
     assume A18: n in dom F1; then
A19: G1.n = G.((P").n) by A7,A10,A12,FUNCT_1:12;

     reconsider m = (P").n as Nat;
A20: m in dom P & n = P.m by A7,A10,A11,A18,FUNCT_1:32; then
     F1.n = F.m by A8,FUNCT_1:12;
     hence G1.n = diameter(F1.n) by A4,A19,A20;
    end;

    defpred P[Nat] means
     $1 in dom F1 implies diameter(union rng(F1|$1)) <= Sum(G1|$1);

A21:F1 <> {} & G1 <> {} by A2,A7,A9,A12,FINSEQ_3:29;

A22:now let n be Nat;
     assume n in dom F1; then
     ex m be set st m in dom F & F1.n = F.m by A6,A7,RFINSEQ:30;
     hence F1.n is open_interval Subset of REAL by A3;
    end;

A23:P[0] by FINSEQ_3:24;

A24:for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume A25: P[k];
     assume A26: k+1 in dom F1; then
A27: 1 <= k+1 <= len F1 by FINSEQ_3:25;
     per cases;
     suppose A28: k = 0; then
A29:  F1|(k+1) = <*F1.1*> & G1|(k+1) = <*G1.1*> by A21,FINSEQ_5:20; then
A30:  rng(F1|(k+1)) = {F1.1} by FINSEQ_1:38;
      Sum(G1|(k+1)) = G1.1 by A29,EXTREAL1:8;
      hence diameter(union rng(F1|(k+1))) <= Sum(G1|(k+1)) by A17,A26,A28,A30;
     end;
     suppose k <> 0; then
A31:  1 <= k by NAT_1:14;

A32:  k < len F1 by A27,NAT_1:13; then
A33:  diameter(union rng(F1|k)) + diameter(F1.(k+1))
       <= Sum(G1|k) + diameter(F1.(k+1)) by A25,A31,FINSEQ_3:25,XXREAL_3:35;

      {G1.(k+1)} c= rng G1 by A7,A10,A12,A26,FUNCT_1:3,ZFMISC_1:31; then
A34:  rng <*G1.(k+1)*> c= rng G1 by FINSEQ_1:38;

A35:  rng G = rng G1 by A13,CLASSES1:75; then
      rng (G1|k) c= rng G by FINSEQ_5:19; then
A36:  not -infty in rng(G1|k) & not -infty in rng <*G1.(k+1)*> by A14,A34,A35;

      len F1 = len G1 by A7,A10,A12,FINSEQ_3:29; then
      G1|(k+1) = G1|k ^ <*G1.(k+1)*> by A27,NAT_1:13,FINSEQ_5:83; then
      Sum(G1|(k+1)) = Sum(G1|k) + Sum <*G1.(k+1)*> by A36,EXTREAL1:10
       .= Sum(G1|k) + G1.(k+1) by EXTREAL1:8; then
A37:  Sum(G1|k) + diameter(F1.(k+1)) = Sum(G1|(k+1)) by A17,A26;

A38:  F1.(k+1) is open_interval Subset of REAL by A22,A26;
A39:  union rng(F1|k) is open_interval Subset of REAL by A6,A22,Th40; then
A40:  union rng(F1|k) \/ F1.(k+1) is interval by A6,A31,A32,A38,XXREAL_2:89;

      F1|(k+1) = F1|k ^ <*F1.(k+1)*> by A27,NAT_1:13,FINSEQ_5:83; then
      rng(F1|(k+1)) = rng(F1|k) \/ rng <*F1.(k+1)*> by FINSEQ_1:31
       .= rng(F1|k) \/ {F1.(k+1)} by FINSEQ_1:38; then
      union rng(F1|(k+1)) = union rng(F1|k) \/ union {F1.(k+1)}
        by ZFMISC_1:78; then
      diameter(union rng(F1|(k+1)))
       <= diameter(union rng(F1|k)) + diameter(F1.(k+1))
         by A38,A39,A40,Lm12;
      hence diameter(union rng(F1|(k+1))) <= Sum(G1|(k+1))
        by A33,A37,XXREAL_0:2;
     end;
    end;

A41:for k be Nat holds P[k] from NAT_1:sch 2(A23,A24);

A42:len F1 = len G1 by A7,A10,A12,FINSEQ_3:29;
    1 <= len F1 by A21,FINSEQ_1:20; then
    diameter(union rng(F1|(len F1))) <= Sum(G1|(len F1))
      by A41,FINSEQ_3:25; then
    diameter(union rng F1) <= Sum(G1|(len G1)) by A42,FINSEQ_1:58; then
A43:diameter(union rng F1) <= Sum G1 by FINSEQ_1:58;

    union rng(F1|(len F1)) is open_interval Subset of REAL
      by A6,A22,Th40; then
A44:union rng F1 is open_interval Subset of REAL by FINSEQ_1:58;
    union rng F1 = union rng F by A6,CLASSES1:75; then
    diameter A <= diameter(union rng F1) by A1,A44,MEASURE5:12;
    hence thesis by A16,A43,XXREAL_0:2;
end;

theorem Th46:
for X be non empty set, f be sequence of X, i,j be Nat
 ex g be sequence of X st
   (for n be Nat st n <> i & n <> j holds f.n = g.n)
 & f.i = g.j & f.j = g.i
proof
    let X be non empty set, f be sequence of X, i,j be Nat;
    defpred P[object,object] means
     ($1 <> i & $1 <> j implies $2 = f.$1)
   & ($1 = i implies $2 = f.j)
   & ($1 = j implies $2 = f.i);

A1: for n be Element of NAT
     ex x be Element of X st P[n,x]
    proof
     let n be Element of NAT;
     per cases;
     suppose A2: n <> i & n <> j;
      reconsider x = f.n as Element of X;
      take x;
      thus P[n,x] by A2;
     end;
     suppose A3: n = i;
      reconsider x = f.j as Element of X;
      take x;
      thus P[n,x] by A3;
     end;
     suppose A4: n = j;
      reconsider x = f.i as Element of X;
      take x;
      thus P[n,x] by A4;
     end;
    end;

    consider g be Function of NAT,X such that
A5:  for n be Element of NAT holds P[n,g.n] from FUNCT_2:sch 3(A1);
    take g;
A6: i is Element of NAT & j is Element of NAT by ORDINAL1:def 12;
    hereby let n be Nat;
     assume A7: n <> i & n <> j;
     n is Element of NAT by ORDINAL1:def 12;
     hence f.n = g.n by A5,A7;
    end;
    thus f.i = g.j & f.j = g.i by A5,A6;
end;

theorem
for f,g be sequence of ExtREAL st
 f is nonnegative &
 (ex N be Nat st (Ser f).N <= (Ser g).N
               & (for n be Nat st n > N holds f.n <= g.n))
 holds SUM f <= SUM g
proof
    let f,g be sequence of ExtREAL;
    assume that
A1:  f is nonnegative and
A2:  ex N be Nat st (Ser f).N <= (Ser g).N
               & (for n be Nat st n > N holds f.n <= g.n);
    consider N be Nat such that
A3:  (Ser f).N <= (Ser g).N and
A4:  for n be Nat st n > N holds f.n <= g.n by A2;

    defpred P[Nat] means (Ser f).(N+$1) <= (Ser g).(N+$1);
A5: P[0] by A3;
A6: for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume A7: P[k];
A8:  (Ser f).(N+k+1) = (Ser f).(N+k) + f.(N+k+1)
   & (Ser g).(N+k+1) = (Ser g).(N+k) + g.(N+k+1) by SUPINF_2:def 11;
     N < N+k+1 by NAT_1:11,13; then
     f.(N+k+1) <= g.(N+k+1) by A4;
     hence P[k+1] by A7,A8,XXREAL_3:36;
    end;

A9: for m be Nat holds P[m] from NAT_1:sch 2(A5,A6);

    for x be ExtReal st x in rng Ser f
     ex y be ExtReal st y in rng Ser g & x <= y
    proof
     let x be ExtReal;
     assume x in rng Ser f; then
     consider n be Element of NAT such that
A10:  x = (Ser f).n by FUNCT_2:113;
     per cases;
     suppose n < N; then
      reconsider m = N-n as Nat by NAT_1:21;
      N = n + m; then
      (Ser f).n <= (Ser f).N by A1,SUPINF_2:41; then
A11:  x <= (Ser g).N by A3,A10,XXREAL_0:2;
      dom Ser g = NAT by FUNCT_2:def 1; then
      N in dom Ser g by ORDINAL1:def 12;
      hence thesis by A11,FUNCT_1:3;
     end;
     suppose n >= N; then
      reconsider m = n - N as Nat by NAT_1:21;
A12:  x <= (Ser g).(N+m) by A9,A10;
      dom Ser g = NAT by FUNCT_2:def 1;
      hence thesis by A12,FUNCT_1:3;
     end;
    end;
    hence SUM f <= SUM g by XXREAL_2:63;
end;

theorem Th48:
for f,g be sequence of ExtREAL, j,k be Nat st
 k < j & (for n be Nat st n < j holds f.n = g.n)
holds (Ser f).k = (Ser g).k
proof
    let f,g be sequence of ExtREAL, j,k be Nat;
    assume that
A1:  k < j and
A2:  for n be Nat st n < j holds f.n = g.n;

    defpred P[Nat] means $1 <= k implies (Ser f).$1 = (Ser g).$1;

    now assume 0 <= k;
     f.0 = g.0 by A1,A2; then
     (Ser f).0 = g.0 by SUPINF_2:def 11;
     hence (Ser f).0 = (Ser g).0 by SUPINF_2:def 11;
    end; then
A3: P[0];

A4: for m be Nat st P[m] holds P[m+1]
    proof
     let m be Nat;
     assume A5: P[m];
     assume A6: m+1 <= k; then
A7:  m+1 < j by A1,XXREAL_0:2;

     (Ser f).(m+1) = (Ser f).m + f.(m+1) by SUPINF_2:def 11; then
     (Ser f).(m+1) = (Ser g).m + g.(m+1) by A2,A5,A6,A7,NAT_1:13;
     hence (Ser f).(m+1) = (Ser g).(m+1) by SUPINF_2:def 11;
    end;
    for m be Nat holds P[m] from NAT_1:sch 2(A3,A4);
    hence (Ser f).k = (Ser g).k;
end;

theorem Th49:
for f,g be sequence of ExtREAL, i,j be Nat st
 f is nonnegative &
 i >= j & (for n be Nat st n <> i & n <> j holds f.n = g.n)
 & f.i = g.j & f.j = g.i
 holds (Ser f).i = (Ser g).i
proof
    let f,g be sequence of ExtREAL, i,j be Nat;
    assume that
A1:  f is nonnegative and
A2:  i >= j and
A3:  for n be Nat st n <> i & n <> j holds f.n = g.n and
A4:  f.i = g.j and
A5:  f.j = g.i;

A6: for k be Element of NAT holds 0 <= g.k
    proof
     let k be Element of NAT;
     per cases;
     suppose k = i or k = j;
      hence 0 <= g.k by A1,A4,A5,SUPINF_2:51;
     end;
     suppose k <> i & k <> j; then
      g.k = f.k by A3;
      hence 0 <= g.k by A1,SUPINF_2:51;
     end;
    end; then
A7: g is nonnegative by SUPINF_2:39;

    per cases;
    suppose A8: j = 0;

     defpred P1[Nat] means $1 < i implies (Ser f).$1 + f.i = (Ser g).$1 + g.i;

     now assume 0 < i;
      f.i = (Ser g).0 & (Ser f).0 = g.i by A4,A5,A8,SUPINF_2:def 11;
      hence (Ser f).0 + f.i = (Ser g).0 + g.i;
     end; then
A9:  P1[0];

A10: for m be Nat st P1[m] holds P1[m+1]
     proof
      let m be Nat;
      assume A11: P1[m];
      assume A12: m+1 < i;

A13:  0 <= f.m & 0 <= f.(m+1) & 0 <= f.i by A1,SUPINF_2:51; then
A14:  0 <= (Ser f).m by A1,MEASURE7:2;

A15:  0 <= g.m & 0 <= g.(m+1) & 0 <= g.i by A6,SUPINF_2:39,51; then
A16:  0 <= (Ser g).m by A7,MEASURE7:2;

A17:  f.(m+1) = g.(m+1) by A3,A8,A12; then
A18:  (Ser f).(m+1) = g.(m+1) + (Ser f).m
    & (Ser g).(m+1) = f.(m+1) + (Ser g).m by SUPINF_2:def 11; then
      (Ser f).(m+1) + f.i
        = g.(m+1) + ((Ser f).m + f.i) by A13,A14,A15,XXREAL_3:44;
      hence (Ser f).(m+1) + f.i = (Ser g).(m+1) + g.i
        by A11,A12,A15,A16,A17,A18,XXREAL_3:44,NAT_1:13;
     end;
A19: for m be Nat holds P1[m] from NAT_1:sch 2(A9,A10);

     per cases;
     suppose A20: i=0; then
      (Ser f).i = f.0 & (Ser g).i = g.0 by SUPINF_2:def 11;
      hence (Ser f).i = (Ser g).i by A4,A8,A20;
     end;
     suppose i <> 0; then
      reconsider m = i-1 as Nat by NAT_1:20;
A21:  i = m+1; then
      m < i by NAT_1:13; then
      (Ser f).m + f.i = (Ser g).m + g.i by A19; then
      (Ser f).i = (Ser g).m + g.i by A21,SUPINF_2:def 11;
      hence (Ser f).i = (Ser g).i by A21,SUPINF_2:def 11;
     end;
    end;
    suppose A22: j <> 0; then
     reconsider m = j-1 as Nat by NAT_1:20;
A23: j = m+1; then
A24: m < j by NAT_1:13;
     for n be Nat st n < j holds f.n = g.n by A2,A3; then
A25: (Ser f).m = (Ser g).m by A24,Th48;

     per cases;
     suppose A26: j=i; then
      (Ser f).i = (Ser g).m + g.i by A4,A23,A25,SUPINF_2:def 11;
      hence (Ser f).i = (Ser g).i by A23,A26,SUPINF_2:def 11;
     end;

     suppose j <> i; then
A27:  j < i by A2,XXREAL_0:1;

      defpred P2[Nat] means
       j <= $1 < i implies (Ser f).$1 + f.i = (Ser g).$1 + g.i;

A28:  P2[0] by A22;
A29:  for k be Nat st P2[k] holds P2[k+1]
      proof
       let k be Nat;
       assume A30: P2[k];
       assume A31: j <= k+1 < i;

       per cases;
       suppose A32: j = k+1;

A33:    0 <= f.i & 0 <= g.i & 0 <= g.k by A1,A6,SUPINF_2:39,51; then
A34:    0 <= (Ser g).k by A7,MEASURE7:2;

        (Ser f).(k+1) + f.i
         = (Ser f).k + f.(k+1) + f.i by SUPINF_2:def 11; then
        (Ser f).(k+1) + f.i
         = (Ser g).k + f.i + g.i by A5,A25,A32,A33,A34,XXREAL_3:44;
        hence (Ser f).(k+1) + f.i = (Ser g).(k+1) + g.i
          by A4,A32,SUPINF_2:def 11;
       end;
       suppose j <> k+1; then
A35:    j < k+1 by A31,XXREAL_0:1;

A36:    0 <= f.(k+1) & 0 <= f.i & 0 <= f.k by A1,SUPINF_2:51; then
A37:    0 <= (Ser f).k by A1,MEASURE7:2;

A38:    0 <= g.(k+1) & 0 <= g.i & 0 <= g.k by A6,SUPINF_2:39,51; then
A39:    0 <= (Ser g).k by A7,MEASURE7:2;

        (Ser f).(k+1) = f.(k+1) + (Ser f).k by SUPINF_2:def 11; then
        (Ser f).(k+1) + f.i
          = f.(k+1) + ((Ser f).k + f.i) by A36,A37,XXREAL_3:44; then
        (Ser f).(k+1) + f.i
          = g.(k+1) + ((Ser g).k + g.i) by A3,A30,A31,A35,NAT_1:13; then
        (Ser f).(k+1) + f.i
          = g.(k+1) + (Ser g).k + g.i by A38,A39,XXREAL_3:44;
        hence (Ser f).(k+1) + f.i = (Ser g).(k+1) + g.i by SUPINF_2:def 11;
       end;
      end;
A40:  for k be Nat holds P2[k] from NAT_1:sch 2(A28,A29);

      reconsider k = i-1 as Nat by A27,NAT_1:20;
A41:  i = k+1; then
      j <= k < i by A27,NAT_1:13; then
      (Ser f).k + f.i = (Ser g).k + g.i by A40; then
      (Ser f).i = (Ser g).k + g.i by A41,SUPINF_2:def 11;
      hence (Ser f).i = (Ser g).i by A41,SUPINF_2:def 11;
     end;
    end;
end;

theorem Th50:
for f,g be sequence of ExtREAL, i,j be Nat st
 f is nonnegative & f.i = g.j & f.j = g.i
 & (for n be Nat st n <> i & n <> j holds f.n = g.n)
 holds for n be Nat st n >= i & n >= j holds (Ser f).n = (Ser g).n
proof
    let f,g be sequence of ExtREAL, i,j be Nat;
    assume that
A1:  f is nonnegative and
A2:  f.i = g.j and
A3:  f.j = g.i and
A4:  for n be Nat st n <> i & n <> j holds f.n = g.n;

    let n be Nat;
    assume
A5:  n >= i & n >= j;

    defpred P[Nat] means $1 >= i & $1 >= j implies (Ser f).$1 = (Ser g).$1;

    now assume 0 >= i & 0 >= j; then
     i = 0 & j = 0; then
     (Ser f).0 = g.0 by A2,SUPINF_2:def 11;
     hence (Ser f).0 = (Ser g).0 by SUPINF_2:def 11;
    end; then
A6: P[0];

A7: for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume
A8:   P[k];
     now assume
A9:   k+1 >= i & k+1 >= j;

      per cases;
      suppose k < i & k < j; then
       k+1 <= i & k+1 <= j by NAT_1:13; then
       k+1 = i & k+1 = j by A9,XXREAL_0:1;
       hence (Ser f).(k+1) = (Ser g).(k+1) by A1,A3,A4,Th49;
      end;
      suppose
A10:   k >= i & k < j; then
       k+1 <= j by NAT_1:13; then
A11:   k+1 = j by A9,XXREAL_0:1;
       for n be Nat st n <> j & n <> i holds f.n = g.n by A4;
       hence (Ser f).(k+1) = (Ser g).(k+1)
         by A1,A2,A3,A11,A10,NAT_1:12,Th49;
      end;
      suppose
A12:   k < i & k >= j; then
       k+1 <= i by NAT_1:13; then
       k+1 = i by A9,XXREAL_0:1;
       hence (Ser f).(k+1) = (Ser g).(k+1)
         by A1,A2,A3,A4,A12,NAT_1:12,Th49;
      end;
      suppose
A13:   k >= i & k >= j; then
A14:   k+1 > i & k+1 > j by NAT_1:13;
       (Ser f).(k+1) = (Ser f).k + f.(k+1) by SUPINF_2:def 11
        .= (Ser g).k + g.(k+1) by A4,A8,A13,A14;
       hence (Ser f).(k+1) = (Ser g).(k+1) by SUPINF_2:def 11;
      end;
     end;
     hence P[k+1];
    end;

    for k be Nat holds P[k] from NAT_1:sch 2(A6,A7);
    hence (Ser f).n = (Ser g).n by A5;
end;

Lm13:
for f,g be sequence of ExtREAL, i,j be Nat st
 f is nonnegative &
 i >= j & (for n be Nat st n <> i & n <> j holds f.n = g.n)
 & f.i = g.j & f.j = g.i
 holds SUM f <= SUM g
proof
    let f,g be sequence of ExtREAL, i,j be Nat;
    assume that
A1:  f is nonnegative and
A2:  i >= j and
A3:  for n be Nat st n <> i & n <> j holds f.n = g.n and
A4:  f.i = g.j and
A5:  f.j = g.i;

A6: dom Ser g = NAT by FUNCT_2:def 1;

    for x being ExtReal st x in rng Ser f holds ex y being
    ExtReal st y in rng Ser g & x <= y
    proof
     let x be ExtReal;
     assume x in rng Ser f; then
     consider n be Element of NAT such that
A7:   x = (Ser f).n by FUNCT_2:113;

     per cases;
     suppose n <= i; then
      x <= (Ser f).i by A1,A7,MEASURE7:8; then
A8:   x <= (Ser g).i by A1,A2,A3,A4,A5,Th49;
      i in dom Ser g by A6,ORDINAL1:def 12;
      hence ex y be ExtReal st y in rng Ser g & x <= y by A8,FUNCT_1:3;
     end;
     suppose A9: n > i; then
      n >= j by A2,XXREAL_0:2; then
      (Ser f).n = (Ser g).n by A1,A3,A4,A5,A9,Th50;
      hence ex y be ExtReal st y in rng Ser g & x <= y by A6,A7,FUNCT_1:3;
     end;
    end;
    hence SUM f <= SUM g by XXREAL_2:63;
end;

theorem Th51:
for f,g be sequence of ExtREAL, i,j be Nat st
 f is nonnegative &
 i >= j & (for n be Nat st n <> i & n <> j holds f.n = g.n)
 & f.i = g.j & f.j = g.i
 holds SUM f = SUM g
proof
    let f,g be sequence of ExtREAL, i,j be Nat;
    assume that
A1:  f is nonnegative and
A2:  i >= j and
A3:  for n be Nat st n <> i & n <> j holds f.n = g.n and
A4:  f.i = g.j and
A5:  f.j = g.i;

A6: SUM f <= SUM g by A1,A2,A3,A4,A5,Lm13;

    for k be Element of NAT holds 0 <= g.k
    proof
     let k be Element of NAT;
     per cases;
     suppose k = i or k = j;
      hence 0 <= g.k by A1,A4,A5,SUPINF_2:51;
     end;
     suppose k <> i & k <> j; then
      g.k = f.k by A3;
      hence 0 <= g.k by A1,SUPINF_2:51;
     end;
    end; then
    g is nonnegative by SUPINF_2:39; then
    SUM g <= SUM f by A2,A3,A4,A5,Lm13;
    hence SUM f = SUM g by A6,XXREAL_0:1;
end;

theorem Th52:
for A be Subset of REAL, F1,F2 be Interval_Covering of A, n,m be Nat
 st (for k be Nat st k <> n & k <> m holds F1.k = F2.k) &
    F1.n = F2.m & F1.m = F2.n holds vol F1 = vol F2
proof
   let A be Subset of REAL, F1,F2 be Interval_Covering of A, n,m be Nat;
   assume that
A1: for k be Nat st k <> n & k <> m holds F1.k = F2.k and
A2: F1.n = F2.m and
A3: F1.m = F2.n;

A4:n is Element of NAT & m is Element of NAT by ORDINAL1:def 12; then
   (F1 vol).n = diameter(F1.n) & (F1 vol).m = diameter(F1.m)
     by MEASURE7:def 4; then
A5:(F1 vol).n = (F2 vol).m & (F1 vol).m = (F2 vol).n
     by A2,A3,A4,MEASURE7:def 4;

A6:for k be Nat st k <> n & k <> m holds (F1 vol).k = (F2 vol).k
   proof
    let k be Nat;
A7: k is Element of NAT by ORDINAL1:def 12;
    assume k <> n & k <> m; then
    F1.k = F2.k by A1; then
    (F1 vol).k = diameter(F2.k) by A7,MEASURE7:def 4;
    hence (F1 vol).k = (F2 vol).k by A7,MEASURE7:def 4;
   end; then
A8:for k be Nat st k <> m & k <> n holds (F2 vol).k = (F1 vol).k;

   n >= m or m > n; then
   SUM(F1 vol) = SUM(F2 vol) by A5,A6,A8,Th51,MEASURE7:12; then
   vol F1 = SUM(F2 vol) by MEASURE7:def 6;
   hence vol F1 = vol F2 by MEASURE7:def 6;
end;

theorem
for A be Subset of REAL, F1,F2 be Interval_Covering of A, n,m be Nat
 st (for k be Nat st k <> n & k <> m holds F1.k = F2.k) &
    F1.n = F2.m & F1.m = F2.n holds
 for k be Nat st k >= n & k >= m holds (Ser (F1 vol)).k = (Ser (F2 vol)).k
proof
    let A be Subset of REAL, F1,F2 be Interval_Covering of A, n,m be Nat;
    assume that
A1:  for k be Nat st k <> n & k <> m holds F1.k = F2.k and
A2:  F1.n = F2.m and
A3:  F1.m = F2.n;

    let k be Nat;
    assume that
A4:  k >= n and
A5:  k >= m;
A6: n is Element of NAT & m is Element of NAT by ORDINAL1:def 12; then
    (F1 vol).n = diameter(F1.n)
  & (F1 vol).m = diameter(F1.m) by MEASURE7:def 4; then
A7: (F1 vol).n = (F2 vol).m
  & (F1 vol).m = (F2 vol).n by A2,A3,A6,MEASURE7:def 4;

    for k be Nat st k <> n & k <> m holds (F1 vol).k = (F2 vol).k
    proof
     let k be Nat;
A8:  k is Element of NAT by ORDINAL1:def 12;
     assume k <> n & k <> m; then
     F1.k = F2.k by A1; then
     (F1 vol).k = diameter (F2.k) by A8,MEASURE7:def 4;
     hence (F1 vol).k = (F2 vol).k by A8,MEASURE7:def 4;
    end;
    hence (Ser (F1 vol)).k = (Ser (F2 vol)).k
      by A4,A5,A7,Th50,MEASURE7:12;
end;

theorem
for X be non empty set, seq be sequence of X, f be FinSequence of X
 st rng f c= rng seq holds
  ex N be Nat st rng f c= rng(seq|(Segm N))
proof
    let X be non empty set, seq be sequence of X,
    f be FinSequence of X;
    assume
A1:  rng f c= rng seq;
    defpred P[Nat] means
     for F be FinSequence of X st len F = $1 & rng F c= rng seq
      holds ex N be Nat st rng F c= rng (seq|(Segm N));

    now let F be FinSequence of X;
     assume len F = 0 & rng F c= rng seq; then
     F = {}; then
     rng F c= rng (seq|(Segm 0));
     hence ex N be Nat st rng F c= rng (seq|(Segm N));
    end; then
A2: P[0];

A3: for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume
A4:   P[k];
     now let F be FinSequence of X;
      assume that
A5:    len F = k+1 and
A6:    rng F c= rng seq;
      reconsider F1 = F|k as FinSequence of X;

      k <= len F by A5,NAT_1:13; then
A7:   len F1 = k by FINSEQ_1:59;

A8:   F1 = F | Seg k by FINSEQ_1:def 16;

      rng (F|(Seg k)) c= rng F by RELAT_1:70; then
      rng F1 c= rng seq by A6,A8; then
      consider N1 be Nat such that
A9:    rng F1 c= rng (seq|(Segm N1)) by A4,A7;

      1 <= k+1 by NAT_1:11; then
      k+1 in dom F by A5,FINSEQ_3:25; then
      F.(k+1) in rng F by FUNCT_1:3; then
      consider m be Element of NAT such that
A10:   F.(k+1) = seq.m by A6,FUNCT_2:113;
      reconsider m as Nat;

      F = F1 ^ <*F.(k+1)*> by A5,A8,FINSEQ_3:55; then
      rng F = rng F1 \/ rng <*F.(k+1)*> by FINSEQ_1:31; then
A11:  rng F = rng F1 \/ {F.(k+1)} by FINSEQ_1:38;

A12:  dom seq = NAT by FUNCT_2:def 1;

      per cases;
      suppose A13: m < N1; then
       m in Segm N1 by NAT_1:44; then
       m in dom seq /\ Segm N1 by A12,XBOOLE_0:def 4; then
       m in dom(seq|(Segm N1)) by RELAT_1:61; then
       (seq|(Segm N1)).m in rng(seq|(Segm N1)) by FUNCT_1:3; then
       F.(k+1) in rng(seq|(Segm N1)) by A10,A13,FUNCT_1:49,NAT_1:44; then
       {F.(k+1)} c= rng(seq|(Segm N1)) by TARSKI:def 1;
       hence ex N be Nat st rng F c= rng(seq|(Segm N)) by A9,A11,XBOOLE_1:8;
      end;

      suppose m >= N1; then
       m+1 > N1 by NAT_1:13; then
       seq|(Segm N1) c= seq|(Segm (m+1)) by RELAT_1:75,NAT_1:39; then
       rng(seq|(Segm N1)) c= rng(seq|(Segm (m+1))) by RELAT_1:11; then
A14:   rng F1 c= rng(seq|(Segm (m+1))) by A9;
A15:   m < m+1 by NAT_1:13; then
       m in Segm(m+1) by NAT_1:44; then
       m in dom seq /\ Segm(m+1) by A12,XBOOLE_0:def 4; then
       m in dom(seq|(Segm(m+1))) by RELAT_1:61; then
       (seq|(Segm(m+1)).m in rng(seq|(Segm(m+1)))) by FUNCT_1:3; then
       F.(k+1) in rng(seq|(Segm(m+1))) by A10,A15,NAT_1:44,FUNCT_1:49; then
       {F.(k+1)} c= rng(seq|(Segm(m+1))) by TARSKI:def 1;
       hence ex N be Nat st rng F c= rng(seq|(Segm N)) by A11,A14,XBOOLE_1:8;
      end;
     end;
     hence P[k+1];
    end;
    for k be Nat holds P[k] from NAT_1:sch 2(A2,A3); then
    P[len f];
    hence ex N be Nat st rng f c= rng(seq|(Segm N)) by A1;
end;

theorem Th55:
for A be non empty Subset of REAL, F be Interval_Covering of A,
 G be one-to-one FinSequence of bool REAL st rng G c= rng F
ex F1 be Interval_Covering of A st
 (for n be Nat st n in dom G holds G.n = F1.n) &
 vol F1 = vol F
proof
    let A be non empty Subset of REAL, F be Interval_Covering of A,
    G be one-to-one FinSequence of bool REAL;
    assume that
A1:  rng G c= rng F;

    defpred P[Nat] means
     ex F0 be Interval_Covering of A st
      (for n be Nat st n in dom(G|$1) holds (G|$1).n = F0.n) &
      F0,F are_fiberwise_equipotent &
      vol F0 = vol F;

A2: P[0]
    proof
     take F;
     thus thesis;
    end;

A3: for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume P[k]; then
     consider F0 be Interval_Covering of A such that
A4:   for n be Nat st n in dom(G|k) holds (G|k).n = F0.n and
A5:   F0,F are_fiberwise_equipotent and
A6:   vol F0 = vol F;

A7:  dom F0 = NAT by FUNCT_2:def 1;

     per cases;
     suppose A8: len G <= k; then
      len G < k+1 by NAT_1:13; then
      G|k = G & G|(k+1) = G by A8,FINSEQ_1:58;
      hence P[k+1] by A4,A5,A6;
     end;

     suppose A9: len G > k; then
A10:  len G >= k+1 by NAT_1:13; then
A11:  len (G|(k+1)) = k+1 by FINSEQ_1:59;

A12:  k+1 in dom G by A10,FINSEQ_3:25,NAT_1:11;
      G.(k+1) = G|(Seg(k+1)).(k+1) by FUNCT_1:49,FINSEQ_1:4; then
A13:  G.(k+1) = (G|(k+1)).(k+1) by FINSEQ_1:def 16; then
A14:  (G|(k+1)).(k+1) in rng F by A1,A12,FUNCT_1:3;

      rng F = rng F0 by A5,CLASSES1:75; then
      consider M0 be Element of NAT such that
A15:   (G|(k+1)).(k+1) = F0.M0 by A14,FUNCT_2:113;

A16:  now assume A17: 1 <= M0 <= k; then
       M0 <= len G by A9,XXREAL_0:2; then
A18:   M0 in dom G by A17,FINSEQ_3:25; then
       M0 in dom (G|(Seg k)) by A17,FINSEQ_1:1,RELAT_1:57; then
       M0 in dom(G|k) by FINSEQ_1:def 16; then
       (G|k).M0 = F0.M0 by A4; then
       G.M0 = F0.M0 by A17,FINSEQ_3:112; then
       M0 = k+1 by A12,A13,A15,A18,FUNCT_1:def 4;
       hence contradiction by A17,NAT_1:13;
      end;

      per cases by A16,NAT_1:13,14;
      suppose
A19:   M0 = 0;

       consider F1 be sequence of bool REAL such that
A20:    (for n be Nat st n <> 0 & n <> k+1 holds F0.n = F1.n)
      & F0.0 = F1.(k+1) & F0.(k+1) = F1.0 by Th46;

A21:   dom F1 = NAT by FUNCT_2:def 1;

A22:   for n be Nat st n in dom(G|(k+1)) holds (G|(k+1)).n = F1.n
       proof
        let n be Nat;
        assume n in dom(G|(k+1)); then
A23:    1 <= n <= k+1 by A11,FINSEQ_3:25;
        per cases;
        suppose n = k+1;
         hence (G|(k+1)).n = F1.n by A15,A19,A20;
        end;
        suppose A24: n <> k+1; then
A25:     F0.n = F1.n by A20,A23;
         n < k+1 by A23,A24,XXREAL_0:1; then
A26:     n <= k by NAT_1:13;

         n <= len G by A10,A23,XXREAL_0:2; then
         n in dom G by A23,FINSEQ_3:25; then
         n in dom(G|Seg k) by A23,A26,FINSEQ_1:1,RELAT_1:57; then
A27:     n in dom(G|k) by FINSEQ_1:def 16;

         (G|(k+1)).n = G.n by A23,FINSEQ_3:112; then
         (G|(k+1)).n = (G|k).n by A26,FINSEQ_3:112;
         hence (G|(k+1)).n = F1.n by A4,A25,A27;
        end;
       end;
       for n be set st n <> 0 & n <> k+1 & n in dom F0 holds
          F0.n = F1.n by A20; then
A28:   F0,F1 are_fiberwise_equipotent by A7,A20,A21,RFINSEQ:28; then
       rng F1 = rng F by A5,CLASSES1:75,76; then
A29:   A c= union rng F1 by MEASURE7:def 2;
       for n be Element of NAT holds F1.n is Interval
       proof
        let n be Element of NAT;
        per cases;
        suppose n <> 0 & n <> k+1; then
         F1.n = F0.n by A20;
         hence F1.n is Interval;
        end;
        suppose n = 0 or n = k+1;
         hence F1.n is Interval by A20;
        end;
       end; then
       reconsider F1 as Interval_Covering of A by A29,MEASURE7:def 2;

       vol F1 = vol F by A6,A20,Th52;
       hence P[k+1] by A5,A22,A28,CLASSES1:76;
      end;
      suppose
A30:   k+1 <= M0;

       consider F1 be sequence of bool REAL such that
A31:    (for n be Nat st n <> M0 & n <> k+1 holds F0.n = F1.n)
      & F0.M0 = F1.(k+1) & F0.(k+1) = F1.M0 by Th46;

A32:   dom F1 = NAT by FUNCT_2:def 1;

A33:   for n be Nat st n in dom(G|(k+1)) holds (G|(k+1)).n = F1.n
       proof
        let n be Nat;
        assume n in dom(G|(k+1)); then
A34:    1 <= n <= k+1 by A11,FINSEQ_3:25;
        per cases;
        suppose n = k+1;
         hence (G|(k+1)).n = F1.n by A15,A31;
        end;
        suppose A35: n <> k+1; then
         n < k+1 by A34,XXREAL_0:1; then
A36:     F0.n = F1.n by A30,A31;
         n < k+1 by A34,A35,XXREAL_0:1; then
A37:     n <= k by NAT_1:13;

         n <= len G by A10,A34,XXREAL_0:2; then
         n in dom G by A34,FINSEQ_3:25; then
         n in dom(G|Seg k) by A34,A37,FINSEQ_1:1,RELAT_1:57; then
A38:     n in dom(G|k) by FINSEQ_1:def 16;

         (G|(k+1)).n = G.n by A34,FINSEQ_3:112; then
         (G|(k+1)).n = (G|k).n by A37,FINSEQ_3:112;
         hence (G|(k+1)).n = F1.n by A4,A36,A38;
        end;
       end;
       for n be set st n <> M0 & n <> k+1 & n in dom F0 holds
         F0.n = F1.n by A31; then
A39:   F0,F1 are_fiberwise_equipotent by A7,A31,A32,RFINSEQ:28; then
       rng F1 = rng F by A5,CLASSES1:75,76; then
A40:   A c= union rng F1 by MEASURE7:def 2;
       for n be Element of NAT holds F1.n is Interval
       proof
        let n be Element of NAT;
        per cases;
        suppose n <> M0 & n <> k+1; then
         F1.n = F0.n by A31;
         hence F1.n is Interval;
        end;
        suppose n = M0 or n = k+1;
         hence F1.n is Interval by A31;
        end;
       end; then
       reconsider F1 as Interval_Covering of A by A40,MEASURE7:def 2;
       vol F1 = vol F by A6,A31,Th52;
       hence P[k+1] by A5,A33,A39,CLASSES1:76;
      end;
     end;
    end;

    for k be Nat holds P[k] from NAT_1:sch 2(A2,A3); then
A41:P[len G];
    G|len G = G by FINSEQ_1:58;
    hence thesis by A41;
end;

theorem Th56:
for A be non empty Subset of REAL, F be Interval_Covering of A,
 G be one-to-one FinSequence of bool REAL,
 H be FinSequence of ExtREAL st
  rng G c= rng F & dom G = dom H &
 (for n be Nat holds H.n = diameter(G.n)) holds Sum H <= vol F
proof
    let A be non empty Subset of REAL, F be Interval_Covering of A,
    G be one-to-one FinSequence of bool REAL,
    H be FinSequence of ExtREAL;
    assume that
A1:  rng G c= rng F and
A2:  dom G = dom H and
A3:  for n be Nat holds H.n = diameter(G.n);

    consider F1 be Interval_Covering of A such that
A4:  (for n be Nat st n in dom G holds G.n = F1.n) &
     vol F1 = vol F by A1,Th55;

    consider S be sequence of ExtREAL such that
A5:  Sum H = S.(len H) & S.0 = 0 &
     for n be Nat st n < len H holds S.(n+1) = S.n + H.(n+1) by EXTREAL1:def 2;

    defpred P[Nat] means $1 <= len H implies S.$1 <= (Ser(F1 vol)).$1;

    F1 vol is nonnegative by MEASURE7:12; then
A6: P[0] by A5,SUPINF_2:40;

A7: for n be Nat st P[n] holds P[n+1]
    proof
     let n be Nat;
     assume
A8:   P[n];
     assume
A9:   n+1 <= len H; then
A10: n+1 in dom G by A2,FINSEQ_3:25,NAT_1:11;

     S.(n+1) = S.n + H.(n+1) by A5,A9,NAT_1:13; then
     S.(n+1) = S.n + diameter(G.(n+1)) by A3; then
     S.(n+1) = S.n + diameter(F1.(n+1)) by A4,A10; then
A11: S.(n+1) = S.n + (F1 vol).(n+1) by MEASURE7:def 4;

     S.n + (F1 vol).(n+1) <= (Ser(F1 vol)).n + (F1 vol).(n+1)
       by A8,A9,NAT_1:13,XXREAL_3:35;
     hence S.(n+1) <= (Ser(F1 vol)).(n+1) by A11,SUPINF_2:def 11;
    end;

    for n be Nat holds P[n] from NAT_1:sch 2(A6,A7); then
A12:Sum H <= (Ser(F1 vol)).(len H) by A5;
    (Ser(F1 vol)).(len H) <= SUM(F1 vol) by MEASURE7:6,12; then
    Sum H <= SUM(F1 vol) by A12,XXREAL_0:2;
    hence Sum H <= vol F by A4,MEASURE7:def 6;
end;

Lm14:
for I be Element of Family_of_Intervals st I is non empty closed_interval holds
 diameter I <= OS_Meas.I
proof
    let I be Element of Family_of_Intervals;
    assume A1: I is non empty closed_interval; then
    consider a,b be Real such that
A2:  I = [.a,b.] by MEASURE5:def 3;

    reconsider a1 = a, b1 = b as R_eal by XXREAL_0:def 1;
A3: diameter I = b1 - a1 by A1,A2,XXREAL_1:29,MEASURE5:6; then
A4: diameter I < +infty by XXREAL_0:4;

A5: OS_Meas.I <= diameter I by A1,Th44;
    OS_Meas is nonnegative by MEASURE4:def 1; then
    -infty < 0 & 0 <= OS_Meas.I by SUPINF_2:51; then
A6: OS_Meas.I in REAL by A4,A5,XXREAL_0:14; then
    reconsider DI = diameter I, LI = OS_Meas.I as Real by A3;

A7: inf Svc I in REAL by A6,MEASURE7:def 10;

    Svc2 I c= Svc I by Th30; then
A8: Svc I is non empty Subset of ExtREAL;

    for e be Real st 0 < e holds DI <= LI + e
    proof
     let e be Real;
     assume A9: 0 < e;
     consider x be ExtReal such that
A10:   x in Svc I & x < inf Svc I + e/2 by A7,A8,MEASURE6:5,A9,XREAL_1:215;
     consider F be Interval_Covering of I such that
A11:   x = vol F by A10,MEASURE7:def 8;

     defpred P2[Element of NAT,object] means
      (F.$1 = {+infty} or F.$1 = {-infty} implies $2 = {})
    & (not(F.$1 = {+infty} or F.$1 = {-infty}) implies $2 = F.$1);

A12:  for n be Element of NAT ex A be Element of bool REAL st P2[n,A]
     proof
      let n be Element of NAT;
      per cases;
      suppose A13: F.n = {+infty} or F.n = {-infty};
       {} c= REAL; then
       reconsider A = {} as Element of bool REAL;
       take A;
       thus thesis by A13;
      end;
      suppose A14: not(F.n = {+infty} or F.n = {-infty});
       take A = F.n;
       thus thesis by A14;
      end;
     end;

     consider F2 be Function of NAT,bool REAL such that
A15:   for n be Element of NAT holds P2[n,F2.n] from FUNCT_2:sch 3(A12);
     reconsider F2 as sequence of bool REAL;

     now let x be object;
      assume A16: x in I; then
      reconsider x1=x as Real;
      I c= union rng F by MEASURE7:def 2; then
      consider A be set such that
A17:    x in A & A in rng F by A16,TARSKI:def 4;
      consider n be Element of NAT such that
A18:    A = F.n by A17,FUNCT_2:113;
A19:  dom F2 = NAT by FUNCT_2:def 1;
      F.n <> {+infty} & F.n <> {-infty}
        by A17,A18,TARSKI:def 1; then
      x in F2.n & F2.n in rng F2 by A15,A17,A18,A19,FUNCT_1:3;
      hence x in union rng F2 by TARSKI:def 4;
     end; then
A20:  I c= union(rng F2);

     now let n be Element of NAT;
      per cases;
      suppose F.n = {+infty} or F.n = {-infty};
       hence F2.n is Interval by A15;
      end;
      suppose not (F.n = {+infty} or F.n = {-infty});
       hence F2.n is Interval by A15;
      end;
     end; then
     reconsider F2 as Interval_Covering of I by A20,MEASURE7:def 2;

A21: for n be Element of NAT holds (F vol).n = (F2 vol).n
     proof
      let n be Element of NAT;
      per cases;
      suppose A22: F.n = {+infty} or F.n = {-infty}; then
       diameter(F.n) = sup(F.n) - inf(F.n) by MEASURE5:def 6; then
A23:    diameter(F.n) = sup(F.n) + -inf(F.n) by XXREAL_3:def 4;
       F.n = [.+infty,+infty.] or F.n = [.-infty,-infty.]
         by A22,XXREAL_1:17; then
       (sup(F.n) = +infty & inf(F.n) = +infty)
    or (sup(F.n) = -infty & inf(F.n) = -infty) by XXREAL_2:25,29; then
A24:    (F vol).n = 0 by A23,XXREAL_3:6,MEASURE7:def 4;
       F2.n = {} by A22,A15; then
       diameter(F2.n) = 0 by MEASURE5:def 6;
       hence (F vol).n = (F2 vol).n by A24,MEASURE7:def 4;
      end;
      suppose not(F.n = {+infty} or F.n = {-infty}); then
       F2.n = F.n by A15; then
       (F2 vol).n = diameter(F.n) by MEASURE7:def 4;
       hence (F vol).n = (F2 vol).n by MEASURE7:def 4;
      end;
     end; then
     F vol = F2 vol by FUNCT_2:def 8; then
     vol F2 = SUM(F vol) by MEASURE7:def 6; then
A25:  x = vol F2 by A11,MEASURE7:def 6;

A26:  now assume ex n be Nat st diameter(F2.n) = +infty; then
      consider N be Nat such that
A27:    diameter(F2.N) = +infty;
A28:   N is Element of NAT by ORDINAL1:def 12; then
      (F2 vol).N = +infty by A27,MEASURE7:def 4; then
      SUM(F2 vol) = +infty by A28,SUPINF_2:45,MEASURE7:12; then
      vol F2 = +infty by MEASURE7:def 6;
      hence contradiction by A10,A25,XXREAL_0:3;
     end;

A29:  for n be Element of NAT holds F2.n <> {+infty} & F2.n <> {-infty}
     proof
      let n be Element of NAT;
      now assume A30: F2.n = {+infty} or F2.n = {-infty};
       per cases;
       suppose F.n = {+infty} or F.n = {-infty};
        hence contradiction by A30,A15;
       end;
       suppose not(F.n = {+infty} or F.n = {-infty});
        hence contradiction by A15,A30;
       end;
      end;
      hence thesis;
     end;

     defpred P3[Element of NAT,object] means
      (F2.$1 <> {} implies
        $2 = ].inf(F2.$1) - e/(2|^($1+3)), sup(F2.$1) + e/(2|^($1+3)).[)
    & (F2.$1 = {} implies $2 = ]. -e/(2|^($1+3)), e/(2|^($1+3)).[);

A31:  for n be Element of NAT
      ex A be Element of bool REAL st P3[n,A]
     proof
      let n be Element of NAT;
      per cases;
      suppose A32: F2.n <> {};
       reconsider A = ].inf(F2.n) - e/(2|^(n+3)),sup(F2.n) + e/(2|^(n+3)).[
        as Subset of REAL;
       take A;
       thus thesis by A32;
      end;
      suppose A33: F2.n = {};
       reconsider A = ]. -e/(2|^(n+3)),e/(2|^(n+3)).[
        as Subset of REAL;
       take A;
       thus thesis by A33;
      end;
     end;

     consider FF be Function of NAT,bool REAL such that
A34:   for n be Element of NAT holds P3[n,FF.n] from FUNCT_2:sch 3(A31);

A35:  for n be Element of NAT holds F2.n c= FF.n
     proof
      let n be Element of NAT;
      now let x be ExtReal;
       assume A36: x in F2.n; then
A37:    diameter(F2.n) = sup(F2.n)-inf(F2.n) by MEASURE5:def 6;

A38:    now assume A39: inf(F2.n) = -infty;
        sup(F2.n) <> -infty by A39,XXREAL_2:70,A29;
        hence contradiction by A26,A37,A39,XXREAL_3:14;
       end;

A40:    now assume A41: sup(F2.n) = +infty;
        inf(F2.n) <> +infty by A41,XXREAL_2:70,A29; then
        diameter(F2.n) = +infty by A37,A41,XXREAL_3:13;
        hence contradiction by A26;
       end;

       reconsider ee = e/(2|^(n+3)) as R_eal by XXREAL_0:def 1;

A42:   2|^(n+3) > 0 by NEWTON:83;

       per cases by MEASURE5:1;
       suppose F2.n is open_interval; then
        consider p,q be R_eal such that
A43:      F2.n = ].p,q.[ by MEASURE5:def 2;

        F2.n = ].inf(F2.n),sup(F2.n).[ by A36,A43,XXREAL_2:78; then
A44:     inf(F2.n) < x & x < sup(F2.n) by A36,XXREAL_1:4; then
        inf(F2.n) <> +infty & sup(F2.n) <> -infty by XXREAL_0:3,5; then
        inf(F2.n) in REAL & sup(F2.n) in REAL by A38,A40,XXREAL_0:14; then
        reconsider p1=inf(F2.n),q1=sup(F2.n) as Real;
        p1 - e/(2|^(n+3)) < p1 & q1 < q1 + e/(2|^(n+3))
          by A42,A9,XREAL_1:139,XREAL_1:29,44; then
        inf(F2.n) - ee < inf(F2.n) & sup(F2.n) < sup(F2.n) + ee
          by Lm9,XXREAL_3:def 2; then
        inf(F2.n) - e/(2|^(n+3)) < x & x < sup(F2.n) + e/(2|^(n+3))
          by A44,XXREAL_0:2; then
        x in ].inf(F2.n) - e/(2|^(n+3)),sup(F2.n) + e/(2|^(n+3)).[
          by XXREAL_1:4;
        hence x in FF.n by A34,A36;
       end;
       suppose F2.n is left_open_interval; then
        consider p be R_eal, q be Real such that
A45:      F2.n = ].p,q.] by MEASURE5:def 5;
        p < x & x <= q by A36,A45,XXREAL_1:2; then
        p < q by XXREAL_0:2; then
        F2.n is right_end by A45,XXREAL_2:35; then
        F2.n = ].inf(F2.n),sup(F2.n).] by A45,XXREAL_2:76; then
A46:     inf(F2.n) < x & x <= sup(F2.n) by A36,XXREAL_1:2; then
        inf(F2.n) < sup(F2.n) by XXREAL_0:2; then
        inf(F2.n) <> +infty & sup(F2.n) <> -infty by XXREAL_0:3,5; then
        inf(F2.n) in REAL & sup(F2.n) in REAL by A38,A40,XXREAL_0:14; then
        reconsider p1=inf(F2.n),q1=sup(F2.n) as Real;
        p1 - e/(2|^(n+3)) < p1 & q1 < q1 + e/(2|^(n+3))
          by A42,A9,XREAL_1:139,XREAL_1:29,44; then
        inf(F2.n) - ee < inf(F2.n) & sup(F2.n) < sup(F2.n) + ee
          by Lm9,XXREAL_3:def 2; then
        inf(F2.n) - e/(2|^(n+3)) < x & x < sup(F2.n) + e/(2|^(n+3))
          by A46,XXREAL_0:2; then
        x in ].inf(F2.n) - e/(2|^(n+3)),sup(F2.n) + e/(2|^(n+3)).[
          by XXREAL_1:4;
        hence x in FF.n by A34,A36;
       end;
       suppose F2.n is right_open_interval; then
        consider p be Real, q be R_eal such that
A47:      F2.n = [.p,q.[ by MEASURE5:def 4;
        p <= x & x < q by A36,A47,XXREAL_1:3; then
        p < q by XXREAL_0:2; then
        F2.n is left_end by A47,XXREAL_2:34; then
        F2.n = [.inf(F2.n),sup(F2.n).[ by A47,XXREAL_2:77; then
A48:     inf(F2.n) <= x & x < sup(F2.n) by A36,XXREAL_1:3; then
        inf(F2.n) < sup(F2.n) by XXREAL_0:2; then
        inf(F2.n) <> +infty & sup(F2.n) <> -infty by XXREAL_0:3,5; then
        inf(F2.n) in REAL & sup(F2.n) in REAL by A38,A40,XXREAL_0:14; then
        reconsider p1=inf(F2.n),q1=sup(F2.n) as Real;
        p1 - e/(2|^(n+3)) < p1 & q1 < q1 + e/(2|^(n+3))
          by A42,A9,XREAL_1:139,XREAL_1:29,44; then
        inf(F2.n) - ee < inf(F2.n) & sup(F2.n) < sup(F2.n) + ee
          by Lm9,XXREAL_3:def 2; then
        inf(F2.n) - e/(2|^(n+3)) < x & x < sup(F2.n) + e/(2|^(n+3))
          by A48,XXREAL_0:2; then
        x in ].inf(F2.n) - e/(2|^(n+3)),sup(F2.n) + e/(2|^(n+3)).[
          by XXREAL_1:4;
        hence x in FF.n by A34,A36;
       end;
       suppose F2.n is closed_interval; then
        consider p,q be Real such that
A49:      F2.n = [.p,q.] by MEASURE5:def 3;
        p <= x & x <= q by A36,A49,XXREAL_1:1; then
        p <= q by XXREAL_0:2; then
        F2.n is left_end right_end by A49,XXREAL_2:33; then
        F2.n = [.inf(F2.n),sup(F2.n).] by XXREAL_2:75; then
A50:     inf(F2.n) <= x & x <= sup(F2.n) by A36,XXREAL_1:1; then
        inf(F2.n) <> +infty & sup(F2.n) <> -infty by A38,A40
,XXREAL_0:2,4,6; then
        inf(F2.n) in REAL & sup(F2.n) in REAL by A38,A40,XXREAL_0:14; then
        reconsider p1=inf(F2.n),q1=sup(F2.n) as Real;
        p1 - e/(2|^(n+3)) < p1 & q1 < q1 + e/(2|^(n+3))
          by A42,A9,XREAL_1:139,XREAL_1:29,44; then
        inf(F2.n) - ee < inf(F2.n) & sup(F2.n) < sup(F2.n) + ee
          by Lm9,XXREAL_3:def 2; then
        inf(F2.n) - e/(2|^(n+3)) < x & x < sup(F2.n) + e/(2|^(n+3))
          by A50,XXREAL_0:2; then
        x in ].inf(F2.n) - e/(2|^(n+3)),sup(F2.n) + e/(2|^(n+3)).[
          by XXREAL_1:4;
        hence x in FF.n by A34,A36;
       end;
      end;
      hence F2.n c= FF.n;
     end;
     now let x be object;
      assume A51: x in I; then
      reconsider x1 = x as ExtReal;
      I c= union rng F2 by MEASURE7:def 2; then
      consider A be set such that
A52:    x in A & A in rng F2 by A51,TARSKI:def 4;
      consider n be Element of NAT such that
A53:    A = F2.n by A52,FUNCT_2:113;
A54:   F2.n c= FF.n by A35;
      dom FF = NAT by FUNCT_2:def 1; then
      FF.n in rng FF by FUNCT_1:3;
      hence x in union rng FF by A52,A53,A54,TARSKI:def 4;
     end; then
A55: I c= union rng FF;
A56: for n be Element of NAT holds FF.n is open_interval
     proof
      let n be Element of NAT;
      per cases;
      suppose A57: F2.n <> {};
       reconsider e1 = e/(2|^(n+3)) as R_eal by XXREAL_0:def 1;
       FF.n = ].inf(F2.n) - e1,sup(F2.n) + e1.[ by A57,A34;
       hence FF.n is open_interval by MEASURE5:def 2;
      end;
      suppose F2.n = {}; then
A58:    FF.n = ]. -e/(2|^(n+3)), e/(2|^(n+3)).[ by A34;
       reconsider e1 = e/(2|^(n+3)) as R_eal by XXREAL_0:def 1;
       FF.n = ]. -e1,e1 .[ by A58,XXREAL_3:def 3;
       hence FF.n is open_interval by MEASURE5:def 2;
      end;
     end;
     for n be Element of NAT holds FF.n is Interval
     proof
      let n be Element of NAT;
      FF.n is open_interval by A56;
      hence FF.n is Interval;
     end; then
     reconsider FF as Interval_Covering of I by A55,MEASURE7:def 2;
     reconsider FF as Open_Interval_Covering of I by A56,Def5;
     deffunc F(Nat) = e/2/(2|^($1 + 1));
     consider S be Real_Sequence such that
A59:   for n be Nat holds S.n = F(n) from SEQ_1:sch 1;
     rng S c= ExtREAL by NUMBERS:31; then
     reconsider SS = S as ExtREAL_sequence by FUNCT_2:6;
     S.0 = e/2/(2|^(0+1)) by A59; then
A60:  S.0 = e/2/2 by NEWTON:5;
A61:  |. 1/2 .| < 1 by LIOUVIL1:7;
A62:  for n be Nat holds S.(n+1) = (1/2)*S.n
     proof
      let n be Nat;
A63:   S.(n+1) = e/2/(2|^(n+1+1)) & S.n = e/2/(2|^(n+1)) by A59; then
      S.(n+1) = e/2/(2|^(n+1)*2|^1) by NEWTON:8; then
      S.(n+1) = e/2/(2|^(n+1)*2) by NEWTON:5; then
      S.(n+1) = e/2/(2|^(n+1))/2 by XCMPLX_1:78;
      hence thesis by A63;
     end;
A64:S is summable &
     Sum S = S.0/(1-(1/2)) by A61,A62,SERIES_1:25;
A65: Partial_Sums S is convergent by A61,A62,SERIES_1:25,def 2;
     Partial_Sums S = Partial_Sums SS
     proof
      rng(Partial_Sums S) c= ExtREAL by NUMBERS:31; then
A66:   Partial_Sums S is ExtREAL_sequence by FUNCT_2:6;
      defpred P[Nat] means (Partial_Sums S).$1 = (Partial_Sums SS).$1;
      (Partial_Sums S).0 = SS.0 by SERIES_1:def 1; then
A67:   P[0] by MESFUNC9:def 1;
A68:   for n be Nat st P[n] holds P[n+1]
      proof
       let n be Nat;
       assume A69: P[n];
       (Partial_Sums S).(n+1) = (Partial_Sums S).n + S.(n+1)
         by SERIES_1:def 1; then
       (Partial_Sums S).(n+1) = (Partial_Sums SS).n + SS.(n+1)
         by A69,XXREAL_3:def 2;
       hence P[n+1] by MESFUNC9:def 1;
      end;
      for n be Nat holds P[n] from NAT_1:sch 2(A67,A68); then
      for n be Element of NAT holds
        (Partial_Sums S).n = (Partial_Sums SS).n;
      hence thesis by A66,FUNCT_2:def 8;
     end; then
     lim Partial_Sums SS = lim Partial_Sums S by A65,RINFSUP2:14; then
     Sum SS = lim Partial_Sums S by MESFUNC9:def 3; then
A70: Sum SS = Sum S by SERIES_1:def 3;
     for n be object st n in dom SS holds SS.n >= 0
     proof
      let n be object;
      assume n in dom SS; then
      reconsider n1 = n as Nat;
      SS.n = e/2/(2|^(n1+1)) by A59;
      hence SS.n >= 0 by A9;
     end; then
A71:F2 vol is nonnegative & SS is nonnegative by MEASURE7:12,SUPINF_2:52; then
A72: SUM SS = e/2 by A64,A60,A70,MEASURE8:2;
     for n be Nat holds (FF vol).n = (F2 vol).n + SS.n
     proof
      let n be Nat;
A73:   n is Element of NAT by ORDINAL1:def 12; then
A74:   (FF vol).n = diameter(FF.n) by MEASURE7:def 4;
      reconsider e1 = e/(2|^(n+3)) as R_eal by XXREAL_0:def 1;
A75:   -e1 = -e/(2|^(n+3)) by XXREAL_3:def 3;
A76:  2|^(n+3) > 0 by NEWTON:83; then
A77:   e/(2|^(n+3)) > 0 by A9,XREAL_1:139;
      per cases;
      suppose A78: F2.n = {}; then
       FF.n = ]. -e1, e1 .[ by A75,A73,A34; then
       (FF vol).n = e1 - -e1 by A74,A77,MEASURE5:5; then
       (FF vol).n = e/(2|^(n+3)) - -e/(2|^(n+3)) by A75,Lm9; then
       (FF vol).n = 2 * (e/(2|^(n+2+1))); then
       (FF vol).n = 2 * (e/(2|^(n+2) * 2)) by NEWTON:6; then
A79:    (FF vol).n = 2 * (e/(2|^(n+2))/2) by XCMPLX_1:78;
       diameter(F2.n) = 0 by A78,MEASURE5:def 6; then
A80:    (F2 vol).n = 0 by A73,MEASURE7:def 4;
       SS.n = e/2/(2|^(n+1)) by A59; then
       SS.n = e/(2*(2|^(n+1))) by XCMPLX_1:78; then
       SS.n = e/(2|^(n+1+1)) by NEWTON:6;
       hence (FF vol).n = (F2 vol).n + SS.n by A79,A80,XXREAL_3:4;
      end;
      suppose A81: F2.n <> {}; then
A82:    FF.n = ].inf(F2.n)-e1,sup(F2.n)+e1.[ by A73,A34;
A83:   inf(F2.n) <= sup(F2.n) by A81,XXREAL_2:40;
A84:   diameter(F2.n) = sup(F2.n) - inf(F2.n) by A81,MEASURE5:def 6;
A85:   now assume sup(F2.n) = +infty & inf(F2.n) <> +infty; then
        diameter(F2.n) = +infty by A84,XXREAL_3:13;
        hence contradiction by A26;
       end;
A86:   now assume A87: inf(F2.n) = +infty; then
        sup(F2.n) = +infty by A81,XXREAL_2:40,XXREAL_0:4;
        hence contradiction by A29,A73,A87,XXREAL_2:70;
       end;
       now assume A88: sup(F2.n) = -infty; then
        inf(F2.n) = -infty by A81,XXREAL_2:40,XXREAL_0:6;
        hence contradiction by A29,A73,A88,XXREAL_2:70;
       end; then
       inf(F2.n) <> -infty by A84,XXREAL_3:14,A26; then
       -infty < inf(F2.n) & sup(F2.n) < +infty by A85,A86,XXREAL_0:4,6; then
       inf(F2.n) in REAL & sup(F2.n) in REAL by A83,XXREAL_0:14; then
       reconsider iF = inf(F2.n), sF = sup(F2.n) as Real;
A89:   inf(F2.n)-e1 = iF - e/(2|^(n+3))
     & sup(F2.n)+e1 = sF + e/(2|^(n+3)) by Lm9,XXREAL_3:def 2;
A90:   iF - e/(2|^(n+3)) < iF & sF < sF + e/(2|^(n+3))
         by A76,A9,XREAL_1:139,XREAL_1:29,44; then
       iF - e/(2|^(n+3)) < sF by A83,XXREAL_0:2; then
       inf(F2.n)-e1 < sup(F2.n)+e1 by A89,A90,XXREAL_0:2; then
       diameter(FF.n) = (sup(F2.n)+e1) - (inf(F2.n)-e1) by A82,MEASURE5:5; then
       diameter(FF.n) = (sF+e/(2|^(n+3)))-(iF - e/(2|^(n+3)))
         by A89,Lm9; then
       diameter(FF.n) = sF - iF + ( 2 * (e/(2|^(n+2+1))) ); then
       diameter(FF.n) = sF - iF + ( 2 * (e/(2|^(n+2)*2)) ) by NEWTON:6; then
       diameter(FF.n) = sF - iF + ( 2 * (e/(2|^(n+2))/2) ) by XCMPLX_1:78; then
A91:   (FF vol).n = sF - iF + e/(2|^(n+2)) by A73,MEASURE7:def 4;
       SS.n = e/2/(2|^(n+1)) by A59; then
       SS.n = e/(2*(2|^(n+1))) by XCMPLX_1:78; then
A92:   SS.n = e/(2|^(n+1+1)) by NEWTON:6;
       diameter(F2.n) = sF - iF by A84,Lm9; then
       (F2 vol).n = sF - iF by A73,MEASURE7:def 4;
       hence (FF vol).n = (F2 vol).n + SS.n by A92,A91,XXREAL_3:def 2;
      end;
     end; then
A93: SUM(FF vol) = SUM(F2 vol) + SUM SS by A71,MEASURE8:3;
     SUM(F vol) = vol F & SUM(FF vol) = vol FF by MEASURE7:def 6; then
A94:  vol FF = x + e/2 by A21,A11,A93,A72,FUNCT_2:def 8;
     reconsider I1 = I as Subset of R^1 by TOPMETR:17;
A95: I1 is compact by A2,Th24;
     reconsider F1 = rng FF as Subset-Family of R^1 by TOPMETR:17;
     I1 c= union rng FF by MEASURE7:def 2; then
     consider F2 be Subset-Family of R^1 such that
A96:  F2 c= F1 & F2 is Cover of I1 &
      for C be set st C in F2 holds C meets I1
        by SETFAM_1:def 11,BORSUK_1:22;
     for P be Subset of R^1 st P in F1 holds P is open
     proof
      let P be Subset of R^1;
      assume P in F1; then
      consider n be Element of NAT such that
A97:   P = FF.n by FUNCT_2:113;
      ex p,q be R_eal st P = ].p,q.[ by A97,MEASURE5:def 2;
      hence P is open by BORSUK_5:40;
     end; then
     for P be Subset of R^1 st P in F2 holds P is open by A96; then
     consider G1 be Subset-Family of R^1 such that
A98:  G1 c= F2 & G1 is Cover of I1 & G1 is finite
        by A95,A96,COMPTS_1:def 4,TOPS_2:def 1;
     reconsider G1 as finite set by A98;
     now let A be set;
      assume A in rng(canFS G1); then
      A in F1 by A96,A98;
      hence A in bool REAL;
     end; then
     rng (canFS G1) c= bool REAL; then
     reconsider GG= canFS G1 as FinSequence of bool REAL by FINSEQ_1:def 4;
     I c= union G1 by A98,SETFAM_1:def 11; then
     I c= Union GG by ZFMISC_1:2,SRINGS_3:2; then
A99: I c= union rng GG by CARD_3:def 4;
     deffunc F(Nat) = diameter(GG.$1);
     consider G2 be FinSequence of ExtREAL such that
A100:  len G2 = len GG
    & for n be Nat st n in dom G2 holds G2.n = F(n) from FINSEQ_2:sch 1;
A101: dom GG = dom G2 by A100,FINSEQ_3:29;
A102: now let n be Nat;
      per cases;
      suppose n in dom GG;
       hence G2.n = diameter(GG.n) by A100,A101;
      end;
      suppose A103: not n in dom GG; then
       G2.n = 0 by A101,FUNCT_1:def 2;
       hence G2.n = diameter(GG.n) by A103,FUNCT_1:def 2,MEASURE5:10;
      end;
     end;
A104: for n be Nat st n in dom GG holds I meets GG.n
     proof
      let n be Nat;
      assume n in dom GG; then
      GG.n in rng(canFS G1) by FUNCT_1:3;
      hence thesis by A96,A98;
     end;
     for n be Nat st n in dom GG holds GG.n is open_interval Subset of REAL
     proof
      let n be Nat;
      assume n in dom GG; then
      GG.n in rng(canFS G1) by FUNCT_1:3; then
      GG.n in G1; then
      ex k be Element of NAT st GG.n = FF.k by A96,A98,FUNCT_2:113;
      hence GG.n is open_interval Subset of REAL;
     end; then
A105: DI <= Sum G2 by A1,A99,A100,A101,A104,Th45;
     rng (canFS G1) c= rng FF by A96,A98; then
     Sum G2 <= x + e/2 by A94,A1,A101,A102,Th56; then
A106:  DI <= x + e/2 by A105,XXREAL_0:2;
     reconsider e2 = e/2 as ExtReal;
A107: e/2 in REAL by XREAL_0:def 1;
A108: inf Svc I + e/2 + e/2 = inf Svc I + (e2 + e2) by XXREAL_3:29
     .= inf Svc I + (e/2 + e/2) by XXREAL_3:def 2;
     x + e/2 < inf Svc I + e/2 + e/2 by A107,A10,XXREAL_3:43; then
     DI < inf Svc I + (e/2 + e/2) by A108,A106,XXREAL_0:2; then
     DI < OS_Meas.I + e by MEASURE7:def 10;
     hence DI <= LI + e by XXREAL_3:def 2;
    end;
    hence thesis by XREAL_1:41;
end;

Lm15:
for I be Element of Family_of_Intervals st
 I is non empty open_interval & diameter I < +infty holds
 diameter I <= OS_Meas.I
proof
    let I be Element of Family_of_Intervals;
    assume that
A1:  I is non empty open_interval and
A2:  diameter I < +infty;
    0 <= diameter I by A1,MEASURE5:13; then
    diameter I in REAL by A2,XXREAL_0:14; then
    reconsider DI = diameter I as Real;
A3: OS_Meas.I <= diameter I by A1,Th44;
    OS_Meas is nonnegative by MEASURE4:def 1; then
    -infty < 0 & 0 <= OS_Meas.I by SUPINF_2:51; then
    OS_Meas.I in REAL by A2,A3,XXREAL_0:14; then
    reconsider LI = OS_Meas.I as Real;
    consider a1,a2 be R_eal such that
A4:  I = ].a1,a2.[ by A1,MEASURE5:def 2;
A5: a2 <> -infty & a1 <> +infty by A1,A4,XXREAL_1:28,XXREAL_0:3,5; then
A6: -a1 <> -infty by XXREAL_3:23;
A7: now assume a1 = -infty; then
     diameter I = a2 - -infty by A1,A4,XXREAL_1:28,MEASURE5:5; then
     diameter I = a2 + +infty by XXREAL_3:5,def 4;
     hence contradiction by A2,A5,XXREAL_3:def 2;
    end;
A8: now assume a2 = +infty; then
     diameter I = +infty - a1 by A1,A4,XXREAL_1:28,MEASURE5:5; then
     diameter I = +infty + (-a1) by XXREAL_3:def 4;
     hence contradiction by A2,A6,XXREAL_3:def 2;
    end;
    a1 <> +infty & a2 <> -infty by A1,A4,XXREAL_1:28,XXREAL_0:3,5; then
    a1 in REAL & a2 in REAL by A7,A8,XXREAL_0:14; then
    reconsider r1 = a1, r2 = a2 as Real;
    DI = a2 - a1 by A1,A4,XXREAL_1:28,MEASURE5:5; then
A9: DI = r2 - r1 by Lm9; then
    0 < DI by A1,A4,XXREAL_1:28,XREAL_1:50; then
A10:DI/2 < DI & 0 < DI/2 by XREAL_1:215,216;
    for e be Real st 0 < e holds DI <= LI + e
    proof
     let e be Real;
     assume A11: 0 < e;
     set e1 = min(DI/2,e);
     e1 > 0 by A10,A11,XXREAL_0:21; then
A12: r1 < r1 + e1/2 & r2 - e1/2 < r2 by XREAL_1:29,44,215;
     e1 <= DI/2 & e1 <= e by XXREAL_0:17; then
A13: e1 < DI by A10,XXREAL_0:2;
A14: (r2 - e1/2) - (r1+e1/2) = DI - e1 by A9; then
     (r2 - e1/2) - (r1+e1/2) > 0 by A13,XREAL_1:50; then
A15: r1+e1/2 < r2-e1/2 by XREAL_1:47;
     set J = [. r1+e1/2,r2-e1/2 .];
     reconsider J as non empty closed_interval Subset of REAL
       by A15,MEASURE5:14;
     reconsider j1=r1+e1/2, j2=r2-e1/2 as R_eal by XXREAL_0:def 1;
A16: diameter J = j2 - j1 by A15,MEASURE5:6; then
     reconsider DJ = diameter J as Real;
     diameter J = DI - e1 by A14,A16,Lm9; then
     DI = DJ + e1; then
A17: DI <= DJ + e by XXREAL_0:17,XREAL_1:6;
     J in the set of all I where I is Interval; then
A18: diameter J <= OS_Meas.J by Lm14,MEASUR10:def 1;
     J c= I by A4,A12,XXREAL_1:47; then
     OS_Meas.J <= LI by MEASURE4:def 1; then
     DJ <= LI by A18,XXREAL_0:2; then
     DJ + e <= LI + e by XREAL_1:6;
     hence DI <= LI + e by A17,XXREAL_0:2;
    end;
    hence diameter I <= OS_Meas.I by XREAL_1:41;
end;

Lm16:
for I be Element of Family_of_Intervals st
 I is non empty left_open_interval & diameter I < +infty holds
 diameter I <= OS_Meas.I
proof
    let I be Element of Family_of_Intervals;
    assume that
A1:  I is non empty left_open_interval and
A2:  diameter I < +infty;
    0 <= diameter I by A1,MEASURE5:13; then
    diameter I in REAL by A2,XXREAL_0:14; then
    reconsider DI = diameter I as Real;
A3: OS_Meas.I <= diameter I by A1,Th44;
    OS_Meas is nonnegative by MEASURE4:def 1; then
    -infty < 0 & 0 <= OS_Meas.I by SUPINF_2:51; then
    OS_Meas.I in REAL by A2,A3,XXREAL_0:14; then
    reconsider LI = OS_Meas.I as Real;
    consider a1 be R_eal,r2 be Real such that
A4:  I = ].a1,r2.] by A1,MEASURE5:def 5;
    reconsider a2 = r2 as R_eal by XXREAL_0:def 1;
A5: now assume a1 = -infty; then
     diameter I = a2 - -infty by A1,A4,XXREAL_1:26,MEASURE5:8; then
     diameter I = r2 + +infty by XXREAL_3:5,def 4;
     hence contradiction by A2,XXREAL_3:def 2;
    end;
    a1 <> +infty by A1,A4,XXREAL_1:26,XXREAL_0:3; then
    a1 in REAL by A5,XXREAL_0:14; then
    reconsider r1 = a1 as Real;
    DI = a2 - a1 by A1,A4,XXREAL_1:26,MEASURE5:8; then
A6: DI = r2 - r1 by Lm9; then
    0 < DI by A1,A4,XXREAL_1:26,XREAL_1:50; then
A7: DI/2 < DI & 0 < DI/2 by XREAL_1:215,216;
    for e be Real st 0 < e holds DI <= LI + e
    proof
     let e be Real;
     assume A8: 0 < e;
     set e1 = min(DI/2,e);
     e1 > 0 by A7,A8,XXREAL_0:21; then
A9:  r1 < r1 + e1/2 & r2 - e1/2 < r2 by XREAL_1:29,44,215;
     e1 <= DI/2 & e1 <= e by XXREAL_0:17; then
A10: e1 < DI by A7,XXREAL_0:2;
     set J = [. r1+e1/2,r2-e1/2 .];
     (r2 - e1/2) - (r1+e1/2) = DI - e1 by A6; then
     (r2 - e1/2) - (r1+e1/2) > 0 by A10,XREAL_1:50; then
A11: r1+e1/2 < r2-e1/2 by XREAL_1:47; then
     reconsider J as non empty closed_interval Subset of REAL
       by MEASURE5:14;
     reconsider j1=r1+e1/2, j2=r2-e1/2 as R_eal by XXREAL_0:def 1;
A12: diameter J = j2 - j1 by A11,MEASURE5:6; then
     reconsider DJ = diameter J as Real;
     diameter J = (r2-e1/2) - (r1+e1/2) by A12,Lm9; then
     DI = DJ + e1 by A6; then
A13: DI <= DJ + e by XXREAL_0:17,XREAL_1:6;
     J in the set of all I where I is Interval; then
A14: diameter J <= OS_Meas.J by Lm14,MEASUR10:def 1;
     J c= I by A4,A9,XXREAL_1:39; then
     OS_Meas.J <= LI by MEASURE4:def 1; then
     DJ <= LI by A14,XXREAL_0:2; then
     DJ + e <= LI + e by XREAL_1:6;
     hence DI <= LI + e by A13,XXREAL_0:2;
    end;
    hence diameter I <= OS_Meas.I by XREAL_1:41;
end;

Lm17:
for I be Element of Family_of_Intervals st
 I is non empty right_open_interval & diameter I < +infty holds
 diameter I <= OS_Meas.I
proof
    let I be Element of Family_of_Intervals;
    assume that
A1: I is non empty right_open_interval and
A2: diameter I < +infty;
    0 <= diameter I by A1,MEASURE5:13; then
    diameter I in REAL by A2,XXREAL_0:14; then
    reconsider DI = diameter I as Real;
A3: OS_Meas.I <= diameter I by A1,Th44;
    OS_Meas is nonnegative by MEASURE4:def 1; then
    -infty < 0 & 0 <= OS_Meas.I by SUPINF_2:51; then
    OS_Meas.I in REAL by A2,A3,XXREAL_0:14; then
    reconsider LI = OS_Meas.I as Real;
    consider r1 be Real, a2 be R_eal such that
A4:  I = [.r1,a2.[ by A1,MEASURE5:def 4;
    reconsider a1 = r1 as R_eal by XXREAL_0:def 1;
A5: now assume a2 = +infty; then
     diameter I = +infty - a1 by A1,A4,XXREAL_1:27,MEASURE5:7; then
     diameter I = +infty + (-a1) by XXREAL_3:def 4;
     hence contradiction by A2,XXREAL_3:def 2;
    end;
    a2 <> -infty by A1,A4,XXREAL_1:27,XXREAL_0:5; then
    a2 in REAL by A5,XXREAL_0:14; then
    reconsider r2 = a2 as Real;
    DI = a2 - a1 by A1,A4,XXREAL_1:27,MEASURE5:7; then
A6: DI = r2 - r1 by Lm9; then
    0 < DI by A1,A4,XXREAL_1:27,XREAL_1:50; then
A7: DI/2 < DI & 0 < DI/2 by XREAL_1:215,216;
    for e be Real st 0 < e holds DI <= LI + e
    proof
     let e be Real;
     assume A8: 0 < e;
     set e1 = min(DI/2,e);
A9: e1 > 0 by A7,A8,XXREAL_0:21;
     e1 <= DI/2 & e1 <= e by XXREAL_0:17; then
A10: e1 < DI by A7,XXREAL_0:2;
     set J = [. r1+e1/2,r2-e1/2 .];
     (r2 - e1/2) - (r1+e1/2) = DI - e1 by A6; then
     (r2 - e1/2) - (r1+e1/2) > 0 by A10,XREAL_1:50; then
A11: r1+e1/2 < r2-e1/2 by XREAL_1:47; then
     reconsider J as non empty closed_interval Subset of REAL
       by MEASURE5:14;
     reconsider j1=r1+e1/2, j2=r2-e1/2 as R_eal by XXREAL_0:def 1;
A12: diameter J = j2 - j1 by A11,MEASURE5:6; then
     reconsider DJ = diameter J as Real;
     diameter J = (r2-e1/2) - (r1+e1/2) by A12,Lm9; then
     DI = DJ + e1 by A6; then
A13: DI <= DJ + e by XXREAL_0:17,XREAL_1:6;
     J in the set of all I where I is Interval; then
A14: diameter J <= OS_Meas.J by Lm14,MEASUR10:def 1;
     r1 < r1 + e1/2 & r2 - e1/2 < r2 by A9,XREAL_1:29,44,215; then
     J c= I by A4,XXREAL_1:43; then
     OS_Meas.J <= LI by MEASURE4:def 1; then
     DJ <= LI by A14,XXREAL_0:2; then
     DJ + e <= LI + e by XREAL_1:6;
     hence DI <= LI + e by A13,XXREAL_0:2;
    end;
    hence diameter I <= OS_Meas.I by XREAL_1:41;
end;

Lm18:
for a,b be Real st a <= b holds diameter [.a,b.] = b - a
proof
    let a,b be Real;
    reconsider a1 = a, b1 = b as R_eal by XXREAL_0:def 1;
    assume a <= b; then
    diameter [.a,b.] = b1 - a1 by MEASURE5:6;
    hence thesis by Lm9;
end;

Lm19:
for I be Element of Family_of_Intervals st
 diameter I = +infty holds sup I = +infty or inf I = -infty
proof
    let I be Element of Family_of_Intervals;
    assume A1: diameter I = +infty;
    now assume sup I <> +infty & inf I <> -infty; then
     sup I - inf I <> +infty by XXREAL_3:18;
     hence contradiction by A1,MEASURE5:def 6;
    end;
    hence thesis;
end;

Lm20:
for I be non empty closed_interval Subset of REAL
  holds diameter I = OS_Meas.I
proof
    let I be non empty closed_interval Subset of REAL;
    I in the set of all I where I is Interval; then
    OS_Meas.I <= diameter I &
    diameter I <= OS_Meas.I by Th44,Lm14,MEASUR10:def 1;
    hence diameter I = OS_Meas.I by XXREAL_0:1;
end;

Lm21:
for I be Element of Family_of_Intervals st
 diameter I = +infty holds diameter I <= OS_Meas.I
proof
    let I be Element of Family_of_Intervals;
    assume A1: diameter I = +infty;
A2: now assume inf I = sup I; then
     diameter I = sup I - sup I by A1,MEASURE5:def 6; then
     diameter I = sup I + -sup I by XXREAL_3:def 4;
     hence contradiction by A1,XXREAL_3:7;
    end;
    I in the set of all I where I is Interval by MEASUR10:def 1; then
A3: ex L be Interval st I = L;
A4: for R be Real holds R <= OS_Meas.I
    proof
     let R be Real;
     per cases;
     suppose A5: R <= 0;
      OS_Meas is nonnegative by MEASURE4:def 1;
      hence R <= OS_Meas.I by A5,SUPINF_2:51;
      end;
     suppose A6: R > 0;
      ex J be non empty closed_interval Subset of REAL st
       R = OS_Meas.J & J c= I
      proof
       per cases by A1,Lm19;
       suppose A7: sup I = +infty & inf I = -infty;
        reconsider J = [.0,R.] as non empty closed_interval Subset of REAL
          by A6,MEASURE5:14;
        take J;
A8:     now let r be Real;
         assume r in J;
         inf I < r & r < sup I by A7,XXREAL_0:4,6;
         hence r in I by A3,XXREAL_2:83;
        end;
        diameter J = R - 0 by A6,Lm18;
        hence thesis by A8,Lm20;
       end;
       suppose A9: sup I = +infty & inf I <> -infty; then
        inf I in REAL by A2,XXREAL_0:14; then
        reconsider r = inf I as Real;
A10:    r < r+1 & r+1 < r+1+R by A6,XREAL_1:29; then
        reconsider J = [.r+1,r+1+R.] as non empty closed_interval
         Subset of REAL by MEASURE5:14;
        take J;
A11:    now let p be Real;
         assume p in J; then
         r+1 <= p <= r+1+R by XXREAL_1:1; then
         inf I < p & p < sup I by A9,A10,XXREAL_0:2,4;
         hence p in I by A3,XXREAL_2:83;
        end;
        diameter J = (r+1+R)-(r+1) by A10,Lm18;
        hence thesis by A11,Lm20;
       end;
       suppose A12: sup I <> +infty & inf I = -infty; then
        sup I in REAL by A2,XXREAL_0:14; then
        reconsider r = sup I as Real;
A13:    r-1-R < r-1 < r by A6,XREAL_1:44; then
        reconsider J = [.r-1-R,r-1 .] as non empty closed_interval
         Subset of REAL by MEASURE5:14;
        take J;
A14:    now let p be Real;
         assume p in J; then
         r-1-R <= p <= r-1 by XXREAL_1:1; then
         inf I < p & p < sup I by A12,A13,XXREAL_0:2,6;
         hence p in I by A3,XXREAL_2:83;
        end;
        diameter J = (r-1)-(r-1-R) by A13,Lm18 .= R;
        hence thesis by A14,Lm20;
       end;
      end;
      hence R <= OS_Meas.I by MEASURE4:def 1;
     end;
    end;
    now assume A15: OS_Meas.I <> +infty;
     OS_Meas is nonnegative by MEASURE4:def 1; then
     OS_Meas.I >= 0 by SUPINF_2:51; then
     OS_Meas.I in REAL by A15,XXREAL_0:14; then
     reconsider R0 = OS_Meas.I as Real;
     R0 < R0 + 1 by XREAL_1:29;
     hence contradiction by A4;
    end;
    hence diameter I <= OS_Meas.I by A1;
end;

Lm22:
for I be Interval holds diameter I <= OS_Meas.I
proof
    let I be Interval;
A1: I in the set of all I where I is Interval;
    per cases;
    suppose A2: I = {};
     OS_Meas is zeroed by MEASURE4:def 1; then
     OS_Meas.I = 0 by A2,VALUED_0:def 19;
     hence diameter I <= OS_Meas.I by A2,MEASURE5:def 6;
    end;
    suppose I <> {} & diameter I = +infty;
     hence diameter I <= OS_Meas.I
      by A1,Lm21,MEASUR10:def 1;
    end;
    suppose A3: I <> {} & diameter I <> +infty;
     I is open_interval or I is closed_interval or
     I is right_open_interval or I is left_open_interval by MEASURE5:1;
     hence diameter I <= OS_Meas.I
       by A1,A3,Lm15,Lm16,Lm17,Lm20,XXREAL_0:4,MEASUR10:def 1;
    end;
end;

theorem Th57:
  for I be Interval holds diameter I = OS_Meas.I
proof
    let I be Interval;
    I in the set of all I where I is Interval; then
    OS_Meas.I <= diameter I &
    diameter I <= OS_Meas.I by Th44,Lm22,MEASUR10:def 1;
    hence thesis by XXREAL_0:1;
end;

begin :: Construction of the one-dimensional Lebesque measure

definition
  let F be FinSequence of Family_of_Intervals;
  let n be Nat;
  redefine func F.n -> interval Subset of REAL;  :: redefines . (FUNCT_1, definition)
  correctness
  proof
    per cases;
    suppose n in dom F; then
     F.n in Family_of_Intervals by PARTFUN1:4; then
     ex I be Interval st F.n = I by MEASUR10:def 1;
     hence F.n is interval Subset of REAL;
    end;
    suppose not n in dom F; then
     F.n = {} & {} c= REAL by FUNCT_1:def 2;
     hence F.n is interval Subset of REAL;
    end;
   end;
end;

definition
  func pre-Meas -> nonnegative zeroed Function of Family_of_Intervals,ExtREAL
   equals OS_Meas|Family_of_Intervals;
  correctness
  proof
   set IT = OS_Meas|Family_of_Intervals;
A1:OS_Meas is nonnegative zeroed by MEASURE4:def 1;
   reconsider IT as Function of Family_of_Intervals,ExtREAL by FUNCT_2:32;
A2:dom IT = Family_of_Intervals by FUNCT_2:def 1;
A3:now let x be Element of Family_of_Intervals;
    IT.x = OS_Meas.x by A2,FUNCT_1:47;
    hence IT.x >= 0 by A1,MEASURE1:def 2;
   end;
   IT.{} = OS_Meas.{} by A2,SETFAM_1:def 8,FUNCT_1:47; then
   IT.{} = 0 by A1,VALUED_0:def 19;
   hence thesis by A3,VALUED_0:def 19,MEASURE1:def 2;
  end;
end;

theorem Th58:
  for I be Element of Family_of_Intervals holds pre-Meas.I = diameter I
proof
    let I be Element of Family_of_Intervals;
    I in the set of all J where J is Interval by MEASUR10:def 1; then
A1: ex J be Interval st I = J;
    pre-Meas.I = OS_Meas.I by FUNCT_1:49;
    hence pre-Meas.I = diameter I by A1,Th57;
end;

theorem Th59:
  for I be Interval holds pre-Meas.I = diameter I
proof
    let I be Interval;
    I in the set of all J where J is Interval;
    hence thesis by Th58,MEASUR10:def 1;
end;

theorem Th60:
  for A,B be Element of Family_of_Intervals
   st A misses B & A \/ B is Interval
     holds pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
proof
    let A,B be Element of Family_of_Intervals;
    assume that
A1:  A misses B and
A2:  A \/ B is Interval;
    A in the set of all I where I is Interval by MEASUR10:def 1; then
A3: ex I be Interval st A = I;
    B in the set of all I where I is Interval by MEASUR10:def 1; then
A4: ex I be Interval st B = I;
    per cases;
    suppose A5: A = {}; then
     pre-Meas.A = 0 by Th58,MEASURE5:10;
     hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B by A5,XXREAL_3:4;
    end;
    suppose A6: B = {}; then
     pre-Meas.B = 0 by Th58,MEASURE5:10;
     hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B by A6,XXREAL_3:4;
    end;
    suppose A7: A <> {} & B <> {};
      per cases by A3,MEASURE5:1;
      suppose A is closed_interval; then
A8:    A = [.inf A,sup A.] by A7,MEASURE6:17;
       inf A <= sup A by A7,A8,XXREAL_1:29; then
A9:   A is left_end right_end by A8,XXREAL_2:33;
A10:   now assume B is closed_interval; then
        B = [.inf B,sup B.] by A7,MEASURE6:17;
        hence contradiction by A1,A2,A7,A8,Th14;
       end;
       per cases by A4,A10,MEASURE5:1;
       suppose B is right_open_interval; then
        B = [.inf B,sup B.[ by A7,MEASURE6:18; then
A11:    inf A = sup B & A \/ B = [.inf B,sup A.]
          by A1,A2,A7,A8,Th15; then
A12:    sup(A \/ B) = sup A & inf(A \/ B) = inf B
          by A7,XXREAL_1:29,MEASURE6:10,14;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A13:    pre-Meas.(A \/ B) = sup A - inf B by A7,A12,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A13,A9,A11,XXREAL_3:34;
       end;
       suppose B is left_open_interval; then
        B = ].inf B,sup B.] by A7,MEASURE6:19; then
A14:    sup A = inf B & A \/ B = [.inf A,sup B.]
          by A1,A2,A7,A8,Th16; then
A15:    sup(A \/ B) = sup B & inf(A \/ B) = inf A
          by A7,XXREAL_1:29,MEASURE6:10,14;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A16:    pre-Meas.(A \/ B) = sup B - inf A by A7,A15,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A16,A9,A14,XXREAL_3:34;
       end;
       suppose B is open_interval; then
A17:    B = ].inf B,sup B.[ by A7,MEASURE6:16;
        per cases by A1,A2,A7,A8,A17,Th17;
        suppose
A18:     inf A = sup B & A \/ B = ].inf B,sup A.]; then
         inf B <= sup A by A7,XXREAL_1:26; then
A19:     sup(A \/ B) = sup A & inf(A \/ B) = inf B by A18,A7,MEASURE6:9,13;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A20:     pre-Meas.(A \/ B) = sup A - inf B by A7,A19,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A20,A9,A18,XXREAL_3:34;
        end;
        suppose
A21:     inf B = sup A & A \/ B = [.inf A,sup B.[; then
         inf A <= sup B by A7,XXREAL_1:27; then
A22:     sup(A \/ B) = sup B & inf(A \/ B) = inf A by A21,A7,MEASURE6:11,15;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A23:     pre-Meas.(A \/ B) = sup B - inf A by A7,A22,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A23,A9,A21,XXREAL_3:34;
        end;
       end;
      end;
      suppose A is right_open_interval; then
A24:    A = [.inf A,sup A.[ by A7,MEASURE6:18;
A25:   A is left_end by A7,A24,XXREAL_1:27,XXREAL_2:34;
A26:   now assume B is left_open_interval; then
        B = ].inf B,sup B.] by A7,MEASURE6:19;
        hence contradiction by A1,A2,A7,A24,Th19;
       end;
       per cases by A4,A26,MEASURE5:1;
       suppose B is closed_interval; then
A27:    B = [.inf B,sup B.] by A7,MEASURE6:17; then
A28:    inf B = sup A & A \/ B = [.inf A,sup B.]
          by A1,A2,A7,A24,Th15;
        inf B <= sup B by A7,A27,XXREAL_1:29; then
A29:    B is left_end right_end by A27,XXREAL_2:33;
A30:    sup(A \/ B) = sup B & inf(A \/ B) = inf A
          by A28,A7,XXREAL_1:29,MEASURE6:10,14;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A31:    pre-Meas.(A \/ B) = sup B - inf A by A7,A30,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A31,A29,A28,XXREAL_3:34;
       end;
       suppose B is right_open_interval; then
A32:    B = [.inf B,sup B.[ by A7,MEASURE6:18;
        per cases by A1,A2,A7,A24,A32,Th18;
        suppose
A33:     inf A = sup B & A \/ B = [.inf B,sup A.[; then
         inf B <= sup A by A7,XXREAL_1:27; then
A34:     sup(A \/ B) = sup A & inf(A \/ B) = inf B by A33,A7,MEASURE6:11,15;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A35:     pre-Meas.(A \/ B) = sup A - inf B by A7,A34,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A35,A25,A33,XXREAL_3:34;
        end;
        suppose
A36:     inf B = sup A & A \/ B = [.inf A,sup B.[;
A37:     B is left_end by A7,A32,XXREAL_1:27,XXREAL_2:34;
         inf A <= sup B by A36,A7,XXREAL_1:27; then
A38:     sup(A \/ B) = sup B & inf(A \/ B) = inf A by A36,A7,MEASURE6:11,15;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A39:     pre-Meas.(A \/ B) = sup B - inf A by A7,A38,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A39,A37,A36,XXREAL_3:34;
        end;
       end;
       suppose B is open_interval; then
        B = ].inf B,sup B.[ by A7,MEASURE6:16; then
A40:    sup B = inf A & A \/ B = ].inf B,sup A.[
          by A1,A2,A7,A24,Th20; then
        inf B <= sup A by A7,XXREAL_1:28; then
A41:    sup(A \/ B) = sup A & inf(A \/ B) = inf B by A40,A7,MEASURE6:8,12;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A42:    pre-Meas.(A \/ B) = sup A - inf B by A7,A41,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A42,A25,A40,XXREAL_3:34;
       end;
      end;
      suppose A is left_open_interval; then
A43:    A = ].inf A,sup A.] by A7,MEASURE6:19;
A44:   A is right_end by A7,A43,XXREAL_1:26,XXREAL_2:35;
A45:   now assume B is right_open_interval; then
        B = [.inf B,sup B.[ by A7,MEASURE6:18;
        hence contradiction by A1,A2,A7,A43,Th19;
       end;
       per cases by A4,A45,MEASURE5:1;
       suppose B is closed_interval; then
A46:    B = [.inf B,sup B.] by A7,MEASURE6:17;
        inf B <= sup B by A7,A46,XXREAL_1:29; then
A47:    B is left_end right_end by A46,XXREAL_2:33;
A48:    inf A = sup B & A \/ B = [.inf B,sup A.]
          by A1,A2,A7,A43,A46,Th16; then
A49:    sup(A \/ B) = sup A & inf(A \/ B) = inf B
          by A7,XXREAL_1:29,MEASURE6:10,14;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A50:    pre-Meas.(A \/ B) = sup A - inf B by A7,A49,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A50,A47,A48,XXREAL_3:34;
       end;
       suppose B is left_open_interval; then
A51:    B = ].inf B,sup B.] by A7,MEASURE6:19;
A52:    B is right_end by A7,A51,XXREAL_1:26,XXREAL_2:35;
        per cases by A1,A2,A7,A43,A51,Th21;
        suppose
A53:     inf A = sup B & A \/ B = ].inf B,sup A.]; then
         inf B <= sup A by A7,XXREAL_1:26; then
A54:     sup(A \/ B) = sup A & inf(A \/ B) = inf B by A53,A7,MEASURE6:9,13;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A55:     pre-Meas.(A \/ B) = sup A - inf B by A7,A54,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A55,A52,A53,XXREAL_3:34;
        end;
        suppose
A56:     inf B = sup A & A \/ B = ].inf A,sup B.]; then
         inf A <= sup B by A7,XXREAL_1:26; then
A57:     sup(A \/ B) = sup B & inf(A \/ B) = inf A by A56,A7,MEASURE6:9,13;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A58:     pre-Meas.(A \/ B) = sup B - inf A by A7,A57,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A58,A44,A56,XXREAL_3:34;
        end;
       end;
       suppose B is open_interval; then
         B = ].inf B,sup B.[ by A7,MEASURE6:16; then
A60:    inf B = sup A & A \/ B = ].inf A,sup B.[
          by A1,A2,A7,A43,Th22; then
        inf A <= sup B by A7,XXREAL_1:28; then
A61:    sup(A \/ B) = sup B & inf(A \/ B) = inf A by A60,A7,MEASURE6:8,12;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A62:    pre-Meas.(A \/ B) = sup B - inf A by A7,A61,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A62,A44,A60,XXREAL_3:34;
       end;
      end;
      suppose A is open_interval; then
A63:    A = ].inf A,sup A.[ by A7,MEASURE6:16;
A64:   now assume B is open_interval; then
        B = ].inf B,sup B.[ by A7,MEASURE6:16;
        hence contradiction by A1,A2,A7,A63,Th23;
       end;
       per cases by A4,A64,MEASURE5:1;
       suppose B is closed_interval; then
A65:    B = [.inf B,sup B.] by A7,MEASURE6:17;
        inf B <= sup B by A7,A65,XXREAL_1:29; then
A66:    B is left_end right_end by A65,XXREAL_2:33;
        per cases by A1,A2,A7,A63,A65,Th17;
        suppose
A67:     inf A = sup B & A \/ B = [.inf B,sup A.[; then
         inf B <= sup A by A7,XXREAL_1:27; then
A68:     sup(A \/ B) = sup A & inf(A \/ B) = inf B by A67,A7,MEASURE6:11,15;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A69:     pre-Meas.(A \/ B) = sup A - inf B by A7,A68,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A69,A67,A66,XXREAL_3:34;
        end;
        suppose
A70:     inf B = sup A & A \/ B = ].inf A,sup B.]; then
         inf A <= sup B by A7,XXREAL_1:26; then
A71:     sup(A \/ B) = sup B & inf(A \/ B) = inf A by A70,A7,MEASURE6:9,13;
         pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A72:     pre-Meas.(A \/ B) = sup B - inf A by A7,A71,MEASURE5:def 6;
         pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
         pre-Meas.A = sup A - inf A
       & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
         hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
           by A72,A70,A66,XXREAL_3:34;
        end;
       end;
       suppose B is left_open_interval; then
A73:    B = ].inf B,sup B.] by A7,MEASURE6:19;
A74:    sup B = inf A & A \/ B = ].inf B,sup A.[
          by A1,A2,A7,A63,A73,Th22; then
        inf B <= sup A by A7,XXREAL_1:28; then
A75:    sup(A \/ B) = sup A & inf(A \/ B) = inf B by A74,A7,MEASURE6:8,12;
A76:    B is right_end by A7,A73,XXREAL_1:26,XXREAL_2:35;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A77:    pre-Meas.(A \/ B) = sup A - inf B by A7,A75,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A77,A74,A76,XXREAL_3:34;
       end;
       suppose B is right_open_interval; then
A78:    B = [.inf B,sup B.[ by A7,MEASURE6:18; then
A79:    sup A = inf B & A \/ B = ].inf A,sup B.[
          by A1,A2,A7,A63,Th20; then
        inf A <= sup B by A7,XXREAL_1:28; then
A80:    sup(A \/ B) = sup B & inf(A \/ B) = inf A by A79,A7,MEASURE6:8,12;
A81:    B is left_end by A7,A78,XXREAL_1:27,XXREAL_2:34;
        pre-Meas.(A \/ B) = diameter(A \/ B) by A2,Th59; then
A82:    pre-Meas.(A \/ B) = sup B - inf A by A7,A80,MEASURE5:def 6;
        pre-Meas.A = diameter A & pre-Meas.B = diameter B by Th58; then
        pre-Meas.A = sup A - inf A
      & pre-Meas.B = sup B - inf B by A7,MEASURE5:def 6;
        hence pre-Meas.(A \/ B) = pre-Meas.A + pre-Meas.B
          by A82,A79,A81,XXREAL_3:34;
       end;
      end;
    end;
end;

theorem Th61:
  for F be non empty disjoint_valued FinSequence of Family_of_Intervals
   st Union F is Interval holds
    ex n be Nat st n in dom F & Union F \ F.n is Interval
proof
    let F be non empty disjoint_valued FinSequence of Family_of_Intervals;
    assume A1: Union F is Interval; then
    reconsider UF = Union F as Interval;
A2: Union F = union rng F by CARD_3:def 4;
    per cases by A1,MEASURE5:1;
    suppose A3: Union F = {};
A4: rng F <> {};
     Union F \ F.1 = {} & {} c= REAL by A3;
     hence ex n be Nat st n in dom F & Union F \ F.n is Interval
       by A4,FINSEQ_3:32;
    end;
    suppose A5: Union F is non empty closed_interval Subset of REAL; then
A6:  Union F = [.inf UF,sup UF.] by MEASURE6:17; then
     inf UF <= sup UF by A5,XXREAL_1:29; then
     inf UF in Union F by A6,XXREAL_1:1; then
     consider A be set such that
A7:   inf UF in A & A in rng F by A2,TARSKI:def 4;
     consider n be Element of NAT such that
A8:   n in dom F & A = F.n by A7,PARTFUN1:3;
A9: inf UF <= inf(F.n) & sup(F.n) <= sup UF
       by A2,A7,A8,ZFMISC_1:74,XXREAL_2:59,60;
     inf(F.n) is LowerBound of F.n by XXREAL_2:def 4; then
     inf(F.n) <= inf UF by A7,A8,XXREAL_2:def 2; then
A10: inf UF = inf(F.n) by A9,XXREAL_0:1; then
A11: F.n is left_end by A7,A8,XXREAL_2:def 5;
     per cases;
     suppose F.n is right_end; then
      F.n = [.inf(F.n),sup(F.n).] by A11,XXREAL_2:75; then
      Union F \ F.n = ].sup(F.n),sup UF.]
        by A6,A7,A8,XXREAL_2:40,A10,XXREAL_1:182; then
      UF \ F.n is interval Subset of REAL;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A8;
     end;
     suppose F.n is non right_end; then
      F.n = [.inf(F.n),sup(F.n).[ by A11,XXREAL_2:77; then
      Union F \ F.n = [.sup(F.n),sup UF.]
        by A6,A10,A7,A8,XXREAL_1:27,XXREAL_1:184; then
      UF \ F.n is interval Subset of REAL;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A8;
     end;
    end;
    suppose A12: Union F is non empty left_open_interval Subset of REAL; then
A13:  Union F = ].inf UF,sup UF.] by MEASURE6:19; then
     sup UF in Union F by A12,XXREAL_1:26,XXREAL_1:2; then
     consider A be set such that
A14:   sup UF in A & A in rng F by A2,TARSKI:def 4;
     consider n be Element of NAT such that
A15:   n in dom F & A = F.n by A14,PARTFUN1:3;
A16: inf UF <= inf(F.n) & sup(F.n) <= sup UF
       by A2,A14,A15,ZFMISC_1:74,XXREAL_2:59,60;
     sup(F.n) is UpperBound of F.n by XXREAL_2:def 3; then
     sup(F.n) >= sup UF by A14,A15,XXREAL_2:def 1; then
A17: sup UF = sup(F.n) by A16,XXREAL_0:1; then
A18: F.n is right_end by A14,A15,XXREAL_2:def 6;
     per cases;
     suppose F.n is left_end; then
      F.n = [.inf(F.n),sup(F.n).] by A18,XXREAL_2:75; then
      Union F \ F.n = ].inf UF,inf(F.n).[
        by A13,A14,A15,XXREAL_2:40,A17,XXREAL_1:191;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A15;
     end;
     suppose F.n is non left_end; then
      F.n = ].inf(F.n),sup(F.n).] by A18,XXREAL_2:76; then
      Union F \ F.n = ].inf UF,inf(F.n).]
        by A13,A17,A14,A15,XXREAL_1:26,XXREAL_1:193; then
      UF \ F.n is interval Subset of REAL;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A15;
     end;
    end;
    suppose A19: Union F is non empty right_open_interval Subset of REAL; then
A20:  Union F = [.inf UF,sup UF.[ by MEASURE6:18; then
     inf UF in Union F by A19,XXREAL_1:27,XXREAL_1:3; then
     consider A be set such that
A21:   inf UF in A & A in rng F by A2,TARSKI:def 4;
     consider n be Element of NAT such that
A22:   n in dom F & A = F.n by A21,PARTFUN1:3;
A23: inf UF <= inf(F.n) & sup(F.n) <= sup UF
        by A2,A21,A22,ZFMISC_1:74,XXREAL_2:59,60;
     inf(F.n) is LowerBound of F.n by XXREAL_2:def 4; then
     inf(F.n) <= inf UF by A21,A22,XXREAL_2:def 2; then
A24: inf UF = inf(F.n) by A23,XXREAL_0:1; then
A25: F.n is left_end by A21,A22,XXREAL_2:def 5;
     per cases;
     suppose F.n is right_end; then
      F.n = [.inf(F.n),sup(F.n).] by A25,XXREAL_2:75; then
      Union F \ F.n = ].sup(F.n),sup UF.[
        by A20,A21,A22,XXREAL_2:40,A24,XXREAL_1:183;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A22;
     end;
     suppose F.n is non right_end; then
      F.n = [.inf(F.n),sup(F.n).[ by A25,XXREAL_2:77; then
      Union F \ F.n = [.sup(F.n),sup UF.[
        by A20,A24,A21,A22,XXREAL_1:27,XXREAL_1:185; then
      UF \ F.n is interval Subset of REAL;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A22;
     end;
    end;
    suppose A26: Union F is non empty open_interval Subset of REAL; then
A27:  Union F = ].inf UF,sup UF.[ by MEASURE6:16;
     deffunc F(Nat) = inf(F.$1);
     consider G be FinSequence of ExtREAL such that
A28:   len G = len F & for n be Nat st n in dom G holds G.n = F(n)
       from FINSEQ_2:sch 1;
A29:  min_p G in dom G by A28,Def2;
A30:  for n be Nat st n in dom F holds inf(F.(min_p G)) <= inf(F.n)
     proof
      let n be Nat;
      assume A31: n in dom F; then
      1 <= n & n <= len G by A28,FINSEQ_3:25; then
A32:   G.(min_p G) <= G.n & min G <= G.n by Th26;
      min_p G in dom G by A28,Def2; then
A33:   G.(min_p G) = inf(F.(min_p G)) by A28;
      n in dom G by A28,A31,FINSEQ_3:29;
      hence thesis by A32,A33,A28;
     end;
A34:  min_p G in dom F by A29,A28,FINSEQ_3:29; then
     F.(min_p G) c= UF by A2,ZFMISC_1:74,FUNCT_1:3; then
A35: inf UF <= inf(F.(min_p G)) & sup(F.(min_p G)) <= sup UF by XXREAL_2:59,60;
A36: now assume A37: inf(F.(min_p G)) = +infty;
A38:   for n be Nat st n in dom F holds F.n = {+infty} or F.n = {}
      proof
       let n be Nat;
       assume n in dom F; then
       inf(F.n) = +infty by A30,A37,XXREAL_0:4; then
       +infty is LowerBound of F.n by XXREAL_2:def 4;
       hence thesis by ZFMISC_1:33,XXREAL_2:52;
      end;
      per cases;
      suppose ex n be Nat st n in dom F & F.n = {+infty}; then
       consider n be Nat such that
A39:     n in dom F & F.n = {+infty};
       {+infty} c= UF by A2,A39,FUNCT_1:3,ZFMISC_1:74; then
       +infty in UF by ZFMISC_1:31;
       hence contradiction;
      end;
      suppose A40: for n be Nat st n in dom F holds F.n <> {+infty}; then
A41:    for n be Nat st n in dom F holds F.n = {} by A38;
       for x be object holds x in rng F iff x = {}
       proof
        let x be object;
        hereby assume x in rng F; then
         ex n be Element of NAT st n in dom F & x = F.n by PARTFUN1:3;
         hence x = {} by A40,A38;
        end;
        assume A42: x = {};
        rng F <> {}; then
        1 in dom F & F.1 = x by A41,A42,FINSEQ_3:32;
        hence x in rng F by FUNCT_1:3;
       end; then
       rng F = {{}} by TARSKI:def 1;
       hence contradiction by A26,A2;
      end;
     end; then
A43:  inf(F.(min_p G)) <= sup(F.(min_p G)) by XXREAL_2:38,40;
A44:  rng F c= bool REAL by XBOOLE_1:1;
     now assume inf UF < inf(F.(min_p G)); then
      consider x be R_eal such that
A45:    inf UF < x & x < inf (F.(min_p G)) & x in REAL by MEASURE5:2;
      x < sup(F.(min_p G)) by A45,A43,XXREAL_0:2; then
      x < sup UF by A35,XXREAL_0:2; then
      x in UF by A45,XXREAL_2:83;
      then
      consider A be set such that
A46:    x in A & A in rng F by A2,TARSKI:def 4;
      reconsider A as non empty Subset of REAL by A46,A44;
      consider n be Element of NAT such that
A47:    n in dom F & A = F.n by A46,PARTFUN1:3;
      inf(F.(min_p G)) <= inf A by A30,A47; then
      x < inf A by A45,XXREAL_0:2;
      hence contradiction by A46,XXREAL_2:3;
     end; then
A48: inf UF = inf(F.(min_p G)) by A35,XXREAL_0:1;
     now assume A49: inf(F.(min_p G)) in F.(min_p G);
      F.(min_p G) in rng F by A34,FUNCT_1:3; then
      inf UF in UF by A2,A48,A49,TARSKI:def 4;
      hence contradiction by A27,XXREAL_1:4;
     end; then
A50: F.(min_p G) is not left_end by XXREAL_2:def 5;
     per cases;
     suppose F.(min_p G) is right_end; then
      F.(min_p G) = ].inf(F.(min_p G)),sup(F.(min_p G)).]
        by A50,XXREAL_2:76; then
      Union F \ F.(min_p G) = ].sup(F.(min_p G)),sup UF.[
        by A27,A48,A36,XXREAL_2:38,XXREAL_1:26,XXREAL_1:187;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A34;
     end;
     suppose F.(min_p G) is non right_end; then
      F.(min_p G) = ].inf(F.(min_p G)), sup(F.(min_p G)).[
        by A50,A36,XXREAL_2:38,XXREAL_2:78; then
      Union F \ F.(min_p G) = [.sup(F.(min_p G)),sup UF.[
        by A27,A48,A36,XXREAL_2:38,XXREAL_1:28,XXREAL_1:189; then
      UF \ F.(min_p G) is interval Subset of REAL;
      hence ex n be Nat st n in dom F & Union F \ F.n is Interval by A34;
     end;
    end;
end;

theorem Th62:
  for A be Interval holds pre-Meas*<*A*> = <*pre-Meas.A*>
proof
    let A be Interval;
A1: A in Family_of_Intervals by MEASUR10:def 1;
 rng <*A*> = {A} by FINSEQ_1:38; then
    reconsider FA = <*A*> as FinSequence of Family_of_Intervals
     by A1,ZFMISC_1:31,FINSEQ_1:def 4;
    dom pre-Meas = Family_of_Intervals
  & rng FA c= Family_of_Intervals by FUNCT_2:def 1; then
    dom(pre-Meas*FA) = dom FA by RELAT_1:27; then
A2: dom(pre-Meas*FA) = Seg 1 by FINSEQ_1:38; then
A3: dom(pre-Meas*FA) = dom <*pre-Meas.A*> by FINSEQ_1:38;
    for n be Nat st n in dom(pre-Meas*FA) holds
      (pre-Meas*FA).n = <*pre-Meas.A*>.n
    proof
     let n be Nat;
     assume A4: n in dom(pre-Meas*FA); then
A5:  n = 1 by A2,FINSEQ_1:2,TARSKI:def 1; then
     (pre-Meas*FA).n = pre-Meas.(FA.1) by A4,FUNCT_1:12
        .= pre-Meas.A;
     hence thesis by A5;
    end;
    hence pre-Meas*<*A*> = <*pre-Meas.A*> by A3,FINSEQ_1:13;
end;

theorem Th63:
  for F be disjoint_valued FinSequence of Family_of_Intervals
   st Union F in Family_of_Intervals
   ex G be disjoint_valued FinSequence of Family_of_Intervals
    st F,G are_fiberwise_equipotent
    & for n be Nat st n in dom G holds Union(G|n) in Family_of_Intervals
    & pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n))
proof
    let F be disjoint_valued FinSequence of Family_of_Intervals;
    assume
A1:  Union F in Family_of_Intervals;
    defpred P[Nat] means
     for H be disjoint_valued FinSequence of Family_of_Intervals
      st len H = $1 & Union H in Family_of_Intervals
       ex G be disjoint_valued FinSequence of Family_of_Intervals
        st H,G are_fiberwise_equipotent
         & for n be Nat st n in dom G holds
            Union(G|n) in Family_of_Intervals
          & pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n));
    now let H be disjoint_valued FinSequence of Family_of_Intervals;
     assume that
A2:   len H = 0 and
      Union H in Family_of_Intervals;
A3:  H = {} by A2;
     take G = H;
     thus H,G are_fiberwise_equipotent;
     thus for n be Nat st n in dom G holds
           Union(G|n) in Family_of_Intervals
         & pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n)) by A3;
    end; then
A4: P[0];
A5: for k be Nat st P[k] holds P[k+1]
    proof
     let k be Nat;
     assume A6: P[k];
     hereby let H be disjoint_valued FinSequence of Family_of_Intervals;
      assume that
A7:    len H = k+1 and
A8:    Union H in Family_of_Intervals;
A9:   H <> {} by A7;
      ex I be Interval st Union H = I by A8,MEASUR10:def 1; then
      consider N be Nat such that
A10:    N in dom H & Union H \ H.N is Interval by A9,Th61;
      1 <= len H by A7,NAT_1:11; then
A11:   len H in dom H by FINSEQ_3:25;
      reconsider H1 = Swap(H,N,len H)|(Seg k)
        as FinSequence of Family_of_Intervals by FINSEQ_1:18;
A12:   H,Swap(H,N,len H) are_fiberwise_equipotent by A10,A11,Th28; then
A13:   len (Swap(H,N,len H)) = k+1 by A7,RFINSEQ:3; then
      len(Swap(H,N,len H)|k) = k by NAT_1:11,FINSEQ_1:59; then
A14:  len H1 = k by FINSEQ_1:def 16;
      for n,m be object st n <> m holds H1.n misses H1.m
      proof
       let n,m be object;
       assume A15: n <> m;
       per cases;
       suppose A16: n in dom H1 & m in dom H1; then
        reconsider n1=n, m1=m as Element of NAT;
A17:     1 <= n1 <= k & 1 <= m1 <= k by A16,A14,FINSEQ_3:25; then
A18:     n1 <> len H & m1 <> len H by A7,NAT_1:13;
        k <= k+1 by NAT_1:11; then
        1 <= n1 <= len H & 1 <= m1 <= len H by A7,A17,XXREAL_0:2; then
A19:     n1 in dom H & m1 in dom H by FINSEQ_3:25;
        per cases;
        suppose n1 = N; then
         Swap(H,N,len H).n1 = H.(len H)
       & Swap(H,N,len H).m1 = H.m1 by A15,A19,A18,A11,EXCHSORT:29,33; then
         H1.n1 = H.(len H) & H1.m1 = H.m1 by A17,FINSEQ_1:1,FUNCT_1:49;
         hence H1.n misses H1.m by A18,PROB_2:def 2;
        end;
        suppose m1 = N; then
         Swap(H,N,len H).m1 = H.(len H)
       & Swap(H,N,len H).n1 = H.n1 by A15,A19,A18,A11,EXCHSORT:29,33; then
         H1.m1 = H.(len H) & H1.n1 = H.n1 by A17,FINSEQ_1:1,FUNCT_1:49;
         hence H1.n misses H1.m by A18,PROB_2:def 2;
        end;
        suppose n1 <> N & m1 <> N; then
         Swap(H,N,len H).n1 = H.n1
       & Swap(H,N,len H).m1 = H.m1 by A18,EXCHSORT:33; then
         H1.n1 = H.n1 & H1.m1 = H.m1 by A17,FINSEQ_1:1,FUNCT_1:49;
         hence H1.n misses H1.m by A15,PROB_2:def 2;
        end;
       end;
       suppose not n in dom H1 or not m in dom H1; then
        H1.n = {} or H1.m = {} by FUNCT_1:def 2;
        hence H1.n misses H1.m by XBOOLE_1:65;
       end;
      end; then
      reconsider H1 as disjoint_valued FinSequence of Family_of_Intervals
         by PROB_2:def 2;
A20:   Swap(H,N,len H) = H1 ^ <* Swap(H,N,len H).(len H) *>
        by A13,A7,FINSEQ_3:55; then
      rng Swap(H,N,len H) = rng H1 \/ rng <* Swap(H,N,len H).(len H) *>
        by FINSEQ_1:31; then
      rng Swap(H,N,len H) = rng H1 \/ { Swap(H,N,len H).(len H) }
        by FINSEQ_1:38; then
      union rng Swap(H,N,len H)
       = union rng H1 \/ union { Swap(H,N,len H).(len H) } by ZFMISC_1:78; then
A21:   union rng H = union rng H1 \/ Swap(H,N,len H).(len H)
        by A10,A11,Th28,CLASSES1:75;
A22:   Swap(H,N,len H).(len H) = H.N by A10,A11,EXCHSORT:31;
A23:  for A be set st A in rng H1 holds A misses Swap(H,N,len H).(len H)
      proof
       let A be set;
       assume A in rng H1; then
       consider n be Element of NAT such that
A24:     n in dom H1 & A = H1.n by PARTFUN1:3;
A25:    1 <= n <= k by A14,A24,FINSEQ_3:25; then
A26:    A = Swap(H,N,len H).n by A24,FUNCT_1:49,FINSEQ_1:1;
A27:    n <> len H by A7,A25,NAT_1:13;
       n <= len H by A7,A25,NAT_1:13; then
A28:    n in dom H by A25,FINSEQ_3:25;
       per cases;
       suppose A29: n = N; then
        A = H.(len H) by A11,A26,A28,EXCHSORT:29;
        hence A misses Swap(H,N,len H).(len H) by A22,A27,A29,PROB_2:def 2;
       end;
       suppose A30: n <> N; then
        A = H.n by A26,A27,EXCHSORT:33;
        hence A misses Swap(H,N,len H).(len H) by A22,A30,PROB_2:def 2;
       end;
      end; then
A31:   union rng H1 misses Swap(H,N,len H).(len H) by ZFMISC_1:80;
      union rng H1 = union rng H \ Swap(H,N,len H).(len H)
        by A23,A21,ZFMISC_1:80,XBOOLE_1:88; then
      Union H1 = union rng H \ H.N by A22,CARD_3:def 4; then
      Union H1 is Interval by A10,CARD_3:def 4; then
      Union H1 in the set of all I where I is Interval; then
      consider G1 be disjoint_valued FinSequence of Family_of_Intervals
       such that
A32:    H1,G1 are_fiberwise_equipotent and
A33:    for n be Nat st n in dom G1 holds
           Union(G1|n) in Family_of_Intervals
         & pre-Meas.(Union(G1|n)) = Sum(pre-Meas*(G1|n))
           by A6,A14,MEASUR10:def 1;
      set G = G1^<*H.N*>;
A34:  H.N in rng H by A10,FUNCT_1:3; then
      {H.N} c= Family_of_Intervals by ZFMISC_1:31; then
      rng <*H.N*> c= Family_of_Intervals by FINSEQ_1:38; then
A35: <*H.N*> is disjoint_valued FinSequence of Family_of_Intervals
        by FINSEQ_1:def 4;
A36:  union rng G1 misses H.N by A31,A22,A32,CLASSES1:75;
      for A be set st A in rng <*H.N*> holds A misses union rng G1
      proof
       let A be set;
       assume A in rng <*H.N*>; then
       A in {H.N} by FINSEQ_1:38; then
       A = H.N by TARSKI:def 1;
       hence thesis by A36;
      end; then
      union rng G1 misses union rng <*H.N*> by ZFMISC_1:80; then
      reconsider G as disjoint_valued FinSequence of Family_of_Intervals
        by A35,FINSEQ_1:75,MEASURE9:45;
      take G;
A37:  Swap(H,N,len H),G are_fiberwise_equipotent by A32,A20,A22,RFINSEQ:1;
      hence
A38:    H,G are_fiberwise_equipotent by A12,CLASSES1:76;
      thus for n be Nat st n in dom G holds
            Union(G|n) in Family_of_Intervals
          & pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n))
      proof
       let n be Nat;
       assume n in dom G; then
A39:    1 <= n <= len G by FINSEQ_3:25;
A40:    len G = len H & len G1 = len H1 by A38,A32,RFINSEQ:3; then
       dom G1 = Seg k by A14,FINSEQ_1:def 3; then
       G1 = G|(Seg k) by FINSEQ_1:21; then
A41:    G1 = G|k by FINSEQ_1:def 16;
       per cases;
       suppose A42: n <= k; then
A43:     n in dom G1 by A39,A40,A14,FINSEQ_3:25;
A44:     G|n = G1|n by A41,A42,FINSEQ_5:77;
        Union(G|n) = Union(G1|n) by A41,A42,FINSEQ_5:77;
        hence Union(G|n) in Family_of_Intervals by A43,A33;
        thus pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n)) by A44,A43,A33;
       end;
       suppose n > k; then
A45:   n >= k+1 by NAT_1:13; then
A46:    G|n = G by A40,A7,FINSEQ_1:58; then
        rng(G|n) = rng H by A37,A12,CLASSES1:76,CLASSES1:75; then
        Union(G|n) = union rng H by CARD_3:def 4;
        hence Union(G|n) in Family_of_Intervals by A8,CARD_3:def 4;
A47:     Union G1 is Interval
        proof
         per cases;
         suppose k = 0; then
          G1 = {} by A40; then
          union rng G1 = {} by ZFMISC_1:2; then
          Union G1 = {} & {} c= REAL by CARD_3:def 4;
          hence Union G1 is Interval;
         end;
         suppose k <> 0; then
          k >=1 by NAT_1:14; then
          k in dom G1 by A14,A40,FINSEQ_3:25; then
          Union(G1|k) in the set of all I where I is Interval
            by A33,MEASUR10:def 1; then
          ex I be Interval st Union(G1|k) = I;
          hence Union G1 is Interval by A14,A40,FINSEQ_1:58;
         end;
        end; then
A48:    Union G1 in the set of all I where I is Interval;
A49:     rng <*H.N*> = {H.N} by FINSEQ_1:38; then
        reconsider HN = <*H.N*> as FinSequence of Family_of_Intervals
          by A34,ZFMISC_1:31,FINSEQ_1:def 4;
A50:     Union G1 misses H.N by A36,CARD_3:def 4;
        rng(G|n) = rng G1 \/ rng <*H.N*> by A46,FINSEQ_1:31; then
        union rng(G|n) = union rng G1 \/ union rng <*H.N*>
          by ZFMISC_1:78; then
A51:    Union(G|n) = union rng G1 \/ union rng <*H.N*> by CARD_3:def 4
         .= Union G1 \/ union {H.N} by A49,CARD_3:def 4;
        rng G = rng H by A37,A12,CLASSES1:76,CLASSES1:75; then
        Union G = union rng H by CARD_3:def 4; then
        Union G = Union H by CARD_3:def 4; then
        ex I be Interval st Union G = I by A8,MEASUR10:def 1; then
A52:     Union G1 \/ H.N is Interval by A51,A45,A40,A7,FINSEQ_1:58;
A53:     pre-Meas.(Union G1) = Sum(pre-Meas*G1)
        proof
         per cases;
         suppose k = 0; then
A54:       G1 = {} by A40; then
          union rng G1 = {} by ZFMISC_1:2; then
          Union G1 = {} by CARD_3:def 4; then
          pre-Meas.(Union G1) = diameter {} by A47,Th59; then
          pre-Meas.(Union G1) = 0 by MEASURE5:def 6;
          hence pre-Meas.(Union G1) = Sum(pre-Meas*G1) by A54,EXTREAL1:7;
         end;
         suppose k <> 0; then
          k >= 1 by NAT_1:14; then
A55:       k in dom G1 by A14,A40,FINSEQ_3:25;
          G1|k = G1 by A14,A40,FINSEQ_1:58;
          hence pre-Meas.(Union G1) = Sum(pre-Meas*G1) by A55,A33;
         end;
        end;
A56:     pre-Meas*HN = <*pre-Meas.(H.N)*> by Th62;
        reconsider LG1 = pre-Meas*G1 as FinSequence of ExtREAL;
        reconsider LHN = pre-Meas*HN as FinSequence of ExtREAL;
        dom pre-Meas = Family_of_Intervals by FUNCT_2:def 1; then
        rng G1 c= dom pre-Meas & rng HN c= dom pre-Meas; then
A57:    pre-Meas*G = (pre-Meas*G1)^<*pre-Meas.(H.N)*> by A56,MATRIX15:5;
        pre-Meas.(Union(G|n)) = pre-Meas.(Union G1) + pre-Meas.(H.N)
          by A48,MEASUR10:def 1,A34,A50,A52,A51,Th60
        .= Sum(pre-Meas*G) by A57,A53,MEASURE9:21;
        hence pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n))
          by A45,A40,A7,FINSEQ_1:58;
       end;
      end;
      end;
     end;
     for k be Nat holds P[k] from NAT_1:sch 2(A4,A5); then
     P[len F];
     hence ex G be disjoint_valued FinSequence of Family_of_Intervals
       st F,G are_fiberwise_equipotent
        & for n be Nat st n in dom G holds
           Union(G|n) in Family_of_Intervals
         & pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n)) by A1;
end;

theorem Th64:
  for F,G be FinSequence of ExtREAL holds
   (F is without-infty & G is without-infty implies F^G is without-infty)
 & (F is without+infty & G is without+infty implies F^G is without+infty)
proof
    let F,G be FinSequence of ExtREAL;
    hereby assume F is without-infty & G is without-infty; then
A1:  not -infty in rng F & not -infty in rng G by MESFUNC5:def 3;
     rng(F^G) = rng F \/ rng G by FINSEQ_1:31; then
     not -infty in rng(F^G) by A1,XBOOLE_0:def 3;
     hence F^G is without-infty by MESFUNC5:def 3;
    end;
    assume F is without+infty & G is without+infty; then
A2: not +infty in rng F & not +infty in rng G by MESFUNC5:def 4;
    rng(F^G) = rng F \/ rng G by FINSEQ_1:31; then
    not +infty in rng(F^G) by A2,XBOOLE_0:def 3;
    hence F^G is without+infty by MESFUNC5:def 4;
end;

theorem Th65:
  for F be FinSequence of ExtREAL, k be Nat holds
     (F is without-infty implies F/^k is without-infty)
   & (F is without+infty implies F/^k is without+infty)
proof
    let F be FinSequence of ExtREAL, k be Nat;
    hereby assume F is without-infty; then
A1:  not -infty in rng F by MESFUNC5:def 3;
     rng(F/^k) c= rng F by FINSEQ_5:33;
     hence F/^k is without-infty by A1,MESFUNC5:def 3;
    end;
    assume F is without+infty; then
A2: not +infty in rng F by MESFUNC5:def 4;
    rng(F/^k) c= rng F by FINSEQ_5:33;
    hence F/^k is without+infty by A2,MESFUNC5:def 4;
end;

theorem Th66:
  for F be FinSequence of ExtREAL holds
     (F is without-infty implies Sum F <> -infty)
   & (F is without+infty implies Sum F <> +infty)
proof
    let F be FinSequence of ExtREAL;
    hereby assume F is without-infty; then
A1:  not -infty in rng F by MESFUNC5:def 3;
     consider S be sequence of ExtREAL such that
A2:   Sum F = S.(len F) & S.0 = 0 &
      for n be Nat st n < len F holds S.(n+1) = S.n + F.(n+1)
        by EXTREAL1:def 2;
     defpred P[Nat] means $1 <= len F implies S.$1 <> -infty;
A3:  P[0] by A2;
A4:  for n be Nat st P[n] holds P[n+1]
     proof
      let n be Nat;
      assume A5: P[n];
      assume A6: n+1 <= len F; then
A7:  S.(n+1) = S.n + F.(n+1) by A2,NAT_1:13;
      n+1 in dom F by A6,NAT_1:11,FINSEQ_3:25; then
      F.(n+1) in rng F by FUNCT_1:3;
      hence S.(n+1) <> -infty by A1,A5,NAT_1:13,A6,A7,XXREAL_3:17;
     end;
     for n be Nat holds P[n] from NAT_1:sch 2(A3,A4);
     hence Sum F <> -infty by A2;
    end;
    assume F is without+infty; then
A8: not +infty in rng F by MESFUNC5:def 4;
    consider S be sequence of ExtREAL such that
A9:  Sum F = S.(len F) & S.0 = 0 &
     for n be Nat st n < len F holds S.(n+1) = S.n + F.(n+1)
       by EXTREAL1:def 2;
    defpred P[Nat] means $1 <= len F implies S.$1 <> +infty;
A10: P[0] by A9;
A11: for n be Nat st P[n] holds P[n+1]
    proof
     let n be Nat;
     assume A12: P[n];
     assume A13: n+1 <= len F; then
A14: S.(n+1) = S.n + F.(n+1) by A9,NAT_1:13;
     n+1 in dom F by A13,NAT_1:11,FINSEQ_3:25; then
     F.(n+1) in rng F by FUNCT_1:3;
     hence S.(n+1) <> +infty by A8,A12,NAT_1:13,A13,A14,XXREAL_3:16;
    end;
    for n be Nat holds P[n] from NAT_1:sch 2(A10,A11);
    hence Sum F <> +infty by A9;
end;

theorem Th67:  :: ExtREAL version of RFINSEQ:9
  for R1,R2 be without-infty FinSequence of ExtREAL
    st R1,R2 are_fiberwise_equipotent
  holds Sum R1 = Sum R2
proof
  let R1,R2 be without-infty FinSequence of ExtREAL;
  defpred P[Nat] means for f,g be without-infty FinSequence of ExtREAL
   st f,g are_fiberwise_equipotent & len f = $1 holds Sum f = Sum g;
  assume
A1: R1,R2 are_fiberwise_equipotent;
A2: len R1 = len R1;
A3: for n be Nat st P[n] holds P[n+1]
  proof
    let n be Nat;
    assume
A4: P[n];
    let f,g be without-infty FinSequence of ExtREAL;
    assume that
A5: f,g are_fiberwise_equipotent and
A6: len f = n+1;
    set a = f.(n+1);
A7: rng f = rng g by A5,CLASSES1:75;
    0 qua Nat+1<=n+1 by NAT_1:13;
    then n+1 in dom f by A6,FINSEQ_3:25;
    then
A8: a in rng g by A7,FUNCT_1:def 3;
    then consider m being Nat such that
A9: m in dom g and
A10: g.m = a by FINSEQ_2:10;
    set gg = g/^m, gm = g|m;
    m<=len g by A9,FINSEQ_3:25; then
A11: len gm = m by FINSEQ_1:59;
A12: 1<=m by A9,FINSEQ_3:25;
    max(0,m-1) = m-1 by A9,FINSEQ_3:25,FINSEQ_2:4;
    then reconsider m1 = m-1 as Element of NAT by FINSEQ_2:5;
A13: m = m1+1;
    then
A14: Seg m1 c= Seg m by FINSEQ_1:5,NAT_1:11;
    m in Seg m by A12,FINSEQ_1:1;
    then gm.m = a by A9,A10,RFINSEQ:6;
    then
A15: gm = (gm|m1)^<*a*> by A11,A13,RFINSEQ:7;
    set fn = f|n;
A16: g = (g|m)^(g/^m);
A17: gm|m1 = gm|(Seg m1) by FINSEQ_1:def 16
      .= (g|(Seg m))|(Seg m1) by FINSEQ_1:def 16
      .= g|((Seg m)/\(Seg m1)) by RELAT_1:71
      .= g|(Seg m1) by A14,XBOOLE_1:28
      .= g|m1 by FINSEQ_1:def 16;
A18: f = fn ^ <*a*> by A6,RFINSEQ:7;
A19: fn is without-infty & g|m1 is without-infty
  & gg is without-infty & gm is without-infty
  & g/^m is without-infty by MEASURE9:36,Th65; then
A20: (g|m1)^gg is without-infty & (g|m1)^(g/^m) is without-infty by Th64;
    a <> -infty by A8,MESFUNC5:def 3; then
    not -infty in {a} by TARSKI:def 1; then
A21: not -infty in rng <*a*> by FINSEQ_1:38; then
A22: <*a*> is without-infty FinSequence of ExtREAL by MESFUNC5:def 3;
A23: not -infty in rng fn
  & not -infty in rng((g|m1)^gg)
  & not -infty in rng(g|m1)
  & not -infty in rng gg
  & not -infty in rng gm by A19,A20,MESFUNC5:def 3;
A24: Sum(g|m1) <> -infty & Sum <*a*> <> -infty & Sum gg <> -infty
      by A22,Th66,MEASURE9:36,Th65;
A25:now
      let x be object;
      card Coim(f,x) = card Coim(g,x) by A5,CLASSES1:def 10; then
      card (f"{x}) = card Coim(g,x) by RELAT_1:def 17; then
      card (f"{x}) = card (g"{x}) by RELAT_1:def 17;
      then
      card(fn"{x}) + card(<*a*>"{x}) = card(((g|m1)^<*a*>^(g/^m))"{x})
        by A15,A17,A18,FINSEQ_3:57
        .= card(((g|m1)^<*a*>)"{x}) + card((g/^m)"{x}) by FINSEQ_3:57
        .= card((g|m1)"{x})+ card(<*a*>"{x}) + card((g/^m)"{x}) by FINSEQ_3:57
        .= card((g|m1)"{x}) + card((g/^m)"{x})+ card(<*a*>"{x})
        .= card(((g|m1)^(g/^m))"{x})+ card(<*a*>"{x}) by FINSEQ_3:57
        .= card Coim((g|m1)^(g/^m),x) + card(<*a*>"{x}) by RELAT_1:def 17;
      hence card Coim(fn,x) = card Coim((g|m1)^(g/^m),x) by RELAT_1:def 17;
    end;
    len fn = n by A6,FINSEQ_1:59,NAT_1:11;
    then Sum fn = Sum((g|m1)^gg) by A4,A19,A20,A25,CLASSES1:def 10;
    hence Sum f = Sum((g|m1)^gg) + Sum <*a*> by A18,A23,A21,EXTREAL1:10
      .= Sum(g|m1) + Sum gg+ Sum <*a*> by A23,EXTREAL1:10
      .= Sum(g|m1)+ Sum <*a*> + Sum gg by A24,XXREAL_3:29
      .= Sum gm + Sum gg by A15,A17,A23,A21,EXTREAL1:10
      .= Sum g by A16,A23,EXTREAL1:10;
  end;
A26: P[0]
  proof
    let f,g be without-infty FinSequence of ExtREAL;
    assume f,g are_fiberwise_equipotent & len f = 0; then
A27: len g = 0 & f = <*>ExtREAL by RFINSEQ:3;
     then g = <*>ExtREAL;
    hence thesis by A27;
  end;
  for n be Nat holds P[n] from NAT_1:sch 2(A26,A3);
  hence thesis by A1,A2;
end;

theorem Th68:
  for F be disjoint_valued FinSequence of Family_of_Intervals
    st Union F in Family_of_Intervals holds
      pre-Meas.(Union F) = Sum(pre-Meas*F)
proof
    let F be disjoint_valued FinSequence of Family_of_Intervals;
    assume Union F in Family_of_Intervals; then
    consider G be disjoint_valued FinSequence of Family_of_Intervals
     such that
A1:  F,G are_fiberwise_equipotent and
A2:  for n be Nat st n in dom G holds Union(G|n) in Family_of_Intervals
       & pre-Meas.(Union(G|n)) = Sum(pre-Meas*(G|n)) by Th63;
    per cases;
    suppose A3: F = {}; then
      union rng F = {} by ZFMISC_1:2; then
      Union F = {} & {} c= REAL by CARD_3:def 4; then
      pre-Meas.(Union F) = diameter {} by Th59
        .= 0 by MEASURE5:def 6;
      hence pre-Meas.(Union F) = Sum(pre-Meas*F) by A3,EXTREAL1:7;
    end;
    suppose F <> {}; then
A4:  1 <= len F by FINSEQ_1:20;
A5:  len F = len G & dom F = dom G by A1,RFINSEQ:3;
  rng F = rng G by A1,CLASSES1:75; then
     Union F = union rng G by CARD_3:def 4; then
A6: Union F = Union G by CARD_3:def 4;
A7:  G|len F = G by A5,FINSEQ_1:58;
     len F in dom G by A4,A5,FINSEQ_3:25; then
A8: pre-Meas.(Union G) = Sum(pre-Meas*G) by A7,A2;
A9: pre-Meas*G is nonnegative & pre-Meas*F is nonnegative by MEASURE9:47;
A10: dom(pre-Meas) = Family_of_Intervals by FUNCT_2:def 1;
     rng G c= Family_of_Intervals & rng F c= Family_of_Intervals;
     hence pre-Meas.(Union F) = Sum(pre-Meas*F)
       by A6,A8,A9,Th67,A1,A5,A10,CLASSES1:83;
    end;
end;

theorem Th69:
  for K be disjoint_valued Function of NAT,Family_of_Intervals
    st Union K in Family_of_Intervals holds
      pre-Meas.(Union K) <= SUM(pre-Meas*K)
proof
    let K be disjoint_valued Function of NAT,Family_of_Intervals;
    assume
A1: Union K in Family_of_Intervals;
    reconsider F = K as sequence of bool REAL by FUNCT_2:7;
    pre-Meas.(Union K) = OS_Meas.(Union F) by A1,FUNCT_1:49
     .= OS_Meas.(union rng F) by CARD_3:def 4; then
A2: pre-Meas.(Union K) <= SUM(OS_Meas*F) by MEASURE4:def 1;
    for n be Element of NAT holds (OS_Meas*F).n = (pre-Meas*K).n
    proof
      let n be Element of NAT;
      reconsider A = F.n as Subset of REAL;
A3:   dom F = NAT & dom K = NAT by FUNCT_2:def 1; then
      (pre-Meas*K).n = pre-Meas.(K.n) by FUNCT_1:13
        .= OS_Meas.(K.n) by FUNCT_1:49;
      hence thesis by A3,FUNCT_1:13;
    end;
    hence pre-Meas.(Union K) <= SUM(pre-Meas*K) by A2,FUNCT_2:def 8;
end;

definition
  redefine func pre-Meas -> pre-Measure of Family_of_Intervals;  :: redefines pre-Meas (MEASUR12, definition)
  correctness by Th68,Th69,MEASURE9:def 7;
end;

definition :: Jordan Measure
  func J-Meas -> Measure of Field_generated_by Family_of_Intervals
  means :Def9:
  for A be set st A in Field_generated_by Family_of_Intervals holds
         for F be disjoint_valued FinSequence of Family_of_Intervals
        st A = Union F holds it.A = Sum(pre-Meas*F);
  existence by MEASURE9:55;
  uniqueness
  proof
    let f1,f2 be Measure of Field_generated_by Family_of_Intervals;
    assume that
A1:  for A be set st A in Field_generated_by Family_of_Intervals holds
         for F be disjoint_valued FinSequence of Family_of_Intervals
        st A = Union F holds f1.A = Sum(pre-Meas*F) and
A2:  for A be set st A in Field_generated_by Family_of_Intervals holds
         for F be disjoint_valued FinSequence of Family_of_Intervals
        st A = Union F holds f2.A = Sum(pre-Meas*F);
    for A be Element of Field_generated_by Family_of_Intervals
     holds f1.A = f2.A
    proof
     let A be Element of Field_generated_by Family_of_Intervals;
     A in Field_generated_by Family_of_Intervals; then
     A in DisUnion Family_of_Intervals by SRINGS_3:22; then
     A in { A where A is Subset of REAL :
        ex F be disjoint_valued FinSequence of Family_of_Intervals
         st A = Union F } by SRINGS_3:def 3; then
     ex E be Subset of REAL st
      A = E & ex F be disjoint_valued FinSequence of Family_of_Intervals
       st E = Union F; then
     consider F be disjoint_valued FinSequence of Family_of_Intervals
      such that
A3:  A = Union F;
     f1.A = Sum(pre-Meas*F) by A1,A3;
     hence f1.A = f2.A by A2,A3;
    end;
    hence f1=f2 by FUNCT_2:def 8;
end;
end;

Lm23:
for A be set st A in Field_generated_by Family_of_Intervals holds
 for F be disjoint_valued FinSequence of Family_of_Intervals
   st A = Union F holds J-Meas.A = Sum(pre-Meas*F) by Def9;

definition
  redefine func J-Meas -> induced_Measure of Family_of_Intervals,pre-Meas;  :: redefines J-Meas (MEASUR12, definition)
  correctness by Lm23,MEASURE9:def 8;
end;

registration
  cluster J-Meas -> completely-additive;
  coherence by MEASURE9:60;
end;

definition :: Borel Measure
  func B-Meas -> sigma_Measure of Borel_Sets equals
    (sigma_Meas(C_Meas J-Meas))|Borel_Sets;
  correctness by MEASURE9:61,MEASUR10:6;
end;

theorem Th71:
  for A be Interval holds J-Meas.A = diameter A
proof
    let A be Interval;
A1: A in Family_of_Intervals by MEASUR10:def 1;
A2: Family_of_Intervals c= Field_generated_by Family_of_Intervals
      by SRINGS_3:21;
    reconsider F = <*A*>
     as disjoint_valued FinSequence of Family_of_Intervals by A1,FINSEQ_1:74;
    rng F = {A} by FINSEQ_1:38; then
    union rng F = A; then
    A = Union F by CARD_3:def 4; then
    J-Meas.A = Sum(pre-Meas*F) by A2,A1,Def9; then
    J-Meas.A = Sum(<*pre-Meas.A*>) by Th62; then
    J-Meas.A = pre-Meas.A by EXTREAL1:8;
    hence J-Meas.A = diameter A by Th59;
end;

theorem Th72:
  for A be Interval holds B-Meas.A = diameter A
proof
    let A be Interval;
A1: A in Family_of_Intervals by MEASUR10:def 1;
A2: Family_of_Intervals c= Field_generated_by Family_of_Intervals
      by SRINGS_3:21;
A3: Field_generated_by Family_of_Intervals c= Borel_Sets
      by PROB_1:def 9,MEASUR10:6;
A4: Field_generated_by Family_of_Intervals
      c= sigma_Field C_Meas J-Meas by MEASURE8:20;
    B-Meas.A = (sigma_Meas(C_Meas J-Meas)).A by A3,A2,A1,FUNCT_1:49
     .= (C_Meas J-Meas).A by A4,A2,A1,MEASURE4:def 3
     .= J-Meas.A by A2,A1,MEASURE8:18;
    hence B-Meas.A = diameter A by Th71;
end;

theorem Th73:
  for A be Interval holds A in Borel_Sets
proof
    let A be Interval;
A1: A in Family_of_Intervals by MEASUR10:def 1;
A2: Family_of_Intervals c= Field_generated_by Family_of_Intervals
      by SRINGS_3:21;
    Field_generated_by Family_of_Intervals
     c= sigma Field_generated_by Family_of_Intervals by PROB_1:def 9;
    hence thesis by A2,A1,MEASUR10:6;
end;

definition :: Lebesgue Measure
  func L-Field -> SigmaField of REAL equals
    COM (Borel_Sets,B-Meas);
  correctness;
end;

definition
  func L-Meas -> sigma_Measure of L-Field equals
    COM B-Meas;
  correctness;
end;

registration
  cluster L-Meas -> complete;
  correctness
  proof
    B-Meas is induced_sigma_Measure of Family_of_Intervals,J-Meas
      by MEASURE9:def 9,MEASUR10:6;
    hence thesis by MEASUR10:3,6;
  end;
end;

theorem Th75:
  {} is thin of B-Meas
proof
  set A = [.1,1.];
    {} c= REAL; then
    reconsider E = {} as Subset of REAL;
A1: A in Family_of_Intervals by MEASUR10:def 1;
A2: Family_of_Intervals c= Field_generated_by Family_of_Intervals
      by SRINGS_3:21;
A3: Field_generated_by Family_of_Intervals c= Borel_Sets
      by PROB_1:def 9,MEASUR10:6;
A4: E c= A;
    reconsider a = 1 as R_eal by XXREAL_0:def 1;
    B-Meas.A = diameter A by Th72 .= a - a by MEASURE5:6
     .= 1 - 1 by Lm9 .= 0;
    hence {} is thin of B-Meas by A3,A2,A1,A4,MEASURE3:def 2;
end;

theorem
  for a be Real holds {a} is thin of B-Meas
proof
    let a be Real;
    set A = [.a,a.];
    reconsider E = {a} as Subset of REAL;
A1: A in Family_of_Intervals by MEASUR10:def 1;
A2: Family_of_Intervals c= Field_generated_by Family_of_Intervals
      by SRINGS_3:21;
A3: Field_generated_by Family_of_Intervals c= Borel_Sets
      by PROB_1:def 9,MEASUR10:6;
A4: E c= A by XXREAL_1:17;
    reconsider a1 = a as R_eal by XXREAL_0:def 1;
    B-Meas.A = diameter A by Th72 .= a1 - a1 by MEASURE5:6
     .= a - a by Lm9 .= 0;
    hence {a} is thin of B-Meas by A3,A2,A1,A4,MEASURE3:def 2;
end;

theorem
  Borel_Sets c= L-Field
proof
  now let A be set;
    assume A1: A in Borel_Sets;
    set B = A;
    A = B \/ {};
    hence A in COM(Borel_Sets,B-Meas) by A1,Th75,MEASURE3:def 3;
  end;
  hence thesis;
end;

theorem
  for A be Interval holds L-Meas.A = diameter A
  proof
    let A be Interval;
    A \/ {} = A; then
    L-Meas.A = B-Meas.A by Th73,Th75,MEASURE3:def 5;
    hence thesis by Th72;
  end;