reserve a,b,c,d for Real;
reserve r,s for Real;
reserve p,q,r,s,t for ExtReal;

theorem
  r < s & (for q st r < q & q < s holds t <= q) implies t <= r
proof
  assume that
A1: r < s and
A2: for q st r < q & q < s holds t <= q;
  for q st r < q holds t <= q
  proof
    let q such that
A3: r < q;
    per cases;
    suppose q < s;
      hence thesis by A2,A3;
    end;
    suppose
A4:   s <= q;
      consider p such that
A5:   r < p and
A6:   p < s by A1,Th227;
      t <= p by A2,A5,A6;
      then t <= s by A6,XXREAL_0:2;
      hence thesis by A4,XXREAL_0:2;
    end;
  end;
  hence thesis by Th227;
end;
