I'm experimenting with the Coq field module trying to prove the following simple identity directly from field axioms: forall v, 0v == v
. I saw that both 0
and ==
have existing notations, so I tried this (but failed):
(***********)
(* IMPORTS *)
(***********)
Require Import Coq.setoid_ring.Field_theory.
(*********************)
(* forall v, 0v == v *)
(*********************)
Lemma mul_0_l: forall v,
("0" * v "==" "0")%R_scope.
Proof.
I got this error message:
Unknown scope delimiting key R_scope.
When I looked at the field library, R_scope
is definitely there,
so I must be missing something.
Actually, those notations are in a section, which means that they are not available from the outside.
Furthermore, all these definitions are parameterized by the field structure, so if you want to prove general results about fields you will need to declare (or instantiate) those parameters locally.
I'm not sure it is actually meant to be used that way. My advice is to open an issue on Github to ask the purpose of the setoid_ring plugin.
About notation
Note that the quotes are part of the syntax for the
Notation
/Infix
commandYou can now just write
x + y
, no quotes.It is good practice to assign scopes to your notations (via the
: R_scope
annotation above for example) as that enables mechanisms for disambiguation of different meanings for the same notation. In particular the main two ways to make notations available are:Local Open Scope R_scope.
make allR_scope
notations available for the current file.Bind Scope R_scope with whatever.
associates a delimiting keywhatever
to the scopeR_scope
. The delimiting key is what goes after the%
symbol to open a scope in a given expression, so you could write(0 == 0 * v)%whatever
, whether or notR_scope
was previously opened usingLocal Open Scope
.Here is an (unsuccessful) attempt based on @Li-yao-Xia:
In the assumptions I have:
And the goal says:
I figured there must be something that says:
field_theory -> almost_ring_theory
. But when I tried toapply Rfield
I got: