| GrafiteAst.ApplyP (_, term) -> Tactics.applyP term
| GrafiteAst.ApplyS (_, term, params) ->
Tactics.applyS ~term ~params ~dbd:(LibraryDb.instance ())
- ~universe:status.GrafiteTypes.universe
+ ~automation_cache:status.GrafiteTypes.automation_cache
| GrafiteAst.Assumption _ -> Tactics.assumption
| GrafiteAst.AutoBatch (_,params) ->
Tactics.auto ~params ~dbd:(LibraryDb.instance ())
- ~universe:status.GrafiteTypes.universe
+ ~automation_cache:status.GrafiteTypes.automation_cache
| GrafiteAst.Cases (_, what, pattern, (howmany, names)) ->
Tactics.cases_intros ?howmany ~mk_fresh_name_callback:(namer_of names)
~pattern what
| GrafiteAst.Demodulate (_, params) ->
Tactics.demodulate
~dbd:(LibraryDb.instance ()) ~params
- ~universe:status.GrafiteTypes.universe
+ ~automation_cache:status.GrafiteTypes.automation_cache
| GrafiteAst.Destruct (_,xterms) -> Tactics.destruct xterms
| GrafiteAst.Elim (_, what, using, pattern, (depth, names)) ->
Tactics.elim_intros ?using ?depth ~mk_fresh_name_callback:(namer_of names)
| GrafiteAst.Suppose (_, t, id, t1) -> Declarative.suppose t id t1
| GrafiteAst.By_just_we_proved (_, just, ty, id, t1) ->
Declarative.by_just_we_proved ~dbd:(LibraryDb.instance())
- ~universe:status.GrafiteTypes.universe just ty id t1
+ ~automation_cache:status.GrafiteTypes.automation_cache just ty id t1
| GrafiteAst.We_need_to_prove (_, t, id, t2) ->
Declarative.we_need_to_prove t id t2
| GrafiteAst.Bydone (_, t) ->
Declarative.bydone ~dbd:(LibraryDb.instance())
- ~universe:status.GrafiteTypes.universe t
+ ~automation_cache:status.GrafiteTypes.automation_cache t
| GrafiteAst.We_proceed_by_cases_on (_, t, t1) ->
Declarative.we_proceed_by_cases_on t t1
| GrafiteAst.We_proceed_by_induction_on (_, t, t1) ->
| GrafiteAst.Thesisbecomes (_, t) -> Declarative.thesisbecomes t
| GrafiteAst.ExistsElim (_, just, id1, t1, id2, t2) ->
Declarative.existselim ~dbd:(LibraryDb.instance())
- ~universe:status.GrafiteTypes.universe just id1 t1 id2 t2
+ ~automation_cache:status.GrafiteTypes.automation_cache just id1 t1 id2 t2
| GrafiteAst.Case (_,id,params) -> Declarative.case id params
| GrafiteAst.AndElim(_,just,id1,t1,id2,t2) ->
Declarative.andelim ~dbd:(LibraryDb.instance ())
- ~universe:status.GrafiteTypes.universe just id1 t1 id2 t2
+ ~automation_cache:status.GrafiteTypes.automation_cache just id1 t1 id2 t2
| GrafiteAst.RewritingStep (_,termine,t1,t2,cont) ->
Declarative.rewritingstep ~dbd:(LibraryDb.instance ())
- ~universe:status.GrafiteTypes.universe termine t1 t2 cont
+ ~automation_cache:status.GrafiteTypes.automation_cache termine t1 t2 cont
let classify_tactic tactic =
match tactic with
let eval_ng_tac (text, prefix_len, tac) =
match tac with
| GrafiteAst.NApply (_loc, t) -> NTactics.apply_tac (text,prefix_len,t)
- | GrafiteAst.NChange (_loc, w,ww) ->
- NTactics.change_tac (text,prefix_len,w) (text,prefix_len,ww)
- | GrafiteAst.NId _ -> fun x -> x
+ | GrafiteAst.NAssert (_loc, seqs) ->
+ NTactics.assert_tac
+ ((List.map
+ (function (hyps,concl) ->
+ List.map
+ (function
+ (id,`Decl t) -> id,`Decl (text,prefix_len,t)
+ |(id,`Def (b,t))->id,`Def((text,prefix_len,b),(text,prefix_len,t))
+ ) hyps,
+ (text,prefix_len,concl))
+ ) seqs)
+ | GrafiteAst.NCases (_loc, what, where) ->
+ NTactics.cases_tac
+ ~what:(text,prefix_len,what)
+ ~where:(text,prefix_len,where)
+ | GrafiteAst.NCase1 (_loc,n) -> NTactics.case1_tac n
+ | GrafiteAst.NChange (_loc, pat, ww) ->
+ NTactics.change_tac
+ ~where:(text,prefix_len,pat) ~with_what:(text,prefix_len,ww)
+ | GrafiteAst.NElim (_loc, what, where) ->
+ NTactics.elim_tac
+ ~what:(text,prefix_len,what)
+ ~where:(text,prefix_len,where)
+ | GrafiteAst.NEval (_loc, where, reduction) ->
+ NTactics.eval_tac ~reduction ~where:(text,prefix_len,where)
+ | GrafiteAst.NGeneralize (_loc, where) ->
+ 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)
;;
let rec eval_command = {ec_go = fun ~disambiguate_command opts status
| GrafiteAst.Index (loc,None,uri) ->
assert false (* TODO: for user input *)
| GrafiteAst.Index (loc,Some key,uri) ->
- let universe = Universe.index
- status.GrafiteTypes.universe key (CicUtil.term_of_uri uri) in
- let status = {status with GrafiteTypes.universe = universe} in
+ let universe =
+ status.GrafiteTypes.automation_cache.AutomationCache.univ
+ in
+ let universe = Universe.index universe key (CicUtil.term_of_uri uri) in
+ let cache = {
+ status.GrafiteTypes.automation_cache with AutomationCache.univ = universe }
+ in
+ let status = { status with GrafiteTypes.automation_cache = cache } in
(* debug
let msg =
let candidates = Universe.get_candidates status.GrafiteTypes.universe key in
*)
let status = GrafiteTypes.add_moo_content [cmd] status in
status,[]
+ | GrafiteAst.Select (_,uri) as cmd ->
+ if List.mem cmd status.GrafiteTypes.moo_content_rev then status, []
+ else
+ let cache =
+ AutomationCache.add_term_to_active status.GrafiteTypes.automation_cache
+ [] [] [] (CicUtil.term_of_uri uri) None
+ in
+ let status = { status with GrafiteTypes.automation_cache = cache } in
+ let status = GrafiteTypes.add_moo_content [cmd] status in
+ status, []
+ | GrafiteAst.Pump (_,steps) ->
+ let cache =
+ AutomationCache.pump status.GrafiteTypes.automation_cache steps
+ in
+ let status = { status with GrafiteTypes.automation_cache = cache } in
+ status, []
| GrafiteAst.PreferCoercion (loc, coercion) ->
eval_prefer_coercion status coercion
| GrafiteAst.Coercion (loc, uri, add_composites, arity, saturations) ->
prerr_endline ("nuovo lemma: " ^ NCicPp.ppmetasenv ~subst:nsubst nmenv);
{ status with
GrafiteTypes.ng_status =
- GrafiteTypes.ProofMode { NTactics.gstatus = ninitial_stack;
+ GrafiteTypes.ProofMode { NTacStatus.gstatus = ninitial_stack;
istatus = {
- NTactics.pstatus =
+ NTacStatus.pstatus =
NUri.uri_of_string suri, 0, nmenv, nsubst,
(NCic.Constant ([],"",Some nbo,nty,(`Provided,`Definition,`Regular)));
lstatus = nlexicon_status} }
| GrafiteTypes.ProofMode nstatus ->
let nstatus = eval_ng_tac (text,prefix_len,tac) nstatus in
let nstatus = eval_ng_punct (text,prefix_len,punct) nstatus in
- NTactics.pp_tac_status nstatus;
+ NTacStatus.pp_tac_status nstatus;
{ status with GrafiteTypes.ng_status = GrafiteTypes.ProofMode nstatus }, [])
| GrafiteAst.NonPunctuationTactical (_, tac, punct) ->
let status =