Skip to content
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

Refactor and improve CommRingSolver #1093

Merged
merged 18 commits into from
Feb 7, 2024
Merged

Conversation

felixwellen
Copy link
Collaborator

The reflection code of the CommRingSolver is pretty horrible, this PRs intends to improve the situation and make it more flexible.

@felixwellen felixwellen changed the title Refactor CommRingSolver Refactor and improve CommRingSolver Jan 29, 2024
@felixwellen felixwellen marked this pull request as ready for review January 31, 2024 22:57
Copy link
Contributor

@mzeuner mzeuner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is will hopefully make our lives much easier.
I can't claim to understand what is going on in the reflection code, so I can't comment on that part of the PR.
I still don't quite understand when using the solver in place is possible and when a where clause with an extra term is needed. Maybe some examples of things that are not expected to work could be helpful.

-Closed I x x∈I = subst (_∈ I) (useSolver x) (·Closed (snd I) (- 1r) x∈I)
where useSolver : (x : R) → - 1r · x ≡ - x
useSolver = solve R'
-Closed I x x∈I = subst (_∈ I) useSolver (·Closed (snd I) (- 1r) x∈I)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected that you can just write solve! R' in place here, is there a reason why this is not possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit mysterious and might be a deficiency of the reflection mechanism. I turned this into issue #1097

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is solved now, thanks to @ncfavier :-)

Cubical/Algebra/CommRing/BinomialThm.agda Show resolved Hide resolved
@felixwellen
Copy link
Collaborator Author

Now it should be more easy to guess when the ring solver will work: It doesn't work well with concrete rings like the integers and sometimes you need to introduce helpers, if some meta variables cannot be solved. Otherwise it should work now in place as one might expect.

@felixwellen
Copy link
Collaborator Author

Max agreed to a merge -> merging.

@felixwellen felixwellen merged commit 4f73645 into master Feb 7, 2024
1 check passed
@felixwellen felixwellen deleted the fwellen/tactical-initiative branch February 15, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants