reserve p for Point of TOP-REAL 2,
  f,f1,f2,g for FinSequence of TOP-REAL 2,
  v, v1,v2 for FinSequence of REAL,
  r,s for Real,
  n,m,i,j,k for Nat,
  x for set;
reserve G for Go-board;
reserve D for set,
  f for FinSequence of D,
  M for Matrix of D;
reserve f for FinSequence of TOP-REAL 2;

theorem
  1<=len f & f/.1 in rng Line(G,1) & f/.len f in rng Line(G,len G) &
  f is_sequence_on G implies
 (for i st 1<=i & i<=len G holds ex k st k in dom f & f /.k in rng Line(G,i)) &
 (for i st 1<=i & i<=len G & 2<=len f holds L~f meets rng Line(G,i)) &
 for i,j,k,m
  st 1<=i & i<=len G & 1<=j & j<=len G & k in dom f
      & m in dom f & f/.k in rng Line(G,i) &
     (for n st n in dom f & f/.n in rng Line(G,i)
       holds n<=k) &
      k<m & f/.m in rng Line(G,j)
  holds i<j
proof
  assume that
A1: 1<=len f and
A2: f/.1 in rng Line(G,1) and
A3: f/.len f in rng Line(G,len G) and
A4: f is_sequence_on G;
A5: len f in dom f by A1,FINSEQ_3:25;
  defpred P[Nat] means
1<=$1 & $1<= len G implies ex k st k in dom
  f & f/.k in rng Line(G,$1);
A6: for k st P[k] holds P[k+1]
  proof
    let k;
    assume
A7: 1<=k & k<= len G implies ex i st i in dom f & f/.i in rng Line(G,k );
    assume that
A8: 1<=k+1 and
A9: k+1<=len G;
A10: k+1 in dom G by A8,A9,FINSEQ_3:25;
    per cases;
    suppose
A11:  k=0;
      take 1;
      thus thesis by A1,A2,A11,FINSEQ_3:25;
    end;
    suppose
A12:  k<>0;
      defpred R[Nat] means $1 in dom f & f/.$1 in rng Line(G,k);
A13:  for i be Nat holds R[i] implies i<=len f by FINSEQ_3:25;
A14:  0+1<=k by A12,NAT_1:13;
      then
A15:  ex i be Nat st R[i] by A7,A9,NAT_1:13;
      consider m be Nat such that
A16:  R[m] & for i be Nat st R[i] holds i<= m from NAT_1:sch 6(A13,
      A15);
      take m+1;
      k<=len G by A9,NAT_1:13;
      then
A17:  k in dom G by A14,FINSEQ_3:25;
      thus thesis by A1,A3,A4,A10,A17,A16,Th21;
    end;
  end;
A18: P[0];
  thus
A19: for i holds P[i] from NAT_1:sch 2(A18,A6);
  thus for i st 1<=i & i<=len G & 2<=len f holds L~f meets rng Line(G,i)
  proof
    let i;
    assume that
A20: 1<=i & i<=len G and
A21: 2<=len f;
    consider k such that
A22: k in dom f and
A23: f/.k in rng Line(G,i) by A19,A20;
    f/.k in L~f by A21,A22,Th1;
    then L~f /\ rng Line(G,i) <> {} by A23,XBOOLE_0:def 4;
    hence thesis;
  end;
  let m,k,i,j;
  assume that
A24: 1<=m and
A25: m<=len G and
A26: 1<=k & k<=len G and
A27: i in dom f and
A28: j in dom f and
A29: f/.i in rng Line(G,m) and
A30: for n st n in dom f & f/.n in rng Line(G,m) holds n<=i and
A31: i<j and
A32: f/.j in rng Line(G,k);
A33: i<=len f & j<=len f by A27,A28,FINSEQ_3:25;
    per cases;
    suppose
      m = len G;
      then len f<=i by A3,A5,A30;
      hence thesis by A31,A33,XXREAL_0:1;
    end;
    suppose
      m <> len G;
      then m<len G by A25,XXREAL_0:1;
      then 1<=m+1 & m+1<=len G by NAT_1:11,13;
      then
A34:  m+1 in dom G by FINSEQ_3:25;
      reconsider l = j - i as Element of NAT by A31,INT_1:5;
      defpred P[set] means for n,l be Nat st n=$1 & n>0 & i+n in
      dom f & f/.(i+n) in rng Line(G,l) & l in dom G holds m<l;
A35:  k in dom G by A26,FINSEQ_3:25;
   m in dom G by A24,A25,FINSEQ_3:25;
      then
A36:  f/.(i+1) in rng Line(G,m+1) by A1,A3,A4,A27,A29,A30,A34,Th21;
A37:  for o be Nat st P[o] holds P[o+1]
      proof
        let o be Nat such that
A38:    P[o];
        let n,l be Nat such that
A39:    n=o+1 and
A40:    n>0 and
A41:    i+n in dom f and
A42:    f/.(i+n) in rng Line(G,l) and
A43:    l in dom G;
          per cases;
          suppose
            o=0;
            then l=m+1 by A34,A36,A39,A42,A43,Th2;
            hence thesis by NAT_1:13;
          end;
          suppose
A44:        o<>0;
            1<=i by A27,FINSEQ_3:25;
            then
A45:        1<=i+o by NAT_1:12;
            i+n<=len f & i+o<=i+o+1 by A41,FINSEQ_3:25,NAT_1:12;
            then i+o<=len f by A39,XXREAL_0:2;
            then
A46:        i+o in dom f by A45,FINSEQ_3:25;
            then consider l1 be Nat such that
A47:        l1 in dom G and
A48:        f/.(i+o) in rng Line(G,l1) by A4,Th19;
A49:        m<l1 by A38,A44,A46,A47,A48;
A50:        i+n = i+o+1 by A39;
            per cases by A4,A41,A50,A46,A47,A48,Th20;
            suppose
              f/.(i+n) in rng Line(G,l1);
             hence thesis by A42,A43,A47,A49,Th2;
            end;
            suppose
              for k st f/.(i+n) in rng Line(G,k) & k in dom G holds
              |.l1-k.| = 1;
              then |.l1-l.| = 1 by A42,A43;
               then per cases by SEQM_3:41;
                suppose
                  l1>l & l1=l+1;
                  then m<=l by A49,NAT_1:13;
                  then per cases by XXREAL_0:1;
                  suppose
                    m=l;
                    then i+n<=i by A30,A41,A42;
                    then n<=i-i by XREAL_1:19;
                   hence thesis by A40;
                  end;
                  suppose
                    m<l;
                   hence thesis;
                  end;
                end;
                suppose
                  l1<l & l=l1+1;
                 hence thesis by A49,XXREAL_0:2;
                end;
            end;
          end;
      end;
A51:  P[0];
A52:  for o be Nat holds P[o] from NAT_1:sch 2(A51,A37);
      0< j - i & i+l = j by A31,XREAL_1:50;
      hence thesis by A28,A32,A52,A35;
    end;
end;
