
theorem Th30:
  for T being non _trivial _finite _Tree, v being Vertex of T
  ex v1, v2 being Vertex of T
  st v1 <> v2 & v1 is endvertex & v2 is endvertex &
    v in T.pathBetween(v1,v2).vertices()
proof
  defpred P[Nat] means for T being non _trivial _finite _Tree
    for v being Vertex of T st T.order() = $1 + 2 holds
    ex v1, v2 being Vertex of T
    st v1 <> v2 & v1 is endvertex & v2 is endvertex &
      v in T.pathBetween(v1,v2).vertices();
  A1: P[0]
  proof
    let T be non _trivial _finite _Tree, v be Vertex of T;
    assume A2: T.order() = 0 + 2;
    then card the_Vertices_of T = 2 by GLIB_000:def 24;
    then consider v1, v2 being object such that
      A3: v1 <> v2 & the_Vertices_of T = {v1,v2} by CARD_2:60;
    reconsider v1, v2 as Vertex of T by A3, TARSKI:def 2;
    take v1, v2;
    thus v1 <> v2 by A3;
    thus v1 is endvertex & v2 is endvertex by A2, Th27;
    v = v1 or v = v2 by A3, TARSKI:def 2;
    hence thesis by HELLY:29;
  end;
  A4: for k being Nat st P[k] holds P[k+1]
  proof
    let k be Nat;
    assume A5: P[k];
    let T be non _trivial _finite _Tree, v be Vertex of T;
    assume A6: T.order() = (k+1) + 2;
    set v0 = the endvertex Vertex of T;
    per cases;
    suppose A7: v = v0;
      consider v1, v2 being Vertex of T such that
        A8: v1 <> v2 & v1 is endvertex & v2 is endvertex by GLIB_002:45;
      per cases;
      suppose A9: v <> v1;
        take v, v1;
        thus v <> v1 & v is endvertex & v1 is endvertex by A7, A8, A9;
        thus thesis by HELLY:29;
      end;
      suppose A10: v = v1;
        take v, v2;
        thus v <> v2 & v is endvertex & v2 is endvertex by A8, A10;
        thus thesis by HELLY:29;
      end;
    end;
    suppose A11: v <> v0;
      set T0 = the removeVertex of T, v0;
a12:  T0.order() + 1 = k + 2 + 1 by A6, GLIB_000:48;
      T0.order() <> 1
      proof
        assume T0.order() = 1;
        then 0+1 = k + 1 + 1 by a12;
        hence contradiction;
      end;
      then reconsider T0 as non _trivial _finite _Tree by GLIB_000:26;
      not v in {v0} by A11, TARSKI:def 1;
      then v in the_Vertices_of T \ {v0} by XBOOLE_0:def 5;
      then v in the_Vertices_of T0 by GLIB_000:47;
      then consider v1,v2 being Vertex of T0 such that
        A13: v1 <> v2 & v1 is endvertex & v2 is endvertex and
        A14: v in T0.pathBetween(v1,v2).vertices() by A5, a12;
      the_Vertices_of T0 c= the_Vertices_of T by GLIB_000:def 32;
      then reconsider w1 = v1, w2 = v2 as Vertex of T by TARSKI:def 3;
      consider e0 being object such that
        A15: v0.edgesInOut() = {e0} & not e0 Joins v0,v0,T by GLIB_000:def 51;
      A16: the_Edges_of T0
         = T.edgesBetween(the_Vertices_of T \ {v0}) by GLIB_000:47
        .= T.edgesBetween(the_Vertices_of T) \ v0.edgesInOut() by GLIB_000:107
        .= the_Edges_of T \ {e0} by A15, GLIB_000:34;
      consider e1 being object such that
        A17: v1.edgesInOut() = {e1} & not e1 Joins v1,v1,T0
        by A13, GLIB_000:def 51;
      consider e2 being object such that
        A18: v2.edgesInOut() = {e2} & not e2 Joins v2,v2,T0
        by A13, GLIB_000:def 51;
      v0 in {v0} by TARSKI:def 1;
      then not v0 in the_Vertices_of T \ {v0} by XBOOLE_0:def 5;
      then A19: not v0 in the_Vertices_of T0 by GLIB_000:47;
      A20: w1 <> v0.adj(e0) implies w1 is endvertex
      proof
        assume A21: w1 <> v0.adj(e0);
        A22: v1.edgesInOut() c= w1.edgesInOut() by GLIB_000:78;
        for e being object st e in w1.edgesInOut() holds e in v1.edgesInOut()
        proof
          let e be object;
          assume A23: e in w1.edgesInOut();
          e <> e0
          proof
            assume e = e0;
            then A24: e0 Joins w1,w1.adj(e0),T by A23, GLIB_000:67;
            e0 in v0.edgesInOut() by A15, TARSKI:def 1;
            then e0 Joins v0,v0.adj(e0),T by GLIB_000:67;
            then w1 = v0 or w1 = v0.adj(e0) by A24, GLIB_000:15;
            hence contradiction by A19, A21;
          end;
          then not e in {e0} by TARSKI:def 1;
          then A25: e in the_Edges_of T0 by A16, A23, XBOOLE_0:def 5;
          then (the_Source_of T0).e = (the_Source_of T).e &
            (the_Target_of T0).e = (the_Target_of T).e by GLIB_000:def 32;
          then (the_Source_of T0).e = w1 or (the_Target_of T0).e = w1
            by A23, GLIB_000:61;
          hence thesis by A25, GLIB_000:61;
        end;
        then w1.edgesInOut() c= v1.edgesInOut() by TARSKI:def 3;
        then v1.edgesInOut() = w1.edgesInOut() by A22, XBOOLE_0:def 10;
        hence w1 is endvertex by A17, GLIB_000:18, GLIB_000:def 51;
      end;
      A26: w2 <> v0.adj(e0) implies w2 is endvertex
      proof
        assume A27: w2 <> v0.adj(e0);
        A28: v2.edgesInOut() c= w2.edgesInOut() by GLIB_000:78;
        for e being object st e in w2.edgesInOut() holds e in v2.edgesInOut()
        proof
          let e be object;
          assume A29: e in w2.edgesInOut();
          e <> e0
          proof
            assume e = e0;
            then A30: e0 Joins w2,w2.adj(e0),T by A29, GLIB_000:67;
            e0 in v0.edgesInOut() by A15, TARSKI:def 1;
            then e0 Joins v0,v0.adj(e0),T by GLIB_000:67;
            then w2 = v0 or w2 = v0.adj(e0) by A30, GLIB_000:15;
            hence contradiction by A19, A27;
          end;
          then not e in {e0} by TARSKI:def 1;
          then A31: e in the_Edges_of T0 by A16, A29, XBOOLE_0:def 5;
          then (the_Source_of T0).e = (the_Source_of T).e &
            (the_Target_of T0).e = (the_Target_of T).e by GLIB_000:def 32;
          then (the_Source_of T0).e = w2 or (the_Target_of T0).e = w2
            by A29, GLIB_000:61;
          hence thesis by A31, GLIB_000:61;
        end;
        then w2.edgesInOut() c= v2.edgesInOut() by TARSKI:def 3;
        then v2.edgesInOut() = w2.edgesInOut() by A28, XBOOLE_0:def 10;
        hence w2 is endvertex by A18, GLIB_000:18, GLIB_000:def 51;
      end;
      A32: T0.pathBetween(v1,v2) = T.pathBetween(w1,w2) by HELLY:33;
      per cases;
      suppose A33: w1 = v0.adj(e0);
        then A34: w2 <> v0.adj(e0) by A13;
        take v0, w2;
        thus v0 <> w2 & v0 is endvertex & w2 is endvertex by A19, A26, A34;
        e0 in v0.edgesInOut() by A15, TARSKI:def 1;
        then A35: e0 Joins v0, w1, T by A33, GLIB_000:67;
        then A36: T.walkOf(v0,e0,w1) = T.pathBetween(v0,w1) by Th29;
        set P1 = T.pathBetween(v0,w1), P2 = T.pathBetween(w1,w2);
        set P = P1.append(P2);
        A37: P1.last() = w1 & P2.first() = w1 by HELLY:28;
        for x being object holds x in P1.vertices() /\ P2.vertices()
          iff x = w1
        proof
          let x be object;
          hereby
            assume x in P1.vertices() /\ P2.vertices();
            then A38: x in P1.vertices() & x in P2.vertices()
              by XBOOLE_0:def 4;
            then A39: x in {v0,w1} by A35, A36, GLIB_001:91;
            x in T0.pathBetween(v1,v2).vertices() by A32, A38, GLIB_001:98;
            then x in the_Vertices_of T0;
            hence x = w1 by A19, A39, TARSKI:def 2;
          end;
          assume x = w1;
          then x = P1.last() & x = P2.first() by HELLY:28;
          then x in P1.vertices() & x in P2.vertices() by GLIB_001:88;
          hence thesis by XBOOLE_0:def 4;
        end;
        then P1.vertices() /\ P2.vertices() = {P1.last()} by A37,TARSKI:def 1;
        then reconsider P as Path of T by A37, HELLY:38;
        P1 is_Walk_from v0,w1 & P2 is_Walk_from w1,w2 by HELLY:def 2;
        then A40: P = T.pathBetween(v0,w2) by GLIB_001:31, HELLY:def 2;
        T0.pathBetween(v1,v2).vertices() = P2.vertices()
          by HELLY:33, GLIB_001:98;
        then v in P1.vertices() \/ P2.vertices() by A14, XBOOLE_0:def 3;
        hence thesis by A37, A40, GLIB_001:93;
      end;
      suppose A41: w2 = v0.adj(e0);
        then A42: w1 <> v0.adj(e0) by A13;
        take w1, v0;
        thus w1 <> v0 & w1 is endvertex & v0 is endvertex by A19, A20, A42;
        e0 in v0.edgesInOut() by A15, TARSKI:def 1;
        then A43: e0 Joins w2, v0, T by A41, GLIB_000:67, GLIB_000:14;
        then A44: T.walkOf(w2,e0,v0) = T.pathBetween(w2,v0) by Th29;
        set P1 = T.pathBetween(w1,w2), P2 = T.pathBetween(w2,v0);
        set P = P1.append(P2);
        A45: P1.last() = w2 & P2.first() = w2 by HELLY:28;
        for x being object holds x in P1.vertices() /\ P2.vertices()
          iff x = w2
        proof
          let x be object;
          hereby
            assume x in P1.vertices() /\ P2.vertices();
            then A46: x in P1.vertices() & x in P2.vertices()
              by XBOOLE_0:def 4;
            then A47: x in {w2,v0} by A43, A44, GLIB_001:91;
            x in T0.pathBetween(v1,v2).vertices() by A32, A46, GLIB_001:98;
            then x in the_Vertices_of T0;
            hence x = w2 by A19, A47, TARSKI:def 2;
          end;
          assume x = w2;
          then x in P1.vertices() & x in P2.vertices() by GLIB_001:88, A45;
          hence thesis by XBOOLE_0:def 4;
        end;
        then P1.vertices() /\ P2.vertices() = {P1.last()} by A45,TARSKI:def 1;
        then reconsider P as Path of T by A45, HELLY:38;
        P1 is_Walk_from w1,w2 & P2 is_Walk_from w2,v0 by HELLY:def 2;
        then A48: P = T.pathBetween(w1,v0) by GLIB_001:31, HELLY:def 2;
        T0.pathBetween(v1,v2).vertices() = P1.vertices()
          by HELLY:33, GLIB_001:98;
        then v in P1.vertices() \/ P2.vertices() by A14, XBOOLE_0:def 3;
        hence thesis by A45, A48, GLIB_001:93;
      end;
      suppose A49: w1 <> v0.adj(e0) & w2 <> v0.adj(e0);
        take w1, w2;
        thus w1<>w2 & w1 is endvertex & w2 is endvertex by A13, A20, A26, A49;
        thus thesis by A14, GLIB_001:98, HELLY:33;
      end;
    end;
  end;
  A50: for k being Nat holds P[k] from NAT_1:sch 2(A1,A4);
  let T be non _trivial _finite _Tree, v be Vertex of T;
  T.order() >= 1 & T.order() <> 1 by GLIB_000:25, GLIB_000:26;
  then T.order() > 1 by XXREAL_0:1;
  then T.order() >= 1+1 by INT_1:7;
  then consider k being Nat such that
    A51: T.order() = 2 + k by NAT_1:10;
  thus thesis by A50, A51;
end;
