Update syntax in auto.rst chapter#13343
Conversation
70ef971 to
ddcbc27
Compare
|
Updated. |
|
I'm wondering what to do about |
|
It belongs here IMHO. If we could keep the nonterminal names as close to what is currently presented as possible, this would be nice BTW ( |
| :n:`with *` | ||
| Use the unfolding hints in all existing hint databases. | ||
|
|
||
| Uses the unfold hints declared in all the hint databases. | ||
| :n:`with {+ @ident }` | ||
| Use the unfolding hints in :n:`{+ @ident }` in addition to the database ``core``. | ||
| Use the fake database `nocore` to omit `core`. |
There was a problem hiding this comment.
This is basically the same explanation as the previous one of hintbases, so I don't think it is actually worth repeating.
There was a problem hiding this comment.
Yeah, we should hyperlink to a common description for commonly used bits of grammar rather than repeating the same text over and over. That may be easier to do as a cleanup once the syntax has been updated everywhere.
| Unfolds constants that were declared through a :cmd:`Hint Unfold` | ||
| in the given databases. | ||
|
|
||
| .. tacn:: autorewrite {? * } with {+ @ident } {? @clause_dft_concl } {? using @ltac_expr } |
There was a problem hiding this comment.
@mattam82 (or @JasonGross): can you tell us what this optional * does?
There was a problem hiding this comment.
Can you guess from this? The * passes a ~conds:AllMatches to the lower level code. Naive is the default for ~conds.
The options are defined as:
type conditions =
| Naive (* Only try the first occurrence of the lemma (default) *)
| FirstSolved (* Use the first match whose side-conditions are solved *)
| AllMatches (* Rewrite all matches whose side-conditions are solved *)
There was a problem hiding this comment.
From this, I would conclude approximately that * means autorewrite will rewrite in all occurrences that match a single rewrite lemma instead of rewriting in only one place at once, and that it may do more progress in some cases because of this.
There was a problem hiding this comment.
This seems to be a bit of a mess. Only some parts of the occurrences clause are accepted. I guess the * is a workaround for not supporting the at 1 form. Would you mind turning my last example into something that works and verifying that the occurrence numbers are applied in H?
autorewrite * with True at 1.
(* The "at" syntax isn't available yet for the autorewrite tactic. *)
autorewrite * with True in |- * at 1.
(* The "at" syntax isn't available yet for the autorewrite tactic. *)
autorewrite * with True in H at 1.
(* Rewriting base True does not exist. *)
There was a problem hiding this comment.
Also #1933 (comment) where @mattam82 seems to have given an explanation (in French)
There was a problem hiding this comment.
@JasonGross Thanks for your help. @mattam82's French comment about rewrite* and autorewrite* aligns well with the piece of code found by Jim but the issue opened by Samuel seems to indicate that autorewrite* does not actually work. We need @mattam82 to comment, so I'll ping him by e-mail.
In any case, the current documentation of * added in this PR is probably a bit too simple ("If present, rewrite all occurrences.")
Zimmi48
left a comment
There was a problem hiding this comment.
Here's the rest of my review.
|
@jfehrle My suggestion to introduce a new syntax |
|
|
I think this should be changed in the mlgs to |
|
Updated. This took forever to update. Be sure to look at the changes in |
|
Updated. |
Zimmi48
left a comment
There was a problem hiding this comment.
Great improvement to the occurrence clauses section.
|
Updated. |
|
Great improvements to |
|
Updated. Are we getting close to done? |
Zimmi48
left a comment
There was a problem hiding this comment.
Only a non-important suggestion but could we introduce more symmetry in the way and the order that the variants and the flags associated to auto, trivial and eauto are presented?
| .. tacv:: autounfold with {+ @ident} in @goal_occurrences | ||
| Like :tacn:`eauto`, but does a breadth-first search (i.e. the tactic | ||
| checks all the relevant hints to see if one solves the goal before | ||
| recurring). |
There was a problem hiding this comment.
breadth-first search is more than this (it explores all "paths of length 2" before going to "paths of length 3"). Anyway, what about linking to Wikipedia instead of attempting to explain this?
There was a problem hiding this comment.
Got it. I had some doubt that this was doing a full bfs. AFAIK, the kernel, monad infrastructure, Ltac, etc. are all designed around dfs and backtracking. For efficiency, you'd want to save the resulting proof state for each successful hint at each level rather than repeating application of the hint (easy to code). I'll have to look at that code sometime.
One thing I'd like to experiment with at some point is guiding the search in part by metrics on the proof such as the length of the goal conclusion(s), keeping only the best N results at any point. That may solve some goals more efficiently and/or make useful progress for the user.
There was a problem hiding this comment.
BTW, there are several implementations of proof search and the plan was to get rid of the legacy auto and eauto backend in favor of the most recently written typeclasses eauto which also has a bfs strategy BTW (while keeping the tactics of course). See #721.
There was a problem hiding this comment.
Ah, you worked on that! We'll have to chat about it sometime.
Zimmi48
left a comment
There was a problem hiding this comment.
I think we are very close to done.
| | REPLACE "Proof" "using" section_var_expr "with" Pltac.tactic | ||
| | WITH "Proof" "using" section_subset_expr OPT [ "with" ltac_expr5 ] | ||
| | DELETE "Proof" "using" section_var_expr |
There was a problem hiding this comment.
Instead of making this change in common.edit_mlg, I suggest following more closely the implementation for once. I.e. only document Proof using (without mentioning the with clause) in the proof mode chapter, and put the two forms with the with clause in the auto.rst file.
There was a problem hiding this comment.
Note that doc_grammar complains if the same command is shown in more than one :cmd:. I'll use :cmdv: but then doc_grammar won't check or update it. And I'll add a reference from Print using to Print with.
A bit of a weird case. We should start using the pattern LIST0 [ opt1 | opt2 | ... | optn ] in the grammar where needed to accept multiple options in any order.
|
Updated. |
| | {? @ident } %{ {*; @record_field } {? ; } %} | ||
| constructor ::= @ident {* @binder } {? @of_type } | ||
| cumul_ident_decl ::= @ident {? @cumul_univ_decl } | ||
| cumul_univ_decl ::= @%{ {* {? {| = | + | * } } @ident } {? + } {| %| {*, @univ_constraint } {? + } %} | {| %} | %|%} } } |
There was a problem hiding this comment.
I think it's best to leave cumul_univ_decl where it has been put in #12653, i.e. next to univ_decl.
There was a problem hiding this comment.
As you wish. That list of productions in the universe chapter is a bit of an anomaly, throwing together several nonterminals that don't all refer to each other.
There was a problem hiding this comment.
We should improve this, of course, but there is no point in putting productions very far from the place they are currently documented.
|
Rebased and updated. |
Zimmi48
left a comment
There was a problem hiding this comment.
Looks good to me. Can you squash at the same time as you address my last comments?
| Undocumented :n:`eauto @nat_or_var @nat_or_var` syntax in favor of new ``bfs eauto``. | ||
| Also deprecated 2-integer syntax for ``debug eauto`` and ``info_eauto``. | ||
| (Use ``bfs eauto`` with the :flag:`Info Eauto` or :flag:`Debug Eauto` flags instead.) |
There was a problem hiding this comment.
You could put a few :tacn: in this changelog entry (not an important suggestion).
| | @qualid | ||
| univ_decl ::= @%{ {* @ident } {? + } {? %| {*, @univ_constraint } {? + } } %} | ||
| cumul_univ_decl ::= @%{ {* {? {| = | + | * } } @ident } {? + } {? %| {*, @univ_constraint } {? + } } %} | ||
| cumul_univ_decl ::= @%{ {* {? {| = | + | * } } @ident } {? + } {| %| {*, @univ_constraint } {? + } %} | {| %} | %|%} } } |
There was a problem hiding this comment.
The presentation of this production should not change. This is an implementation detail that we need to take care of the special case where you put no space between the | and the final } (case of an empty list of universe constraints).
|
Updated and squashed. Thanks for the review! |
|
@coqbot merge now |

Convert and refine the chapter.
Fixes #5201