src/HOL/Induct/LFilter.ML
author wenzelm
Wed, 21 Oct 1998 13:31:30 +0200
changeset 5707 b0e631634b5a
parent 5618 721671c68324
child 6141 a6922171b396
permissions -rw-r--r--
field_injects [iffs];
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     1
(*  Title:      HOL/ex/LFilter
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     2
    ID:         $Id$
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     4
    Copyright   1997  University of Cambridge
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     5
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     6
The "filter" functional for coinductive lists
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     7
  --defined by a combination of induction and coinduction
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     8
*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     9
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    10
(*** findRel: basic laws ****)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    11
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    12
val findRel_LConsE = 
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    13
    findRel.mk_cases [LCons_LCons_eq] "(LCons x l, l'') : findRel p";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    14
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    15
AddSEs [findRel_LConsE];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    16
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    17
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    18
Goal "(l,l'): findRel p ==> (l,l''): findRel p --> l'' = l'";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    19
by (etac findRel.induct 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    20
by (Blast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    21
by (Blast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    22
qed_spec_mp "findRel_functional";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    23
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    24
Goal "(l,l'): findRel p ==> EX x l''. l' = LCons x l'' & p x";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    25
by (etac findRel.induct 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    26
by (Blast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    27
by (Blast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    28
qed_spec_mp "findRel_imp_LCons";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    29
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    30
Goal "(LNil,l): findRel p ==> R";
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    31
by (blast_tac (claset() addEs [findRel.elim]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    32
qed "findRel_LNil";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    33
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    34
AddSEs [findRel_LNil];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    35
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    36
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    37
(*** Properties of Domain (findRel p) ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    38
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    39
Goal "LCons x l : Domain(findRel p) = (p x | l : Domain(findRel p))";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    40
by (case_tac "p x" 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    41
by (ALLGOALS (blast_tac (claset() addIs findRel.intrs)));
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    42
qed "LCons_Domain_findRel";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    43
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    44
Addsimps [LCons_Domain_findRel];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    45
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    46
val major::prems = 
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
    47
Goal "[| l: Domain (findRel p);                                   \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    48
\            !!x l'. [| (l, LCons x l') : findRel p;  p x |] ==> Q    \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    49
\         |] ==> Q";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    50
by (rtac (major RS DomainE) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    51
by (forward_tac [findRel_imp_LCons] 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    52
by (REPEAT (eresolve_tac [exE,conjE] 1));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    53
by (hyp_subst_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    54
by (REPEAT (ares_tac prems 1));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    55
qed "Domain_findRelE";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    56
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    57
val prems = goal thy
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    58
    "[| !!x. p x ==> q x |] ==> Domain (findRel p) <= Domain (findRel q)";
3718
d78cf498a88c Minor tidying to use Clarify_tac, etc.
paulson
parents: 3120
diff changeset
    59
by (Clarify_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    60
by (etac findRel.induct 1);
5618
paulson
parents: 5223
diff changeset
    61
by (blast_tac (claset() addIs findRel.intrs @ prems) 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    62
by (blast_tac (claset() addIs findRel.intrs) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    63
qed "Domain_findRel_mono";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    64
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    65
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    66
(*** find: basic equations ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    67
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
    68
Goalw [find_def] "find p LNil = LNil";
4535
f24cebc299e4 added select_equality to the implicit claset
oheimb
parents: 4521
diff changeset
    69
by (Blast_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    70
qed "find_LNil";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
    71
Addsimps [find_LNil];
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    72
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    73
Goalw [find_def] "(l,l') : findRel p ==> find p l = l'";
4535
f24cebc299e4 added select_equality to the implicit claset
oheimb
parents: 4521
diff changeset
    74
by (blast_tac (claset() addDs [findRel_functional]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    75
qed "findRel_imp_find";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
    76
Addsimps [findRel_imp_find];
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    77
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    78
Goal "p x ==> find p (LCons x l) = LCons x l";
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    79
by (blast_tac (claset() addIs (findRel_imp_find::findRel.intrs)) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    80
qed "find_LCons_found";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
    81
Addsimps [find_LCons_found];
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    82
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    83
Goalw [find_def] "l ~: Domain(findRel p) ==> find p l = LNil";
4535
f24cebc299e4 added select_equality to the implicit claset
oheimb
parents: 4521
diff changeset
    84
by (Blast_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    85
qed "diverge_find_LNil";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    86
Addsimps [diverge_find_LNil];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    87
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    88
Goal "~ (p x) ==> find p (LCons x l) = find p l";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    89
by (case_tac "LCons x l : Domain(findRel p)" 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    90
by (Asm_full_simp_tac 2);
3718
d78cf498a88c Minor tidying to use Clarify_tac, etc.
paulson
parents: 3120
diff changeset
    91
by (Clarify_tac 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
    92
by (Asm_simp_tac 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    93
by (blast_tac (claset() addIs (findRel_imp_find::findRel.intrs)) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    94
qed "find_LCons_seek";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
    95
Addsimps [find_LCons_seek];
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    96
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
    97
Goal "find p (LCons x l) = (if p x then LCons x l else find p l)";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4535
diff changeset
    98
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    99
qed "find_LCons";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   100
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   101
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   102
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   103
(*** lfilter: basic equations ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   104
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   105
Goal "lfilter p LNil = LNil";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   106
by (rtac (lfilter_def RS def_llist_corec RS trans) 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   107
by (Simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   108
qed "lfilter_LNil";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   109
Addsimps [lfilter_LNil];
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   110
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   111
Goal "l ~: Domain(findRel p) ==> lfilter p l = LNil";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   112
by (rtac (lfilter_def RS def_llist_corec RS trans) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   113
by (Asm_simp_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   114
qed "diverge_lfilter_LNil";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   115
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   116
Addsimps [diverge_lfilter_LNil];
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   117
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   118
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   119
Goal "p x ==> lfilter p (LCons x l) = LCons x (lfilter p l)";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   120
by (rtac (lfilter_def RS def_llist_corec RS trans) 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   121
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   122
qed "lfilter_LCons_found";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   123
(*This rewrite and lfilter_LCons_seek are NOT added because lfilter_LCons
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   124
  subsumes both*)
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   125
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   126
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   127
Goal "(l, LCons x l') : findRel p \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   128
\              ==> lfilter p l = LCons x (lfilter p l')";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   129
by (rtac (lfilter_def RS def_llist_corec RS trans) 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   130
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   131
qed "findRel_imp_lfilter";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   132
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   133
Addsimps [findRel_imp_lfilter];
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   134
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   135
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   136
Goal "~ (p x) ==> lfilter p (LCons x l) = lfilter p l";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   137
by (rtac (lfilter_def RS def_llist_corec RS trans) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   138
by (case_tac "LCons x l : Domain(findRel p)" 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   139
by (Asm_full_simp_tac 2);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   140
by (etac Domain_findRelE 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   141
by (safe_tac (claset() delrules [conjI]));
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   142
by (Asm_full_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   143
qed "lfilter_LCons_seek";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   144
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   145
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   146
Goal "lfilter p (LCons x l) = \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   147
\         (if p x then LCons x (lfilter p l) else lfilter p l)";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4535
diff changeset
   148
by (asm_simp_tac (simpset() addsimps [lfilter_LCons_found, lfilter_LCons_seek]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   149
qed "lfilter_LCons";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   150
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   151
AddSIs [llistD_Fun_LNil_I, llistD_Fun_LCons_I];
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   152
Addsimps [lfilter_LCons];
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   153
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   154
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   155
Goal "lfilter p l = LNil ==> l ~: Domain(findRel p)";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   156
by (rtac notI 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   157
by (etac Domain_findRelE 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   158
by (etac rev_mp 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   159
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   160
qed "lfilter_eq_LNil";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   161
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   162
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   163
Goal "lfilter p l = LCons x l' -->     \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   164
\              (EX l''. l' = lfilter p l'' & (l, LCons x l'') : findRel p)";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   165
by (stac (lfilter_def RS def_llist_corec) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   166
by (case_tac "l : Domain(findRel p)" 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   167
by (etac Domain_findRelE 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   168
by (Asm_simp_tac 2);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   169
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   170
by (Blast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   171
qed_spec_mp "lfilter_eq_LCons";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   172
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   173
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   174
Goal "lfilter p l = LNil  |  \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   175
\         (EX y l'. lfilter p l = LCons y (lfilter p l') & p y)";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   176
by (case_tac "l : Domain(findRel p)" 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   177
by (Asm_simp_tac 2);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   178
by (blast_tac (claset() addSEs [Domain_findRelE] 
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   179
                        addIs  [findRel_imp_lfilter]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   180
qed "lfilter_cases";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   181
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   182
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   183
(*** lfilter: simple facts by coinduction ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   184
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   185
Goal "lfilter (%x. True) l = l";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   186
by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   187
by (ALLGOALS Simp_tac);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   188
qed "lfilter_K_True";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   189
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   190
Goal "lfilter p (lfilter p l) = lfilter p l";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   191
by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4535
diff changeset
   192
by (ALLGOALS Simp_tac);
3724
f33e301a89f5 Step_tac -> Safe_tac
paulson
parents: 3718
diff changeset
   193
by Safe_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   194
(*Cases: p x is true or false*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   195
by (rtac (lfilter_cases RS disjE) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   196
by (etac ssubst 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4090
diff changeset
   197
by Auto_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   198
qed "lfilter_idem";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   199
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   200
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   201
(*** Numerous lemmas required to prove lfilter_conj:
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   202
     lfilter p (lfilter q l) = lfilter (%x. p x & q x) l
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   203
 ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   204
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   205
Goal "(l,l') : findRel q \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   206
\           ==> l' = LCons x l'' --> p x --> (l,l') : findRel (%x. p x & q x)";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   207
by (etac findRel.induct 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   208
by (blast_tac (claset() addIs findRel.intrs) 1);
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   209
by (blast_tac (claset() addIs findRel.intrs) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   210
qed_spec_mp "findRel_conj_lemma";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   211
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   212
val findRel_conj = refl RSN (2, findRel_conj_lemma);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   213
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   214
Goal "(l,l'') : findRel (%x. p x & q x) \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   215
\              ==> (l, LCons x l') : findRel q --> ~ p x     \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   216
\                  --> l' : Domain (findRel (%x. p x & q x))";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   217
by (etac findRel.induct 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4090
diff changeset
   218
by Auto_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   219
qed_spec_mp "findRel_not_conj_Domain";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   220
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   221
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   222
Goal "(l,lxx) : findRel q ==> \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   223
\            lxx = LCons x lx --> (lx,lz) : findRel(%x. p x & q x) --> ~ p x \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   224
\            --> (l,lz) : findRel (%x. p x & q x)";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   225
by (etac findRel.induct 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   226
by (ALLGOALS (blast_tac (claset() addIs findRel.intrs)));
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   227
qed_spec_mp "findRel_conj2";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   228
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   229
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   230
Goal "(lx,ly) : findRel p \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   231
\              ==> ALL l. lx = lfilter q l \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   232
\                  --> l : Domain (findRel(%x. p x & q x))";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   233
by (etac findRel.induct 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   234
by (blast_tac (claset() addSDs [sym RS lfilter_eq_LCons]
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   235
                        addIs  [findRel_conj]) 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4090
diff changeset
   236
by Auto_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   237
by (dtac (sym RS lfilter_eq_LCons) 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4090
diff changeset
   238
by Auto_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   239
by (dtac spec 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   240
by (dtac (refl RS rev_mp) 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   241
by (blast_tac (claset() addIs [findRel_conj2]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   242
qed_spec_mp "findRel_lfilter_Domain_conj";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   243
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   244
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   245
Goal "(l,l'') : findRel(%x. p x & q x) \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   246
\              ==> l'' = LCons y l' --> \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   247
\                  (lfilter q l, LCons y (lfilter q l')) : findRel p";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   248
by (etac findRel.induct 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4535
diff changeset
   249
by (ALLGOALS Asm_simp_tac);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   250
by (ALLGOALS (blast_tac (claset() addIs findRel.intrs)));
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   251
qed_spec_mp "findRel_conj_lfilter";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   252
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   253
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   254
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   255
Goal "(lfilter p (lfilter q l), lfilter (%x. p x & q x) l)  \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   256
\         : llistD_Fun (range                                   \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   257
\                       (%u. (lfilter p (lfilter q u),          \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   258
\                             lfilter (%x. p x & q x) u)))";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   259
by (case_tac "l : Domain(findRel q)" 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   260
by (subgoal_tac "l ~: Domain (findRel (%x. p x & q x))" 2);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   261
by (blast_tac (claset() addIs [impOfSubs Domain_findRel_mono]) 3);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   262
(*There are no qs in l: both lists are LNil*)
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   263
by (Asm_simp_tac 2);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   264
by (etac Domain_findRelE 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   265
(*case q x*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   266
by (case_tac "p x" 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   267
by (asm_simp_tac (simpset() addsimps [findRel_conj RS findRel_imp_lfilter]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   268
(*case q x and ~(p x) *)
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   269
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   270
by (case_tac "l' : Domain (findRel (%x. p x & q x))" 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   271
(*subcase: there is no p&q in l' and therefore none in l*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   272
by (subgoal_tac "l ~: Domain (findRel (%x. p x & q x))" 2);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   273
by (blast_tac (claset() addIs [findRel_not_conj_Domain]) 3);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   274
by (subgoal_tac "lfilter q l' ~: Domain(findRel p)" 2);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   275
by (blast_tac (claset() addIs [findRel_lfilter_Domain_conj]) 3);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   276
(*    ...and therefore too, no p in lfilter q l'.  Both results are Lnil*)
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   277
by (Asm_simp_tac 2);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   278
(*subcase: there is a p&q in l' and therefore also one in l*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   279
by (etac Domain_findRelE 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   280
by (subgoal_tac "(l, LCons xa l'a) : findRel(%x. p x & q x)" 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   281
by (blast_tac (claset() addIs [findRel_conj2]) 2);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   282
by (subgoal_tac "(lfilter q l', LCons xa (lfilter q l'a)) : findRel p" 1);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   283
by (blast_tac (claset() addIs [findRel_conj_lfilter]) 2);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   284
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   285
val lemma = result();
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   286
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   287
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   288
Goal "lfilter p (lfilter q l) = lfilter (%x. p x & q x) l";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   289
by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4535
diff changeset
   290
by (ALLGOALS Simp_tac);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   291
by (blast_tac (claset() addIs [lemma, impOfSubs llistD_Fun_mono]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   292
qed "lfilter_conj";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   293
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   294
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   295
(*** Numerous lemmas required to prove ??:
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   296
     lfilter p (lmap f l) = lmap f (lfilter (%x. p(f x)) l)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   297
 ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   298
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   299
Goal "(l,l') : findRel(%x. p (f x)) ==> lmap f l : Domain(findRel p)";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   300
by (etac findRel.induct 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   301
by (ALLGOALS Asm_full_simp_tac);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   302
qed "findRel_lmap_Domain";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   303
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   304
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   305
Goal "lmap f l = LCons x l' -->     \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   306
\              (EX y l''. x = f y & l' = lmap f l'' & l = LCons y l'')";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   307
by (stac (lmap_def RS def_llist_corec) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   308
by (res_inst_tac [("l", "l")] llistE 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4090
diff changeset
   309
by Auto_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   310
qed_spec_mp "lmap_eq_LCons";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   311
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   312
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   313
Goal "(lx,ly) : findRel p ==>  \
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   314
\    ALL l. lmap f l = lx --> ly = LCons x l' --> \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   315
\    (EX y l''. x = f y & l' = lmap f l'' &       \
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   316
\    (l, LCons y l'') : findRel(%x. p(f x)))";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   317
by (etac findRel.induct 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   318
by (ALLGOALS Asm_simp_tac);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   319
by (safe_tac (claset() addSDs [lmap_eq_LCons]));
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   320
by (blast_tac (claset() addIs findRel.intrs) 1);
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   321
by (blast_tac (claset() addIs findRel.intrs) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   322
qed_spec_mp "lmap_LCons_findRel_lemma";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   323
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   324
val lmap_LCons_findRel = refl RSN (2, refl RSN (2, lmap_LCons_findRel_lemma));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   325
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   326
Goal "lfilter p (lmap f l) = lmap f (lfilter (p o f) l)";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   327
by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4535
diff changeset
   328
by (ALLGOALS Simp_tac);
3724
f33e301a89f5 Step_tac -> Safe_tac
paulson
parents: 3718
diff changeset
   329
by Safe_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   330
by (case_tac "lmap f l : Domain (findRel p)" 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   331
by (subgoal_tac "l ~: Domain (findRel(%x. p (f x)))" 2);
4090
9f1eaab75e8c isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   332
by (blast_tac (claset() addIs [findRel_lmap_Domain]) 3);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   333
by (Asm_simp_tac 2);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   334
by (etac Domain_findRelE 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   335
by (forward_tac [lmap_LCons_findRel] 1);
3718
d78cf498a88c Minor tidying to use Clarify_tac, etc.
paulson
parents: 3120
diff changeset
   336
by (Clarify_tac 1);
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4477
diff changeset
   337
by (Asm_simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   338
qed "lfilter_lmap";