Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Coq Notations #115

Open
Aqissiaq opened this issue Oct 30, 2024 · 2 comments
Open

Support for Coq Notations #115

Aqissiaq opened this issue Oct 30, 2024 · 2 comments

Comments

@Aqissiaq
Copy link

It would be nice if an Ott grammer like

grammar
G {{ tex \Gamma }} :: G_ ::=
  {{ coq gmap nat nat }}
  {{ coq-universe Type }}

Could generate Notation G := (gmap nat nat) instead of Definition G := (gmap nat nat).

The motivating example is std++'s finite maps, where Notation is much more convenient than Definition.

From stdpp Require Import gmap.

(* with Notation, automation works out of the box *)
Notation context := (gmap nat nat).
Fact insert_lookup_ne_context: forall (C:context) i j x y,
    i <> j -> C !! i = Some x -> <[j:=y]> C !! i = Some x.
  by intros; simplify_map_eq.
Qed.

(* with Definition things are much harder *)
Definition context' := gmap nat nat.
Fact insert_lookup_ne_context': forall (C:context') i j x y,
    i <> j -> C !! i = Some x -> <[j:=y]> C !! i = Some x.
Proof.
  intros.
  Fail now simplify_map_eq.
  (* Tactic failure: Cannot solve this goal. *)
  Fail rewrite lookup_insert_ne.
  (* Found no subterm matching "<[?M5058:=?M5060]> ?M5057 !! ?M5059" in the current goal. *)
  now setoid_rewrite lookup_insert_ne.
Qed.
@palmskog
Copy link
Collaborator

palmskog commented Oct 30, 2024

Thanks, one approach might be to have a coq-notation hom:

grammar
G {{ tex \Gamma }} :: G_ ::=
  {{ coq-notation (gmap nat nat) }}

or

grammar
G {{ tex \Gamma }} :: G_ ::=
  {{ coq (gmap nat nat) }}
  {{ coq-notation }}

@eapiova
Copy link

eapiova commented Dec 17, 2024

It would be very nice to have this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants