reserve P,P1,P2,R for Subset of TOP-REAL 2,
  p,p1,p2,p3,p11,p22,q,q1,q2,q3,q4 for Point of TOP-REAL 2,
  f,h for FinSequence of TOP-REAL 2,
  r for Real,
  u for Point of Euclid 2,
  n,m,i,j,k for Nat,
  x,y for set;

theorem Th17:
  p<>f/.1 & f is being_S-Seq & p in LSeg(f,n) implies ex h st h is
being_S-Seq & h/.1=f/.1 & h/.len h = p & L~h is_S-P_arc_joining f/.1,p & L~h c=
  L~f & L~h = L~(f|n) \/ LSeg(f/.n,p)
proof
  set p1 = f/.1, q = f/.n;
  assume that
A1: p<>p1 and
A2: f is being_S-Seq and
A3: p in LSeg(f,n);
A4: f is special by A2;
A5: n <= n+1 by NAT_1:11;
A6: now
    assume
A7: not n in dom f or not n+1 in dom f;
    now
      per cases by A7;
      suppose
        not n in dom f;
        then not(1 <= n & n <= len f) by FINSEQ_3:25;
        then not(1 <= n & n+1 <= len f) by A5,XXREAL_0:2;
        hence contradiction by A3,TOPREAL1:def 3;
      end;
      suppose
        not n+1 in dom f;
        then not(1 <= n+1 & n+1<= len f) by FINSEQ_3:25;
        hence contradiction by A3,NAT_1:11,TOPREAL1:def 3;
      end;
    end;
    hence contradiction;
  end;
A8: f is one-to-one by A2;
A9: Seg len f=dom f by FINSEQ_1:def 3;
  then
A10: 1<=n by A6,FINSEQ_1:1;
A11: n+1<=len f by A6,A9,FINSEQ_1:1;
A12: n<=len f by A6,A9,FINSEQ_1:1;
  now
    per cases;
    case
      f/.n = p & f/.(n+1) = p;
      then n+1 = n by A6,A8,PARTFUN2:10;
      hence contradiction;
    end;
    case
A13:  f/.n = p & f/.(n+1) <> p;
      then 1<n by A1,A10,XXREAL_0:1;
      then
A14:  1+1<=n by NAT_1:13;
      now
        per cases by A14,XXREAL_0:1;
        suppose
A15:      n=1+1;
          now
            per cases by A4,A12,A13,A15;
            suppose
A16:          p1`1=p`1;
              take h = <* p1,|[p1`1,(p1`2+p`2)/2]|,p *>;
              thus h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A1,A2,A13
,A15,A16,Th15;
            end;
            suppose
A17:          p1`2=p`2;
              take h = <* p1,|[(p1`1+p`1)/2,p1`2]|,p *>;
              thus h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A1,A2,A13
,A15,A17,Th14;
            end;
          end;
          hence thesis;
        end;
        suppose
A18:      n>2;
          take h=f|n;
          thus h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A2,A6,A13
,A18,Th16;
        end;
      end;
      hence thesis;
    end;
    case
A19:  f/.n <> p & f/.(n+1) = p;
      now
        per cases by A10,XXREAL_0:1;
        suppose
A20:      n=1;
          now
            per cases by A4,A11,A19,A20;
            suppose
A21:          p1`1= p`1;
              take h=<* p1,|[p1`1,(p1`2+p`2)/2]|,p *>;
              thus h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A2,A19,A20
,A21,Th15;
            end;
            suppose
A22:          p1`2=p`2;
              take h=<* p1,|[(p1`1+p`1)/2,p1`2]|,p *>;
              thus h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A2,A19,A20
,A22,Th14;
            end;
          end;
          hence thesis;
        end;
        suppose
A23:      1<n;
          take h=f|(n+1);
          1+1<n+1 by A23,XREAL_1:6;
          hence h is being_S-Seq & h/.1=p1 & h/.len h=p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A2,A6,A19
,Th16,TOPREAL3:38;
        end;
      end;
      hence thesis;
    end;
    case
A24:  f/.n <> p & f/.(n+1) <> p;
      now
        per cases by A10,XXREAL_0:1;
        suppose
A25:      n=1;
          set q1 = f/.(1+1);
A26:      len f >= 1+1 by A2;
          then
A27:      LSeg(f,n) = LSeg(p1,q1) by A25,TOPREAL1:def 3;
          now
            per cases by A4,A26;
            suppose
A28:          p1`1=q1`1;
              take h = <* p1,|[p1`1,(p1`2+p`2)/2]|,p *>;
              p1`1 <= p`1 & p`1 <= q1`1 by A3,A27,A28,TOPREAL1:3;
              then p1`1 = p`1 by A28,XXREAL_0:1;
              hence h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A1,A2,A3
,A25,Th12;
            end;
            suppose
A29:          p1`2=q1`2;
              take h = <* p1,|[(p1`1+p`1)/2,p1`2]|,p *>;
              p1`2 <= p`2 & p`2 <= q1`2 by A3,A27,A29,TOPREAL1:4;
              then p1`2 = p`2 by A29,XXREAL_0:1;
              hence h is being_S-Seq & h/.1=p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h = L~(f|n) \/ LSeg(q,p) by A1,A2,A3
,A25,Th11;
            end;
          end;
          hence thesis;
        end;
        suppose
A30:      1<n;
          take h = (f|n)^<*p*>;
          thus h is being_S-Seq & h/.1 = p1 & h/.len h = p & L~h
is_S-P_arc_joining p1,p & L~h c= L~f & L~h =L~(f|n) \/ LSeg(q,p) by A2,A3,A6
,A24,A30,Th13;
        end;
      end;
      hence thesis;
    end;
  end;
  hence thesis;
end;
