reserve n for Nat,
  a, b, r, w for Real,
  x, y, z for Point of TOP-REAL n,
  e for Point of Euclid n;
reserve V for RealLinearSpace,
        p,q,x for Element of V;
reserve p, q, x for Point of TOP-REAL n;
reserve s, t for Point of TOP-REAL 2;

theorem Th64:
 for V being RealLinearSpace, p1,p2,p3 being Point of V
   st p1 in halfline(p2,p3)
  holds p1 in LSeg(p2,p3) or p3 in LSeg(p2,p1)
proof let V be RealLinearSpace, p1,p2,p3 be Point of V;
 assume p1 in halfline(p2,p3);
  then consider r such that
A1: p1 = (1-r)*p2 + r*p3 and
A2: 0 <= r;
  set s = 1/r;
  now per cases;
   case r <= 1;
    hence p1 in LSeg(p2,p3) by A1,A2;
   end;
   case
A3:  r >= 1;
    per cases by A2;
    case r = 0;
      then p1 = p2 by A1,Th2;
     hence p1 in LSeg(p2,p3) by RLTOPSP1:68;
    end;
    case
A4:  r > 0;
     then
A5:  s*r = 1 by XCMPLX_1:87;
A6:  s <= 1 by A3,XREAL_1:183;
A7:  r*p3 = p1 - (1-r)*p2 by RLVECT_4:1,A1;
    (s*r)*p3 = s*(r*p3) by RLVECT_1:def 7
           .= s*p1 - s*((1-r)*p2) by RLVECT_1:34,A7
           .= s*p1 - s*(1-r)*p2 by RLVECT_1:def 7;
    then p3 = s*p1 - s*(1-r)*p2 by RLVECT_1:def 8,A5
           .= s*p1 + (-s*(1-r))*p2 by RLVECT_1:79
           .= s*p1 + (1-s)*p2 by A5;
    hence p3 in LSeg(p2,p1) by A4,A6;
    end;
   end;
  end;
 hence thesis;
end;
