]> matita.cs.unibo.it Git - helm.git/blob - components/tactics/paramodulation/inference.mli
Naif substitution. Removed local context in metas during relocation.
[helm.git] / components / tactics / 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 val metas_of_proof_time : float ref
27
28 (* type substitution = Cic.substitution *)
29 type substitution = (int * Cic.term) list 
30
31 type equality =
32     int *                (* weight *)
33     proof *              (* proof *)
34     (Cic.term *          (* type *)
35      Cic.term *          (* left side *)
36      Cic.term *          (* right side *)
37      Utils.comparison) * (* ordering *)  
38     Cic.metasenv        (* environment for metas *)
39
40 and proof =
41   | NoProof   (* no proof *)
42   | BasicProof of substitution * Cic.term (* already a proof of a goal *)
43   | ProofBlock of (* proof of a rewrite step *)
44       substitution * UriManager.uri * (* eq_ind or eq_ind_r *)
45         (Cic.name * Cic.term) * Cic.term * (Utils.pos * equality) * proof
46   | ProofGoalBlock of proof * proof
47       (* proof of the new meta, proof of the goal from which this comes *)
48   | ProofSymBlock of Cic.term list * proof (* expl.named subst, proof *)
49   | SubProof of Cic.term * int * proof
50       (* parent proof, subgoal, proof of the subgoal *)
51
52 type environment = Cic.metasenv * Cic.context * CicUniv.universe_graph
53
54 (** builds the Cic.term encoded by proof *)
55 val build_proof_term: ?noproof:Cic.term -> proof -> Cic.term
56
57 val string_of_proof: proof -> string
58
59 val filter : substitution -> Cic.metasenv -> Cic.metasenv
60
61 exception MatchingFailure
62
63 (** matching between two terms. Can raise MatchingFailure *)
64 val matching:
65   Cic.metasenv -> Cic.metasenv -> Cic.context -> Cic.term -> Cic.term ->
66   CicUniv.universe_graph ->
67   substitution * Cic.metasenv * CicUniv.universe_graph
68
69 (**
70    special unification that checks if the two terms are "simple", and in
71    such case should be significantly faster than CicUnification.fo_unif
72 *)
73 val unification:
74   Cic.metasenv -> Cic.metasenv -> Cic.context -> Cic.term -> Cic.term ->
75   CicUniv.universe_graph ->
76   substitution * Cic.metasenv * CicUniv.universe_graph
77
78     
79 (**
80    scans the context to find all Declarations "left = right"; returns a
81    list of tuples (proof, (type, left, right), newmetas). Uses
82    PrimitiveTactics.new_metasenv_for_apply to replace bound variables with
83    fresh metas...
84 *)
85 val find_equalities:
86   Cic.context -> ProofEngineTypes.proof -> int list * equality list * int
87
88 (**
89    searches the library for equalities that can be applied to the current goal
90 *)
91 val find_library_equalities:
92   HMysql.dbd -> Cic.context -> ProofEngineTypes.status -> int ->
93   UriManager.UriSet.t * (UriManager.uri * equality) list * int
94
95 (**
96    searches the library for theorems that are not equalities (returned by the
97    function above)
98 *)
99 val find_library_theorems:
100   HMysql.dbd -> environment -> ProofEngineTypes.status -> UriManager.UriSet.t ->
101   (Cic.term * Cic.term * Cic.metasenv) list
102
103 (**
104    searches the context for hypotheses that are not equalities
105 *)
106 val find_context_hypotheses:
107   environment -> int list -> (Cic.term * Cic.term * Cic.metasenv) list
108
109
110 exception TermIsNotAnEquality;;
111
112 (**
113    raises TermIsNotAnEquality if term is not an equation.
114    The first Cic.term is a proof of the equation
115 *)
116 val equality_of_term: Cic.term -> Cic.term -> equality
117
118 (**
119    Re-builds the term corresponding to this equality
120 *)
121 val term_of_equality: equality -> Cic.term
122
123 val term_is_equality: Cic.term -> bool
124
125 (** tests a sort of alpha-convertibility between the two terms, but on the
126     metavariables *)
127 val meta_convertibility: Cic.term -> Cic.term -> bool
128
129 (** meta convertibility between two equations *)
130 val meta_convertibility_eq: equality -> equality -> bool
131
132 val is_weak_identity: environment -> equality -> bool
133 val is_identity: environment -> equality -> bool
134
135 val string_of_equality: ?env:environment -> equality -> string
136
137
138 val metas_of_term: Cic.term -> int list
139 val metas_of_proof: proof -> int list
140
141 (** ensures that metavariables in equality are unique *)
142 val fix_metas: int -> equality -> int * equality
143
144 val apply_subst: substitution -> Cic.term -> Cic.term
145 val ppsubst: substitution -> string