
theorem
  for G2 being _Graph, V being finite Subset of the_Vertices_of G2
  for G1 being addLoops of G2, V
  ex p being non empty Graph-yielding FinSequence
  st p.1 == G2 & p.len p = G1 & len p = card V + 1 &
    for n being Element of dom p st n <= len p - 1 holds
    ex v being Vertex of G2, e being object
    st p.(n+1) is addEdge of p.n, v,e,v & v in V & not e in the_Edges_of p.n
proof
  :: Proof follows along the lines of the similar ones done in GLIB_008
  defpred P[Nat] means for G2 being _Graph
    for V being finite Subset of the_Vertices_of G2
    for G1 being addLoops of G2, V st card V = $1
    ex p being non empty Graph-yielding FinSequence
    st p.1 == G2 & p.len p = G1 & len p = card V + 1 &
      for n being Element of dom p st n <= len p - 1 holds
      ex v being Vertex of G2, e being object
      st p.(n+1) is addEdge of p.n, v,e,v & v in V & not e in the_Edges_of p.n;
  A1: P[0]
  proof
    :: no loops added at all
    let G2 be _Graph, V being finite Subset of the_Vertices_of G2;
    let G1 be addLoops of G2, V;
    assume card V = 0;
    then A2: V = {};
    take p = <* G1 *>;
    thus p.1 == G2 by A2, Th21;
    thus p.len p = p.1 by FINSEQ_1:40 .= G1;
    thus len p = card V + 1 by A2, FINSEQ_1:40;
    let n be Element of dom p;
    A3: 1 <= n by FINSEQ_3:25;
    assume n <= len p - 1;
    then n <= 1-1 by FINSEQ_1:40;
    hence thesis by A3, XXREAL_0:2; :: by contradiction
  end;
  A4: for k being Nat st P[k] holds P[k+1]
  proof
    let k be Nat;
    assume A5: P[k];
    let G2 be _Graph, V be finite Subset of the_Vertices_of G2;
    let G1 be addLoops of G2, V;
    assume A6: card V = k+1;
    then A7: V <> {};
    set v0 = the Element of V;
    v0 in V by A7;
    then reconsider v0 as Vertex of G2;
    reconsider V9 = V \ {v0} as finite Subset of the_Vertices_of G2;
    :: we use that we can partition the vertices loops should be added to
    :: into two disjoint subsets and then add loops on one subset first
    A8: V = V9 \/ {v0} by A7, ZFMISC_1:116;
    reconsider V0 = {v0} as finite Subset of the_Vertices_of G2;
    v0 in {v0} by TARSKI:def 1;
    then A9: not v0 in V9 by XBOOLE_0:def 5;
    then V9 misses V0 by ZFMISC_1:50;
    then consider G9 being addLoops of G2, V9 such that
      A10: G1 is addLoops of G9, V0 by A8, Th24;
    card V9 = card V - card V0 by A7, ZFMISC_1:31, CARD_2:44
      .= k+1-1 by A6, CARD_1:30;
    then consider p being non empty Graph-yielding FinSequence such that
      A11: p.1 == G2 & p.len p = G9 & len p = card V9 + 1 and
      A12: for n being Element of dom p st n <= len p - 1 holds
        ex v being Vertex of G2, e being object
        st p.(n+1) is addEdge of p.n, v,e,v & v in V9 &
          not e in the_Edges_of p.n by A5;
    take q = p ^ <* G1 *>;
    1 <= len p by FINSEQ_1:20;
    then 1 in dom p by FINSEQ_3:25;
    hence q.1 == G2 by A11, FINSEQ_1:def 7;
    A13: len q = len p + len <* G1 *> by FINSEQ_1:22
      .= len p + 1 by FINSEQ_1:40;
    hence A14: q.len q = G1 by FINSEQ_1:42;
    thus len q = card V + 1 by A8, A9, A11, A13, CARD_2:41;
    let n be Element of dom q;
    assume n <= len q - 1;
    then per cases by Lm2;
    suppose A15: n = len q - 1;
      then A16: q.(n+1) = G1 by A14;
      A17: 1 <= n by FINSEQ_3:25;
      A18: n = len p by A13, A15;
      then n in dom p by A17, FINSEQ_3:25;
      then A19: q.n = G9 by A11, A18, FINSEQ_1:def 7;
      v0 is Vertex of G9 by Th15;
      then consider e being object such that
        A20: not e in the_Edges_of G9 & G1 is addEdge of G9,v0,e,v0
        by A10, Th27;
      reconsider v0 as Vertex of G2;
      take v0, e;
      thus q.(n+1) is addEdge of q.n,v0,e,v0 by A16, A19, A20;
      thus v0 in V by A7;
      thus not e in the_Edges_of q.n by A19, A20;
    end;
    suppose A21: n <= len p - 1;
      then A22: n+0 <= len p - 1 + 1 by XREAL_1:7;
      1 <= n by FINSEQ_3:25;
      then reconsider m = n as Element of dom p by A22, FINSEQ_3:25;
      consider v being Vertex of G2, e being object such that
        A23: p.(m+1) is addEdge of p.m,v,e,v & v in V9 &
          not e in the_Edges_of p.m by A12, A21;
      1+0 <= n+1 & n+1 <= len p - 1 + 1 by A21, XREAL_1:6;
      then n+1 in dom p by FINSEQ_3:25;
      then A24: q.(n+1) = p.(m+1) by FINSEQ_1:def 7;
      A25: q.n = p.m by FINSEQ_1:def 7;
      take v,e;
      v in V by A23, XBOOLE_1:36, TARSKI:def 3;
      hence thesis by A23, A24, A25;
    end;
  end;
  A26: for k being Nat holds P[k] from NAT_1:sch 2(A1,A4);
  let G2 be _Graph, V be finite Subset of the_Vertices_of G2;
  let G1 be addLoops of G2, V;
  thus thesis by A26;
end;
