X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Ftactics%2Funiverse.ml;h=780b72daf8e421402e4752a070867ea00044a6db;hb=82d4772ee9ac860f0a99b774612d2cf19838bb4b;hp=f7c3932dc688abf1e5ca3c4acb0308d59b1d4a66;hpb=2e2648a9ed26d9b813de8e6a10e2776162565f09;p=helm.git diff --git a/helm/software/components/tactics/universe.ml b/helm/software/components/tactics/universe.ml index f7c3932dc..780b72daf 100644 --- a/helm/software/components/tactics/universe.ml +++ b/helm/software/components/tactics/universe.ml @@ -28,16 +28,35 @@ module Codomain = struct let compare = Pervasives.compare end module S = Set.Make(Codomain) -module TI = Discrimination_tree.DiscriminationTreeIndexing(S) +module TI = Discrimination_tree.Make(Discrimination_tree.CicIndexable)(S) type universe = TI.t -let empty = TI.empty +let empty = TI.empty ;; + +let iter u f = + TI.iter u + (fun p s -> f p (S.elements s)) ;; let get_candidates univ ty = S.elements (TI.retrieve_unifiables univ ty) ;; +let in_universe univ ty = + let candidates = get_candidates univ ty in + List.fold_left + (fun res cand -> + match res with + | Some found -> Some found + | None -> + let candty,_ = + CicTypeChecker.type_of_aux' [] [] cand CicUniv.oblivion_ugraph in + let same ,_ = + CicReduction.are_convertible [] candty ty CicUniv.oblivion_ugraph in + if same then Some cand else None + ) None candidates +;; + let rec unfold context = function | Cic.Prod(name,s,t) -> let t' = unfold ((Some (name,Cic.Decl s))::context) t in @@ -73,7 +92,7 @@ let rec collapse_head_metas t = let rec dummies_of_coercions = function - | Cic.Appl (c::l) when CoercDb.is_a_coercion' c -> + | Cic.Appl (c::l) when CoercDb.is_a_coercion c <> None -> Cic.Meta (-1,[]) | Cic.Appl l -> let l' = List.map dummies_of_coercions l in Cic.Appl l'