]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/ng_paramodulation/nCicParamod.ml
5fe0a34c1c074424ad958dbc1ce7498805df790d
[helm.git] / helm / software / components / ng_paramodulation / nCicParamod.ml
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic        
3     ||A||  Library of Mathematics, developed at the Computer Science     
4     ||T||  Department, University of Bologna, Italy.                     
5     ||I||                                                                
6     ||T||  HELM is free software; you can redistribute it and/or         
7     ||A||  modify it under the terms of the GNU General Public License   
8     \   /  version 2 or (at your option) any later version.      
9      \ /   This software is distributed as is, NO WARRANTY.     
10       V_______________________________________________________________ *)
11
12 (* $Id: orderings.ml 9869 2009-06-11 22:52:38Z denes $ *)
13
14 let nparamod rdb metasenv subst context t table =
15   let module C = 
16     struct
17       let metasenv = metasenv
18       let subst = subst
19       let context = context
20     end
21   in
22   let module B = NCicBlob.NCicBlob(C) in
23   let module P = Paramod.Paramod(B) in
24   let bag, maxvar = Terms.M.empty, 0 in
25   let (bag,maxvar), passives = 
26     HExtlib.list_mapi_acc (fun x _ a -> P.mk_passive a x) (bag,maxvar) table
27   in
28   let (bag,maxvar), goals = 
29     HExtlib.list_mapi_acc (fun x _ a -> P.mk_goal a x) (bag,maxvar) [t]
30   in
31   let solutions = P.paramod (bag,maxvar) ~g_passives:goals ~passives in
32   List.map 
33     (fun (bag,i,l) ->
34       let stamp = Unix.gettimeofday () in
35       let proofterm = NCicProof.mk_proof bag i l in
36       prerr_endline (Printf.sprintf "Got proof term in %fs"
37         (Unix.gettimeofday() -. stamp));
38       let metasenv, proofterm = 
39         let rec aux k metasenv = function
40           | NCic.Meta _ as t -> metasenv, t
41           | NCic.Implicit _ -> 
42               let metasenv,i,_,_=NCicMetaSubst.mk_meta metasenv context `Term in
43               metasenv, NCic.Meta (i,(k,NCic.Irl (List.length context)))
44           | t -> NCicUntrusted.map_term_fold_a 
45                   (fun _ k -> k+1) k aux metasenv t
46         in
47          aux 0 metasenv proofterm
48       in
49       let metasenv, subst, proofterm, _prooftype = 
50         NCicRefiner.typeof 
51           (rdb#set_coerc_db NCicCoercion.empty_db) 
52           metasenv subst context proofterm None
53       in
54       proofterm, metasenv, subst)
55     solutions
56 ;;
57   
58   
59
60