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

theorem
  for G, v, V for G1, G2 being addAdjVertexAll of G,v,V
  ex f being Function of the_Edges_of G1, the_Edges_of G2
  st f|the_Edges_of G = id the_Edges_of G & f is one-to-one onto &
    for v1,e,v2 being object st e Joins v1,v2,G1 holds f.e Joins v1,v2,G2
proof
  let G,v,V;
  let G1,G2 be addAdjVertexAll of G,v,V;
  per cases;
  suppose A1: V c= the_Vertices_of G & not v in the_Vertices_of G;
    :: define an appropiate function using the theorem before
    defpred P[object,object] means
      for v1,v2 being object st $1 Joins v1,v2,G1 holds $2 Joins v1,v2,G2;
    A2: for e1 being object st e1 in the_Edges_of G1
      ex e2 being object st e2 in the_Edges_of G2 & P[e1,e2]
    proof
      let e1 be object;
      assume e1 in the_Edges_of G1;
      then e1 Joins (the_Source_of G1).e1, (the_Target_of G1).e1,G1
        by GLIB_000:def 13;
      then consider e2 being object such that
        A3: e2 Joins (the_Source_of G1).e1, (the_Target_of G1).e1,G2 by Th67;
      take e2;
      thus e2 in the_Edges_of G2 by A3, GLIB_000:def 13;
      let v1, v2 be object;
      assume e1 Joins v1, v2,G1;
      then per cases by GLIB_000:def 13;
      suppose (the_Source_of G1).e1 = v1 & (the_Target_of G1).e1 = v2;
        hence e2 Joins v1,v2,G2 by A3;
      end;
      suppose (the_Source_of G1).e1 = v2 & (the_Target_of G1).e1 = v1;
        hence e2 Joins v1,v2,G2 by A3, GLIB_000:14;
      end;
    end;
    consider f1 being Function of the_Edges_of G1, the_Edges_of G2 such that
      A4: for e1 being object st e1 in the_Edges_of G1 holds P[e1,f1.e1]
      from FUNCT_2:sch 1(A2);
    :: On the old graph the function doesn't have to be the identity
    :: but could be some other automorphism that leaves the vertices in V
    :: unchanged, so we need to correct that.
    set f = f1 +* id the_Edges_of G;
    :: show that the function has the correct domain and range
    :: (I tried using the clustering from FUNCT_4 but it didn't work out.)
    A5: the_Edges_of G c= the_Edges_of G1 by GLIB_006:def 9;
    A6: dom f1 = the_Edges_of G1
    proof
      per cases;
      suppose V <> {};
        then the_Edges_of G2 <> {} by A1, Th47;
        hence thesis by FUNCT_2:def 1;
      end;
      suppose A7: the_Edges_of G <> {};
        the_Edges_of G2 <> {}
        proof
          assume A8: the_Edges_of G2 = {};
          the_Edges_of G c= the_Edges_of G2 by GLIB_006:def 9;
          hence contradiction by A7, A8;
        end;
        hence thesis by FUNCT_2:def 1;
      end;
      suppose V = {} & the_Edges_of G = {};
        then the_Edges_of G1 = {} & the_Edges_of G2 = {} by Lm11;
        hence thesis;
      end;
    end;
    A9: dom f = dom f1 \/ dom id the_Edges_of G by FUNCT_4:def 1
      .= the_Edges_of G1 by A5, A6, XBOOLE_1:12;
    A10: rng id the_Edges_of G c= the_Edges_of G2
      by GLIB_006:def 9;
    A11: rng f1 \/ rng id the_Edges_of G c= the_Edges_of G2
      by A10, XBOOLE_1:8;
    rng f c= rng f1 \/ rng id the_Edges_of G by FUNCT_4:17;
    then reconsider f as Function of the_Edges_of G1, the_Edges_of G2
      by A9, FUNCT_2:2,A11, XBOOLE_1:1;
    take f;
    :: from definition of f, identity on old graph is trivial
    thus f|the_Edges_of G = f|dom id the_Edges_of G
      .= id the_Edges_of G;
    :: time to bring up the edge sets (E1 for both, E2 only for onto)
    consider E1 being set such that
      card V = card E1 and
      A12: E1 misses the_Edges_of G & the_Edges_of G1 = the_Edges_of G \/ E1
      and A13: for v1 being object st v1 in V ex e1 being object st e1 in E1 &
        e1 Joins v1,v,G1 &
        for e2 being object st e2 Joins v1,v,G1 holds e1 = e2
      by A1, Def4;
    consider E2 being set such that
      card V = card E2 and
      A14: E2 misses the_Edges_of G & the_Edges_of G2 = the_Edges_of G \/ E2
      and A15: for v1 being object st v1 in V ex e1 being object st e1 in E2 &
        e1 Joins v1,v,G2 &
        for e2 being object st e2 Joins v1,v,G2 holds e1 = e2
      by A1, Def4;
    :: show the one-to-one property
    for e1,e2 being object st e1 in dom f & e2 in dom f & f.e1 = f.e2
      holds e1 = e2
    proof
      let e1,e2 be object;
      assume that
        A16: e1 in dom f & e2 in dom f and
        A17: f.e1 = f.e2;
      set x1 = (the_Source_of G1).e1, y1 = (the_Target_of G1).e1;
      set x2 = (the_Source_of G1).e2, y2 = (the_Target_of G1).e2;
      A18: e1 in the_Edges_of G1 & e2 in the_Edges_of G1 by A16;
      per cases;
      :: one-to-one on old graph / identity is trivial
      suppose A19: e1 in the_Edges_of G & e2 in the_Edges_of G;
        then e1 in dom id the_Edges_of G & e2 in dom id the_Edges_of G;
        then f.e1 = (id the_Edges_of G).e1 & f.e2 = (id the_Edges_of G).e2
          by FUNCT_4:13;
        then f.e1 = e1 & f.e2 = e2 by A19, FUNCT_1:18;
        hence thesis by A17;
      end;
      :: If e2 is an old edge, it cannot be incident to v.
      :: On the other hand, e1 must be incident to v. This leads
      :: to a contradiction.
      suppose A20: not e1 in the_Edges_of G & e2 in the_Edges_of G;
        then not e1 in dom id the_Edges_of G & e2 in dom id the_Edges_of G;
        then A21: f.e1 = f1.e1 & f.e2 = (id the_Edges_of G).e2
          by FUNCT_4:11, FUNCT_4:13;
        A22: e1 Joins x1,y1,G1 by A18, GLIB_000:def 13;
        then A23: not x1 in the_Vertices_of G or not y1 in the_Vertices_of G
          by A1, A12, A20, Th51;
        e2 Joins x2,y2,G1 by A18, GLIB_000:def 13;
        then A24: e2 Joins x2,y2,G by A20, GLIB_006:72;
        then A25: x2 in the_Vertices_of G & y2 in the_Vertices_of G
          by GLIB_000:13;
        A26: f.e1 Joins x1,y1,G2 by A21,A18, A22, A4;
        A27: e2 Joins x2,y2,G2 by A24, GLIB_006:70;
        f.e2 = e2 by A20, A21, FUNCT_1:18;
        hence thesis by A23, A25, A26, GLIB_000:15,A17,A27;
      end;
      :: symmetric case
      suppose A28: not e2 in the_Edges_of G & e1 in the_Edges_of G;
        then not e2 in dom id the_Edges_of G & e1 in dom id the_Edges_of G;
        then A29: f.e2 = f1.e2 & f.e1 = (id the_Edges_of G).e1
          by FUNCT_4:11, FUNCT_4:13;
        A30: e2 Joins x2,y2,G1 by A18, GLIB_000:def 13;
        then e2 in E1 & ((x2 = v & y2 in V) or (y2 = v & x2 in V))
          by A1, A12, A28, Th51;
        then A31: not x2 in the_Vertices_of G or not y2 in the_Vertices_of G
          by A1;
        e1 Joins x1,y1,G1 by A18, GLIB_000:def 13;
        then A32: e1 Joins x1,y1,G by A28, GLIB_006:72;
        then A33: x1 in the_Vertices_of G & y1 in the_Vertices_of G
          by GLIB_000:13;
        A34: f.e2 Joins x2,y2,G2 by A29,A18, A30, A4;
        A35: e1 Joins x1,y1,G2 by A32, GLIB_006:70;
        f.e1 = e1 by A28, A29, FUNCT_1:18;
        then f.e2 Joins x1,y1,G2 by A17, A35;
        hence thesis by A31, A33,A34, GLIB_000:15;
      end;
      :: interesting case on the new edges
      suppose A36: not e1 in the_Edges_of G & not e2 in the_Edges_of G;
        then not e1 in dom id the_Edges_of G & not e2 in dom id the_Edges_of G;
        then A37: f.e1 = f1.e1 & f.e2 = f1.e2 by FUNCT_4:11;
        A38: e1 Joins x1,y1,G1 by A18, GLIB_000:def 13;
        then A39: e1 in E1 & ((x1 = v & y1 in V) or (y1 = v & x1 in V))
          by A1, A12, A36, Th51;
        A40: e2 Joins x2,y2,G1 by A18, GLIB_000:def 13;
        A41: f.e1 Joins x1,y1,G2 by A18, A38, A37, A4;
        f.e2 Joins x2,y2,G2 by A18, A40, A37, A4;
        :: Now essentially we use the one-to-one property of the new
        :: edges of addAdjVertexAll to show e1 = e2, but because of
        :: the many or's we have to make several further case distinctions
        :: to cover symmetric cases.
        then per cases by A17, A41, GLIB_000:15;
        suppose A42: x1 = x2 & y1 = y2;
          per cases by A39;
          suppose A43: x1 = v & y1 in V;
            then consider e being object such that
              e in E1 & e Joins y1,v,G1 and
              A44: for e3 being object st e3 Joins y1,v,G1 holds e = e3 by A13;
            e1 = e by A44,A38, A43, GLIB_000:14;
            hence thesis by A44, A40, A42, A43, GLIB_000:14;
          end;
          suppose A46: y1 = v & x1 in V;
            then consider e being object such that
              e in E1 & e Joins x1,v,G1 and
              A47: for e3 being object st e3 Joins x1,v,G1 holds e = e3 by A13;
            e1 Joins x1,v,G1 by A38, A46;
            then e1 = e by A47;
            hence thesis by A47, A40, A42, A46;
          end;
        end;
        suppose A49: x1 = y2 & y1 = x2;
          per cases by A39;
          suppose A50: x1 = v & y1 in V;
            then consider e being object such that
              e in E1 & e Joins y1,v,G1 and
              A51: for e3 being object st e3 Joins y1,v,G1 holds e = e3 by A13;
            e1 = e by A51,A38, A50, GLIB_000:14;
            hence thesis by A51, A40, A49, A50;
          end;
          suppose A53: y1 = v & x1 in V;
            then consider e being object such that
              e in E1 & e Joins x1,v,G1 and
              A54: for e3 being object st e3 Joins x1,v,G1 holds e = e3 by A13;
            e1 Joins x1,v,G1 by A38, A53;
            then A55: e1 = e by A54;
            e2 Joins x1,v,G1 by A40, A49, A53, GLIB_000:14;
            hence thesis by A54, A55;
          end;
        end;
      end;
    end;
    hence f is one-to-one by FUNCT_1:def 4;
    :: show the onto property
    for e being object holds e in the_Edges_of G2 implies e in rng f
    proof
      let e be object;
      assume A56: e in the_Edges_of G2;
      per cases;
      :: trivial if e is old edge
      suppose A57: e in the_Edges_of G;
        then e in dom id the_Edges_of G;
        then A58: f.e = (id the_Edges_of G).e by FUNCT_4:13
          .= e by A57, FUNCT_1:18;
        the_Edges_of G c= the_Edges_of G1 by GLIB_006:def 9;
        hence thesis by A58, FUNCT_1:def 3, A9, A57;
      end;
      :: e being a new edge means it is incident to v and a vertex in V,
      :: which in turn must be adjacent by some e1 in G1, also by f.e1
      :: in G2, and the one-to-one property of the edges returns e = f.e1.
      suppose A59: not e in the_Edges_of G;
        set v1 = (the_Source_of G2).e, v2 = (the_Target_of G2).e;
        A60: e Joins v1,v2,G2 by A56, GLIB_000:def 13;
        then per cases by A1, A14, A59, Th51; :: symmetry
        suppose A61: v1 = v & v2 in V;
          then consider e1 being object such that
            A62: e1 in E1 & e1 Joins v2,v,G1 and
            for e2 being object st e2 Joins v2,v,G1 holds e1 = e2 by A13;
          A63: e1 in the_Edges_of G1 by A62, GLIB_000:def 13;
          then A64: f1.e1 Joins v2,v,G2 by A62, A4;
          E1 /\ the_Edges_of G = {} by A12, XBOOLE_0:def 7;
          then not e1 in dom id the_Edges_of G by A62, Lm7;
          then A65: f.e1 Joins v2,v,G2 by A64, FUNCT_4:11;
          consider e3 being object such that
            e3 in E2 & e3 Joins v2,v,G2 and
            A66: for e2 being object st e2 Joins v2,v,G2 holds e3 = e2 by A15,
A61;
          f.e1 = e3 by A65, A66;
          then f.e1 = e by A66,A61, A60, GLIB_000:14;
          hence e in rng f by A63, A9, FUNCT_1:def 3;
        end;
        suppose A68: v2 = v & v1 in V;
          then consider e1 being object such that
            A69: e1 in E1 & e1 Joins v1,v,G1 and
            for e2 being object st e2 Joins v1,v,G1 holds e1 = e2 by A13;
          A70: e1 in the_Edges_of G1 by A69, GLIB_000:def 13;
          then A71: f1.e1 Joins v1,v,G2 by A69, A4;
          E1 /\ the_Edges_of G = {} by A12, XBOOLE_0:def 7;
          then not e1 in dom id the_Edges_of G by A69, Lm7;
          then A72: f.e1 Joins v1,v,G2 by A71, FUNCT_4:11;
          consider e3 being object such that
            e3 in E2 & e3 Joins v1,v,G2 and
            A73: for e2 being object st e2 Joins v1,v,G2 holds e3 = e2 by A15,
A68;
          f.e1 = e3 by A72, A73;
          then f.e1 = e by A73,A68, A60;
          hence e in rng f by A70, A9, FUNCT_1:def 3;
        end;
      end;
    end;
    then the_Edges_of G2 c= rng f by TARSKI:def 3;
    hence f is onto by FUNCT_2:def 3, XBOOLE_0:def 10;
    :: rest is trivial from definition of f1 / using the identity on old graph
    let v1,e,v2 be object;
    assume A75: e Joins v1,v2,G1;
    per cases;
    suppose A76: e in the_Edges_of G;
      then e in dom id the_Edges_of G;
      then A77: f.e = (id the_Edges_of G).e by FUNCT_4:13
        .= e by A76, FUNCT_1:18;
      reconsider w1=v1,w2=v2 as set by TARSKI:1;
      e Joins w1,w2,G by A75, A76, GLIB_006:72;
      hence thesis by A77,GLIB_006:70;
    end;
    suppose not e in the_Edges_of G;
      then not e in dom id the_Edges_of G;
      then A78: f.e = f1.e by FUNCT_4:11;
      e in the_Edges_of G1 by A75, GLIB_000:def 13;
      hence thesis by A78,A75, A4;
    end;
  end;
  suppose not (V c= the_Vertices_of G & not v in the_Vertices_of G);
    :: In case we have G == G1 == G2, the identity on the edges obviously
    :: satisfies the requirements.
    then A79: G1 == G & G2 == G by Def4;
    then A80: the_Edges_of G1 = the_Edges_of G &
      the_Edges_of G2 = the_Edges_of G by GLIB_000:def 34;
    set f = id the_Edges_of G;
    reconsider f as Function of the_Edges_of G1, the_Edges_of G2 by A80;
    take f;
    thus f|the_Edges_of G = id the_Edges_of G;
    thus f is one-to-one onto by A80;
    let v1,e,v2 be object;
    assume A81: e Joins v1,v2,G1;
    G1 == G2 by A79, GLIB_000:85;
    then A82: e Joins v1,v2,G2 by A81, GLIB_000:88;
    e in the_Edges_of G1 by A81, GLIB_000:def 13;
    hence thesis by A80, A82, FUNCT_1:18;
  end;
end;
