
theorem
  for G being chordal _Graph, P being Path of G st P is open & P is
chordless
for x,e being object st (not x in P.vertices() & e Joins P.last(),x,G &
not ex f being object st f Joins P.(len P-2),x,G)
holds P.addEdge(e) is Path-like
  & P.addEdge(e) is open & P.addEdge(e) is chordless
proof
  let G be chordal _Graph, P be Path of G such that
A1: P is open and
A2: P is chordless;
  let x,e be object such that
A3: not x in P.vertices() and
A4: e Joins P.last(),x,G and
A5: not ex f being object st f Joins P.(len P-2),x,G;
  reconsider Q = P.addEdge(e) as Path of G by A1,A3,A4,GLIB_001:151;
A6: len Q = len P + 2 by A4,GLIB_001:64;
  defpred P[Nat] means (4 <= 2*$1 & 2*$1 <= len P+1) implies for j being odd
  Nat st j + 2*$1 = len P + 2
   holds not ex e being object st e Joins Q.j,x,G;
A7: now
    let n be odd Nat such that
A8: n <= len P;
    1 <= n by Th2;
    then n in dom P by A8,FINSEQ_3:25;
    hence P.n = Q.n by A4,GLIB_001:65;
  end;
A9: Q.last() = x by A4,GLIB_001:63;
  for k being Nat st for a being Nat st a < k holds P[a] holds P[k]
  proof
    let k be Nat such that
A10: for a being Nat st a < k holds P[a];
    assume that
A11: 4 <= 2*k and
    2*k <= len P+1;
    let j be odd Nat such that
A12: j + 2*k = len P + 2;
    j + 4 <= j + 2*k by A11,XREAL_1:7;
    then
A13: j + 4 - 4 <= len P + 2 - 4 by A12,XREAL_1:9;
A14: len P - 2 <= len P by XREAL_1:43;
    then
A15: j <= len P by A13,XXREAL_0:2;
A16: j in NAT by ORDINAL1:def 12;
    let e be object such that
A17: e Joins Q.j,x,G;
    per cases by A13,XXREAL_0:1;
    suppose
      j = len P - 2;
      then Q.j = P.(len P - 2) by A7,XREAL_1:43;
      hence contradiction by A5,A17;
    end;
    suppose
A18:  j < len P - 2*1;
      reconsider lP2 = len P+2 as odd Element of NAT;
      reconsider jj = j as odd Element of NAT by ORDINAL1:def 12;
      set B = Q.cut(jj,lP2);
      len P < len P + 2 by XREAL_1:29;
      then
A19:  j <= len P + 2 by A15,XXREAL_0:2;
      then
A20:  B.last() = x by A9,A6,GLIB_001:37;
A21:  len B + j = len P + 2 + 1 by A6,A19,GLIB_001:36;
A22:  now
        let i be even Nat such that
A23:    i < len B-1;
        j + i < (len B - 1) + j by A23,XREAL_1:8;
        then
A24:    j + i <= len P + 2 - 2 by A21,Th3;
        len B - 1 < len B by XREAL_1:44;
        then
A25:    i < len B by A23,XXREAL_0:2;
A26:    i in NAT by ORDINAL1:def 12;
        then j+i in dom Q by A6,A19,A25,GLIB_001:36;
        then
A27:    1 <= j + i by FINSEQ_3:25;
        B.(i+1) = Q.(j+i) by A6,A19,A26,A25,GLIB_001:36;
        hence B.(i+1) = P.(j+i) & j+i in dom P by A7,A27,A24,FINSEQ_3:25;
      end;
      set C = B.addEdge(e);
A28:  B.first() = Q.j by A6,A19,GLIB_001:37;
A29:  B.first() = Q.j by A6,A19,GLIB_001:37;
      then
A30:  e Joins B.last(),B.first(),G by A17,A20;
A31:  now
        let n be odd Nat such that
A32:    n <= len B;
        1 <= n by Th2;
        then n in dom B by A32,FINSEQ_3:25;
        hence C.n = B.n by A30,GLIB_001:65;
      end;
A33:  len P + 3 - (len P - 2) < len P + 3 - j by A18,XREAL_1:15;
      then
A34:  3 < len B by A21,XXREAL_0:2;
      len B + 2 > 5 + 2 by A21,A33,XREAL_1:8;
      then
A35:  len C > 7 by A17,A20,GLIB_000:14,GLIB_001:64;
A36:  now
        assume C.length() <= 3;
        then 2*C.length() <= 2*3 by XREAL_1:64;
        then 2*C.length()+1 <= 2*3+1 by XREAL_1:6;
        hence contradiction by A35,GLIB_001:112;
      end;
      P.vertexAt(j) = P.j by A15,GLIB_001:def 8;
      then P.j in P.vertices() by A16,A13,A14,GLIB_001:89,XXREAL_0:2;
      then B.first() in P.vertices() by A7,A13,A14,A28,XXREAL_0:2;
      then
A37:  B is open by A3,A20;
      then C is Cycle-like by A17,A34,A29,A20,Th33,GLIB_000:14;
      then C is chordal by A36,Def11;
      then consider m,n being odd Nat such that
A38:  m+2 < n and
A39:  n <= len C and
A40:  C.m <> C.n and
A41:  ex e being object st e Joins C.m,C.n,G and
A42:  C is Cycle-like implies not (m=1 & n = len C) & not (m=1 & n =
      len C-2) & not (m=3 & n = len C) by Th83;
      consider e being object such that
A43:  e Joins C.m,C.n,G by A41;
      1 <= m by Th2;
      then 1-1 <= m-1 by XREAL_1:9;
      then reconsider m1 = m-1 as even Element of NAT by INT_1:3;
      reconsider m1 as even Nat;
A44:  len C = len B + 2 by A17,A20,GLIB_000:14,GLIB_001:64;
      then m+2 < len B+2 by A38,A39,XXREAL_0:2;
      then
A45:  m+2-2 < len B+2-2 by XREAL_1:9;
      then
A46:  m1 < len B-1 by XREAL_1:9;
      then
A47:  B.(m1+1) = P.(j+m1) by A22;
A48:  j+m1 in dom P by A22,A46;
      then
A49:  j+m1 <= len P by FINSEQ_3:25;
A50:  C.last() = Q.j by A28,A30,GLIB_001:63;
      now
        assume
A51:    n = len C;
        then e Joins P.(j+m1),Q.j,G by A31,A50,A43,A45,A47;
        then e Joins P.(j+m1),P.j,G by A7,A13,A14,XXREAL_0:2;
        then
A52:    e Joins P.j,P.(j+m1),G;
        3 < m by A17,A34,A29,A20,A37,A42,A51,Th7,Th33,GLIB_000:14,XXREAL_0:2;
        then
A53:    2+1-1 < m-1 by XREAL_1:9;
        then
A54:    j < j+m1 by XREAL_1:29;
        j + 2 < j+m1 by A53,XREAL_1:8;
        hence contradiction by A1,A2,A49,A52,A54,Th91;
      end;
      then n < len B+2*1 by A44,A39,XXREAL_0:1;
      then
A55:  n <= len B+2-2 by Th3;
      then
A56:  C.n = B.n by A31;
      1 <= n by Th2;
      then 1-1 <= n-1 by XREAL_1:9;
      then reconsider n1 = n-1 as even Element of NAT by INT_1:3;
      reconsider n1 as even Nat;
      m+2-1 <n-1 by A38,XREAL_1:9;
      then j+(m1+2) < j+n1 by XREAL_1:8;
      then
A57:  j+m1+2 < j+n1;
      now
        C.m = B.m by A31,A45;
        then
A58:    C.m = Q.(j+m1) by A7,A47,A49;
A59:    len P < len P + 2 by XREAL_1:29;
        j+m1 <= len P by A48,FINSEQ_3:25;
        then consider kk being Nat such that
A60:    (j+m1) + 2*kk = len P+2 by A59,Lm2,XXREAL_0:2;
        assume
A61:    n = len B;
A62:    now
          assume 2*kk < 3+1;
          then 2*kk <= 3 by NAT_1:13;
          then 2*kk = 0 or 2*kk = 2 by Th11;
          hence contradiction by A21,A38,A40,A61,A60;
        end;
        1 <= m by Th2;
        then 1 < m by A34,A37,A30,A44,A42,A61,Th33,XXREAL_0:1;
        then
A63:    1-1 < m-1 by XREAL_1:9;
A64:    now
          assume 2*kk > len P + 1;
          then 2*kk >= len P + 1 + 1 by NAT_1:13;
          hence contradiction by A60,XREAL_1:29;
        end;
A65:    now
          assume kk >= k;
          then
A66:      2*kk >= 2*k by XREAL_1:64;
          j + 2*kk + m1 > j + 2*kk by A63,XREAL_1:29;
          hence contradiction by A12,A60,A66,XREAL_1:7;
        end;
        C.n = x by A20,A31,A61;
        hence contradiction by A10,A43,A60,A62,A64,A65,A58;
      end;
      then n < len B by A55,XXREAL_0:1;
      then
A67:  n1 < len B-1 by XREAL_1:9;
      then j+n1 in dom P by A22;
      then
A68:  j+n1 <= len P by FINSEQ_3:25;
      m < m+2 by XREAL_1:29;
      then m < n by A38,XXREAL_0:2;
      then m1 < n1 by XREAL_1:9;
      then
A69:  j+m1 < j+n1 by XREAL_1:8;
A70:  C.m = B.m by A31,A45;
      B.(n1+1) = P.(j+n1) by A22,A67;
      hence contradiction by A1,A2,A43,A47,A68,A70,A56,A69,A57,Th91;
    end;
  end;
  then
A71: for k being Nat st for a being Nat st a < k holds P[a] holds P[k];
A72: for k being Nat holds P[k] from NAT_1:sch 4(A71);
A73: now
    let n be odd Nat such that
A74: n <= len P-2;
    len P-2 <= len P-2+4 by XREAL_1:31;
    then consider k being Nat such that
A75: n + 2*k = len P + 2 by A74,Lm2,XXREAL_0:2;
A76: now
      assume 2*k > len P + 1;
      then n + 2*k > 1 + (len P + 1) by Th2,XREAL_1:8;
      hence contradiction by A75;
    end;
    now
      assume
A77:  2*k < 4;
      n + 4 <= len P-2+4 by A74,XREAL_1:7;
      hence contradiction by A75,A77,XREAL_1:8;
    end;
    hence not ex e being object st e Joins Q.n,x,G by A72,A75,A76;
  end;
A78: now
    assume Q is chordal;
    then consider m,n being odd Nat such that
A79: m+2 < n and
A80: n <= len Q and
    Q.m <> Q.n and
A81: ex e being object st e Joins Q.m,Q.n,G and
    Q is Cycle-like implies not (m=1 & n = len Q) & not (m=1 & n = len Q-2
    ) & not (m=3 & n = len Q) by Th83;
    m+2 < len P+2 by A6,A79,A80,XXREAL_0:2;
    then
A82: m+2-2 < len P+2-2 by XREAL_1:9;
    m < m+2 by XREAL_1:29;
    then
A83: m < n by A79,XXREAL_0:2;
    per cases by A80,XXREAL_0:1;
    suppose
A84:  n = len Q;
      then m+2-2 < len P+2-2 by A6,A79,XREAL_1:9;
      hence contradiction by A9,A73,A81,A84,Th3;
    end;
    suppose
A85:  n < len Q;
A86:  Q.m = P.m by A7,A82;
A87:  n <= len P + 2 - 2 by A6,A85,Th3;
      then Q.n = P.n by A7;
      hence contradiction by A1,A2,A79,A81,A83,A87,A86,Th91;
    end;
  end;
  Q.first() = P.first() by A4,GLIB_001:63;
  then Q.first() in P.vertices() by GLIB_001:88;
  hence thesis by A3,A9,A78;
end;
