X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Facic_procedural%2FproceduralTypes.ml;h=b4d88169af438c267948b0c382114856ad2b9c05;hb=b4027b84fae91e907b6874060b91d89b6a1ad780;hp=95fdc6e562d6c8e281c937509dd8b57d57431ab9;hpb=4db221ee87ba30f63db0ea32c98858041e8e6213;p=helm.git diff --git a/helm/software/components/acic_procedural/proceduralTypes.ml b/helm/software/components/acic_procedural/proceduralTypes.ml index 95fdc6e56..b4d88169a 100644 --- a/helm/software/components/acic_procedural/proceduralTypes.ml +++ b/helm/software/components/acic_procedural/proceduralTypes.ml @@ -68,13 +68,15 @@ let is_atomic = function (****************************************************************************) -type name = string -type what = Cic.annterm -type how = bool -type using = Cic.annterm -type count = int -type note = string -type where = (name * name) option +type name = string +type what = Cic.annterm +type how = bool +type using = Cic.annterm +type count = int +type note = string +type where = (name * name) option +type inferred = Cic.annterm +type pattern = Cic.annterm type step = Note of note | Theorem of name * what * note @@ -83,10 +85,11 @@ type step = Note of note | Intros of count option * name list * note | Cut of name * what * note | LetIn of name * what * note - | Rewrite of how * what * where * note - | Elim of what * using option * note + | Rewrite of how * what * where * pattern * note + | Elim of what * using option * pattern * note | Apply of what * note - | Whd of count * note + | Change of inferred * what * where * pattern * note + | ClearBody of name * note | Branch of step list list * note (* annterm constructors *****************************************************) @@ -97,8 +100,6 @@ let mk_arel i b = Cic.ARel ("", "", i, b) let floc = H.dummy_floc -let hole = C.AImplicit ("", Some `Hole) - let mk_note str = G.Comment (floc, G.Note (floc, str)) let mk_theorem name t = @@ -127,26 +128,34 @@ let mk_letin name what = let tactic = G.LetIn (floc, what, name) in mk_tactic tactic -let mk_rewrite direction what where = +let mk_rewrite direction what where pattern = let direction = if direction then `RightToLeft else `LeftToRight in let pattern, rename = match where with - | None -> (None, [], Some hole), [] - | Some (premise, name) -> (None, [premise, hole], None), [name] + | None -> (None, [], Some pattern), [] + | Some (premise, name) -> (None, [premise, pattern], None), [name] in let tactic = G.Rewrite (floc, direction, what, pattern, rename) in mk_tactic tactic -let mk_elim what using = - let tactic = G.Elim (floc, what, using, Some 0, []) in +let mk_elim what using pattern = + let pattern = None, [], Some pattern in + let tactic = G.Elim (floc, what, using, pattern, Some 0, []) in mk_tactic tactic let mk_apply t = let tactic = G.Apply (floc, t) in mk_tactic tactic -let mk_whd i = - let pattern = None, [], Some hole in - let tactic = G.Reduce (floc, `Whd, pattern) in +let mk_change t where pattern = + let pattern = match where with + | None -> None, [], Some pattern + | Some (premise, _) -> None, [premise, pattern], None + in + let tactic = G.Change (floc, pattern, t) in + mk_tactic tactic + +let mk_clearbody id = + let tactic = G.ClearBody (floc, id) in mk_tactic tactic let mk_dot = G.Executable (floc, G.Tactical (floc, G.Dot floc, None)) @@ -162,20 +171,21 @@ let mk_vb = G.Executable (floc, G.Tactical (floc, G.Shift floc, None)) (* rendering ****************************************************************) let rec render_step sep a = function - | Note s -> mk_note s :: a - | Theorem (n, t, s) -> mk_note s :: mk_theorem n t :: a - | Qed s -> mk_note s :: mk_qed :: a - | Id s -> mk_note s :: cont sep (mk_id :: a) - | Intros (c, ns, s) -> mk_note s :: cont sep (mk_intros c ns :: a) - | Cut (n, t, s) -> mk_note s :: cont sep (mk_cut n t :: a) - | LetIn (n, t, s) -> mk_note s :: cont sep (mk_letin n t :: a) - | Rewrite (b, t, w, s) -> mk_note s :: cont sep (mk_rewrite b t w :: a) - | Elim (t, xu, s) -> mk_note s :: cont sep (mk_elim t xu :: a) - | Apply (t, s) -> mk_note s :: cont sep (mk_apply t :: a) - | Whd (c, s) -> mk_note s :: cont sep (mk_whd c :: a) - | Branch ([], s) -> a - | Branch ([ps], s) -> render_steps sep a ps - | Branch (pss, s) -> + | Note s -> mk_note s :: a + | Theorem (n, t, s) -> mk_note s :: mk_theorem n t :: a + | Qed s -> (* mk_note s :: *) mk_qed :: a + | Id s -> mk_note s :: cont sep (mk_id :: a) + | Intros (c, ns, s) -> mk_note s :: cont sep (mk_intros c ns :: a) + | Cut (n, t, s) -> mk_note s :: cont sep (mk_cut n t :: a) + | LetIn (n, t, s) -> mk_note s :: cont sep (mk_letin n t :: a) + | Rewrite (b, t, w, e, s) -> mk_note s :: cont sep (mk_rewrite b t w e :: a) + | Elim (t, xu, e, s) -> mk_note s :: cont sep (mk_elim t xu e :: a) + | Apply (t, s) -> mk_note s :: cont sep (mk_apply t :: a) + | Change (t, _, w, e, s) -> mk_note s :: cont sep (mk_change t w e :: a) + | ClearBody (n, s) -> mk_note s :: cont sep (mk_clearbody n :: a) + | Branch ([], s) -> a + | Branch ([ps], s) -> render_steps sep a ps + | Branch (pss, s) -> let a = mk_ob :: a in let body = mk_cb :: list_rev_map_concat (render_steps None) mk_vb a pss in mk_note s :: cont sep body