Skip to content

Commit 75a2695

Browse files
committed
Review #2
1 parent d7acdce commit 75a2695

19 files changed

Lines changed: 183 additions & 187 deletions

doc/sphinx/addendum/extraction.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ Setting the target language
106106
107107
.. prodn::
108108
language ::= OCaml
109-
| Ocaml
110109
| Haskell
111110
| Scheme
112111
| JSON
@@ -232,7 +231,7 @@ principles of extraction (logical parts and types).
232231
Here :token:`qualid` can be
233232
any function or inductive constructor, and the :token:`ident`\s are
234233
the names of the useless arguments. Arguments can can also be
235-
identified positionally by :token:`int`\s starting from 1.
234+
identified positionally by :token:`integer`\s starting from 1.
236235

237236
When an actual extraction takes place, an error is normally raised if the
238237
:cmd:`Extraction Implicit` declarations cannot be honored, that is

doc/sphinx/addendum/generalized-rewriting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ pass additional arguments such as ``using relation``.
534534
.. tacn:: setoid_reflexivity
535535
setoid_symmetry {? in @ident }
536536
setoid_transitivity @one_term
537-
setoid_rewrite {? {| -> | <- } } @constr_with_bindings {? at @occurrences } {? in @ident }
538-
setoid_rewrite {? {| -> | <- } } @constr_with_bindings in @ident at @occurrences
537+
setoid_rewrite {? {| -> | <- } } @one_term {? with @bindings } {? at @occurrences } {? in @ident }
538+
setoid_rewrite {? {| -> | <- } } @one_term {? with @bindings } in @ident at @occurrences
539539
setoid_replace @one_term with @one_term {? using relation @one_term } {? in @ident } {? at {+ @int_or_var } } {? by @ltac_expr3 }
540540
:name: setoid_reflexivity; setoid_symmetry; setoid_transitivity; setoid_rewrite; _; setoid_replace
541541

doc/sphinx/addendum/implicit-coercions.rst

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -126,43 +126,43 @@ Declaring Coercions
126126
-------------------------
127127

128128
.. cmd:: Coercion @reference : @class >-> @class
129-
Coercion @qualid {? @univ_decl } @def_body
129+
Coercion @ident {? @univ_decl } @def_body
130130

131131
:name: Coercion; _
132132

133133
The first form declares the construction denoted by :token:`reference` as a coercion between
134134
the two given classes. The second form defines :token:`ident`
135-
just like :n:`Definition @ident := term {? @type }`
135+
just like :cmd:`Definition` :n:`@ident {? @univ_decl } @def_body`
136136
and then declares :token:`ident` as a coercion between it source and its target.
137137
Both forms support the :attr:`local` attribute, which makes the coercion local to the current section.
138138

139-
.. exn:: @qualid not declared.
139+
.. exn:: @ident not declared.
140140
:undocumented:
141141

142-
.. exn:: @qualid is already a coercion.
142+
.. exn:: @ident is already a coercion.
143143
:undocumented:
144144

145145
.. exn:: Funclass cannot be a source class.
146146
:undocumented:
147147

148-
.. exn:: @qualid is not a function.
148+
.. exn:: @ident is not a function.
149149
:undocumented:
150150

151-
.. exn:: Cannot find the source class of @qualid.
151+
.. exn:: Cannot find the source class of @ident.
152152
:undocumented:
153153

154-
.. exn:: Cannot recognize @class as a source class of @qualid.
154+
.. exn:: Cannot recognize @class as a source class of @ident.
155155
:undocumented:
156156

157-
.. warn:: @qualid does not respect the uniform inheritance condition.
157+
.. warn:: @ident does not respect the uniform inheritance condition.
158158
:undocumented:
159159

160160
.. exn:: Found target class ... instead of ...
161161
:undocumented:
162162

163163
.. warn:: New coercion path ... is ambiguous with existing ...
164164

165-
When the coercion :token:`qualid` is added to the inheritance graph, new
165+
When the coercion :token:`ident` is added to the inheritance graph, new
166166
coercion paths which have the same classes as existing ones are ignored.
167167
The :cmd:`Coercion` command tries to check the convertibility of new ones and
168168
existing ones. The paths for which this check fails are displayed by a warning
@@ -255,26 +255,9 @@ Classes as Records
255255

256256
.. index:: :> (coercion)
257257

258-
We allow the definition of *Structures with Inheritance* (or classes as records)
259-
by extending the existing :cmd:`Record` macro. Its new syntax is:
260-
261-
.. todo PR Not sure how to merge this into the main definition...
262-
263-
.. cmdv:: {| Record | Structure } {? >} @ident {* @binder } : @sort := {? @ident} { {+; @ident :{? >} @term } }
264-
265-
The first identifier :token:`ident` is the name of the defined record and
266-
:token:`sort` is its type. The optional identifier after ``:=`` is the name
267-
of the constructor (it will be :n:`Build_@ident` if not given).
268-
The other identifiers are the names of the fields, and :token:`term`
269-
are their respective types. If ``:>`` is used instead of ``:`` in
270-
the declaration of a field, then the name of this field is automatically
271-
declared as a coercion from the record name to the class of this
272-
field type. Note that the fields always verify the uniform
273-
inheritance condition. If the optional ``>`` is given before the
274-
record name, then the constructor name is automatically declared as
275-
a coercion from the class of the last field type to the record name
276-
(this may fail if the uniform inheritance condition is not
277-
satisfied).
258+
*Structures with Inheritance* may be defined using the :cmd:`Record` command. Use `:>`
259+
in the field type to declare the field as a coercion from the record name to the class
260+
of the field type. See :token:`of_type`.
278261

279262
Coercions and Sections
280263
----------------------

doc/sphinx/addendum/micromega.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ proof by abstracting monomials by variables.
250250
`psatz`: a proof procedure for non-linear arithmetic
251251
----------------------------------------------------
252252

253-
.. tacn:: psatz @term {? @int_or_var }
253+
.. tacn:: psatz @one_term {? @int_or_var }
254254
:name: psatz
255255

256256
This tactic explores the *Cone* by increasing degrees – hence the

doc/sphinx/addendum/nsatz.rst

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ Nsatz: tactics for proving equalities in integral domains
55

66
:Author: Loïc Pottier
77

8-
.. tacn:: nsatz {? with radicalmax := @term strategy := @term parameters := @term variables := @term }
9-
:name: nsatz
8+
9+
To use the tactics described in this secion, load the ``Nsatz`` module with the
10+
command ``Require Import Nsatz``. Alternatively, if you prefer not to transitively depend on the
11+
files that declare the axioms used to define the real numbers, you can
12+
``Require Import NsatzTactic`` instead; this will still allow
13+
:tacn:`nsatz` to solve goals defined about :math:`\mathbb{Z}`,
14+
:math:`\mathbb{Q}` and any user-registered rings.
15+
16+
17+
.. tacn:: nsatz {? with radicalmax := @one_term strategy := @one_term parameters := @one_term variables := @one_term }
1018

1119
This tactic is for solving goals of the form
1220

@@ -34,42 +42,35 @@ Nsatz: tactics for proving equalities in integral domains
3442

3543
`radicalmax`
3644
bound when searching for r such that
37-
:math:`c (P−Q) r = \sum_{i=1..s} S_i (P i − Q i)`
45+
:math:`c (P−Q) r = \sum_{i=1..s} S_i (P i − Q i)`.
46+
This argument must be of type `N` (binary natural numbers).
3847

3948
`strategy`
4049
gives the order on variables :math:`X_1,\ldots,X_n` and the strategy
4150
used in Buchberger algorithm (see :cite:`sugar` for details):
4251

43-
* strategy = 0: reverse lexicographic order and newest s-polynomial.
44-
* strategy = 1: reverse lexicographic order and sugar strategy.
45-
* strategy = 2: pure lexicographic order and newest s-polynomial.
46-
* strategy = 3: pure lexicographic order and sugar strategy.
52+
* `strategy := 0%Z`: reverse lexicographic order and newest s-polynomial.
53+
* `strategy := 1%Z`: reverse lexicographic order and sugar strategy.
54+
* `strategy := 2%Z`: pure lexicographic order and newest s-polynomial.
55+
* `strategy := 3%Z`: pure lexicographic order and sugar strategy.
4756

4857
`parameters`
49-
list of variables :math:`X_{i_1},\ldots,X_{i_k}` among
58+
a list of lists, each of type `@list R`, containing the variables :math:`X_{i_1},\ldots,X_{i_k}` among
5059
:math:`X_1,\ldots,X_n` which are considered as parameters: computation will be performed with
5160
rational fractions in these variables, i.e. polynomials are considered
5261
with coefficients in :math:`R(X_{i_1},\ldots,X_{i_k})`. In this case, the coefficient
5362
:math:`c` can be a non constant polynomial in :math:`X_{i_1},\ldots,X_{i_k}`, and the tactic
5463
produces a goal which states that :math:`c` is not zero.
5564

5665
`variables`
57-
list of the variables in the decreasing order in
58-
which they will be used in the Buchberger algorithm. If `variables` = :g:`(@nil R)`,
66+
a list of lists, each of type `@list R`, containing the variables in the decreasing order in
67+
which they will be used in the Buchberger algorithm. If `variables` = :g:`(@[] R)`,
5968
then `lvar` is replaced by all the variables which are not in
6069
`parameters`.
6170

6271
See the file `Nsatz.v <https://github.com/coq/coq/blob/master/test-suite/success/Nsatz.v>`_
6372
for many examples, especially in geometry.
6473

65-
You can load the ``Nsatz`` module with the command ``Require Import Nsatz``.
66-
67-
Alternatively, if you prefer not to transitively depend on the
68-
files declaring the axioms used to define the real numbers, you can
69-
``Require Import NsatzTactic`` instead; this will still allow
70-
:tacn:`nsatz` to solve goals defined about :math:`\mathbb{Z}`,
71-
:math:`\mathbb{Q}` and any user-registered rings.
72-
7374
More about `nsatz`
7475
---------------------
7576

doc/sphinx/addendum/program.rst

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ obligations which need to be resolved to create the final term.
3333
.. _elaborating-programs:
3434

3535
Elaborating programs
36-
---------------------
36+
--------------------
3737

3838
The main difference from |Coq| is that an object in a type :g:`T : Set` can
3939
be considered as an object of type :g:`{x : T | P}` for any well-formed
@@ -113,7 +113,7 @@ coercions.
113113
.. _syntactic_control:
114114

115115
Syntactic control over equalities
116-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117117

118118
To give more control over the generation of equalities, the
119119
type checker will fall back directly to |Coq|’s usual typing of dependent
@@ -158,12 +158,8 @@ prove some goals to construct the final definitions.
158158
Program Definition
159159
~~~~~~~~~~~~~~~~~~
160160

161-
.. todo PR need to understand this better. Is there a reason this only has
162-
a subset of the Definition syntax? Maybe need to ask Matthieu
163-
164-
.. cmd:: Program Definition @ident := @term
165-
166-
A variant of :cmd:`Definition`. Types the value term in Russell and generates proof
161+
A :cmd:`Definition` command with the :attr:`program` attribute types
162+
the value term in Russell and generates proof
167163
obligations. Once solved using the commands shown below, it binds the
168164
final |Coq| term to the name :n:`@ident` in the environment.
169165

@@ -199,20 +195,8 @@ Program Definition
199195
Program Fixpoint
200196
~~~~~~~~~~~~~~~~
201197

202-
.. cmd:: Program Fixpoint @fix_definition {* with @fix_definition }
203-
204-
The optional :n:`@fixannot` annotation can be one of:
205-
206-
+ :g:`measure f R` where :g:`f` is a value of type :g:`X` computed on
207-
any subset of the arguments and the optional term
208-
:g:`R` is a relation on :g:`X`. :g:`X` defaults to :g:`nat` and :g:`R`
209-
to :g:`lt`.
210-
211-
+ :g:`wf R x` which is equivalent to :g:`measure x R`.
212-
213-
The structural fixpoint operator behaves just like the one of |Coq| (see
214-
:cmd:`Fixpoint`), except it may also generate obligations. It works
215-
with mutually recursive definitions too.
198+
A :cmd:`Fixpoint` command with the :attr:`program` attribute may also generate obligations. It works
199+
with mutually recursive definitions too. For example:
216200

217201
.. coqtop:: reset in
218202

@@ -249,8 +233,6 @@ using the syntax:
249233
| _ => O
250234
end.
251235

252-
253-
254236
.. caution:: When defining structurally recursive functions, the generated
255237
obligations should have the prototype of the currently defined
256238
functional in their context. In this case, the obligations should be
@@ -269,21 +251,20 @@ using the syntax:
269251
Program Lemma
270252
~~~~~~~~~~~~~
271253

272-
.. cmd:: Program Lemma @ident : @type
273-
274-
A variant of :cmd:`Lemma`. The Russell language can also be used to type statements of logical
275-
properties. It will generate obligations, try to solve them
276-
automatically and fail if some unsolved obligations remain. In this
277-
case, one can first define the lemma’s statement using :cmd:`Program
278-
Definition` and use it as the goal afterwards. Otherwise the proof
254+
A :cmd:`Lemma` command with the :attr:`program` attribute uses the Russell
255+
language to type statements of logical
256+
properties. It generates obligations, tries to solve them
257+
automatically and fails if some unsolved obligations remain. In this
258+
case, one can first define the lemma’s statement using :cmd:`Definition`
259+
and use it as the goal afterwards. Otherwise the proof
279260
will be started with the elaborated version as a goal. The
280261
:g:`Program` attribute can similarly be used as a prefix for
281262
:cmd:`Variable`, :cmd:`Hypothesis`, :cmd:`Axiom` etc.
282263

283264
.. _solving_obligations:
284265

285266
Solving obligations
286-
--------------------
267+
-------------------
287268

288269
The following commands are available to manipulate obligations. The
289270
optional identifier is used when multiple functions have unsolved
@@ -295,7 +276,7 @@ optional tactic is replaced by the default one if not specified.
295276

296277
Sets the default obligation solving tactic applied to all obligations
297278
automatically, whether to solve them or when starting to prove one,
298-
e.g. using :g:`Next`.
279+
e.g. using :cmd:`Next Obligation`.
299280

300281
This command supports the :attr:`local` and :attr:`global` attributes.
301282
:attr:`local` makes the setting last only for the current
@@ -310,7 +291,7 @@ optional tactic is replaced by the default one if not specified.
310291

311292
Displays all remaining obligations.
312293

313-
.. cmd:: Obligation @natural {? of @ident } {? : @term {? with @ltac_expr } }
294+
.. cmd:: Obligation @natural {? of @ident } {? : @type {? with @ltac_expr } }
314295

315296
Start the proof of obligation :token:`natural`.
316297

0 commit comments

Comments
 (0)