equal
deleted
inserted
replaced
1 (* Title: HOL/Library/Reflection.thy |
1 (* Title: HOL/Library/Reflection.thy |
2 Author: Amine Chaieb, TU Muenchen |
2 Author: Amine Chaieb, TU Muenchen |
3 *) |
3 *) |
4 |
4 |
5 section {* Generic reflection and reification *} |
5 section \<open>Generic reflection and reification\<close> |
6 |
6 |
7 theory Reflection |
7 theory Reflection |
8 imports Main |
8 imports Main |
9 begin |
9 begin |
10 |
10 |
11 ML_file "~~/src/HOL/Tools/reflection.ML" |
11 ML_file "~~/src/HOL/Tools/reflection.ML" |
12 |
12 |
13 method_setup reify = {* |
13 method_setup reify = \<open> |
14 Attrib.thms -- |
14 Attrib.thms -- |
15 Scan.option (Scan.lift (Args.$$$ "(") |-- Args.term --| Scan.lift (Args.$$$ ")")) >> |
15 Scan.option (Scan.lift (Args.$$$ "(") |-- Args.term --| Scan.lift (Args.$$$ ")")) >> |
16 (fn (user_eqs, to) => fn ctxt => SIMPLE_METHOD' (Reflection.default_reify_tac ctxt user_eqs to)) |
16 (fn (user_eqs, to) => fn ctxt => SIMPLE_METHOD' (Reflection.default_reify_tac ctxt user_eqs to)) |
17 *} "partial automatic reification" |
17 \<close> "partial automatic reification" |
18 |
18 |
19 method_setup reflection = {* |
19 method_setup reflection = \<open> |
20 let |
20 let |
21 fun keyword k = Scan.lift (Args.$$$ k -- Args.colon) >> K (); |
21 fun keyword k = Scan.lift (Args.$$$ k -- Args.colon) >> K (); |
22 val onlyN = "only"; |
22 val onlyN = "only"; |
23 val rulesN = "rules"; |
23 val rulesN = "rules"; |
24 val any_keyword = keyword onlyN || keyword rulesN; |
24 val any_keyword = keyword onlyN || keyword rulesN; |
28 thms -- Scan.optional (keyword rulesN |-- thms) [] -- |
28 thms -- Scan.optional (keyword rulesN |-- thms) [] -- |
29 Scan.option (keyword onlyN |-- Args.term) >> |
29 Scan.option (keyword onlyN |-- Args.term) >> |
30 (fn ((user_eqs, user_thms), to) => fn ctxt => |
30 (fn ((user_eqs, user_thms), to) => fn ctxt => |
31 SIMPLE_METHOD' (Reflection.default_reflection_tac ctxt user_thms user_eqs to)) |
31 SIMPLE_METHOD' (Reflection.default_reflection_tac ctxt user_thms user_eqs to)) |
32 end |
32 end |
33 *} "partial automatic reflection" |
33 \<close> "partial automatic reflection" |
34 |
34 |
35 end |
35 end |
36 |
36 |