Skip to content

Trunk+abstracting injection flags#677

Merged
coqbot merged 2 commits into
rocq-prover:masterfrom
herbelin:trunk+abstracting-injection-flags
Oct 27, 2017
Merged

Trunk+abstracting injection flags#677
coqbot merged 2 commits into
rocq-prover:masterfrom
herbelin:trunk+abstracting-injection-flags

Conversation

@maximedenes

Copy link
Copy Markdown
Member

This replaces #420 as discussed during the WG.

@maximedenes

Copy link
Copy Markdown
Member Author

@herbelin would you mind rebasing this? Thanks!

@maximedenes maximedenes added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label May 28, 2017
@maximedenes maximedenes added this to the 8.7 milestone Jun 1, 2017
@maximedenes maximedenes added the kind: fix This fixes a bug or incorrect documentation. label Jun 1, 2017
@herbelin herbelin removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jun 9, 2017
@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch from 37ea1ca to ff32694 Compare June 9, 2017 10:17
@herbelin

herbelin commented Jun 9, 2017

Copy link
Copy Markdown
Member

Rebased done. (It is actually more than a bugfix, it is the beginning of a proposal for adding a static control of tactic flags on top of the current dynamic control.)

@maximedenes

Copy link
Copy Markdown
Member Author

@herbelin It seems there was a failure in formal-topology. Could you have a look?

@maximedenes maximedenes added the needs: fixing The proposed code change is broken. label Jun 19, 2017
@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch from ff32694 to 82d0aa2 Compare July 13, 2017 17:31
@herbelin herbelin changed the base branch from trunk to master July 13, 2017 17:31
@herbelin

Copy link
Copy Markdown
Member

Overlay added for formal-topology (decide equality had become stronger).

@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch from 82d0aa2 to 4dd9ac1 Compare July 13, 2017 21:32
@Zimmi48 Zimmi48 removed the needs: fixing The proposed code change is broken. label Jul 19, 2017
Comment thread tactics/equality.ml Outdated
(* [keep_proofs] is relevant for types in Prop with elimination in Type *)
(* In particular, it is relevant for injection but not for discriminate *)

let find_positions keep_proofs env sigma ~no_discr t1 t2 =

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

keep_proofs should be a label here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree that a label better documents itself (and be consistent with the use of a label for no_discr).

Comment thread tactics/equality.ml Outdated

let injectable env sigma t1 t2 =
match find_positions env sigma ~no_discr:true t1 t2 with
let injectable keep_proofs env sigma t1 t2 =

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here, should be a label.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Finally, I changed this to support a Boolean option so as to have better compatibility. Now, plugin writers have to make a conscious decision of whether they want to use the API with a statically-defined behavior or with a behavior which varies depending on the value of global flags.

Comment thread plugins/funind/invfun.ml Outdated
then Proofview.V82.of_tactic (Equality.discrHyp id) g
else if Equality.injectable (pf_env g) (project g) t1 t2
then tclTHENLIST [Proofview.V82.of_tactic (Equality.injHyp None id);thin [id];intros_with_rewrite] g
else if Equality.injectable false(*?*) (pf_env g) (project g) t1 t2

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is there something that shoud be checked, as indicated by the comment?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Previously, this behavior was dynamically decided by the Keep Proof Equalities flag. In principle, it should be @forestjulien and @Matafou to know what they want here, but I don't think it matters a lot.

I committed a new version which preserves the former dynamic behavior.

Comment thread tactics/equality.ml Outdated
| None -> !keep_proof_equalities_for_injection
| Some b -> b

let dEqThen keep_proofs with_evars ntac = function

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

label

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

label

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are pros and cons. For instance, here, there is also an issue of uniformity of style. The with_evars flag is used pervasively without being a label.

Comment thread tactics/equality.ml
!injection_in_context
&& Flags.version_strictly_greater Flags.V8_5
let use_injection_in_context = function
| None -> !injection_in_context && Flags.version_strictly_greater Flags.V8_5

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What is this option and why do flags have priority over it? I'm not saying anything is wrong, just trying to understand.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Boolean injection_in_context is the dynamic value of the Structural Injection option.

The flags is the static configuration, defaulting to the dynamic configuration when None. If Some, the static configuration takes priority. See discussion at ceps #29.

@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch 2 times, most recently from a3c1b60 to ada2c38 Compare July 26, 2017 11:16
@maximedenes

Copy link
Copy Markdown
Member Author

@herbelin Is the topology fix backward compatible? If yes, can you make a PR upstream so that we can remove the overlay?

@herbelin

Copy link
Copy Markdown
Member

It is not. We could make one of course but to the price of an uglier code or of getting rid of decide equality.

@maximedenes

Copy link
Copy Markdown
Member Author

@herbelin Can you integrate the fix in topology?

@herbelin

herbelin commented Aug 1, 2017

Copy link
Copy Markdown
Member

Sorry, I failed to understand the policy with fixes to contributor packages. We don't have control on topology besides overlays, do we? What do you want me to do exactly?

@maximedenes

Copy link
Copy Markdown
Member Author

If you can make a pull request on topology, it would be ideal. But of course, if they don't ship a version of topology for each version of Coq, the fix should be backward compatible.

@herbelin

herbelin commented Aug 1, 2017

Copy link
Copy Markdown
Member

@maximedenes: I don't know if you are a subscriber to topology. So, just to be sure you know, I made a PR, letting them decide what they think is best for them.

@maximedenes

Copy link
Copy Markdown
Member Author

Indeed, I'm not, so thanks for the update.

@Zimmi48

Zimmi48 commented Aug 2, 2017

Copy link
Copy Markdown
Member

@herbelin if you give the link to the PR in the thread, it can help track its status.

@herbelin

herbelin commented Aug 2, 2017

Copy link
Copy Markdown
Member

PR on topology here.

@Zimmi48 Zimmi48 added needs: fixing The proposed code change is broken. needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. labels Aug 9, 2017
@Zimmi48

Zimmi48 commented Aug 9, 2017

Copy link
Copy Markdown
Member

It seems that this PR creates warnings which make the Travis build fail (and in passing there is also a trivial merge conflict).

Maybe a mention should be added in the compatibility file (I'm not sure what's the rule concerning when to update this file).

Finally, following your PR on topology, a commit was added to the master branch for backward-forward compatibility. Maybe this branch can be tested as a temporary overlay to confirm this commit does the job?

@Zimmi48

Zimmi48 commented Aug 15, 2017

Copy link
Copy Markdown
Member

@herbelin Would you mind fixing the conflict and the warnings? Otherwise, this is going to miss 8.7+beta.

@maximedenes maximedenes modified the milestones: 8.8, 8.7+beta Aug 17, 2017
@bmsherman

Copy link
Copy Markdown

@Zimmi48 I have also now pushed that commit to the ci branch of the bmsherman/topology library, which is the one that I believe you are following. It took me a while because I wanted to be able to confirm that it was working on Travis, but have been having other difficulties with Travis so it wasn't building for some other reason.

@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch from ada2c38 to 2c1c901 Compare September 4, 2017 10:44
@herbelin

herbelin commented Sep 4, 2017

Copy link
Copy Markdown
Member

@Zimmi48: I rebased. I cannot reproduced the warning, so I suspect it resulted from a temporary failure of master.

@Zimmi48 Zimmi48 removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Sep 4, 2017
@Zimmi48

Zimmi48 commented Sep 4, 2017

Copy link
Copy Markdown
Member

@herbelin Did you try to compile with the -warn-error configure option? Travis still reports some fatal warnings.

@Zimmi48

Zimmi48 commented Sep 4, 2017

Copy link
Copy Markdown
Member

Also note that you should normally be able to drop the overlay (commit 2c1c901) now.

@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch 2 times, most recently from 6059756 to 630ef94 Compare September 4, 2017 13:16
@herbelin

herbelin commented Sep 4, 2017

Copy link
Copy Markdown
Member

@Zimmi48: Ah, sorry, I did not see the funind warning (I generally don't use the -warn-error configuration flag because I generally prefer to skip warnings while in work-in-progress phase; I should eventually find a more robust light way to check them before pushing though, other than my eyes jumping over the non-filtered tacentries.ml warning).

Warning now fixed, and overlay removed.

@Zimmi48

Zimmi48 commented Sep 4, 2017

Copy link
Copy Markdown
Member

I generally don't use the -warn-error configuration flag because I generally prefer to skip warnings while in work-in-progress phase; I should eventually find a more robust light way to check them before pushing though

Same here.

@Zimmi48 Zimmi48 removed the needs: fixing The proposed code change is broken. label Sep 4, 2017
maximedenes added a commit to maximedenes/coq that referenced this pull request Sep 11, 2017
@maximedenes

Copy link
Copy Markdown
Member Author

A travis run on my repo seemed to indicate a failure in formal-topology, but maybe unrelated. A quick rebase would help figuring out.

@maximedenes maximedenes added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Sep 15, 2017
@Zimmi48

Zimmi48 commented Sep 15, 2017

Copy link
Copy Markdown
Member

If we believe the Travis output before the conflict, the failure on formal-topology is real. This is also consistent with the history of this PR that has highlighted that formal-topology uses a lot of decide equality.
The conflicts come only from the CHANGES file and this is really annoying (this file is a large source of merge conflicts). We should probably come up with a strategy for generating the CHANGES file at the time of the release instead, but with formatted descriptions left in the commit messages (or PR messages). In the meantime, in the case of this PR, the CHANGES mention should go in the section "Changes beyond 8.7" (since it is too late at this point in the release cycle to backport a fix that affects the behavior of a tactic).

@bmsherman

Copy link
Copy Markdown

I'm sorry, for some reason I thought that I had pushed the change to stop using the decide equality tactic in the formal-topology library (ci branch of bmsherman/topology), but I just checked it now and apparently that change had not been incorporated. I've just made the change now.

(@Zimmi48 formal-topology actually only used decide equality once, and all that used to solve was decidable equality of the empty type anyway, so I removed the use of the decide equality tactic and just manually created the decidable equality instance.)

ML level can set the flags themselves.

In particular, using injection and discriminate with option "Keep
Proofs Equalities" when called from "decide equality" and "Scheme
Equality".

This fixes bug rocq-prover#5281.
@herbelin herbelin removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Oct 26, 2017
@herbelin

Copy link
Copy Markdown
Member

It seems this branch has been forgotten because of a needs:rebase tag which was not relevant at that time and which noone checked the relevance about.

A property of such tag is of course that it eventually spontaneously becomes relevant again, so I rebased.

Anything preventing this fix to be merged? (I guess now in 8.8 since it changes the ML API?)

@Zimmi48

Zimmi48 commented Oct 26, 2017

Copy link
Copy Markdown
Member

A property of such tag is of course that it eventually spontaneously becomes relevant again, so I rebased.

If you mean: "I rebased today", then you forgot to push. Not a big deal though because the only conflicts are in the change-log files.

@herbelin herbelin force-pushed the trunk+abstracting-injection-flags branch from 630ef94 to 91e9e1c Compare October 26, 2017 14:52
@herbelin

Copy link
Copy Markdown
Member

Indeed (I forgot the -f).

@coqbot coqbot merged commit 91e9e1c into rocq-prover:master Oct 27, 2017
coqbot pushed a commit that referenced this pull request Oct 27, 2017
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants