quint icon indicating copy to clipboard operation
quint copied to clipboard

[Rust] Try to avoid normalizing by improving Hash impl for Value

Open bugarela opened this issue 11 months ago • 2 comments

Imported comment from the PR which included https://github.com/informalsystems/quint/commit/dd333e80c4847686913272aa79745ec3bf741706

Comparing by value instead of by string in the tests uncovered a problem.

In TS, we call normalForm() whenever we deal with keys on a Value::Map, which I was not doing here yet. This caused things like Set(2.to(4)).mapBy(s => s.size()).get(Set(2, 3, 4)) to fail, as the key on the map would look like Value::Interval(2, 4) while they key we are trying to get looks like Value::Set(2, 3, 4), which don't hash to the same thing.

It might be the case that changing the Hash impl to enumerate sets before hashing is better (more performant) than this. I just did what we already do in TS to unblock this PR, and we can try to optimize it later.

bugarela avatar Apr 08 '25 19:04 bugarela

Can I start working on this?

geooner avatar May 27 '25 23:05 geooner

@geooner Yes!

bugarela avatar May 28 '25 11:05 bugarela