| NElim of loc * CicNotationPt.term * npattern
| NId of loc
| NIntro of loc * string
+ | NRewrite of loc * direction * CicNotationPt.term * npattern
type ('term, 'lazy_term, 'reduction, 'ident) tactic =
(* Higher order tactics (i.e. tacticals) *)
assert false ^ " " ^ assert false
| NId _ -> "nid"
| NIntro (_,n) -> "#" ^ n
+ | NRewrite (_,dir,n,where) -> "nrewrite" ^ assert false
;;
let rec pp_tactic ~map_unicode_to_tex ~term_pp ~lazy_term_pp =
~where:(text,prefix_len,where)
| GrafiteAst.NId _ -> (fun x -> x)
| GrafiteAst.NIntro (_loc,n) -> NTactics.intro_tac n
+ | GrafiteAst.NRewrite (_loc,dir,what,where) ->
+ NTactics.rewrite_tac ~dir ~what:(text,prefix_len,what)
+ ~where:(text,prefix_len,where)
;;
let rec eval_command = {ec_go = fun ~disambiguate_command opts status
GrafiteAst.NChange (loc, what, with_what)
| IDENT "nelim"; what = tactic_term ; where = pattern_spec ->
GrafiteAst.NElim (loc, what, where)
+ | IDENT "nrewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
+ GrafiteAst.NRewrite (loc, dir, what, where)
| SYMBOL "#"; n=IDENT -> GrafiteAst.NIntro (loc,n)
| SYMBOL "#"; SYMBOL "_" -> GrafiteAst.NIntro (loc,"_")
| SYMBOL "*" -> GrafiteAst.NCase1 (loc,"_")
status
;;
+let rewrite_tac ~dir ~what:(_,_,what) ~where =
+ let name =
+ match dir with `LeftToRight -> "eq_elim_r" | `RightToLeft -> "eq_ind"
+ in
+ block_tac
+ [ select_tac ~where true;
+ exact_tac
+ ("",0,
+ Ast.Appl(Ast.Ident(name,None)::HExtlib.mk_list Ast.Implicit 5 @
+ [what]))]
+;;
+
let intro_tac name =
block_tac
[ exact_tac
what:NTacStatus.tactic_term -> where:NTacStatus.tactic_pattern ->
NTacStatus.tactic
val case1_tac: string -> NTacStatus.tactic
-
+val rewrite_tac:
+ dir:[ `LeftToRight | `RightToLeft ] ->
+ what:NTacStatus.tactic_term -> where:NTacStatus.tactic_pattern ->
+ NTacStatus.tactic