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