| author | wenzelm | 
| Sat, 21 Jan 2006 23:02:24 +0100 | |
| changeset 18732 | c0511e120f17 | 
| parent 18605 | b971e113dee7 | 
| child 19075 | 12833c7e0fa6 | 
| 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  | 
|
| 17852 | 16  | 
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
 | 
17  | 
end;  | 
| 
 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 
wenzelm 
parents:  
diff
changeset
 | 
18  | 
|
| 
 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 
wenzelm 
parents:  
diff
changeset
 | 
19  | 
structure AutoBind: AUTO_BIND =  | 
| 
 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 
wenzelm 
parents:  
diff
changeset
 | 
20  | 
struct  | 
| 
 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 
wenzelm 
parents:  
diff
changeset
 | 
21  | 
|
| 10359 | 22  | 
(** bindings **)  | 
23  | 
||
| 17349 | 24  | 
val rule_contextN = "rule_context";  | 
| 10359 | 25  | 
val thesisN = "thesis";  | 
26  | 
val thisN = "this";  | 
|
27  | 
||
| 17349 | 28  | 
fun strip_judgment thy = ObjectLogic.drop_judgment thy o Logic.strip_assums_concl;  | 
| 11764 | 29  | 
|
| 17349 | 30  | 
fun statement_binds thy name prop =  | 
31  | 
[((name, 0), SOME (Term.list_abs (Logic.strip_params prop, strip_judgment thy prop)))];  | 
|
| 10359 | 32  | 
|
33  | 
||
34  | 
(* goal *)  | 
|
35  | 
||
| 17349 | 36  | 
fun goal thy [prop] = statement_binds thy thesisN prop  | 
| 15531 | 37  | 
| goal _ _ = [((thesisN, 0), NONE)];  | 
| 10359 | 38  | 
|
| 18605 | 39  | 
fun cases thy [prop] = RuleCases.make_simple true (thy, prop) rule_contextN  | 
40  | 
| cases _ _ = [(rule_contextN, NONE)];  | 
|
| 17349 | 41  | 
|
| 10359 | 42  | 
|
43  | 
(* facts *)  | 
|
44  | 
||
| 17349 | 45  | 
fun get_arg thy prop =  | 
46  | 
(case strip_judgment thy prop of  | 
|
| 15531 | 47  | 
_ $ t => SOME (Term.list_abs (Logic.strip_params prop, t))  | 
48  | 
| _ => NONE);  | 
|
| 10359 | 49  | 
|
| 12140 | 50  | 
fun facts _ [] = []  | 
| 17349 | 51  | 
| facts thy props =  | 
| 10359 | 52  | 
let val prop = Library.last_elem props  | 
| 17349 | 53  | 
in [(Syntax.dddot_indexname, get_arg thy prop)] @ statement_binds thy thisN prop end;  | 
| 10359 | 54  | 
|
| 17852 | 55  | 
val no_facts = [(Syntax.dddot_indexname, NONE), ((thisN, 0), NONE)];  | 
| 10808 | 56  | 
|
| 
6783
 
9cf9c17d9e35
renamed object_logic.ML to Isar/auto_bind.ML and tuned this module;
 
wenzelm 
parents:  
diff
changeset
 | 
57  | 
end;  |