Multi-set is a term that varies the set concept from set theory . The peculiarity of multi-sets compared to the usual concept of set is that the elements of a multi-set can occur several times. Accordingly, the set operations used for multisets also have a modified meaning.
In computer science , multisets (also called multisets or bags ) represent a useful data structure. For example, the database language SQL handles tables as multisets by default.
A multiset over a set is a mapping of into the set of natural numbers . The number indicates how often the element occurs in the multi-set . The set of all multisets over can be written as. In the following, however, it is used to save vertical space .
Reduced base quantity
The reduced basic amount (engl. "Support") of a multi amount over the amount of the relevant elements of , in formulas:
A multiset is called part (multi) set of a multiset if each element of the reduced basic set of in occurs at least as often as in . Formally:
Two multi- sets and are equal if their reduced basic sets are equal and the multiplicities match. They are then also partial multiple sets of one another in both directions.
The above definition with the admission of the (actually irrelevant) 0 value is a generalization of the indicator function for the usual quantities. It enables the provision of a “universe” as a basic set, to which all multisets in question are related, and consequently simplifies handling and comparison.
A multiset is clearly a set in which each element can appear any number of times. In this sense, sets are a special case of multi-sets in which each value only occurs once.
You note multisets like sets explicitly with curly brackets and write an element in as often as it occurs in the multiset. In order to distinguish multi-amounts from normal amounts, a small one (for bag ) is sometimes added as an index. Instead, some authors use modified brackets: .
Let it be the multiset over with , and . Then you write or or .
You take a die and roll the dice 20 times in a row. Then it can be that one
- 3 times a 1
- 2 times a 2
- 4 times a 3
- 5 times a 4
- 3 times a 5 and
- 3 times a 6
has thrown. The basic set is then ; the multiplicity of is 4; so . The multiset lists each throw, ignoring the order:
Another example is the prime factorization of 120:
It can be interpreted as a multi-set .
Number of possible multi-amounts
The number of -elemental multisets over a -elemental set is called (analogous to the binomial coefficients ) as . This can be expressed as a binomial coefficient:
as long as and . If so, the combinatorial quantity is meaningfully defined as . In all other cases it is the same .
This indicates the number of possible outcomes when pulling distinguishable balls from an urn if the order is not observed and each ball drawn is put back into the urn after it has been drawn (see combination with repetition ).
If 10 balls are drawn one after the other from an urn with 5 balls, each ball drawn is put back, so there is
possible combinations if the order of the balls drawn is not observed.
Variant: multisets with at least one occurrence of each element type
Use to denote the number of possible multisets over a -elementary set , so that each element type occurs at least- times. Then it is easy to see that, as soon as the overall mandatory occurrences are removed from the multiset objects, it is a combinatorial enumeration of the first kind. More precisely:
According to the os information, closer applies
as long . If so, the combinatorial quantity is meaningfully defined as . In all other cases it is the same .
Variant: multi-quantities with capacity restrictions
Use or to denote the number of possible multi-sets over a -elementary set , so that each element type occurs between and Mal (or between and Mal). This is called a regular combination. Using combinatorial arguments one obtains the closed form:
and analogously for the variant. To derive this combinatorial quantity, consider the sets
and immediately recognizes that and . You can see that , so . A bijection construction also proves that for everyone with . Based on this knowledge and the inclusion-exclusion formula for the cardinality of a finite union, the os closed form can be calculated. The variant can be derived analogously .
Combinatorial Identities: Sums
To create a multi-element multiset of element types, the possible values for the number of the last element type are added up using the options for the first element types. In mathematical terms, this means
. The sum display of the restricted combinatorial quantity now enables the calculation of its cumulative sum:
From the sets of multisets in the os section, it can be seen that the total number of multisets over elements and capacity constraints is given by . Accordingly, the complementary sums can be formed as follows
The os results apply analogously to the variant. These sums are important when calculating probabilities.
The limited combinatorial size occurs when types of objects available, including - (or - ) copies of each type, and you want to calculate how many combinations you can select them (regardless of the order). Example situations :
(1.) Card colors, including cards and number of cards. Then is the number of possible hands.
(2.) Number of types of molecules, each with particles, and the number of particles that flow into a vessel. Then is the number of possible mixes.
Operations on multiset
A multiset over multisets over can be combined considering the multiplicities. This accomplishes with
A function can be expanded to a function , whereby
Together with with
we are dealing with a monad structure .
The functor and can also be traced back to another useful operation. extends a function to a function by
With the help of this operation, and can be set.
Union, Average and Difference
The (large) union of two multisets over the same basic set can either be directly as
or by means of
can be specified.
As a small union of two multisets, the smallest multiset becomes
which includes both.
The average of two multi-amounts over the same base amount is application-specific. There are
, such as
The second definition can be traced back to the above if an additional operation is introduced. Be , then is defined by
The average in the second sense then results as with
There are also at least two meaningful definitions for the difference between two multisets over the same basic set .
For both applies and . Which is the "right" one depends on the application.
Let be multisets over the prime numbers. With and as multiplied multisets we have:
- The great union corresponds to the product .
- The small union corresponds to the LCM , ie .
- The first version of the average corresponds to the GCD , ie .
- The first version corresponds to the difference .
If you keep the operations defined in the previous section, you will get related structures by varying the multiplicity set.
- Real multiples in the interval result in probability distributions. The multi-set basic set becomes the set of possible events. The operation converts functions that generate probability distributions of other sets of events on the basis of events that have occurred into functions that can deal with probability distributions as input. Compare also fuzzy sets .
- If body elements are allowed for the multiplicities and a scaling is also defined, multisets over A become vectors of a vector space with a base that is indexed by A. embodies the fact that for the definition of a linear mapping it is sufficient to define the images of the basis vectors. Similarly, functions on base index pairs converts to bilinear maps.
↑ Cristian S. Calude, Gheorghe Păun, Grzegorz Rozenberg, Arto Salomaa, Multiset Processing: Mathematical, Computer Science, and Molecular Computing Points of View Springer Verlag 2001, ISBN 3-540-43063-6 , p. 105
↑ John Riordan: Permutation and combinations . In: An Introduction to Combinatorial Analysis ( en ). John Wiley & Sons Inc., 1958, p. 16.