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

Fixes #9412: Context command ignored implicit binders #11390

Closed

Conversation

herbelin
Copy link
Member

Kind: bug fix

Fixes / closes #9412

This is a quick fix (which will have to be adapted on top of #12272).

@herbelin herbelin added kind: fix This fixes a bug or incorrect documentation. part: elaboration The elaboration engine, also known as the pretyper. labels Jan 13, 2020
@herbelin herbelin added this to the 8.11.0 milestone Jan 13, 2020
@herbelin herbelin requested a review from a team as a code owner January 13, 2020 09:31
@ppedrot ppedrot modified the milestones: 8.11.0, 8.12+beta1 Jan 13, 2020
@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from 7e23c89 to 18abb07 Compare January 14, 2020 21:07
@herbelin
Copy link
Member Author

I added a warning for Context not in a section (but I'm not fully convinced; refining the refman to tell that Context outside a section is like the declarations made Local is maybe lighter).

Maybe the incompatibilities are too important and it'll be preferable to do the fix in two steps... A first release with a warning telling how to fix. The next release w/o the warning??

@SkySkimmer
Copy link
Contributor

Some people use context outside sections a lot, eg https://github.com/mit-pdos/perennial/blob/cdaa737e40d08c1c7c7d514db69a8f9b55814713/src/CSL/RefinementIdempotenceModule.v#L18-L52
Not sure we want to warn for that. Maybe an off-by-default warning?

@herbelin
Copy link
Member Author

Some people use context outside sections a lot, eg https://github.com/mit-pdos/perennial/blob/cdaa737e40d08c1c7c7d514db69a8f9b55814713/src/CSL/RefinementIdempotenceModule.v#L18-L52
Not sure we want to warn for that. Maybe an off-by-default warning?

Thanks. This confirms my view that we should rather change the doc. (But still keep a warning for Context {a : A} outside a section).

To deal with the compatibility, I'm now otherwise considering using the multiple sequence of implicit arguments feature, i.e. to do so that Context (f : forall {x}, ...) behaves as Arguments f {x} ..., x ... (including auto implicit arguments if any). This could even be generalized to all manual declarations of implicit arguments, i.e., when the conclusion of f is rigid, that:

Definition f : forall {x}, ...

behaves (including auto implicit arguments) as:

Arguments f {x} ..., x ...

I suspect that this would be totally compatible, since the extra sequence would be used only when more arguments than expected are used.

Also, this would provide with an alternative way to explicitly give implicit arguments which is lighter than by using the (x:=...) notation.

What do you think?

@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from 18abb07 to f253565 Compare January 17, 2020 22:29
@herbelin herbelin requested a review from a team as a code owner January 17, 2020 22:29
@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from f253565 to 0f34cb5 Compare January 20, 2020 15:12
@herbelin herbelin requested a review from a team as a code owner January 20, 2020 15:12
@maximedenes maximedenes self-assigned this Jan 27, 2020
Copy link
Member

@Zimmi48 Zimmi48 left a comment

Choose a reason for hiding this comment

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

If this is meant to be a breaking change, the changelog entry should be much more explicit about this.

@herbelin
Copy link
Member Author

If this is meant to be a breaking change, the changelog entry should be much more explicit about this.

I started investigating how to make it (hopefully) a non-breaking change, by using multiple lists of implicit arguments. It is not so clear how to do in an elegant way though:

  • First, this has to exclude constants with flexible conclusion as e.g. in type forall X, X -> X, since this kind of constant have an arity difficult to control syntactically.

  • Second, it would be too ad hoc to do it only for Context, so it would have to be done for all kinds of declarations.

  • Third, it is not fully clear which range of flexibility we may want. For instance, in

    Set Implicit Arguments.
    Context (f : forall {A} B, A -> B -> Type).
    

    it would certainly be natural that:

    • with 4 arguments, it is @f x y z t (no implicit arguments at all)
    • with 2 arguments, it is @f _ _ x y (the automatic + manual implicit arguments)
    • with 1 argument, it is @f _ _ x
    • with 0 arguments, it is @f _ (the maximal manual one)

    But with 3 arguments, should it fail on the principle that it is 2 implicit arguments or none? Or should it make a hierarchy between manual and automatic implicit arguments and consider either that the manual implicit arguments are stronger, giving @f _ x y z, or that the automatic implicit arguments are stronger, giving @f x _ y z. This is the point I arrived in my thinking.

[Slightly related, but for another PR, @mattam82 suggested me to deprecate automatic declaration of not-in-section Context assumptions as instances, as it was done already for Axiom.]

@SkySkimmer SkySkimmer added needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. needs: overlay This is breaking external developments we track in CI. labels Mar 30, 2020
@Zimmi48
Copy link
Member

Zimmi48 commented May 12, 2020

Dear PR author(s) and contributors, it seems to us this PR may need additional work beyond the 8.12 branching deadline on May 15th.

We are thus removing the 8.12+beta1 milestone; please retarget as appropriate, and also consider updating labels to reflect current status, moving the PR to draft status, etc.

We apologize in advance if we misunderstood the PR status.

@Zimmi48 Zimmi48 removed this from the 8.12+beta1 milestone May 12, 2020
@herbelin
Copy link
Member Author

This PR implements/fixes what I think is the expected behavior for Context and, to me, there is no doubt that it is good. The problem was to preserve compatibility. User and developer feedback welcome about how to manage the incompatibilities (a flag, an upgrading script, manual updates, ...)?

@Zimmi48
Copy link
Member

Zimmi48 commented May 13, 2020

I'm slightly worried about your ideas for making this a non-breaking change. I'd much rather advertise this as a breaking bug fix (like the one of Export) and implement the only correct behavior. Have you tried preparing overlays for the affected projects? Naively, I'd think that if the implicit binders were ignored, a backward-compatible fix is just to remove the implicit binders from these projects, wherever they create trouble. If backward-compatible overlays are easy to prepare, then the number of affected projects is not a problem: we should just make sure that the fix is properly advertised in the release notes. But there might be something I don't understand because I'm surprised that the compatibility impact is so large.

In any case: this seems slightly too late for 8.12, but this would still be great to finish this!

@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from 0f34cb5 to a385b2e Compare October 4, 2020 14:25
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Oct 4, 2020
@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from a385b2e to 4bf1400 Compare November 18, 2020 15:54
@Zimmi48
Copy link
Member

Zimmi48 commented Nov 18, 2020

BTW, the change to the doc is completely independent of the rest of the PR and should have been its own PR (it would have been merged much faster).

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Nov 18, 2020

The job library:ci-fiat_crypto_legacy has failed in allow failure mode
ping @JasonGross

@Zimmi48
Copy link
Member

Zimmi48 commented Nov 18, 2020

The number of impacted projects seems so huge that I'm having a very hard time believing that there are really this many projects that used an implicit binder in the type of a variable declared in a Context command. It may instead be the effect of a buggy implementation...

@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jun 23, 2021
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 23, 2021

The job library:ci-fiat_crypto_legacy has failed in allow failure mode
ping @JasonGross

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 23, 2021

Hey, I have detected that there were CI failures at commit 9629257 without any failure in the test-suite.
I checked that the corresponding jobs for the base commit c750baa succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following targets: ci-fiat_crypto, ci-fiat_crypto_legacy.

However, you may want to wait until the pipeline for the base commit (c750baa) finishes.

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Aug 23, 2021
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Sep 22, 2021

The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed.

@coqbot-app coqbot-app bot added the stale This PR will be closed unless it is rebased. label Sep 22, 2021
@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from 9629257 to 934282f Compare September 22, 2021 11:56
@coqbot-app coqbot-app bot removed needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. stale This PR will be closed unless it is rebased. labels Sep 22, 2021
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Sep 22, 2021

The job library:ci-fiat_crypto_legacy has failed in allow failure mode
ping @JasonGross

@Alizter
Copy link
Contributor

Alizter commented Nov 27, 2021

ping @herbelin what is to be done with this?

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Apr 27, 2022
@coqbot-app
Copy link
Contributor

coqbot-app bot commented May 27, 2022

The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed.

@coqbot-app coqbot-app bot added the stale This PR will be closed unless it is rebased. label May 27, 2022
@herbelin herbelin force-pushed the master+fix-9412-context-implicits branch from 934282f to 6a38039 Compare May 30, 2022 09:34
@coqbot-app coqbot-app bot removed needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. stale This PR will be closed unless it is rebased. labels May 30, 2022
@coqbot-app
Copy link
Contributor

coqbot-app bot commented May 30, 2022

The job library:ci-fiat_crypto_legacy has failed in allow failure mode
ping @JasonGross

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jul 12, 2022
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Aug 11, 2022

The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed.

@coqbot-app coqbot-app bot added the stale This PR will be closed unless it is rebased. label Aug 11, 2022
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Sep 12, 2022

This PR was not rebased after 30 days despite the warning, it is now closed.

@coqbot-app coqbot-app bot closed this Sep 12, 2022
@Zimmi48
Copy link
Member

Zimmi48 commented Sep 12, 2022

@herbelin Was this PR almost ready for the last two years?

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. needs: fixing The proposed code change is broken. needs: overlay This is breaking external developments we track in CI. needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. part: elaboration The elaboration engine, also known as the pretyper. stale This PR will be closed unless it is rebased.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context ignores implicit binders in types of hypotheses
8 participants