27 val dest: int option -> attribute |
27 val dest: int option -> attribute |
28 val intro_query: int option -> attribute |
28 val intro_query: int option -> attribute |
29 val elim_query: int option -> attribute |
29 val elim_query: int option -> attribute |
30 val dest_query: int option -> attribute |
30 val dest_query: int option -> attribute |
31 val rule_del: attribute |
31 val rule_del: attribute |
32 val add_args: |
32 val add: (int option -> attribute) -> (int option -> attribute) -> (int option -> attribute) -> |
33 (int option -> attribute) -> (int option -> attribute) -> (int option -> attribute) -> |
33 attribute context_parser |
34 Attrib.src -> attribute |
|
35 end; |
34 end; |
36 |
35 |
37 structure ContextRules: CONTEXT_RULES = |
36 structure ContextRules: CONTEXT_RULES = |
38 struct |
37 struct |
39 |
38 |
201 (snd o PureThy.add_thms [((Binding.empty, Drule.equal_intr_rule), [intro_query NONE])])); |
200 (snd o PureThy.add_thms [((Binding.empty, Drule.equal_intr_rule), [intro_query NONE])])); |
202 |
201 |
203 |
202 |
204 (* concrete syntax *) |
203 (* concrete syntax *) |
205 |
204 |
206 fun add_args a b c = Attrib.syntax |
205 fun add a b c x = |
207 (Scan.lift ((Args.bang >> K a || Args.query >> K c || Scan.succeed b) -- |
206 (Scan.lift ((Args.bang >> K a || Args.query >> K c || Scan.succeed b) -- |
208 Scan.option OuterParse.nat) >> (fn (f, n) => f n)); |
207 Scan.option OuterParse.nat) >> (fn (f, n) => f n)) x; |
209 |
208 |
210 val rule_atts = |
209 val _ = Context.>> (Context.map_theory |
211 [("intro", add_args intro_bang intro intro_query, "declaration of introduction rule"), |
210 (Attrib.setup (Binding.name "intro") (add intro_bang intro intro_query) |
212 ("elim", add_args elim_bang elim elim_query, "declaration of elimination rule"), |
211 "declaration of introduction rule" #> |
213 ("dest", add_args dest_bang dest dest_query, "declaration of destruction rule"), |
212 Attrib.setup (Binding.name "elim") (add elim_bang elim elim_query) |
214 ("rule", Attrib.syntax (Scan.lift Args.del >> K rule_del), |
213 "declaration of elimination rule" #> |
215 "remove declaration of intro/elim/dest rule")]; |
214 Attrib.setup (Binding.name "dest") (add dest_bang dest dest_query) |
216 |
215 "declaration of destruction rule" #> |
217 val _ = Context.>> (Context.map_theory (Attrib.add_attributes rule_atts)); |
216 Attrib.setup (Binding.name "rule") (Scan.lift Args.del >> K rule_del) |
|
217 "remove declaration of intro/elim/dest rule")); |
218 |
218 |
219 end; |
219 end; |