src/ZF/ex/BT.thy
author clasohm
Tue Feb 06 12:27:17 1996 +0100 (1996-02-06)
changeset 1478 2b8c2a7547ab
parent 1401 0c439768f45c
child 3840 e0baea4d485a
permissions -rw-r--r--
expanded tabs
clasohm@1478
     1
(*  Title:      ZF/ex/BT.thy
lcp@515
     2
    ID:         $Id$
clasohm@1478
     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@935
     9
BT = Datatype +
lcp@515
    10
consts
clasohm@1478
    11
    bt_rec      :: [i, i, [i,i,i,i,i]=>i] => i
clasohm@1478
    12
    n_nodes     :: i=>i
clasohm@1478
    13
    n_leaves    :: i=>i
clasohm@1478
    14
    bt_reflect  :: i=>i
lcp@515
    15
clasohm@1478
    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
clasohm@1478
    25
  n_nodes_def   "n_nodes(t) == bt_rec(t,  0,  %x y z r s. succ(r#+s))"
clasohm@1478
    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