]> matita.cs.unibo.it Git - helm.git/blob - components/tactics/paramodulation/equality.mli
tagged 0.5.0-rc1
[helm.git] / 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_equality :
56   equality_bag -> int * proof * 
57   (Cic.term * Cic.term * Cic.term * Utils.comparison) *
58   Cic.metasenv -> 
59     equality
60
61 val mk_tmp_equality :
62  int * (Cic.term * Cic.term * Cic.term * Utils.comparison) * Cic.metasenv -> 
63     equality
64     
65 val open_equality :
66   equality ->
67     int * proof * 
68     (Cic.term * Cic.term * Cic.term * Utils.comparison) *
69     Cic.metasenv * int
70 val depend : equality_bag -> equality -> int -> bool
71 val compare : equality -> equality -> int
72 val max_weight_in_proof : equality_bag -> int -> proof -> int
73 val max_weight : equality_bag -> goal_proof -> proof -> int
74 val string_of_equality : 
75   ?env:Utils.environment -> equality -> string
76 val string_of_proof : 
77   ?names:(Cic.name option)list -> equality_bag -> proof -> goal_proof -> string
78 (* given a proof and a list of meta indexes we are interested in the
79  * instantiation gives back the cic proof and the list of instantiations *)  
80 (* build_goal_proof [eq_URI] [goal_proof] [initial_proof] [ty] 
81  *  [ty] is the type of the goal *)
82 val build_goal_proof: 
83   equality_bag ->
84   UriManager.uri -> goal_proof -> proof -> Cic.term-> int list -> 
85     Cic.context -> Cic.metasenv -> 
86     Cic.term * Cic.term list
87 val build_proof_term :
88   equality_bag ->
89   UriManager.uri -> (int * Cic.term) list -> int -> proof -> Cic.term
90 val refl_proof: UriManager.uri -> Cic.term -> Cic.term -> Cic.term 
91 (** ensures that metavariables in equality are unique *)
92 val fix_metas_goal: int -> goal -> int * goal
93 val fix_metas: equality_bag -> int -> equality -> int * equality
94 val metas_of_proof: equality_bag -> proof -> int list
95
96 (* this should be used _only_ to apply (efficiently) this subst on the 
97  * initial proof passed to build_goal_proof *)
98 val add_subst : Subst.substitution -> proof -> proof
99 exception TermIsNotAnEquality;;
100
101 (**
102    raises TermIsNotAnEquality if term is not an equation.
103    The first Cic.term is a proof of the equation
104 *)
105 val equality_of_term: equality_bag -> Cic.term -> Cic.term -> equality
106
107 (**
108    Re-builds the term corresponding to this equality
109 *)
110 val term_of_equality: UriManager.uri -> equality -> Cic.term
111 val term_is_equality: Cic.term -> bool
112
113 (** tests a sort of alpha-convertibility between the two terms, but on the
114     metavariables *)
115 val meta_convertibility: Cic.term -> Cic.term -> bool
116
117 (** meta convertibility between two equations *)
118 val meta_convertibility_eq: equality -> equality -> bool
119 val meta_convertibility_subst: 
120   Cic.term -> Cic.term -> Cic.metasenv -> Cic.substitution option
121
122 val is_weak_identity: equality -> bool
123 val is_identity: Utils.environment -> equality -> bool
124
125 (* symmetric [eq_ty] [l] [id] [uri] [m] 
126  *
127  * given an equality (_,p,(_,[l],r,_),[m],[id]) of 'type' l=r
128  * returns the proof of the symmetric (r=l).
129  *
130  * [uri] is the uri of eq
131  * [eq_ty] the ty of the equality sides
132  *)
133 val symmetric:
134   equality_bag -> Cic.term -> Cic.term -> int -> UriManager.uri ->
135     Cic.metasenv -> proof
136
137 (* takes 3 lists of alive ids (they are threated the same way, the type is
138  * funny just to not oblige you to concatenate them) and drops all the dead
139  * equalities *)
140 val collect: equality_bag -> int list -> int list -> int list -> unit
141
142 (* given an equality, returns the numerical id *)
143 val id_of: equality -> int
144
145 (* profiling statistics *)
146 val get_stats: unit -> string
147