| IDENT "nelim"; what = tactic_term ; where = pattern_spec ->
GrafiteAst.NElim (loc, what, where)
| SYMBOL "#"; n=IDENT -> GrafiteAst.NIntro (loc,n)
+ | SYMBOL "#"; SYMBOL "_" -> GrafiteAst.NIntro (loc,"_")
| SYMBOL "*" -> GrafiteAst.NCase1 (loc,"_")
| SYMBOL "*"; n=IDENT ->
GrafiteAst.NCase1 (loc,n)
status
;;
+let find_in_context name context =
+ let rec aux acc = function
+ | [] -> raise Not_found
+ | (hd,_) :: tl when hd = name -> acc
+ | _ :: tl -> aux (acc + 1) tl
+ in
+ aux 1 context
+;;
+
+let clear name status goal =
+ let goalty = get_goalty status goal in
+ let j =
+ try find_in_context name (ctx_of goalty)
+ with Not_found -> fail (lazy ("hypothesis '" ^ name ^ "' not found")) in
+ let n,h,metasenv,subst,o = status.pstatus in
+ let metasenv,subst,_ = NCicMetaSubst.restrict metasenv subst goal [j] in
+ { status with pstatus = n,h,metasenv,subst,o }
+;;
+
+let clear_tac name = distribute_tac (clear name);;
+
let intro_tac name =
- exact_tac
- ("",0,(CicNotationPt.Binder (`Lambda,
- (CicNotationPt.Ident (name,None),None),CicNotationPt.Implicit)))
+ block_tac
+ [ exact_tac
+ ("",0,(CicNotationPt.Binder (`Lambda,
+ (CicNotationPt.Ident (name,None),None),CicNotationPt.Implicit)));
+ if name = "_" then clear_tac name else fun x -> x ]
;;
let cases ~what status goal =