TritonVM / tasm-lib

A collection of functions written in Triton VM assembly (tasm)
Apache License 2.0
11 stars 2 forks source link

Add snippet for set-equality of two `u64` lists #114

Open Sword-Smith opened 1 month ago

Sword-Smith commented 1 month ago

Add a snippet where one list (assumed to be sorted and containing unique elements) is compared to another list which is not sorted and may contain duplicates. The snippet should either return a boolean indicating set-equality or crash the VM if set equality does not hold.

The snippet can be implemented using logarithmic derivatives of the running product, where multiplicities are divined.

The mathematical expressions that are compared should be:

$ld=\sum_{i}\frac{m_i}{\alpha - l_i}$, and

$ld=\sum_{j}\frac{1}{\alpha - l_j}$

where $m_i$ is the divined-in multiplicity. $m_i$ should be constrained somehow, to either a u32 or to something smaller yet.

This snippet can be used together with that defined in #111 in neptune-core's removal record integrity program to verify that the divined-in chunk indices are correct.