reserve a, b, r, s for Real;

theorem Th8:
  a <= b implies [.a,b.] /\ (left_closed_halfline(a) \/
  right_closed_halfline(b)) = {a,b}
proof
  set A = left_closed_halfline(a);
  set B = right_closed_halfline(b);
  assume a <= b;
  then
A1: a in [.a,b.] & b in [.a,b.] by XXREAL_1:1;
  thus [.a,b.] /\ (A \/ B) c= {a,b}
  proof
    let x be object;
    assume
A2: x in [.a,b.] /\ (A \/ B);
    then reconsider x as Real;
    x in A \/ B by A2,XBOOLE_0:def 4;
    then x in A or x in B by XBOOLE_0:def 3;
    then
A3: x <= a or x >= b by XXREAL_1:234,236;
    x in [.a,b.] by A2,XBOOLE_0:def 4;
    then a <= x & x <= b by XXREAL_1:1;
    then x = a or x = b by A3,XXREAL_0:1;
    hence thesis by TARSKI:def 2;
  end;
  let x be object;
  a in A by XXREAL_1:234;
  then
A4: a in A \/ B by XBOOLE_0:def 3;
  b in B by XXREAL_1:236;
  then
A5: b in A \/ B by XBOOLE_0:def 3;
  assume x in {a,b};
  then x = a or x = b by TARSKI:def 2;
  hence thesis by A1,A4,A5,XBOOLE_0:def 4;
end;
