src/ZF/Induct/ListN.ML
author wenzelm
Thu, 15 Nov 2001 18:20:13 +0100
changeset 12207 4dff931b852f
parent 12088 6f463d16cbd0
permissions -rw-r--r--
added Induct/Binary_Trees.thy, Induct/Tree_Forest (converted from former ex/TF.ML ex/TF.thy ex/Term.ML ex/Term.thy);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12088
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     1
(*  Title:      ZF/ex/ListN
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     2
    ID:         $Id$
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     5
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     6
Inductive definition of lists of n elements
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     7
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     8
See Ch. Paulin-Mohring, Inductive Definitions in the System Coq.
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     9
Research Report 92-49, LIP, ENS Lyon.  Dec 1992.
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    10
*)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    11
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    12
Goal "l \\<in> list(A) ==> <length(l),l> \\<in> listn(A)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    13
by (etac list.induct 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    14
by (ALLGOALS Asm_simp_tac);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    15
by (REPEAT (ares_tac listn.intrs 1));
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    16
qed "list_into_listn";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    17
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    18
Goal "<n,l> \\<in> listn(A) <-> l \\<in> list(A) & length(l)=n";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    19
by (rtac iffI 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    20
by (blast_tac (claset() addIs [list_into_listn]) 2);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    21
by (etac listn.induct 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    22
by Auto_tac;
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    23
qed "listn_iff";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    24
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    25
Goal "listn(A)``{n} = {l \\<in> list(A). length(l)=n}";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    26
by (rtac equality_iffI 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    27
by (simp_tac (simpset() addsimps [listn_iff,separation,image_singleton_iff]) 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    28
qed "listn_image_eq";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    29
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    30
Goalw listn.defs "A \\<subseteq> B ==> listn(A) \\<subseteq> listn(B)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    31
by (rtac lfp_mono 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    32
by (REPEAT (rtac listn.bnd_mono 1));
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    33
by (REPEAT (ares_tac ([univ_mono,Sigma_mono,list_mono] @ basic_monos) 1));
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    34
qed "listn_mono";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    35
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    36
Goal "[| <n,l> \\<in> listn(A); <n',l'> \\<in> listn(A) |] ==> <n#+n', l@l'> \\<in> listn(A)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    37
by (etac listn.induct 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    38
by (ftac (impOfSubs listn.dom_subset) 1);
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    39
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps listn.intrs)));
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    40
qed "listn_append";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    41
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    42
val Nil_listn_case  = listn.mk_cases "<i,Nil> \\<in> listn(A)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    43
and Cons_listn_case = listn.mk_cases "<i,Cons(x,l)> \\<in> listn(A)";
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    44
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    45
val zero_listn_case = listn.mk_cases "<0,l> \\<in> listn(A)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    46
and succ_listn_case = listn.mk_cases "<succ(i),l> \\<in> listn(A)";