]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_notation/cicNotationFwd.ml
Unsharing finally introduced (but just for object processing, not yet for terms
[helm.git] / helm / ocaml / cic_notation / cicNotationFwd.ml
index 8e955c0b10a8d562647833d501477c3aa87a28ff..4f17e80496c9a9b44831e4fec56d8754170e2309 100644 (file)
@@ -23,6 +23,8 @@
  * http://helm.cs.unibo.it/
  *)
 
+open Printf
+
 open CicNotationEnv
 open CicNotationPt
 
@@ -240,9 +242,25 @@ let instantiate_level2 env term =
               | _ -> assert false
             in
             instantiate_fold_right env)
-    | If (_, p_true, p_false) as t -> aux env (CicNotationUtil.find_branch (Magic t))
+    | If (_, p_true, p_false) as t ->
+        aux env (CicNotationUtil.find_branch (Magic t))
     | Fail -> assert false
     | _ -> assert false
   in
   aux env term
 
+let instantiate_appl_pattern env appl_pattern =
+  let lookup name =
+    try List.assoc name env
+    with Not_found ->
+      prerr_endline (sprintf "Name %s not found" name);
+      assert false
+  in
+  let rec aux = function
+    | UriPattern uri -> CicUtil.term_of_uri uri
+    | ImplicitPattern -> Cic.Implicit None
+    | VarPattern name -> lookup name
+    | ApplPattern terms -> Cic.Appl (List.map aux terms)
+  in
+  aux appl_pattern
+