-
Notifications
You must be signed in to change notification settings - Fork 716
feat: add decidable equality to DHashMap/HashMap/HashSet and their extensional variants
#11421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wkrozowski
merged 92 commits into
leanprover:master
from
wkrozowski:wojciech/hashmap_deceq
Dec 12, 2025
+194
−0
Merged
Changes from 62 commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
d28319d
push work so far
wkrozowski fc9c400
Sublemma works
wkrozowski 26bffd8
Sublemma now works
wkrozowski d586c3f
Main lemma goes through
wkrozowski ae7a4ac
Add first user-facing lemmas
wkrozowski 54f89f9
Add working model lemma
wkrozowski 9b0035c
Work on the train
wkrozowski a560481
Lemmas go through
wkrozowski 44f9398
Progress with the const BEq
wkrozowski f4bce74
push
wkrozowski 4d63159
Add const lemma
wkrozowski 09452de
Add perm lemmas
wkrozowski fa88c40
Congruence lemmas continued
wkrozowski fcad743
fix scoping issue
wkrozowski bd7dca5
Remove unit variant and add the raw variant
wkrozowski f37ad5f
Add lemmas to DHashMap
wkrozowski 9ce4b8c
Add Raw DHashMapLemmas
wkrozowski 3afdb45
Done with lemmas
wkrozowski d985064
ExtHashMap done
wkrozowski 7ed80a9
Add BEq to ExtHashSet
wkrozowski 99b62eb
Merge branch 'master' into wojciech/hashmap_beq2
wkrozowski 4a93e11
Fix merge issue
wkrozowski 59a0ec6
Remove unnecessary hashable instance
wkrozowski 53e4653
Remove unnecessary hashable
wkrozowski cea11fe
Continue removing useless Hashable instance
wkrozowski a87d1e0
Remove whitespace
wkrozowski 59738d1
Fix formatting
wkrozowski 396efbd
Merge branch 'master' into wojciech/hashmap_beq2
wkrozowski 8a84316
Remove unused code
wkrozowski ba95c26
Initial work
wkrozowski 109af27
Add import
wkrozowski b928c86
Refactor ExtDHashMap code
wkrozowski 483f612
One more refactor
wkrozowski 3461806
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski c777360
Finish decidableEq instance for ExtDHashMap
wkrozowski 4d23872
Merge branch 'master' into wojciech/hashmap_beq2
wkrozowski 4364811
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski d1f18b9
First part of addressing Markus' comments
wkrozowski dbc9784
Proof golfing
wkrozowski 40ef92e
Fix notation
wkrozowski b3b2f97
Apply Markus' suggestions
wkrozowski eb83bb2
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 2b3820f
Resolve semantic merge conflict
wkrozowski c2738a7
Fist portion of Markus' suggestions
wkrozowski 748a879
Second part of refactor
wkrozowski 0089a8f
Finish adding the extensional variants
wkrozowski 84b1bd7
Try refactoring `ExtDHashMap`
wkrozowski 8f59aa7
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 9ef0843
Put the code I have so far
wkrozowski efdb7ab
Forgotten instance
wkrozowski 55b3d02
Refactor
wkrozowski 1a93a9f
cleanup extensional variants
wkrozowski 57e1453
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 4e012a6
further renaming
wkrozowski 640a5da
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski befc92b
Refactor Decidable Equiv
wkrozowski 8bd5295
chore: fix orphaned modules issue
wkrozowski e8d3749
Respond to Markus' comments
wkrozowski 3785fa8
Resolve Markus' comments
wkrozowski 3bd07be
Refactor
wkrozowski 7ef173e
Further refactor
wkrozowski 6a8b212
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski c04f684
Resolve Markus' comment
wkrozowski 3b281d5
Remove `beqUnit`
wkrozowski d264dea
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski c47995a
Weaken the instances for the Const variant
wkrozowski 8adfa66
Cleanup
wkrozowski 81ca6a5
Further cleanup
wkrozowski b1ed589
Further cleanup
wkrozowski 06c5d1d
One more round of cleanup
wkrozowski 9927009
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 4afd191
Further cleanup
wkrozowski ea94efb
Fix whitespace
wkrozowski 9c78a3a
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 085187c
chore: change `letI` to `let`
wkrozowski 3079fa6
Further cleanup
wkrozowski f59e2a8
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski f353aea
Proof golf
wkrozowski e94e818
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski fb951bf
Add names for instances
wkrozowski 3074be8
Add `any_eq`
wkrozowski 02434df
Minor cleanup
wkrozowski a269546
chore: proof golf
wkrozowski 851d4e7
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 7e9771b
chore: cleanup
wkrozowski b2c392f
chore: docstrings
wkrozowski 4ced8f0
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski d0e16d9
chore: cleanup
wkrozowski e1b4565
Merge branch 'wojciech/hashmap_beq2' into wojciech/hashmap_deceq
wkrozowski 24d77ba
Merge branch 'master' into wojciech/hashmap_deceq
wkrozowski 3155dd5
Merge branch 'master' into wojciech/hashmap_deceq
wkrozowski ffca990
chore: make the statement more general
wkrozowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /- | ||
| Copyright (c) 2025 Lean FRO, LLC. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Wojciech Różowski | ||
| -/ | ||
| module | ||
|
|
||
| prelude | ||
| public import Std.Data.DHashMap.Internal.RawLemmas | ||
|
|
||
| public section | ||
|
|
||
| /-! | ||
| # Decidable equivalence for `DHashMap` | ||
| -/ | ||
|
|
||
| open Std.DHashMap.Internal | ||
|
|
||
| namespace Std.DHashMap | ||
|
|
||
| instance {α : Type u} {β : α → Type v} [DecidableEq α] [Hashable α] [∀ k, DecidableEq (β k)] (m₁ m₂ : DHashMap α β) : Decidable (m₁ ~m m₂) := @decidable_of_iff _ _ ⟨fun h => ⟨h⟩, fun h => h.1⟩ <| Raw₀.decidableEquiv ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ m₁.2 m₂.2 | ||
|
|
||
| end Std.DHashMap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /- | ||
| Copyright (c) 2025 Lean FRO, LLC. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Wojciech Różowski | ||
| -/ | ||
| module | ||
|
|
||
| prelude | ||
| public import Std.Data.DHashMap.Internal.RawLemmas | ||
|
|
||
| public section | ||
|
|
||
| /-! | ||
| # Decidable equivalence for `DHashMap.Raw` | ||
| -/ | ||
|
|
||
| open Std.DHashMap.Internal | ||
|
|
||
| namespace Std.DHashMap.Raw | ||
|
|
||
| instance {α : Type u} {β : α → Type v} [DecidableEq α] [Hashable α] [∀ k, DecidableEq (β k)] {m₁ m₂ : Raw α β} (h₁ : m₁.WF) (h₂ : m₂.WF) : Decidable (m₁.Equiv m₂) := | ||
| Raw₀.decidableEquiv ⟨m₁, h₁.size_buckets_pos⟩ ⟨m₂, h₂.size_buckets_pos⟩ h₁ h₂ | ||
|
|
||
| end Std.DHashMap.Raw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.