-
Notifications
You must be signed in to change notification settings - Fork 114
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
feat: add LawfulBEq
instance for Vector
#1104
Conversation
awaiting-review |
Mathlib CI status (docs):
|
awaiting-review |
If |
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.
Minor
We need to wait until Mathlib builds but otherwise all good. The Mathlib issue appears to be elsewhere, so no need to worry. |
Batteries/Data/Vector/Lemmas.lean
Outdated
rw [mk_isEqv_mk] | ||
intro heqv | ||
ext | ||
have := Array.rel_of_isEqv heqv |
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 just noticed that Array.rel_of_isEqv
is remarkably inconvenient to use. It should be a pair of lemmas:
theorem size_eq_size_of_isEqv {v₁ v₂ : Array α} : v₁.isEqv v₂ r → v₁.size = v₂.size := sorry
theorem getElem_rel_getElem_of_isEqv {v₁ v₂ : Array α} {h₁ : i < v₁.size} {h₂ : i < v₂.size} : v₁.isEqv v₂ r → r v₁[i] v₂[i] := sorry
What do you think @kim-em ?
If you want to avoid theorem Vector.isEqv_eq_toArray_isEqv_toArray (v₁ v₂ : Vector α n) : v₁.isEqv v₂ r = v₁.toArray.isEqv v₂.toArray r :=
match v₁, v₂ with | ⟨_,_⟩, ⟨_,_⟩ => mk_isEqv_mk .. And the companion for |
awaiting-author |
I'm much more happy with the size of the proof now; thank you! |
awaiting-review |
Thank you! |
9089cee
The
eq_of_beq
proof is a bit hairy, and I couldn't find a proof that didn't useVector.ext
, so I moved the instance to be with the otherVector
lemmas. All review is greatly appreciated.