equal
deleted
inserted
replaced
12 val mk_def: Proof.context -> (string * term) list -> term list |
12 val mk_def: Proof.context -> (string * term) list -> term list |
13 val expand: cterm list -> thm -> thm |
13 val expand: cterm list -> thm -> thm |
14 val def_export: Assumption.export |
14 val def_export: Assumption.export |
15 val add_defs: ((string * mixfix) * ((bstring * attribute list) * term)) list -> Proof.context -> |
15 val add_defs: ((string * mixfix) * ((bstring * attribute list) * term)) list -> Proof.context -> |
16 (term * (bstring * thm)) list * Proof.context |
16 (term * (bstring * thm)) list * Proof.context |
|
17 val add_def: (string * mixfix) * term -> Proof.context -> (term * (bstring * thm)) * Proof.context |
17 val export: Proof.context -> Proof.context -> thm -> thm list * thm |
18 val export: Proof.context -> Proof.context -> thm -> thm list * thm |
18 val export_cterm: Proof.context -> Proof.context -> cterm -> cterm * thm |
19 val export_cterm: Proof.context -> Proof.context -> cterm -> cterm * thm |
19 val trans_terms: Proof.context -> thm list -> thm |
20 val trans_terms: Proof.context -> thm list -> thm |
20 val trans_props: Proof.context -> thm list -> thm |
21 val trans_props: Proof.context -> thm list -> thm |
21 val print_rules: Proof.context -> unit |
22 val print_rules: Proof.context -> unit |
39 |
40 |
40 (* prepare defs *) |
41 (* prepare defs *) |
41 |
42 |
42 fun cert_def ctxt eq = |
43 fun cert_def ctxt eq = |
43 let |
44 let |
44 val display_term = quote o Syntax.string_of_term ctxt; |
45 fun err msg = cat_error msg ("The error(s) above occurred in definition: " ^ |
45 fun err msg = cat_error msg ("The error(s) above occurred in definition: " ^ display_term eq); |
46 quote (Syntax.string_of_term ctxt eq)); |
46 val ((lhs, _), eq') = eq |
47 val ((lhs, _), eq') = eq |
47 |> Sign.no_vars (Syntax.pp ctxt) |
48 |> Sign.no_vars (Syntax.pp ctxt) |
48 |> PrimitiveDefs.dest_def ctxt Term.is_Free (Variable.is_fixed ctxt) (K true) |
49 |> PrimitiveDefs.dest_def ctxt Term.is_Free (Variable.is_fixed ctxt) (K true) |
49 handle TERM (msg, _) => err msg | ERROR msg => err msg; |
50 handle TERM (msg, _) => err msg | ERROR msg => err msg; |
50 in (Term.dest_Free (Term.head_of lhs), eq') end; |
51 in (Term.dest_Free (Term.head_of lhs), eq') end; |
97 |> fold Variable.declare_term eqs |
98 |> fold Variable.declare_term eqs |
98 |> ProofContext.add_assms_i def_export |
99 |> ProofContext.add_assms_i def_export |
99 (map2 (fn a => fn eq => (a, [(eq, [])])) (names' ~~ atts) eqs) |
100 (map2 (fn a => fn eq => (a, [(eq, [])])) (names' ~~ atts) eqs) |
100 |>> map2 (fn lhs => fn (name, [th]) => (lhs, (name, th))) lhss |
101 |>> map2 (fn lhs => fn (name, [th]) => (lhs, (name, th))) lhss |
101 end; |
102 end; |
|
103 |
|
104 fun add_def (var, rhs) = add_defs [(var, (("", []), rhs))] #>> the_single; |
102 |
105 |
103 |
106 |
104 (* specific export -- result based on educated guessing *) |
107 (* specific export -- result based on educated guessing *) |
105 |
108 |
106 (* |
109 (* |