-
Notifications
You must be signed in to change notification settings - Fork 242
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
Vec.Properties: introduce ≈-cong′
#2424
Conversation
(draft because we still need to figure out a good name for this lemma, and also update the documentation at |
This improvement is awesome! In the long term, it'd be great if it's possible to prioritize this new lemma over the existing |
This seems like a great contribution... but I'm not across what's needed to get this over the line for v2.2 |
Remaining to do?
|
(rebased to fix conflicts, mostly caused by #2430) |
- do not export lemma from Vec.Properties - use Function.Base rather than Function
Hi! Sorry for the absence, I'll try to unblock this as much as possible.
Done!
I don't think we can, because the old
I am indifferent. I guess it could be argued that the new |
Ah okay, that makes sense!
Yup. I was advocating for deprecation based on the misconception that the new definition was more general. Okay great, I think that tidies everything up. I'll merge this in and squeeze it into v2.2 |
Additions
This PR introduces the
≈-cong′
lemma:This lemma does for
≈[_]
whatcong
does for≡
: givenf
andxs ≈[ _ ] ys
it provesf xs ≈[ _ ] f ys
.More specifically, it proves that any
Vec A n → Vec B m
function that is polymorphic inn
must preserve≈[_]
.Current status
Compare this with the existing
≈-cong
lemma (introduced by @shhyou with #2067 along with the reasoning system):This lemma works for a non-polymorphic
f
, but it requires the user to supply proof thatf
preserves≈[_]
.We already have a handful of these proofs written for some functions:
Simplifications
≈-cong′
is used in a similar way, except that it doesn't require manually proving preservation ofcast
forf
.So, most uses of
≈-cong
(including all current ones) can be migrated to≈-cong′
just by removing the 2nd argument:An extreme example is
example4-cong²
, where we show chaining≈-cong
. This can also be done with≈-cong′
, but there we can further express it as a single≈-cong′
of the composition, as we tend to do withcong
:And the 'cast preservation' proofs above, should you still need them, are just special cases of
≈-cong′
: