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

theorem
  p<=r & p<=s & r<=q & s<=q implies [.p,r.[ \/ [.r,s.] \/ ].s,q.] = [.p,q.]
proof
  assume that
A1: p <= r and
A2: p <= s and
A3: r <= q and
A4: s <= q;
  per cases;
  suppose r <= s;
    hence [.p,r.[ \/ [.r,s.] \/ ].s,q.] = [.p,s.] \/ ].s,q.] by A1,Th166
      .= [.p,q.] by A2,A4,Th167;
  end;
  suppose
A5: s < r;
    hence [.p,r.[ \/ [.r,s.] \/ ].s,q.] = [.p,r.[ \/ {} \/ ].s,q.] by Th29
      .= [.p,q.] by A2,A3,A5,Th175;
  end;
end;
