reserve a, b, c, d, r, s for Real,
  n for Element of NAT,
  p, p1, p2 for Point of TOP-REAL 2,
  x, y for Point of TOP-REAL n,
  C for Simple_closed_curve,
  A, B, P for Subset of TOP-REAL 2,
  U, V for Subset of (TOP-REAL 2)|C`,
  D for compact with_the_max_arc Subset of TOP-REAL 2;

theorem Th57:
  a < b & c < d & p1 in closed_inside_of_rectangle(a,b,c,d) &
  not p2 in closed_inside_of_rectangle(a,b,c,d) & P is_an_arc_of p1,p2 implies
  Segment(P,p1,p2,p1,First_Point(P,p1,p2,rectangle(a,b,c,d))) c=
  closed_inside_of_rectangle(a,b,c,d)
proof
  set R = closed_inside_of_rectangle(a,b,c,d);
  set dR = rectangle(a,b,c,d);
  set n = First_Point(P,p1,p2,dR);
  assume that
A1: a < b and
A2: c < d and
A3: p1 in R and
A4: not p2 in R and
A5: P is_an_arc_of p1,p2;
  let x be object;
  assume that
A6: x in Segment(P,p1,p2,p1,n) and
A7: not x in R;
  reconsider x as Point of T2 by A6;
A8: Fr R = dR by A1,A2,Th52;
  p1 in P by A5,TOPREAL1:1;
  then
A9: P meets R by A3,XBOOLE_0:3;
  p2 in P by A5,TOPREAL1:1;
  then P \ R <> {}T2 by A4,XBOOLE_0:def 5;
  then
A10: P meets dR by A5,A8,A9,CONNSP_1:22,JORDAN6:10;
A11: P is closed by A5,JORDAN6:11;
  then
A12: P /\ dR is closed;
A13: n in P /\ dR by A5,A10,A11,JORDAN5C:def 1;
  per cases;
  suppose x = n;
    then
A14: x in dR by A13,XBOOLE_0:def 4;
    dR c= R by A1,A2,Th45;
    hence thesis by A7,A14;
  end;
  suppose
A15: x <> n;
    reconsider P as non empty Subset of T2 by A5,TOPREAL1:1;
    consider f being Function of I[01], T2|P such that
A16: f is being_homeomorphism and
A17: f.0 = p1 and
A18: f.1 = p2 by A5,TOPREAL1:def 1;
A19: rng f = [#](T2|P) by A16,TOPS_2:def 5
      .= P by PRE_TOPC:def 5;
    n in P by A13,XBOOLE_0:def 4;
    then consider na being object such that
A20: na in dom f and
A21: f.na = n by A19,FUNCT_1:def 3;
    reconsider na as Real by A20;
A22: 0 <= na by A20,BORSUK_1:43;
A23: na <= 1 by A20,BORSUK_1:43;
A24: Segment(P,p1,p2,p1,n) c= P by JORDAN16:2;
    then consider xa being object such that
A25: xa in dom f and
A26: f.xa = x by A6,A19,FUNCT_1:def 3;
    reconsider xa as Real by A25;
A27: 0 <= xa by A25,BORSUK_1:43;
A28: xa <= 1 by A25,BORSUK_1:43;
A29: Segment(P,p1,p2,p1,x) is_an_arc_of p1,x by A3,A5,A6,A7,A24,JORDAN16:24;
    then p1 in Segment(P,p1,p2,p1,x) by TOPREAL1:1;
    then
A30: Segment(P,p1,p2,p1,x) meets R by A3,XBOOLE_0:3;
    x in Segment(P,p1,p2,p1,x) by A29,TOPREAL1:1;
    then Segment(P,p1,p2,p1,x) \ R <> {}T2 by A7,XBOOLE_0:def 5;
    then Segment(P,p1,p2,p1,x) meets Fr R by A29,A30,CONNSP_1:22,JORDAN6:10;
    then consider z being object such that
A31: z in Segment(P,p1,p2,p1,x) and
A32: z in dR by A8,XBOOLE_0:3;
    reconsider z as Point of T2 by A31;
    Segment(P,p1,p2,p1,x) = {p: LE p1,p,P,p1,p2 & LE p,x,P,p1,p2}
    by JORDAN6:26;
    then
A33: ex zz being Point of T2 st ( zz = z)&( LE p1,zz,P,p1,p2)&(
    LE zz,x,P,p1,p2) by A31;
    Segment(P,p1,p2,p1,x) c= P by JORDAN16:2;
    then consider za being object such that
A34: za in dom f and
A35: f.za = z by A19,A31,FUNCT_1:def 3;
    reconsider za as Real by A34;
A36: 0 <= za by A34,BORSUK_1:43;
A37: za <= 1 by A34,BORSUK_1:43;
A38: na <= za by A5,A10,A12,A16,A17,A18,A21,A23,A32,A35,A36,JORDAN5C:def 1;
A39: za <= xa by A16,A17,A18,A26,A27,A28,A33,A35,A37,JORDAN5C:def 3;
    Segment(P,p1,p2,p1,n) = {p: LE p1,p,P,p1,p2 & LE p,n,P,p1,p2}
    by JORDAN6:26;
    then ex xx being Point of T2 st ( xx = x)&( LE p1,xx,P,p1,p2)&(
    LE xx,n,P,p1,p2) by A6;
    then xa <= na by A16,A17,A18,A21,A22,A23,A26,A28,JORDAN5C:def 3;
    then xa < na by A15,A21,A26,XXREAL_0:1;
    hence thesis by A38,A39,XXREAL_0:2;
  end;
end;
