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

Auto-instantiate proof of adjunction alongside section and retraction (cf., #57) #68

Merged
merged 12 commits into from
Sep 18, 2019

Conversation

nateyazdani
Copy link
Contributor

This PR pulls in Jasper's HoTT module for adjointifying equivalences and applies its generic lemmas when equivalence-proving is enabled. The module is placed at theories/Adjoint.v.

For an ornament named ${ornament}, this feature instantiates Jasper's fg_id' (to adjointify retraction) as ${ornament}_retraction and f_adjoint (to prove adjunction) as ${ornament}_adjunction.

The initial retraction proof (which is an input to the previous two lemmas) is now generated as ${ornament}_retraction0 to prevent a name collision. To actually benefit from the adjunction theorem, rewritings need to use the adjointified retraction lemma, hence the preferential naming scheme.

The test script (test.sh) passes successfully.

Some potential design concerns:

  • Are you okay with adjunction sharing the same proof-generation option as section+retraction?
  • Do you want the Adjoint.v module translated to use Ltac proof scripts instead of terms?
  • Is the need to use adjointified retraction lemmas a problem? I wouldn't think so, but I wanted to mention it because the two versions' definitional equalities don't coincide (e.g., refold_retraction in Example.v does not hold, though a different proof could plausibly work).

If satisfactory, this feature would resolve issue #57.

nateyazdani and others added 5 commits August 28, 2019 15:39
A proof later in the module relies on definitional equalities of the initially
generated retraction proof not shared by the adjunction-augmented version.
Copy link
Collaborator

@tlringer tlringer left a comment

Choose a reason for hiding this comment

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

Exciting! A few comments. Please also add tests for adjunction inside of Test.v, and make sure that you run all of them and that it works correctly.

plugin/coq/examples/Example.v Outdated Show resolved Hide resolved
plugin/coq/examples/Example.v Outdated Show resolved Hide resolved
plugin/coq/examples/Example.v Outdated Show resolved Hide resolved
plugin/src/automation/equivalence.ml Show resolved Hide resolved
plugin/src/automation/equivalence.ml Show resolved Hide resolved
plugin/coq/examples/Example.v Outdated Show resolved Hide resolved
plugin/src/automation/equivalence.ml Show resolved Hide resolved
plugin/src/automation/equivalence.mli Show resolved Hide resolved
plugin/src/frontend.ml Show resolved Hide resolved
plugin/src/frontend.ml Show resolved Hide resolved
@tlringer
Copy link
Collaborator

tlringer commented Sep 6, 2019

Linking to #39 also

@nateyazdani
Copy link
Contributor Author

All requests for changes have been addressed, with the exception of the naming scheme and a line in the example script; I asked follow-up questions in reply to those comments.

All tests pass.

@nateyazdani
Copy link
Contributor Author

Ah, it seems that I've let this linger too long, and there are now merge conflicts. They're pretty innocuous, so I'll leave them be for now, in case you'd like to inspect.

@tlringer
Copy link
Collaborator

Yeah, don't bother trying the merge, I'll do it once everything is addressed

@nateyazdani
Copy link
Contributor Author

All done with requested changes! After switching the initial retraction name back to ${ornament}_retraction, I used ${ornament}_retraction_adjoint for the adjointified version.

@tlringer
Copy link
Collaborator

LGTM, I will take over and try the merge.

@tlringer tlringer merged commit d784b94 into master Sep 18, 2019
@tlringer
Copy link
Collaborator

Thanks for the great work!!

@tlringer tlringer deleted the user-friendly-types branch September 18, 2019 23:28
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