reserve p,p1,p2,p3,p11,p22,q,q1,q2 for Point of TOP-REAL 2,
  f,h for FinSequence of TOP-REAL 2,
  r,r1,r2,s,s1,s2 for Real,
  u,u1,u2,u5 for Point of Euclid 2,
  n,m,i,j,k for Nat,
  N for Nat,
  x,y,z for set;
reserve lambda for Real;

theorem
  for q,p2,p st q`2 = p2`2 & p`2 <> p2`2 holds (LSeg(p2,|[p2`1,p`2]|) \/
  LSeg(|[p2`1,p`2]|,p)) /\ LSeg(q,p2) = {p2}
proof
  let q,p2,p such that
A1: q`2 = p2`2 and
A2: p`2 <> p2`2;
  set p3 = |[(p2)`1,p`2]|;
  set l23 = LSeg(p2,p3), l3 = LSeg(p3,p), l = LSeg(q,p2);
A3: l3 /\ l = {}
  proof
    set x = the Element of l3 /\ l;
    assume
A4: l3 /\ l <> {};
    then x in l3 by XBOOLE_0:def 4;
    then consider s1 being Real such that
A5: x = (1-s1)*p3 + s1*p and
    0 <= s1 and
    s1 <= 1;
    x in l by A4,XBOOLE_0:def 4;
    then consider s2 being Real such that
A6: x = (1-s2)*q + s2*p2 and
    0 <= s2 and
    s2 <= 1;
A7: ((1-s1)*p3 + s1*p)`2 = ((1-s1)*p3) `2 + (s1*p) `2 by Th2
      .= (1-s1)*(p3 `2) + (s1*p) `2 by Th4
      .= (1-s1)*(p3 `2) + s1*(p `2) by Th4
      .= (1-s1)*(p `2) + s1*(p `2)
      .= p `2;
    ((1-s2)*q + s2*p2) `2 = ((1-s2)*q) `2 + (s2*p2) `2 by Th2
      .= (1-s2)*(q`2) + (s2*p2) `2 by Th4
      .= (1-s2)*(q `2) + s2*(p2 `2) by Th4
      .= p2 `2 by A1;
    hence contradiction by A2,A5,A7,A6;
  end;
A8: l23 /\ l = {p2}
  proof
    thus l23 /\ l c= {p2}
    proof
      let x be object;
      assume
A9:   x in l23 /\ l;
      then x in l23 by XBOOLE_0:def 4;
      then consider s1 being Real such that
A10:  (1-s1)*p2 + s1*p3=x and
      0<=s1 and
      s1<=1;
      x in l by A9,XBOOLE_0:def 4;
      then consider s2 being Real such that
A11:  (1-s2)*q + s2*p2=x and
      0 <= s2 and
      s2 <= 1;
A12:  ((1-s2)*q + s2*p2) `2 = ((1-s2)*q) `2 + (s2*p2) `2 by Th2
        .= (1-s2)*(q`2) + (s2*p2) `2 by Th4
        .= (1-s2)*(q `2) + s2*(p2 `2) by Th4
        .= p2 `2 by A1;
      set t = (1-s1)*p2 + s1*p3;
A13:  t`1 = ((1-s1)*p2) `1 + (s1*p3) `1 by Th2
        .= (1-s1)*(p2 `1) + (s1*p3) `1 by Th4
        .= (1-s1)*(p2 `1) + s1*(p3 `1) by Th4
        .= (1-s1)*(p2 `1) + s1*(p2 `1)
        .= p2 `1;
      t = |[t`1, t`2]| by EUCLID:53
        .= p2 by A10,A13,A11,A12,EUCLID:53;
      hence thesis by A10,TARSKI:def 1;
    end;
    let x be object;
    assume x in {p2};
    then
A14: x=p2 by TARSKI:def 1;
    p2 in l23 & p2 in l by RLTOPSP1:68;
    hence thesis by A14,XBOOLE_0:def 4;
  end;
  thus (l23 \/ l3) /\ l = l23 /\ l \/ l3 /\ l by XBOOLE_1:23
    .= {p2} by A8,A3;
end;
