Skip to content
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

feat: Std.HashMap #4583

Merged
merged 46 commits into from
Jul 5, 2024
Merged

feat: Std.HashMap #4583

merged 46 commits into from
Jul 5, 2024

Conversation

TwoFX
Copy link
Member

@TwoFX TwoFX commented Jun 28, 2024

Preliminary PRs:

Quick overview over API/naming changes compared to Lean.HashMap and Batteries.HashMap:

Lean

  • find? -> get?/getElem?
  • find! -> get!/getElem!
  • findD -> getD
  • findEntry? -> not implemented for now
  • insert' -> containsThenInsert (order reversed in result)
  • insertIfNew -> getThenInsertIfNew? (order reversed in result)
  • numBuckets -> Internal.numBuckets
  • ofListWith -> not implemented for now
  • Array.groupByKey -> not implemented for now
  • merge -> not implemented for now, but you can use insertMany

Batteries

  • modify -> not implemented for now
  • mergeWith -> not implemented for now
  • mergeWithM -> not implemented for now

src/Std/Init/Option.lean Outdated Show resolved Hide resolved
src/Std/Init/Nat.lean Outdated Show resolved Hide resolved
src/Std/Init/Nat.lean Outdated Show resolved Hide resolved
@kim-em
Copy link
Collaborator

kim-em commented Jun 30, 2024

Some functions don't have any theorems (e.g. toList, insertMany, ofList). This is of course fine, but we should document this somewhere. Perhaps I would suggest collecting their definitions together and putting them under a /-! ... -/ comment explaining that they don't have theorems at this point.

github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
Split from #4583

Mathlib has `isSome_map'` but calls it `isSome_map`.
github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
Split from #4583

`exists_of_set` appears in Batteries as `exists_of_set'`. The
`exists_of_set` version is unused in batteries and mathlib at least and
I would argue that the primed version (i.e., the one added in this PR)
is always better anyway.

`isEmpty_iff` appears in mathlib as `isEmpty_iff_eq_nil`.
github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
Split from #4583

Rewriting the `i` in `xs[i]` usually fails with `motive is not type
correct`, but with this lemma it works.
github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 3, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 3, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 3, 2024 13:56 Inactive
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 3, 2024 16:00 Inactive
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 3, 2024 16:40 Inactive
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 3, 2024 17:46 Inactive
@TwoFX
Copy link
Member Author

TwoFX commented Jul 5, 2024

@david-christiansen Thank you very much for the detailed review! I'll give you a chance to confirm that all of your comments have been addressed and then I think it's time to get this merged.

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 5, 2024 09:04 Inactive
@david-christiansen
Copy link
Contributor

This is great, thanks!

@TwoFX TwoFX enabled auto-merge July 5, 2024 10:06
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 5, 2024 10:09 Inactive
@TwoFX TwoFX added this pull request to the merge queue Jul 5, 2024
Merged via the queue into master with commit 3e0ea76 Jul 5, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants