0
|
1 |
(* Title: ZF/ex/bin.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1993 University of Cambridge
|
|
5 |
|
|
6 |
Datatype of binary integers
|
|
7 |
*)
|
|
8 |
|
|
9 |
(*Example of a datatype with an infix constructor*)
|
|
10 |
structure Bin = Datatype_Fun
|
|
11 |
(val thy = Univ.thy;
|
|
12 |
val rec_specs =
|
|
13 |
[("bin", "univ(0)",
|
|
14 |
[(["Plus", "Minus"], "i"),
|
|
15 |
(["op $$"], "[i,i]=>i")])];
|
|
16 |
val rec_styp = "i";
|
|
17 |
val ext = Some (NewSext {
|
|
18 |
mixfix =
|
|
19 |
[Infixl("$$", "[i,i] => i", 60)],
|
|
20 |
xrules = [],
|
|
21 |
parse_ast_translation = [],
|
|
22 |
parse_preproc = None,
|
|
23 |
parse_postproc = None,
|
|
24 |
parse_translation = [],
|
|
25 |
print_translation = [],
|
|
26 |
print_preproc = None,
|
|
27 |
print_postproc = None,
|
|
28 |
print_ast_translation = []});
|
|
29 |
val sintrs =
|
|
30 |
["Plus : bin",
|
|
31 |
"Minus : bin",
|
|
32 |
"[| w: bin; b: bool |] ==> w$$b : bin"];
|
|
33 |
val monos = [];
|
|
34 |
val type_intrs = bool_into_univ::data_typechecks;
|
|
35 |
val type_elims = []);
|
|
36 |
|
|
37 |
(*Perform induction on l, then prove the major premise using prems. *)
|
|
38 |
fun bin_ind_tac a prems i =
|
|
39 |
EVERY [res_inst_tac [("x",a)] Bin.induct i,
|
|
40 |
rename_last_tac a ["1"] (i+3),
|
|
41 |
ares_tac prems i];
|
|
42 |
|