56 val simp_add: attribute |
56 val simp_add: attribute |
57 val simp_del: attribute |
57 val simp_del: attribute |
58 val cong_add: attribute |
58 val cong_add: attribute |
59 val cong_del: attribute |
59 val cong_del: attribute |
60 val map_simpset: (simpset -> simpset) -> theory -> theory |
60 val map_simpset: (simpset -> simpset) -> theory -> theory |
61 val get_simproc: Context.generic -> xstring -> simproc |
61 val get_simproc: Proof.context -> xstring * Position.T -> simproc |
62 val def_simproc: {name: string, lhss: string list, |
62 val def_simproc: {name: binding, lhss: term list, |
63 proc: morphism -> simpset -> cterm -> thm option, identifier: thm list} -> |
63 proc: morphism -> simpset -> cterm -> thm option, identifier: thm list} -> |
64 local_theory -> local_theory |
64 local_theory -> local_theory |
65 val def_simproc_i: {name: string, lhss: term list, |
65 val def_simproc_cmd: {name: binding, lhss: string list, |
66 proc: morphism -> simpset -> cterm -> thm option, identifier: thm list} -> |
66 proc: morphism -> simpset -> cterm -> thm option, identifier: thm list} -> |
67 local_theory -> local_theory |
67 local_theory -> local_theory |
68 val cong_modifiers: Method.modifier parser list |
68 val cong_modifiers: Method.modifier parser list |
69 val simp_modifiers': Method.modifier parser list |
69 val simp_modifiers': Method.modifier parser list |
70 val simp_modifiers: Method.modifier parser list |
70 val simp_modifiers: Method.modifier parser list |
160 ); |
160 ); |
161 |
161 |
162 |
162 |
163 (* get simprocs *) |
163 (* get simprocs *) |
164 |
164 |
165 fun get_simproc context xname = |
165 fun get_simproc ctxt (xname, pos) = |
166 let |
166 let |
167 val (space, tab) = Simprocs.get context; |
167 val (space, tab) = Simprocs.get (Context.Proof ctxt); |
168 val name = Name_Space.intern space xname; |
168 val name = Name_Space.intern space xname; |
169 in |
169 in |
170 (case Symtab.lookup tab name of |
170 (case Symtab.lookup tab name of |
171 SOME proc => proc |
171 SOME proc => (Context_Position.report ctxt pos (Name_Space.markup space name); proc) |
172 | NONE => error ("Undefined simplification procedure: " ^ quote name)) |
172 | NONE => error ("Undefined simplification procedure: " ^ quote name)) |
173 end; |
173 end; |
174 |
174 |
175 val _ = ML_Antiquote.value "simproc" (Scan.lift Args.name >> (fn name => |
175 val _ = |
176 "Simplifier.get_simproc (ML_Context.the_generic_context ()) " ^ ML_Syntax.print_string name)); |
176 ML_Antiquote.value "simproc" (Scan.lift (Parse.position Args.name) >> (fn x => |
|
177 "Simplifier.get_simproc (ML_Context.the_local_context ()) " ^ |
|
178 ML_Syntax.print_pair ML_Syntax.print_string ML_Syntax.print_position x)); |
177 |
179 |
178 |
180 |
179 (* define simprocs *) |
181 (* define simprocs *) |
180 |
182 |
181 local |
183 local |
182 |
184 |
183 fun gen_simproc prep {name, lhss, proc, identifier} lthy = |
185 fun gen_simproc prep {name = b, lhss, proc, identifier} lthy = |
184 let |
186 let |
185 val b = Binding.name name; |
|
186 val naming = Local_Theory.naming_of lthy; |
187 val naming = Local_Theory.naming_of lthy; |
187 val simproc = make_simproc |
188 val simproc = make_simproc |
188 {name = Name_Space.full_name naming b, |
189 {name = Name_Space.full_name naming b, |
189 lhss = |
190 lhss = |
190 let |
191 let |