-
Notifications
You must be signed in to change notification settings - Fork 698
Use a compact representation for real literals #415
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
Conversation
|
Don't feel expert enough to comment in the details but I like it. |
|
I should make it clear that the third item (no more unfolding for morphisms) is kind of a breaking change. I have no idea though how often people have been using |
|
I believe we do some things with |
Possibly. For instance, in some cases where |
|
@silene I've pushed a Travis build with your PR, maybe it is useful to see the impact? |
|
Well, after having a look to https://travis-ci.org/ejgallego/coq/builds/198948362 , it seems this PR breaks Coquelicot and Flocq (and Compcert by transitivity) , I guess the author knows how to handle that :) Do you know of any other development that runs in 8.6/8.7 and could be interesting to test? |
Regarding Flocq, the breakage gives a better view of the impact of this pull request, due to the number of different contributors. In particular, the following issues never occurred when converting the standard library:
|
|
Interesting, thanks @silene . By the way, I see you seem to have pushed related changes to Flocq's master, this however breaks the automated build for both Coq 8.6 and trunk. Did you intend that? If what you want is to have the ci scripts to point to a particular flocq branch for this PR, let me know and I'll add a Flocq overlay. |
This was certainly not intended, especially since I successfully performed a full build of Flocq with Coq 8.6 before pushing (including Flocq's regression checks). Could you point me to these automated builds, so that I try to understand what went wrong? |
Forget about that. I did indeed perform a full build, but the result was not successful. I am not quite sure how the failure went unnoticed. I will fix it. |
|
Interestingly enough, most of the compilation failures came from misfeatures that this pull request intends to fix. For instance, there was a case of |
|
Does this PR still require fixes? Or can it be selected for the next round of merges? |
|
No, it does not require any fix. So, at this point, it is mostly a question of deciding whether the benefits (faster decision procedures, more intuitive proofs, one parser/printer less) outweigh the issues (poor backward compatibility for low-level scripts). |
|
Merging this patch (which looks great IMO) would break testing of flocq, compcert, and coquelicot. These are important packages. Guillaume, do you think such packages could be updated upstream as to be compatible with both 8.6 and 8.7 + this patch? |
|
As for myself, I think that the benefits are strictly greater than the one issue of this PR, namely backward-compatibility. So I'm in favour of merging it. |
For Coquelicot, it should be possible (though I won't have time to do that for the next two weeks). For Flocq, it is next to impossible, since Flocq comes with its own mechanism for "fixing" |
For now I guess you could use a poor's man version. There are two ways as far as I know:
I may try the second approach to make |
Yes, that is what we have been using for the Coq library of Why3 too. Some of the files exist in three different versions (8.4, 8.5, and 8.6) and the |
Here is a messier but lighter-weight poor man's Ltac ifdef' name x y :=
tryif constr_eq name name then exact x else exact y.
Definition F
:= ltac:(ifdef' x True False).
Definition T
:= ltac:(ifdef' True True False).
Print F. (* F = False *)
Print T. (* T = True *) |
... which opportunately reminds me that the discussion on attributes for the 8.7 version has stalled... |
|
Indeed, it would likely be more lightweight if |
And which reminds me Coq 8.0 which had a "V7only [ vernac list ]." command :) |
|
At some point @aspiwack was mumbling something about writing such a CEP... |
|
The basic idea was to have commands like |
|
The exact syntax has not been decided, but in the spirit yes. This would allow to define stuff on a Coq version basis, assuming we have some attribute |
|
Would the syntax for tactics get attribute, whether it is on an individual basis, or at the level of a sentence? |
|
Regarding attributes: I've got a draft proposal somewhere, indeed, as well as an incomplete prototype implementation. I'll try to unearth it next week. |
|
I would very much be in favor of tactics taking attributes too, with some of them being generic and some being tactic-specific. That would avoid having tons of custom syntax: less syntax is better for learning... |
|
That's starting to be a bit off-topic, but I'd personally like that attributes are attached to sentence rather than particular constructs, so that the syntax is uniform. For instance, something along the lines of: |
|
This is a report of experience on porting the contributions [Note: In
So, I guess this is expected and, at least for the two first cases, we cannot do a lot about it. In Float specifically, the breakages are of different kinds:
|
|
It's kind of unfortunate that this porting was not done while the PR was still open, isn't it? If the coq-contribs AILS and Float are still considered worth maintaining, they should be added to Travis CI. But you are suggesting yourself that maybe Float is obsolete. Was it the contrib which was strongly criticized as fundamentally incomplete by some people a while ago? More generally, the question could be asked for all contribs. Which ones are still worth maintaining? Which ones are useful to people, and actually used? Could some of them find an external maintainer? ... |
Yes, I have experienced it too. I feel like it is more of an issue with
I wonder if we should add
No real difficulty but quite a bit of work. Since
That surprises me. Part of the commits were especially meant to prevent that from happening. I will have to take a look at it.
Theoretically, if none of your developments explicitly mention |
Looks unavoidable as this seems the standard way to work for This has by the way sometimes surprising consequences: Lemma f (x := 1) : S x = x -> x + x = x * x.
intro; simpl.
(* S x = x -> S x = 1 *)
Maybe worth to try, I don't know.
Here is a reproducible example: Require Import Reals Ring.
Goal (0+1=0)%R.
ring_simplify (0+1)%R.
Could a pre-processor which rewrites one in the other relevant? An equivalent to |
That is a funny one. It happens that 1 and -1 are hardcoded in the tactic. Since I had exercised the
That would be relevant. Yet, since |
|
@Zimmi48: We need an infrastructure for benchmarking. We need a way to evaluate the impact of our changes on user developments. At best, this is the collection of all developments we are aware of, but reasonably, it can only be a representative subset of them. Now, there is an inner contradiction in a benchmarking test: if we decide for a change of semantics, as we did for this PR, we must update the benchmarking suite otherwise it would not test anything further. This has been done for the packages tested on Travis, but of course there are many other packages available around which were not tested and which we could decide to test also. It is about finding an optimal compromise. In particular, we provided patches for the contributions tested on Travis so that we were still able to use the benchmarking suite (and, incidentally, this provides with a graceful service that we offer to the developers of these packages which we test). Personally, as I said a couple of times, I believe that contributing to build a repository of mathematical and computer science results is important. This is a direction that Isabelle follows with AFP and that Mizar also follows with MML, a direction about which there was a seminar last October and which shows the interest of a community in this direction (especially the CICM community). Coq is not only a programming software, Coq has also a historical role to play as a tool to build formal mathematical knowledge and we should not lose this opportunity. Also, when I'm testing
|
You know I agree with you on that objective. This is also why I'm arguing for putting the standard library into its own repository. It could be the occasion to gather more contributions. For me, contribs do not correspond to the notion of a central repository. They are still external developments, even if they are maintained by the Coq developers.
Yes but then, why not include them into Travis? Your feedback would have been useful to improve the PR. It is still useful now, but earlier would have been better. And we would have got that feedback earlier if these contribs had been included in the Travis tests.
OK thanks! Indeed, this should be considered and decided by the authors themselves. Similarly, the author of GeoCoq asked for the removal of the older contrib for which it is a replacement (I don't know if that wish has been taken into account though.) |
|
@Zimmi48: In general, I'm more on the side of thinking that it is unavoidable to have an experimentation phase for features, even more that we clearly have the responsiveness to deal with post-commit improvements. So, I'm not shocked by this PR having been merged, after having taken into account the elements of the PR discussion, in a state which looks to me reasonable. And I'm fine with being the one who looks at the contribs compatibility. |
To be clear, the natural upgrade of Float (15 years old) is PFF (10 years old). Note that it might be that the content of the contrib is actually PFF and it just happens that the contrib was never renamed; I haven't checked. Flocq is meant to absorb PFF in the long run, but it is not there yet. In fact, Flocq contains some |
|
@silene: the version we have contains files which are the light grey ones at the pff page (up to So, what are your projects with the PFF extension of Float? If the project is that Flocq absorbs Of course, this is a very naive question since I'm unaware of the technical and material issues relative to such a move. So, I apologize for this probable naivety. |
So it is indeed the Float part only.
It is not clear yet. We certainly don't want to expose the (outdated) interface of Float/PFF, but some of the more complicated results are only available in PFF. As a rule of thumb, all the facts proved in the light grey files (that is, Float) have been made obsolete by Flocq, but some of the higher-level files of PFF (e.g. |
|
So since Float has been made obsolete and Flocq is tested in Travis, do you think Float should be removed from the contribs or does it still make sense to keep it? |
|
A few more comments about the impact of this PR on compatibilitity.
|
There might be a misunderstanding there. The cause of the incompatibility is not that
Does it not? Anyway, as I said, a goal like |
|
@silene: Looks like I'm going round in circles. I'm hoping a strict compatility of About |
|
Hi, I noticed another example of unexpected unfolding of real constants using the Maple mode which is relying on low-level commands of the Require Import Reals.
Ltac f x := constr:(FEc 2%Z).
Goal True.
prove_with_field ltac:(f) (1+1)%R.
(* (R1 + R1)%R = (R1 + R1)%R -> True *)This is related to |
From a quick glance at the code, it seems like the function that needs protection is |
|
Seems indeed to fix the problem I observed. Thanks very much! |
|
For compatibility purposes, I'm trying to transform a real constant into an expression made only of Alternatively, that would be cool to have some |
What I did for |
|
Oh! I didn't even know it was documented in the reference manual. Will do. |
This patch set has three main consequences. The first one is the intended one; the two others are side-effects.
Parsing and printing of real literals no longer use the binary representation; they now use
IZR. In other words,5%Ris no longer syntactically equal to1 + 2 * 2; it is nowIZR 5.IZRno longer reduces to a unary representation but to a binary representation, that is,IZR 5is no longer2 + 1 + 1 + 1but1 + 2 * 2. (This also means that5%Ris still convertible to1 + 2 * 2, due to the first item.)Morphism rings no longer unfold their ring morphisms. This is mostly a hack so that
ring_simplifyandfield_simplifyare still usable onR.Note that several of these commits (8d92932, e0a09d3, 3758cbf, 7f82a39, e3c978c) are worth applying even if this feature is deemed too intrusive.