src/ZF/ex/ListN.ML
author paulson
Tue, 01 Aug 2000 15:28:21 +0200
changeset 9491 1a36151ee2fc
parent 6153 bff90585cce5
child 11316 b4e71bd751e4
permissions -rw-r--r--
natify, a coercion to reduce the number of type constraints in arithmetic
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6153
bff90585cce5 new typechecking solver for the simplifier
paulson
parents: 6141
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
5137
60205b0de9b9 Huge tidy-up: removal of leading \!\!
paulson
parents: 5068
diff changeset
    12
Goal "l:list(A) ==> <length(l),l> : listn(A)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    13
by (etac list.induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1732
diff changeset
    14
by (ALLGOALS Asm_simp_tac);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    15
by (REPEAT (ares_tac listn.intrs 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    16
qed "list_into_listn";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    18
Goal "<n,l> : listn(A) <-> l:list(A) & length(l)=n";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
by (rtac iffI 1);
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5618
diff changeset
    20
by (blast_tac (claset() addIs [list_into_listn]) 2);
1732
38776e927da8 Updated for new form of induction rules
paulson
parents: 1461
diff changeset
    21
by (etac listn.induct 1);
6153
bff90585cce5 new typechecking solver for the simplifier
paulson
parents: 6141
diff changeset
    22
by Auto_tac;
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    23
qed "listn_iff";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    25
Goal "listn(A)``{n} = {l:list(A). length(l)=n}";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
by (rtac equality_iffI 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 2469
diff changeset
    27
by (simp_tac (simpset() addsimps [listn_iff,separation,image_singleton_iff]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    28
qed "listn_image_eq";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
5137
60205b0de9b9 Huge tidy-up: removal of leading \!\!
paulson
parents: 5068
diff changeset
    30
Goalw listn.defs "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
    31
by (rtac lfp_mono 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    32
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
    33
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
    34
qed "listn_mono";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 7
diff changeset
    35
5268
59ef39008514 even more tidying of Goal commands
paulson
parents: 5147
diff changeset
    36
Goal "[| <n,l> : listn(A); <n',l'> : listn(A) |] ==> <n#+n', l@l'> : listn(A)";
1732
38776e927da8 Updated for new form of induction rules
paulson
parents: 1461
diff changeset
    37
by (etac listn.induct 1);
9491
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6153
diff changeset
    38
by (ftac (impOfSubs listn.dom_subset) 1);
1a36151ee2fc natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents: 6153
diff changeset
    39
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps listn.intrs)));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 515
diff changeset
    40
qed "listn_append";
71
729fe026c5f3 sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents: 56
diff changeset
    41
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    42
val Nil_listn_case  = listn.mk_cases "<i,Nil> : listn(A)"
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    43
and Cons_listn_case = listn.mk_cases "<i,Cons(x,l)> : listn(A)";
85
914270f33f2d minor changes e.g. datatype_elims
lcp
parents: 71
diff changeset
    44
6141
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    45
val zero_listn_case = listn.mk_cases "<0,l> : listn(A)"
a6922171b396 removal of the (thm list) argument of mk_cases
paulson
parents: 6046
diff changeset
    46
and succ_listn_case = listn.mk_cases "<succ(i),l> : listn(A)";