192 |
192 |
193 fun find_arg T x [] = sys_error "find_arg" |
193 fun find_arg T x [] = sys_error "find_arg" |
194 | find_arg T x ((p as (_, (SOME _, _))) :: ps) = |
194 | find_arg T x ((p as (_, (SOME _, _))) :: ps) = |
195 apsnd (cons p) (find_arg T x ps) |
195 apsnd (cons p) (find_arg T x ps) |
196 | find_arg T x ((p as (U, (NONE, y))) :: ps) = |
196 | find_arg T x ((p as (U, (NONE, y))) :: ps) = |
197 if T = U then (y, (U, (SOME x, y)) :: ps) |
197 if (T: typ) = U then (y, (U, (SOME x, y)) :: ps) |
198 else apsnd (cons p) (find_arg T x ps); |
198 else apsnd (cons p) (find_arg T x ps); |
199 |
199 |
200 fun make_args Ts xs = |
200 fun make_args Ts xs = |
201 map (fn (T, (NONE, ())) => Const ("arbitrary", T) | (_, (SOME t, ())) => t) |
201 map (fn (T, (NONE, ())) => Const ("arbitrary", T) | (_, (SOME t, ())) => t) |
202 (fold (fn (t, T) => snd o find_arg T t) xs (map (rpair (NONE, ())) Ts)); |
202 (fold (fn (t, T) => snd o find_arg T t) xs (map (rpair (NONE, ())) Ts)); |