-
Notifications
You must be signed in to change notification settings - Fork 142
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
Swapping the argument order in equational reasoning #998
Comments
Wow - this is great! I ran into this problem once, but didn't know it has an easy fix like this. Does it have drawbacks? Does the use of |
The issues the stdlib has had with it: i) very verbose to rename the syntax, ii) much more non-obvious what to do when trying to import explicitly using |
What do you mean by it being verbose? Don't we just need to change a couple of definitions to be macros? |
Maybe we can just try how good or bad it is? |
* swap the argument order in equational reasoning * [#998]: Remove unused code, fix imports --------- Co-authored-by: Felix Cherubini <felix.cherubini@posteo.de>
solved by #999 |
In porting a category solver from the 1lab (https://github.com/maxsnew/multi-poly-cats/tree/main/Cubical/Tactics/CategorySolver), I ran into an issue: the solvers can't work in equational reasoning proofs because they never have the right hand side of the goal inferred. For example this proof:
Doesn't succeed with the current definition of equational reasoning, in each case the call to
solveCat!
fails because the rhs is an unsolved metavariable.Reed Mullanix showed me that the issue can be solved by redefining the equational-reasoning syntax to swap the order the arguments are passed:
Agda's type checker works from left to right but the equational reasoning macro is right-nested, so swapping the arguments like this gives better type inference and can even lead to performance improvements. With this change the equational reasoning proof above works.
This change has already been done in the agda-stdlib three years ago (agda/agda-stdlib#1045) and is used in the 1lab as well. It seems quite critical for allowing the use of solvers in practice.
The text was updated successfully, but these errors were encountered: