akargl@42176
|
1 |
(* Title: test for sml/xmlsrc/datatypes.sml
|
akargl@42176
|
2 |
Authors: Walther Neuper 2003
|
neuper@37906
|
3 |
(c) due to copyright terms
|
neuper@37906
|
4 |
|
neuper@37906
|
5 |
use"../smltest/xmlsrc/datatypes.sml";
|
neuper@37906
|
6 |
use"datatypes.sml";
|
neuper@37906
|
7 |
*)
|
neuper@37906
|
8 |
|
neuper@37906
|
9 |
"-----------------------------------------------------------------";
|
neuper@37906
|
10 |
"table of contents -----------------------------------------------";
|
neuper@37906
|
11 |
"-----------------------------------------------------------------";
|
neuper@37906
|
12 |
"----------- fun rules2xml ---------------------------------------";
|
neuper@37906
|
13 |
"----------- fun thm''2xml ---------------------------------------";
|
wneuper@59127
|
14 |
"----------- fun xml_of_model ------------------------------------------------------------------";
|
wneuper@59158
|
15 |
"----------- fun xml_of_tac --------------------------------------------------------------------";
|
wneuper@59158
|
16 |
"----------- fun xml_of_tac: SimpleTacic: is not properly abstracted in Java -------------------";
|
wneuper@59158
|
17 |
"----------- fun xml_of_tac: StringListTactic --------------------------------------------------";
|
wneuper@59159
|
18 |
"----------- fun xml_of_tac: different substitutions converted to same XML ---------------------";
|
neuper@37906
|
19 |
"-----------------------------------------------------------------";
|
neuper@37906
|
20 |
"-----------------------------------------------------------------";
|
neuper@37906
|
21 |
"-----------------------------------------------------------------";
|
walther@59874
|
22 |
|
neuper@37906
|
23 |
|
neuper@37906
|
24 |
|
neuper@37906
|
25 |
"----------- fun rules2xml ---------------------------------------";
|
neuper@37906
|
26 |
"----------- fun rules2xml ---------------------------------------";
|
neuper@37906
|
27 |
"----------- fun rules2xml ---------------------------------------";
|
akargl@42176
|
28 |
|
neuper@37906
|
29 |
show_thes();
|
neuper@37906
|
30 |
val thyID = "Test";
|
akargl@42176
|
31 |
|
akargl@42176
|
32 |
(*========== inhibit exn AK110725 ================================================
|
walther@59970
|
33 |
val thydata = Thy_Read.from_store ["IsacKnowledge", "Test", "Rulesets", "ac_plus_times"];
|
akargl@42176
|
34 |
(*AK110725
|
walther@59970
|
35 |
(*val thydata = Thy_Read.from_store ["IsacKnowledge", "Test", "Rulesets", "ac_plus_times"];
|
walther@59997
|
36 |
(* ERROR: Problem.from_store not found: ["IsacKnowledge", "Test", "Rulesets", "ac_plus_times"] *)*)
|
walther@59970
|
37 |
"~~~~~ fun Thy_Read.from_store, args:"; val (theID:theID) = (["IsacKnowledge", "Test", "Rulesets", "ac_plus_times"]);
|
walther@59879
|
38 |
(*get_py (ThyC.get_theory "Pure") theID theID (get_thes ());
|
walther@59997
|
39 |
(* ERROR: Problem.from_store not found: ["IsacKnowledge", "Test", "Rulesets", "ac_plus_times"] *)*)
|
wneuper@59348
|
40 |
(*default_print_depth 3; 999*)
|
neuper@55421
|
41 |
(get_thes ());
|
akargl@42176
|
42 |
|
walther@59879
|
43 |
(*"~~~~~ fun get_py, args:"; val (thy, d, _, []) = ((ThyC.get_theory "Pure"), theID, theID, (get_thes ()));*)
|
walther@59879
|
44 |
"~~~~~ fun get_py, args:"; val (thy, d, _, [_]) = ((ThyC.get_theory "Pure"), theID, theID, (get_thes ()));
|
walther@59970
|
45 |
error ("Problem.from_store not found: "^(strs2str d));
|
akargl@42176
|
46 |
(*AK110725 To be continued...s*)
|
akargl@42176
|
47 |
*)
|
akargl@42176
|
48 |
|
walther@59851
|
49 |
val Hrls {thy_rls = (_,Rule_Set.Repeat {rules = rules as rule::_,...}),...} = thydata;
|
neuper@37906
|
50 |
|
neuper@37906
|
51 |
(*for rule2xml...*)
|
neuper@37906
|
52 |
val (j, thyID, Thm (thmID, thm)) = (2, thyID, rule);
|
neuper@37906
|
53 |
val (isa, thyID') = thy_containing_thm thyID thmID;
|
neuper@37906
|
54 |
val guh = thm2guh (isa, thyID') thmID;
|
neuper@37906
|
55 |
writeln (rules2xml 2 "Test" rules);
|
neuper@37906
|
56 |
|
neuper@37906
|
57 |
|
neuper@37906
|
58 |
"----------- fun thm''2xml ---------------------------------------";
|
neuper@37906
|
59 |
"----------- fun thm''2xml ---------------------------------------";
|
neuper@37906
|
60 |
"----------- fun thm''2xml ---------------------------------------";
|
akargl@42176
|
61 |
|
neuper@37906
|
62 |
show_thes();
|
neuper@37906
|
63 |
val theID = ["IsacKnowledge", "Diff", "Theorems", "frac_conv"];
|
walther@59970
|
64 |
val thydata = Thy_Read.from_store theID;
|
neuper@37906
|
65 |
val Hthm {guh=guh, thm=thm, mathauthors=ma, coursedesign=co} = thydata;
|
neuper@37906
|
66 |
writeln(thydata2xml (theID, thydata));
|
neuper@37906
|
67 |
"----- check 'manually' ...0 < ?n |] ==> ?a... -----";
|
walther@60242
|
68 |
"---------------------------- \<up> --------- \<up> ------------";
|
neuper@37906
|
69 |
|
neuper@37906
|
70 |
|
neuper@37906
|
71 |
|
neuper@37906
|
72 |
(* use"../smltest/xmlsrc/datatypes.sml";
|
akargl@42176
|
73 |
*)
|
akargl@42176
|
74 |
============ inhibit exn AK110725 ==============================================*)
|
wneuper@59127
|
75 |
|
wneuper@59127
|
76 |
"----------- fun xml_of_model ------------------------------------------------------------------";
|
wneuper@59127
|
77 |
"----------- fun xml_of_model ------------------------------------------------------------------";
|
wneuper@59127
|
78 |
"----------- fun xml_of_model ------------------------------------------------------------------";
|
wneuper@59127
|
79 |
(*create testdata: see --- tryrefine ---
|
wneuper@59127
|
80 |
xml_of_model used via refineProblem \<longrightarrow> matchpbl2xml \<longrightarrow> model2xml*)
|
wneuper@59127
|
81 |
reset_states ();
|
walther@60242
|
82 |
CalcTree [(["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
|
wneuper@59127
|
83 |
"solveFor x", "solutions L"],
|
walther@59997
|
84 |
("RatEq",["univariate", "equation"],["no_met"]))];
|
wneuper@59127
|
85 |
Iterator 1;
|
wneuper@59127
|
86 |
moveActiveRoot 1; autoCalculate 1 CompleteCalc;
|
wneuper@59127
|
87 |
refineProblem 1 ([1],Res) "pbl_equ_univ";
|
walther@59904
|
88 |
"~~~~~ fun refineProblem, args:"; val (cI, ((p,p_) : pos'), (guh : Check_Unique.id)) =
|
wneuper@59127
|
89 |
(1, ([1],Res), "pbl_equ_univ");
|
walther@59974
|
90 |
val pblID = Ptool.guh2kestoreID guh
|
wneuper@59127
|
91 |
val ((pt,_),_) = get_calc cI
|
wneuper@59127
|
92 |
val pp = par_pblobj pt p
|
wneuper@59127
|
93 |
val chd = tryrefine pblID pt (pp, p_);
|
wneuper@59127
|
94 |
"~~~~~ fun matchpbl2xml, args:"; val ((cI:calcID), (model_ok, pI, hdl, pbl, pre)) = (cI, chd);
|
walther@59943
|
95 |
"~~~~~ fun model2xml, args:"; val (j, (itms:I_Model.T), where_) = (i, pbl, pre);
|
wneuper@59127
|
96 |
"~~~~~ fun xml_of_model, args:"; val (itms, where_) = (pbl, pre);
|
wneuper@59127
|
97 |
val xxx = xml_of_model itms where_;
|
wneuper@59127
|
98 |
(xmlstr 0 xxx);
|
wneuper@59127
|
99 |
writeln(xmlstr 0 xxx);
|
walther@60242
|
100 |
if xmlstr 0 xxx = "(MODEL)\n. (GIVEN)\n. . (ITEM status=correct)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . equality (x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) = 1 / x)\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/ITEM)\n. . (ITEM status=correct)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . solveFor x\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/ITEM)\n. (/GIVEN)\n. (WHERE)\n. . (ITEM status=correct)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/ITEM)\n. (/WHERE)\n. (FIND)\n. . (ITEM status=correct)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . solutions L\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/ITEM)\n. (/FIND)\n. (RELATE)\n. (/RELATE)\n(/MODEL)\n"
|
wneuper@59127
|
101 |
then () else error ("xml_of_model changed = " ^ xmlstr 0 xxx);
|
wneuper@59127
|
102 |
|
wneuper@59158
|
103 |
"----------- fun xml_of_tac --------------------------------------------------------------------";
|
wneuper@59158
|
104 |
"----------- fun xml_of_tac --------------------------------------------------------------------";
|
wneuper@59158
|
105 |
"----------- fun xml_of_tac --------------------------------------------------------------------";
|
wneuper@59158
|
106 |
(* WN150814 these are the Java objects.
|
wneuper@59158
|
107 |
import isac.util.tactics.RewriteInst
|
wneuper@59158
|
108 |
import isac.util.tactics.RewriteSet
|
wneuper@59158
|
109 |
import isac.util.tactics.RewriteSetInst
|
wneuper@59158
|
110 |
import isac.util.tactics.SimpleTactic ...not appropriately abstracted
|
wneuper@59158
|
111 |
import isac.util.tactics.StringListTactic ...not appropriately abstracted
|
wneuper@59158
|
112 |
import isac.util.tactics.SubProblemTactic
|
wneuper@59158
|
113 |
import isac.util.tactics.Tactic
|
wneuper@59158
|
114 |
*)
|
walther@59874
|
115 |
Rewrite: ThmC.T -> Tactic.input;
|
wneuper@59253
|
116 |
val tac = Rewrite("refl", @{thm refl});
|
wneuper@59252
|
117 |
if xmlstr 0 (xml_of_tac tac) =
|
wneuper@59252
|
118 |
(*---xml_of_tac------------------------------------------thm'_to_thm''--------------
|
wneuper@59252
|
119 |
"(REWRITETACTIC name=Rewrite)\n" ^
|
wneuper@59252
|
120 |
". (THEOREM)\n" ^
|
wneuper@59252
|
121 |
". . (ID)\n" ^
|
wneuper@59252
|
122 |
". . . refl\n" ^
|
wneuper@59252
|
123 |
". . (/ID)\n" ^
|
wneuper@59252
|
124 |
". . (FORMULA)\n" ^
|
wneuper@59252
|
125 |
". . . (ISA)\n" ^
|
wneuper@59252
|
126 |
". . . . a = a\n" ^
|
wneuper@59252
|
127 |
". . . (/ISA)\n" ^
|
wneuper@59252
|
128 |
". . . (TERM)\n" ^
|
wneuper@59253
|
129 |
". . . . ?t = ?t\n" ^
|
wneuper@59252
|
130 |
". . . (/TERM)\n" ^
|
wneuper@59252
|
131 |
". . (/FORMULA)\n" ^
|
wneuper@59252
|
132 |
". (/THEOREM)\n" ^
|
wneuper@59252
|
133 |
-----xml_of_tac------------------------------------------thm'_to_thm''------------*)
|
wneuper@59252
|
134 |
"(REWRITETACTIC name=Rewrite)\n" ^
|
wneuper@59252
|
135 |
". (THEOREM)\n" ^
|
wneuper@59252
|
136 |
". . (ID)\n" ^
|
wneuper@59252
|
137 |
". . . refl\n" ^
|
wneuper@59252
|
138 |
". . (/ID)\n" ^
|
wneuper@59252
|
139 |
". . (FORMULA)\n" ^
|
wneuper@59253
|
140 |
". . . ?t = ?t\n" ^
|
wneuper@59252
|
141 |
". . (/FORMULA)\n" ^
|
wneuper@59252
|
142 |
". (/THEOREM)\n" ^
|
wneuper@59252
|
143 |
"(/REWRITETACTIC)\n" then () else error "xml_of_tac Rewrite CHANGED";
|
wneuper@59158
|
144 |
|
walther@59911
|
145 |
Rewrite_Inst: Subst.input * ThmC.T -> Tactic.input;
|
wneuper@59497
|
146 |
val tac = Rewrite_Inst(["(''bdv'', x)"], ("refl", @{thm refl}));
|
wneuper@59252
|
147 |
if xmlstr 0 (xml_of_tac tac) =
|
wneuper@59252
|
148 |
"(REWRITEINSTTACTIC name=Rewrite_Inst)\n" ^
|
wneuper@59252
|
149 |
". (SUBSTITUTION)\n" ^
|
wneuper@59252
|
150 |
". . (PAIR)\n" ^
|
wneuper@59252
|
151 |
". . . (VARIABLE)\n" ^
|
wneuper@59252
|
152 |
". . . . (MATHML)\n" ^ (* TODO *)
|
wneuper@59252
|
153 |
". . . . . (ISA)\n" ^
|
wneuper@59252
|
154 |
". . . . . . bdv\n" ^
|
wneuper@59252
|
155 |
". . . . . (/ISA)\n" ^
|
wneuper@59252
|
156 |
". . . . (/MATHML)\n" ^
|
wneuper@59252
|
157 |
". . . (/VARIABLE)\n" ^
|
wneuper@59252
|
158 |
". . . (VALUE)\n" ^
|
wneuper@59252
|
159 |
". . . . (MATHML)\n" ^
|
wneuper@59252
|
160 |
". . . . . (ISA)\n" ^
|
wneuper@59252
|
161 |
". . . . . . x\n" ^
|
wneuper@59252
|
162 |
". . . . . (/ISA)\n" ^
|
wneuper@59252
|
163 |
". . . . (/MATHML)\n" ^
|
wneuper@59252
|
164 |
". . . (/VALUE)\n" ^
|
wneuper@59252
|
165 |
". . (/PAIR)\n" ^
|
wneuper@59252
|
166 |
". (/SUBSTITUTION)\n" ^
|
wneuper@59252
|
167 |
(*---xml_of_tac------------------------------------------thm'_to_thm''--------------
|
wneuper@59252
|
168 |
". (THEOREM)\n" ^
|
wneuper@59252
|
169 |
". . (ID)\n" ^
|
wneuper@59252
|
170 |
". . . refl\n" ^
|
wneuper@59252
|
171 |
". . (/ID)\n" ^
|
wneuper@59252
|
172 |
". . (FORMULA)\n" ^ (* OK *)
|
wneuper@59252
|
173 |
". . . (ISA)\n" ^
|
wneuper@59252
|
174 |
". . . . a = a\n" ^
|
wneuper@59252
|
175 |
". . . (/ISA)\n" ^
|
wneuper@59252
|
176 |
". . . (TERM)\n" ^
|
wneuper@59253
|
177 |
". . . ?t = ?t\n" ^
|
wneuper@59252
|
178 |
". . . (/TERM)\n" ^
|
wneuper@59252
|
179 |
". . (/FORMULA)\n" ^
|
wneuper@59252
|
180 |
". (/THEOREM)\n" ^
|
wneuper@59252
|
181 |
-----xml_of_tac------------------------------------------thm'_to_thm''------------*)
|
wneuper@59252
|
182 |
". (THEOREM)\n" ^
|
wneuper@59252
|
183 |
". . (ID)\n" ^
|
wneuper@59252
|
184 |
". . . refl\n" ^
|
wneuper@59252
|
185 |
". . (/ID)\n" ^
|
wneuper@59252
|
186 |
". . (FORMULA)\n" ^
|
wneuper@59253
|
187 |
". . . ?t = ?t\n" ^
|
wneuper@59252
|
188 |
". . (/FORMULA)\n" ^
|
wneuper@59252
|
189 |
". (/THEOREM)\n" ^
|
wneuper@59252
|
190 |
"(/REWRITEINSTTACTIC)\n" then () else error "xml_of_tac Rewrite_Inst CHANGED";
|
wneuper@59158
|
191 |
|
walther@59867
|
192 |
Rewrite_Set: Rule_Set.id -> Tactic.input;
|
wneuper@59158
|
193 |
val tac = Rewrite_Set("simplify");
|
wneuper@59252
|
194 |
if xmlstr 0 (xml_of_tac tac) = "(REWRITESETTACTIC name=Rewrite_Set)\n" ^
|
wneuper@59252
|
195 |
". simplify\n" ^
|
wneuper@59252
|
196 |
"(/REWRITESETTACTIC)\n" then () else error "xml_of_tac Rewrite_Set CHANGED";
|
wneuper@59158
|
197 |
|
walther@59911
|
198 |
Rewrite_Set_Inst: Subst.input * Rule_Set.id -> Tactic.input;
|
wneuper@59497
|
199 |
val tac = Rewrite_Set_Inst(["(''bdv'', x)"], "simplify");
|
wneuper@59252
|
200 |
if xmlstr 0 (xml_of_tac tac) =
|
wneuper@59252
|
201 |
"(REWRITESETINSTTACTIC name=Rewrite_Set_Inst)\n" ^
|
wneuper@59252
|
202 |
". (SUBSTITUTION)\n" ^
|
wneuper@59252
|
203 |
". . (PAIR)\n" ^
|
wneuper@59252
|
204 |
". . . (VARIABLE)\n" ^
|
wneuper@59252
|
205 |
". . . . (MATHML)\n" ^ (* TODO *)
|
wneuper@59252
|
206 |
". . . . . (ISA)\n" ^
|
wneuper@59252
|
207 |
". . . . . . bdv\n" ^
|
wneuper@59252
|
208 |
". . . . . (/ISA)\n" ^
|
wneuper@59252
|
209 |
". . . . (/MATHML)\n" ^
|
wneuper@59252
|
210 |
". . . (/VARIABLE)\n" ^
|
wneuper@59252
|
211 |
". . . (VALUE)\n" ^
|
wneuper@59252
|
212 |
". . . . (MATHML)\n" ^
|
wneuper@59252
|
213 |
". . . . . (ISA)\n" ^
|
wneuper@59252
|
214 |
". . . . . . x\n" ^
|
wneuper@59252
|
215 |
". . . . . (/ISA)\n" ^
|
wneuper@59252
|
216 |
". . . . (/MATHML)\n" ^
|
wneuper@59252
|
217 |
". . . (/VALUE)\n" ^
|
wneuper@59252
|
218 |
". . (/PAIR)\n" ^
|
wneuper@59252
|
219 |
". (/SUBSTITUTION)\n" ^
|
wneuper@59252
|
220 |
". (RULESET)\n" ^
|
wneuper@59252
|
221 |
". . simplify\n" ^
|
wneuper@59252
|
222 |
". (/RULESET)\n" ^
|
wneuper@59252
|
223 |
"(/REWRITESETINSTTACTIC)\n"then () else error "xml_of_tac Rewrite_Set_Inst CHANGED";
|
wneuper@59252
|
224 |
|
wneuper@59158
|
225 |
|
wneuper@59158
|
226 |
"----------- fun xml_of_tac: SimpleTacic: is not properly abstracted in Java -------------------";
|
wneuper@59158
|
227 |
"----------- fun xml_of_tac: SimpleTacic: is not properly abstracted in Java -------------------";
|
wneuper@59158
|
228 |
"----------- fun xml_of_tac: SimpleTacic: is not properly abstracted in Java -------------------";
|
wneuper@59158
|
229 |
|
walther@59865
|
230 |
"----------- these are : TermC.as_string -> tac: WN150814 THESE WELL BECOME TermTactic TERMTACTIC";
|
walther@59865
|
231 |
Add_Given: TermC.as_string -> Tactic.input;
|
walther@59865
|
232 |
Add_Find: TermC.as_string -> Tactic.input;
|
walther@59865
|
233 |
Add_Relation: TermC.as_string -> Tactic.input;
|
walther@59865
|
234 |
Check_elementwise: TermC.as_string -> Tactic.input;
|
walther@59865
|
235 |
Take: TermC.as_string -> Tactic.input;
|
wneuper@59158
|
236 |
|
walther@59865
|
237 |
Add_Given: TermC.as_string -> Tactic.input;
|
wneuper@59158
|
238 |
val tac = Add_Given("equality (x + 1 = 2)");
|
wneuper@59158
|
239 |
xml_of_tac tac;(*
|
wneuper@59162
|
240 |
<FORMTACTIC name="Add_Given">
|
wneuper@59158
|
241 |
<MATHML>
|
wneuper@59158
|
242 |
<ISA>equality (x + 1 = 2)</ISA>
|
wneuper@59158
|
243 |
</MATHML>
|
wneuper@59162
|
244 |
</FORMTACTIC>*)
|
wneuper@59170
|
245 |
if xmlstr 0 (xml_of_tac tac) = "(FORMTACTIC name=Add_Given)\n. (MATHML)\n. . (ISA)\n. . . equality (x + 1 = 2)\n. . (/ISA)\n. (/MATHML)\n(/FORMTACTIC)\n"
|
wneuper@59158
|
246 |
then () else error "xml_of_tac Add_Given CHANGED";
|
wneuper@59158
|
247 |
|
wneuper@59158
|
248 |
"----------- these are : string -> tac: ";
|
wneuper@59571
|
249 |
Calculate: string -> Tactic.input;; (* should be the operator*)
|
walther@59879
|
250 |
Specify_Theory: ThyC.id -> Tactic.input;;
|
wneuper@59158
|
251 |
val tac = Specify_Theory("Differentiate");
|
wneuper@59158
|
252 |
xml_of_tac tac;(*
|
wneuper@59158
|
253 |
<SIMPLETACTIC name="Specify_Theory">
|
wneuper@59158
|
254 |
<MATHML> NONSENSE
|
wneuper@59158
|
255 |
<ISA>Differentiate</ISA>
|
wneuper@59158
|
256 |
</MATHML>
|
wneuper@59158
|
257 |
</SIMPLETACTIC>*)
|
wneuper@59170
|
258 |
if xmlstr 0 (xml_of_tac tac) = "(SIMPLETACTIC name=Specify_Theory)\n. Differentiate\n(/SIMPLETACTIC)\n"
|
wneuper@59158
|
259 |
then () else error "xml_of_tac Specify_Theory CHANGED";
|
wneuper@59158
|
260 |
|
wneuper@59158
|
261 |
"----------- fun xml_of_tac: StringListTactic --------------------------------------------------";
|
wneuper@59158
|
262 |
"----------- fun xml_of_tac: StringListTactic --------------------------------------------------";
|
wneuper@59158
|
263 |
"----------- fun xml_of_tac: StringListTactic --------------------------------------------------";
|
wneuper@59571
|
264 |
Model_Problem: Tactic.input;
|
wneuper@59571
|
265 |
Or_to_List: Tactic.input;
|
wneuper@59158
|
266 |
|
walther@60154
|
267 |
Apply_Method: MethodC.id -> Tactic.input;
|
walther@59903
|
268 |
Refine_Tacitly: Problem.id -> Tactic.input;
|
walther@59903
|
269 |
Specify_Problem: Problem.id -> Tactic.input;
|
walther@60154
|
270 |
Specify_Method: MethodC.id -> Tactic.input;
|
walther@59912
|
271 |
Substitute: Subst.input -> Tactic.input;; (* Substitute: sube -> tac; Subst.string_eqs_empty: TermC.as_string list; UNCLEAR HOW TO INPUT *)
|
walther@59903
|
272 |
Check_Postcond: Problem.id -> Tactic.input;
|
wneuper@59158
|
273 |
|
walther@60154
|
274 |
Apply_Method: MethodC.id -> Tactic.input;
|
wneuper@59158
|
275 |
val tac = Apply_Method(["test", "equation", "simplify"]);
|
wneuper@59158
|
276 |
xml_of_tac tac;(*
|
wneuper@59158
|
277 |
<STRINGLISTTACTIC name="Apply_Method">
|
wneuper@59158
|
278 |
<STRINGLIST>
|
wneuper@59158
|
279 |
<STRING>test</STRING>
|
wneuper@59158
|
280 |
<STRING>equation</STRING>
|
wneuper@59158
|
281 |
<STRING>simplify</STRING>
|
wneuper@59158
|
282 |
</STRINGLIST>
|
wneuper@59158
|
283 |
</STRINGLISTTACTIC>*)
|
wneuper@59170
|
284 |
if xmlstr 0 (xml_of_tac tac) = "(STRINGLISTTACTIC name=Apply_Method)\n. (STRINGLIST)\n. . (STRING)\n. . . test\n. . (/STRING)\n. . (STRING)\n. . . equation\n. . (/STRING)\n. . (STRING)\n. . . simplify\n. . (/STRING)\n. (/STRINGLIST)\n(/STRINGLISTTACTIC)\n"
|
wneuper@59158
|
285 |
then () else error "xml_of_tac Apply_Method CHANGED";
|
wneuper@59158
|
286 |
|
wneuper@59159
|
287 |
"----------- fun xml_of_tac: different substitutions converted to same XML ---------------------";
|
wneuper@59159
|
288 |
"----------- fun xml_of_tac: different substitutions converted to same XML ---------------------";
|
wneuper@59159
|
289 |
"----------- fun xml_of_tac: different substitutions converted to same XML ---------------------";
|
wneuper@59159
|
290 |
(* Note: tacs Substitute, Rewrite_Inst* have different substitutions,
|
wneuper@59159
|
291 |
while input in frontend is not yet clear: *)
|
walther@59911
|
292 |
Rewrite_Inst: Subst.input * ThmC.T -> Tactic.input;
|
walther@59912
|
293 |
Substitute : Subst.input -> Tactic.input;
|
wneuper@59159
|
294 |
|
walther@59911
|
295 |
Subst.input_empty: Subst.input;
|
walther@59911
|
296 |
Subst.input_empty: Subst.input;
|
walther@59997
|
297 |
val subs = ["(''bdv_1'', xxx)", "(''bdv_2'', yyy)"]: TermC.as_string list;
|
wneuper@59159
|
298 |
xml_of_subs subs;(*
|
wneuper@59159
|
299 |
<SUBSTITUTION>
|
wneuper@59159
|
300 |
<PAIR>
|
wneuper@59159
|
301 |
<VARIABLE>
|
wneuper@59159
|
302 |
<MATHML>
|
wneuper@59159
|
303 |
<ISA>bdv_1</ISA>
|
wneuper@59159
|
304 |
</MATHML>
|
wneuper@59159
|
305 |
</VARIABLE>
|
wneuper@59159
|
306 |
<VALUE><
|
wneuper@59159
|
307 |
MATHML>
|
wneuper@59159
|
308 |
<ISA>xxx</ISA>
|
wneuper@59159
|
309 |
</MATHML>
|
wneuper@59159
|
310 |
</VALUE>
|
wneuper@59159
|
311 |
</PAIR>
|
wneuper@59159
|
312 |
<PAIR>
|
wneuper@59159
|
313 |
<VARIABLE>
|
wneuper@59159
|
314 |
<MATHML>
|
wneuper@59159
|
315 |
<ISA>bdv_2</ISA>
|
wneuper@59159
|
316 |
</MATHML>
|
wneuper@59159
|
317 |
</VARIABLE>
|
wneuper@59159
|
318 |
<VALUE>
|
wneuper@59159
|
319 |
<MATHML>
|
wneuper@59159
|
320 |
<ISA>yyy</ISA>
|
wneuper@59159
|
321 |
</MATHML>
|
wneuper@59159
|
322 |
</VALUE>
|
wneuper@59159
|
323 |
</PAIR>
|
wneuper@59159
|
324 |
</SUBSTITUTION>:*)
|
wneuper@59253
|
325 |
val tac = Rewrite_Inst (subs, ("diff_sin_chain", @{thm diff_sin_chain}));
|
wneuper@59159
|
326 |
val xml = xml_of_tac tac;
|
wneuper@59159
|
327 |
|
wneuper@59170
|
328 |
if xmlstr 0 (xml_of_tac tac) = "(REWRITEINSTTACTIC name=Rewrite_Inst)\n. (SUBSTITUTION)\n. . (PAIR)\n. . . (VARIABLE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . bdv_1\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VARIABLE)\n. . . (VALUE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . xxx\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VALUE)\n. . (/PAIR)\n. . (PAIR)\n. . . (VARIABLE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . bdv_2\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VARIABLE)\n. . . (VALUE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . yyy\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VALUE)\n. . (/PAIR)\n. (/SUBSTITUTION)\n. (THEOREM)\n. . (ID)\n. . . diff_sin_chain\n. . (/ID)\n. . (FORMULA)\n. . . d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u\n. . (/FORMULA)\n. (/THEOREM)\n(/REWRITEINSTTACTIC)\n"
|
wneuper@59159
|
329 |
then () else error "xml_of_tac Rewrite_Inst CHANGED";
|
wneuper@59252
|
330 |
|
wneuper@59498
|
331 |
val Rewrite_Inst (["(''bdv_1'', xxx)", "(''bdv_2'', yyy)"], ("diff_sin_chain", term)) = xml_to_tac xml;
|
walther@59868
|
332 |
if (UnparseC.term o Thm.prop_of) term = "d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u"
|
wneuper@59159
|
333 |
then () else error "xml_to_tac Rewrite_Inst CHANGED";
|
wneuper@59159
|
334 |
|
walther@59912
|
335 |
val sube = ["(bdv_1 = xxx)", "(bdv_2 = yyy)"]: Subst.input;
|
walther@59912
|
336 |
Subst.string_eqs_empty: TermC.as_string list;
|
walther@59912
|
337 |
Subst.string_eqs_empty: Subst.input;
|
wneuper@59159
|
338 |
xml_of_sube sube;(*
|
wneuper@59159
|
339 |
<SUBSTITUTION>
|
wneuper@59159
|
340 |
<PAIR>
|
wneuper@59159
|
341 |
<VARIABLE>
|
wneuper@59159
|
342 |
<MATHML>
|
wneuper@59159
|
343 |
<ISA>bdv_1</ISA>
|
wneuper@59159
|
344 |
</MATHML>
|
wneuper@59159
|
345 |
</VARIABLE>
|
wneuper@59159
|
346 |
<VALUE>
|
wneuper@59159
|
347 |
<MATHML>
|
wneuper@59159
|
348 |
<ISA>xxx</ISA>
|
wneuper@59159
|
349 |
</MATHML>
|
wneuper@59159
|
350 |
</VALUE>
|
wneuper@59159
|
351 |
</PAIR>
|
wneuper@59159
|
352 |
<PAIR>
|
wneuper@59159
|
353 |
<VARIABLE>
|
wneuper@59159
|
354 |
<MATHML>
|
wneuper@59159
|
355 |
<ISA>bdv_2</ISA>
|
wneuper@59159
|
356 |
</MATHML>
|
wneuper@59159
|
357 |
</VARIABLE>
|
wneuper@59159
|
358 |
<VALUE>
|
wneuper@59159
|
359 |
<MATHML>
|
wneuper@59159
|
360 |
<ISA>yyy</ISA>
|
wneuper@59159
|
361 |
</MATHML>
|
wneuper@59159
|
362 |
</VALUE>
|
wneuper@59159
|
363 |
</PAIR>
|
wneuper@59159
|
364 |
</SUBSTITUTION>:*)
|
wneuper@59159
|
365 |
val tac = Substitute sube;
|
wneuper@59159
|
366 |
val xml = xml_of_tac tac;
|
wneuper@59159
|
367 |
|
wneuper@59170
|
368 |
if xmlstr 0 (xml_of_tac tac) = "(STRINGLISTTACTIC name=Substitute)\n. (SUBSTITUTION)\n. . (PAIR)\n. . . (VARIABLE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . bdv_1\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VARIABLE)\n. . . (VALUE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . xxx\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VALUE)\n. . (/PAIR)\n. . (PAIR)\n. . . (VARIABLE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . bdv_2\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VARIABLE)\n. . . (VALUE)\n. . . . (MATHML)\n. . . . . (ISA)\n. . . . . . yyy\n. . . . . (/ISA)\n. . . . (/MATHML)\n. . . (/VALUE)\n. . (/PAIR)\n. (/SUBSTITUTION)\n(/STRINGLISTTACTIC)\n"
|
wneuper@59159
|
369 |
then () else error "xml_of_tac Substitute CHANGED";
|
wneuper@59253
|
370 |
case xml_to_tac xml of Substitute ["bdv_1 = xxx", "bdv_2 = yyy"] => ()
|
wneuper@59253
|
371 |
| _ => error "xml_to_tac Substitute CHANGED"; |