| NGeneralize of loc * npattern
| NId of loc
| NIntro of loc * string
+ | NInversion of loc * CicNotationPt.term * npattern
| NLApply of loc * CicNotationPt.term
| NLetIn of loc * npattern * CicNotationPt.term * string
| NReduce of loc * [ `Normalize of bool | `Whd of bool ] * npattern
assert false ^ " " ^ assert false
| NId _ -> "nid"
| NIntro (_,n) -> "#" ^ n
+ | NInversion (_,what,where) -> "ninversion " ^ CicNotationPp.pp_term what ^
+ assert false ^ " " ^ assert false
| NLApply (_,t) -> "lapply " ^ CicNotationPp.pp_term t
| NRewrite (_,dir,n,where) -> "nrewrite " ^
(match dir with `LeftToRight -> ">" | `RightToLeft -> "<") ^
NTactics.generalize_tac ~where:(text,prefix_len,where)
| GrafiteAst.NId _ -> (fun x -> x)
| GrafiteAst.NIntro (_loc,n) -> NTactics.intro_tac n
+ | GrafiteAst.NInversion (_loc, what, where) ->
+ NTactics.inversion_tac
+ ~what:(text,prefix_len,what)
+ ~where:(text,prefix_len,where)
| GrafiteAst.NLApply (_loc, t) -> NTactics.lapply_tac (text,prefix_len,t)
| GrafiteAst.NLetIn (_loc,where,what,name) ->
NTactics.letin_tac ~where:(text,prefix_len,where)
G.NElim (loc, what, where)
| IDENT "ngeneralize"; p=pattern_spec ->
G.NGeneralize (loc, p)
+ | IDENT "ninversion"; what = tactic_term ; where = pattern_spec ->
+ G.NInversion (loc, what, where)
| IDENT "nlapply"; t = tactic_term -> G.NLApply (loc, t)
| IDENT "nletin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
where = pattern_spec ->
(* $Id: nCic.ml 9058 2008-10-13 17:42:30Z tassi $ *)
-let pp m = prerr_endline (Lazy.force m);;
-(* let pp _ = ();; *)
+(* let pp m = prerr_endline (Lazy.force m);;*)
+let pp _ = ();;
let fresh_name =
let i = ref 0 in
Some (CicNotationPt.Implicit `JustOne)),
mk_appl (mk_id "P"::id_rs)))))
in
- pp (lazy ("and the theorem is: \n" ^ (CicNotationPp.pp_term theorem)));
let t = mk_appl ( [mk_id (ind_name ^ "_" ^ suffix)]@ id_ls @ [lambdas] @
List.map mk_id hyplist @
HExtlib.mk_list (CicNotationPt.Implicit `JustOne) (List.length ys) @ [mk_id "Hterm"] ) in
- pp (lazy ("and t is: \n" ^ (CicNotationPp.pp_term t)));
let status, theorem = GrafiteDisambiguate.disambiguate_nobj status ~baseuri
(baseuri ^ name ^ ".def",
0,CicNotationPt.Theorem (`Theorem,name,theorem,Some
) status
;;
+let inversion_tac ~what:(txt,len,what) ~where =
+ let what = txt, len, Ast.Appl [what; Ast.Implicit `Vector] in
+ let indtyinfo = ref None in
+ let sort = ref (NCic.Rel 1) in
+ atomic_tac (block_tac [
+ analyze_indty_tac ~what indtyinfo;
+ (fun s -> select_tac
+ ~where ~job:(`Substexpand ((HExtlib.unopt !indtyinfo).rightno+1)) true s);
+ sort_of_goal_tac sort;
+ (fun status ->
+ let ity = HExtlib.unopt !indtyinfo in
+ let NReference.Ref (uri, _) = ity.reference in
+ let name =
+ NUri.name_of_uri uri ^ "_inv_" ^
+ snd (NCicElim.ast_of_sort
+ (match !sort with NCic.Sort x -> x | _ -> assert false))
+ in
+ let eliminator =
+ let _,_,w = what in
+ Ast.Appl [ Ast.Ident (name,None) ; Ast.Implicit `Vector ; w ]
+ in
+ exact_tac ("",0,eliminator) status) ])
+;;
val find_in_context : 'a -> ('a * 'b) list -> int
+
+val inversion_tac:
+ what:NTacStatus.tactic_term -> where:NTacStatus.tactic_pattern ->
+ 's NTacStatus.tactic