author | berghofe |
Mon, 13 Oct 2008 17:51:59 +0200 | |
changeset 35 | d5c090b9a2b1 |
parent 25 | e2f9f94b26d4 |
child 43 | 02f76f1b6e7b |
permissions | -rw-r--r-- |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory NamedThms |
25
e2f9f94b26d4
Antiquotation setup is now contained in theory Base.
berghofe
parents:
20
diff
changeset
|
2 |
imports Base |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
13
2b07da8b310d
polished and added a subdirectory for the recipes
Christian Urban <urbanc@in.tum.de>
parents:
12
diff
changeset
|
5 |
section {* Accumulate a List of Theorems under a Name *} |
2
978a3c2ed7ce
split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
0
diff
changeset
|
6 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
text {* |
20 | 9 |
{\bf Problem:} |
10 |
Your tool @{text foo} works with special rules, called @{text foo}-rules. |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
Users should be able to declare @{text foo}-rules in the theory, |
20 | 12 |
which are then used by some method.\smallskip |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
|
20 | 14 |
{\bf Solution:} This can be achieved using |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
*} |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
ML {* |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
18 |
structure FooRules = NamedThmsFun( |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
19 |
val name = "foo" |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
20 |
val description = "Rules for foo" |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
21 |
); |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
22 |
*} |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
23 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
24 |
setup FooRules.setup |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
25 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
text {* |
20 | 27 |
This code declares a context data slot where the theorems are stored, |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
28 |
an attribute @{attribute foo} (with the usual @{text add} and @{text del} options |
20 | 29 |
to adding and deleting theorems) and an internal ML interface to retrieve and |
30 |
modify the theorems. |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
|
20 | 32 |
Furthermore, the facts are made available on the user level under the dynamic |
33 |
fact name @{text foo}. For example: |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
34 |
*} |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
35 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
36 |
lemma rule1[foo]: "A" sorry |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
37 |
lemma rule2[foo]: "B" sorry |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
38 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
39 |
declare rule1[foo del] |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
thm foo |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
|
20 | 43 |
text {* |
44 |
In an ML-context the rules marked with @{text "foo"} an be retrieved |
|
45 |
using |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
*} |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
|
20 | 48 |
ML {* FooRules.get @{context} *} |
49 |
||
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
50 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
51 |
text {* |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
52 |
\begin{readmore} |
12
2f1736cb8f26
various changes by Alex and Christian
Christian Urban <urbanc@in.tum.de>
parents:
2
diff
changeset
|
53 |
For more information see @{ML_file "Pure/Tools/named_thms.ML"}. |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
\end{readmore} |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
*} |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
|
15
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
57 |
text {* |
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
58 |
(FIXME: maybe add a comment about the case when the theorems |
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
59 |
to be added need to satisfy certain properties) |
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
60 |
|
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
61 |
*} |
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
62 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
64 |
end |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
65 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
66 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
67 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |