Bag (mathematics)
In mathematics, a bag (also called multi set) is a collection of objects that is unordered and can contain objects more than once. It is the latter aspect that distinguishes bags from sets, which can contain objects at most once. An example of a bag would be which contains a once and b twice, and a different bag would be which contains a twice and b once, and finally the bag which is yet another bag and in fact a set.
Formally bags can be defined in set theory as partial functionss that map objects to a positive natural number. So in terms of sets
The usual set operations such as set union, set intersection and cartesian product can be easily generalized for bags.
Formal definition
Bag operations
This article is a stub. You can help Wikipedia by expanding it.