Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to temporarily disable notations in Coq

Tags:

coq

Notations are convenient when you're familiar with a project but can be confusing when you're just starting with a code base. I know you can turn off all notations with the vernacular Set Printing All. However, I want to keep some printing off, such as implicit arguments. Printing all as follows:

Require Import Utf8_core. 
Set Printing All.
Theorem contradiction_implies_anything : forall P Q : Prop,
  (P /\ ~P) -> Q.
Proof.

gives the following proof state:

1 subgoal (ID 120)

  ============================
  forall (P Q : Prop) (_ : and P (not P)), Q

Which is almost there, but I would like the _ to be removed and the forall to be and just unfold my notations.

I tried Set Printing Notations as indicated in the Coq Reference Manual but that didn't do anything, nor did enabling

Set Printing Implicit.
Set Printing Coercions.
Set Printing Synth.
Set Printing Projections.
like image 348
sdpoll Avatar asked Dec 20 '19 02:12

sdpoll


People also ask

What are reserved notations in Coq?

These are the notations whose level and associativity is imposed by Coq Reserved Notation "x <-> y" (at level 95, no associativity). Reserved Notation "x /\ y" (at level 80, right associativity). Reserved Notation "x \/ y" (at level 85, right associativity).

How do you deal with ambiguity in Coq?

To deal with the ambiguity of notations, Coq uses precedence levels ranging from 0 to 100 (plus one extra level numbered 200) and associativity rules. Consider for example the new notation Notation "A \/ B" := (or A B). Clearly, an expression such as forall A:Prop, True /\ A \/ A \/ False is ambiguous.

What is tactic notation in Coq?

It is sometimes expected that the same symbolic notation has different meanings in different contexts; to achieve this form of overloading, Coq offers a notion of notation scopes . The main command to provide custom notations for tactics is Tactic Notation.

How do I parse Unicode characters in Coq notation?

In Unicode, one can use combining characters like ⃗that combine with a regular character and puts the arrow on top. Since Coq notations ignore whitespace, it is possible to define the following notation: Notation "x ⃗" := x (x global). This then allows you to parse notations like x⃗ y⃗and z⃗as Coq variables x yand z.


1 Answers

The funny thing about Printing Notations is that you actually have to Unset it.

Unset Printing Notations.

Here's where the manual hints at it:

Printing Notations:
Controls whether to use notations for printing terms wherever possible. Default is on.

like image 136
Li-yao Xia Avatar answered Oct 20 '22 20:10

Li-yao Xia