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 by Bors] - feat(data/tree): Add definitions about binary trees; special support for tree unit
#16715
Conversation
Can you use |
The reason I initially decided against it was because the use case in #16415 is to allow encodings to trees. The encoding of There were also minor annoyances with having some @[simp] def something : tree unit -> α
| tree.nil := /- something -/
| (tree.node () x y) := /- something -/ generates a simp lemma which only simplifies |
This all sounds like things you can solve using a new recursor. |
tree unit
tree unit
tree unit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this PR but I would like another reviewer's opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maintainer merge
🚀 Pull request has been placed on the maintainer queue by YaelDillies. |
it's been two months so we should probably merge master first |
Sorry for the long wait! bors merge |
…for `tree unit` (#16715) Provide convenience API for `tree unit`. In particular, define a recursor for `tree unit` as well as other helper lemmas. In addition, define common functions on binary trees such as `nodes`, `num_leaves`, `height`, and prove basic lemmas about these functions, such as the fact that the number of leaves is one more than the number of internal nodes and the height is at most the number of nodes. Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
Pull request successfully merged into master. Build succeeded: |
tree unit
tree unit
Provide convenience API for
tree unit
. In particular, define a recursor fortree unit
as well as other helper lemmas.In addition, define common functions on binary trees such as
nodes
,num_leaves
,height
, and prove basic lemmas about these functions, such as the fact that the number of leaves is one more than the number of internal nodes and the height is at most the number of nodes.Moving part of #16415 into its own PR, so that the catalan PR, which doesn't need to know anything about encodings, can proceed faster.