src/ZF/listfn.thy
author lcp
Thu, 30 Sep 1993 10:10:21 +0100
changeset 14 1c0926788772
parent 0 a5a9c433f639
child 43 eb7ad4a7dc4f
permissions -rw-r--r--
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext domrange/image_subset,vimage_subset: deleted needless premise! misc: This slightly simplifies two proofs in Schroeder-Bernstein Theorem ind-syntax/rule_concl: recoded to avoid exceptions intr-elim: now checks conclusions of introduction rules func/fun_disjoint_Un: now uses ex_ex1I list-fn/hd,tl,drop: new simpdata/bquant_simps: new list/list_case_type: restored! bool.thy: changed 1 from a "def" to a translation Removed occurreces of one_def in bool.ML, nat.ML, univ.ML, ex/integ.ML nat/succ_less_induct: new induction principle arith/add_mono: new results about monotonicity simpdata/mem_simps: removed the ones for succ and cons; added succI1, consI2 to ZF_ss upair/succ_iff: new, for use with simp_tac (cons_iff already existed) ordinal/Ord_0_in_succ: renamed from Ord_0_mem_succ nat/nat_0_in_succ: new ex/prop-log/hyps_thms_if: split up the fast_tac call for more speed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	ZF/list-fn
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Functions for Lists in Zermelo-Fraenkel Set Theory 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
map is a binding operator -- it applies to meta-level functions, not 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
object-level functions.  This simplifies the final form of term_rec_conv,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
although complicating its derivation.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
ListFn = List +
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
consts
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
  "@"	     :: "[i,i]=>i"      			(infixr 60)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
  list_rec   :: "[i, i, [i,i,i]=>i] => i"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
  map 	     :: "[i=>i, i] => i"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
  length,rev :: "i=>i"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
  flat       :: "i=>i"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
  list_add   :: "i=>i"
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    21
  hd,tl      :: "i=>i"
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    22
  drop	     :: "[i,i]=>i"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
 (* List Enumeration *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
 "[]"        :: "i" 	                           	("[]")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
 "@List"     :: "args => i" 	                   	("[(_)]")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
translations
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
  "[x, xs]"     == "Cons(x, [xs])"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
  "[x]"         == "Cons(x, [])"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  "[]"          == "Nil"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
rules
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    36
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    37
  hd_def	"hd(l)	     == list_case(0, %x xs.x, l)"
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    38
  tl_def	"tl(l)       == list_case(Nil, %x xs.xs, l)"
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    39
  drop_def	"drop(i,l)   == rec(i, l, %j r. tl(r))"
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 0
diff changeset
    40
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
  list_rec_def
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
      "list_rec(l,c,h) == Vrec(l, %l g.list_case(c, %x xs. h(x, xs, g`xs), l))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
  map_def       "map(f,l)    == list_rec(l,  Nil,  %x xs r. Cons(f(x), r))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
  length_def    "length(l)   == list_rec(l,  0,  %x xs r. succ(r))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
  app_def       "xs@ys       == list_rec(xs, ys, %x xs r. Cons(x,r))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
  rev_def       "rev(l)      == list_rec(l,  Nil,  %x xs r. r @ [x])"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
  flat_def      "flat(ls)    == list_rec(ls, Nil,  %l ls r. l @ r)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
  list_add_def  "list_add(l) == list_rec(l, 0,  %x xs r. x#+r)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
end