]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/content_pres/proceduralTypes.ml
More stuff in technicalities/setoids.ma
[helm.git] / helm / software / components / content_pres / proceduralTypes.ml
index 0ef73e2488d84b170a45f23f1edfc0e8d5c1ce9d..95fdc6e562d6c8e281c937509dd8b57d57431ab9 100644 (file)
@@ -55,6 +55,17 @@ let list_rev_map_concat map sep a l =
    in
    aux a l
 
+let is_atomic = function
+   | C.ASort _
+   | C.AConst _
+   | C.AMutInd _
+   | C.AMutConstruct _
+   | C.AVar _
+   | C.ARel _
+   | C.AMeta _
+   | C.AImplicit _     -> true
+   | _                 -> false
+
 (****************************************************************************)
 
 type name  = string
@@ -75,6 +86,7 @@ type step = Note of note
          | Rewrite of how * what * where * note
          | Elim of what * using option * note
          | Apply of what * note
+         | Whd of count * note
          | Branch of step list list * note
 
 (* annterm constructors *****************************************************)
@@ -85,6 +97,8 @@ 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 = 
@@ -114,7 +128,6 @@ let mk_letin name what =
    mk_tactic tactic
 
 let mk_rewrite direction what where =
-   let hole = C.AImplicit ("", Some `Hole) in
    let direction = if direction then `RightToLeft else `LeftToRight in 
    let pattern, rename = match where with
       | None                 -> (None, [], Some hole), []
@@ -131,6 +144,11 @@ 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
+   mk_tactic tactic
+
 let mk_dot = G.Executable (floc, G.Tactical (floc, G.Dot floc, None))
 
 let mk_sc = G.Executable (floc, G.Tactical (floc, G.Semicolon floc, None))
@@ -154,6 +172,7 @@ let rec render_step sep a = function
    | 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)      ->