equal
deleted
inserted
replaced
549 |
549 |
550 fun prod_ty ty1 ty2 = HOLogic.mk_prodT (ty1,ty2); |
550 fun prod_ty ty1 ty2 = HOLogic.mk_prodT (ty1,ty2); |
551 |
551 |
552 local |
552 local |
553 fun mk_uncurry (xt, yt, zt) = |
553 fun mk_uncurry (xt, yt, zt) = |
554 Const(@{const_name uncurry}, (xt --> yt --> zt) --> prod_ty xt yt --> zt) |
554 Const(@{const_name case_prod}, (xt --> yt --> zt) --> prod_ty xt yt --> zt) |
555 fun dest_pair(Const(@{const_name Pair},_) $ M $ N) = {fst=M, snd=N} |
555 fun dest_pair(Const(@{const_name Pair},_) $ M $ N) = {fst=M, snd=N} |
556 | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair" |
556 | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair" |
557 fun is_var (Var _) = true | is_var (Free _) = true | is_var _ = false |
557 fun is_var (Var _) = true | is_var (Free _) = true | is_var _ = false |
558 in |
558 in |
559 fun mk_pabs{varstruct,body} = |
559 fun mk_pabs{varstruct,body} = |
629 |
629 |
630 fun dest_pair(Const(@{const_name Pair},_) $ M $ N) = {fst=M, snd=N} |
630 fun dest_pair(Const(@{const_name Pair},_) $ M $ N) = {fst=M, snd=N} |
631 | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair"; |
631 | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair"; |
632 |
632 |
633 |
633 |
634 local fun ucheck t = (if #Name (dest_const t) = @{const_name uncurry} then t |
634 local fun ucheck t = (if #Name (dest_const t) = @{const_name case_prod} then t |
635 else raise Match) |
635 else raise Match) |
636 in |
636 in |
637 fun dest_pabs used tm = |
637 fun dest_pabs used tm = |
638 let val ({Bvar,Body}, used') = dest_abs used tm |
638 let val ({Bvar,Body}, used') = dest_abs used tm |
639 in {varstruct = Bvar, body = Body, used = used'} |
639 in {varstruct = Bvar, body = Body, used = used'} |