src/ZF/ex/ListN.ML
author paulson
Tue, 26 Mar 1996 16:16:24 +0100
changeset 1614 c9f0fc335b12
parent 1461 6bcb44e4d6e5
child 1732 38776e927da8
permissions -rw-r--r--
Rewriting changes due to new arith_ss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     1
(*  Title:      ZF/ex/listn
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
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
Inductive definition of lists of n elements
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
See Ch. Paulin-Mohring, Inductive Definitions in the System Coq.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
Research Report 92-49, LIP, ENS Lyon.  Dec 1992.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    12
open ListN;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
7
268f93ab3bc4 Installation of new simplifier for ZF/ex. The hom_ss example in misc.ML is
lcp
parents: 0
diff changeset
    14
val listn_induct = standard 
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    15
    (listn.mutual_induct RS spec RS spec RSN (2,rev_mp));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
71
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    17
goal ListN.thy "!!l. l:list(A) ==> <length(l),l> : listn(A)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    18
by (etac list.induct 1);
7
268f93ab3bc4 Installation of new simplifier for ZF/ex. The hom_ss example in misc.ML is
lcp
parents: 0
diff changeset
    19
by (ALLGOALS (asm_simp_tac list_ss));
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    20
by (REPEAT (ares_tac listn.intrs 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    21
qed "list_into_listn";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
goal ListN.thy "<n,l> : listn(A) <-> l:list(A) & length(l)=n";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
by (rtac iffI 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
by (etac listn_induct 1);
7
268f93ab3bc4 Installation of new simplifier for ZF/ex. The hom_ss example in misc.ML is
lcp
parents: 0
diff changeset
    26
by (safe_tac (ZF_cs addSIs (list_typechecks @
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    27
                            [length_Nil, length_Cons, list_into_listn])));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    28
qed "listn_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
goal ListN.thy "listn(A)``{n} = {l:list(A). length(l)=n}";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
by (rtac equality_iffI 1);
7
268f93ab3bc4 Installation of new simplifier for ZF/ex. The hom_ss example in misc.ML is
lcp
parents: 0
diff changeset
    32
by (simp_tac (list_ss addsimps [listn_iff,separation,image_singleton_iff]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    33
qed "listn_image_eq";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    35
goalw ListN.thy listn.defs "!!A B. A<=B ==> listn(A) <= listn(B)";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 7
diff changeset
    36
by (rtac lfp_mono 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    37
by (REPEAT (rtac listn.bnd_mono 1));
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 7
diff changeset
    38
by (REPEAT (ares_tac ([univ_mono,Sigma_mono,list_mono] @ basic_monos) 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    39
qed "listn_mono";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 7
diff changeset
    40
71
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    41
goal ListN.thy
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    42
    "!!n l. [| <n,l> : listn(A);  <n',l'> : listn(A) |] ==> \
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    43
\           <n#+n', l@l'> : listn(A)";
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    44
by (etac listn_induct 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    45
by (ALLGOALS (asm_simp_tac (list_ss addsimps listn.intrs)));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    46
qed "listn_append";
71
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    47
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    48
val Nil_listn_case = listn.mk_cases list.con_defs "<i,Nil> : listn(A)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    49
and Cons_listn_case = listn.mk_cases list.con_defs "<i,Cons(x,l)> : listn(A)";
85
914270f33f2d minor changes e.g. datatype_elims
lcp
parents: 71
diff changeset
    50
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    51
val zero_listn_case = listn.mk_cases list.con_defs "<0,l> : listn(A)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    52
and succ_listn_case = listn.mk_cases list.con_defs "<succ(i),l> : listn(A)";