src/HOL/Tools/inductive_package.ML
changeset 23577 c5b93c69afd3
parent 22997 d4f3b015b50b
child 23762 24eef53a9ad3
equal deleted inserted replaced
23576:1ffe739e5ee0 23577:c5b93c69afd3
   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));