src/ZF/ex/Ntree.thy
author wenzelm
Tue, 04 Apr 2000 18:08:08 +0200
changeset 8666 6c21e6f91804
parent 8125 df502e820d07
child 11316 b4e71bd751e4
permissions -rw-r--r--
case_tac / induct_tac: optional rule;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/ex/Ntree.ML
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     5
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     6
Datatype definition n-ary branching trees
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     7
Demonstrates a simple use of function space in a datatype definition
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     8
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     9
Based upon ex/Term.thy
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    10
*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    11
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    12
Ntree = InfDatatype +
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    13
consts
1401
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 539
diff changeset
    14
  ntree    :: i=>i
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 539
diff changeset
    15
  maptree  :: i=>i
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 539
diff changeset
    16
  maptree2 :: [i,i] => i
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    17
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    18
datatype
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    19
  "ntree(A)" = Branch ("a: A", "h: (UN n:nat. n -> ntree(A))")
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    20
  monos       "[[subset_refl, Pi_mono] MRS UN_mono]"    (*MUST have this form*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    21
  type_intrs  "[nat_fun_univ RS subsetD]"
6117
f9aad8ccd590 tidying of datatype and inductive definitions
paulson
parents: 1478
diff changeset
    22
  type_elims   UN_E
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    23
539
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    24
datatype
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    25
  "maptree(A)" = Sons ("a: A", "h: maptree(A) -||> maptree(A)")
6117
f9aad8ccd590 tidying of datatype and inductive definitions
paulson
parents: 1478
diff changeset
    26
  monos        FiniteFun_mono1         (*Use monotonicity in BOTH args*)
539
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    27
  type_intrs  "[FiniteFun_univ1 RS subsetD]"
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    28
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    29
datatype
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    30
  "maptree2(A,B)" = Sons2 ("a: A", "h: B -||> maptree2(A,B)")
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    31
  monos       "[subset_refl RS FiniteFun_mono]"
6117
f9aad8ccd590 tidying of datatype and inductive definitions
paulson
parents: 1478
diff changeset
    32
  type_intrs   FiniteFun_in_univ'
539
01906e4644e0 ZF/ex/Ntree: two new examples, maptree and maptree2
lcp
parents: 515
diff changeset
    33
8125
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    34
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    35
constdefs
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    36
  ntree_rec  :: [[i,i,i]=>i, i] => i
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    37
   "ntree_rec(b) == 
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    38
    Vrecursor(%pr. ntree_case(%x h. b(x, h, lam i: domain(h). pr`(h`i))))"
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    39
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    40
constdefs
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    41
    ntree_copy     :: i=>i
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    42
    "ntree_copy(z) == ntree_rec(%x h r. Branch(x,r), z)"
df502e820d07 added recursor
paulson
parents: 6117
diff changeset
    43
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    44
end