equal
deleted
inserted
replaced
266 fun nvars (Const (@{syntax_const "_idts"}, _) $ _ $ idts) = nvars idts + 1 |
266 fun nvars (Const (@{syntax_const "_idts"}, _) $ _ $ idts) = nvars idts + 1 |
267 | nvars _ = 1; |
267 | nvars _ = 1; |
268 |
268 |
269 fun setcompr_tr [e, idts, b] = |
269 fun setcompr_tr [e, idts, b] = |
270 let |
270 let |
271 val eq = Syntax.const @{const_syntax "op ="} $ Bound (nvars idts) $ e; |
271 val eq = Syntax.const @{const_syntax HOL.eq} $ Bound (nvars idts) $ e; |
272 val P = Syntax.const @{const_syntax HOL.conj} $ eq $ b; |
272 val P = Syntax.const @{const_syntax HOL.conj} $ eq $ b; |
273 val exP = ex_tr [idts, P]; |
273 val exP = ex_tr [idts, P]; |
274 in Syntax.const @{const_syntax Collect} $ Term.absdummy (dummyT, exP) end; |
274 in Syntax.const @{const_syntax Collect} $ Term.absdummy (dummyT, exP) end; |
275 |
275 |
276 in [(@{syntax_const "_Setcompr"}, setcompr_tr)] end; |
276 in [(@{syntax_const "_Setcompr"}, setcompr_tr)] end; |
287 |
287 |
288 fun setcompr_tr' [Abs (abs as (_, _, P))] = |
288 fun setcompr_tr' [Abs (abs as (_, _, P))] = |
289 let |
289 let |
290 fun check (Const (@{const_syntax Ex}, _) $ Abs (_, _, P), n) = check (P, n + 1) |
290 fun check (Const (@{const_syntax Ex}, _) $ Abs (_, _, P), n) = check (P, n + 1) |
291 | check (Const (@{const_syntax HOL.conj}, _) $ |
291 | check (Const (@{const_syntax HOL.conj}, _) $ |
292 (Const (@{const_syntax "op ="}, _) $ Bound m $ e) $ P, n) = |
292 (Const (@{const_syntax HOL.eq}, _) $ Bound m $ e) $ P, n) = |
293 n > 0 andalso m = n andalso not (loose_bvar1 (P, n)) andalso |
293 n > 0 andalso m = n andalso not (loose_bvar1 (P, n)) andalso |
294 subset (op =) (0 upto (n - 1), add_loose_bnos (e, 0, [])) |
294 subset (op =) (0 upto (n - 1), add_loose_bnos (e, 0, [])) |
295 | check _ = false; |
295 | check _ = false; |
296 |
296 |
297 fun tr' (_ $ abs) = |
297 fun tr' (_ $ abs) = |