- if restricted_univ = [] then
- let ct =
- if use_context then find_context_theorems context metasenv else []
- in
- let lt =
- match use_library, dbd with
- | true, Some dbd -> find_library_theorems dbd metasenv goal
- | _ -> []
- in
- let cache = AutoCache.cache_empty in
- let cache = cache_add_list cache context (ct@lt) in
- let automation_cache, _ =
- List.fold_left
- (fun (c,maxmeta) (t,ty) ->
- let head, metasenv, args, maxmeta =
- TermUtil.saturate_term maxmeta metasenv context ty 0
- in
- if List.exists (is_prop metasenv subst context) args then
- c,maxmeta
- else
- let st = if args = [] then t else Cic.Appl (t::args) in
- AutomationCache.add_term_to_active
- c metasenv [] context st (Some head), maxmeta)
- (automation_cache,CicMkImplicit.new_meta metasenv subst) ct
- in
- (* AutomationCache.pp_cache automation_cache; *)
- automation_cache.AutomationCache.univ,
- automation_cache.AutomationCache.tables,
- cache
- else
- let metasenv, t_ty, s_t_ty, _ =
- List.fold_left
- (fun (metasenv as orig,acc, sacc, maxmeta) t ->
- let ty, _ =
- CicTypeChecker.type_of_aux'
- metasenv ~subst:[] context t CicUniv.oblivion_ugraph
- in
- let head, metasenv, args, maxmeta =
- TermUtil.saturate_term maxmeta metasenv context ty 0
- in
- if List.exists (is_prop metasenv subst context) args then
- orig, (t,ty)::acc, sacc, maxmeta
- else
- let st = if args = [] then t else Cic.Appl (t::args) in
- metasenv, (t, ty)::acc, (st,head)::sacc, maxmeta)
- (metasenv, [],[], CicMkImplicit.new_meta metasenv subst) restricted_univ
- in
- let automation_cache = AutomationCache.empty () in
- let automation_cache =
- let universe = automation_cache.AutomationCache.univ in
- let universe =
- Universe.index_list universe context t_ty
- in
- { automation_cache with AutomationCache.univ = universe }
- in
- let automation_cache =
- List.fold_left
- (fun c (t,ty) ->
- AutomationCache.add_term_to_active c metasenv [] context t (Some ty))
- automation_cache s_t_ty
- in
+ match restricted_univ with
+ | None ->
+ let ct =
+ if use_context then find_context_theorems context metasenv else []
+ in
+ let lt =
+ match use_library, dbd with
+ | true, Some dbd -> find_library_theorems dbd metasenv goal
+ | _ -> []
+ in
+ let cache = AutoCache.cache_empty in
+ let cache = cache_add_list cache context (ct@lt) in
+ let automation_cache =
+ add_list_to_tables metasenv subst automation_cache ct
+ in
+(* AutomationCache.pp_cache automation_cache; *)
+ automation_cache.AutomationCache.univ,
+ automation_cache.AutomationCache.tables,
+ cache
+ | Some restricted_univ ->
+ let t_ty =
+ List.map
+ (fun t ->
+ let ty, _ = CicTypeChecker.type_of_aux'
+ metasenv ~subst:[] context t CicUniv.oblivion_ugraph
+ in
+ t, ty)
+ restricted_univ
+ in
+ (* let automation_cache = AutomationCache.empty () in *)
+ let automation_cache =
+ let universe = Universe.empty in
+ let universe =
+ Universe.index_list universe context t_ty
+ in
+ { automation_cache with AutomationCache.univ = universe }
+ in
+ let ct =
+ if use_context then find_context_theorems context metasenv else t_ty
+ in
+ let automation_cache =
+ add_list_to_tables metasenv subst automation_cache ct
+ in