3163 (map (fn i => "x" ^ string_of_int i) (1 upto length Ts)) |
3163 (map (fn i => "x" ^ string_of_int i) (1 upto length Ts)) |
3164 val output_frees = map2 (curry Free) output_names (rev Ts) |
3164 val output_frees = map2 (curry Free) output_names (rev Ts) |
3165 val body = subst_bounds (output_frees, body) |
3165 val body = subst_bounds (output_frees, body) |
3166 val T_compr = HOLogic.mk_ptupleT fp Ts |
3166 val T_compr = HOLogic.mk_ptupleT fp Ts |
3167 val output_tuple = HOLogic.mk_ptuple fp T_compr (rev output_frees) |
3167 val output_tuple = HOLogic.mk_ptuple fp T_compr (rev output_frees) |
3168 val (pred as Const (name, T), all_args) = strip_comb body |
3168 val (pred as Const (name, T), all_args) = |
|
3169 case strip_comb body of |
|
3170 (Const (name, T), all_args) => (Const (name, T), all_args) |
|
3171 | (head, _) => error ("Not a constant: " ^ Syntax.string_of_term_global thy head) |
3169 in |
3172 in |
3170 if defined_functions compilation thy name then |
3173 if defined_functions compilation thy name then |
3171 let |
3174 let |
3172 fun extract_mode (Const ("Pair", _) $ t1 $ t2) = Pair (extract_mode t1, extract_mode t2) |
3175 fun extract_mode (Const ("Pair", _) $ t1 $ t2) = Pair (extract_mode t1, extract_mode t2) |
3173 | extract_mode (Free (x, _)) = if member (op =) output_names x then Output else Input |
3176 | extract_mode (Free (x, _)) = if member (op =) output_names x then Output else Input |