  A classical result due to Lovasz (1967) shows that the isomorphism type of a
graph is determined by homomorphism counts. That is, graphs G and H are
isomorphic whenever the number of homomorphisms from K to G is the same as the
number of homomorphisms from K to H for all graphs K. Variants of this result,
for various classes of finite structures, have been exploited in a wide range
of research fields, including graph theory and finite model theory.
  We provide a categorical approach to homomorphism counting based on the
concept of polyadic (finite) set. The latter is a special case of the notion of
polyadic space introduced by Joyal (1971) and related, via duality, to Boolean
hyperdoctrines in categorical logic. We also obtain new homomorphism counting
results applicable to a number of infinite structures, such as finitely
branching trees and profinite algebras.
