Controlling typing flags - #9004
Conversation
|
|
||
| let pr_typing_flags flags = | ||
| str "check_guarded: " ++ bool flags.check_guarded | ||
| ++ str "\ncheck_positive: " ++ bool flags.check_positive |
There was a problem hiding this comment.
Use an fnl() instead of \n.
There was a problem hiding this comment.
Additionally, you can encapsulate the code into a box (e.g. a v 0 (...) to ensure that the fnl will align the next check exactly under the first check and not under the beginning of the box which encapsulates the call to pr_typing_flags (even if they probably coincide as the code is currently).
| Import b. | ||
| (* Print Typing Flags. *) | ||
| (* About T. *) | ||
| (* Print Assumptions T. *) |
There was a problem hiding this comment.
Remove the comments or make this an output test.
| let evd = Evd.from_ctx ctx in | ||
| Lemmas.start_proof_with_initialization (local,poly,DefinitionBody Fixpoint) | ||
| evd pl (Some(false,indexes,init_tac)) thms None (Lemmas.mk_hook (fun _ _ -> ())) | ||
| evd pl (Some(false,indexes,init_tac)) thms None (Lemmas.mk_hook (fun _ _ -> Global.set_typing_flags original_typing_flag)) |
There was a problem hiding this comment.
This seems quite fragile. Let's try to come up with a better model for how to do this kind of thing.
There was a problem hiding this comment.
Maybe it should be handled more like how Program Mode is done.
OTOH
Require Import Program.Tactics.
Program Lemma foo : Type.
Proof.
Test Program Mode. (* off *)so that doesn't quite work.
In general attributes which act by setting a global option seem difficult to get right especially with proof-starting commands like Lemma.
Does it even make sense to have these typing flags in the global environment? Maybe we should pass them through the constant_entry/mind_entry/etc.This would mean handling them more like universe polymorphism, with an option which is used only to get the default value of the attribute. start_proof takes a goal_kind, if we put typing flags in there we may be able to make it work in the proof too.
There was a problem hiding this comment.
Do other coq devs have any opinion?
Is it blocking or is it an "improvement request"?
Is goal_kind the right place for typing flags?
There was a problem hiding this comment.
The right place will be in Declare.CInfo.t once #12372 is finished.
53f39ee to
d1068bc
Compare
…ixpoints) and [check_positive] (for (co)inductive types).
d1068bc to
55a987d
Compare
| (see Section :ref:`positivity`). This condition ensures the soundness of | ||
| the inductive definition. | ||
| the inductive definition. The positivity checking can be disable using | ||
| the command :cmd:`Unset Positivity Checking` or the attribute |
There was a problem hiding this comment.
| the command :cmd:`Unset Positivity Checking` or the attribute | |
| the flag :flag:`Positivity Checking` or the attribute |
| the inductive definition. | ||
| the inductive definition. The positivity checking can be disable using | ||
| the command :cmd:`Unset Positivity Checking` or the attribute | ||
| ``assume_positive`` (see :ref:`gallina-attributes`). |
There was a problem hiding this comment.
Would be good to show a small example, which may also help explaining what the use cases are. Actually, since you have put this example in another section, a link to this section would also be fine (use .. seealso::).
| ---------------------------- | ||
|
|
||
| .. cmd:: Set Guard Checking | ||
| .. cmd:: Unset Guard Checking |
There was a problem hiding this comment.
You should instead document this as:
.. flag:: Guard Checking| .. cmd:: Set Guard Checking | ||
| .. cmd:: Unset Guard Checking | ||
|
|
||
| Enable/Disable the guard checking of fixpoints. Warning: this can break the |
There was a problem hiding this comment.
Flag to control...
Use .. warning::
| .. cmd:: Print Typing Flags | ||
|
|
||
| Print the status of the three typing flags: check of guard, check of positivity | ||
| and check of universes. |
There was a problem hiding this comment.
This command is not necessary as it redoes the job of Test Universe Checking, Test Positivity Checking, Test Guard Checking.
Co-Authored-By: Théo Zimmermann <theo.zimmermann@univ-paris-diderot.fr>
|
The part without attributes has been merged. |
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
|
Rest implemented in #12586 |
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes. (cherry picked from commit b531ef3)
This PR allows to locally (with attributes) / globally (with Set/Unset commands) enable and disable:
For this, the
check_guardedtyping flag is split intocheck_guardedandcheck_positive.For the moment the syntax of commands is:
Set Guard Checking,Unset Guard Checking,Set/Unset Positivity Checking,Set/Unset Universes Checking.And for attributes:
check_guarded,assume_guarded,check_positive,assume_positive,check_universes,type_in_type.This PR also adds a
Print Typing Flagscommand which prints the status of those three flags, and improves a bit the output ofPrint Assumptions.E.g.
Kind: feature
Any comment welcome.