forked from HOL-Theorem-Prover/HOL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhurdUtils.sig
370 lines (336 loc) · 13.4 KB
/
hurdUtils.sig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
signature hurdUtils =
sig
(* GENERAL *)
type 'a thunk = unit -> 'a
type 'a susp = 'a Susp.susp
type ('a, 'b) maplet = {redex : 'a, residue : 'b}
type ('a, 'b) subst = ('a, 'b) Lib.subst
(* Error handling *)
val ERR : string -> string -> exn
val BUG : string -> string -> exn
val BUG_to_string : exn -> string
val err_BUG : string -> exn -> exn
(* Success and failure *)
val assert : bool -> exn -> unit
val try : ('a -> 'b) -> 'a -> 'b
val total : ('a -> 'b) -> 'a -> 'b option
val can : ('a -> 'b) -> 'a -> bool
val partial : exn -> ('a -> 'b option) -> 'a -> 'b
(* Exception combinators *)
val nof : 'a -> 'b
val allf : 'a -> 'a
val thenf : ('a -> 'b) * ('b -> 'c) -> 'a -> 'c
val orelsef : ('a -> 'b) * ('a -> 'b) -> 'a -> 'b
val tryf : ('a -> 'a) -> 'a -> 'a
val repeatf : ('a -> 'a) -> 'a -> 'a
val repeatplusf : ('a -> 'a) -> 'a -> 'a
val firstf : ('a -> 'b) list -> 'a -> 'b
(* Combinators *)
val A : ('a -> 'b) -> 'a -> 'b
val C : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
val I : 'a -> 'a
val K : 'a -> 'b -> 'a
val N : int -> ('a -> 'a) -> 'a -> 'a
val S : ('a -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'c
val W : ('a -> 'a -> 'b) -> 'a -> 'b
val oo : ('a -> 'b) * ('c -> 'd -> 'a) -> 'c -> 'd -> 'b
(* Pairs *)
val ## : ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd
val D : 'a -> 'a * 'a
val Df : ('a -> 'b) -> ('a * 'a -> 'b * 'b)
val fst : 'a * 'b -> 'a
val snd : 'a * 'b -> 'b
val add_fst : 'a -> 'b -> 'a * 'b
val add_snd : 'a -> 'b -> 'b * 'a
val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c
val equal : ''a -> ''a -> bool
val pair_to_string : ('a -> string) -> ('b -> string) -> 'a * 'b -> string
(* Integers *)
val plus : int -> int -> int
val multiply : int -> int -> int
val succ : int -> int
(* Strings *)
val concat : string -> string -> string
val int_to_string : int -> string
val string_to_int : string -> int
val mk_string_fn : string -> string list -> string
val dest_string_fn : string -> string -> string list
val is_string_fn : string -> string -> bool
(* Debugging *)
val time_n : int -> ('a -> 'b) -> 'a -> unit
val tt : ('a -> 'b) -> 'a -> 'b
val tt2 : ('a -> 'b -> 'c) -> 'a -> 'b -> 'c
val tt3 : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> 'd
val tt4 : ('a -> 'b -> 'c -> 'd -> 'e) -> 'a -> 'b -> 'c -> 'd -> 'e
val ff : ('a -> 'b) -> 'a -> unit
val ff2 : ('a -> 'b -> 'c) -> 'a -> 'b -> unit
val ff3 : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> unit
val ff4 : ('a -> 'b -> 'c -> 'd -> 'e) -> 'a -> 'b -> 'c -> 'd -> unit
(* Useful imperative features *)
val new_int : unit -> int
val random_generator : Random.generator
val random_integer : int -> int
val random_real : unit -> real
val pair_susp : 'a susp -> 'b susp -> ('a * 'b) susp
val susp_map : ('a -> 'b) -> 'a susp -> 'b susp
(* Options *)
val is_some : 'a option -> bool
val grab : 'a option -> 'a
val o_pair : 'a option * 'b -> ('a * 'b) option
val pair_o : 'a * 'b option -> ('a * 'b) option
val o_pair_o : 'a option * 'b option -> ('a * 'b) option
val app_o : ('a -> 'b) -> 'a option -> 'b option
val o_app : ('a -> 'b) option -> 'a -> 'b option
val o_app_o : ('a -> 'b) option -> 'a option -> 'b option
val partial_app_o : ('a -> 'b option) -> 'a option -> 'b option
val partial_o_app : ('a -> 'b option) option -> 'a -> 'b option
val partial_o_app_o : ('a -> 'b option) option -> 'a option -> 'b option
val option_to_list : 'a option -> 'a list
(* Lists *)
val cons : 'a -> 'a list -> 'a list
val append : 'a list -> 'a list -> 'a list
val wrap : 'a -> 'a list
val unwrap : 'a list -> 'a
val fold : ('a -> 'b -> 'b) -> 'b -> 'a list -> 'b
val trans : ('a -> 'b -> 'b) -> 'b -> 'a list -> 'b
val partial_trans : ('a -> 'b -> 'b option) -> 'b -> 'a list -> 'b option
val first : ('a -> bool) -> 'a list -> 'a
val partial_first : ('a -> 'b option) -> 'a list -> 'b option
val forall : ('a -> bool) -> 'a list -> bool
val exists : ('a -> bool) -> 'a list -> bool
val index : ('a -> bool) -> 'a list -> int
val nth : int -> 'a list -> 'a
val split_after : int -> 'a list -> 'a list * 'a list
val assoc : ''a -> (''a * 'b) list -> 'b
val rev_assoc : ''a -> ('b * ''a) list -> 'b
val map : ('a -> 'b) -> 'a list -> 'b list
val partial_map : ('a -> 'b option) -> 'a list -> 'b list
val zip : 'a list -> 'b list -> ('a * 'b) list
val zipwith : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val partial_zipwith : ('a -> 'b -> 'c option) -> 'a list -> 'b list -> 'c list
val cart : 'a list -> 'b list -> ('a * 'b) list
val cartwith : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val partial_cartwith :
('a -> 'b -> 'c option) -> 'a list -> 'b list -> 'c list
val list_to_string : ('a -> string) -> 'a list -> string
(* Lists as sets *)
val subset : ''a list -> ''a list -> bool
val distinct : ''a list -> bool
val union2 : ''a list * ''b list -> ''a list * ''b list -> ''a list * ''b list
(* Permutations and sorting (order functions should always be <=) *)
val rotations : 'a list -> ('a * 'a list) list
val rotate : int -> ('a list -> 'a * 'a list)
val rotate_random : 'a list -> 'a * 'a list
val permutations : 'a list -> 'a list list
val permute : int list -> 'a list -> 'a list
val permute_random : 'a list -> 'a list
val min : ('a -> 'a -> bool) -> 'a list -> 'a
val merge : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
val sort : ('a -> 'a -> bool) -> 'a list -> 'a list
val top_min : ('a -> 'a -> bool option) -> 'a list -> 'a * 'a list
val top_sort : ('a -> 'a -> bool option) -> 'a list -> 'a list
(* Sums *)
datatype ('a, 'b) sum = LEFT of 'a | RIGHT of 'b
(* Streams *)
datatype ('a) stream = STREAM_NIL | STREAM_CONS of ('a * 'a stream thunk)
val stream_null : 'a stream -> bool
val dest_stream_cons : 'a stream -> 'a * 'a stream thunk
val stream_hd : 'a stream -> 'a
val stream_tl : 'a stream -> 'a stream thunk
val stream_to_list : 'a stream -> 'a list
val stream_append : 'a stream thunk -> 'a stream thunk -> 'a stream thunk
val stream_concat : 'a stream thunk list -> 'a stream thunk
(* Trees *)
datatype ('a, 'b) tree = BRANCH of 'a * ('a, 'b) tree list | LEAF of 'b
val tree_size : ('a, 'b) tree -> int
val tree_fold : ('a -> 'b list -> 'b) -> ('c -> 'b) -> ('a, 'c) tree -> 'b
val tree_trans :
('a -> 'b -> 'b) -> ('c -> 'b -> 'd) -> 'b -> ('a, 'c) tree -> 'd list
val tree_partial_trans :
('a -> 'b -> 'b option) -> ('c -> 'b -> 'd option) -> 'b ->
('a, 'c) tree -> 'd list
(* Pretty-printing *)
val pp_map : ('a -> 'b) -> 'b PP.pprinter -> 'a PP.pprinter
val pp_string : string PP.pprinter
val pp_unknown : 'a PP.pprinter
val pp_int : int PP.pprinter
val pp_pair : 'a PP.pprinter -> 'b PP.pprinter -> ('a * 'b) PP.pprinter
val pp_list : 'a PP.pprinter -> 'a list PP.pprinter
(* Substitutions *)
val redex : ('a, 'b) maplet -> 'a
val residue : ('a, 'b) maplet -> 'b
val maplet_map : ('a -> 'c) * ('b -> 'd) -> ('a, 'b) maplet -> ('c, 'd) maplet
val find_redex : ''a -> (''a, 'b) subst -> (''a, 'b) maplet
val clean_subst : (''a, ''a) subst -> (''a, ''a) subst
val subst_vars : ('a, 'b) subst -> 'a list
val subst_map : ('a -> 'c) * ('b -> 'd) -> ('a, 'b) subst -> ('c, 'd) subst
val redex_map : ('a -> 'c) -> ('a, 'b) subst -> ('c, 'b) subst
val residue_map : ('b -> 'c) -> ('a, 'b) subst -> ('a, 'c) subst
val is_renaming_subst : ''b list -> ('a, ''b) subst -> bool
val invert_renaming_subst : ''b list -> ('a, ''b) subst -> (''b, 'a) subst
(* HOL Types *)
type 'a set = 'a HOLset.set
type hol_type = Type.hol_type
type term = Term.term
type thm = Thm.thm
type goal = term list * term
type conv = term -> thm
type rule = thm -> thm
type validation = thm list -> thm
type tactic = goal -> goal list * validation
type thm_tactic = thm -> tactic
type thm_tactical = thm_tactic -> thm_tactic
type vars = term list * hol_type list
type vterm = vars * term
type vthm = vars * thm
type type_subst = (hol_type, hol_type) subst
type term_subst = (term, term) subst
type substitution = term_subst * type_subst
type ho_substitution = substitution * thm thunk
type raw_substitution = (term_subst * term set) * (type_subst * hol_type list)
type ho_raw_substitution = raw_substitution * thm thunk
(* General *)
val profile : ('a -> 'b) -> 'a -> 'b
val parse_with_goal : term frag list -> goal -> term
val PARSE_TAC : (term -> tactic) -> term frag list -> tactic
(* Term/type substitutions *)
val empty_subst : substitution
val type_inst : type_subst -> hol_type -> hol_type
val inst_ty : type_subst -> term -> term
val pinst : substitution -> term -> term
val type_subst_vars_in_set : type_subst -> hol_type list -> bool
val subst_vars_in_set : substitution -> vars -> bool
val type_refine_subst : type_subst -> type_subst -> type_subst
val refine_subst : substitution -> substitution -> substitution
val type_vars_after_subst : hol_type list -> type_subst -> hol_type list
val vars_after_subst : vars -> substitution -> vars
val type_invert_subst : hol_type list -> type_subst -> type_subst
val invert_subst : vars -> substitution -> substitution
val clean_tsubst : term_subst -> term_subst
val tfind_redex : term -> (term, 'b) subst -> (term, 'b) maplet
(* Logic variables *)
val empty_vars : vars
val is_tyvar : vars -> hol_type -> bool
val is_tmvar : vars -> term -> bool
val type_new_vars : hol_type list -> hol_type list * (type_subst * type_subst)
val term_new_vars : term list -> term list * (term_subst * term_subst)
val new_vars : vars -> vars * (substitution * substitution)
val vars_eq : vars -> vars -> bool
val vars_union : vars -> vars -> vars
(* Bound variables *)
val dest_bv : term list -> term -> int
val is_bv : term list -> term -> bool
val mk_bv : term list -> int -> term
(* Terms *)
val type_vars_in_terms : term list -> hol_type list
val list_dest_comb : term -> term * term list
val conjuncts : term -> term list
val dest_unaryop : string -> term -> term
val is_unaryop : string -> (term -> bool)
val dest_binop : string -> term -> term * term
val is_binop : string -> (term -> bool)
val dest_imp : term -> term * term
val is_imp : term -> bool
val dest_foralls : term -> term list * term
val mk_foralls : term list * term -> term
val spec : term -> term -> term
val specl : term list -> term -> term
val var_match : vars -> term -> term -> substitution
(* Theorems *)
val FUN_EQ : thm
val SET_EQ : thm
val hyps : thm list -> term list
val LHS : thm -> term
val RHS : thm -> term
val INST_TY : type_subst -> thm -> thm
val PINST : substitution -> thm -> thm
(* Conversions *)
val FIRSTC : conv list -> conv
val TRYC : conv -> conv
val REPEATPLUSC : conv -> conv
val REPEATC_CUTOFF : int -> conv -> conv
val DEPTH_ONCE_CONV : conv -> conv
val FORALLS_CONV : conv -> conv
val CONJUNCT_CONV : conv -> conv
val EXACT_CONV : term -> conv
val NEGNEG_CONV : conv
val FUN_EQ_CONV : conv
val SET_EQ_CONV : conv
val N_BETA_CONV : int -> conv
val EQ_NEG_BOOL_CONV : conv
val GENVAR_ALPHA_CONV : conv
val GENVAR_BVARS_CONV : conv
val ETA_EXPAND_CONV : term -> conv
val GENVAR_ETA_EXPAND_CONV : conv
(* Rules *)
val THENR : rule * rule -> rule
val REPEATR : rule -> rule
val ORELSER : rule * rule -> rule
val TRYR : rule -> rule
val ALL_RULE : rule
val EVERYR : rule list -> rule
val FORALL_IMP : rule
val EQ_BOOL_INTRO : rule
val GENVAR_BVARS : rule
val GENVAR_SPEC : rule
val GENVAR_SPEC_ALL : rule
val REV_CONJUNCTS : thm list -> thm
val REORDER_ASMS : term list -> rule
val NEW_CONST_RULE : term -> rule
val GENVAR_CONST_RULE : rule
val ZAP_CONSTS_RULE : rule
(* Variable theorem (vthm) operations *)
val thm_to_vthm : thm -> vthm
val vthm_to_thm : vthm -> thm
val clean_vthm : vthm -> vthm
val var_GENVAR_SPEC : vthm -> vthm
val var_CONJUNCTS : vthm -> vthm list
val var_MATCH_MP : thm -> vthm -> vthm
(* Discharging assumptions onto the lhs of an implication *)
val DISCH_CONJ_CONV : conv
val DISCH_CONJ : term -> rule
val DISCH_CONJUNCTS : term list -> rule
val DISCH_CONJUNCTS_ALL : rule
val DISCH_CONJUNCTS_FILTER : (term -> bool) -> rule
val DISCH_CONJ_TAC : tactic
val DISCH_CONJUNCTS_TAC : tactic
val UNDISCH_CONJ_CONV : conv
val UNDISCH_CONJ : rule
val UNDISCH_CONJUNCTS : rule
val UNDISCH_CONJ_TAC : term -> tactic
val UNDISCH_CONJUNCTS_TAC : tactic
(* Tactics *)
val PURE_CONV_TAC : conv -> tactic
val ASMLIST_CASES : tactic -> (term -> tactic) -> tactic
val POP_ASSUM_TAC : tactic -> tactic
val TRUTH_TAC : tactic
val S_TAC : tactic
val Strip : tactic
val K_TAC : 'a -> tactic
val KILL_TAC : tactic
val CONJUNCTS_TAC : tactic
val FUN_EQ_TAC : tactic
val SET_EQ_TAC : tactic
val CHECK_ASMS_TAC : tactic
val EXACT_MP_TAC : thm_tactic
val STRONG_CONJ_TAC : tactic
val STRONG_DISJ_TAC : tactic
val FORWARD_TAC : (thm list -> thm list) -> tactic
val Know : term quotation -> tactic
val Suff : term quotation -> tactic
val POP_ORW : tactic
val Cond : tactic
val Rewr : tactic
val Rewr' : tactic
val art : thm list -> tactic (* ASM_REWRITE_TAC *)
(* Simple CNF conversion *)
val CNF_CONV : conv
val CNF_RULE : rule
val CNF_EXPAND : thm -> thm list
val CNF_TAC : tactic
(* ASM_MATCH_MP_TAC *)
val MATCH_MP_DEPTH : int -> thm list -> thm list -> thm list
val ASM_MATCH_MP_TAC_N : int -> thm list -> tactic
val ASM_MATCH_MP_TAC : thm list -> tactic
end