]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/grafite_engine/grafiteSync.ml
The relevance list can be shorter than leftno (when the default is used).
[helm.git] / helm / software / components / grafite_engine / grafiteSync.ml
index 759186c12a1189c1eaa22be9e116ba1f69a24c0f..49545e5f46f0f0417353bdd921d3cb014d5899a3 100644 (file)
@@ -78,10 +78,30 @@ let add_obj ~pack_coercion_obj uri obj status =
    let term = CicUtil.term_of_uri uri in
    let ty,_ = CicTypeChecker.type_of_aux' [] [] term CicUniv.oblivion_ugraph in
    let tkeys = Universe.keys [] ty in
-   let index_cmd = 
-     List.map 
-       (fun key -> GrafiteAst.Index(HExtlib.dummy_floc,(Some key),uri))
-       tkeys
+   let universe = automation_cache.AutomationCache.univ in
+   let universe, index_cmd = 
+     List.fold_left 
+       (fun (universe,acc) key -> 
+         let cands = Universe.get_candidates universe key in
+         let tys = 
+           List.map
+              (fun t -> 
+                 let ty, _ = 
+                   CicTypeChecker.type_of_aux' [] [] t CicUniv.oblivion_ugraph
+                 in
+                   ty)
+              cands
+         in
+         if List.for_all 
+              (fun cty -> 
+                 not (fst(CicReduction.are_convertible [] ty cty
+                 CicUniv.oblivion_ugraph))) tys 
+        then
+           Universe.index universe key term,
+           GrafiteAst.Index(HExtlib.dummy_floc,(Some key),uri)::acc
+         else
+           universe, acc)
+       (universe,[]) tkeys
    in
    let is_equational = is_equational_fact ty in
    let select_cmd = 
@@ -90,8 +110,6 @@ let add_obj ~pack_coercion_obj uri obj status =
       else
        []
    in
-   let universe = automation_cache.AutomationCache.univ in
-   let universe = Universe.index_term_and_unfolded_term universe [] term ty in
    let automation_cache = 
      if is_equational then
         AutomationCache.add_term_to_active automation_cache [] [] [] term None