Skip to content

feat: EquivBEq and LawfulHashable for String.Slice#13058

Merged
TwoFX merged 4 commits intoleanprover:masterfrom
TwoFX:slice-hash
Mar 23, 2026
Merged

feat: EquivBEq and LawfulHashable for String.Slice#13058
TwoFX merged 4 commits intoleanprover:masterfrom
TwoFX:slice-hash

Conversation

@TwoFX
Copy link
Copy Markdown
Member

@TwoFX TwoFX commented Mar 23, 2026

This PR adds EquivBEq and LawfulHashable instances to String.Slice.

To this end, we redefine String.Slice.hash, which used to be completely opaque, to be defined as String.hash s.copy (and then String.hash remains opaque). We add tests that the lean_slice_hash and lean_string_hash functions do indeed satisfy this relationship.

Of course, it would be even better to have a streaming MurmurHash64A implementation in core that could be used to implement both of these so that we can avoid the opaque, but that is a project for another day.

@TwoFX TwoFX requested a review from kim-em as a code owner March 23, 2026 10:42
@TwoFX TwoFX added the changelog-library Library label Mar 23, 2026
@TwoFX TwoFX enabled auto-merge March 23, 2026 10:42
@TwoFX TwoFX added this pull request to the merge queue Mar 23, 2026
Merged via the queue into leanprover:master with commit fcdd9d1 Mar 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant