author | Christian Urban <urbanc@in.tum.de> |
Wed, 17 Dec 2008 05:08:33 +0000 | |
changeset 59 | b5914f3c643c |
parent 58 | f3794c231898 |
child 63 | 83cea5dc6bac |
permissions | -rw-r--r-- |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory NamedThms |
58 | 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, |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
12 |
which are then used in a method.\smallskip |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
|
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
14 |
{\bf Solution:} This can be achieved using named theorem lists.\smallskip |
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
15 |
|
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
16 |
Named theorem lists can be set up using the code |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
18 |
*} |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
19 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
20 |
ML {* |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
21 |
structure FooRules = NamedThmsFun ( |
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
22 |
val name = "foo" |
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
23 |
val description = "Rules for foo"); |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
24 |
*} |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
25 |
(*<*)setup FooRules.setup(*>*) |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
text {* |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
28 |
and the command |
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
29 |
|
58 | 30 |
@{text [display] "setup FooRules.setup"} |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
31 |
|
20 | 32 |
This code declares a context data slot where the theorems are stored, |
58 | 33 |
an attribute @{text foo} (with the usual @{text add} and @{text del} options |
51
c346c156a7cd
completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents:
48
diff
changeset
|
34 |
for adding and deleting theorems) and an internal ML interface to retrieve and |
20 | 35 |
modify the theorems. |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
36 |
|
20 | 37 |
Furthermore, the facts are made available on the user level under the dynamic |
51
c346c156a7cd
completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents:
48
diff
changeset
|
38 |
fact name @{text foo}. For example we can declare three lemmas to be of the kind |
58 | 39 |
@{text foo} by: |
0
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 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
lemma rule1[foo]: "A" sorry |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
43 |
lemma rule2[foo]: "B" sorry |
48
609f9ef73494
fixed FIXME's in fake responses
Christian Urban <urbanc@in.tum.de>
parents:
47
diff
changeset
|
44 |
lemma rule3[foo]: "C" sorry |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
|
51
c346c156a7cd
completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents:
48
diff
changeset
|
46 |
text {* and undeclare the first one by: *} |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
47 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
declare rule1[foo del] |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
|
51
c346c156a7cd
completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents:
48
diff
changeset
|
50 |
text {* and query the remaining ones by: *} |
47
4daf913fdbe1
hakked latex so that it does not display ML {* *}; general tuning
Christian Urban <urbanc@in.tum.de>
parents:
43
diff
changeset
|
51 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
52 |
thm foo |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
|
20 | 54 |
text {* |
58 | 55 |
On the ML-level the rules marked with @{text "foo"} an be retrieved |
51
c346c156a7cd
completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents:
48
diff
changeset
|
56 |
using the function @{ML FooRules.get}: |
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
|
48
609f9ef73494
fixed FIXME's in fake responses
Christian Urban <urbanc@in.tum.de>
parents:
47
diff
changeset
|
58 |
@{ML_response_fake [display] "FooRules.get @{context}" "[\"?C\",\"?B\"]"} |
20 | 59 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
60 |
\begin{readmore} |
12
2f1736cb8f26
various changes by Alex and Christian
Christian Urban <urbanc@in.tum.de>
parents:
2
diff
changeset
|
61 |
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
|
62 |
\end{readmore} |
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 |
|
15
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
65 |
text {* |
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
66 |
(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
|
67 |
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
|
68 |
|
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
69 |
*} |
9da9ba2b095b
added a solution section and some other minor additions
Christian Urban <urbanc@in.tum.de>
parents:
14
diff
changeset
|
70 |
|
0
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
71 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
end |
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
73 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
74 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
75 |
|
02503850a8cf
initial commit of Alexander's files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
76 |