Skip to content

Commit e32901f

Browse files
committed
Adapt to coq/coq#19216
1 parent c13ecc9 commit e32901f

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

Changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# unreleased
2+
3+
### API
4+
- New `coq.arguments.reset-simplification`
5+
16
# [2.2.2] - 15/07/2024
27

38
Requires Elpi 1.19.2 and Coq 8.19 or Coq 8.20.

src/coq_elpi_builtins.ml

+38-2
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,40 @@ let coq_header_builtins =
13311331
|};
13321332
]
13331333

1334+
[%%if coq = "8.19" || coq = "8.20" ]
1335+
let compat_reduction_behavior_set ~local gref strategy =
1336+
Reductionops.ReductionBehaviour.set ~local gref strategy
1337+
[%%else]
1338+
let compat_reduction_behavior_set ~local gref strategy =
1339+
Reductionops.ReductionBehaviour.set ~local gref (Some strategy)
1340+
[%%endif]
1341+
1342+
[%%if coq = "8.19" || coq = "8.20" ]
1343+
let compat_reset_simplification = []
1344+
[%%else]
1345+
let compat_reset_simplification =
1346+
let open API.BuiltIn in
1347+
let open Pred in
1348+
let open Notation in
1349+
let open CConv in
1350+
let pp ~depth = P.term depth in
1351+
[MLCode(Pred("coq.arguments.reset-simplification",
1352+
In(gref,"GR",
1353+
Full(global,
1354+
{|resets the behavior of the simplification tactics.
1355+
Also resets the ! and / modifiers for the Arguments command.
1356+
Supported attributes:
1357+
- @global! (default: false)|})),
1358+
(fun gref ~depth { options } _ -> grab_global_env "coq.arguments.reset-simplification" (fun state ->
1359+
match gref with
1360+
| ConstRef gref ->
1361+
let local = options.local <> Some false in
1362+
Reductionops.ReductionBehaviour.set ~local gref None;
1363+
state, (), []
1364+
| _ -> err Pp.(str "reset-simplification must be called on constant")))),
1365+
DocAbove)]
1366+
[%%endif]
1367+
13341368
let coq_misc_builtins =
13351369
let open API.BuiltIn in
13361370
let open Pred in
@@ -3083,10 +3117,12 @@ Supported attributes:
30833117
match gref with
30843118
| ConstRef gref ->
30853119
let local = options.local <> Some false in
3086-
Reductionops.ReductionBehaviour.set ~local gref strategy;
3120+
compat_reduction_behavior_set ~local gref strategy;
30873121
state, (), []
30883122
| _ -> err Pp.(str "set-simplification must be called on constant")))),
3089-
DocAbove);
3123+
DocAbove)
3124+
3125+
] @ compat_reset_simplification @ [
30903126
30913127
MLCode(Pred("coq.locate-abbreviation",
30923128
In(id, "Name",

0 commit comments

Comments
 (0)