1

This answer provides a simple useful trick: unfold ">=" is the same as unfold ge but does not require you to know that >= is the notation for ge.

Can you do the same for notations within a scope?

Require Import NArith.
Goal forall x, (x >= x)%N.
unfold ">=".

Here unfold ">=" does not do anything because it tries to unfold ge, not N.ge.

I have found the following solution:

Open Scope N.
unfold ">=".

But is there a syntax allowing to unfold this notation without first opening the scope?

Community
  • 1
  • 1
Zimm i48
  • 2,901
  • 17
  • 26

1 Answers1

1

Yes, you can use the template unfold string % scope as follows:

Require Import NArith.
Goal forall x, (x >= x)%N.
  unfold ">=" % N.

This gives us the goal forall x : N, (x ?= x)%N <> Lt with unfolded >=.

Anton Trunov
  • 15,074
  • 2
  • 23
  • 43
  • `(term) % scope` is the standard syntax for local opening of an interpretation scope. It so happens that Coq accepts it in this case too. It's actually not `scope`, but `key`, I'm being sloppy here. – Anton Trunov Sep 15 '16 at 15:39