Skip to content

Commit c729e9a

Browse files
committed
Review changes #2
1 parent bd90175 commit c729e9a

File tree

6 files changed

+122
-38
lines changed

6 files changed

+122
-38
lines changed

doc/sphinx/addendum/generalized-rewriting.rst

+74-6
Original file line numberDiff line numberDiff line change
@@ -713,13 +713,11 @@ Definitions
713713
~~~~~~~~~~~
714714

715715
The generalized rewriting tactic is based on a set of strategies that can be
716-
combined to obtain custom rewriting procedures. Its set of strategies is based
716+
combined to create custom rewriting procedures. Its set of strategies is based
717717
on the programmable rewriting strategies with generic traversals by Visser et al.
718718
:cite:`Luttik97specificationof` :cite:`Visser98`, which formed the core of
719719
the Stratego transformation language :cite:`Visser01`. Rewriting strategies
720-
are applied using the tactic :n:`rewrite_strat @rewstrategy` where :n:`@rewstrategy` is a
721-
strategy expression. Strategies are defined inductively as described by the
722-
following grammar:
720+
are applied using the tactic :n:`rewrite_strat @rewstrategy`.
723721

724722
.. insertprodn rewstrategy rewstrategy
725723
@@ -732,6 +730,7 @@ following grammar:
732730
| progress @rewstrategy
733731
| try @rewstrategy
734732
| @rewstrategy ; @rewstrategy
733+
| choice @rewstrategy @rewstrategy
735734
| repeat @rewstrategy
736735
| any @rewstrategy
737736
| subterm @rewstrategy
@@ -745,10 +744,79 @@ following grammar:
745744
| eval @red_expr
746745
| fold @term1_extended
747746
| ( @rewstrategy )
748-
| choice @rewstrategy @rewstrategy
749747
| old_hints @ident
750748
751-
Actually a few of these are defined in terms of the others using a
749+
:n:`@term1_extended`
750+
lemma, left to right
751+
752+
:n:`<- @term1_extended`
753+
lemma, right to left
754+
755+
:n:`fail`
756+
failure
757+
758+
:n:`id`
759+
identity
760+
761+
:n:`refl`
762+
reflexivity
763+
764+
:n:`progress rewstrategy`
765+
progress
766+
767+
:n:`try rewstrategy`
768+
try catch
769+
770+
:n:`rewstrategy` ; `@rewstrategy`
771+
composition
772+
773+
:n:`choice @rewstrategy @rewstrategy`
774+
left_biased_choice
775+
776+
:n:`repeat @rewstrategy`
777+
one or more
778+
779+
:n:`any @rewstrategy`
780+
zero or more
781+
782+
:n:`subterm @rewstrategy`
783+
one subterm
784+
785+
:n:`subterms @rewstrategy`
786+
all subterms
787+
788+
:n:`innermost @rewstrategy`
789+
innermost first
790+
791+
:n:`outermost @rewstrategy`
792+
outermost first
793+
794+
:n:`bottomup @rewstrategy`
795+
bottom-up
796+
797+
:n:`topdown @rewstrategy`
798+
top-down
799+
800+
:n:`hints @ident`
801+
apply hints from hint database
802+
803+
:n:`terms {* @term1_extended }`
804+
any of the terms
805+
806+
:n:`eval @red_expr`
807+
apply reduction
808+
809+
:n:`fold @term`
810+
unify
811+
812+
:n:`( @rewstrategy )`
813+
to be documented
814+
815+
:n:`old_hints @ident`
816+
to be documented
817+
818+
819+
A few of these are defined in terms of the others using a
752820
primitive fixpoint operator:
753821

754822
- :n:`try @rewstrategy := choice @rewstrategy id`

doc/sphinx/addendum/implicit-coercions.rst

+8-9
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ typed modulo insertion of appropriate coercions. We allow to write:
2525
Classes
2626
-------
2727

28-
.. insertprodn class class
29-
30-
.. prodn::
31-
class ::= Funclass
32-
| Sortclass
33-
| @smart_global
34-
3528
A class with :math:`n` parameters is any defined name with a type
3629
:n:`forall (@ident__1 : @type__1)..(@ident__n:@type__n), @sort`. Thus a class with
3730
parameters is considered as a single class and not as a family of
@@ -44,7 +37,13 @@ In addition to these user-defined classes, we have two built-in classes:
4437
* ``Funclass``, the class of functions; its objects are all the terms with a functional
4538
type, i.e. of form :g:`forall x:A,B`.
4639

47-
Formally, the syntax of classes is defined here: :n:`@class`.
40+
.. insertprodn class class
41+
42+
.. prodn::
43+
class ::= Funclass
44+
| Sortclass
45+
| @smart_global
46+
4847

4948

5049
Coercions
@@ -188,10 +187,10 @@ Declaring Coercions
188187
This defines :token:`ident` just like :n:`Let @ident := @term {? @type }`,
189188
and then declares :token:`ident` as a coercion between it source and its target.
190189

191-
Assumptions can be declared as coercions.
192190
Use :n:`:>` before the :n:`@type` of the assumption
193191
to declare the assumption as a coercion.
194192
See :ref:`gallina-assumptions`.
193+
195194
..
196195
FIXME:
197196
\comindex{Variable \mbox{\rm (and coercions)}}

doc/sphinx/addendum/ring.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ The syntax for adding a new ring is
360360
preliminary step for :tacn:`ring` and :tacn:`ring_simplify`. It can be used to
361361
transform a goal so that it is better recognized. For instance, ``S n``
362362
can be changed to ``plus 1 n``.
363+
363364
:n:`postprocess [ @ltac_expr ]`
364365
specifies a tactic :n:`@tactic` that is applied as a final
365366
step for :tacn:`ring_simplify`. For instance, it can be used to undo
@@ -368,7 +369,6 @@ The syntax for adding a new ring is
368369
:n:`power @term1_extended [ {+ @qualid } ]`
369370
to be documented
370371

371-
372372
:n:`power_tac @term1_extended @ltac_expr ]`
373373
allows :tacn:`ring` and :tacn:`ring_simplify` to recognize
374374
power expressions with a constant positive integer exponent (example:

doc/sphinx/proof-engine/tactics.rst

+18-4
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,22 @@ Examples:
460460
Occurrence sets and occurrence clauses
461461
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
462462

463-
An occurrence clause (:n:`at @occurrences`) is a modifier to some tactics that obeys the
463+
An occurrence clause (:n:`in @in_clause`) is a modifier to some tactics that obeys the
464464
following syntax:
465465

466-
.. insertprodn occurrences occurrences
466+
.. insertprodn in_clause hypident
467467
468468
.. prodn::
469-
occurrences ::= {+ @int }
470-
| @ident
469+
in_clause ::= @in_clause
470+
| * {? at @occs_nums }
471+
| * |- {? @concl_occ }
472+
| {*, @hypident_occ } |- {? @concl_occ }
473+
| {*, @hypident_occ }
474+
concl_occ ::= * {? at @occs_nums }
475+
hypident_occ ::= @hypident {? at @occs_nums }
476+
hypident ::= @ident
477+
| ( type of @ident )
478+
| ( value of @ident )
471479
472480
The role of an occurrence clause is to select a set of occurrences of a term
473481
in a goal. In the first case, the :n:`@ident {? at {* num}}` parts indicate
@@ -1274,6 +1282,12 @@ Managing the local context
12741282

12751283
.. tacv:: set (@ident := @term) in @occurrences
12761284

1285+
.. insertprodn occurrences occurrences
1286+
1287+
.. prodn::
1288+
occurrences ::= {+ @int }
1289+
| @ident
1290+
12771291
This notation allows specifying which occurrences of :token:`term` have
12781292
to be substituted in the context. The :n:`in @occurrences` clause
12791293
is an occurrence clause whose syntax and behavior are described in

doc/tools/docgram/common.edit_mlg

+4
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,10 @@ record_binder: [
807807
| DELETE name
808808
]
809809

810+
concl_occ: [
811+
| OPTINREF
812+
]
813+
810814
SPLICE: [
811815
| noedit_mode
812816
| command_entry

doc/tools/docgram/orderedGrammar

+17-18
Original file line numberDiff line numberDiff line change
@@ -1648,11 +1648,25 @@ by_arg_tac: [
16481648
in_clause: [
16491649
| in_clause
16501650
| "*" OPT ( "at" occs_nums )
1651-
| "*" "|-" concl_occ
1652-
| LIST0 hypident_occ SEP "," "|-" concl_occ
1651+
| "*" "|-" OPT concl_occ
1652+
| LIST0 hypident_occ SEP "," "|-" OPT concl_occ
16531653
| LIST0 hypident_occ SEP ","
16541654
]
16551655

1656+
concl_occ: [
1657+
| "*" OPT ( "at" occs_nums )
1658+
]
1659+
1660+
hypident_occ: [
1661+
| hypident OPT ( "at" occs_nums )
1662+
]
1663+
1664+
hypident: [
1665+
| ident
1666+
| "(" "type" "of" ident ")"
1667+
| "(" "value" "of" ident ")"
1668+
]
1669+
16561670
as_ipat: [
16571671
| "as" simple_intropattern
16581672
|
@@ -1783,16 +1797,6 @@ bindings_with_parameters: [
17831797
| "(" ident LIST0 simple_binder ":=" term ")"
17841798
]
17851799

1786-
hypident: [
1787-
| ident
1788-
| "(" "type" "of" ident ")"
1789-
| "(" "value" "of" ident ")"
1790-
]
1791-
1792-
hypident_occ: [
1793-
| hypident OPT ( "at" occs_nums )
1794-
]
1795-
17961800
clause_dft_concl: [
17971801
| "in" in_clause
17981802
| OPT ( "at" occs_nums )
@@ -1810,11 +1814,6 @@ opt_clause: [
18101814
|
18111815
]
18121816

1813-
concl_occ: [
1814-
| "*" OPT ( "at" occs_nums )
1815-
|
1816-
]
1817-
18181817
in_hyp_list: [
18191818
| "in" LIST1 ident
18201819
|
@@ -1905,6 +1904,7 @@ rewstrategy: [
19051904
| "progress" rewstrategy
19061905
| "try" rewstrategy
19071906
| rewstrategy ";" rewstrategy
1907+
| "choice" rewstrategy rewstrategy
19081908
| "repeat" rewstrategy
19091909
| "any" rewstrategy
19101910
| "subterm" rewstrategy
@@ -1918,7 +1918,6 @@ rewstrategy: [
19181918
| "eval" red_expr
19191919
| "fold" term1_extended
19201920
| "(" rewstrategy ")"
1921-
| "choice" rewstrategy rewstrategy
19221921
| "old_hints" ident
19231922
]
19241923

0 commit comments

Comments
 (0)