43 val pp = ProofContext.pp ctxt; |
43 val pp = ProofContext.pp ctxt; |
44 val display_term = quote o Pretty.string_of_term pp; |
44 val display_term = quote o Pretty.string_of_term pp; |
45 fun err msg = cat_error msg ("The error(s) above occurred in definition: " ^ display_term eq); |
45 fun err msg = cat_error msg ("The error(s) above occurred in definition: " ^ display_term eq); |
46 val ((lhs, _), eq') = eq |
46 val ((lhs, _), eq') = eq |
47 |> Sign.no_vars pp |
47 |> Sign.no_vars pp |
48 |> Logic.dest_def pp Term.is_Free (Variable.is_fixed ctxt) (K true) |
48 |> PrimitiveDefs.dest_def pp Term.is_Free (Variable.is_fixed ctxt) (K true) |
49 handle TERM (msg, _) => err msg | ERROR msg => err msg; |
49 handle TERM (msg, _) => err msg | ERROR msg => err msg; |
50 in (Term.dest_Free (Term.head_of lhs), eq') end; |
50 in (Term.dest_Free (Term.head_of lhs), eq') end; |
51 |
51 |
52 val abs_def = Logic.abs_def #>> Term.dest_Free; |
52 val abs_def = PrimitiveDefs.abs_def #>> Term.dest_Free; |
53 |
53 |
54 fun mk_def ctxt args = |
54 fun mk_def ctxt args = |
55 let |
55 let |
56 val (xs, rhss) = split_list args; |
56 val (xs, rhss) = split_list args; |
57 val (bind, _) = ProofContext.bind_fixes xs ctxt; |
57 val (bind, _) = ProofContext.bind_fixes xs ctxt; |