author | wenzelm |
Sun, 05 Jun 2005 23:07:26 +0200 | |
changeset 16288 | df2b550a17f6 |
parent 15531 | 08c8dad8e399 |
child 17349 | 03fafcdfdfa7 |
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 |
|
10359 | 5 |
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
|
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 |
12140 | 10 |
val goal: Sign.sg -> term list -> (indexname * term option) list |
11 |
val facts: Sign.sg -> term list -> (indexname * term option) list |
|
9296 | 12 |
val thesisN: string |
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
13 |
end; |
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
14 |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
15 |
structure AutoBind: AUTO_BIND = |
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
16 |
struct |
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
17 |
|
10359 | 18 |
(** bindings **) |
19 |
||
20 |
val thesisN = "thesis"; |
|
21 |
val thisN = "this"; |
|
22 |
||
11764 | 23 |
fun strip_judgment sg = ObjectLogic.drop_judgment sg o Logic.strip_assums_concl; |
24 |
||
25 |
fun statement_binds sg name prop = |
|
15531 | 26 |
[((name, 0), SOME (Term.list_abs (Logic.strip_params prop, strip_judgment sg prop)))]; |
10359 | 27 |
|
28 |
||
29 |
(* goal *) |
|
30 |
||
12241 | 31 |
fun goal sg [prop] = statement_binds sg thesisN prop |
15531 | 32 |
| goal _ _ = [((thesisN, 0), NONE)]; |
10359 | 33 |
|
34 |
||
35 |
(* facts *) |
|
36 |
||
11764 | 37 |
fun get_arg sg prop = |
38 |
(case strip_judgment sg prop of |
|
15531 | 39 |
_ $ t => SOME (Term.list_abs (Logic.strip_params prop, t)) |
40 |
| _ => NONE); |
|
10359 | 41 |
|
12140 | 42 |
fun facts _ [] = [] |
43 |
| facts sg props = |
|
10359 | 44 |
let val prop = Library.last_elem props |
11764 | 45 |
in [(Syntax.dddot_indexname, get_arg sg prop)] @ statement_binds sg thisN prop end; |
10359 | 46 |
|
10808 | 47 |
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
48 |
end; |