-let auto ~params:(l,_) status goal =
- let gty = get_goalty status goal in
- let n,h,metasenv,subst,o = status#obj in
- let status,t = term_of_cic_term status gty (ctx_of gty) in
- let status, l =
- List.fold_left
- (fun (status, l) t ->
- let status, t = disambiguate status t None (ctx_of gty) in
- let status, ty = typeof status (ctx_of t) t in
- let status, t = term_of_cic_term status t (ctx_of gty) in
- let status, ty = term_of_cic_term status ty (ctx_of ty) in
- (status, (t,ty) :: l))
- (status,[]) l
- in
- let pt, metasenv, subst =
- Paramod.nparamod status metasenv subst (ctx_of gty) (NCic.Rel ~-1,t) l
- in
- let status = status#set_obj (n,h,metasenv,subst,o) in
- instantiate status goal (NTacStatus.mk_cic_term (ctx_of gty) pt)
-;;
-
-let auto_tac ~params status =
- distribute_tac (auto ~params) 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) ])