78 (autx j ss) |
78 (autx j ss) |
79 in indt j ^ "<"^str^">\n" ^ |
79 in indt j ^ "<"^str^">\n" ^ |
80 autx (j + i) auts ^ |
80 autx (j + i) auts ^ |
81 indt j ^ "</"^str^">\n" : xml |
81 indt j ^ "</"^str^">\n" : xml |
82 end; |
82 end; |
83 (* tracing(authors2xml 2 "MATHAUTHORS" []); |
83 (* writeln(authors2xml 2 "MATHAUTHORS" []); |
84 tracing(authors2xml 2 "MATHAUTHORS" |
84 writeln(authors2xml 2 "MATHAUTHORS" |
85 ["isac-team 2001", "Richard Lang 2003"]); |
85 ["isac-team 2001", "Richard Lang 2003"]); |
86 *) |
86 *) |
87 |
87 |
88 fun id2xml j ids = |
88 fun id2xml j ids = |
89 let fun id2x _ [] = "" |
89 let fun id2x _ [] = "" |
90 | id2x j (s::ss) = (indt j) ^ "<STRING> " ^ s ^ " </STRING>\n" ^ |
90 | id2x j (s::ss) = (indt j) ^ "<STRING> " ^ s ^ " </STRING>\n" ^ |
91 (id2x j ss) |
91 (id2x j ss) |
92 in (indt j) ^ "<STRINGLIST>\n" ^ |
92 in (indt j) ^ "<STRINGLIST>\n" ^ |
93 (id2x (j + indentation) ids) ^ |
93 (id2x (j + indentation) ids) ^ |
94 (indt j) ^ "</STRINGLIST>\n" end; |
94 (indt j) ^ "</STRINGLIST>\n" end; |
95 (* tracing(id2xml 8 ["linear","univariate","equation"]); |
95 (* writeln(id2xml 8 ["linear","univariate","equation"]); |
96 <STRINGLIST> |
96 <STRINGLIST> |
97 <STRING>linear</STRING> |
97 <STRING>linear</STRING> |
98 <STRING>univariate</STRING> |
98 <STRING>univariate</STRING> |
99 <STRING>equation</STRING> |
99 <STRING>equation</STRING> |
100 </STRINGLIST>*) |
100 </STRINGLIST>*) |
120 fun pos'2xml j (tag, (pos, pos_)) = |
120 fun pos'2xml j (tag, (pos, pos_)) = |
121 indt (j) ^ "<" ^ tag ^ ">\n" ^ |
121 indt (j) ^ "<" ^ tag ^ ">\n" ^ |
122 ints2xml (j+i) pos ^ |
122 ints2xml (j+i) pos ^ |
123 pos_2xml (j+i) pos_ ^ |
123 pos_2xml (j+i) pos_ ^ |
124 indt (j) ^ "</" ^ tag ^ ">\n"; |
124 indt (j) ^ "</" ^ tag ^ ">\n"; |
125 (* tracing(pos'2xml 3 ("POSITION", ([1,2,3], Pbl))); |
125 (* writeln(pos'2xml 3 ("POSITION", ([1,2,3], Pbl))); |
126 *) |
126 *) |
127 |
127 |
128 fun formula2xml j term = (*TODO.WN050211: use for _all_ <FORMULA>*) |
128 fun formula2xml j term = (*TODO.WN050211: use for _all_ <FORMULA>*) |
129 indt j ^ "<FORMULA>\n"^ |
129 indt j ^ "<FORMULA>\n"^ |
130 term2xml j term ^"\n"^ |
130 term2xml j term ^"\n"^ |
131 indt j ^ "</FORMULA>\n" : xml; |
131 indt j ^ "</FORMULA>\n" : xml; |
132 (* tracing(formula2xml 6 (str2term "1+1=2")); |
132 (* writeln(formula2xml 6 (str2term "1+1=2")); |
133 *) |
133 *) |
134 fun formulae2xml j [] = ("":xml) |
134 fun formulae2xml j [] = ("":xml) |
135 | formulae2xml j (r::rs) = formula2xml j r ^ formulae2xml j rs; |
135 | formulae2xml j (r::rs) = formula2xml j r ^ formulae2xml j rs; |
136 (* tracing(formulae2xml 6 [str2term "1+1=2", str2term "1+1+1=3"]); |
136 (* writeln(formulae2xml 6 [str2term "1+1=2", str2term "1+1+1=3"]); |
137 *) |
137 *) |
138 |
138 |
139 (*WN0502 @see ME/ctree: type asms: illdesigned, thus not used*) |
139 (*WN0502 @see ME/ctree: type asms: illdesigned, thus not used*) |
140 fun posform2xml j (p:pos', term) = |
140 fun posform2xml j (p:pos', term) = |
141 indt j ^ "<POSFORM>\n" ^ |
141 indt j ^ "<POSFORM>\n" ^ |
142 pos'2xml (j+i) ("POSITION", p) ^ |
142 pos'2xml (j+i) ("POSITION", p) ^ |
143 indt (j+i) ^ "<FORMULA>\n"^ |
143 indt (j+i) ^ "<FORMULA>\n"^ |
144 term2xml (j+i) term ^"\n"^ |
144 term2xml (j+i) term ^"\n"^ |
145 indt (j+i) ^ "</FORMULA>\n"^ |
145 indt (j+i) ^ "</FORMULA>\n"^ |
146 indt j ^ "</POSFORM>\n" : xml; |
146 indt j ^ "</POSFORM>\n" : xml; |
147 (* tracing(posform2xml 6 (([1,2],Frm), str2term "1+1=2")); |
147 (* writeln(posform2xml 6 (([1,2],Frm), str2term "1+1=2")); |
148 *) |
148 *) |
149 fun posforms2xml j [] = ("":xml) |
149 fun posforms2xml j [] = ("":xml) |
150 | posforms2xml j (r::rs) = posform2xml j r ^ posforms2xml j rs; |
150 | posforms2xml j (r::rs) = posform2xml j r ^ posforms2xml j rs; |
151 (* tracing(posforms2xml 6 [(([1],Res), str2term "1+1=2"),(([2],Res), str2term "1+1+1=3")]); |
151 (* writeln(posforms2xml 6 [(([1],Res), str2term "1+1=2"),(([2],Res), str2term "1+1+1=3")]); |
152 *) |
152 *) |
153 |
153 |
154 fun calcref2xml j (thyID:thyID, (scrop, (rewop, _)):calc) = |
154 fun calcref2xml j (thyID:thyID, (scrop, (rewop, _)):calc) = |
155 indt j ^ "<CALCREF>\n" ^ |
155 indt j ^ "<CALCREF>\n" ^ |
156 indt (j+i) ^ "<STRING> " ^ scrop ^ "</STRING>\n" ^ |
156 indt (j+i) ^ "<STRING> " ^ scrop ^ "</STRING>\n" ^ |
170 indt j ^ "</CALC>\n" : xml; |
170 indt j ^ "</CALC>\n" : xml; |
171 |
171 |
172 (*.for creating a href for a rule within an rls's rule list; |
172 (*.for creating a href for a rule within an rls's rule list; |
173 the guh points to the thy of definition of the rule, NOT of use in rls.*) |
173 the guh points to the thy of definition of the rule, NOT of use in rls.*) |
174 fun rule2xml j (thyID:thyID) Erule = |
174 fun rule2xml j (thyID:thyID) Erule = |
175 raise error "rule2xml called with 'Erule'" |
175 error "rule2xml called with 'Erule'" |
176 (* val (j, thyID, Thm (thmID, thm)) = (j+i, thyID, nth 1 rules); |
176 (* val (j, thyID, Thm (thmID, thm)) = (j+i, thyID, nth 1 rules); |
177 val (j, thyID, Thm (thmID, thm)) = (j, thyID,r); |
177 val (j, thyID, Thm (thmID, thm)) = (j, thyID,r); |
178 *) |
178 *) |
179 | rule2xml j thyID (Thm (thmID, thm)) = |
179 | rule2xml j thyID (Thm (thmID, thm)) = |
180 indt j ^ "<RULE>\n" ^ |
180 indt j ^ "<RULE>\n" ^ |
215 | filt ((s, (t1, t2)) :: ps) = |
215 | filt ((s, (t1, t2)) :: ps) = |
216 if str = s then (t1 $ t2) :: filt ps else filt ps |
216 if str = s then (t1 $ t2) :: filt ps else filt ps |
217 in filt end; |
217 in filt end; |
218 |
218 |
219 (*FIXME.WN040831 model2xml <--?--> pattern2xml*) |
219 (*FIXME.WN040831 model2xml <--?--> pattern2xml*) |
220 (*WN.25.8.03: pattern2xml different output with TextIO | tracing !!! |
220 (*WN.25.8.03: pattern2xml different output with TextIO | writeln !!! |
221 the version below is for TextIO: terms2xml makes \n !*) |
221 the version below is for TextIO: terms2xml makes \n !*) |
222 (* val (j, p, where_) = (i, ppc, where_); |
222 (* val (j, p, where_) = (i, ppc, where_); |
223 *) |
223 *) |
224 fun pattern2xml j p where_ = |
224 fun pattern2xml j p where_ = |
225 (case filterpbl "#Given" p of |
225 (case filterpbl "#Given" p of |
242 (case filterpbl "#Relate" p of |
242 (case filterpbl "#Relate" p of |
243 [] => (indt j) ^ "<RELATE> </RELATE>\n" |
243 [] => (indt j) ^ "<RELATE> </RELATE>\n" |
244 | res => (indt j) ^ "<RELATE>\n" ^ terms2xml' j res ^ |
244 | res => (indt j) ^ "<RELATE>\n" ^ terms2xml' j res ^ |
245 (indt j) ^ "</RELATE>\n"); |
245 (indt j) ^ "</RELATE>\n"); |
246 (* |
246 (* |
247 tracing(pattern2xml 3 ((#ppc o get_pbt) |
247 writeln(pattern2xml 3 ((#ppc o get_pbt) |
248 ["squareroot","univariate","equation","test"]) []); |
248 ["squareroot","univariate","equation","test"]) []); |
249 *) |
249 *) |
250 |
250 |
251 (*see itm_2item*) |
251 (*see itm_2item*) |
252 fun itm_2xml j (Cor (dts,_))= |
252 fun itm_2xml j (Cor (dts,_))= |
316 [] => (indt (j+i)) ^ "<RELATE> </RELATE>\n" |
316 [] => (indt (j+i)) ^ "<RELATE> </RELATE>\n" |
317 | res => (indt (j+i)) ^ "<RELATE>\n" ^ itms2xml (j+2*i) res ^ |
317 | res => (indt (j+i)) ^ "<RELATE>\n" ^ itms2xml (j+2*i) res ^ |
318 (indt (j+i)) ^ "</RELATE>\n")^ |
318 (indt (j+i)) ^ "</RELATE>\n")^ |
319 indt j ^"</MODEL>\n"):xml |
319 indt j ^"</MODEL>\n"):xml |
320 end; |
320 end; |
321 (* tracing(model2xml 3 itms []); |
321 (* writeln(model2xml 3 itms []); |
322 *) |
322 *) |
323 |
323 |
324 fun spec2xml j ((dI,pI,mI):spec) = |
324 fun spec2xml j ((dI,pI,mI):spec) = |
325 (indt j ^"<SPECIFICATION>\n"^ |
325 (indt j ^"<SPECIFICATION>\n"^ |
326 indt (j+i) ^"<THEORYID> "^ dI ^" </THEORYID>\n"^ |
326 indt (j+i) ^"<THEORYID> "^ dI ^" </THEORYID>\n"^ |
342 indt (j+i) ^"<BELONGSTO> "^(case p_ of Pbl => "Pbl" |
342 indt (j+i) ^"<BELONGSTO> "^(case p_ of Pbl => "Pbl" |
343 | Met => "Met" |
343 | Met => "Met" |
344 | _ => "Und")^" </BELONGSTO>\n"^ |
344 | _ => "Und")^" </BELONGSTO>\n"^ |
345 spec2xml (j+i) spec ^ |
345 spec2xml (j+i) spec ^ |
346 indt j ^"</CALCHEAD>\n"):xml; |
346 indt j ^"</CALCHEAD>\n"):xml; |
347 (* tracing (modspec2xml 2 e_ocalhd); |
347 (* writeln (modspec2xml 2 e_ocalhd); |
348 *) |
348 *) |
349 fun pos'calchead2xml j (p:pos', (b, p_, head, gfr, pre, spec): ocalhd) = |
349 fun pos'calchead2xml j (p:pos', (b, p_, head, gfr, pre, spec): ocalhd) = |
350 (indt j ^"<CALCHEAD status = "^ |
350 (indt j ^"<CALCHEAD status = "^ |
351 quote (if b then "correct" else "incorrect")^">\n"^ |
351 quote (if b then "correct" else "incorrect")^">\n"^ |
352 pos'2xml (j+i) ("POSITION", p) ^ |
352 pos'2xml (j+i) ("POSITION", p) ^ |
374 foldl op^ ("", map (sub2xml (j+i)) |
374 foldl op^ ("", map (sub2xml (j+i)) |
375 (subs2subst (assoc_thy "Isac.thy") subs)) ^ |
375 (subs2subst (assoc_thy "Isac.thy") subs)) ^ |
376 indt j ^"</SUBSTITUTION>\n"):xml; |
376 indt j ^"</SUBSTITUTION>\n"):xml; |
377 (* val subs = [(str2term "bdv", str2term "x")]; |
377 (* val subs = [(str2term "bdv", str2term "x")]; |
378 val subs = ["(bdv, x)"]; |
378 val subs = ["(bdv, x)"]; |
379 tracing(subs2xml 0 subs); |
379 writeln(subs2xml 0 subs); |
380 *) |
380 *) |
381 fun subst2xml j (subst:subst) = |
381 fun subst2xml j (subst:subst) = |
382 (indt j ^"<SUBSTITUTION>\n"^ |
382 (indt j ^"<SUBSTITUTION>\n"^ |
383 foldl op^ ("", map (sub2xml (j+i)) subst) ^ |
383 foldl op^ ("", map (sub2xml (j+i)) subst) ^ |
384 indt j ^"</SUBSTITUTION>\n"):xml; |
384 indt j ^"</SUBSTITUTION>\n"):xml; |
385 (* val subst = [(str2term "bdv", str2term "x")]; |
385 (* val subst = [(str2term "bdv", str2term "x")]; |
386 tracing(subst2xml 0 subst); |
386 writeln(subst2xml 0 subst); |
387 *) |
387 *) |
388 |
388 |
389 (* val (j, str) = ((j+i), form); |
389 (* val (j, str) = ((j+i), form); |
390 *) |
390 *) |
391 fun thmstr2xml j str = ((((term2xml j) o str2term) str)^"\n"):xml; |
391 fun thmstr2xml j str = ((((term2xml j) o str2term) str)^"\n"):xml; |
566 *) |
566 *) |
567 | tac2xml j (Rewrite thm') = |
567 | tac2xml j (Rewrite thm') = |
568 (indt j ^"<REWRITETACTIC name=\"Rewrite\">\n"^ |
568 (indt j ^"<REWRITETACTIC name=\"Rewrite\">\n"^ |
569 thm'2xml (j+i) thm'^ |
569 thm'2xml (j+i) thm'^ |
570 indt j ^"</REWRITETACTIC>\n"):xml |
570 indt j ^"</REWRITETACTIC>\n"):xml |
571 (* tracing (tac2xml 2 (Rewrite ("all_left", |
571 (* writeln (tac2xml 2 (Rewrite ("all_left", |
572 "~ ?b =!= 0 ==> (?a = ?b) = (?a - ?b = 0)"))); |
572 "~ ?b =!= 0 ==> (?a = ?b) = (?a - ?b = 0)"))); |
573 val (j, (Rewrite_Inst (subs, thm'))) = (i, tac); |
573 val (j, (Rewrite_Inst (subs, thm'))) = (i, tac); |
574 *) |
574 *) |
575 | tac2xml j (Rewrite_Inst (subs, thm')) = |
575 | tac2xml j (Rewrite_Inst (subs, thm')) = |
576 (indt j ^"<REWRITEINSTTACTIC name=\"Rewrite_Inst\">\n"^ |
576 (indt j ^"<REWRITEINSTTACTIC name=\"Rewrite_Inst\">\n"^ |
577 subs2xml (j+i) subs^ |
577 subs2xml (j+i) subs^ |
578 thm'2xml (j+i) thm'^ |
578 thm'2xml (j+i) thm'^ |
579 indt j ^"</REWRITEINSTTACTIC>\n"):xml |
579 indt j ^"</REWRITEINSTTACTIC>\n"):xml |
580 (* tracing (tac2xml 2 (Rewrite_Inst |
580 (* writeln (tac2xml 2 (Rewrite_Inst |
581 (["(bdv,x)"], |
581 (["(bdv,x)"], |
582 ("all_left", |
582 ("all_left", |
583 "~ ?b =!= 0 ==> (?a = ?b) = (?a - ?b = 0)")))); |
583 "~ ?b =!= 0 ==> (?a = ?b) = (?a - ?b = 0)")))); |
584 *) |
584 *) |
585 | tac2xml j (Rewrite_Set rls') = |
585 | tac2xml j (Rewrite_Set rls') = |
696 indt j ^ "</EXTREF>\n" : xml; |
696 indt j ^ "</EXTREF>\n" : xml; |
697 |
697 |
698 (* val (ContThmInst{thyID, thm, bdvs, thminst, applto, applat, reword, |
698 (* val (ContThmInst{thyID, thm, bdvs, thminst, applto, applat, reword, |
699 asms, lhs, rhs, result, resasms, asmrls}) = |
699 asms, lhs, rhs, result, resasms, asmrls}) = |
700 (context_thy (pt,pos) tac); |
700 (context_thy (pt,pos) tac); |
701 tracing (contthy2xml 2 (context_thy (pt,pos) tac)); |
701 writeln (contthy2xml 2 (context_thy (pt,pos) tac)); |
702 *) |
702 *) |
703 fun contthy2xml j EContThy = |
703 fun contthy2xml j EContThy = |
704 raise error "contthy2xml called with EContThy" |
704 error "contthy2xml called with EContThy" |
705 | contthy2xml j (ContThm {thyID, thm, applto, applat, reword, |
705 | contthy2xml j (ContThm {thyID, thm, applto, applat, reword, |
706 asms,lhs, rhs, result, resasms, asmrls}) = |
706 asms,lhs, rhs, result, resasms, asmrls}) = |
707 indt j ^ "<GUH> " ^ thm ^ " </GUH>\n" ^ |
707 indt j ^ "<GUH> " ^ thm ^ " </GUH>\n" ^ |
708 |
708 |
709 indt j ^ "<APPLTO>\n" ^ |
709 indt j ^ "<APPLTO>\n" ^ |