| author | wenzelm | 
| Wed, 23 Nov 2016 16:15:17 +0100 | |
| changeset 64521 | 1aef5a0e18d7 | 
| parent 62979 | 1e527c40ae40 | 
| child 67399 | eab6ce8368fa | 
| permissions | -rw-r--r-- | 
| 62979 | 1 | (* Title: HOL/Quickcheck_Random.thy | 
| 2 | Author: Florian Haftmann & Lukas Bulwahn, TU Muenchen | |
| 3 | *) | |
| 26265 | 4 | |
| 60758 | 5 | section \<open>A simple counterexample generator performing random testing\<close> | 
| 26265 | 6 | |
| 51126 
df86080de4cb
reform of predicate compiler / quickcheck theories:
 haftmann parents: 
50046diff
changeset | 7 | theory Quickcheck_Random | 
| 40650 
d40b347d5b0b
adding Enum to HOL-Main image and removing it from HOL-Library
 bulwahn parents: 
38857diff
changeset | 8 | imports Random Code_Evaluation Enum | 
| 26265 | 9 | begin | 
| 10 | ||
| 37751 | 11 | notation fcomp (infixl "\<circ>>" 60) | 
| 12 | notation scomp (infixl "\<circ>\<rightarrow>" 60) | |
| 31179 | 13 | |
| 60758 | 14 | setup \<open>Code_Target.add_derived_target ("Quickcheck", [(Code_Runtime.target, I)])\<close>
 | 
| 45718 
8979b2463fc8
quickcheck random can also find potential counterexamples;
 bulwahn parents: 
45178diff
changeset | 15 | |
| 60758 | 16 | subsection \<open>Catching Match exceptions\<close> | 
| 45718 
8979b2463fc8
quickcheck random can also find potential counterexamples;
 bulwahn parents: 
45178diff
changeset | 17 | |
| 45801 
5616fbda86e6
hiding definitional facts in Quickcheck; introducing catch_match more honestly
 bulwahn parents: 
45733diff
changeset | 18 | axiomatization catch_match :: "'a => 'a => 'a" | 
| 45718 
8979b2463fc8
quickcheck random can also find potential counterexamples;
 bulwahn parents: 
45178diff
changeset | 19 | |
| 52435 
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
 haftmann parents: 
51143diff
changeset | 20 | code_printing | 
| 
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
 haftmann parents: 
51143diff
changeset | 21 | constant catch_match \<rightharpoonup> (Quickcheck) "((_) handle Match => _)" | 
| 31179 | 22 | |
| 61799 | 23 | subsection \<open>The \<open>random\<close> class\<close> | 
| 26265 | 24 | |
| 28335 | 25 | class random = typerep + | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 26 |   fixes random :: "natural \<Rightarrow> Random.seed \<Rightarrow> ('a \<times> (unit \<Rightarrow> term)) \<times> Random.seed"
 | 
| 26265 | 27 | |
| 26267 
ba710daf77a7
added combinator for interpretation of construction of datatype
 haftmann parents: 
26265diff
changeset | 28 | |
| 60758 | 29 | subsection \<open>Fundamental and numeric types\<close> | 
| 31179 | 30 | |
| 31 | instantiation bool :: random | |
| 32 | begin | |
| 33 | ||
| 34 | definition | |
| 37751 | 35 | "random i = Random.range 2 \<circ>\<rightarrow> | 
| 32657 | 36 | (\<lambda>k. Pair (if k = 0 then Code_Evaluation.valtermify False else Code_Evaluation.valtermify True))" | 
| 31179 | 37 | |
| 38 | instance .. | |
| 39 | ||
| 40 | end | |
| 41 | ||
| 42 | instantiation itself :: (typerep) random | |
| 43 | begin | |
| 44 | ||
| 46975 | 45 | definition | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 46 |   random_itself :: "natural \<Rightarrow> Random.seed \<Rightarrow> ('a itself \<times> (unit \<Rightarrow> term)) \<times> Random.seed"
 | 
| 46975 | 47 | where "random_itself _ = Pair (Code_Evaluation.valtermify TYPE('a))"
 | 
| 31179 | 48 | |
| 49 | instance .. | |
| 50 | ||
| 51 | end | |
| 52 | ||
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 53 | instantiation char :: random | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 54 | begin | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 55 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 56 | definition | 
| 49972 
f11f8905d9fd
incorporated constant chars into instantiation proof for enum;
 haftmann parents: 
48891diff
changeset | 57 | "random _ = Random.select (Enum.enum :: char list) \<circ>\<rightarrow> (\<lambda>c. Pair (c, \<lambda>u. Code_Evaluation.term_of c))" | 
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 58 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 59 | instance .. | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 60 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 61 | end | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 62 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 63 | instantiation String.literal :: random | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 64 | begin | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 65 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 66 | definition | 
| 32657 | 67 | "random _ = Pair (STR '''', \<lambda>u. Code_Evaluation.term_of (STR ''''))" | 
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 68 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 69 | instance .. | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 70 | |
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 71 | end | 
| 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 72 | |
| 31179 | 73 | instantiation nat :: random | 
| 74 | begin | |
| 75 | ||
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 76 | definition random_nat :: "natural \<Rightarrow> Random.seed | 
| 46975 | 77 | \<Rightarrow> (nat \<times> (unit \<Rightarrow> Code_Evaluation.term)) \<times> Random.seed" | 
| 78 | where | |
| 37751 | 79 | "random_nat i = Random.range (i + 1) \<circ>\<rightarrow> (\<lambda>k. Pair ( | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 80 | let n = nat_of_natural k | 
| 32657 | 81 | in (n, \<lambda>_. Code_Evaluation.term_of n)))" | 
| 31194 | 82 | |
| 83 | instance .. | |
| 84 | ||
| 85 | end | |
| 86 | ||
| 87 | instantiation int :: random | |
| 88 | begin | |
| 89 | ||
| 90 | definition | |
| 37751 | 91 | "random i = Random.range (2 * i + 1) \<circ>\<rightarrow> (\<lambda>k. Pair ( | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 92 | let j = (if k \<ge> i then int (nat_of_natural (k - i)) else - (int (nat_of_natural (i - k)))) | 
| 32657 | 93 | in (j, \<lambda>_. Code_Evaluation.term_of j)))" | 
| 31179 | 94 | |
| 95 | instance .. | |
| 96 | ||
| 30945 | 97 | end | 
| 31179 | 98 | |
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 99 | instantiation natural :: random | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 100 | begin | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 101 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 102 | definition random_natural :: "natural \<Rightarrow> Random.seed | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 103 | \<Rightarrow> (natural \<times> (unit \<Rightarrow> Code_Evaluation.term)) \<times> Random.seed" | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 104 | where | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 105 | "random_natural i = Random.range (i + 1) \<circ>\<rightarrow> (\<lambda>n. Pair (n, \<lambda>_. Code_Evaluation.term_of n))" | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 106 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 107 | instance .. | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 108 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 109 | end | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 110 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 111 | instantiation integer :: random | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 112 | begin | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 113 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 114 | definition random_integer :: "natural \<Rightarrow> Random.seed | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 115 | \<Rightarrow> (integer \<times> (unit \<Rightarrow> Code_Evaluation.term)) \<times> Random.seed" | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 116 | where | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 117 | "random_integer i = Random.range (2 * i + 1) \<circ>\<rightarrow> (\<lambda>k. Pair ( | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 118 | let j = (if k \<ge> i then integer_of_natural (k - i) else - (integer_of_natural (i - k))) | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 119 | in (j, \<lambda>_. Code_Evaluation.term_of j)))" | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 120 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 121 | instance .. | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 122 | |
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 123 | end | 
| 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 124 | |
| 31260 | 125 | |
| 60758 | 126 | subsection \<open>Complex generators\<close> | 
| 31260 | 127 | |
| 60758 | 128 | text \<open>Towards @{typ "'a \<Rightarrow> 'b"}\<close>
 | 
| 31603 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 129 | |
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 130 | axiomatization random_fun_aux :: "typerep \<Rightarrow> typerep \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> term)
 | 
| 46975 | 131 |   \<Rightarrow> (Random.seed \<Rightarrow> ('b \<times> (unit \<Rightarrow> term)) \<times> Random.seed)
 | 
| 132 | \<Rightarrow> (Random.seed \<Rightarrow> Random.seed \<times> Random.seed) | |
| 31603 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 133 |   \<Rightarrow> Random.seed \<Rightarrow> (('a \<Rightarrow> 'b) \<times> (unit \<Rightarrow> term)) \<times> Random.seed"
 | 
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 134 | |
| 31622 | 135 | definition random_fun_lift :: "(Random.seed \<Rightarrow> ('b \<times> (unit \<Rightarrow> term)) \<times> Random.seed)
 | 
| 61076 | 136 |   \<Rightarrow> Random.seed \<Rightarrow> (('a::term_of \<Rightarrow> 'b::typerep) \<times> (unit \<Rightarrow> term)) \<times> Random.seed"
 | 
| 46975 | 137 | where | 
| 138 | "random_fun_lift f = | |
| 139 |     random_fun_aux TYPEREP('a) TYPEREP('b) (op =) Code_Evaluation.term_of f Random.split_seed"
 | |
| 31603 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 140 | |
| 38857 
97775f3e8722
renamed class/constant eq to equal; tuned some instantiations
 haftmann parents: 
37751diff
changeset | 141 | instantiation "fun" :: ("{equal, term_of}", random) random
 | 
| 31603 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 142 | begin | 
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 143 | |
| 46975 | 144 | definition | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 145 |   random_fun :: "natural \<Rightarrow> Random.seed \<Rightarrow> (('a \<Rightarrow> 'b) \<times> (unit \<Rightarrow> term)) \<times> Random.seed"
 | 
| 46975 | 146 | where "random i = random_fun_lift (random i)" | 
| 31603 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 147 | |
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 148 | instance .. | 
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 149 | |
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 150 | end | 
| 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 151 | |
| 60758 | 152 | text \<open>Towards type copies and datatypes\<close> | 
| 31603 
fa30cd74d7d6
revised interpretation combinator for datatype constructions
 haftmann parents: 
31483diff
changeset | 153 | |
| 46975 | 154 | definition collapse :: "('a \<Rightarrow> ('a \<Rightarrow> 'b \<times> 'a) \<times> 'a) \<Rightarrow> 'a \<Rightarrow> 'b \<times> 'a"
 | 
| 155 | where "collapse f = (f \<circ>\<rightarrow> id)" | |
| 31223 
87bde6b5f793
re-added corrected version of type copy quickcheck generator
 haftmann parents: 
31211diff
changeset | 156 | |
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 157 | definition beyond :: "natural \<Rightarrow> natural \<Rightarrow> natural" | 
| 46975 | 158 | where "beyond k l = (if l > k then l else 0)" | 
| 31260 | 159 | |
| 46975 | 160 | lemma beyond_zero: "beyond k 0 = 0" | 
| 31267 | 161 | by (simp add: beyond_def) | 
| 162 | ||
| 46311 | 163 | |
| 46975 | 164 | definition (in term_syntax) [code_unfold]: | 
| 165 |   "valterm_emptyset = Code_Evaluation.valtermify ({} :: ('a :: typerep) set)"
 | |
| 166 | ||
| 167 | definition (in term_syntax) [code_unfold]: | |
| 168 |   "valtermify_insert x s = Code_Evaluation.valtermify insert {\<cdot>} (x :: ('a :: typerep * _)) {\<cdot>} s"
 | |
| 46311 | 169 | |
| 170 | instantiation set :: (random) random | |
| 171 | begin | |
| 172 | ||
| 58389 | 173 | fun random_aux_set | 
| 46311 | 174 | where | 
| 175 | "random_aux_set 0 j = collapse (Random.select_weight [(1, Pair valterm_emptyset)])" | |
| 46975 | 176 | | "random_aux_set (Code_Numeral.Suc i) j = | 
| 177 | collapse (Random.select_weight | |
| 178 | [(1, Pair valterm_emptyset), | |
| 179 | (Code_Numeral.Suc i, | |
| 180 | random j \<circ>\<rightarrow> (%x. random_aux_set i j \<circ>\<rightarrow> (%s. Pair (valtermify_insert x s))))])" | |
| 46311 | 181 | |
| 182 | lemma [code]: | |
| 46975 | 183 | "random_aux_set i j = | 
| 184 | collapse (Random.select_weight [(1, Pair valterm_emptyset), | |
| 185 | (i, random j \<circ>\<rightarrow> (%x. random_aux_set (i - 1) j \<circ>\<rightarrow> (%s. Pair (valtermify_insert x s))))])" | |
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 186 | proof (induct i rule: natural.induct) | 
| 46311 | 187 | case zero | 
| 50046 | 188 | show ?case by (subst select_weight_drop_zero [symmetric]) | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 189 | (simp add: random_aux_set.simps [simplified] less_natural_def) | 
| 46311 | 190 | next | 
| 46547 
d1dcb91a512e
use qualified constant names instead of suffixes (from Florian Haftmann)
 huffman parents: 
46311diff
changeset | 191 | case (Suc i) | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 192 | show ?case by (simp only: random_aux_set.simps(2) [of "i"] Suc_natural_minus_one) | 
| 46311 | 193 | qed | 
| 194 | ||
| 46975 | 195 | definition "random_set i = random_aux_set i i" | 
| 46311 | 196 | |
| 197 | instance .. | |
| 198 | ||
| 199 | end | |
| 200 | ||
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 201 | lemma random_aux_rec: | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 202 | fixes random_aux :: "natural \<Rightarrow> 'a" | 
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 203 | assumes "random_aux 0 = rhs 0" | 
| 46547 
d1dcb91a512e
use qualified constant names instead of suffixes (from Florian Haftmann)
 huffman parents: 
46311diff
changeset | 204 | and "\<And>k. random_aux (Code_Numeral.Suc k) = rhs (Code_Numeral.Suc k)" | 
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 205 | shows "random_aux k = rhs k" | 
| 51143 
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
 haftmann parents: 
51126diff
changeset | 206 | using assms by (rule natural.induct) | 
| 31483 
88210717bfc8
added generator for char and trivial generator for String.literal
 haftmann parents: 
31267diff
changeset | 207 | |
| 60758 | 208 | subsection \<open>Deriving random generators for datatypes\<close> | 
| 45718 
8979b2463fc8
quickcheck random can also find potential counterexamples;
 bulwahn parents: 
45178diff
changeset | 209 | |
| 48891 | 210 | ML_file "Tools/Quickcheck/quickcheck_common.ML" | 
| 211 | ML_file "Tools/Quickcheck/random_generators.ML" | |
| 34968 
ceeffca32eb0
tuned structure; moved non-related quickcheck.setup to Code_Generator.thy
 haftmann parents: 
33562diff
changeset | 212 | |
| 
ceeffca32eb0
tuned structure; moved non-related quickcheck.setup to Code_Generator.thy
 haftmann parents: 
33562diff
changeset | 213 | |
| 60758 | 214 | subsection \<open>Code setup\<close> | 
| 33561 
ab01b72715ef
introduced Auto Nitpick in addition to Auto Quickcheck;
 blanchet parents: 
32657diff
changeset | 215 | |
| 52435 
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
 haftmann parents: 
51143diff
changeset | 216 | code_printing | 
| 
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
 haftmann parents: 
51143diff
changeset | 217 | constant random_fun_aux \<rightharpoonup> (Quickcheck) "Random'_Generators.random'_fun" | 
| 61799 | 218 |   \<comment> \<open>With enough criminal energy this can be abused to derive @{prop False};
 | 
| 219 | for this reason we use a distinguished target \<open>Quickcheck\<close> | |
| 60758 | 220 | not spoiling the regular trusted code generation\<close> | 
| 34968 
ceeffca32eb0
tuned structure; moved non-related quickcheck.setup to Code_Generator.thy
 haftmann parents: 
33562diff
changeset | 221 | |
| 41935 
d786a8a3dc47
minor corrections for renaming; moved postprocessing of terms to Quickcheck_Common
 bulwahn parents: 
41928diff
changeset | 222 | code_reserved Quickcheck Random_Generators | 
| 34968 
ceeffca32eb0
tuned structure; moved non-related quickcheck.setup to Code_Generator.thy
 haftmann parents: 
33562diff
changeset | 223 | |
| 37751 | 224 | no_notation fcomp (infixl "\<circ>>" 60) | 
| 225 | no_notation scomp (infixl "\<circ>\<rightarrow>" 60) | |
| 51126 
df86080de4cb
reform of predicate compiler / quickcheck theories:
 haftmann parents: 
50046diff
changeset | 226 | |
| 45801 
5616fbda86e6
hiding definitional facts in Quickcheck; introducing catch_match more honestly
 bulwahn parents: 
45733diff
changeset | 227 | hide_const (open) catch_match random collapse beyond random_fun_aux random_fun_lift | 
| 
5616fbda86e6
hiding definitional facts in Quickcheck; introducing catch_match more honestly
 bulwahn parents: 
45733diff
changeset | 228 | |
| 51126 
df86080de4cb
reform of predicate compiler / quickcheck theories:
 haftmann parents: 
50046diff
changeset | 229 | hide_fact (open) collapse_def beyond_def random_fun_lift_def | 
| 31267 | 230 | |
| 31179 | 231 | end |