src/ZF/ex/BT.thy
author lcp
Tue Nov 29 00:31:31 1994 +0100 (1994-11-29)
changeset 753 ec86863e87c8
parent 515 abcc438e7c27
child 935 a94ef3eed456
permissions -rw-r--r--
replaced "rules" by "defs"
lcp@515
     1
(*  Title: 	ZF/ex/bt-fn.thy
lcp@515
     2
    ID:         $Id$
lcp@515
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
lcp@515
     4
    Copyright   1992  University of Cambridge
lcp@515
     5
lcp@515
     6
Binary trees
lcp@515
     7
*)
lcp@515
     8
lcp@515
     9
BT = Univ +
lcp@515
    10
consts
lcp@515
    11
    bt_rec    	:: "[i, i, [i,i,i,i,i]=>i] => i"
lcp@515
    12
    n_nodes	:: "i=>i"
lcp@515
    13
    n_leaves   	:: "i=>i"
lcp@515
    14
    bt_reflect 	:: "i=>i"
lcp@515
    15
lcp@515
    16
    bt 	        :: "i=>i"
lcp@515
    17
lcp@515
    18
datatype
lcp@515
    19
  "bt(A)" = Lf  |  Br ("a: A",  "t1: bt(A)",  "t2: bt(A)")
lcp@515
    20
  
lcp@753
    21
defs
lcp@515
    22
  bt_rec_def
lcp@515
    23
    "bt_rec(t,c,h) == Vrec(t, %t g.bt_case(c, %x y z. h(x,y,z,g`y,g`z), t))"
lcp@515
    24
lcp@515
    25
  n_nodes_def	"n_nodes(t) == bt_rec(t,  0,  %x y z r s. succ(r#+s))"
lcp@515
    26
  n_leaves_def	"n_leaves(t) == bt_rec(t,  succ(0),  %x y z r s. r#+s)"
lcp@515
    27
  bt_reflect_def "bt_reflect(t) == bt_rec(t,  Lf,  %x y z r s. Br(x,s,r))"
lcp@515
    28
lcp@515
    29
end