reserve G,G1,G2 for _Graph;
reserve W,W1,W2 for Walk of G;
reserve e,x,y,z for set;
reserve v for Vertex of G;
reserve n,m for Element of NAT;

theorem Th148:
  for W being Path of G, e,v being object st e Joins W.last(),v,G &
  not e in W.edges() & (W is trivial or W is open) & for n being odd Element of
  NAT st 1 < n & n <= len W holds W.n <> v holds W.addEdge(e) is Path-like
proof
  let W be Path of G, e,v be object;
  assume that
A1: e Joins W.last(), v,G and
A2: not e in W.edges() and
A3: W is trivial or W is open and
A4: for n being odd Element of NAT st 1 < n & n <= len W holds W.n <> v;
  reconsider lenW = len W as odd Element of NAT;
  set W2 = W.addEdge(e);
A5: e in W.last().edgesInOut() by A1,GLIB_000:62;
  now
    thus W2 is Trail-like by A2,A5,Lm60;
    let m, n be odd Element of NAT;
    assume that
A6: m < n and
A7: n <= len W2 and
A8: W2.m = W2.n;
    now
      per cases by A3;
      suppose
A9:     W is open;
        now
          per cases;
          suppose
A10:        n <= len W;
A11:        1 <= m by ABIAN:12;
            m <= len W by A6,A10,XXREAL_0:2;
            then m in dom W by A11,FINSEQ_3:25;
            then
A12:        W2.m = W.m by A1,Lm38;
            1 <= n by ABIAN:12;
            then n in dom W by A10,FINSEQ_3:25;
            then
A13:        W.m = W.n by A1,A8,A12,Lm38;
            then m = 1 by A6,A10,Def28;
            then W.first() = W.last() by A6,A10,A13,Def28;
            hence m = 1 & n = len W2 by A9;
          end;
          suppose
            n > len W;
            then lenW + 1 <= n by NAT_1:13;
            then lenW + 1 < n by XXREAL_0:1;
            then lenW + 1 + 1 <= n by NAT_1:13;
            then len W + (1+1) <= n;
            then
A14:        len W2 <= n by A1,Lm37;
            then
A15:        n = len W2 by A7,XXREAL_0:1;
            then W2.n = W2.(len W + 2) by A1,Lm37;
            then
A16:        W2.n = v by A1,Lm38;
            m < len W + (1 + 1) by A1,A6,A15,Lm37;
            then m < len W + 1 + 1;
            then m <= lenW + 1 by NAT_1:13;
            then m < lenW + 1 by XXREAL_0:1;
            then
A17:        m <= len W by NAT_1:13;
            1 <= m by ABIAN:12;
            then m in dom W by A17,FINSEQ_3:25;
            then
A18:        W.m = v by A1,A8,A16,Lm38;
            now
A19:          1 <= m by ABIAN:12;
              assume m <> 1;
              then 1 < m by A19,XXREAL_0:1;
              hence contradiction by A4,A17,A18;
            end;
            hence m = 1;
            thus n = len W2 by A7,A14,XXREAL_0:1;
          end;
        end;
        hence m = 1 & n = len W2;
      end;
      suppose
        W is trivial;
        then ex v being Vertex of G st W = G.walkOf(v) by Lm56;
        then len W = 1 by Th12;
        then
A20:    len W2 = 1 + 2 by A1,Lm37;
A21:    m+1 <= n by A6,NAT_1:13;
A22:    1 <= m by ABIAN:12;
        then 1+1 <= m+1 by XREAL_1:7;
        then 2*1 <= n by A21,XXREAL_0:2;
        then 2*1 < n by XXREAL_0:1;
        then
A23:    len W2 <= n by A20,NAT_1:13;
        then m < 3 by A6,A7,A20,XXREAL_0:1;
        then m+1-1 <= 3-1 by A20,NAT_1:13;
        then m < 2*1 by XXREAL_0:1;
        then m+1 <= 2 by NAT_1:13;
        then m+1-1 <= 2-1 by XREAL_1:13;
        hence m = 1 & n = len W2 by A7,A22,A23,XXREAL_0:1;
      end;
    end;
    hence m = 1 & n = len W2;
  end;
  hence thesis;
end;
