Skip to content

Conversation

@wkrozowski
Copy link
Contributor

@wkrozowski wkrozowski commented Nov 17, 2025

This PR adds support for difference operation for DHashMap/HashMap/HashSet and proves several lemmas about it.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 17, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 17, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase bef8574b93cacb87c7e9804870341441346a64b5 --onto 8b575dcbf2a3b907044df2233a61b61003eeeb45. You can force Mathlib CI using the force-mathlib-ci label. (2025-11-17 13:16:47)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 4296f8deeece4fdf6dbe7d5d6b5e23bd6a250d13 --onto 5a4226f2bdcc6299df76285b1d30f238546c09fe. You can force Mathlib CI using the force-mathlib-ci label. (2025-11-18 13:51:02)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 51b67385cc0cd2613764ee4607957fef1f06128b --onto 5306a3469d20caa5f9d80384a5c1effdb14e9c67. You can force Mathlib CI using the force-mathlib-ci label. (2025-11-21 19:17:33)

@leanprover-bot
Copy link
Collaborator

leanprover-bot commented Nov 17, 2025

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase bef8574b93cacb87c7e9804870341441346a64b5 --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-11-17 13:16:49)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 4296f8deeece4fdf6dbe7d5d6b5e23bd6a250d13 --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-11-18 13:51:04)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 51b67385cc0cd2613764ee4607957fef1f06128b --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-11-21 19:17:34)

Copy link
Member

@TwoFX TwoFX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lemma statements about diff look good! Don't forget to use the SDiff notation as the normal form once you implement the definition on the user-facing types.

@wkrozowski wkrozowski changed the title feat: add difference on DHashMap/HashMap/HashSet [Work in progress] feat: add difference on DHashMap/HashMap/HashSet Nov 18, 2025
@wkrozowski wkrozowski marked this pull request as ready for review November 18, 2025 15:00
@wkrozowski wkrozowski marked this pull request as draft November 20, 2025 17:46
@wkrozowski wkrozowski marked this pull request as ready for review November 21, 2025 18:10
Copy link
Member

@TwoFX TwoFX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly looking good now.

case h_2 => rfl
exact dl₁

theorem getValueCast?_filter_contains_eq_false [BEq α] [LawfulBEq α]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no false in the theorem statement, then there should be no false in the name. This lemma should be called getValueCast?_filter_not_contains. The same applies to many other lemmas in this file.

{l₁ l₂ : List ((a : α) × β a)} {k : α}
(dl₁ : DistinctKeys l₁) :
getKey? k (List.filter (fun p => !List.contains (l₂.map Sigma.fst) p.fst) l₁) =
if containsKey k l₂ = true then none else getKey? k l₁ := by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if containsKey k l₂ = true then none else getKey? k l₁ := by
if containsKey k l₂ = true then none else getKey? k l₁ := by

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants