| author | kleing |
| Thu, 20 Jun 2002 18:48:31 +0200 | |
| changeset 13229 | a2b09d99e5cf |
| parent 12241 | c4a2a0686238 |
| child 14981 | e73f8140af78 |
| 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 |
| 8807 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
5 |
|
| 10359 | 6 |
Logic specific patterns and automatic term bindings. |
|
6783
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 |
|
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
9 |
signature AUTO_BIND = |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
10 |
sig |
| 12140 | 11 |
val goal: Sign.sg -> term list -> (indexname * term option) list |
12 |
val facts: Sign.sg -> term list -> (indexname * term option) list |
|
| 9296 | 13 |
val thesisN: string |
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
14 |
end; |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
15 |
|
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
16 |
structure AutoBind: AUTO_BIND = |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
17 |
struct |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
18 |
|
| 10359 | 19 |
(** bindings **) |
20 |
||
21 |
val thesisN = "thesis"; |
|
22 |
val thisN = "this"; |
|
23 |
||
| 11764 | 24 |
fun strip_judgment sg = ObjectLogic.drop_judgment sg o Logic.strip_assums_concl; |
25 |
||
26 |
fun statement_binds sg name prop = |
|
27 |
[((name, 0), Some (Term.list_abs (Logic.strip_params prop, strip_judgment sg prop)))]; |
|
| 10359 | 28 |
|
29 |
||
30 |
(* goal *) |
|
31 |
||
| 12241 | 32 |
fun goal sg [prop] = statement_binds sg thesisN prop |
33 |
| goal _ _ = [((thesisN, 0), None)]; |
|
| 10359 | 34 |
|
35 |
||
36 |
(* facts *) |
|
37 |
||
| 11764 | 38 |
fun get_arg sg prop = |
39 |
(case strip_judgment sg prop of |
|
| 10808 | 40 |
_ $ t => Some (Term.list_abs (Logic.strip_params prop, t)) |
| 10359 | 41 |
| _ => None); |
42 |
||
| 12140 | 43 |
fun facts _ [] = [] |
44 |
| facts sg props = |
|
| 10359 | 45 |
let val prop = Library.last_elem props |
| 11764 | 46 |
in [(Syntax.dddot_indexname, get_arg sg prop)] @ statement_binds sg thisN prop end; |
| 10359 | 47 |
|
| 10808 | 48 |
|
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
49 |
end; |