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

Fixing yet a source of dependency on alphabetic order in unification. #7257

Merged

Conversation

herbelin
Copy link
Member

@herbelin herbelin commented Apr 15, 2018

Kind: bug fix

Fixes #7256, refining c24bcae (PR #924) and 6304c84:

  • c24bcae fixed the order in the heuristic governed by the choose flag
  • 6304c84 improved the order by preferring projections

There remained a dependency in the alphabetic order in selecting unification candidates. This PR fixes it by radically changing the representation of the substitution to invert, using a map indexed on the rank in the signature rather than on the name of the variable. Note that more could be done to use numbers further, e.g. for representing aliases (but not a priority at the moment).

Added note: The fix seems to break things elsewhere. To be investigated. This PR now depends on PR #7274 for the compilation of the test-suite. (Updated 28 July 2018)

@herbelin herbelin added kind: fix This fixes a bug or incorrect documentation. part: tactics part: elaboration The elaboration engine, also known as the pretyper. part: unification The unification mechanism. labels Apr 15, 2018
@herbelin herbelin added this to the 8.8.1 milestone Apr 15, 2018
@herbelin herbelin requested a review from mattam82 as a code owner April 15, 2018 13:58
@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from 652437a to 6c5f948 Compare April 15, 2018 14:05
@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from 6c5f948 to ee912f7 Compare April 16, 2018 21:27
@herbelin herbelin added the needs: merge of dependency This PR depends on another PR being merged first. label Apr 17, 2018
@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from ee912f7 to bda4019 Compare April 18, 2018 17:14
@Zimmi48 Zimmi48 added this to Request 8.8 inclusion in Coq 8.8 Apr 19, 2018
@herbelin
Copy link
Member Author

@mattam82: is it asking you a lot to review this PR considering your schedule?

@Zimmi48 Zimmi48 modified the milestones: 8.8.1, 8.9+beta1 Jun 9, 2018
@Zimmi48 Zimmi48 added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jun 9, 2018
@ppedrot ppedrot removed the needs: merge of dependency This PR depends on another PR being merged first. label Jul 26, 2018
@ppedrot
Copy link
Member

ppedrot commented Jul 26, 2018

#7274 has been merged, can you rebase @herbelin?

Copy link
Member

@mattam82 mattam82 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Removing the choose function and rather returning the ordered list of possible projections makes the algorithm much clearer I think. I suppose the Notations.out change is unrelated right?

@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from bda4019 to 21a9b15 Compare July 28, 2018 09:08
@coqbot coqbot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jul 28, 2018
@herbelin
Copy link
Member Author

herbelin commented Jul 28, 2018

I suppose the Notations.out change is unrelated right?

It is not unrelated. This was a case where the inference of the return predicate was dependent on the names of variables. The change in Notations.out reflects what is the canonical way to infer the predicate, independently of how the variables are named.

I added a note in CHANGES to clarify the potential incompatibilities.

I also removed the UniMath overlay, since this has been merged upstream.

PS: Thanks for the review.

@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from 21a9b15 to 0322575 Compare July 28, 2018 18:06
@ppedrot ppedrot self-assigned this Aug 16, 2018
@ppedrot
Copy link
Member

ppedrot commented Aug 16, 2018

@herbelin Are the CI failures related? Otherwise, can you rebase on a fresh master to check that everything is OK?

@herbelin
Copy link
Member Author

Are the CI failures related?

Probably. No visibility though on when I can work on it.

@ppedrot ppedrot added the needs: progress Work in progress: awaiting action from the author. label Sep 5, 2018
@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from 0322575 to 2245419 Compare September 11, 2018 12:14
@herbelin
Copy link
Member Author

Note in passing: make ci-vst on MacOS X fails. The makefile sets $ARCH to Darwin and the .depend targer looks for compert/Darwin which does not exist. Maybe setting ARCH manually in dev/ci-vst.sh would work (if ever an accepted way to proceed).

@herbelin
Copy link
Member Author

herbelin commented Sep 11, 2018

Note for myself: VST failing on a change of unification in the following (simplified) example:

Goal forall n, n = 0 -> exists p, p = n /\ p = 0.
intros. eexists ?[p]. split. rewrite H.
reflexivity.

Added: now fixed.

@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from 2245419 to a10cfdf Compare September 12, 2018 08:22
@herbelin
Copy link
Member Author

@ CI experts: cross-crypto has an instance of unification which depends on the ASCII order, and which this PR fixes. The incompatibility is in the submodule FCF. Is there a way to make an overlay for a submodule or do I need instead to let upstream FCF first merge the (backwards-compatible) fix I made?

@SkySkimmer
Copy link
Contributor

SkySkimmer commented Sep 14, 2018 via email

@herbelin
Copy link
Member Author

@SkySkimmer: I went towards submitting a PR to FCF. If it takes too long, I'll do an overlay of cross-crypto linking to my own version of the submodule. Thanks!

@herbelin herbelin removed the needs: progress Work in progress: awaiting action from the author. label Sep 14, 2018
This refines even further c24bcae (PR coq#924) and 6304c84:
- c24bcae fixed the order in the heuristic
- 6304c84 improved the order by preferring projections

There remained a dependency in the alphabetic order in selecting
unification candidates. The current commit fixes it.

We radically change the representation of the substitution to invert
by using a map indexed on the rank in the signature rather than on the
name of the variable.

More could be done to use numbers further, e.g. for representing
aliases.

Note that this has consequences on the test-suite (in
output/Notations.v) as some problems now infer a dependent return
clause.
@herbelin herbelin force-pushed the master+fix-yet-another-unif-dep-in-alphabet branch from a10cfdf to 99ffdbb Compare September 14, 2018 14:24
@herbelin
Copy link
Member Author

herbelin commented Sep 15, 2018

Finally, I made an overlay to cross-crypto to tell it which HEAD of FCF to get. Should I submit a PR to cross-crypto just for that or can I expect that cross-crypto updates the head of its submodule automatically?

Added: never mind, I saw that the last commit to cross-crypto was a submodule update, so I submitted a PR.

@herbelin
Copy link
Member Author

Overlays merged upstream. Seems ready.

@ppedrot ppedrot merged commit c9c18ed into coq:master Sep 19, 2018
ppedrot added a commit that referenced this pull request Sep 19, 2018
@Zimmi48 Zimmi48 added this to Request 8.9 inclusion in Coq 8.9 Sep 26, 2018
silene added a commit that referenced this pull request Oct 16, 2018
@coqbot coqbot moved this from Request 8.9 inclusion to Shipped in 8.9+beta1 in Coq 8.9 Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: fix This fixes a bug or incorrect documentation. part: elaboration The elaboration engine, also known as the pretyper. part: tactics part: unification The unification mechanism.
Projects
No open projects
Coq 8.9
  
Shipped in 8.9+beta1
Development

Successfully merging this pull request may close these issues.

Yet another source of dependency on alphabetic order in unification
6 participants