[#14844] fix: collapse empty DiscrTree tries - #24
Merged
Conversation
Contributor
Author
Build report for downstream: undo overridesTurned red:
Stayed green
|
downstream-repo: batteries downstream-url: https://github.com/leanprover-community/batteries downstream-rev: nightly-testing downstream-sha: 6f9327fde05a7b7f8475971a11d8dae0d38d7eb5
downstream-repo: mathlib4 downstream-url: https://github.com/leanprover-community/mathlib4-nightly-testing downstream-rev: nightly-testing downstream-sha: b878dd3f7ab9bf9046ef1c1dac56d94b8b29c9c4
downstream-repo: verso downstream-url: https://github.com/leanprover/verso downstream-rev: nightly-testing downstream-sha: ad4748a221f2ad0491b1045e7ca1dc25dcfa6eb0
robsimmons
force-pushed
the
adaptation-14844
branch
from
August 20, 2026 23:55
4535bea to
2a243cf
Compare
FawadHa1der
pushed a commit
to FawadHa1der/lean4
that referenced
this pull request
Aug 21, 2026
This PR ensures that `DiscrTree` operations collapse any trie nodes that end up empty. This change allows `mapArraysM` to properly implement Aesop's filterDiscrTreeM in the [downstream adaptation PR](leanprover/downstream-lean4#24), which also deprecates `Trie.isEmptyTrie` in favor of the now-upstreamed `Trie.isEmptyNode`. Following Aesop's lead, this PR also adds @[specialize] annotations to the recursive portion of for mapArraysM and to the similarly-patterned foldM and foldValuesM. Three new test files provide coverage of these and other DiscrTree operations. This PR (and the tests) are intended to lay groundwork for leanprover#14805.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is the adaptation PR for leanprover/lean4#14844.