diff options
| author | Emilio Jesus Gallego Arias | 2020-07-02 18:17:24 +0200 |
|---|---|---|
| committer | Emilio Jesus Gallego Arias | 2020-11-26 21:21:54 +0100 |
| commit | 14150241cfd016c7f64974cc5c58bb116689f3c1 (patch) | |
| tree | ebb9358b5b82cf62a5649f77cc8d7d68e27a4a48 /doc | |
| parent | 5a9e90e426ba2e25cbcb76af2bb67717984e2b6b (diff) | |
[vernac] Allow to control typing flags with attributes.
The syntax is the one of boolean attributes, that is to say
`#[typing($flag={yes,no}]` where `$flag` is one of `guarded`,
`universes`, `positive`.
We had to instrument the pretyper in a few places, it is interesting
that it is doing so many checks.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/changelog/12-misc/12586-declare+typing_flags.rst | 5 | ||||
| -rw-r--r-- | doc/sphinx/language/core/inductive.rst | 26 | ||||
| -rw-r--r-- | doc/sphinx/proof-engine/vernacular-commands.rst | 15 |
3 files changed, 29 insertions, 17 deletions
diff --git a/doc/changelog/12-misc/12586-declare+typing_flags.rst b/doc/changelog/12-misc/12586-declare+typing_flags.rst index 001cd600b0..bd4e6f401d 100644 --- a/doc/changelog/12-misc/12586-declare+typing_flags.rst +++ b/doc/changelog/12-misc/12586-declare+typing_flags.rst @@ -1,5 +1,6 @@ - **Added:** - Typing flags can now be specified per-constant, this does allow - to fine-grain specify them from plugins or attributes. + Typing flags can now be specified per-constant / inductive, this + allows to fine-grain specify them from plugins or attributes. See + the reference manual for details on attribute syntax. (`#12586 <https://github.com/coq/coq/pull/12586>`_, by Emilio Jesus Gallego Arias). diff --git a/doc/sphinx/language/core/inductive.rst b/doc/sphinx/language/core/inductive.rst index 9fda2ab1fa..f277997094 100644 --- a/doc/sphinx/language/core/inductive.rst +++ b/doc/sphinx/language/core/inductive.rst @@ -31,8 +31,8 @@ Inductive types proposition). This command supports the :attr:`universes(polymorphic)`, - :attr:`universes(template)`, :attr:`universes(cumulative)`, and - :attr:`private(matching)` attributes. + :attr:`universes(template)`, :attr:`universes(cumulative)`, + :attr:`typing(positive)`, and :attr:`private(matching)` attributes. Mutually inductive types can be defined by including multiple :n:`@inductive_definition`\s. The :n:`@ident`\s are simultaneously added to the environment before the types of constructors are checked. @@ -49,10 +49,12 @@ Inductive types .. exn:: Non strictly positive occurrence of @ident in @type. - The types of the constructors have to satisfy a *positivity condition* - (see Section :ref:`positivity`). This condition ensures the soundness of - the inductive definition. The positivity checking can be disabled using - the :flag:`Positivity Checking` flag (see :ref:`controlling-typing-flags`). + The types of the constructors have to satisfy a *positivity + condition* (see Section :ref:`positivity`). This condition + ensures the soundness of the inductive definition. The + positivity checking can be disabled using the :flag:`Positivity + Checking` flag or the :attr:`typing(positive)` attribute (see + :ref:`controlling-typing-flags`). .. exn:: The conclusion of @type is not valid; it must be built from @ident. @@ -848,9 +850,7 @@ between universes for inductive types in the Type hierarchy. .. coqtop:: none - Unset Positivity Checking. - Inductive I : Prop := not_I_I (not_I : I -> False) : I. - Set Positivity Checking. + #[typing(positive=no)] Inductive I : Prop := not_I_I (not_I : I -> False) : I. .. coqtop:: all @@ -884,9 +884,7 @@ between universes for inductive types in the Type hierarchy. .. coqtop:: none - Unset Positivity Checking. - Inductive Lam := lam (_ : Lam -> Lam). - Set Positivity Checking. + #[typing(positive=no)] Inductive Lam := lam (_ : Lam -> Lam). .. coqtop:: all @@ -915,9 +913,7 @@ between universes for inductive types in the Type hierarchy. .. coqtop:: none - Unset Positivity Checking. - Inductive A: Type := introA: ((A -> Prop) -> Prop) -> A. - Set Positivity Checking. + #[typing(positive=no)] Inductive A: Type := introA: ((A -> Prop) -> Prop) -> A. .. coqtop:: all diff --git a/doc/sphinx/proof-engine/vernacular-commands.rst b/doc/sphinx/proof-engine/vernacular-commands.rst index e7db9cfaca..b8160b7966 100644 --- a/doc/sphinx/proof-engine/vernacular-commands.rst +++ b/doc/sphinx/proof-engine/vernacular-commands.rst @@ -1152,6 +1152,11 @@ Controlling Typing Flags anymore but it still affects the reduction of the term. Unchecked fixpoints are printed by :cmd:`Print Assumptions`. +.. attr:: typing(guarded) + + Similar to :flag:`Guard Checking`, but on a per-declaration + basis. Takes ``yes/no`` as parameters, i.e. ``typing(guarded=no)``. + .. flag:: Positivity Checking This flag can be used to enable/disable the positivity checking of inductive @@ -1159,6 +1164,11 @@ Controlling Typing Flags break the consistency of the system, use at your own risk. Unchecked (co)inductive types are printed by :cmd:`Print Assumptions`. +.. attr:: typing(positive) + + Similar to :flag:`Positivity Checking`, but on a per-declaration basis. + Takes ``yes/no`` as parameters, i.e. ``typing(positive=no)``. + .. flag:: Universe Checking This flag can be used to enable/disable the checking of universes, providing a @@ -1167,6 +1177,11 @@ Controlling Typing Flags :cmd:`Print Assumptions`. It has the same effect as `-type-in-type` command line argument (see :ref:`command-line-options`). +.. attr:: typing(universes) + + Similar to :flag:`Universe Checking`, but on a per-declaration basis. + Takes ``yes/no`` as parameters, i.e. ``typing(universes=no)``. + .. cmd:: Print Typing Flags Print the status of the three typing flags: guard checking, positivity checking |
