X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_notation%2FcicNotationFwd.ml;h=4f17e80496c9a9b44831e4fec56d8754170e2309;hb=91a095f0686ee569ba035e4e30c7d071588cb8e7;hp=10bab9e36fb3bcaedd333aec34ec64610077164d;hpb=f7759f86b755f4f7dc2b23edd52ed4d2e5c028fe;p=helm.git diff --git a/helm/ocaml/cic_notation/cicNotationFwd.ml b/helm/ocaml/cic_notation/cicNotationFwd.ml index 10bab9e36..4f17e8049 100644 --- a/helm/ocaml/cic_notation/cicNotationFwd.ml +++ b/helm/ocaml/cic_notation/cicNotationFwd.ml @@ -23,6 +23,8 @@ * http://helm.cs.unibo.it/ *) +open Printf + open CicNotationEnv open CicNotationPt @@ -211,7 +213,6 @@ let instantiate_level2 env term = | [] -> assert false (* as above *) | (name :: _) as names -> let rec instantiate_fold_left acc env' = - prerr_endline "instantiate_fold_left"; match lookup_value env' name with | ListValue (_ :: _) -> instantiate_fold_left @@ -232,7 +233,6 @@ let instantiate_level2 env term = | [] -> assert false (* as above *) | (name :: _) as names -> let rec instantiate_fold_right env' = - prerr_endline "instantiate_fold_right"; match lookup_value env' name with | ListValue (_ :: _) -> let acc = instantiate_fold_right (tail_names names env') in @@ -242,7 +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)) + | 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 +