X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_notation%2FcicNotationUtil.ml;h=887f5bf0564f1e1c20cbec279b91c46e0f0cbb81;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=29edf6e7cb6354de9f4587cf360eed2473bdd384;hpb=7197b0c80afda28580f5b8cc5e7fb5e5697dc435;p=helm.git diff --git a/helm/ocaml/cic_notation/cicNotationUtil.ml b/helm/ocaml/cic_notation/cicNotationUtil.ml index 29edf6e7c..887f5bf05 100644 --- a/helm/ocaml/cic_notation/cicNotationUtil.ml +++ b/helm/ocaml/cic_notation/cicNotationUtil.ml @@ -63,8 +63,8 @@ let visit_ast ?(special_k = fun _ -> assert false) k = | Some term -> Some (k term) and aux_capture_variable (term, typ_opt) = k term, aux_opt typ_opt and aux_patterns patterns = List.map aux_pattern patterns - and aux_pattern ((head, vars), term) = - ((head, List.map aux_capture_variable vars), k term) + and aux_pattern ((head, hrefs, vars), term) = + ((head, hrefs, List.map aux_capture_variable vars), k term) and aux_subst (name, term) = (name, k term) and aux_substs substs = List.map aux_subst substs in @@ -160,6 +160,12 @@ let rec strip_attributes t = in visit_ast ~special_k strip_attributes t +let rec get_idrefs = + function + | Ast.AttributedTerm (`IdRef id, t) -> id :: get_idrefs t + | Ast.AttributedTerm (_, t) -> get_idrefs t + | _ -> [] + let meta_names_of_term term = let rec names = ref [] in let add_name n = @@ -203,7 +209,7 @@ let meta_names_of_term term = and aux_branch (pattern, term) = aux_pattern pattern ; aux term - and aux_pattern (head, vars) = + and aux_pattern (head, _, vars) = List.iter aux_capture_var vars and aux_definition (var, term, i) = aux_capture_var var ; @@ -300,16 +306,13 @@ let dressn ~sep:sauces = let find_appl_pattern_uris ap = let rec aux acc = function - | Ast.UriPattern uri -> - (try - ignore (List.find (fun uri' -> UriManager.eq uri uri') acc); - acc - with Not_found -> uri :: acc) + | Ast.UriPattern uri -> uri :: acc | Ast.ImplicitPattern | Ast.VarPattern _ -> acc | Ast.ApplPattern apl -> List.fold_left aux acc apl in - aux [] ap + let uris = aux [] ap in + HExtlib.list_uniq (List.fast_sort UriManager.compare uris) let rec find_branch = function