From: Claudio Sacerdoti Coen Date: Wed, 1 Apr 2009 20:40:51 +0000 (+0000) Subject: New tactic intro. Syntax: "# n". X-Git-Tag: make_still_working~4128 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=d072c3ea699cf33189d18d8431fda9750fc2eb93;p=helm.git New tactic intro. Syntax: "# n". --- diff --git a/helm/software/components/grafite/grafiteAst.ml b/helm/software/components/grafite/grafiteAst.ml index eada3bedc..4f86ff6eb 100644 --- a/helm/software/components/grafite/grafiteAst.ml +++ b/helm/software/components/grafite/grafiteAst.ml @@ -54,6 +54,7 @@ type ntactic = | NChange of loc * npattern * CicNotationPt.term | NElim of loc * CicNotationPt.term * npattern | NId of loc + | NIntro of loc * string type ('term, 'lazy_term, 'reduction, 'ident) tactic = (* Higher order tactics (i.e. tacticals) *) diff --git a/helm/software/components/grafite/grafiteAstPp.ml b/helm/software/components/grafite/grafiteAstPp.ml index f3e336277..6a493f834 100644 --- a/helm/software/components/grafite/grafiteAstPp.ml +++ b/helm/software/components/grafite/grafiteAstPp.ml @@ -96,6 +96,7 @@ let pp_ntactic ~map_unicode_to_tex = function | NElim (_,what,where) -> "nelim " ^ CicNotationPp.pp_term what ^ assert false ^ " " ^ assert false | NId _ -> "nid" + | NIntro (_,n) -> n ;; let rec pp_tactic ~map_unicode_to_tex ~term_pp ~lazy_term_pp = diff --git a/helm/software/components/grafite_engine/grafiteEngine.ml b/helm/software/components/grafite_engine/grafiteEngine.ml index ade6a3350..b3560150e 100644 --- a/helm/software/components/grafite_engine/grafiteEngine.ml +++ b/helm/software/components/grafite_engine/grafiteEngine.ml @@ -593,7 +593,8 @@ let eval_ng_tac (text, prefix_len, tac) = NTactics.elim_tac ~what:(text,prefix_len,what) ~where:(text,prefix_len,where) - | GrafiteAst.NId _ -> fun x -> x + | GrafiteAst.NId _ -> (fun x -> x) + | GrafiteAst.NIntro (_loc,n) -> NTactics.intro_tac n ;; let rec eval_command = {ec_go = fun ~disambiguate_command opts status diff --git a/helm/software/components/grafite_parser/grafiteParser.ml b/helm/software/components/grafite_parser/grafiteParser.ml index 8e67c0f3e..821d2909a 100644 --- a/helm/software/components/grafite_parser/grafiteParser.ml +++ b/helm/software/components/grafite_parser/grafiteParser.ml @@ -186,6 +186,7 @@ EXTEND GrafiteAst.NChange (loc, what, with_what) | IDENT "nelim"; what = tactic_term ; where = pattern_spec -> GrafiteAst.NElim (loc, what, where) + | SYMBOL "#"; n=IDENT -> GrafiteAst.NIntro (loc,n) ] ]; tactic: [ diff --git a/helm/software/components/ng_tactics/nTactics.ml b/helm/software/components/ng_tactics/nTactics.ml index 2521498ba..40a490d6b 100644 --- a/helm/software/components/ng_tactics/nTactics.ml +++ b/helm/software/components/ng_tactics/nTactics.ml @@ -448,6 +448,8 @@ let exact t status goal = instantiate status goal t ;; +let exact_tac t = distribute_tac (exact t) ;; + let reopen status = let n,h,metasenv,subst,o = status.pstatus in let subst, newm = @@ -515,4 +517,8 @@ let elim_tac ~what ~where status = status ;; - +let intro_tac name = + exact_tac + ("",0,(CicNotationPt.Binder (`Lambda, + (CicNotationPt.Ident (name,None),None),CicNotationPt.Implicit))) +;; diff --git a/helm/software/components/ng_tactics/nTactics.mli b/helm/software/components/ng_tactics/nTactics.mli index 6c318798e..de8c24738 100644 --- a/helm/software/components/ng_tactics/nTactics.mli +++ b/helm/software/components/ng_tactics/nTactics.mli @@ -46,6 +46,6 @@ val block_tac: tactic list -> tactic val apply_tac: tactic_term -> tactic val change_tac: where:tactic_pattern -> with_what:tactic_term -> tactic val elim_tac: what:tactic_term -> where:tactic_pattern -> tactic - +val intro_tac: string -> tactic val pp_tac_status: tac_status -> unit