reserve x,y,z,r,s for ExtReal;
reserve A,B for ext-real-membered set;
reserve A,B for ext-real-membered set;

theorem
  A is right_end interval & B is interval & sup A = inf B implies A \/
  B is interval
proof
  assume that
A1: A is right_end interval and
A2: B is interval and
A3: sup A = inf B;
  set z = inf B;
A4: z in A by A1,A3;
  for x,y,r st x in A \/ B & y in A \/ B & x < r & r < y holds r in A \/ B
  proof
    let x,y,r such that
A5: x in A \/ B and
A6: y in A \/ B and
A7: x < r and
A8: r < y;
    per cases by A5,A6,XBOOLE_0:def 3;
    suppose
      x in A & y in A;
      then r in A by A1,A7,A8,Th80;
      hence thesis by XBOOLE_0:def 3;
    end;
    suppose that
A9:   x in A and
A10:  y in B;
      per cases;
      suppose
        r <= z;
        then r in A by A1,A4,A7,A9,Th80;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose
        z < r;
        then r in B by A2,A8,A10,Th82;
        hence thesis by XBOOLE_0:def 3;
      end;
    end;
    suppose that
A11:  x in B and
A12:  y in A;
      per cases;
      suppose
        z <= r;
        then r in A by A1,A4,A8,A12,Th80;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose
A13:    r < z;
        z <= x by A11,Th3;
        hence thesis by A7,A13,XXREAL_0:2;
      end;
    end;
    suppose
      x in B & y in B;
      then r in B by A2,A7,A8,Th80;
      hence thesis by XBOOLE_0:def 3;
    end;
  end;
  hence thesis by Th84;
end;
