
theorem Th29:
  for G3, G4 being _Graph, V1, V2 being set
  for G1 being addLoops of G3, V1, G2 being addLoops of G4, V2
  for F0 being PGraphMapping of G3, G4
  st V1 c= the_Vertices_of G3 & V2 c= the_Vertices_of G4 &
    F0_V | V1 is one-to-one & dom(F0_V | V1) = V1 & rng(F0_V | V1) = V2
  ex F being PGraphMapping of G1, G2 st
    F_V = F0_V & F_E | dom F0_E = F0_E &
    (F0 is non empty  implies F is non empty) &
    (F0 is total implies F is total) &
    (F0 is onto implies F is onto) &
    (F0 is one-to-one implies F is one-to-one) &
    (F0 is directed implies F is directed) &
    (F0 is weak_SG-embedding implies F is weak_SG-embedding) &
    (F0 is isomorphism implies F is isomorphism) &
    (F0 is Disomorphism implies F is Disomorphism)
proof
  let G3, G4 be _Graph, V1, V2 be set;
  let G1 be addLoops of G3, V1, G2 be addLoops of G4, V2;
  let F0 be PGraphMapping of G3, G4;
  assume that
    A1: V1 c= the_Vertices_of G3 & V2 c= the_Vertices_of G4 and
    A2: F0_V | V1 is one-to-one & dom(F0_V | V1) = V1 & rng(F0_V | V1) = V2;
  :: define F_V and F_E
  the_Vertices_of G1 = the_Vertices_of G3 &
    the_Vertices_of G2 = the_Vertices_of G4 by A1, Def5;
  then reconsider f=F0_V as PartFunc of the_Vertices_of G1, the_Vertices_of G2;
  :: below does not accept A2 instead of A1...
  consider E1 being set, f1 being one-to-one Function such that
    A3: E1 misses the_Edges_of G3 & the_Edges_of G1 = the_Edges_of G3 \/ E1 &
      dom f1 = E1 & rng f1 = V1 & the_Source_of G1 = the_Source_of G3 +* f1 &
      the_Target_of G1 = the_Target_of G3 +* f1 by A1, Def5;
  :: why does the checker accept the following?
  consider E2 being set, f2 being one-to-one Function such that
    A4: E2 misses the_Edges_of G4 & the_Edges_of G2 = the_Edges_of G4 \/ E2 &
      dom f2 = E2 & rng f2 = V2 & the_Source_of G2 = the_Source_of G4 +* f2 &
      the_Target_of G2 = the_Target_of G4 +* f2 by A2, Def5;
  set h = f2"*(F0_V|V1)*f1;
  set g = F0_E +* h;
  A5: dom g = dom F0_E \/ dom h by FUNCT_4:def 1;
  A6: dom(f2") = rng(F0_V|V1) by A2, A4, FUNCT_1:33;
  then A7: dom(f2"*(F0_V|V1)) = rng f1 by A2, A3, RELAT_1:27;
  then A8: dom h = E1 by A3, RELAT_1:27;
  then A9: dom g c= the_Edges_of G1 by A3, A5, XBOOLE_1:9;
  rng(f2"*(F0_V|V1)) = rng(f2") by A6, RELAT_1:28
    .= E2 by A4, FUNCT_1:33;
  then A10: rng h = E2 by A7, RELAT_1:28;
  A11: rng g c= rng F0_E \/ rng h by FUNCT_4:17;
  rng F0_E \/ rng h c= the_Edges_of G4 \/ E2 by A10, XBOOLE_1:9;
  then rng g c= the_Edges_of G2 by A4, A11, XBOOLE_1:1;
  then reconsider g as PartFunc of the_Edges_of G1, the_Edges_of G2
    by A9, RELSET_1:4;
  A12: dom((F0_V|V1)*f1) = dom f1 by A2, A3, RELAT_1:27;
  :: reconsider F as PGM
  now
    hereby
      let e be object;
      set v = (the_Source_of G1).e, w = (the_Target_of G1).e;
      assume e in dom g;
      then per cases by FUNCT_4:12;
      suppose A13: e in dom F0_E;
        then v = (the_Source_of G3).e & w = (the_Target_of G3).e
          by GLIB_006:def 9;
        hence v in dom f & w in dom f by A13, GLIB_010:5;
      end;
      suppose e in dom h;
        then A14: e in dom f1 by A3, A8;
        then v = f1.e & w = f1.e by A3, FUNCT_4:13;
        then v in V1 & w in V1 by A3, A14, FUNCT_1:3;
        hence v in dom f & w in dom f by A2, RELAT_1:57;
      end;
    end;
    let e,v,w be object;
    assume A15: e in dom g & v in dom f & w in dom f;
    assume A16: e Joins v,w,G1;
    per cases by A15, FUNCT_4:12;
    suppose A17: e in dom F0_E;
      then e Joins v,w,G3 by A16, GLIB_006:72;
      then A18: F0_E.e Joins F0_V.v,F0_V.w,G4 by A15, A17, GLIB_010:4;
      not e in E1 by A3, A15, A17, XBOOLE_0:5;
      then g.e Joins f.v,f.w,G4 by A8, A18, FUNCT_4:11;
      hence g.e Joins f.v,f.w,G2 by GLIB_006:70;
    end;
    suppose e in dom h;
      then A19: e in E1 & g.e = h.e by A8, FUNCT_4:13;
      then (the_Source_of G1).e = f1.e &
        (the_Target_of G1).e = f1.e by A3, FUNCT_4:13;
      then A20: v = f1.e & w = f1.e by A16, GLIB_000:def 13;
      then A21: v in V1 by A3, A19, FUNCT_1:3;
      then A22: f.v = (F0_V|V1).v by FUNCT_1:49;
      then A23: f.v in V2 by A2, A21, FUNCT_1:3;
      then f.v in dom(f2") by A4, FUNCT_1:33;
      then f2".(f.v) in rng(f2") by FUNCT_1:3;
      then A24: f2".(f.v) in dom f2 by FUNCT_1:33;
      then (the_Source_of G2).(f2".(f.v)) = f2.(f2".(f.v)) &
        (the_Target_of G2).(f2".(f.v)) = f2.(f2".(f.v)) by A4, FUNCT_4:13;
      then A25: (the_Source_of G2).(f2".(f.v)) = f.v &
        (the_Target_of G2).(f2".(f.v))=f.v by A4, A23, FUNCT_1:35;
      f2".(f.v) in the_Edges_of G2 by A4, A24, XBOOLE_0:def 3;
      then f2".((F0_V|V1).v) Joins f.v,f.v,G2 by A22, A25, GLIB_000:def 13;
      then f2".(((F0_V|V1)*f1).e) Joins f.v,f.w,G2 by A3, A19, A20, FUNCT_1:13;
      then (f2"*((F0_V|V1)*f1)).e Joins f.v,f.w,G2 by A3, A12, A19, FUNCT_1:13;
      hence g.e Joins f.v,f.w,G2 by A19, RELAT_1:36;
    end;
  end;
  then reconsider F = [f,g] as PGraphMapping of G1, G2 by GLIB_010:8;
  take F;
  thus F_V = F0_V;
  A26: dom F0_E misses dom h by A3, A8, XBOOLE_1:63;
  hence F_E | dom F0_E = F0_E by FUNCT_4:33;
  :: show the properties
  hereby
    assume F0 is non empty;
    then dom F_V <> {};
    hence F is non empty;
  end;
  thus A27: F0 is total implies F is total
  proof
    assume F0 is total;
    then A28: dom F0_V = the_Vertices_of G3 & dom F0_E = the_Edges_of G3
      by GLIB_010:def 11;
    :: here A1 cannot be substituted by A2
    then A29: dom F_V = the_Vertices_of G1 by A1, Def5;
    dom F_E = the_Edges_of G1 by A3, A8, A28, FUNCT_4:def 1;
    hence F is total by A29, GLIB_010:def 11;
  end;
  thus A30: F0 is onto implies F is onto
  proof
    assume F0 is onto;
    then A31: rng F0_V = the_Vertices_of G4 & rng F0_E = the_Edges_of G4
      by GLIB_010:def 12;
    :: here A2 instead of A1 works again...
    then A32: rng F_V = the_Vertices_of G2 by A2, Def5;
    rng F_E = the_Edges_of G2 by A4, A10, A26, A31, NECKLACE:6;
    hence F is onto by A32, GLIB_010:def 12;
  end;
  thus A33: F0 is one-to-one implies F is one-to-one
  proof
    assume A34: F0 is one-to-one;
    rng F0_E misses E2 by A4, XBOOLE_1:63;
    then F_V is one-to-one & F_E is one-to-one by A2, A10, A34, FUNCT_4:92;
    hence F is one-to-one by GLIB_010:def 13;
  end;
  thus A35: F0 is directed implies F is directed
  proof
    assume A36: F0 is directed;
    now
      let e,v,w be object;
      assume A37: e in dom F_E & v in dom F_V & w in dom F_V;
      assume A38: e DJoins v,w,G1;
      per cases by A37, FUNCT_4:12;
      suppose A39: e in dom F0_E;
        then e DJoins v,w,G3 by A38, GLIB_006:71;
        then A40: F0_E.e DJoins F0_V.v,F0_V.w,G4
          by A36, A37, A39, GLIB_010:def 14;
        not e in E1 by A3, A37, A39, XBOOLE_0:5;
        then g.e DJoins f.v,f.w,G4 by A8, A40, FUNCT_4:11;
        hence F_E.e DJoins F_V.v,F_V.w,G2 by GLIB_006:70;
      end;
      suppose e in dom h;
        then A41: e in E1 & g.e = h.e by A8, FUNCT_4:13;
        then (the_Source_of G1).e = f1.e &
          (the_Target_of G1).e = f1.e by A3, FUNCT_4:13;
        then A42: v = f1.e & w = f1.e by A38, GLIB_000:def 14;
        then A43: v in V1 by A3, A41, FUNCT_1:3;
        then A44: f.v = (F0_V|V1).v by FUNCT_1:49;
        then A45: f.v in V2 by A2, A43, FUNCT_1:3;
        then f.v in dom(f2") by A4, FUNCT_1:33;
        then f2".(f.v) in rng(f2") by FUNCT_1:3;
        then A46: f2".(f.v) in dom f2 by FUNCT_1:33;
        then (the_Source_of G2).(f2".(f.v)) = f2.(f2".(f.v)) &
          (the_Target_of G2).(f2".(f.v)) = f2.(f2".(f.v)) by A4, FUNCT_4:13;
        then A47: (the_Source_of G2).(f2".(f.v)) = f.v &
          (the_Target_of G2).(f2".(f.v))=f.v
          by A4, A45, FUNCT_1:35;
        f2".(f.v) in the_Edges_of G2 by A4, A46, XBOOLE_0:def 3;
        then f2".((F0_V|V1).v) DJoins f.v,f.v,G2 by A44, A47, GLIB_000:def 14;
        then f2".(((F0_V|V1)*f1).e) DJoins f.v,f.w,G2
          by A3, A41, A42, FUNCT_1:13;
        then (f2"*((F0_V|V1)*f1)).e DJoins f.v,f.w,G2
          by A3, A12, A41, FUNCT_1:13;
        hence F_E.e DJoins F_V.v,F_V.w,G2 by A41, RELAT_1:36;
      end;
    end;
    hence F is directed by GLIB_010:def 14;
  end;
  thus F0 is weak_SG-embedding implies F is weak_SG-embedding by A27, A33;
  thus F0 is isomorphism implies F is isomorphism by A27, A30, A33;
  thus F0 is Disomorphism implies F is Disomorphism by A27, A30, A33, A35;
end;
