A multiset is like a set, just allowing that the elements have multiplicities. Thus the multiset differs from the multiset , while is the same as . Multisets are useful in combinatorics. See wikipedia.
While it is possible to take multisets as a fundamental concept in foundations, it is more common to define them in terms of sets and functions.
A multiset ,can be defined as a set (its underlying set) together with a function (giving each element its multiplicity) from to a class of nonzero cardinal numbers. A multiset is locally finite if multiplicity takes values in the natural numbers. Many authors take all multisets to be locally finite; that is the default in combinatorics. The multiset is finite if it is locally finite and is a finite set. We can also define a multiset to be a function from the proper class of all objects to the class of all cardinal numbers, with the proviso that the objects whose multiplicity is nonzero form a set (the set above).
If we are only interested in multisets with elements drawn from a given set (as is common in combinatorics), then an alternative definition is very useful: a multisubset of is a function , where two multisubsets and are considered equal if there is a bijection that makes a commutative triangle. In other words, a multisubset of is an isomorphism class in the slice category . (Compare this to the structural definition of subset of as an injective function to .)
A multisubset of is locally finite if every fibre is finite; it is finite if additionally the image of (which corresponds to in the original definition) is finite. A locally finite multisubset can also be described as a function from to the set of natural numbers; this is just the multiplicity function again, now with (rather than ) specified as the domain and allowing the value to be taken.
The operations on cardinal numbers induce operations on multisets (or on multisubsets of any given set ).
In the following, let and be multisets.
The cardinality of a multiset is given by
The intersection of multisets is the multiset whose cardinality is given by the infimum operation on cardinal numbers.
The union of multisets is the multiset whose cardinality is given by the supremum operation on cardinal numbers.
The set difference of multisets is the multiset given by
The sum of multisets is the multiset whose cardinality is given by addition of cardinal numbers; this has no analogue for ordinary sets.
The product of multisets (turning them into a rig) is the multiset whose cardinality is given by the product of cardinal numbers
Note that if is a set, then
The inner product of multisets is given by
Note that the inner product corresponds to the cardinality of the product
…
Mathematics of Multisets, Apostolos Syropoulos
Categorical Models of Multisets, Apostolos Syropoulos
An Overview of the Applications of Multisets, D. Singh, A. M. Ibrahim, T. Yohanna and J. N. Singh
Is there a reason that you moved these references up here? We need them especially for the stuff about morphisms below. —Toby
Eric: What would a colimit over an MSet-valued functor look like?
Toby: That depends on what the morphisms are.
Eric: I wonder if there is enough freedom in the definition of morphisms of multisets so that the colimit turns out particularly nice. I’m hoping that it might turn out to be simply the sum of multisets. According to limits and colimits by example the colimit of a Set-valued functor is a quotient of the disjoint union.
Toby: I think that you might hope for the coproduct (but not a general colimit) of multisets to be a sum rather than a disjoint union. Actually, you could argue that the sum is the proper notion of disjoint union for abstract multisets.
What is a function between multisets? I would be inclined to say that for multisubsets of an ambient universe considered as objects of , a function from to would be an arbitrary function (not necessarily commuting with the projections to ). But this doesn’t work if a multisubset of is an isomorphism class in rather than merely an object of it. – Mike Shulman
Eric: This definition is taken from Syropoulos:
Category is a category of all possible multisets.
The last part of the definition is a kind of wreath product (see 4). However, it is not clear at the moment how this definition fits into the general theory of wreath products.
Mike Shulman: Huh. So his definition takes a multiset to assign a set to every element, rather than a cardinality to every element, so that the multisubsets of are exactly objects of . I’m surprised, though, that with his definition the only functions are constant; why can’t I send the two copies of to different places?
Toby: If you could, then and would be isomorphic in this category, and we'd just have back again.
I find Mathematics of Multisets especially interesting for its distinction between multisets with distinguishable objects and ‘pure’ multisets with indistinguishable objects. The definition above involving cardinal numbers gives us ‘pure’ multisets, unlike the objects of the category above.
Normally, one only needs multisubsets of a given set, and one is not interested in functions between them. But if one wants to make a category of abstract multisets, then the pure and impure versions are different!
Mike Shulman: Whereas his definition makes the category of multisets equivalent to . Is that better?
I don’t find it wrong that the category of multisets would be equivalent to , since only sees “structural” properties of sets, and the fact that two elements of a set are “the same” (which is what distinguishes from ) is a nonstructural property that only makes sense in the context of sub-multisets of some ambient set.
Toby: At least is different from . And how do you decide whether being ‘the same’ is a structural property of a multiset? We're trying to take an idea that originally applied only to collections of elements from a fixed universe and move it to a more abstract settings; there are (at least) two ways to do that, and Syropoulos has chosen the more interesting one. (Anyway, if somebody asked me to come up with a structural notion of abstract multiset, the first thing that I would think of —and did think of, before this discussion started— is an object of .) Asking which notion is correct is not really a fair question.
Eric: The paper Mathematics of Multisets is worth having a look. I might have pasted a suboptimal piece. He talks about two types of multisets (and more actually): 1.) real multisets and 2. multisets. Here is another quote:
Real multisets and multisets are associated with a (ordinary) set and an equivalence relation or a function, respectively. Here are the formal definitions:
Definition 1. A real multiset is a pair , where is a set and an equivalence relation on . The set is called the field of the real multiset. Elements of in the same equivalence class will be said to be of the same sort; elements in different equivalence classes will be said to be of different sorts.
Given two real multisets and , a morphism of real multisets is a function which respects sorts; that is, if and , then .
Definition 2. Let be a set. A multiset over is just a pair , where is a set and is a function.
The previous definition is the characteristic function definition method for multisets.
Remark 1. Any ordinary set is actually a multiset , where is its characteristic function.
Eric: Given and , is or is ?
Todd: It’s . (To make the question structural, we should think of and as multisubsets of some other multiset, but never mind.)
As a writer (perhaps Toby) was saying above, a locally finite multiset can be thought of as an ordinary set equipped with a multiplicity function . A multisubset of can then be reckoned as equipped with a function which is bounded above by . To take the intersection of two multisubsets , you take the minimum or inf of . Your question can then be translated to one where , where and .
Eric: Thanks Todd! The reference Mathematics of Multisets explains this nicely too.
Eric: What is the difference (aside from negatives) between multisets and abelian groups freely generate by some set ? It seems like a multiset ( s a set and ) can be thought of as a vector with providing the coefficients.
For example, we could express the multiset as
Toby: The only difference is notation; see the note at the end of inner product of multisets.
Mike Shulman: At least, if all your multisets are locally finite.
Toby: Right; which they are for Eric, who specified . If you allow arbitrary cardinalities, then it's the free module on over the rig of cardinal numbers.