| author | wenzelm | 
| Wed, 10 Oct 2007 17:31:54 +0200 | |
| changeset 24947 | b7e990e1706a | 
| parent 21448 | 09c953c07008 | 
| child 26686 | 9f3f5429bac6 | 
| permissions | -rw-r--r-- | 
| 6783 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 1 | (* Title: Pure/Isar/auto_bind.ML | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 2 | ID: $Id$ | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 3 | Author: Markus Wenzel, TU Muenchen | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 4 | |
| 17349 | 5 | Automatic bindings of Isar text elements. | 
| 6783 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 6 | *) | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 7 | |
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 8 | signature AUTO_BIND = | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 9 | sig | 
| 17349 | 10 | val rule_contextN: string | 
| 9296 | 11 | val thesisN: string | 
| 17349 | 12 | val thisN: string | 
| 19075 | 13 | val premsN: string | 
| 21448 | 14 | val assmsN: string | 
| 17349 | 15 | val goal: theory -> term list -> (indexname * term option) list | 
| 16 | val cases: theory -> term list -> (string * RuleCases.T option) list | |
| 17 | val facts: theory -> term list -> (indexname * term option) list | |
| 17852 | 18 | val no_facts: (indexname * term option) list | 
| 6783 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 19 | end; | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 20 | |
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 21 | structure AutoBind: AUTO_BIND = | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 22 | struct | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 23 | |
| 10359 | 24 | (** bindings **) | 
| 25 | ||
| 17349 | 26 | val rule_contextN = "rule_context"; | 
| 10359 | 27 | val thesisN = "thesis"; | 
| 28 | val thisN = "this"; | |
| 19075 | 29 | val premsN = "prems"; | 
| 21448 | 30 | val assmsN = "assms"; | 
| 10359 | 31 | |
| 17349 | 32 | fun strip_judgment thy = ObjectLogic.drop_judgment thy o Logic.strip_assums_concl; | 
| 11764 | 33 | |
| 17349 | 34 | fun statement_binds thy name prop = | 
| 35 | [((name, 0), SOME (Term.list_abs (Logic.strip_params prop, strip_judgment thy prop)))]; | |
| 10359 | 36 | |
| 37 | ||
| 38 | (* goal *) | |
| 39 | ||
| 17349 | 40 | fun goal thy [prop] = statement_binds thy thesisN prop | 
| 15531 | 41 | | goal _ _ = [((thesisN, 0), NONE)]; | 
| 10359 | 42 | |
| 18605 | 43 | fun cases thy [prop] = RuleCases.make_simple true (thy, prop) rule_contextN | 
| 44 | | cases _ _ = [(rule_contextN, NONE)]; | |
| 17349 | 45 | |
| 10359 | 46 | |
| 47 | (* facts *) | |
| 48 | ||
| 17349 | 49 | fun get_arg thy prop = | 
| 50 | (case strip_judgment thy prop of | |
| 15531 | 51 | _ $ t => SOME (Term.list_abs (Logic.strip_params prop, t)) | 
| 52 | | _ => NONE); | |
| 10359 | 53 | |
| 12140 | 54 | fun facts _ [] = [] | 
| 17349 | 55 | | facts thy props = | 
| 10359 | 56 | let val prop = Library.last_elem props | 
| 17349 | 57 | in [(Syntax.dddot_indexname, get_arg thy prop)] @ statement_binds thy thisN prop end; | 
| 10359 | 58 | |
| 17852 | 59 | val no_facts = [(Syntax.dddot_indexname, NONE), ((thisN, 0), NONE)]; | 
| 10808 | 60 | |
| 6783 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 61 | end; |