reserve p,p1,p2,p3,q,q1,q2 for Point of TOP-REAL 2,
  i for Nat,
  lambda for Real;

theorem Th38:
  for a,b,c,d being Real st a<=b & c <=d
  holds E-bound rectangle(a,b,c,d) = b
proof
  let a,b,c,d be Real;
  assume that
A1: a<=b and
A2: c <=d;
  set X = rectangle(a,b,c,d);
  reconsider Z = (proj1|X).:the carrier of ((TOP-REAL 2)|X)
  as Subset of REAL;
A3: X = the carrier of ((TOP-REAL 2)|X) by PRE_TOPC:8;
A4: for p be Real st p in Z holds p <= b
  proof
    let p be Real;
    assume p in Z;
    then consider p0 being object such that
A5: p0 in the carrier of (TOP-REAL 2)|X and
    p0 in the carrier of (TOP-REAL 2)|X and
A6: p = (proj1|X).p0 by FUNCT_2:64;
    reconsider p0 as Point of TOP-REAL 2 by A3,A5;
    X= {q : q`1 = a & q`2 <= d & q`2 >= c or q`1 <= b & q`1 >= a & q`2 = d or
    q`1 <= b & q`1 >= a & q`2 = c or q`1 = b & q`2 <= d & q`2 >= c}
    by A1,A2,SPPOL_2:54;
    then ex q being Point of TOP-REAL 2 st p0 = q &
    (q`1 = a & q`2 <= d & q`2 >= c or q`1 <= b & q`1 >= a & q`2 = d or
    q`1 <= b & q`1 >= a & q`2 = c or q`1 = b & q`2 <= d & q`2 >= c) by A3,A5;
    hence thesis by A1,A3,A5,A6,PSCOMP_1:22;
  end;
A7: for q being Real st for p being Real
  st p in Z holds p <= q holds b <= q
  proof
    let q be Real such that
A8: for p be Real st p in Z holds p <= q;
    |[b,d]| in LSeg(|[ b,c ]|, |[ b,d ]|) by RLTOPSP1:68;
    then
A9: |[b,d]| in LSeg(|[ a,c ]|, |[ b,c ]|) \/ LSeg(|[ b,c ]|, |[ b,d ]| )
    by XBOOLE_0:def 3;
    X= (LSeg(|[ a,c ]|, |[ a,d ]|) \/ LSeg(|[ a,d ]|, |[ b,d ]|))
    \/ (LSeg(|[ a,c ]|, |[ b,c ]|) \/ LSeg(|[ b,c ]|, |[ b,d ]|))
    by SPPOL_2:def 3;
    then
A10: |[b,d]| in X by A9,XBOOLE_0:def 3;
    then (proj1|X). |[b,d]| = |[b,d]|`1 by PSCOMP_1:22
      .= b by EUCLID:52;
    hence thesis by A3,A8,A10,FUNCT_2:35;
  end;
  thus E-bound X = upper_bound (proj1|X) by PSCOMP_1:def 9
    .= upper_bound Z by PSCOMP_1:def 2
    .= b by A4,A7,SEQ_4:46;
end;
