~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to pretyping/evd.mli

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
(************************************************************************)
 
3
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
 
4
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
 
5
(*   \VV/  **************************************************************)
 
6
(*    //   *      This file is distributed under the terms of the       *)
 
7
(*         *       GNU Lesser General Public License Version 2.1        *)
 
8
(************************************************************************)
 
9
 
 
10
(*i $Id: evd.mli 11865 2009-01-28 17:34:30Z herbelin $ i*)
 
11
 
 
12
(*i*)
 
13
open Util
 
14
open Names
 
15
open Term
 
16
open Sign
 
17
open Environ
 
18
open Libnames
 
19
open Mod_subst
 
20
open Termops
 
21
(*i*)
 
22
 
 
23
(* The type of mappings for existential variables.
 
24
   The keys are integers and the associated information is a record
 
25
   containing the type of the evar ([evar_concl]), the context under which 
 
26
   it was introduced ([evar_hyps]) and its definition ([evar_body]). 
 
27
   [evar_info] is used to add any other kind of information. *)
 
28
 
 
29
type evar = existential_key
 
30
 
 
31
type evar_body =
 
32
  | Evar_empty 
 
33
  | Evar_defined of constr
 
34
 
 
35
type evar_info = {
 
36
  evar_concl : constr;
 
37
  evar_hyps : named_context_val;
 
38
  evar_body : evar_body;
 
39
  evar_filter : bool list;
 
40
  evar_extra : Dyn.t option}
 
41
 
 
42
val eq_evar_info : evar_info -> evar_info -> bool
 
43
 
 
44
val make_evar : named_context_val -> types -> evar_info
 
45
val evar_concl : evar_info -> constr
 
46
val evar_context : evar_info -> named_context
 
47
val evar_filtered_context : evar_info -> named_context
 
48
val evar_hyps : evar_info -> named_context_val
 
49
val evar_body : evar_info -> evar_body
 
50
val evar_filter : evar_info -> bool list
 
51
val evar_unfiltered_env :  evar_info -> env
 
52
val evar_env :  evar_info -> env
 
53
 
 
54
type evar_map
 
55
val eq_evar_map : evar_map -> evar_map -> bool
 
56
 
 
57
val empty : evar_map
 
58
 
 
59
val add : evar_map -> evar -> evar_info -> evar_map
 
60
 
 
61
val dom : evar_map -> evar list
 
62
val find : evar_map -> evar -> evar_info
 
63
val remove : evar_map -> evar -> evar_map
 
64
val mem : evar_map -> evar -> bool
 
65
val to_list : evar_map -> (evar * evar_info) list
 
66
val fold : (evar -> evar_info -> 'a -> 'a) -> evar_map -> 'a -> 'a
 
67
 
 
68
val merge : evar_map -> evar_map -> evar_map
 
69
 
 
70
val define : evar_map -> evar -> constr -> evar_map
 
71
 
 
72
val is_evar : evar_map -> evar -> bool
 
73
 
 
74
val is_defined : evar_map -> evar -> bool
 
75
 
 
76
val string_of_existential : evar -> string
 
77
val existential_of_int : int -> evar
 
78
 
 
79
(*s [existential_value sigma ev] raises [NotInstantiatedEvar] if [ev] has
 
80
    no body and [Not_found] if it does not exist in [sigma] *)
 
81
 
 
82
exception NotInstantiatedEvar
 
83
val existential_value : evar_map -> existential -> constr
 
84
val existential_type : evar_map -> existential -> types
 
85
val existential_opt_value : evar_map -> existential -> constr option
 
86
 
 
87
(*********************************************************************)
 
88
(* constr with holes *)
 
89
type open_constr = evar_map * constr
 
90
 
 
91
(*********************************************************************)
 
92
(* The type constructor ['a sigma] adds an evar map to an object of
 
93
  type ['a] *)
 
94
type 'a sigma = {
 
95
  it : 'a ;
 
96
  sigma : evar_map}
 
97
 
 
98
val sig_it  : 'a sigma -> 'a
 
99
val sig_sig : 'a sigma -> evar_map
 
100
 
 
101
(*********************************************************************)
 
102
(* Meta map *)
 
103
 
 
104
module Metamap : Map.S with type key = metavariable
 
105
 
 
106
module Metaset : Set.S with type elt = metavariable
 
107
 
 
108
val meta_exists : (metavariable -> bool) -> Metaset.t -> bool
 
109
 
 
110
type 'a freelisted = {
 
111
  rebus : 'a;
 
112
  freemetas : Metaset.t }
 
113
 
 
114
val metavars_of : constr -> Metaset.t
 
115
val mk_freelisted : constr -> constr freelisted
 
116
val map_fl : ('a -> 'b) -> 'a freelisted -> 'b freelisted
 
117
 
 
118
(* Status of an instance found by unification wrt to the meta it solves:
 
119
  - a supertype of the meta (e.g. the solution to ?X <= T is a supertype of ?X)
 
120
  - a subtype of the meta (e.g. the solution to T <= ?X is a supertype of ?X)
 
121
  - a term that can be eta-expanded n times while still being a solution
 
122
    (e.g. the solution [P] to [?X u v = P u v] can be eta-expanded twice)
 
123
*)
 
124
 
 
125
type instance_constraint = 
 
126
    IsSuperType | IsSubType | ConvUpToEta of int | UserGiven
 
127
 
 
128
(* Status of the unification of the type of an instance against the type of
 
129
     the meta it instantiates:
 
130
   - CoerceToType means that the unification of types has not been done
 
131
     and that a coercion can still be inserted: the meta should not be
 
132
     substituted freely (this happens for instance given via the
 
133
     "with" binding clause).
 
134
   - TypeProcessed means that the information obtainable from the
 
135
     unification of types has been extracted.
 
136
   - TypeNotProcessed means that the unification of types has not been
 
137
     done but it is known that no coercion may be inserted: the meta
 
138
     can be substituted freely.
 
139
*)
 
140
 
 
141
type instance_typing_status =
 
142
    CoerceToType | TypeNotProcessed | TypeProcessed
 
143
 
 
144
(* Status of an instance together with the status of its type unification *)
 
145
 
 
146
type instance_status = instance_constraint * instance_typing_status
 
147
 
 
148
(* Clausal environments *)
 
149
 
 
150
type clbinding =
 
151
  | Cltyp of name * constr freelisted
 
152
  | Clval of name * (constr freelisted * instance_status) * constr freelisted
 
153
 
 
154
val map_clb : (constr -> constr) -> clbinding -> clbinding
 
155
 
 
156
(*********************************************************************)
 
157
(* Unification state *)
 
158
type evar_defs
 
159
 
 
160
(* Assume empty [evar_map] and [conv_pbs] *)
 
161
val subst_evar_defs_light : substitution -> evar_defs -> evar_defs
 
162
 
 
163
(* create an [evar_defs] with empty meta map: *)
 
164
val create_evar_defs      : evar_map -> evar_defs
 
165
val create_goal_evar_defs : evar_map -> evar_defs
 
166
val empty_evar_defs : evar_defs
 
167
val evars_of         : evar_defs -> evar_map
 
168
val evars_reset_evd  : evar_map ->  evar_defs -> evar_defs
 
169
 
 
170
(* Should the obligation be defined (opaque or transparent (default)) or
 
171
   defined transparent and expanded in the term? *)
 
172
 
 
173
type obligation_definition_status = Define of bool | Expand
 
174
 
 
175
(* Evars *)
 
176
type hole_kind =
 
177
  | ImplicitArg of global_reference * (int * identifier option)
 
178
  | BinderType of name
 
179
  | QuestionMark of obligation_definition_status
 
180
  | CasesType
 
181
  | InternalHole
 
182
  | TomatchTypeParameter of inductive * int
 
183
  | GoalEvar
 
184
  | ImpossibleCase
 
185
val is_defined_evar :  evar_defs -> existential -> bool
 
186
val is_undefined_evar :  evar_defs -> constr -> bool
 
187
val undefined_evars : evar_defs -> evar_defs
 
188
val evar_declare :
 
189
  named_context_val -> evar -> types -> ?src:loc * hole_kind ->
 
190
      ?filter:bool list -> evar_defs -> evar_defs
 
191
val evar_define : evar -> constr -> evar_defs -> evar_defs
 
192
val evar_source : existential_key -> evar_defs -> loc * hole_kind
 
193
 
 
194
(* [evar_merge evd evars] extends the evars of [evd] with [evars] *)
 
195
val evar_merge : evar_defs -> evar_map -> evar_defs
 
196
 
 
197
(* Unification constraints *)
 
198
type conv_pb = Reduction.conv_pb
 
199
type evar_constraint = conv_pb * env * constr * constr
 
200
val add_conv_pb :  evar_constraint -> evar_defs -> evar_defs
 
201
val extract_changed_conv_pbs : evar_defs -> 
 
202
      (existential_key list -> evar_constraint -> bool) ->
 
203
      evar_defs * evar_constraint list
 
204
val extract_all_conv_pbs : evar_defs -> evar_defs * evar_constraint list
 
205
 
 
206
 
 
207
(* Metas *)
 
208
val find_meta : evar_defs -> metavariable -> clbinding
 
209
val meta_list : evar_defs -> (metavariable * clbinding) list
 
210
val meta_defined : evar_defs -> metavariable -> bool
 
211
(* [meta_fvalue] raises [Not_found] if meta not in map or [Anomaly] if
 
212
   meta has no value *)  
 
213
val meta_fvalue    : evar_defs -> metavariable -> constr freelisted * instance_status
 
214
val meta_opt_fvalue : evar_defs -> metavariable -> (constr freelisted * instance_status) option
 
215
val meta_ftype     : evar_defs -> metavariable -> constr freelisted
 
216
val meta_name      : evar_defs -> metavariable -> name
 
217
val meta_with_name : evar_defs -> identifier -> metavariable
 
218
val meta_declare   :
 
219
  metavariable -> types -> ?name:name -> evar_defs -> evar_defs
 
220
val meta_assign    : metavariable -> constr * instance_status -> evar_defs -> evar_defs
 
221
val meta_reassign  : metavariable -> constr * instance_status -> evar_defs -> evar_defs
 
222
 
 
223
(* [meta_merge evd1 evd2] returns [evd2] extended with the metas of [evd1] *)
 
224
val meta_merge : evar_defs -> evar_defs -> evar_defs
 
225
 
 
226
val undefined_metas : evar_defs -> metavariable list
 
227
val metas_of : evar_defs -> metamap
 
228
val map_metas_fvalue : (constr -> constr) -> evar_defs -> evar_defs
 
229
 
 
230
type metabinding = metavariable * constr * instance_status
 
231
 
 
232
val retract_coercible_metas : evar_defs -> metabinding list * evar_defs
 
233
val subst_defined_metas : metabinding list -> constr -> constr option
 
234
 
 
235
(**********************************************************)
 
236
(* Sort variables *)
 
237
 
 
238
val new_sort_variable : evar_map -> sorts * evar_map
 
239
val is_sort_variable : evar_map -> sorts -> bool
 
240
val whd_sort_variable : evar_map -> constr -> constr
 
241
val set_leq_sort_variable : evar_map -> sorts -> sorts -> evar_map
 
242
val define_sort_variable : evar_map -> sorts -> sorts -> evar_map
 
243
 
 
244
(**********************************************************)
 
245
(* Failure explanation *)
 
246
 
 
247
type unsolvability_explanation = SeveralInstancesFound of int
 
248
 
 
249
(*********************************************************************)
 
250
(* debug pretty-printer: *)
 
251
 
 
252
val pr_evar_info : evar_info -> Pp.std_ppcmds
 
253
val pr_evar_map  : evar_map -> Pp.std_ppcmds
 
254
val pr_evar_defs : evar_defs -> Pp.std_ppcmds
 
255
val pr_sort_constraints : evar_map -> Pp.std_ppcmds
 
256
val pr_metaset : Metaset.t -> Pp.std_ppcmds