Multiset Check
MultiSet Check is the process of verifying whether two MultiSets contain the same elements. Unlike a regular set, a MultiSet can include duplicate values. Let's explain this concept with three examples below.
The two sets below have the same elements, although in different orders, so they are equal.
The two sets below have different sizes, so they aren’t equal.
The two sets below are the same size, but only contains the value 4, so they aren’t equal.
So, how can we determine if two arbitrary sets satisfy MultiSet equality? At first glance, it might seem sufficient to simply multiply all the values together, but would this really work?
In fact, there can be numerous counterexamples to the equation as shown below.
To probabilistically verify the above safely, we can use the Schwartz–Zippel lemma to construct polynomials and perform checks as follows. Using the same example above, if the size of the entire field is , the calculations match on only 4 values on both sides, making it probabilistically secure.
Last updated