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
  for G being _finite _Graph, W being Path of G holds
    len W.vertexSeq() <= G.order() + 1
proof
  let G be _finite _Graph, W be Path of G;
  now
    per cases;
    suppose
      len W = 1;
      then 1 + 1 = 2 * len W.vertexSeq() by Def14;
      hence thesis by NAT_1:12;
    end;
    suppose
      len W <> 1;
      then W is non trivial by Lm55;
      then consider lenW2 being odd Element of NAT such that
A1:   lenW2 = len W - 2 and
A2:   W.cut(1,lenW2).addEdge(W.(lenW2+1)) = W by Th131;
      set W2 = W.cut(1,lenW2), vs1 = W2.vertexSeq();
      consider f being Function such that
A3:   dom f = vs1 & for x being object st x in vs1 holds f.x = x`2 from
      FUNCT_1:sch 3;
A4:   lenW2 < len W - 0 by A1,XREAL_1:15;
      then
A5:   len W2 = lenW2 by Lm22;
      now
        let x1, x2 be object;
        assume that
A6:     x1 in dom f and
A7:     x2 in dom f and
A8:     f.x1 = f.x2;
        consider a1,b1 being object such that
A9:     x1 = [a1,b1] by A3,A6,RELAT_1:def 1;
A10:    b1 = vs1.a1 by A3,A6,A9,FUNCT_1:1;
A11:    f.x1 = x1`2 by A3,A6
          .= b1 by A9;
        consider a2,b2 being object such that
A12:    x2 = [a2,b2] by A3,A7,RELAT_1:def 1;
A13:    a2 in dom vs1 by A3,A7,A12,FUNCT_1:1;
A14:    a1 in dom vs1 by A3,A6,A9,FUNCT_1:1;
A15:    b2 = vs1.a2 by A3,A7,A12,FUNCT_1:1;
A16:    f.x2 = x2`2 by A3,A7
          .= b2 by A12;
        reconsider a1,a2 as Element of NAT by A14,A13;
A17:    now
          let n1,n2 be Element of NAT;
          assume that
A18:      n1<n2 and
A19:      n1 in dom vs1 and
A20:      n2 in dom vs1 and
A21:      vs1.n1 = vs1.n2;
A22:      2*n2-1 in dom W2 by A20,Th71;
A23:      2*n1-1 in dom W2 by A19,Th71;
          then reconsider a = 2*n1-1, b=2*n2-1 as odd Element of NAT by A22;
A24:      W2.b = W.b by A4,A22,Lm23;
A25:      n2 <= len vs1 by A20,FINSEQ_3:25;
          1 <= n2 by A20,FINSEQ_3:25;
          then
A26:      vs1.n2 = W2.b by A25,Def14;
A27:      n1 <= len vs1 by A19,FINSEQ_3:25;
          1 <= n1 by A19,FINSEQ_3:25;
          then
A28:      vs1.n1 = W2.a by A27,Def14;
          b <= lenW2 by A5,A22,FINSEQ_3:25;
          then
A29:      b < len W by A4,XXREAL_0:2;
          2*n1 < 2*n2 by A18,XREAL_1:68;
          then
A30:      a < b by XREAL_1:14;
          W2.a = W.a by A4,A23,Lm23;
          hence contradiction by A21,A28,A26,A24,A30,A29,Def28;
        end;
        now
          assume
A31:      a1 <> a2;
          now
            per cases;
            suppose
              a1 <= a2;
              then a1 < a2 by A31,XXREAL_0:1;
              hence contradiction by A8,A11,A16,A14,A10,A13,A15,A17;
            end;
            suppose
              a1 > a2;
              hence contradiction by A8,A11,A16,A14,A10,A13,A15,A17;
            end;
          end;
          hence contradiction;
        end;
        hence x1 = x2 by A8,A9,A12,A11,A16;
      end;
      then
A32:  f is one-to-one by FUNCT_1:def 4;
      now
        let y be object;
        assume y in rng f;
        then consider x being object such that
A33:    x in dom f and
A34:    f.x = y by FUNCT_1:def 3;
        consider a,b being object such that
A35:    x = [a,b] by A3,A33,RELAT_1:def 1;
        y = x`2 by A3,A33,A34;
        then
A36:    y = b by A35;
A37:    b = vs1.a by A3,A33,A35,FUNCT_1:1;
        a in dom vs1 by A3,A33,A35,FUNCT_1:1;
        then y in rng vs1 by A36,A37,FUNCT_1:def 3;
        hence y in the_Vertices_of G;
      end;
      then rng f c= the_Vertices_of G by TARSKI:def 3;
      then Segm card vs1 c= Segm card the_Vertices_of G by A3,A32,CARD_1:10;
      then card vs1 <= card the_Vertices_of G by NAT_1:39;
      then len vs1 <= G.order() by GLIB_000:def 24;
      then
A38:  len vs1 + 1 <= G.order() + 1 by XREAL_1:7;
A39:  lenW2 < len W - 0 by A1,XREAL_1:15;
      then
A40:  W.(lenW2+1) Joins W.lenW2, W.(lenW2+2), G by Def3;
      1 <= lenW2 by ABIAN:12;
      then W2.last() = W.lenW2 by A39,Lm16,JORDAN12:2;
      then W.vertexSeq() = vs1 ^ <*W.(lenW2+2)*> by A2,A40,Th73;
      then len W.vertexSeq() = len vs1 + len <*W.(lenW2+2)*> by FINSEQ_1:22;
      hence thesis by A38,FINSEQ_1:39;
    end;
  end;
  hence thesis;
end;
