reserve x for set,
  p,q,r,s,t,u for ExtReal,
  g for Real,
  a for Element of ExtREAL;

theorem
  p < s & r <= q & s <= r implies ].p,r.] \/ [.s,q.] = ].p,q.]
proof
  assume that
A1: p < s and
A2: r <= q and
A3: s <= r;
  let t;
  thus t in ].p,r.] \/ [.s,q.] implies t in ].p,q.]
  proof
    assume t in ].p,r.] \/ [.s,q.];
    then t in ].p,r.] or t in [.s,q.] by XBOOLE_0:def 3;
    then
A4: p < t & t <= r or s <= t & t <= q by Th1,Th2;
    then
A5: p < t by A1,XXREAL_0:2;
    t <= q by A2,A4,XXREAL_0:2;
    hence thesis by A5,Th2;
  end;
  assume t in ].p,q.];
  then p < t & t <= r or s <= t & t <= q by A3,Th2,XXREAL_0:2;
  then t in ].p,r.] or t in [.s,q.] by Th1,Th2;
  hence thesis by XBOOLE_0:def 3;
end;
