Skip to content

Commit

Permalink
Merge pull request #665 from proux01/coq_19216
Browse files Browse the repository at this point in the history
Adapt to coq/coq#19216
  • Loading branch information
gares authored Jul 15, 2024
2 parents c13ecc9 + e32901f commit 48c3020
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# unreleased

### API
- New `coq.arguments.reset-simplification`

# [2.2.2] - 15/07/2024

Requires Elpi 1.19.2 and Coq 8.19 or Coq 8.20.
Expand Down
40 changes: 38 additions & 2 deletions src/coq_elpi_builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,40 @@ let coq_header_builtins =
|};
]

[%%if coq = "8.19" || coq = "8.20" ]
let compat_reduction_behavior_set ~local gref strategy =
Reductionops.ReductionBehaviour.set ~local gref strategy
[%%else]
let compat_reduction_behavior_set ~local gref strategy =
Reductionops.ReductionBehaviour.set ~local gref (Some strategy)
[%%endif]

[%%if coq = "8.19" || coq = "8.20" ]
let compat_reset_simplification = []
[%%else]
let compat_reset_simplification =
let open API.BuiltIn in
let open Pred in
let open Notation in
let open CConv in
let pp ~depth = P.term depth in
[MLCode(Pred("coq.arguments.reset-simplification",
In(gref,"GR",
Full(global,
{|resets the behavior of the simplification tactics.
Also resets the ! and / modifiers for the Arguments command.
Supported attributes:
- @global! (default: false)|})),
(fun gref ~depth { options } _ -> grab_global_env "coq.arguments.reset-simplification" (fun state ->
match gref with
| ConstRef gref ->
let local = options.local <> Some false in
Reductionops.ReductionBehaviour.set ~local gref None;
state, (), []
| _ -> err Pp.(str "reset-simplification must be called on constant")))),
DocAbove)]
[%%endif]

let coq_misc_builtins =
let open API.BuiltIn in
let open Pred in
Expand Down Expand Up @@ -3083,10 +3117,12 @@ Supported attributes:
match gref with
| ConstRef gref ->
let local = options.local <> Some false in
Reductionops.ReductionBehaviour.set ~local gref strategy;
compat_reduction_behavior_set ~local gref strategy;
state, (), []
| _ -> err Pp.(str "set-simplification must be called on constant")))),
DocAbove);
DocAbove)
] @ compat_reset_simplification @ [
MLCode(Pred("coq.locate-abbreviation",
In(id, "Name",
Expand Down

0 comments on commit 48c3020

Please sign in to comment.