equal
deleted
inserted
replaced
272 let |
272 let |
273 val vars = vars_of tm; |
273 val vars = vars_of tm; |
274 val body = body_of tm; |
274 val body = body_of tm; |
275 val rev_new_vars = Term.rename_wrt_term body vars; |
275 val rev_new_vars = Term.rename_wrt_term body vars; |
276 fun subst (x, T) b = |
276 fun subst (x, T) b = |
277 if can Name.dest_internal x andalso not (Term.loose_bvar1 (b, 0)) |
277 if can Name.dest_internal x andalso not (Term.is_dependent b) |
278 then (Const ("_idtdummy", T), incr_boundvars ~1 b) |
278 then (Const ("_idtdummy", T), incr_boundvars ~1 b) |
279 else (mark_boundT (x, T), Term.subst_bound (mark_bound x, b)); |
279 else (mark_boundT (x, T), Term.subst_bound (mark_bound x, b)); |
280 val (rev_vars', body') = fold_map subst rev_new_vars body; |
280 val (rev_vars', body') = fold_map subst rev_new_vars body; |
281 in (rev rev_vars', body') end; |
281 in (rev rev_vars', body') end; |
282 |
282 |
295 fun eta_abs (Abs (a, T, t)) = |
295 fun eta_abs (Abs (a, T, t)) = |
296 (case eta_abs t of |
296 (case eta_abs t of |
297 t' as f $ u => |
297 t' as f $ u => |
298 (case eta_abs u of |
298 (case eta_abs u of |
299 Bound 0 => |
299 Bound 0 => |
300 if Term.loose_bvar1 (f, 0) orelse is_aprop f then Abs (a, T, t') |
300 if Term.is_dependent f orelse is_aprop f then Abs (a, T, t') |
301 else incr_boundvars ~1 f |
301 else incr_boundvars ~1 f |
302 | _ => Abs (a, T, t')) |
302 | _ => Abs (a, T, t')) |
303 | t' => Abs (a, T, t')) |
303 | t' => Abs (a, T, t')) |
304 | eta_abs t = t; |
304 | eta_abs t = t; |
305 in |
305 in |
306 if Config.get ctxt eta_contract then eta_abs tm else tm |
306 if Config.get ctxt eta_contract then eta_abs tm else tm |
430 |
430 |
431 val variant_abs = var_abs Free; |
431 val variant_abs = var_abs Free; |
432 val variant_abs' = var_abs mark_boundT; |
432 val variant_abs' = var_abs mark_boundT; |
433 |
433 |
434 fun dependent_tr' (q, r) (A :: Abs (x, T, B) :: ts) = |
434 fun dependent_tr' (q, r) (A :: Abs (x, T, B) :: ts) = |
435 if Term.loose_bvar1 (B, 0) then |
435 if Term.is_dependent B then |
436 let val (x', B') = variant_abs' (x, dummyT, B); |
436 let val (x', B') = variant_abs' (x, dummyT, B); |
437 in Term.list_comb (Lexicon.const q $ mark_boundT (x', T) $ A $ B', ts) end |
437 in Term.list_comb (Lexicon.const q $ mark_boundT (x', T) $ A $ B', ts) end |
438 else Term.list_comb (Lexicon.const r $ A $ B, ts) |
438 else Term.list_comb (Lexicon.const r $ A $ B, ts) (* FIXME decr!? *) |
439 | dependent_tr' _ _ = raise Match; |
439 | dependent_tr' _ _ = raise Match; |
440 |
440 |
441 |
441 |
442 (* quote / antiquote *) |
442 (* quote / antiquote *) |
443 |
443 |