]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/paramodulation/inference.mli
ocaml 3.09 transition
[helm.git] / helm / ocaml / paramodulation / inference.mli
1 (* Copyright (C) 2005, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 type equality =
27     int *                (* weight *)
28     proof *              (* proof *)
29     (Cic.term *          (* type *)
30      Cic.term *          (* left side *)
31      Cic.term *          (* right side *)
32      Utils.comparison) * (* ordering *)  
33     Cic.metasenv *       (* environment for metas *)
34     Cic.term list        (* arguments *)
35
36 and proof =
37   | NoProof
38   | BasicProof of Cic.term (* already a proof of a goal *)
39   | ProofBlock of (* proof of a rewrite step *)
40       Cic.substitution * UriManager.uri * (* eq_ind or eq_ind_r *)
41         (Cic.name * Cic.term) * Cic.term * (Utils.pos * equality) * proof
42   | ProofGoalBlock of proof * proof
43       (* proof of the new meta, proof of the goal from which this comes *)
44   | ProofSymBlock of Cic.term list * proof (* expl.named subst, proof *)
45   | SubProof of Cic.term * int * proof
46       (* parent proof, subgoal, proof of the subgoal *)
47
48 type environment = Cic.metasenv * Cic.context * CicUniv.universe_graph
49
50 (** builds the Cic.term encoded by proof *)
51 val build_proof_term: proof -> Cic.term
52
53 val string_of_proof: proof -> string
54
55 exception MatchingFailure
56
57 (** matching between two terms. Can raise MatchingFailure *)
58 val matching:
59   Cic.metasenv -> Cic.context -> Cic.term -> Cic.term ->
60   CicUniv.universe_graph ->
61   Cic.substitution * Cic.metasenv * CicUniv.universe_graph
62
63 (**
64    special unification that checks if the two terms are "simple", and in
65    such case should be significantly faster than CicUnification.fo_unif
66 *)
67 val unification:
68   Cic.metasenv -> Cic.context -> Cic.term -> Cic.term ->
69   CicUniv.universe_graph ->
70   Cic.substitution * Cic.metasenv * CicUniv.universe_graph
71
72     
73 (**
74    scans the context to find all Declarations "left = right"; returns a
75    list of tuples (proof, (type, left, right), newmetas). Uses
76    PrimitiveTactics.new_metasenv_for_apply to replace bound variables with
77    fresh metas...
78 *)
79 val find_equalities:
80   Cic.context -> ProofEngineTypes.proof -> int list * equality list * int
81
82 (**
83    searches the library for equalities that can be applied to the current goal
84 *)
85 val find_library_equalities:
86   HMysql.dbd -> Cic.context -> ProofEngineTypes.status -> int ->
87   UriManager.UriSet.t * (UriManager.uri * equality) list * int
88
89 (**
90    searches the library for theorems that are not equalities (returned by the
91    function above)
92 *)
93 val find_library_theorems:
94   HMysql.dbd -> environment -> ProofEngineTypes.status -> UriManager.UriSet.t ->
95   (Cic.term * Cic.term * Cic.metasenv) list
96
97 (**
98    searches the context for hypotheses that are not equalities
99 *)
100 val find_context_hypotheses:
101   environment -> int list -> (Cic.term * Cic.term * Cic.metasenv) list
102
103
104 exception TermIsNotAnEquality;;
105
106 (**
107    raises TermIsNotAnEquality if term is not an equation.
108    The first Cic.term is a proof of the equation
109 *)
110 val equality_of_term: Cic.term -> Cic.term -> equality
111
112 val term_is_equality: Cic.term -> bool
113
114 (** tests a sort of alpha-convertibility between the two terms, but on the
115     metavariables *)
116 val meta_convertibility: Cic.term -> Cic.term -> bool
117
118 (** meta convertibility between two equations *)
119 val meta_convertibility_eq: equality -> equality -> bool
120
121 val is_identity: environment -> equality -> bool
122
123 val string_of_equality: ?env:environment -> equality -> string
124
125 val metas_of_term: Cic.term -> int list
126
127 (** ensures that metavariables in equality are unique *)
128 val fix_metas: int -> equality -> int * equality