]> matita.cs.unibo.it Git - helm.git/commitdiff
new disambiguatio attached with the right universe graph
authorEnrico Tassi <enrico.tassi@inria.fr>
Tue, 9 Dec 2008 18:30:47 +0000 (18:30 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Tue, 9 Dec 2008 18:30:47 +0000 (18:30 +0000)
helm/software/components/grafite_parser/grafiteDisambiguate.ml

index 9950b4eb747ded55b256995bd108313d2a9da7ba..bcbcf9c934153b93a0659302df3552f3d021e331 100644 (file)
@@ -570,11 +570,51 @@ let disambiguate_obj lexicon_status ?baseuri metasenv (text,prefix_len,obj) =
          | None -> raise BaseUriNotSetYet)
     | CicNotationPt.Inductive _ -> assert false
     | CicNotationPt.Theorem _ -> None in
-  (*
+(*   let time = Unix.gettimeofday () in *)
+  let (diff, metasenv, _, cic, _) =
+    singleton "third"
+      (CicDisambiguate.disambiguate_obj 
+        ~lookup_in_library 
+        ~mk_choice:cic_mk_choice
+        ~mk_implicit
+        ~description_of_alias:LexiconAst.description_of_alias
+        ~aliases:lexicon_status.LexiconEngine.aliases
+        ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) ~uri 
+        (text,prefix_len,obj)) in
+(*
+  let time = Unix.gettimeofday () -. time in
+  prerr_endline ("VECCHIA DISAMBIGUAZIONE: " ^ string_of_float time);
+*)
+(*
   (let time = Unix.gettimeofday () in
    prerr_endline "INIZIO NUOVA DISAMBIGUAZIONE";
    (match obj with
       CicNotationPt.Theorem (_,_,ty,_) ->
+   let graph = 
+     match cic with
+     | Cic.CurrentProof (_,metasenv, _, ty,_,_) ->
+         let _, ugraph = 
+           CicTypeChecker.type_of_aux' metasenv [] ty CicUniv.empty_ugraph
+         in
+           ugraph
+     | Cic.Constant (_,_, ty,_,_) ->
+         let _, ugraph = 
+                 CicTypeChecker.type_of_aux' [] [] ty CicUniv.empty_ugraph
+         in
+           ugraph
+     | _ -> CicUniv.empty_ugraph
+   in
+   let graph =
+       List.fold_left 
+         (fun graph (_,_,l) ->
+           List.fold_left
+             (fun graph (uri,_,_) ->
+                let _,g = CicTypeChecker.typecheck uri in
+                CicUniv.merge_ugraphs ~base_ugraph:graph ~increment:(g,uri))
+             graph l)
+       graph (CoercDb.to_list ())
+   in
+   ignore(CicUniv.do_rank graph);
        (try
          (match 
           NCicDisambiguate.disambiguate_term
@@ -603,21 +643,6 @@ let disambiguate_obj lexicon_status ?baseuri metasenv (text,prefix_len,obj) =
        )
     | _ -> ())
   ); 
-  let time = Unix.gettimeofday () in
-  *)
-  let (diff, metasenv, _, cic, _) =
-    singleton "third"
-      (CicDisambiguate.disambiguate_obj 
-        ~lookup_in_library 
-        ~mk_choice:cic_mk_choice
-        ~mk_implicit
-        ~description_of_alias:LexiconAst.description_of_alias
-        ~aliases:lexicon_status.LexiconEngine.aliases
-        ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) ~uri 
-        (text,prefix_len,obj)) in
-(*
-  let time = Unix.gettimeofday () -. time in
-  prerr_endline ("VECCHIA DISAMBIGUAZIONE: " ^ string_of_float time);
 *)
   let lexicon_status = LexiconEngine.set_proof_aliases lexicon_status diff in
   lexicon_status, metasenv, cic