src/ZF/ex/TF.ML
author paulson
Mon, 28 Dec 1998 16:54:01 +0100
changeset 6046 2c8a8be36c94
parent 5147 825877190618
child 6153 bff90585cce5
permissions -rw-r--r--
converted to use new primrec section
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
     1
(*  Title:      ZF/ex/tf.ML
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
Trees & forests, a mutually recursive type definition.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
     9
Addsimps tree_forest.intrs;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
(** tree_forest(A) as the union of tree(A) and forest(A) **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
739
786f32e0b64e modified for new treatment of mutual recursion
lcp
parents: 529
diff changeset
    13
val [_, tree_def, forest_def] = tree_forest.defs;
786f32e0b64e modified for new treatment of mutual recursion
lcp
parents: 529
diff changeset
    14
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    15
Goalw [tree_def] "tree(A) <= tree_forest(A)";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
by (rtac Part_subset 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    17
qed "tree_subset_TF";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    19
Goalw [forest_def] "forest(A) <= tree_forest(A)";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
by (rtac Part_subset 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    21
qed "forest_subset_TF";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    23
Goal "tree(A) Un forest(A) = tree_forest(A)";
739
786f32e0b64e modified for new treatment of mutual recursion
lcp
parents: 529
diff changeset
    24
by (safe_tac (subset_cs addSIs [equalityI, tree_subset_TF, forest_subset_TF]));
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
    25
by (fast_tac (claset() addSIs tree_forest.intrs addEs [tree_forest.elim]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    26
qed "TF_equals_Un";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
(** NOT useful, but interesting... **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    30
Goalw [tree_def, forest_def] 
434
89d45187f04d Various updates and tidying
lcp
parents: 279
diff changeset
    31
    "tree_forest(A) = (A*forest(A)) + ({0} + tree(A)*forest(A))";
529
f0d16216e394 ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    32
let open tree_forest;  
f0d16216e394 ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    33
    val rew = rewrite_rule (con_defs @ tl defs) in  
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
    34
by (fast_tac (claset() addSIs (map rew intrs RL [PartD1]) addEs [rew elim]) 1)
529
f0d16216e394 ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    35
end;
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 739
diff changeset
    36
qed "tree_forest_unfold";
434
89d45187f04d Various updates and tidying
lcp
parents: 279
diff changeset
    37
739
786f32e0b64e modified for new treatment of mutual recursion
lcp
parents: 529
diff changeset
    38
val tree_forest_unfold' = rewrite_rule [tree_def, forest_def] 
529
f0d16216e394 ZF/List, ex/Brouwer,Data,LList,Ntree,TF,Term: much simplified proof of _unfold
lcp
parents: 515
diff changeset
    39
                          tree_forest_unfold;
434
89d45187f04d Various updates and tidying
lcp
parents: 279
diff changeset
    40
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    41
Goalw [tree_def, forest_def]
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    42
    "tree(A) = {Inl(x). x: A*forest(A)}";
438
52e8393ccd77 minor tidying up (ordered rewriting in Integ.ML)
lcp
parents: 434
diff changeset
    43
by (rtac (Part_Inl RS subst) 1);
52e8393ccd77 minor tidying up (ordered rewriting in Integ.ML)
lcp
parents: 434
diff changeset
    44
by (rtac (tree_forest_unfold' RS subst_context) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    45
qed "tree_unfold";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    47
Goalw [tree_def, forest_def]
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    48
    "forest(A) = {Inr(x). x: {0} + tree(A)*forest(A)}";
438
52e8393ccd77 minor tidying up (ordered rewriting in Integ.ML)
lcp
parents: 434
diff changeset
    49
by (rtac (Part_Inr RS subst) 1);
52e8393ccd77 minor tidying up (ordered rewriting in Integ.ML)
lcp
parents: 434
diff changeset
    50
by (rtac (tree_forest_unfold' RS subst_context) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    51
qed "forest_unfold";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
434
89d45187f04d Various updates and tidying
lcp
parents: 279
diff changeset
    53
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    54
(** Type checking for recursor: Not needed; possibly interesting (??) **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    55
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    56
val major::prems = goal TF.thy
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    57
    "[| z: tree_forest(A);  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    58
\       !!x f r. [| x: A;  f: forest(A);  r: C(f)               \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    59
\                 |] ==> b(x,f,r): C(Tcons(x,f));       \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    60
\       c : C(Fnil);                                            \
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    61
\       !!t f r1 r2. [| t: tree(A);  f: forest(A);  r1: C(t); r2: C(f) \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    62
\                     |] ==> d(t,f,r1,r2): C(Fcons(t,f))        \
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    63
\    |] ==> tree_forest_rec(b,c,d,z) : C(z)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    64
by (rtac (major RS tree_forest.induct) 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
    65
by (ALLGOALS (asm_simp_tac (simpset() addsimps prems)));
760
f0200e91b272 added qed and qed_goal[w]
clasohm
parents: 739
diff changeset
    66
qed "TF_rec_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    67
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    68
(*Mutually recursive version*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    69
val prems = goal TF.thy
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    70
    "[| !!x f r. [| x: A;  f: forest(A);  r: D(f)               \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    71
\                 |] ==> b(x,f,r): C(Tcons(x,f));               \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    72
\       c : D(Fnil);                                            \
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    73
\       !!t f r1 r2. [| t: tree(A);  f: forest(A);  r1: C(t); r2: D(f) \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
    74
\                     |] ==> d(t,f,r1,r2): D(Fcons(t,f))        \
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    75
\    |] ==> (ALL t:tree(A).    tree_forest_rec(b,c,d,t)  : C(t)) &       \
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    76
\           (ALL f: forest(A). tree_forest_rec(b,c,d,f) : D(f))";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    77
by (rewtac Ball_def);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    78
by (rtac tree_forest.mutual_induct 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
    79
by (ALLGOALS (asm_simp_tac (simpset() addsimps prems)));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    80
qed "tree_forest_rec_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    81
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    82
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    83
(** list_of_TF and of_list **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    84
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    85
Goal "z: tree_forest(A) ==> list_of_TF(z) : list(tree(A))";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    86
by (etac tree_forest.induct 1);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    87
by (ALLGOALS Asm_simp_tac);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
    88
qed "list_of_TF_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    89
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    90
Goal "l: list(tree(A)) ==> of_list(l) : forest(A)";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    91
by (etac list.induct 1);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    92
by (ALLGOALS Asm_simp_tac);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    93
qed "of_list_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    94
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    95
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    96
(** map **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    97
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
    98
val prems = Goal
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
    99
    "[| !!x. x: A ==> h(x): B |] ==> \
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   100
\      (ALL t:tree(A). map(h,t) : tree(B)) &  \
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   101
\      (ALL f: forest(A). map(h,f) : forest(B))";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   102
by (rewtac Ball_def);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   103
by (rtac tree_forest.mutual_induct 1);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   104
by (ALLGOALS (asm_simp_tac (simpset() addsimps prems)));
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   105
qed "map_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   106
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   107
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   108
(** size **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   109
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   110
Goal "z: tree_forest(A) ==> size(z) : nat";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   111
by (etac tree_forest.induct 1);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   112
by (ALLGOALS Asm_simp_tac);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   113
qed "size_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   114
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   115
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   116
(** preorder **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   117
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   118
Goal "z: tree_forest(A) ==> preorder(z) : list(A)";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   119
by (etac tree_forest.induct 1);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   120
by (ALLGOALS Asm_simp_tac);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   121
qed "preorder_type";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   122
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   123
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   124
(** Term simplification **)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   125
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   126
val treeI = tree_subset_TF RS subsetD
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   127
and forestI = forest_subset_TF RS subsetD;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   128
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   129
val typechecks =
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   130
    [treeI, forestI,
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   131
     list_of_TF_type, map_type, size_type, preorder_type];
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   132
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   133
Addsimps typechecks;
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   134
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   135
(** theorems about list_of_TF and of_list **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   136
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   137
(*essentially the same as list induction*)
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   138
val major::prems = Goal
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 782
diff changeset
   139
    "[| f: forest(A);   \
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   140
\       R(Fnil);        \
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   141
\       !!t f. [| t: tree(A);  f: forest(A);  R(f) |] ==> R(Fcons(t,f))  \
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   142
\    |] ==> R(f)";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   143
by (rtac (major RS (tree_forest.mutual_induct RS conjunct2 RS spec RSN (2,rev_mp))) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   144
by (REPEAT (ares_tac (TrueI::prems) 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   145
qed "forest_induct";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   146
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   147
Goal "f: forest(A) ==> of_list(list_of_TF(f)) = f";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   148
by (etac forest_induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   149
by (ALLGOALS Asm_simp_tac);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   150
qed "forest_iso";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   151
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   152
Goal "ts: list(tree(A)) ==> list_of_TF(of_list(ts)) = ts";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   153
by (etac list.induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   154
by (ALLGOALS Asm_simp_tac);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 760
diff changeset
   155
qed "tree_list_iso";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   156
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   157
(** theorems about map **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   158
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   159
Goal "z: tree_forest(A) ==> map(%u. u, z) = z";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   160
by (etac tree_forest.induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   161
by (ALLGOALS Asm_simp_tac);
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   162
qed "map_ident";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   163
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   164
Goal "z: tree_forest(A) ==> map(h, map(j,z)) = map(%u. h(j(u)), z)";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   165
by (etac tree_forest.induct 1);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   166
by (ALLGOALS Asm_simp_tac);
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   167
qed "map_compose";
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   168
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   169
(** theorems about size **)
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   170
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   171
Goal "z: tree_forest(A) ==> size(map(h,z)) = size(z)";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   172
by (etac tree_forest.induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   173
by (ALLGOALS Asm_simp_tac);
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   174
qed "size_map";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   175
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   176
Goal "z: tree_forest(A) ==> size(z) = length(preorder(z))";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   177
by (etac tree_forest.induct 1);
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   178
by (ALLGOALS   (*TYPECHECKING: why so explicit?*)
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   179
    (asm_simp_tac
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   180
     (simpset() addsimps [treeI RS preorder_type RS length_app])));
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   181
qed "size_length";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   182
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   183
(** theorems about preorder **)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   184
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   185
Goal "z: tree_forest(A) ==> preorder(TF.map(h,z)) = List.map(h, preorder(z))";
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 486
diff changeset
   186
by (etac tree_forest.induct 1);
6046
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   187
by (ALLGOALS  (*TYPECHECKING: why so explicit?*)
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   188
    (asm_simp_tac
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   189
     (simpset() addsimps [treeI RS preorder_type RS map_app_distrib])));
2c8a8be36c94 converted to use new primrec section
paulson
parents: 5147
diff changeset
   190
qed "preorder_map";