]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/tactics/paramodulation/equality.mli
Preparing for 0.5.9 release.
[helm.git] / helm / software / components / tactics / paramodulation / equality.mli
1 (* Copyright (C) 2006, 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://helm.cs.unibo.it/
24  *)
25
26 type rule = SuperpositionRight | SuperpositionLeft | Demodulation
27
28 (* every equality group has its own bag. the bag contains the infos necessary
29  * for building the proof. FIXME: should also contain maxmeta! *)
30 type equality_bag
31
32 val mk_equality_bag: unit -> equality_bag
33
34 type equality 
35
36 and proof =
37     Exact of Cic.term
38   | Step of Subst.substitution * (rule * int * (Utils.pos * int) * Cic.term)
39
40 and goal_proof = (rule * Utils.pos * int * Subst.substitution * Cic.term) list
41
42 type goal = goal_proof * Cic.metasenv * Cic.term
43
44 val pp_proof: 
45   equality_bag ->
46   (Cic.name option) list -> goal_proof -> proof -> Subst.substitution -> int ->
47     Cic.term -> string
48
49 val draw_proof:
50   equality_bag ->
51   (Cic.name option) list -> goal_proof -> proof -> int -> unit
52
53 val pp_proofterm: Cic.term -> string
54
55 val mk_eq_ind : 
56     UriManager.uri ->
57     Cic.term ->
58     Cic.term -> 
59     Cic.term -> 
60     Cic.term -> 
61     Cic.term -> 
62     Cic.term -> 
63     Cic.term
64     
65 val mk_equality :
66   equality_bag -> int * proof * 
67   (Cic.term * Cic.term * Cic.term * Utils.comparison) *
68   Cic.metasenv -> equality_bag * equality
69
70 val mk_tmp_equality :
71  int * (Cic.term * Cic.term * Cic.term * Utils.comparison) * Cic.metasenv -> 
72     equality
73     
74 val open_equality :
75   equality ->
76     int * proof * 
77     (Cic.term * Cic.term * Cic.term * Utils.comparison) *
78     Cic.metasenv * int
79 val depend : equality_bag -> equality -> int -> bool
80 val compare : equality -> equality -> int
81 val max_weight_in_proof : equality_bag -> int -> proof -> int
82 val max_weight : equality_bag -> goal_proof -> proof -> int
83 val string_of_equality : 
84   ?env:Utils.environment -> equality -> string
85 val string_of_proof : 
86   ?names:(Cic.name option)list -> equality_bag -> proof -> goal_proof -> string
87 (* given a proof and a list of meta indexes we are interested in the
88  * instantiation gives back the cic proof and the list of instantiations *)  
89 (* build_goal_proof [eq_URI] [goal_proof] [initial_proof] [ty] 
90  *  [ty] is the type of the goal *)
91 val build_goal_proof: 
92   ?contextualize:bool -> 
93   ?forward:bool ->
94   equality_bag ->
95   UriManager.uri -> goal_proof -> proof -> Cic.term-> int list -> 
96     Cic.context -> Cic.metasenv -> 
97     Cic.term * Cic.term list
98 val build_proof_term :
99   equality_bag ->
100   UriManager.uri -> (int * Cic.term) list -> int -> proof -> Cic.term
101 val refl_proof: UriManager.uri -> Cic.term -> Cic.term -> Cic.term 
102 (** ensures that metavariables in equality are unique *)
103 val fix_metas_goal: equality_bag -> goal -> equality_bag * goal
104 val fix_metas: equality_bag -> equality -> equality_bag * equality
105 val metas_of_proof: equality_bag -> proof -> int list
106
107 (* this should be used _only_ to apply (efficiently) this subst on the 
108  * initial proof passed to build_goal_proof *)
109 val add_subst : Subst.substitution -> proof -> proof
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: 
117    equality_bag -> Cic.term -> Cic.term -> Cic.metasenv ->
118     equality_bag * equality
119
120 (**
121    Re-builds the term corresponding to this equality
122 *)
123 val term_of_equality: UriManager.uri -> equality -> Cic.term
124 val term_is_equality: Cic.term -> bool
125
126 val saturate_term : 
127      equality_bag -> Cic.metasenv -> Cic.substitution -> Cic.context -> Cic.term ->
128          equality_bag * Cic.term * Cic.metasenv * Cic.term list
129
130 val push_maxmeta : equality_bag -> int -> equality_bag 
131 val maxmeta : equality_bag -> int 
132 val filter_metasenv_gt_maxmeta: equality_bag -> Cic.metasenv -> Cic.metasenv
133
134 (** tests a sort of alpha-convertibility between the two terms, but on the
135     metavariables *)
136 val meta_convertibility: Cic.term -> Cic.term -> bool
137
138 (** meta convertibility between two equations *)
139 val meta_convertibility_eq: equality -> equality -> bool
140 val meta_convertibility_subst: 
141   Cic.term -> Cic.term -> Cic.metasenv -> Cic.substitution option
142
143 val is_weak_identity: equality -> bool
144 val is_identity: Utils.environment -> equality -> bool
145
146 val is_in: equality_bag -> int -> bool
147
148 (* symmetric [eq_ty] [l] [id] [uri] [m] 
149  *
150  * given an equality (_,p,(_,[l],r,_),[m],[id]) of 'type' l=r
151  * returns the proof of the symmetric (r=l).
152  *
153  * [uri] is the uri of eq
154  * [eq_ty] the ty of the equality sides
155  *)
156 val symmetric:
157   equality_bag -> Cic.term -> Cic.term -> int -> UriManager.uri ->
158     Cic.metasenv -> equality_bag * proof
159
160 (* takes 3 lists of alive ids (they are threated the same way, the type is
161  * funny just to not oblige you to concatenate them) and drops all the dead
162  * equalities *)
163 val collect: equality_bag -> int list -> int list -> int list -> equality_bag 
164
165 (* given an equality, returns the numerical id *)
166 val id_of: equality -> int
167
168 (* profiling statistics *)
169 val get_stats: unit -> string
170