| NGeneralize of loc * npattern
| NId of loc
| NIntro of loc * string
+ | NLetIn of loc * npattern * CicNotationPt.term * string
| NRewrite of loc * direction * CicNotationPt.term * npattern
type ('term, 'lazy_term, 'reduction, 'ident) tactic =
NTactics.generalize_tac ~where:(text,prefix_len,where)
| GrafiteAst.NId _ -> (fun x -> x)
| GrafiteAst.NIntro (_loc,n) -> NTactics.intro_tac n
+ | GrafiteAst.NLetIn (_loc,where,what,name) ->
+ NTactics.letin_tac ~where:(text,prefix_len,where)
+ ~what:(text,prefix_len,what) name
| GrafiteAst.NRewrite (_loc,dir,what,where) ->
NTactics.rewrite_tac ~dir ~what:(text,prefix_len,what)
~where:(text,prefix_len,where)
GrafiteAst.NElim (loc, what, where)
| IDENT "ngeneralize"; p=pattern_spec ->
GrafiteAst.NGeneralize (loc, p)
+ | IDENT "nletin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
+ where = pattern_spec ->
+ GrafiteAst.NLetIn (loc,where,t,name)
| IDENT "nrewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
GrafiteAst.NRewrite (loc, dir, what, where)
| IDENT "nwhd"; delta = OPT [ IDENT "nodelta" -> () ];
select0_tac ~where ~job:(`ChangeWith change)
;;
+let letin_tac ~where:(_,_,(m,hyp,gp)) ~what:(_,_,w) name =
+ assert(m = None);
+ let where = Some w, [],
+ match gp with
+ | None -> Some Ast.Implicit
+ | Some where ->
+ Some
+ (List.fold_left
+ (fun t _ ->
+ Ast.Binder(`Pi,(Ast.Ident("_",None),Some Ast.UserInput),t))
+ where hyp)
+ in
+ block_tac [
+ generalize0_tac (List.map (fun (name,_) -> Ast.Ident (name,None)) hyp);
+ exact_tac ("",0,Ast.LetIn((Ast.Ident (name,None),None),w,Ast.Implicit));
+ change_tac ~where:("",0,where) ~with_what:("",0,Ast.Ident (name,None))
+ ]
+;;
+
let apply_tac = exact_tac;;
type indtyinfo = {
val eval_tac:
reduction:[ `Whd of bool ] ->
where:NTacStatus.tactic_pattern -> NTacStatus.tactic
+val letin_tac:
+ where:NTacStatus.tactic_pattern ->
+ what: NTacStatus.tactic_term ->
+ string -> NTacStatus.tactic
+