| NCase1 of loc * string
| NChange of loc * npattern * CicNotationPt.term
| NElim of loc * CicNotationPt.term * npattern
+ | NEval of loc * npattern * [ `Whd of bool ]
+ | NGeneralize of loc * npattern
| NId of loc
| NIntro of loc * string
| NRewrite of loc * direction * CicNotationPt.term * npattern
- | NGeneralize of loc * npattern
type ('term, 'lazy_term, 'reduction, 'ident) tactic =
(* Higher order tactics (i.e. tacticals) *)
NTactics.elim_tac
~what:(text,prefix_len,what)
~where:(text,prefix_len,where)
+ | GrafiteAst.NEval (_loc, where, reduction) ->
+ NTactics.eval_tac ~reduction ~where:(text,prefix_len,where)
| GrafiteAst.NGeneralize (_loc, where) ->
NTactics.generalize_tac ~where:(text,prefix_len,where)
| GrafiteAst.NId _ -> (fun x -> x)
GrafiteAst.NGeneralize (loc, p)
| IDENT "nrewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
GrafiteAst.NRewrite (loc, dir, what, where)
+ | IDENT "nwhd"; delta = OPT [ IDENT "nodelta" -> () ];
+ where = pattern_spec ->
+ let delta = match delta with None -> true | _ -> false in
+ GrafiteAst.NEval (loc, where, `Whd delta)
| SYMBOL "#"; n=IDENT -> GrafiteAst.NIntro (loc,n)
| SYMBOL "#"; SYMBOL "_" -> GrafiteAst.NIntro (loc,"_")
| SYMBOL "*" -> GrafiteAst.NCase1 (loc,"_")
) s) ]
;;
+let eval_tac ~reduction ~where =
+ let change status t =
+ match reduction with
+ | `Whd perform_delta ->
+ whd status
+ ?delta:(if perform_delta then None else Some max_int) (ctx_of t) t
+ in
+ let where = GrafiteDisambiguate.disambiguate_npattern where in
+ select0_tac ~where ~job:(`ChangeWith change)
+;;
+
let change_tac ~where ~with_what =
let change status t =
let status, ww = disambiguate status with_what None (ctx_of t) in
what:NTacStatus.tactic_term -> where:NTacStatus.tactic_pattern ->
NTacStatus.tactic
val generalize_tac : where:NTacStatus.tactic_pattern -> NTacStatus.tactic
+val eval_tac:
+ reduction:[ `Whd of bool ] ->
+ where:NTacStatus.tactic_pattern -> NTacStatus.tactic