| author | huffman | 
| Fri, 04 Jan 2008 23:24:32 +0100 | |
| changeset 25833 | fe56cdb73ae5 | 
| parent 25803 | 230c9c87d739 | 
| child 25923 | 5fe4b543512e | 
| permissions | -rw-r--r-- | 
| 3071 | 1 | (* Title: HOLCF/IOA/meta_theory/Sequence.thy | 
| 3275 | 2 | ID: $Id$ | 
| 12218 | 3 | Author: Olaf Müller | 
| 3071 | 4 | |
| 12218 | 5 | Sequences over flat domains with lifted elements. | 
| 17233 | 6 | *) | 
| 3071 | 7 | |
| 17233 | 8 | theory Sequence | 
| 9 | imports Seq | |
| 10 | begin | |
| 3071 | 11 | |
| 17233 | 12 | defaultsort type | 
| 13 | ||
| 14 | types 'a Seq = "'a::type lift seq" | |
| 3071 | 15 | |
| 3952 | 16 | consts | 
| 3071 | 17 | |
| 7229 
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
 wenzelm parents: 
4559diff
changeset | 18 | Consq ::"'a => 'a Seq -> 'a Seq" | 
| 3071 | 19 |   Filter           ::"('a => bool)  => 'a Seq -> 'a Seq"
 | 
| 20 |   Map              ::"('a => 'b)    => 'a Seq -> 'b Seq"
 | |
| 21 |   Forall           ::"('a => bool)  => 'a Seq => bool"
 | |
| 22 | Last ::"'a Seq -> 'a lift" | |
| 17233 | 23 |   Dropwhile        ::"('a => bool)  => 'a Seq -> 'a Seq"
 | 
| 24 |   Takewhile        ::"('a => bool)  => 'a Seq -> 'a Seq"
 | |
| 3071 | 25 |   Zip              ::"'a Seq        -> 'b Seq -> ('a * 'b) Seq"
 | 
| 26 |   Flat             ::"('a Seq) seq   -> 'a Seq"
 | |
| 27 | ||
| 28 |   Filter2          ::"('a => bool)  => 'a Seq -> 'a Seq"
 | |
| 29 | ||
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 30 | abbreviation | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 31 |   Consq_syn  ("(_/>>_)"  [66,65] 65) where
 | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 32 | "a>>s == Consq a$s" | 
| 3071 | 33 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 34 | notation (xsymbols) | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 35 |   Consq_syn  ("(_\<leadsto>_)"  [66,65] 65)
 | 
| 4283 | 36 | |
| 3071 | 37 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 38 | (* list Enumeration *) | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 39 | syntax | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 40 |   "_totlist"      :: "args => 'a Seq"              ("[(_)!]")
 | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 41 |   "_partlist"     :: "args => 'a Seq"              ("[(_)?]")
 | 
| 3071 | 42 | translations | 
| 4283 | 43 | "[x, xs!]" == "x>>[xs!]" | 
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 44 | "[x!]" == "x>>CONST nil" | 
| 4283 | 45 | "[x, xs?]" == "x>>[xs?]" | 
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
23778diff
changeset | 46 | "[x?]" == "x>>CONST UU" | 
| 3071 | 47 | |
| 48 | defs | |
| 49 | ||
| 17233 | 50 | Consq_def: "Consq a == LAM s. Def a ## s" | 
| 3071 | 51 | |
| 17233 | 52 | Filter_def: "Filter P == sfilter$(flift2 P)" | 
| 3071 | 53 | |
| 17233 | 54 | Map_def: "Map f == smap$(flift2 f)" | 
| 3071 | 55 | |
| 17233 | 56 | Forall_def: "Forall P == sforall (flift2 P)" | 
| 3071 | 57 | |
| 17233 | 58 | Last_def: "Last == slast" | 
| 3071 | 59 | |
| 17233 | 60 | Dropwhile_def: "Dropwhile P == sdropwhile$(flift2 P)" | 
| 3071 | 61 | |
| 17233 | 62 | Takewhile_def: "Takewhile P == stakewhile$(flift2 P)" | 
| 3071 | 63 | |
| 17233 | 64 | Flat_def: "Flat == sflat" | 
| 3071 | 65 | |
| 17233 | 66 | Zip_def: | 
| 67 | "Zip == (fix$(LAM h t1 t2. case t1 of | |
| 3071 | 68 | nil => nil | 
| 17233 | 69 | | x##xs => (case t2 of | 
| 70 | nil => UU | |
| 71 | | y##ys => (case x of | |
| 12028 | 72 | UU => UU | 
| 17233 | 73 | | Def a => (case y of | 
| 12028 | 74 | UU => UU | 
| 10835 | 75 | | Def b => Def (a,b)##(h$xs$ys))))))" | 
| 3071 | 76 | |
| 17233 | 77 | Filter2_def: "Filter2 P == (fix$(LAM h t. case t of | 
| 3071 | 78 | nil => nil | 
| 17233 | 79 | | x##xs => (case x of UU => UU | Def y => (if P y | 
| 10835 | 80 | then x##(h$xs) | 
| 17233 | 81 | else h$xs))))" | 
| 3071 | 82 | |
| 19551 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 83 | declare andalso_and [simp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 84 | declare andalso_or [simp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 85 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 86 | subsection "recursive equations of operators" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 87 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 88 | subsubsection "Map" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 89 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 90 | lemma Map_UU: "Map f$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 91 | by (simp add: Map_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 92 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 93 | lemma Map_nil: "Map f$nil =nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 94 | by (simp add: Map_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 95 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 96 | lemma Map_cons: "Map f$(x>>xs)=(f x) >> Map f$xs" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 97 | by (simp add: Map_def Consq_def flift2_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 98 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 99 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 100 | subsubsection {* Filter *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 101 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 102 | lemma Filter_UU: "Filter P$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 103 | by (simp add: Filter_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 104 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 105 | lemma Filter_nil: "Filter P$nil =nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 106 | by (simp add: Filter_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 107 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 108 | lemma Filter_cons: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 109 | "Filter P$(x>>xs)= (if P x then x>>(Filter P$xs) else Filter P$xs)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 110 | by (simp add: Filter_def Consq_def flift2_def If_and_if) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 111 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 112 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 113 | subsubsection {* Forall *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 114 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 115 | lemma Forall_UU: "Forall P UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 116 | by (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 117 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 118 | lemma Forall_nil: "Forall P nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 119 | by (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 120 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 121 | lemma Forall_cons: "Forall P (x>>xs)= (P x & Forall P xs)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 122 | by (simp add: Forall_def sforall_def Consq_def flift2_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 123 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 124 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 125 | subsubsection {* Conc *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 126 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 127 | lemma Conc_cons: "(x>>xs) @@ y = x>>(xs @@y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 128 | by (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 129 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 130 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 131 | subsubsection {* Takewhile *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 132 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 133 | lemma Takewhile_UU: "Takewhile P$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 134 | by (simp add: Takewhile_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 135 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 136 | lemma Takewhile_nil: "Takewhile P$nil =nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 137 | by (simp add: Takewhile_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 138 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 139 | lemma Takewhile_cons: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 140 | "Takewhile P$(x>>xs)= (if P x then x>>(Takewhile P$xs) else nil)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 141 | by (simp add: Takewhile_def Consq_def flift2_def If_and_if) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 142 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 143 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 144 | subsubsection {* DropWhile *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 145 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 146 | lemma Dropwhile_UU: "Dropwhile P$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 147 | by (simp add: Dropwhile_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 148 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 149 | lemma Dropwhile_nil: "Dropwhile P$nil =nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 150 | by (simp add: Dropwhile_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 151 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 152 | lemma Dropwhile_cons: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 153 | "Dropwhile P$(x>>xs)= (if P x then Dropwhile P$xs else x>>xs)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 154 | by (simp add: Dropwhile_def Consq_def flift2_def If_and_if) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 155 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 156 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 157 | subsubsection {* Last *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 158 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 159 | lemma Last_UU: "Last$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 160 | by (simp add: Last_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 161 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 162 | lemma Last_nil: "Last$nil =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 163 | by (simp add: Last_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 164 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 165 | lemma Last_cons: "Last$(x>>xs)= (if xs=nil then Def x else Last$xs)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 166 | apply (simp add: Last_def Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 167 | apply (rule_tac x="xs" in seq.casedist) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 168 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 169 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 170 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 171 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 172 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 173 | subsubsection {* Flat *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 174 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 175 | lemma Flat_UU: "Flat$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 176 | by (simp add: Flat_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 177 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 178 | lemma Flat_nil: "Flat$nil =nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 179 | by (simp add: Flat_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 180 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 181 | lemma Flat_cons: "Flat$(x##xs)= x @@ (Flat$xs)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 182 | by (simp add: Flat_def Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 183 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 184 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 185 | subsubsection {* Zip *}
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 186 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 187 | lemma Zip_unfold: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 188 | "Zip = (LAM t1 t2. case t1 of | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 189 | nil => nil | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 190 | | x##xs => (case t2 of | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 191 | nil => UU | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 192 | | y##ys => (case x of | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 193 | UU => UU | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 194 | | Def a => (case y of | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 195 | UU => UU | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 196 | | Def b => Def (a,b)##(Zip$xs$ys)))))" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 197 | apply (rule trans) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 198 | apply (rule fix_eq2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 199 | apply (rule Zip_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 200 | apply (rule beta_cfun) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 201 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 202 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 203 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 204 | lemma Zip_UU1: "Zip$UU$y =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 205 | apply (subst Zip_unfold) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 206 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 207 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 208 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 209 | lemma Zip_UU2: "x~=nil ==> Zip$x$UU =UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 210 | apply (subst Zip_unfold) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 211 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 212 | apply (rule_tac x="x" in seq.casedist) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 213 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 214 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 215 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 216 | lemma Zip_nil: "Zip$nil$y =nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 217 | apply (subst Zip_unfold) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 218 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 219 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 220 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 221 | lemma Zip_cons_nil: "Zip$(x>>xs)$nil= UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 222 | apply (subst Zip_unfold) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 223 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 224 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 225 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 226 | lemma Zip_cons: "Zip$(x>>xs)$(y>>ys)= (x,y) >> Zip$xs$ys" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 227 | apply (rule trans) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 228 | apply (subst Zip_unfold) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 229 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 230 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 231 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 232 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 233 | lemmas [simp del] = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 234 | sfilter_UU sfilter_nil sfilter_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 235 | smap_UU smap_nil smap_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 236 | sforall2_UU sforall2_nil sforall2_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 237 | slast_UU slast_nil slast_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 238 | stakewhile_UU stakewhile_nil stakewhile_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 239 | sdropwhile_UU sdropwhile_nil sdropwhile_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 240 | sflat_UU sflat_nil sflat_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 241 | szip_UU1 szip_UU2 szip_nil szip_cons_nil szip_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 242 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 243 | lemmas [simp] = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 244 | Filter_UU Filter_nil Filter_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 245 | Map_UU Map_nil Map_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 246 | Forall_UU Forall_nil Forall_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 247 | Last_UU Last_nil Last_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 248 | Conc_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 249 | Takewhile_UU Takewhile_nil Takewhile_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 250 | Dropwhile_UU Dropwhile_nil Dropwhile_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 251 | Zip_UU1 Zip_UU2 Zip_nil Zip_cons_nil Zip_cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 252 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 253 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 254 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 255 | section "Cons" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 256 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 257 | lemma Consq_def2: "a>>s = (Def a)##s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 258 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 259 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 260 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 261 | lemma Seq_exhaust: "x = UU | x = nil | (? a s. x = a >> s)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 262 | apply (simp add: Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 263 | apply (cut_tac seq.exhaust) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 264 | apply (fast dest: not_Undef_is_Def [THEN iffD1]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 265 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 266 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 267 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 268 | lemma Seq_cases: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 269 | "!!P. [| x = UU ==> P; x = nil ==> P; !!a s. x = a >> s ==> P |] ==> P" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 270 | apply (cut_tac x="x" in Seq_exhaust) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 271 | apply (erule disjE) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 272 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 273 | apply (erule disjE) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 274 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 275 | apply (erule exE)+ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 276 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 277 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 278 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 279 | (* | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 280 | fun Seq_case_tac s i = rule_tac x",s)] Seq_cases i | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 281 | THEN hyp_subst_tac i THEN hyp_subst_tac (i+1) THEN hyp_subst_tac (i+2); | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 282 | *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 283 | (* on a>>s only simp_tac, as full_simp_tac is uncomplete and often causes errors *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 284 | (* | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 285 | fun Seq_case_simp_tac s i = Seq_case_tac s i THEN Asm_simp_tac (i+2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 286 | THEN Asm_full_simp_tac (i+1) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 287 | THEN Asm_full_simp_tac i; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 288 | *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 289 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 290 | lemma Cons_not_UU: "a>>s ~= UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 291 | apply (subst Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 292 | apply (rule seq.con_rews) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 293 | apply (rule Def_not_UU) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 294 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 295 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 296 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 297 | lemma Cons_not_less_UU: "~(a>>x) << UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 298 | apply (rule notI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 299 | apply (drule antisym_less) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 300 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 301 | apply (simp add: Cons_not_UU) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 302 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 303 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 304 | lemma Cons_not_less_nil: "~a>>s << nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 305 | apply (subst Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 306 | apply (rule seq.rews) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 307 | apply (rule Def_not_UU) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 308 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 309 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 310 | lemma Cons_not_nil: "a>>s ~= nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 311 | apply (subst Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 312 | apply (rule seq.rews) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 313 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 314 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 315 | lemma Cons_not_nil2: "nil ~= a>>s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 316 | apply (simp add: Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 317 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 318 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 319 | lemma Cons_inject_eq: "(a>>s = b>>t) = (a = b & s = t)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 320 | apply (simp only: Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 321 | apply (simp add: scons_inject_eq) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 322 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 323 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 324 | lemma Cons_inject_less_eq: "(a>>s<<b>>t) = (a = b & s<<t)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 325 | apply (simp add: Consq_def2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 326 | apply (simp add: seq.inverts) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 327 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 328 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 329 | lemma seq_take_Cons: "seq_take (Suc n)$(a>>x) = a>> (seq_take n$x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 330 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 331 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 332 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 333 | lemmas [simp] = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 334 | Cons_not_nil2 Cons_inject_eq Cons_inject_less_eq seq_take_Cons | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 335 | Cons_not_UU Cons_not_less_UU Cons_not_less_nil Cons_not_nil | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 336 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 337 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 338 | subsection "induction" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 339 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 340 | lemma Seq_induct: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 341 | "!! P. [| adm P; P UU; P nil; !! a s. P s ==> P (a>>s)|] ==> P x" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 342 | apply (erule (2) seq.ind) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 343 | apply (tactic {* def_tac 1 *})
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 344 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 345 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 346 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 347 | lemma Seq_FinitePartial_ind: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 348 | "!! P.[|P UU;P nil; !! a s. P s ==> P(a>>s) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 349 | ==> seq_finite x --> P x" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 350 | apply (erule (1) seq_finite_ind) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 351 | apply (tactic {* def_tac 1 *})
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 352 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 353 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 354 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 355 | lemma Seq_Finite_ind: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 356 | "!! P.[| Finite x; P nil; !! a s. [| Finite s; P s|] ==> P (a>>s) |] ==> P x" | 
| 23778 | 357 | apply (erule (1) Finite.induct) | 
| 19551 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 358 | apply (tactic {* def_tac 1 *})
 | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 359 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 360 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 361 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 362 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 363 | (* rws are definitions to be unfolded for admissibility check *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 364 | (* | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 365 | fun Seq_induct_tac s rws i = rule_tac x",s)] Seq_induct i | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 366 | THEN (REPEAT_DETERM (CHANGED (Asm_simp_tac (i+1)))) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 367 | THEN simp add: rws) i; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 368 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 369 | fun Seq_Finite_induct_tac i = erule Seq_Finite_ind i | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 370 | THEN (REPEAT_DETERM (CHANGED (Asm_simp_tac i))); | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 371 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 372 | fun pair_tac s = rule_tac p",s)] PairE | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 373 | THEN' hyp_subst_tac THEN' Simp_tac; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 374 | *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 375 | (* induction on a sequence of pairs with pairsplitting and simplification *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 376 | (* | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 377 | fun pair_induct_tac s rws i = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 378 | rule_tac x",s)] Seq_induct i | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 379 | THEN pair_tac "a" (i+3) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 380 | THEN (REPEAT_DETERM (CHANGED (Simp_tac (i+1)))) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 381 | THEN simp add: rws) i; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 382 | *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 383 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 384 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 385 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 386 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 387 | subsection "HD,TL" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 388 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 389 | lemma HD_Cons [simp]: "HD$(x>>y) = Def x" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 390 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 391 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 392 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 393 | lemma TL_Cons [simp]: "TL$(x>>y) = y" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 394 | apply (simp add: Consq_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 395 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 396 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 397 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 398 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 399 | subsection "Finite, Partial, Infinite" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 400 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 401 | lemma Finite_Cons [simp]: "Finite (a>>xs) = Finite xs" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 402 | apply (simp add: Consq_def2 Finite_cons) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 403 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 404 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 405 | lemma FiniteConc_1: "Finite (x::'a Seq) ==> Finite y --> Finite (x@@y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 406 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 407 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 408 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 409 | lemma FiniteConc_2: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 410 | "Finite (z::'a Seq) ==> !x y. z= x@@y --> (Finite x & Finite y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 411 | apply (erule Seq_Finite_ind) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 412 | (* nil*) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 413 | apply (intro strip) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 414 | apply (rule_tac x="x" in Seq_cases, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 415 | (* cons *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 416 | apply (intro strip) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 417 | apply (rule_tac x="x" in Seq_cases, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 418 | apply (rule_tac x="y" in Seq_cases, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 419 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 420 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 421 | lemma FiniteConc [simp]: "Finite(x@@y) = (Finite (x::'a Seq) & Finite y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 422 | apply (rule iffI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 423 | apply (erule FiniteConc_2 [rule_format]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 424 | apply (rule refl) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 425 | apply (rule FiniteConc_1 [rule_format]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 426 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 427 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 428 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 429 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 430 | lemma FiniteMap1: "Finite s ==> Finite (Map f$s)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 431 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 432 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 433 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 434 | lemma FiniteMap2: "Finite s ==> ! t. (s = Map f$t) --> Finite t" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 435 | apply (erule Seq_Finite_ind) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 436 | apply (intro strip) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 437 | apply (rule_tac x="t" in Seq_cases, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 438 | (* main case *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 439 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 440 | apply (rule_tac x="t" in Seq_cases, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 441 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 442 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 443 | lemma Map2Finite: "Finite (Map f$s) = Finite s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 444 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 445 | apply (erule FiniteMap2 [rule_format]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 446 | apply (rule refl) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 447 | apply (erule FiniteMap1) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 448 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 449 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 450 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 451 | lemma FiniteFilter: "Finite s ==> Finite (Filter P$s)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 452 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 453 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 454 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 455 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 456 | (* ----------------------------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 457 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 458 | subsection "Conc" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 459 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 460 | lemma Conc_cong: "!! x::'a Seq. Finite x ==> ((x @@ y) = (x @@ z)) = (y = z)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 461 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 462 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 463 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 464 | lemma Conc_assoc: "(x @@ y) @@ z = (x::'a Seq) @@ y @@ z" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 465 | apply (rule_tac x="x" in Seq_induct, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 466 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 467 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 468 | lemma nilConc [simp]: "s@@ nil = s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 469 | apply (rule_tac x="s" in seq.ind) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 470 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 471 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 472 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 473 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 474 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 475 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 476 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 477 | (* should be same as nil_is_Conc2 when all nils are turned to right side !! *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 478 | lemma nil_is_Conc: "(nil = x @@ y) = ((x::'a Seq)= nil & y = nil)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 479 | apply (rule_tac x="x" in Seq_cases) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 480 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 481 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 482 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 483 | lemma nil_is_Conc2: "(x @@ y = nil) = ((x::'a Seq)= nil & y = nil)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 484 | apply (rule_tac x="x" in Seq_cases) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 485 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 486 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 487 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 488 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 489 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 490 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 491 | subsection "Last" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 492 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 493 | lemma Finite_Last1: "Finite s ==> s~=nil --> Last$s~=UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 494 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 495 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 496 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 497 | lemma Finite_Last2: "Finite s ==> Last$s=UU --> s=nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 498 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 499 | apply fast | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 500 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 501 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 502 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 503 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 504 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 505 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 506 | subsection "Filter, Conc" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 507 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 508 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 509 | lemma FilterPQ: "Filter P$(Filter Q$s) = Filter (%x. P x & Q x)$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 510 | apply (rule_tac x="s" in Seq_induct, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 511 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 512 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 513 | lemma FilterConc: "Filter P$(x @@ y) = (Filter P$x @@ Filter P$y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 514 | apply (simp add: Filter_def sfiltersconc) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 515 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 516 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 517 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 518 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 519 | subsection "Map" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 520 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 521 | lemma MapMap: "Map f$(Map g$s) = Map (f o g)$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 522 | apply (rule_tac x="s" in Seq_induct, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 523 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 524 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 525 | lemma MapConc: "Map f$(x@@y) = (Map f$x) @@ (Map f$y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 526 | apply (rule_tac x="x" in Seq_induct, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 527 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 528 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 529 | lemma MapFilter: "Filter P$(Map f$x) = Map f$(Filter (P o f)$x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 530 | apply (rule_tac x="x" in Seq_induct, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 531 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 532 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 533 | lemma nilMap: "nil = (Map f$s) --> s= nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 534 | apply (rule_tac x="s" in Seq_cases, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 535 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 536 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 537 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 538 | lemma ForallMap: "Forall P (Map f$s) = Forall (P o f) s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 539 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 540 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 541 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 542 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 543 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 544 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 545 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 546 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 547 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 548 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 549 | subsection "Forall" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 550 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 551 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 552 | lemma ForallPForallQ1: "Forall P ys & (! x. P x --> Q x) \ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 553 | \ --> Forall Q ys" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 554 | apply (rule_tac x="ys" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 555 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 556 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 557 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 558 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 559 | lemmas ForallPForallQ = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 560 | ForallPForallQ1 [THEN mp, OF conjI, OF _ allI, OF _ impI] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 561 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 562 | lemma Forall_Conc_impl: "(Forall P x & Forall P y) --> Forall P (x @@ y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 563 | apply (rule_tac x="x" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 564 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 565 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 566 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 567 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 568 | lemma Forall_Conc [simp]: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 569 | "Finite x ==> Forall P (x @@ y) = (Forall P x & Forall P y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 570 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 571 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 572 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 573 | lemma ForallTL1: "Forall P s --> Forall P (TL$s)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 574 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 575 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 576 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 577 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 578 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 579 | lemmas ForallTL = ForallTL1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 580 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 581 | lemma ForallDropwhile1: "Forall P s --> Forall P (Dropwhile Q$s)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 582 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 583 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 584 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 585 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 586 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 587 | lemmas ForallDropwhile = ForallDropwhile1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 588 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 589 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 590 | (* only admissible in t, not if done in s *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 591 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 592 | lemma Forall_prefix: "! s. Forall P s --> t<<s --> Forall P t" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 593 | apply (rule_tac x="t" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 594 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 595 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 596 | apply (intro strip) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 597 | apply (rule_tac x="sa" in Seq_cases) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 598 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 599 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 600 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 601 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 602 | lemmas Forall_prefixclosed = Forall_prefix [rule_format] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 603 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 604 | lemma Forall_postfixclosed: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 605 | "[| Finite h; Forall P s; s= h @@ t |] ==> Forall P t" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 606 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 607 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 608 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 609 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 610 | lemma ForallPFilterQR1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 611 | "((! x. P x --> (Q x = R x)) & Forall P tr) --> Filter Q$tr = Filter R$tr" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 612 | apply (rule_tac x="tr" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 613 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 614 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 615 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 616 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 617 | lemmas ForallPFilterQR = ForallPFilterQR1 [THEN mp, OF conjI, OF allI] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 618 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 619 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 620 | (* ------------------------------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 621 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 622 | subsection "Forall, Filter" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 623 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 624 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 625 | lemma ForallPFilterP: "Forall P (Filter P$x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 626 | apply (simp add: Filter_def Forall_def forallPsfilterP) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 627 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 628 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 629 | (* holds also in other direction, then equal to forallPfilterP *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 630 | lemma ForallPFilterPid1: "Forall P x --> Filter P$x = x" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 631 | apply (rule_tac x="x" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 632 | apply (simp add: Forall_def sforall_def Filter_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 633 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 634 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 635 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 636 | lemmas ForallPFilterPid = ForallPFilterPid1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 637 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 638 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 639 | (* holds also in other direction *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 640 | lemma ForallnPFilterPnil1: "!! ys . Finite ys ==> | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 641 | Forall (%x. ~P x) ys --> Filter P$ys = nil " | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 642 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 643 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 644 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 645 | lemmas ForallnPFilterPnil = ForallnPFilterPnil1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 646 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 647 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 648 | (* holds also in other direction *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 649 | lemma ForallnPFilterPUU1: "~Finite ys & Forall (%x. ~P x) ys \ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 650 | \ --> Filter P$ys = UU " | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 651 | apply (rule_tac x="ys" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 652 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 653 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 654 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 655 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 656 | lemmas ForallnPFilterPUU = ForallnPFilterPUU1 [THEN mp, OF conjI] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 657 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 658 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 659 | (* inverse of ForallnPFilterPnil *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 660 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 661 | lemma FilternPnilForallP1: "!! ys . Filter P$ys = nil --> | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 662 | (Forall (%x. ~P x) ys & Finite ys)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 663 | apply (rule_tac x="ys" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 664 | (* adm *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 665 | apply (simp add: seq.compacts Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 666 | (* base cases *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 667 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 668 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 669 | (* main case *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 670 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 671 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 672 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 673 | lemmas FilternPnilForallP = FilternPnilForallP1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 674 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 675 | (* inverse of ForallnPFilterPUU. proved apply 2 lemmas because of adm problems *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 676 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 677 | lemma FilterUU_nFinite_lemma1: "Finite ys ==> Filter P$ys ~= UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 678 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 679 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 680 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 681 | lemma FilterUU_nFinite_lemma2: "~ Forall (%x. ~P x) ys --> Filter P$ys ~= UU" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 682 | apply (rule_tac x="ys" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 683 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 684 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 685 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 686 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 687 | lemma FilternPUUForallP: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 688 | "Filter P$ys = UU ==> (Forall (%x. ~P x) ys & ~Finite ys)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 689 | apply (rule conjI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 690 | apply (cut_tac FilterUU_nFinite_lemma2 [THEN mp, COMP rev_contrapos]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 691 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 692 | apply (blast dest!: FilterUU_nFinite_lemma1) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 693 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 694 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 695 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 696 | lemma ForallQFilterPnil: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 697 | "!! Q P.[| Forall Q ys; Finite ys; !!x. Q x ==> ~P x|] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 698 | ==> Filter P$ys = nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 699 | apply (erule ForallnPFilterPnil) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 700 | apply (erule ForallPForallQ) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 701 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 702 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 703 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 704 | lemma ForallQFilterPUU: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 705 | "!! Q P. [| ~Finite ys; Forall Q ys; !!x. Q x ==> ~P x|] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 706 | ==> Filter P$ys = UU " | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 707 | apply (erule ForallnPFilterPUU) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 708 | apply (erule ForallPForallQ) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 709 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 710 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 711 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 712 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 713 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 714 | (* ------------------------------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 715 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 716 | subsection "Takewhile, Forall, Filter" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 717 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 718 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 719 | lemma ForallPTakewhileP [simp]: "Forall P (Takewhile P$x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 720 | apply (simp add: Forall_def Takewhile_def sforallPstakewhileP) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 721 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 722 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 723 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 724 | lemma ForallPTakewhileQ [simp]: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 725 | "!! P. [| !!x. Q x==> P x |] ==> Forall P (Takewhile Q$x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 726 | apply (rule ForallPForallQ) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 727 | apply (rule ForallPTakewhileP) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 728 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 729 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 730 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 731 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 732 | lemma FilterPTakewhileQnil [simp]: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 733 | "!! Q P.[| Finite (Takewhile Q$ys); !!x. Q x ==> ~P x |] \ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 734 | \ ==> Filter P$(Takewhile Q$ys) = nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 735 | apply (erule ForallnPFilterPnil) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 736 | apply (rule ForallPForallQ) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 737 | apply (rule ForallPTakewhileP) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 738 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 739 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 740 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 741 | lemma FilterPTakewhileQid [simp]: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 742 | "!! Q P. [| !!x. Q x ==> P x |] ==> \ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 743 | \ Filter P$(Takewhile Q$ys) = (Takewhile Q$ys)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 744 | apply (rule ForallPFilterPid) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 745 | apply (rule ForallPForallQ) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 746 | apply (rule ForallPTakewhileP) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 747 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 748 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 749 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 750 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 751 | lemma Takewhile_idempotent: "Takewhile P$(Takewhile P$s) = Takewhile P$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 752 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 753 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 754 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 755 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 756 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 757 | lemma ForallPTakewhileQnP [simp]: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 758 | "Forall P s --> Takewhile (%x. Q x | (~P x))$s = Takewhile Q$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 759 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 760 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 761 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 762 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 763 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 764 | lemma ForallPDropwhileQnP [simp]: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 765 | "Forall P s --> Dropwhile (%x. Q x | (~P x))$s = Dropwhile Q$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 766 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 767 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 768 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 769 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 770 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 771 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 772 | lemma TakewhileConc1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 773 | "Forall P s --> Takewhile P$(s @@ t) = s @@ (Takewhile P$t)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 774 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 775 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 776 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 777 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 778 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 779 | lemmas TakewhileConc = TakewhileConc1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 780 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 781 | lemma DropwhileConc1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 782 | "Finite s ==> Forall P s --> Dropwhile P$(s @@ t) = Dropwhile P$t" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 783 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 784 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 785 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 786 | lemmas DropwhileConc = DropwhileConc1 [THEN mp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 787 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 788 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 789 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 790 | (* ----------------------------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 791 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 792 | subsection "coinductive characterizations of Filter" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 793 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 794 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 795 | lemma divide_Seq_lemma: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 796 | "HD$(Filter P$y) = Def x | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 797 | --> y = ((Takewhile (%x. ~P x)$y) @@ (x >> TL$(Dropwhile (%a.~P a)$y))) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 798 | & Finite (Takewhile (%x. ~ P x)$y) & P x" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 799 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 800 | (* FIX: pay attention: is only admissible with chain-finite package to be added to | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 801 | adm test and Finite f x admissibility *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 802 | apply (rule_tac x="y" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 803 | apply (simp add: adm_subst [OF _ adm_Finite]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 804 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 805 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 806 | apply (case_tac "P a") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 807 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 808 | apply blast | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 809 | (* ~ P a *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 810 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 811 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 812 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 813 | lemma divide_Seq: "(x>>xs) << Filter P$y | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 814 | ==> y = ((Takewhile (%a. ~ P a)$y) @@ (x >> TL$(Dropwhile (%a.~P a)$y))) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 815 | & Finite (Takewhile (%a. ~ P a)$y) & P x" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 816 | apply (rule divide_Seq_lemma [THEN mp]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 817 | apply (drule_tac f="HD" and x="x>>xs" in monofun_cfun_arg) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 818 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 819 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 820 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 821 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 822 | lemma nForall_HDFilter: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 823 | "~Forall P y --> (? x. HD$(Filter (%a. ~P a)$y) = Def x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 824 | (* Pay attention: is only admissible with chain-finite package to be added to | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 825 | adm test *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 826 | apply (rule_tac x="y" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 827 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 828 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 829 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 830 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 831 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 832 | lemma divide_Seq2: "~Forall P y | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 833 | ==> ? x. y= (Takewhile P$y @@ (x >> TL$(Dropwhile P$y))) & | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 834 | Finite (Takewhile P$y) & (~ P x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 835 | apply (drule nForall_HDFilter [THEN mp]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 836 | apply safe | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 837 | apply (rule_tac x="x" in exI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 838 | apply (cut_tac P1="%x. ~ P x" in divide_Seq_lemma [THEN mp]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 839 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 840 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 841 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 842 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 843 | lemma divide_Seq3: "~Forall P y | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 844 | ==> ? x bs rs. y= (bs @@ (x>>rs)) & Finite bs & Forall P bs & (~ P x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 845 | apply (drule divide_Seq2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 846 | (*Auto_tac no longer proves it*) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 847 | apply fastsimp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 848 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 849 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 850 | lemmas [simp] = FilterPQ FilterConc Conc_cong | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 851 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 852 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 853 | (* ------------------------------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 854 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 855 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 856 | subsection "take_lemma" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 857 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 858 | lemma seq_take_lemma: "(!n. seq_take n$x = seq_take n$x') = (x = x')" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 859 | apply (rule iffI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 860 | apply (rule seq.take_lemmas) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 861 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 862 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 863 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 864 | lemma take_reduction1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 865 | " ! n. ((! k. k < n --> seq_take k$y1 = seq_take k$y2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 866 | --> seq_take n$(x @@ (t>>y1)) = seq_take n$(x @@ (t>>y2)))" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 867 | apply (rule_tac x="x" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 868 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 869 | apply (intro strip) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 870 | apply (case_tac "n") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 871 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 872 | apply (case_tac "n") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 873 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 874 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 875 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 876 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 877 | lemma take_reduction: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 878 | "!! n.[| x=y; s=t; !! k. k<n ==> seq_take k$y1 = seq_take k$y2|] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 879 | ==> seq_take n$(x @@ (s>>y1)) = seq_take n$(y @@ (t>>y2))" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 880 | apply (auto intro!: take_reduction1 [rule_format]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 881 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 882 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 883 | (* ------------------------------------------------------------------ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 884 | take-lemma and take_reduction for << instead of = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 885 | ------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 886 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 887 | lemma take_reduction_less1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 888 | " ! n. ((! k. k < n --> seq_take k$y1 << seq_take k$y2) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 889 | --> seq_take n$(x @@ (t>>y1)) << seq_take n$(x @@ (t>>y2)))" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 890 | apply (rule_tac x="x" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 891 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 892 | apply (intro strip) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 893 | apply (case_tac "n") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 894 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 895 | apply (case_tac "n") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 896 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 897 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 898 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 899 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 900 | lemma take_reduction_less: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 901 | "!! n.[| x=y; s=t;!! k. k<n ==> seq_take k$y1 << seq_take k$y2|] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 902 | ==> seq_take n$(x @@ (s>>y1)) << seq_take n$(y @@ (t>>y2))" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 903 | apply (auto intro!: take_reduction_less1 [rule_format]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 904 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 905 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 906 | lemma take_lemma_less1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 907 | assumes "!! n. seq_take n$s1 << seq_take n$s2" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 908 | shows "s1<<s2" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 909 | apply (rule_tac t="s1" in seq.reach [THEN subst]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 910 | apply (rule_tac t="s2" in seq.reach [THEN subst]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 911 | apply (rule fix_def2 [THEN ssubst]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 912 | apply (subst contlub_cfun_fun) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 913 | apply (rule chain_iterate) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 914 | apply (subst contlub_cfun_fun) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 915 | apply (rule chain_iterate) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 916 | apply (rule lub_mono) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 917 | apply (rule chain_iterate [THEN ch2ch_Rep_CFunL]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 918 | apply (rule chain_iterate [THEN ch2ch_Rep_CFunL]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 919 | apply (rule allI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 920 | apply (rule prems [unfolded seq.take_def]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 921 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 922 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 923 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 924 | lemma take_lemma_less: "(!n. seq_take n$x << seq_take n$x') = (x << x')" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 925 | apply (rule iffI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 926 | apply (rule take_lemma_less1) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 927 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 928 | apply (erule monofun_cfun_arg) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 929 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 930 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 931 | (* ------------------------------------------------------------------ | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 932 | take-lemma proof principles | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 933 | ------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 934 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 935 | lemma take_lemma_principle1: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 936 | "!! Q. [|!! s. [| Forall Q s; A s |] ==> (f s) = (g s) ; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 937 | !! s1 s2 y. [| Forall Q s1; Finite s1; ~ Q y; A (s1 @@ y>>s2)|] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 938 | ==> (f (s1 @@ y>>s2)) = (g (s1 @@ y>>s2)) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 939 | ==> A x --> (f x)=(g x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 940 | apply (case_tac "Forall Q x") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 941 | apply (auto dest!: divide_Seq3) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 942 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 943 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 944 | lemma take_lemma_principle2: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 945 | "!! Q. [|!! s. [| Forall Q s; A s |] ==> (f s) = (g s) ; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 946 | !! s1 s2 y. [| Forall Q s1; Finite s1; ~ Q y; A (s1 @@ y>>s2)|] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 947 | ==> ! n. seq_take n$(f (s1 @@ y>>s2)) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 948 | = seq_take n$(g (s1 @@ y>>s2)) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 949 | ==> A x --> (f x)=(g x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 950 | apply (case_tac "Forall Q x") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 951 | apply (auto dest!: divide_Seq3) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 952 | apply (rule seq.take_lemmas) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 953 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 954 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 955 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 956 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 957 | (* Note: in the following proofs the ordering of proof steps is very | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 958 | important, as otherwise either (Forall Q s1) would be in the IH as | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 959 | assumption (then rule useless) or it is not possible to strengthen | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 960 | the IH apply doing a forall closure of the sequence t (then rule also useless). | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 961 | This is also the reason why the induction rule (nat_less_induct or nat_induct) has to | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 962 | to be imbuilt into the rule, as induction has to be done early and the take lemma | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 963 | has to be used in the trivial direction afterwards for the (Forall Q x) case. *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 964 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 965 | lemma take_lemma_induct: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 966 | "!! Q. [|!! s. [| Forall Q s; A s |] ==> (f s) = (g s) ; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 967 | !! s1 s2 y n. [| ! t. A t --> seq_take n$(f t) = seq_take n$(g t); | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 968 | Forall Q s1; Finite s1; ~ Q y; A (s1 @@ y>>s2) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 969 | ==> seq_take (Suc n)$(f (s1 @@ y>>s2)) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 970 | = seq_take (Suc n)$(g (s1 @@ y>>s2)) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 971 | ==> A x --> (f x)=(g x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 972 | apply (rule impI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 973 | apply (rule seq.take_lemmas) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 974 | apply (rule mp) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 975 | prefer 2 apply assumption | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 976 | apply (rule_tac x="x" in spec) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 977 | apply (rule nat_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 978 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 979 | apply (rule allI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 980 | apply (case_tac "Forall Q xa") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 981 | apply (force intro!: seq_take_lemma [THEN iffD2, THEN spec]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 982 | apply (auto dest!: divide_Seq3) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 983 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 984 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 985 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 986 | lemma take_lemma_less_induct: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 987 | "!! Q. [|!! s. [| Forall Q s; A s |] ==> (f s) = (g s) ; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 988 | !! s1 s2 y n. [| ! t m. m < n --> A t --> seq_take m$(f t) = seq_take m$(g t); | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 989 | Forall Q s1; Finite s1; ~ Q y; A (s1 @@ y>>s2) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 990 | ==> seq_take n$(f (s1 @@ y>>s2)) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 991 | = seq_take n$(g (s1 @@ y>>s2)) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 992 | ==> A x --> (f x)=(g x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 993 | apply (rule impI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 994 | apply (rule seq.take_lemmas) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 995 | apply (rule mp) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 996 | prefer 2 apply assumption | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 997 | apply (rule_tac x="x" in spec) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 998 | apply (rule nat_less_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 999 | apply (rule allI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1000 | apply (case_tac "Forall Q xa") | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1001 | apply (force intro!: seq_take_lemma [THEN iffD2, THEN spec]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1002 | apply (auto dest!: divide_Seq3) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1003 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1004 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1005 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1006 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1007 | lemma take_lemma_in_eq_out: | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1008 | "!! Q. [| A UU ==> (f UU) = (g UU) ; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1009 | A nil ==> (f nil) = (g nil) ; | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1010 | !! s y n. [| ! t. A t --> seq_take n$(f t) = seq_take n$(g t); | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1011 | A (y>>s) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1012 | ==> seq_take (Suc n)$(f (y>>s)) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1013 | = seq_take (Suc n)$(g (y>>s)) |] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1014 | ==> A x --> (f x)=(g x)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1015 | apply (rule impI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1016 | apply (rule seq.take_lemmas) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1017 | apply (rule mp) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1018 | prefer 2 apply assumption | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1019 | apply (rule_tac x="x" in spec) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1020 | apply (rule nat_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1021 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1022 | apply (rule allI) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1023 | apply (rule_tac x="xa" in Seq_cases) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1024 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1025 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1026 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1027 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1028 | (* ------------------------------------------------------------------------------------ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1029 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1030 | subsection "alternative take_lemma proofs" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1031 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1032 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1033 | (* --------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1034 | (* Alternative Proof of FilterPQ *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1035 | (* --------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1036 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1037 | declare FilterPQ [simp del] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1038 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1039 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1040 | (* In general: How to do this case without the same adm problems | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1041 | as for the entire proof ? *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1042 | lemma Filter_lemma1: "Forall (%x.~(P x & Q x)) s | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1043 | --> Filter P$(Filter Q$s) = | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1044 | Filter (%x. P x & Q x)$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1045 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1046 | apply (rule_tac x="s" in Seq_induct) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1047 | apply (simp add: Forall_def sforall_def) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1048 | apply simp_all | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1049 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1050 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1051 | lemma Filter_lemma2: "Finite s ==> | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1052 | (Forall (%x. (~P x) | (~ Q x)) s | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1053 | --> Filter P$(Filter Q$s) = nil)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1054 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1055 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1056 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1057 | lemma Filter_lemma3: "Finite s ==> | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1058 | Forall (%x. (~P x) | (~ Q x)) s | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1059 | --> Filter (%x. P x & Q x)$s = nil" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1060 | apply (erule Seq_Finite_ind, simp_all) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1061 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1062 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1063 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1064 | lemma FilterPQ_takelemma: "Filter P$(Filter Q$s) = Filter (%x. P x & Q x)$s" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1065 | apply (rule_tac A1="%x. True" and | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1066 | Q1="%x.~(P x & Q x)" and x1="s" in | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1067 | take_lemma_induct [THEN mp]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1068 | (* better support for A = %x. True *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1069 | apply (simp add: Filter_lemma1) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1070 | apply (simp add: Filter_lemma2 Filter_lemma3) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1071 | apply simp | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1072 | done | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1073 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1074 | declare FilterPQ [simp] | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1075 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1076 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1077 | (* --------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1078 | (* Alternative Proof of MapConc *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1079 | (* --------------------------------------------------------------- *) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1080 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1081 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1082 | |
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1083 | lemma MapConc_takelemma: "Map f$(x@@y) = (Map f$x) @@ (Map f$y)" | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1084 | apply (rule_tac A1="%x. True" and x1="x" in | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1085 | take_lemma_in_eq_out [THEN mp]) | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1086 | apply auto | 
| 
4103954f3668
converted to isar theory; removed unsound adm_all axiom
 huffman parents: 
17233diff
changeset | 1087 | done | 
| 3071 | 1088 | |
| 19741 | 1089 | |
| 1090 | ||
| 1091 | ML {*
 | |
| 1092 | ||
| 1093 | local | |
| 1094 | val Seq_cases = thm "Seq_cases" | |
| 1095 | val Seq_induct = thm "Seq_induct" | |
| 1096 | val Seq_Finite_ind = thm "Seq_Finite_ind" | |
| 1097 | in | |
| 1098 | ||
| 1099 | fun Seq_case_tac s i = res_inst_tac [("x",s)] Seq_cases i
 | |
| 1100 | THEN hyp_subst_tac i THEN hyp_subst_tac (i+1) THEN hyp_subst_tac (i+2); | |
| 1101 | ||
| 1102 | (* on a>>s only simp_tac, as full_simp_tac is uncomplete and often causes errors *) | |
| 1103 | fun Seq_case_simp_tac s i = Seq_case_tac s i THEN SIMPSET' asm_simp_tac (i+2) | |
| 1104 | THEN SIMPSET' asm_full_simp_tac (i+1) | |
| 1105 | THEN SIMPSET' asm_full_simp_tac i; | |
| 1106 | ||
| 1107 | (* rws are definitions to be unfolded for admissibility check *) | |
| 1108 | fun Seq_induct_tac s rws i = res_inst_tac [("x",s)] Seq_induct i
 | |
| 1109 | THEN (REPEAT_DETERM (CHANGED (SIMPSET' asm_simp_tac (i+1)))) | |
| 1110 | THEN SIMPSET' (fn ss => simp_tac (ss addsimps rws)) i; | |
| 1111 | ||
| 1112 | fun Seq_Finite_induct_tac i = etac Seq_Finite_ind i | |
| 1113 | THEN (REPEAT_DETERM (CHANGED (SIMPSET' asm_simp_tac i))); | |
| 1114 | ||
| 1115 | fun pair_tac s = res_inst_tac [("p",s)] PairE
 | |
| 1116 | THEN' hyp_subst_tac THEN' SIMPSET' asm_full_simp_tac; | |
| 1117 | ||
| 1118 | (* induction on a sequence of pairs with pairsplitting and simplification *) | |
| 1119 | fun pair_induct_tac s rws i = | |
| 1120 |            res_inst_tac [("x",s)] Seq_induct i
 | |
| 1121 | THEN pair_tac "a" (i+3) | |
| 1122 | THEN (REPEAT_DETERM (CHANGED (SIMPSET' simp_tac (i+1)))) | |
| 1123 | THEN SIMPSET' (fn ss => simp_tac (ss addsimps rws)) i; | |
| 3071 | 1124 | |
| 12338 
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
 wenzelm parents: 
12218diff
changeset | 1125 | end | 
| 19741 | 1126 | |
| 1127 | *} | |
| 1128 | ||
| 1129 | ||
| 1130 | end |