author | wenzelm |
Thu, 07 Oct 1999 12:36:53 +0200 | |
changeset 7775 | 26898fbd19ca |
parent 7675 | c859160e78b0 |
child 8227 | d67db92897df |
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 |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
5 |
Automatic term bindings -- logic specific patterns. |
7675 | 6 |
|
7 |
The implementation below works fine with the more common |
|
8 |
object-logics, such as HOL, ZF. |
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
9 |
*) |
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
10 |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
11 |
signature AUTO_BIND = |
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
12 |
sig |
7599 | 13 |
val goal: term -> (indexname * term option) list |
14 |
val facts: string -> term list -> (indexname * term option) list |
|
7675 | 15 |
val atomic_thesis: term -> (string * term) * term |
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 |
|
7675 | 21 |
val thesisN = "thesis"; |
22 |
val thisN = "this"; |
|
6796 | 23 |
|
7675 | 24 |
|
25 |
(* goal *) |
|
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
26 |
|
6796 | 27 |
fun statement_binds (name, prop) = |
28 |
let |
|
7331 | 29 |
val concl = Logic.strip_assums_concl prop; |
30 |
val parms = Logic.strip_params prop; |
|
31 |
fun list_abs tm = foldr (fn ((x, T), t) => Abs (x, T, t)) (parms, tm); |
|
32 |
||
7599 | 33 |
val env = [(name ^ "_prop", Some prop), (name ^ "_concl", Some (list_abs concl)), |
34 |
(name, case concl of Const ("Trueprop", _) $ t => Some (list_abs t) | _ => None)]; |
|
7474 | 35 |
in map (fn (s, t) => ((s, 0), t)) env end; |
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
36 |
|
7675 | 37 |
fun goal prop = statement_binds (thesisN, prop); |
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
38 |
|
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
39 |
|
6796 | 40 |
(* facts *) |
41 |
||
42 |
fun dddot_bind prop = |
|
7599 | 43 |
[(Syntax.dddot_indexname, |
44 |
case Logic.strip_imp_concl prop of Const ("Trueprop", _) $ (_ $ t) => Some t | _ => None)]; |
|
6796 | 45 |
|
46 |
fun facts _ [] = [] |
|
7452 | 47 |
| facts name props = |
48 |
let val prop = Library.last_elem props |
|
7675 | 49 |
in dddot_bind prop @ statement_binds (thisN, prop) end; |
50 |
||
51 |
||
52 |
(* atomic_thesis *) |
|
53 |
||
54 |
fun mk_free t = Free (thesisN, Term.fastype_of t); |
|
55 |
||
56 |
fun atomic_thesis ((c as Const ("Trueprop", _)) $ t) = ((thesisN, t), c $ mk_free t) |
|
57 |
| atomic_thesis t = ((thesisN, t), mk_free t); |
|
6796 | 58 |
|
59 |
||
6783
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
wenzelm
parents:
diff
changeset
|
60 |
end; |