reserve G, G2 for _Graph, V, E for set,
  v for object;

theorem
  for G2, v, V for G1 being addAdjVertexAll of G2, v, V
  st V c= the_Vertices_of G2 & not v in the_Vertices_of G2 & G2 is acyclic &
    for G3 being Component of G2, w1, w2 being Vertex of G3
      st w1 in V & w2 in V holds w1 = w2
  holds G1 is acyclic
proof
  let G2, v, V;
  let G1 being addAdjVertexAll of G2, v, V;
  assume that
    A1: V c= the_Vertices_of G2 & not v in the_Vertices_of G2 and
    A2: G2 is acyclic and
    A3: for G3 being Component of G2, w1, w2 being Vertex of G3
      st w1 in V & w2 in V holds w1 = w2;
  consider E being set such that
    card V = card E & E misses the_Edges_of G2 &
    the_Edges_of G1 = the_Edges_of G2 \/ E and
    A4: for v1 being object st v1 in V ex e1 being object st e1 in E &
      e1 Joins v1,v,G1 &
      for e2 being object st e2 Joins v1,v,G1 holds e1 = e2 by A1, Def4;
  not ex W being Walk of G1 st W is Cycle-like
  proof
    given C being Walk of G1 such that
      A5: C is Cycle-like;
    A6: C is closed & C is Path-like by A5;
    set v1 = C.first();
    A7: v1 = C.last() by A6, GLIB_001:def 24;
    per cases;
    :: If the cycle doesn't start at v, it can at most contain it once
    suppose A8: v1 <> v;
      then A9: not v1 in {v} by TARSKI:def 1;
      A10: the_Vertices_of G1 = the_Vertices_of G2 \/ {v} by A1, Def4;
      then reconsider v1 as Vertex of G2 by A9, XBOOLE_0:def 3;
      set G3 = the inducedSubgraph of G2, G2.reachableFrom(v1);
      per cases;
      :: If the cycle lies within the component of v1 in G2,
      :: it is a cycle in G2, leading to a contradiction.
      suppose C.vertices() c= G2.reachableFrom(v1);
        then A11: C.vertices() c= the_Vertices_of G2 by XBOOLE_1:1;
        then A12: C.edges() c= the_Edges_of G2 by Th65;
        G2 is Subgraph of G1 by GLIB_006:57;
        then reconsider C2=C as Walk of G2 by A11, A12, GLIB_001:170;
        C2 is Cycle-like by A5, GLIB_006:24;
        hence contradiction by A2, GLIB_002:def 2;
      end;
      :: If the cycle has a vertex out of the component of G2,
      :: it is in another component of G2 or equals v2
      suppose not C.vertices() c= G2.reachableFrom(v1);
        then consider v2 being object such that
          A13: v2 in C.vertices() & not v2 in G2.reachableFrom(v1)
          by TARSKI:def 3;
        reconsider v2 as Vertex of G1 by A13;
        consider n being odd Element of NAT such that
          A14: n <= len C and
          A15: C.n = v2 by A13, GLIB_001:87;
        :: v2 cannot be v1 (=C.1=C.len C) because it is not reachable from v1
        A16: 1 < n & n < len C
        proof
          thus 1 < n
          proof
            assume A17: 1 >= n;
            1 <= n by ABIAN:12;
            then n = 1 by A17, XXREAL_0:1;
            then v2 = v1 by A15, GLIB_001:def 6;
            hence contradiction by A13, GLIB_002:9;
          end;
          assume n >= len C;
          then n = len C by A14, XXREAL_0:1;
          then v2 = v1 by A7, A15, GLIB_001:def 7;
          hence contradiction by A13, GLIB_002:9;
        end;
        per cases;
        :: If v2 <> v, we can split the cycle at v2.
        :: One of the two resulting paths cannot contain v,
        :: hence connects v1 and v2 in G2, leading to a contradiction
        suppose A18: v2 <> v;
          then not v2 in {v} by TARSKI:def 1;
          then reconsider v2 as Vertex of G2 by A10, XBOOLE_0:def 3;
          set P1 = C.cut(1, n);
          set P2 = C.cut(n, len C);
          A19: 1 is odd Element of NAT by Lm16;
          A20: 1 <= n & n <= len C by ABIAN:12, A14;
          A21: n <= len C & len C <= len C by A14;
          A22: len P1 + 1 = n + 1 by A20, A19, GLIB_001:36;
          A23: len P2 + n = len C + 1 by A21, GLIB_001:36;
          not v in P1.vertices() or not v in P2.vertices()
          proof
            assume v in P1.vertices();
            then consider m being odd Element of NAT such that
              A24: m <= len P1 & P1.m = v by GLIB_001:87;
            reconsider m1 = m-'1 as Element of NAT;
            A25: m1 + 1 = m by Lm14;
            m1 < len P1 by A24, Lm14;
            then A26: C.(1+m1) = v by A19, A20, A24, A25, GLIB_001:36;
            assume v in P2.vertices();
            then consider k being odd Element of NAT such that
              A27: k <= len P2 & P2.k = v by GLIB_001:87;
            A28: k < len P2
            proof
              assume k >= len P2;
              then A29: k = len P2 by A27, XXREAL_0:1;
              v1 = C.len C by A7, GLIB_001:def 7
                .= C.cut(n, len C).last() by A21, GLIB_001:37
                .= v by A27, A29, GLIB_001:def 7;
              hence contradiction by A8;
            end;
            reconsider k1 = k-'1 as Element of NAT;
            A30: k1+1 = k by Lm14;
            k1 < len P2 by A27, Lm14;
            then C.(n+k1) = v by A21, A27, A30, GLIB_001:36;
            then A31: C.m = C.(n+k1) by A25, A26;
            reconsider nk = n+k1 as odd Element of NAT by Lm15;
            A32: 1 <= k1
            proof
              A33: 1 <= k by ABIAN:12;
              1 < k
              proof
                assume 1 >= k;
                then k = 1 by A33, XXREAL_0:1;
                then A34: P2.first() = v by A27, GLIB_001:def 6;
                P2.first() = v2 by A15, A21, GLIB_001:37;
                hence contradiction by A34, A18;
              end;
              hence thesis by NAT_D:49;
            end;
            m < len P1 + 1 by A24, NAT_1:13;
            then A35: m < n + 1 by A22;
            n + 1 <= n + k1 by A32, XREAL_1:6;
            then A36: m < nk by A35, XXREAL_0:2;
            A37: 1 <= k by ABIAN:12;
            k + n <= len C + 1 by A27, A23, XREAL_1:6;
            then k + n - 1 <= len C + 1 - 1 by XREAL_1:9;
            then n + (k-1) <= len C;
            then n+k1 <= len C by A37, XREAL_1:233;
            then m = 1 & nk = len C by A6, A31, GLIB_001:def 28,A36;
            hence contradiction by A28, A30, A23;
          end;
          then per cases;
          suppose not v in P1.vertices();
            then reconsider P3=P1 as Walk of G2 by A1, Th64;
            P1 is_Walk_from C.1, C.n by A20, A19, GLIB_001:37;
            then P1 is_Walk_from v1, v2 by A15, GLIB_001:def 6;
            then P3 is_Walk_from v1, v2 by GLIB_001:19;
            then v2 in G2.reachableFrom(v1) by GLIB_002:def 5;
            hence contradiction by A13;
          end;
          suppose not v in P2.vertices();
            then reconsider P3=P2 as Walk of G2 by A1, Th64;
            P2 is_Walk_from C.n, C.len C by A21, GLIB_001:37;
            then P2 is_Walk_from v2, v1 by A15, A7, GLIB_001:def 7;
            then P3 is_Walk_from v2, v1 by GLIB_001:19;
            then P3.reverse() is_Walk_from v1,v2 by GLIB_001:23;
            hence contradiction by A13,GLIB_002:def 5;
          end;
        end;
        :: If v2 = v, we can split the cycle before and after v2,
        :: so the cycle looks like v1,...,w1,v,w2,...,v1.
        suppose A38: v2 = v;
          reconsider m = n-2 as odd Element of NAT by A16, Lm13;
          set P1 = C.cut(1, m);
          set P2 = C.cut(n+2, len C);
          n-2 <= len C - 0 by A14, XREAL_1:13;
          then A39: 1 <= m & m <= len C by ABIAN:12;
          A40: n+2 <= len C & len C <= len C by A16, GLIB_001:1;
          A41: len P1 + 1 = m + 1 by A39, Lm16, GLIB_001:36;
          A42: len P2 + (n+2) = len C + 1 by A40, GLIB_001:36;
          :: Neither of these two paths can contain v and are therefore in G2.
          A43: not v in P1.vertices() & not v in P2.vertices()
          proof
            assume v in P1.vertices() or v in P2.vertices();
            then per cases;
            suppose v in P1.vertices();
              then consider k being odd Element of NAT such that
                A44: k <= len P1 & P1.k = v by GLIB_001:87;
              reconsider k1 = k-'1 as Element of NAT;
              k1 < len P1 by A44, Lm14;
              then P1.(k1+1) = C.(1+k1) by A39, Lm16, GLIB_001:36;
              then P1.k = C.(k1+1) by Lm14;
              then P1.k = C.k by Lm14;
              then A45: C.k = C.n by A38, A15,A44;
              n - 2 < n - 0 by XREAL_1:15;
              then A46: m < n;
              k <= m by A44, A41;
              then k < n & n <= len C by A14, A46, XXREAL_0:2;
              then n = len C by A5, A45, GLIB_001:def 28;
              hence contradiction by A16;
            end;
            suppose v in P2.vertices();
              then consider k being odd Element of NAT such that
                A47: k <= len P2 & P2.k = v by GLIB_001:87;
              reconsider k1 = k-'1 as Element of NAT;
              k1 < len P2 by A47, Lm14;
              then P2.(k1+1) = C.((n+2)+k1) by A40, GLIB_001:36;
              then P2.k = C.(n+(k1+1)+1) by Lm14;
              then A48: P2.k = C.(n+k+1) by Lm14;
              reconsider nk = n+k+1 as odd Element of NAT;
              A49: C.nk = C.n by A38, A15,A47,A48;
              n < nk & nk <= len C
              proof
                n < n + 1 by NAT_1:13;
                then n + 0 < n + 1 + k by XREAL_1:8;
                hence n < nk;
                len P2 + (n+1) = len C by A42;
                then k + (n+1) <= len C by A47, XREAL_1:6;
                hence thesis;
              end;
              then n = 1 by A49, A5, GLIB_001:def 28;
              hence contradiction by A16;
            end;
          end;
          then reconsider P1, P2 as Walk of G2 by A1, Th64;
          set w1 = C.m, w2 = C.(n+2);
          set e1 = C.(m+1), e2 = C.(n+1);
          n-2 < len C - 0 by A14, XREAL_1:15;
          then e1 Joins w1,C.(m+2),G1 &
            e2 Joins C.n,w2, G1 by GLIB_001:def 3,A16;
          :: Since w1 and w2 are adjacent with v, they are in V.
          then A50: e1 Joins w1,v,G1 & e2 Joins w2,v,G1
            by A38, GLIB_000:14, A15;
          then A51: w1 in V & w2 in V by A1, Def4;
          then reconsider w1, w2 as Vertex of G2 by A1;
          C.cut(1, m).first() = C.1 & C.cut(1, m).last() = C.m
            by A39, Lm16, GLIB_001:37;
          then A52: C.cut(1, m).first() = v1 & C.cut(1, m).last() = w1
            by GLIB_001:def 6;
          C.cut(n+2, len C).first() = w2 & C.cut(n+2, len C).last() = C.len C
            by A40, GLIB_001:37;
          then C.cut(n+2, len C).first() = w2 & C.cut(n+2, len C).last() = v1
            by A7, GLIB_001:def 7;
          then A53: C.cut(n+2, len C).reverse().first() = v1 &
            C.cut(n+2, len C).reverse().last() = w2 by GLIB_001:22;
          :: Both paths are connected to v1, so w1 and w2 are in v1s component.
          w1 in G2.reachableFrom(v1) by A1, A43, A52, Th69;
          then reconsider w1 as Vertex of G3 by GLIB_000:def 37;
          w2 in G2.reachableFrom(v1)
          proof
            assume not w2 in G2.reachableFrom(v1);
            then v in C.cut(n+2, len C).reverse().vertices() by A1, A53,Th69;
            then v in C.cut(n+2, len C).vertices() by GLIB_001:92;
            hence contradiction by A43;
          end;
          then reconsider w2 as Vertex of G3 by GLIB_000:def 37;
          :: Then by assumption, w1 = w2.
          A54: w1 = w2 by A51, A3;
          :: But then the edges connecting w1 and w2 with v1 must be equal,
          :: leading to a contradiction because C is a trail.
          consider e3 being object such that
            e3 in E & e3 Joins w1,v,G1 and
            A55: for e5 being object st e5 Joins w1,v,G1 holds e5 = e3
            by A4, A51;
          e1 = e3 & e2 = e3 by A54, A50, A55;
          then A56: C.(n-1) = C.(n+1);
          reconsider n2=m+1 as even Element of NAT;
          n + (-1) < n + 1 by XREAL_1:8;
          then A57: n2 < n+1;
          A58: 1+0 <= m+1 by XREAL_1:7;
          n+2 - 1 <= len C - 0 by A40, XREAL_1:13;
          then 1 <= n2 & n2 < n+1 & n+1 <= len C by A57, A58;
          then C.n2 <> C.(n+1) by A6, GLIB_001:138;
          hence contradiction by A56;
        end;
      end;
    end;
    :: If the cycle starts at v, since it is not trivial,
    :: we can take the inner path C.3,...,C.(len C-2) which cannot contain v
    suppose A59: v1 = v;
      A60: len C >= 5
      proof
        assume len C < 5;
        then len C < 4+1;
        then len C <= 4 by NAT_1:13;
        then A61: len C = 3 by A5, GLIB_001:126, CHORD:7;
        then 1 < len C;
        then C.(1+1) Joins C.1, C.(1+2), G1 by Lm16, GLIB_001:def 3;
        then C.2 Joins C.first(), C.len C, G1 by A61, GLIB_001:def 6;
        then C.2 Joins C.first(), C.last(), G1 by GLIB_001:def 7;
        then C.2 Joins v,v,G1 by A59, A7;
        hence contradiction by A1, Def4;
      end;
      A62: 1 < len C
      proof
        assume A63: 1 >= len C;
        1 <= len C by ABIAN:12;
        then len C = 1 by A63, XXREAL_0:1;
        hence contradiction by A60;
      end;
      then reconsider m = len C - 2 as odd Element of NAT by Lm13;
      len C - 2 < len C - 0 by XREAL_1:15;
      then A64: m < len C;
      set w1 = C.3, w2 = C.m;
      set e1 = C.2, e2 = C.(m+1);
      set P = C.cut(3,m);
      A65: 3 is odd Element of NAT by Lm16;
      A66: len C - 2 <= len C - 0 by XREAL_1:13;
      5-2 <= len C - 2 by A60, XREAL_1:9;
      then A67: 3 <= m & m <= len C by A66;
      then len P + 3 = len C - 2 + 1 by A65, GLIB_001:36;
      then A68: len P + 4 = len C;
      not v in P.vertices()
      proof
        assume v in P.vertices();
        then consider k being odd Element of NAT such that
          A69: k <= len P & P.k = v by GLIB_001:87;
        reconsider k1=k-'1 as Element of NAT;
        A70: k1+1 = k by Lm14;
        k1 < len P by A69, Lm14;
        then P.(k1+1) = C.(3+k1) by A67, A65, GLIB_001:36;
        then A71: C.(3+k1) = C.len C by A7, A59, A69, A70, GLIB_001:def 7;
        reconsider k3=3+k1 as odd Element of NAT by Lm15, Lm16;
        len P + 2 = len C - 2 by A68;
        then A72: len P + 2 < len C - 0 by XREAL_1:15;
        k3 = k1+1+2;
        then k3 = k+2 by Lm14;
        then k3 <= len P + 2 by A69, XREAL_1:6;
        then k3 < len C by A72, XXREAL_0:2;
        then A73: k3 = 1 by A71, A6, GLIB_001:def 28;
        3 <= k3 by NAT_1:11;
        hence contradiction by A73;
      end;
      then reconsider P as Walk of G2 by A1, Th64;
      :: since w1=C.3 and w2=C.(len C-2) are adjacent to v, they are in V
      C.(1+1) Joins C.1,C.(1+2),G1 & C.(m+1) Joins C.m,C.(m+2),G1
        by A62, A64, Lm16, GLIB_001:def 3;
      then e1 Joins v1,w1,G1 & e2 Joins w2,C.len C,G1 by GLIB_001:def 6;
      then e1 Joins w1,v,G1 & e2 Joins w2,C.last(),G1
        by A59, GLIB_000:14, GLIB_001:def 7;
      then A74: e1 Joins w1,v,G1 & e2 Joins w2,v,G1 by A59, A7;
      then A75: w1 in V & w2 in V by A1, Def4;
      then reconsider w1,w2 as Vertex of G2 by A1;
      set G3 = the inducedSubgraph of G2, G2.reachableFrom(w1);
      :: since v is not in the inner path, w1 and w2 share a component
      :: and are therefore equal by assumption
      C.cut(3,m) is_Walk_from w1,w2 by A67, Lm16, GLIB_001:37;
      then P is_Walk_from w1,w2 by GLIB_001:19;
      then w2 in G2.reachableFrom(w1) by GLIB_002:def 5;
      then reconsider w2 as Vertex of G3 by GLIB_000:def 37;
      w1 in G2.reachableFrom(w1) by GLIB_002:9;
      then reconsider w1 as Vertex of G3 by GLIB_000:def 37;
      A76: w1 = w2 by A3, A75;
      :: so w1 and w2 must share the same edge to v,
      :: which contradicts the trail property of C
      consider e3 being object such that
        e3 in E & e3 Joins w1,v,G1 and
        A77: for e5 being object st e5 Joins w1,v,G1 holds e3 = e5
        by A4, A75;
      A78: e1 = e3 & e2 = e3 by A74, A76, A77;
      reconsider n2=1+1 as even Element of NAT by Lm16;
      len C - 1 <= len C - 0 by XREAL_1:13;
      then A79: m+1 <= len C;
      2 < 3 & 3 + 0 <= m + 1 by A67, XREAL_1:7;
      then 1 <= n2 & n2 < m+1 & m+1 <= len C by A79, XXREAL_0:2;
      then C.n2 <> C.(m+1) by A5, GLIB_001:138;
      hence contradiction by A78;
    end;
  end;
  hence thesis by GLIB_002:def 2;
end;
