Skip to content

feat: create asNode/mkNode abstraction for DiscrTree - #14911

Open
robsimmons wants to merge 3 commits into
masterfrom
push-kqpzqvxlpnyl
Open

feat: create asNode/mkNode abstraction for DiscrTree#14911
robsimmons wants to merge 3 commits into
masterfrom
push-kqpzqvxlpnyl

Conversation

@robsimmons

@robsimmons robsimmons commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This PR creates an additional view abstraction on DiscrTree.Trie nodes that allows nodes to be viewed and inspected without direct case analysis.

This interface allows downstream code to tolerate future minor changes to DiscrTree representations (e.g. #12838 or #14805) more gracefully than is currently possible.

@robsimmons
robsimmons marked this pull request as draft August 24, 2026 12:50
@robsimmons robsimmons changed the title feat: create asNode/mkNode abstraction for DiscrTree feat: missing interface functions for DiscrTree Aug 24, 2026
@robsimmons robsimmons changed the title feat: missing interface functions for DiscrTree feat: create asNode/mkNode abstraction for DiscrTree Aug 24, 2026
@robsimmons
robsimmons requested a review from nomeata August 24, 2026 13:02
@robsimmons
robsimmons marked this pull request as ready for review August 24, 2026 13:02
@robsimmons robsimmons added the changelog-no Do not include this PR in the release changelog label Aug 24, 2026
Comment thread src/Lean/Meta/DiscrTree/Basic.lean Outdated
-/
@[inline]
def Trie.asNode : Trie α → Array α × Array (Key × Trie α)
| .node vs cs => ⟨vs, cs⟩

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We might want to offer .value and .children as well so far users who care about only don't don't have to materialize the other (which, depending on future implementation changes, maybe not be cheap)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@nomeata only concern there would be that DiscrTree.values is recursive - Trie.nodeValues and Trie.nodeChildren make sense for you?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sure

@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 Aug 25, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 71a4d9a3e573916b2bbcb49ad9e1ca62851b77da --onto fd0efc4306a7773c2cd4e079ddaa907426d0f5da. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-25 13:34:08)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 71a4d9a3e573916b2bbcb49ad9e1ca62851b77da --onto 16e77c407779fde9a649adf3478204d1915371a3. You can force reference manual CI using the force-manual-ci label. (2026-08-25 13:34:09)

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

Labels

changelog-no Do not include this PR in the release changelog 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.

3 participants