src/ZF/ex/LList.thy
author clasohm
Wed, 14 Dec 1994 11:41:49 +0100
changeset 782 200a16083201
parent 753 ec86863e87c8
child 810 91c68f74f458
permissions -rw-r--r--
added bind_thm for theorems defined by "standard ..."
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     1
(*  Title: 	ZF/ex/LList.thy
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     2
    ID:         $Id$
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
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
Codatatype definition of Lazy Lists
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     7
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     8
Equality for llist(A) as a greatest fixed point
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     9
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    10
Functions for Lazy Lists
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    11
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    12
STILL NEEDS:
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    13
co_recursion for defining lconst, flip, etc.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    14
a typing rule for it, based on some notion of "productivity..."
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    15
*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    16
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    17
LList = QUniv + "Datatype" +
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    18
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    19
consts
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    20
  llist  :: "i=>i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    21
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    22
codatatype
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    23
  "llist(A)" = LNil | LCons ("a: A", "l: llist(A)")
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    24
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    25
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    26
(*Coinductive definition of equality*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    27
consts
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    28
  lleq :: "i=>i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    29
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    30
(*Previously used <*> in the domain and variant pairs as elements.  But
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    31
  standard pairs work just as well.  To use variant pairs, must change prefix
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    32
  a q/Q to the Sigma, Pair and converse rules.*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    33
coinductive
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    34
  domains "lleq(A)" <= "llist(A) * llist(A)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    35
  intrs
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    36
    LNil  "<LNil, LNil> : lleq(A)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    37
    LCons "[| a:A; <l,l'>: lleq(A) |] ==> <LCons(a,l), LCons(a,l')>: lleq(A)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    38
  type_intrs  "llist.intrs"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    39
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    40
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    41
(*Lazy list functions; flip is not definitional!*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    42
consts
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    43
  lconst   :: "i => i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    44
  flip     :: "i => i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    45
753
ec86863e87c8 replaced "rules" by "defs"
lcp
parents: 515
diff changeset
    46
defs
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    47
  lconst_def  "lconst(a) == lfp(univ(a), %l. LCons(a,l))"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    48
753
ec86863e87c8 replaced "rules" by "defs"
lcp
parents: 515
diff changeset
    49
rules
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    50
  flip_LNil   "flip(LNil) = LNil"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    51
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    52
  flip_LCons  "[| x:bool; l: llist(bool) |] ==> \
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    53
\              flip(LCons(x,l)) = LCons(not(x), flip(l))"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    54
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    55
end
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    56