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