src/ZF/ex/bin.ML
changeset 0 a5a9c433f639
child 16 0b033d50ca1c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/ZF/ex/bin.ML	Thu Sep 16 12:20:38 1993 +0200
     1.3 @@ -0,0 +1,42 @@
     1.4 +(*  Title: 	ZF/ex/bin.ML
     1.5 +    ID:         $Id$
     1.6 +    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
     1.7 +    Copyright   1993  University of Cambridge
     1.8 +
     1.9 +Datatype of binary integers
    1.10 +*)
    1.11 +
    1.12 +(*Example of a datatype with an infix constructor*)
    1.13 +structure Bin = Datatype_Fun
    1.14 + (val thy = Univ.thy;
    1.15 +  val rec_specs = 
    1.16 +      [("bin", "univ(0)",
    1.17 +	  [(["Plus", "Minus"],	"i"),
    1.18 +	   (["op $$"],		"[i,i]=>i")])];
    1.19 +  val rec_styp = "i";
    1.20 +  val ext = Some (NewSext {
    1.21 +	     mixfix =
    1.22 +	      [Infixl("$$", "[i,i] => i", 60)],
    1.23 +	     xrules = [],
    1.24 +	     parse_ast_translation = [],
    1.25 +	     parse_preproc = None,
    1.26 +	     parse_postproc = None,
    1.27 +	     parse_translation = [],
    1.28 +	     print_translation = [],
    1.29 +	     print_preproc = None,
    1.30 +	     print_postproc = None,
    1.31 +	     print_ast_translation = []});
    1.32 +  val sintrs = 
    1.33 +	  ["Plus : bin",
    1.34 +	   "Minus : bin",
    1.35 +	   "[| w: bin;  b: bool |] ==> w$$b : bin"];
    1.36 +  val monos = [];
    1.37 +  val type_intrs = bool_into_univ::data_typechecks;
    1.38 +  val type_elims = []);
    1.39 +
    1.40 +(*Perform induction on l, then prove the major premise using prems. *)
    1.41 +fun bin_ind_tac a prems i = 
    1.42 +    EVERY [res_inst_tac [("x",a)] Bin.induct i,
    1.43 +	   rename_last_tac a ["1"] (i+3),
    1.44 +	   ares_tac prems i];
    1.45 +