| author | wenzelm |
| Sat, 08 Oct 2005 22:39:41 +0200 | |
| changeset 17803 | e235a57651a1 |
| parent 17349 | 03fafcdfdfa7 |
| child 17852 | a06b185a26d7 |
| 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 |
13 |
val goal: theory -> term list -> (indexname * term option) list |
|
14 |
val cases: theory -> term list -> (string * RuleCases.T option) list |
|
15 |
val facts: theory -> term list -> (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 |
||
| 17349 | 23 |
val rule_contextN = "rule_context"; |
| 10359 | 24 |
val thesisN = "thesis"; |
25 |
val thisN = "this"; |
|
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 |
|
| 17349 | 38 |
fun cases thy [prop] = [RuleCases.simple true (thy, prop) rule_contextN] |
39 |
| cases _ _ = [(rule_contextN, NONE)]; |
|
40 |
||
| 10359 | 41 |
|
42 |
(* facts *) |
|
43 |
||
| 17349 | 44 |
fun get_arg thy prop = |
45 |
(case strip_judgment thy prop of |
|
| 15531 | 46 |
_ $ t => SOME (Term.list_abs (Logic.strip_params prop, t)) |
47 |
| _ => NONE); |
|
| 10359 | 48 |
|
| 12140 | 49 |
fun facts _ [] = [] |
| 17349 | 50 |
| facts thy props = |
| 10359 | 51 |
let val prop = Library.last_elem props |
| 17349 | 52 |
in [(Syntax.dddot_indexname, get_arg thy prop)] @ statement_binds thy thisN prop end; |
| 10359 | 53 |
|
| 10808 | 54 |
|
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
55 |
end; |