Convert Vernacular section of gallina chapter to use prodn - #11423
Conversation
|
First, would you delete the 1. For the section "The Vernacular":
2. Assumptions section:
3. I renamed some cmd and cmdv's to, respectively xxxFixME and xxxVar. Should some of these (e.g. SubClassVar and VariableFixMe) become the primary description of those commands, or can the be together with their related commands that share syntax (other than the command name)? 4. Updating the |
e19a54b to
d86bd54
Compare
|
Also, should |
Tactics cannot be parsed outside of proof editing mode. Proof editing mode is activated when running some commands, like
In the proof handling chapter.
The general description of
I would prefer to clearly separate EDIT: but given the shared syntax, describing similar commands in a single place makes sense as well. |
That makes sense. It makes the presentation simpler and probably a bit less effort. But instead of creating a new directive, I would just add sentences just below the syntax presentation such as "You can prefix this command with Local" with a hyperlink on "Local". (Hmm, how you look up "Local" or "#[local]" in the index?)
|
It looks like Axiom, Conjecture, Parameter are synonyms and that Hypothesis, Variable are synonyms, which I can reflect a little better. Are Theorem|Lemma|Fact|Remark|Corollary|Proposition|Property all synonyms? Seems like the variant for "Definition" just below the variant for "Theorem". Also "Let" is under both "Theorem" syntax and "Definition" syntax. Which is the right place? Also, Example and Definition are equivalent but SubClass is different. I think I'll seperate SubClass from Example and Definition. Are Example and Definition completely equivalent? (Still need to update some of the variant commands...) |
|
Updated. Probably better for you to respond to my comments rather than read the output closely. |
Using a dedicated directive allows to create an index of attributes. Then we could write such sentences below the syntax presentation of the command, but it would be something like: This command supports the following list of attributes: :attr:`local`, :attr:`global:,
:attr:`universes`, :attr:`deprecated`.Note that when I'm talking about attributes, I'm not including ad-hoc syntax like
Yes
Yes (and
Yes |
|
Re: first part of #11423 (comment) The section "The Vernacular" seems to me a logical place to introduce the major top-level features of the valid inputs to Coq--some of which are semantic and/or generated by code rather than done in the grammar (and BTW, not easy to fake in a context-free grammar). Specifically, mention that there are commands and tactics, starting with upper/lower case letters. Tactics are only valid when you're in a proof mode (leaving further detail to other chapters as you suggested). Also mention that commands can have attributes (linking to details on these elsewhere). And mention the existence of sections, which open and close like balanced parentheses. This is just to provide a grammatical overview of a few things to replace the useless grammar that's currently in this section. Does this make sense? (And if not described here, then where?) Are there any other general significant non-grammar features that would fit in here? EDIT: I see we already covered much of this in #11423 (comment). |
|
Re: Local/Global and How do you get the list of all attributes and which commands/tactics they apply to? Currently it looks like you have to read lots of code to do so. That's not going to be easy to track or get right. Perhaps we could encourage someone to look at handling this better? At least file a PR? If I create a directive for attributes, it would look like this, except it would say "Attribute": What about indexing? AFAIK the number of attributes is small and doesn't merit its own special index. Perhaps it could show up in the full index. (And remember we discussed indexing tactical quite some time ago without resolution--the PR is still open.)
EDIT: Are attributes meant to apply to tactics? If so, I don't think there's a way to specify them for Ltac/Ltac2. If that's right, we should open a PR. Also, the grammar for attributes allows complex nesting, e.g. |
|
What do you think about changing the grammar so that all commands syntactically accept attributes? These commands are the exceptions. Right now "Local Quit." gives a syntax error whereas "Local Proof" gives a semantic error. Simpler to have it completely consistent and simpler to document accurately). |
|
Also vernac_control (shown above) permits a variety of curious things like "Time Time reflexivity." Also it appears that the |
This comment has been minimized.
This comment has been minimized.
|
Responding to #11423 (comment):
It does, thanks!
I don't know and maybe @SkySkimmer can answer this. In any case, attributes are just like options and flags. They are not part of the grammar, they just have a generic mechanism to parse them. If we must track them manually to start with (like we do for warning, error messages, flags and options) so be it.
No, not like this! The attribute is just
It is bound to grow, and it definitely deserves its own index. The whole point is to replace all the ad hoc flags that we have for a number of commands. A number of flags or options would also deserve to get a corresponding attribute to be set locally.
Just because we couldn't agree on what a tactical is.
Tactics do already support attributes. You can in fact add
This is a very simple grammar whose purpose is to capture whatever attribute we may want to define in the future. Why would we put an arbitrary bound to the level of nesting?
Once again,
Sure, feel free to improve this in another PR. |
They are parsed as attributes. |
|
From a user's perspective, attributes are what one finds within |
|
Let's not get hung up the semantics of "attribute". I doubt the user cares to make a sharp distinction between the syntax
It's trivial to add or remove the index. I don't see a lot of value when I only count 7 current attributes. The attributes accepted by any command are quite specific to each command. Why would the user want to look up "polymorphic" by itself? The attribute description won't say what commands it can be used with. But as we discussed, each command will list the attributes it supports, so if you see
It's not so simple. What's the difference between Also note that every command accepting an attribute will need to refer back to the section giving the general syntax for attribues
But why? What could be simpler than saying that all commands can have attributes instead of only a subset? Consistency is simpler to explain and maintain. Your thoughts? |
|
Also, I think there is another challenge: I think "Local" has slightly different meanings for different commands. If so, it's not going to be easy/possible to write up "Local" in one place. |
There's no difference between
Sometimes they take values.
Well, yes.
This example is only theoretical since these attributes do not exist. Note that it is not the user who can decide to nest attributes, but only the attribute designer. E.g.
When I see your screenshot, I find it pretty simple, and I doubt that you could simplify it while still supporting whatever attributes already exist.
I am not sure I understand this sentence, but isn't it exactly the same for flags and options?
Do not consider these internal / toplevel commands Regarding |
This is unfortunate, we have no choice but to document the |
I certainly don't plan to do anything with these in this PR. But it's overkill to invent a new category of non-commands in the documentation. It just makes the doc more convoluted and confusing to users. It should be sufficient to document them as commands and to mention their special differences in the associated text for each. I expect users will think of them as commands no matter what we call them.
I see this the same as While I need to add some more words relating ltac_expr and tactics, this is the logical place where |
|
Updated. Please take a look. |
They are documented here: https://coq.github.io/doc/master/refman/language/cic.html#coq:flag.auto-template-polymorphism This confirms IMHO the importance of providing an index for attributes. But this can come later on. |
|
@jfehrle Rather than trying to explain exactly what I wanted you to do for the inductive type introduction, I've pushed a commit doing the changes myself. Let me know if you are OK with that. Afterwards, the PR will need some squashing and we can merge. |
| this variant, unless the :flag:`Nonrecursive Elimination Schemes` flag is on. | ||
|
|
||
| This command supports the :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes. | ||
| This command supports the same attributes as the :cmd:`Inductive` command. |
There was a problem hiding this comment.
Although the wording is repeated in a couple places, I prefer the original because it's one less hyperlink to get to the info you need. What do you think?
There was a problem hiding this comment.
We can go back to the original wording, but then the list of supported attributes should be kept.
|
Updated. Your changes look good, they read pretty well. Nonetheless, I thought some of the wording and details could be improved. Please take a look. I plan to squash after I hear back from you. |
|
Also changed the first paragraph under "cmd:: Inductive" to: This command defines one or more |
7b6a092 to
b105249
Compare
|
Squashed and marked ready for review. |
|
What about simply "depending on the universe that the inductive type belongs to"? |
| The :cmd:`Class` command is used to declare a typeclass with parameters | ||
| :token:`binders` and fields the declared record fields. | ||
|
|
||
| This command supports the :attr:`Cumulative`, :attr:`NonCumulative` and :attr:`Private` attributes. |
There was a problem hiding this comment.
Similar to the question you raised in the Gallina chapter, this should either read "This commands supports the same attributes as the Inductive command" or it should be fixed to list the actual full list of attributes that this command supports.
There was a problem hiding this comment.
I listed all the attributes. I have the same text for these commands:
finite_token: [
| "Inductive"
| "CoInductive"
| "Variant"
| "Record"
| "Structure"
| "Class"
]
It may be tedious to get all the attributes right and correct in the doc. Eventually we should come up with a semi-automatic way to extract the relevant attributes for each command. Probably means creating some common code to check attributes.
There was a problem hiding this comment.
Indeed, some future work in sight!
|
Note that the error in the refman is in master, not in this PR. |
|
Given that this PR has been pretty much already reviewed, I announce my intention of merging it on Friday if no more comments by then. |
|
The fix has been merged in master. |
|
@jfehrle Could you fix the PR according to the last few comments I made before I merge this? |
b105249 to
ff0ff3e
Compare
|
Updated, addressed your comments in #11423 (comment). |
|
Thanks for your help! |
| Inductive nat : Set := | ||
| | O : nat | ||
| | S : nat -> nat. | ||
| A simple inductive type belongs to a universe that is a simple :n:`sort`. |
There was a problem hiding this comment.
What does it mean to be a "simple sort"? Is that different from @sort? If so, that should be defined--I can do that in the other PR. And :n:`sort` should be :n:`@sort` (?)
There was a problem hiding this comment.
It's just a sort. I think it is written a simple sort as opposed to a complex type.



Work in progress. Please take a look at the added grammars and changed commands. But I also need your input on several things (below) so I don't end up having to do things twice.