| author | haftmann | 
| Wed, 23 Sep 2009 08:25:51 +0200 | |
| changeset 32698 | be4b248616c0 | 
| parent 29606 | fedb8be05f24 | 
| child 33386 | ff29d1549aca | 
| 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 | Author: Markus Wenzel, TU Muenchen | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 3 | |
| 17349 | 4 | 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 | 5 | *) | 
| 
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 | signature AUTO_BIND = | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 8 | sig | 
| 9296 | 9 | val thesisN: string | 
| 17349 | 10 | val thisN: string | 
| 21448 | 11 | val assmsN: string | 
| 17349 | 12 | val goal: theory -> term list -> (indexname * term option) list | 
| 13 | val facts: theory -> term list -> (indexname * term option) list | |
| 17852 | 14 | 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 | 15 | end; | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 16 | |
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 17 | structure AutoBind: AUTO_BIND = | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 18 | struct | 
| 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 19 | |
| 10359 | 20 | (** bindings **) | 
| 21 | ||
| 22 | val thesisN = "thesis"; | |
| 23 | val thisN = "this"; | |
| 21448 | 24 | val assmsN = "assms"; | 
| 10359 | 25 | |
| 17349 | 26 | fun strip_judgment thy = ObjectLogic.drop_judgment thy o Logic.strip_assums_concl; | 
| 11764 | 27 | |
| 17349 | 28 | fun statement_binds thy name prop = | 
| 29 | [((name, 0), SOME (Term.list_abs (Logic.strip_params prop, strip_judgment thy prop)))]; | |
| 10359 | 30 | |
| 31 | ||
| 32 | (* goal *) | |
| 33 | ||
| 17349 | 34 | fun goal thy [prop] = statement_binds thy thesisN prop | 
| 15531 | 35 | | goal _ _ = [((thesisN, 0), NONE)]; | 
| 10359 | 36 | |
| 37 | ||
| 38 | (* facts *) | |
| 39 | ||
| 17349 | 40 | fun get_arg thy prop = | 
| 41 | (case strip_judgment thy prop of | |
| 15531 | 42 | _ $ t => SOME (Term.list_abs (Logic.strip_params prop, t)) | 
| 43 | | _ => NONE); | |
| 10359 | 44 | |
| 12140 | 45 | fun facts _ [] = [] | 
| 17349 | 46 | | facts thy props = | 
| 10359 | 47 | let val prop = Library.last_elem props | 
| 17349 | 48 | in [(Syntax.dddot_indexname, get_arg thy prop)] @ statement_binds thy thisN prop end; | 
| 10359 | 49 | |
| 17852 | 50 | val no_facts = [(Syntax.dddot_indexname, NONE), ((thisN, 0), NONE)]; | 
| 10808 | 51 | |
| 6783 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 wenzelm parents: diff
changeset | 52 | end; |