src/ZF/ex/ListN.ML
author lcp
Tue Aug 16 18:58:42 1994 +0200 (1994-08-16)
changeset 532 851df239ac8b
parent 515 abcc438e7c27
child 782 200a16083201
permissions -rw-r--r--
ZF/Makefile,ROOT.ML, ZF/ex/Integ.thy: updated for EquivClass
clasohm@0
     1
(*  Title: 	ZF/ex/listn
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1993  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Inductive definition of lists of n elements
clasohm@0
     7
clasohm@0
     8
See Ch. Paulin-Mohring, Inductive Definitions in the System Coq.
clasohm@0
     9
Research Report 92-49, LIP, ENS Lyon.  Dec 1992.
clasohm@0
    10
*)
clasohm@0
    11
lcp@515
    12
open ListN;
clasohm@0
    13
lcp@7
    14
val listn_induct = standard 
lcp@515
    15
    (listn.mutual_induct RS spec RS spec RSN (2,rev_mp));
clasohm@0
    16
lcp@71
    17
goal ListN.thy "!!l. l:list(A) ==> <length(l),l> : listn(A)";
lcp@515
    18
by (etac list.induct 1);
lcp@7
    19
by (ALLGOALS (asm_simp_tac list_ss));
lcp@515
    20
by (REPEAT (ares_tac listn.intrs 1));
clasohm@0
    21
val list_into_listn = result();
clasohm@0
    22
clasohm@0
    23
goal ListN.thy "<n,l> : listn(A) <-> l:list(A) & length(l)=n";
clasohm@0
    24
by (rtac iffI 1);
clasohm@0
    25
by (etac listn_induct 1);
lcp@7
    26
by (safe_tac (ZF_cs addSIs (list_typechecks @
lcp@7
    27
			    [length_Nil, length_Cons, list_into_listn])));
clasohm@0
    28
val listn_iff = result();
clasohm@0
    29
clasohm@0
    30
goal ListN.thy "listn(A)``{n} = {l:list(A). length(l)=n}";
clasohm@0
    31
by (rtac equality_iffI 1);
lcp@7
    32
by (simp_tac (list_ss addsimps [listn_iff,separation,image_singleton_iff]) 1);
clasohm@0
    33
val listn_image_eq = result();
clasohm@0
    34
lcp@515
    35
goalw ListN.thy listn.defs "!!A B. A<=B ==> listn(A) <= listn(B)";
lcp@16
    36
by (rtac lfp_mono 1);
lcp@515
    37
by (REPEAT (rtac listn.bnd_mono 1));
lcp@16
    38
by (REPEAT (ares_tac ([univ_mono,Sigma_mono,list_mono] @ basic_monos) 1));
lcp@16
    39
val listn_mono = result();
lcp@16
    40
lcp@71
    41
goal ListN.thy
lcp@71
    42
    "!!n l. [| <n,l> : listn(A);  <n',l'> : listn(A) |] ==> \
lcp@71
    43
\           <n#+n', l@l'> : listn(A)";
lcp@71
    44
by (etac listn_induct 1);
lcp@515
    45
by (ALLGOALS (asm_simp_tac (list_ss addsimps listn.intrs)));
lcp@71
    46
val listn_append = result();
lcp@71
    47
lcp@515
    48
val Nil_listn_case = listn.mk_cases list.con_defs "<i,Nil> : listn(A)"
lcp@515
    49
and Cons_listn_case = listn.mk_cases list.con_defs "<i,Cons(x,l)> : listn(A)";
lcp@85
    50
lcp@515
    51
val zero_listn_case = listn.mk_cases list.con_defs "<0,l> : listn(A)"
lcp@515
    52
and succ_listn_case = listn.mk_cases list.con_defs "<succ(i),l> : listn(A)";