diff -r e3bbc2c4c581 -r 3c7a76e79898 src/HOL/Tools/function_package/fundef_common.ML --- a/src/HOL/Tools/function_package/fundef_common.ML Mon Apr 20 12:27:23 2009 +0200 +++ b/src/HOL/Tools/function_package/fundef_common.ML Tue Apr 21 09:53:24 2009 +0200 @@ -215,21 +215,6 @@ (fname, qs, gs, args, rhs) end -exception ArgumentCount of string - -fun mk_arities fqgars = - let fun f (fname, _, _, args, _) arities = - let val k = length args - in - case Symtab.lookup arities fname of - NONE => Symtab.update (fname, k) arities - | SOME i => (if i = k then arities else raise ArgumentCount fname) - end - in - fold f fqgars Symtab.empty - end - - (* Check for all sorts of errors in the input *) fun check_defs ctxt fixes eqs = let @@ -269,13 +254,14 @@ " occur" ^ plural "s" "" funvars ^ " in function position.", "Misspelled constructor???"]); true) in - fqgar + (fname, length args) end - - val _ = mk_arities (map check eqs) - handle ArgumentCount fname => - error ("Function " ^ quote fname ^ - " has different numbers of arguments in different equations") + + val _ = AList.group (op =) (map check eqs) + |> map (fn (fname, ars) => + length (distinct (op =) ars) = 1 + orelse error ("Function " ^ quote fname ^ + " has different numbers of arguments in different equations")) fun check_sorts ((fname, fT), _) = Sorts.of_sort (Sign.classes_of (ProofContext.theory_of ctxt)) (fT, HOLogic.typeS)