feat(Data/Tree/Basic): add Membership instance, new notation, rename Tree #39697
feat(Data/Tree/Basic): add Membership instance, new notation, rename Tree #39697sorrachai wants to merge 9 commits into
Conversation
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary 5e3ffb125cImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
Please could you split the renaming part of this PR into a standalone PR, as I originally requested on Zulip? You'll need to add a bunch of deprecations too, and it would be much easier to review if the PR only did the rename. You can leave this PR as is while waiting for the rename to be merged. |
|
Sure, please refer to the new PR. |
| # BinaryTree | ||
|
|
||
| Provides binary tree storage for values of any type, with O(lg n) retrieval. | ||
| See also `Lean.Data.RBTree` for red-black trees - this version allows more operations | ||
| Provides binary tree storage for values of any type. | ||
| See also `Lean.Data.RBBinaryTree` for red-black BinaryTrees - this version allows more operations | ||
| to be defined and is better suited for in-kernel computation. | ||
|
|
||
| We also specialize for `BinaryTree Unit`, which is a binary tree without any | ||
| We also specialize for `BinaryTree Unit`, which is a binary BinaryTree without any | ||
| additional data. We provide the notation `a △ b` for making a `BinaryTree Unit` with children | ||
| `a` and `b`. | ||
| `a` and `b`, and the notation `l △[a] r` for a binary tree with root node | ||
| containing value `a` and two children `l` and `r`. |
There was a problem hiding this comment.
Let's revert the changes here.
| theorem mem_singleton_iff (a x : ℕ) : a ∈ ((nil △[x] nil)) ↔ a = x := by | ||
| constructor | ||
| · intro h | ||
| cases h <;> trivial | ||
| · intro h | ||
| subst h | ||
| apply Mem.node |
There was a problem hiding this comment.
Please add the not_mem_nil and mem_node_iff lemmas too, which can be simp.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Summary:
Suggestion based on the discussion in the cslib thread#CSLib > Splay tree PR @ 💬.