reserve GS for GraphStruct;
reserve G,G1,G2,G3 for _Graph;
reserve e,x,x1,x2,y,y1,y2,E,V,X,Y for set;
reserve n,n1,n2 for Nat;
reserve v,v1,v2 for Vertex of G;

theorem
  for G being _Graph st (for v being Vertex of G holds
    v.inNeighbors() c= the_Vertices_of G \ {v} or
    v.outNeighbors() c= the_Vertices_of G \ {v} or
    v.allNeighbors() c= the_Vertices_of G \ {v})
  holds G is loopless
proof
  let G be _Graph;
  assume A1: for v being Vertex of G holds
    v.inNeighbors() c= the_Vertices_of G \ {v} or
    v.outNeighbors() c= the_Vertices_of G \ {v} or
    v.allNeighbors() c= the_Vertices_of G \ {v};
  now
    let v be object;
    given e being object such that
      A2: e Joins v,v,G;
    reconsider w = v as Vertex of G by A2, FUNCT_2:5;
    e DJoins v,v,G by A2;
    then A3: v in w.inNeighbors() & v in w.outNeighbors() &
      v in w.allNeighbors() by A2, Th69, Th70, Th71;
    v in the_Vertices_of G \ {w}
    proof
      per cases by A1;
      suppose w.inNeighbors() c= the_Vertices_of G \ {w};
        hence thesis by A3;
      end;
      suppose w.outNeighbors() c= the_Vertices_of G \ {w};
        hence thesis by A3;
      end;
      suppose w.allNeighbors() c= the_Vertices_of G \ {w};
        hence thesis by A3;
      end;
    end;
    hence contradiction by ZFMISC_1:56;
  end;
  hence thesis by Th18;
end;
