| Cic.Sort Cic.Prop | Cic.Sort (Cic.CProp _) -> true
| _ -> false
in
+ let add_list_to_tables metasenv subst automation_cache ct =
+ let _,_,bag = automation_cache.AutomationCache.tables in
+ let maxmeta = Equality.maxmeta bag in
+ 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,maxmeta) ct
+ in
if restricted_univ = [] then
let ct =
if use_context then find_context_theorems context metasenv else []
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
+ let automation_cache, _ = add_list_to_tables metasenv subst automation_cache ct
in
-(* AutomationCache.pp_cache automation_cache; *)
+ (* AutomationCache.pp_cache automation_cache; *)
automation_cache.AutomationCache.univ,
automation_cache.AutomationCache.tables,
cache
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 = AutomationCache.empty () in *)
let automation_cache =
- let universe = automation_cache.AutomationCache.univ in
+ 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 []
+ in
+ let automation_cache, _ = add_list_to_tables metasenv subst automation_cache ct
+ in
+ (* proviamo a tenere tutte le equazioni
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
-(* AutomationCache.pp_cache automation_cache; *)
+ in *)
+ (* AutomationCache.pp_cache automation_cache; *)
automation_cache.AutomationCache.univ,
automation_cache.AutomationCache.tables,
- cache_add_list cache_empty context t_ty
+ (* cache_add_list cache_empty context t_ty *)
+ cache_empty
;;
(*
(* let signature = MetadataQuery.signature_of metasenv goal in *)
(PrimitiveTactics.apply_tac term'')
(proof''',goal)
in
+
+
+ let (_,m,_,_,_,_ as p) =
+ let pu,metasenv,subst,proof,px,py = proof'''' in
+ let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in
+ let proof'''' = pu,metasenv,subst,proof,px,py in
+ let univ, params = params in
+ let use_context = bool params "use_context" true in
+ let universe, (active,passive,bag), cache =
+ init_cache_and_tables ~use_library:false ~use_context
+ automation_cache univ (proof'''',newmeta)
+ in
+ match
+ Saturation.given_clause bag (proof'''',newmeta) active passive
+ 1 0 infinity
+ with
+ | None, active, passive, bag ->
+ raise (ProofEngineTypes.Fail (lazy ("paramod fails")))
+ | Some(subst',(pu,metasenv,_,proof,px, py),open_goals),active,
+ passive,bag ->
+ assert_subst_are_disjoint subst subst';
+ let subst = subst@subst' in
+ pu,metasenv,subst,proof,px,py
+ in
+
+(*
let (_,m,_,_,_,_ as p),_ =
solve_rewrite ~params ~automation_cache (proof'''',newmeta)
in
+*)
+
let open_goals =
ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv' ~newmetasenv:m
in
(active,passive,bag), cache, flags
end
else
+ begin
+ debug_print (lazy ("NARROWING DEL GOAL: " ^
+ string_of_int goalno ^ " " ^ ppterm goalty ));
+ let goal_steps, saturation_steps, timeout =
+ 1,0,flags.timeout
+ in
+ match
+ Saturation.given_clause bag status active passive
+ goal_steps saturation_steps timeout
+ with
+ | None, active, passive, bag ->
+ [], (active,passive,bag), cache, flags
+ | Some(subst',(_,metasenv,_subst,proof,_, _),open_goals),active,
+ passive,bag ->
+ assert_subst_are_disjoint subst subst';
+ let subst = subst@subst' in
+ let open_goals =
+ order_new_goals metasenv subst open_goals ppterm
+ in
+ let open_goals =
+ List.map (fun (x,sort) -> x,depth-1,sort) open_goals
+ in
+ incr candidate_no;
+ [(!candidate_no,proof),metasenv,subst,open_goals],
+ (active,passive,bag), cache, flags
+ end
+(*
begin
let params = ([],["use_context","false"]) in
let automation_cache = {
in
try
let ((_,metasenv,subst,_,_,_),open_goals) =
+
solve_rewrite ~params ~automation_cache
(fake_proof, goalno)
in
res', (active,passive,bag), cache, flags
*)
end
+*)
;;
let sort_new_elems =
let smart_candidates =
List.filter
(fun x -> not(List.mem x candidates)) smart_candidates
- in
+ in
+ let debug_msg =
+ (lazy ("smart_candidates" ^ " = " ^
+ (String.concat "\n" (List.map CicPp.ppterm smart_candidates)))) in
+ debug_print debug_msg;
let candidates = List.filter (only signature context metasenv) candidates in
let smart_candidates =
List.filter (only signature context metasenv) smart_candidates
try_candidate dbd goalty
tables subst fake_proof goalno depth context cand
with
- | None, tables -> tables, elems
+ | None, tables ->
+ (* if normal application fails we try to be smart *)
+ (match try_smart_candidate dbd goalty
+ tables subst fake_proof goalno depth context cand
+ with
+ | None, tables -> tables, elems
+ | Some x, tables -> tables, x::elems)
| Some x, tables -> tables, x::elems)
(tables,[]) candidates
in