src/ZF/ex/Bin.ML
author clasohm
Fri, 01 Jul 1994 11:04:12 +0200
changeset 445 7b6d8b8d4580
parent 434 89d45187f04d
child 477 53fc8ad84b33
permissions -rw-r--r--
changed syntax of datatype declaration

(*  Title: 	ZF/ex/bin.ML
    ID:         $Id$
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
    Copyright   1993  University of Cambridge

Datatype of binary integers
*)

(*Example of a datatype with an infix constructor*)
structure Bin = Datatype_Fun
 (val thy = Univ.thy;
  val rec_specs = 
      [("bin", "univ(0)",
	  [(["Plus", "Minus"],	"i", NoSyn),
	   (["$$"],		"[i,i]=>i", Infixl 60)])];
  val rec_styp = "i";
  val sintrs = 
	  ["Plus : bin",
	   "Minus : bin",
	   "[| w: bin;  b: bool |] ==> w$$b : bin"];
  val monos = [];
  val type_intrs = datatype_intrs @ [bool_into_univ];
  val type_elims = []);

(*Perform induction on l, then prove the major premise using prems. *)
fun bin_ind_tac a prems i = 
    EVERY [res_inst_tac [("x",a)] Bin.induct i,
	   rename_last_tac a ["1"] (i+3),
	   ares_tac prems i];