
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;
