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