src/HOL/Tools/TFL/usyntax.ML
changeset 37135 636e6d8645d6
parent 32603 e08fdd615333
child 37391 476270a6c2dc
equal deleted inserted replaced
37123:9cce71cd4bf0 37135:636e6d8645d6
   193    end;
   193    end;
   194 
   194 
   195 fun prod_ty ty1 ty2 = HOLogic.mk_prodT (ty1,ty2);
   195 fun prod_ty ty1 ty2 = HOLogic.mk_prodT (ty1,ty2);
   196 
   196 
   197 local
   197 local
   198 fun mk_uncurry(xt,yt,zt) =
   198 fun mk_uncurry (xt, yt, zt) =
   199     Const("split",(xt --> yt --> zt) --> prod_ty xt yt --> zt)
   199     Const(@{const_name split}, (xt --> yt --> zt) --> prod_ty xt yt --> zt)
   200 fun dest_pair(Const("Pair",_) $ M $ N) = {fst=M, snd=N}
   200 fun dest_pair(Const("Pair",_) $ M $ N) = {fst=M, snd=N}
   201   | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair"
   201   | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair"
   202 fun is_var (Var _) = true | is_var (Free _) = true | is_var _ = false
   202 fun is_var (Var _) = true | is_var (Free _) = true | is_var _ = false
   203 in
   203 in
   204 fun mk_pabs{varstruct,body} =
   204 fun mk_pabs{varstruct,body} =
   274 
   274 
   275 fun dest_pair(Const("Pair",_) $ M $ N) = {fst=M, snd=N}
   275 fun dest_pair(Const("Pair",_) $ M $ N) = {fst=M, snd=N}
   276   | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair";
   276   | dest_pair _ = raise USYN_ERR "dest_pair" "not a pair";
   277 
   277 
   278 
   278 
   279 local  fun ucheck t = (if #Name(dest_const t) = "split" then t
   279 local  fun ucheck t = (if #Name (dest_const t) = @{const_name split} then t
   280                        else raise Match)
   280                        else raise Match)
   281 in
   281 in
   282 fun dest_pabs used tm =
   282 fun dest_pabs used tm =
   283    let val ({Bvar,Body}, used') = dest_abs used tm
   283    let val ({Bvar,Body}, used') = dest_abs used tm
   284    in {varstruct = Bvar, body = Body, used = used'}
   284    in {varstruct = Bvar, body = Body, used = used'}