248 fun term_of_set f T [] = Const ("{}", Type ("set", [T])) |
248 fun term_of_set f T [] = Const ("{}", Type ("set", [T])) |
249 | term_of_set f T (x :: xs) = Const ("insert", |
249 | term_of_set f T (x :: xs) = Const ("insert", |
250 T --> Type ("set", [T]) --> Type ("set", [T])) $ f x $ term_of_set f T xs; |
250 T --> Type ("set", [T]) --> Type ("set", [T])) $ f x $ term_of_set f T xs; |
251 *} |
251 *} |
252 attach (test) {* |
252 attach (test) {* |
253 fun gen_set' aG i j = frequency |
253 fun gen_set' aG aT i j = frequency |
254 [(i, fn () => aG j :: gen_set' aG (i-1) j), (1, fn () => [])] () |
254 [(i, fn () => |
255 and gen_set aG i = gen_set' aG i i; |
255 let |
|
256 val (x, t) = aG j; |
|
257 val (xs, ts) = gen_set' aG aT (i-1) j |
|
258 in |
|
259 (x :: xs, fn () => Const ("insert", |
|
260 aT --> Type ("set", [aT]) --> Type ("set", [aT])) $ t () $ ts ()) |
|
261 end), |
|
262 (1, fn () => ([], fn () => Const ("{}", Type ("set", [aT]))))] () |
|
263 and gen_set aG aT i = gen_set' aG aT i i; |
256 *} |
264 *} |
257 |
265 |
258 |
266 |
259 subsubsection {* const serializations *} |
267 subsubsection {* const serializations *} |
260 |
268 |