src/HOL/ex/predicate_compile.ML
changeset 31986 a68f88d264f7
parent 31879 39bff8d9b032
child 32091 30e2ffbba718
equal deleted inserted replaced
31985:a6e982b1ebba 31986:a68f88d264f7
   417           val (args1, args2) =
   417           val (args1, args2) =
   418             if length args < length iss then
   418             if length args < length iss then
   419               error ("Too few arguments for inductive predicate " ^ name)
   419               error ("Too few arguments for inductive predicate " ^ name)
   420             else chop (length iss) args;
   420             else chop (length iss) args;
   421           val k = length args2;
   421           val k = length args2;
   422           val perm = map (fn i => (find_index_eq (Bound (b - i)) args2) + 1)
   422           val perm = map (fn i => (find_index (fn t => t = Bound (b - i)) args2) + 1)
   423             (1 upto b)  
   423             (1 upto b)
   424           val partial_mode = (1 upto k) \\ perm
   424           val partial_mode = (1 upto k) \\ perm
   425         in
   425         in
   426           if not (partial_mode subset is) then [] else
   426           if not (partial_mode subset is) then [] else
   427           let
   427           let
   428             val is' = 
   428             val is' = 
   625         val (ivs, ovs) = get_args is vs    
   625         val (ivs, ovs) = get_args is vs    
   626         val (f, args) = strip_comb u
   626         val (f, args) = strip_comb u
   627         val (params, args') = chop (length ms) args
   627         val (params, args') = chop (length ms) args
   628         val (inargs, outargs) = get_args is' args'
   628         val (inargs, outargs) = get_args is' args'
   629         val b = length vs
   629         val b = length vs
   630         val perm = map (fn i => (find_index_eq (Bound (b - i)) args') + 1) (1 upto b)
   630         val perm = map (fn i => find_index (fn t => t = Bound (b - i)) args' + 1) (1 upto b)
   631         val outp_perm =
   631         val outp_perm =
   632           snd (get_args is perm)
   632           snd (get_args is perm)
   633           |> map (fn i => i - length (filter (fn x => x < i) is'))
   633           |> map (fn i => i - length (filter (fn x => x < i) is'))
   634         val names = [] (* TODO *)
   634         val names = [] (* TODO *)
   635         val out_names = Name.variant_list names (replicate (length outargs) "x")
   635         val out_names = Name.variant_list names (replicate (length outargs) "x")