-
Notifications
You must be signed in to change notification settings - Fork 713
feat: add a lemma relating minKey? and min? for DTreeMap
#11528
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
base: master
Are you sure you want to change the base?
Conversation
minKey? and min? for DTreeMapminKey? and min? for DTreeMap [DRAFT]
|
Mathlib CI status (docs):
|
|
Reference manual CI status:
|
minKey? and min? for DTreeMap [DRAFT]minKey? and min? for DTreeMap
minKey? and min? for DTreeMapminKey? and min? for DTreeMap
|
|
||
| theorem minKey?_eq_min?_keys [TransCmp cmp] [Min α] | ||
| [LE α] [LawfulOrderCmp cmp] [LawfulOrderMin α] [LawfulOrderLeftLeaningMin α] [LawfulEqCmp cmp] : | ||
| t.minKey? = t.keys.min? := |
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 think this would be nice to have as a simp lemma in the reverse direction, called just min?_keys.
|
|
||
| theorem minKey?_eq_min?_keys [TransCmp cmp] [Min α] | ||
| [LE α] [LawfulOrderCmp cmp] [LawfulOrderMin α] [LawfulOrderLeftLeaningMin α] [LawfulEqCmp cmp] : | ||
| t.minKey? = t.keys.min? := |
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.
How hard would it to add also head?_keys saying t.keys.head? = t.minKey?? I hope not too hard given that we know that the list model is sorted and List.min?_eq_head? exists.
| obtain ⟨e, ⟨hm, _⟩, rfl⟩ := hkm | ||
| exact containsKey_of_mem hm | ||
|
|
||
| theorem minKey?_eq_min?_keys [Ord α] [TransOrd α] |
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 guess we also want everything for List.max? and maxKey??
This PR adds lemmas relating
minKey?andmin?on the keys list for allDTreeMapand other containers derived from it.