3 <!-- Copyright (C) 2000, HELM Team -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic -->
6 <!-- Library of Mathematics, developed at the Computer Science -->
7 <!-- Department, University of Bologna, Italy. -->
9 <!-- HELM is free software; you can redistribute it and/or -->
10 <!-- modify it under the terms of the GNU General Public License -->
11 <!-- as published by the Free Software Foundation; either version 2 -->
12 <!-- of the License, or (at your option) any later version. -->
14 <!-- HELM is distributed in the hope that it will be useful, -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
17 <!-- GNU General Public License for more details. -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
22 <!-- MA 02111-1307, USA. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 xmlns:m="http://www.w3.org/1998/Math/MathML">
30 <!--***********************************************************************-->
31 <!-- From MathML content to HTML -->
32 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena -->
33 <!--***********************************************************************-->
35 <xsl:param name="getterURL" select="'http://localhost:8081/'"/>
36 <xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
37 <xsl:param name="keys" select="'C1,HC2'"/>
38 <xsl:param name="naturalLanguage" select="'yes'"/>
39 <xsl:param name="annotations" select="'no'"/>
41 <xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:variable>
43 <xsl:variable name="header"><xsl:value-of select="$processorURL"/>apply?keys=<xsl:value-of select="$keys"/>&param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&param.annotations=<xsl:value-of select="$annotations"/>&param.keys=<xsl:value-of select="$keys"/>&param.getterURL=<xsl:value-of select="$getterURL"/>&param.processorURL=<xsl:value-of select="$processorURL"/>&xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
45 <xsl:include href="html_init.xsl"/>
46 <xsl:include href="html_set.xsl"/>
47 <xsl:include href="html_reals.xsl"/>
49 <xsl:variable name="showcast" select="0"/>
51 <xsl:template name="makeURL">
52 <xsl:param name="url" select="''"/>
53 <xsl:value-of select="concat(string($header),string($url),'&param.CICURI=',string($url))"/>
56 <!--***********************************************************************-->
57 <!-- HTML Head and Body -->
58 <!--***********************************************************************-->
60 <!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
62 <!-- document needs method="xml" and searches locally for the dtd if -->
63 <!-- doctype-system is specified (the dtd must exist locally for parsing). -->
64 <!-- For having output html must be media-type="html" and for having the -->
65 <!-- correct <br /> you must specify at least the remote dtd by means of -->
66 <!-- doctype-public -->
70 media-type="text/html"
71 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
73 <xsl:variable name="framewidth" select="36"/>
75 <xsl:template match="/">
76 <xsl:param name="current_indent" select="0"/>
80 A { text-decoration: none }
83 <body bgcolor="white">
85 <xsl:with-param name="current_indent" select="0"/>
86 </xsl:apply-templates>
91 <!--***********************************************************************-->
93 <!--***********************************************************************-->
95 <xsl:template name="make_indent">
96 <xsl:param name="current_indent" select="0"/>
97 <xsl:if test="$current_indent > 0">
98 <xsl:text> </xsl:text>
99 <xsl:call-template name="make_indent">
100 <xsl:with-param name="current_indent" select="$current_indent - 1"/>
105 <!-- Syntactic Sugar -->
106 <xsl:template match="m:type">
107 <xsl:param name="current_indent" select="0"/>
108 <xsl:apply-templates>
109 <xsl:with-param name="current_indent"
110 select="$current_indent"/>
111 </xsl:apply-templates>
114 <xsl:template match="m:condition">
115 <xsl:param name="current_indent" select="0"/>
116 <xsl:apply-templates>
117 <xsl:with-param name="current_indent"
118 select="$current_indent"/>
119 </xsl:apply-templates>
122 <xsl:template match="m:math">
123 <xsl:param name="current_indent" select="0"/>
124 <xsl:apply-templates>
125 <xsl:with-param name="current_indent"
126 select="$current_indent"/>
127 </xsl:apply-templates>
130 <!--*********************************************************************-->
132 <!--*********************************************************************-->
135 <xsl:template mode="inline" match="m:ci">
137 <xsl:when test="boolean(@definitionURL)">
139 <xsl:attribute name="href">
140 <xsl:call-template name="makeURL">
141 <xsl:with-param name="url" select="@definitionURL"/>
144 <xsl:apply-templates/>
148 <xsl:value-of select="."/>
155 <xsl:template match="m:apply[m:csymbol]" mode="inline">
156 <xsl:variable name="name">
157 <xsl:value-of select="m:csymbol"/>
161 <xsl:when test="$name='forall'">
162 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
163 <xsl:apply-templates select="m:bvar/m:ci"/>
164 <xsl:text>:</xsl:text>
165 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
166 <xsl:text>.</xsl:text>
167 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
169 <xsl:when test="$name='prod'">
170 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
171 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
172 <xsl:text>:</xsl:text>
173 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
174 <xsl:text>.</xsl:text>
175 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
178 <xsl:when test="$name='arrow'">
179 <xsl:text>(</xsl:text>
180 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
181 <FONT color="blue" FACE="symbol">
182 <xsl:text>®</xsl:text>
184 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
185 <xsl:text>)</xsl:text>
188 <xsl:when test="$name='app'">
189 <xsl:text>(</xsl:text>
190 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
191 <xsl:for-each select="*[position()>2]">
192 <xsl:text> </xsl:text>
193 <xsl:apply-templates mode="inline" select="."/>
195 <xsl:text>)</xsl:text>
198 <xsl:when test="$name='cast'">
199 <xsl:text>(</xsl:text>
200 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
201 <xsl:text>:></xsl:text>
202 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
203 <xsl:text>)</xsl:text>
205 <xsl:when test="$name='Prop'">
206 <FONT color="violet">Prop</FONT>
208 <xsl:when test="$name='Set'">
209 <FONT color="violet">Set</FONT>
211 <xsl:when test="$name='Type'">
212 <FONT color="violet">Type</FONT>
215 <xsl:when test="$name='mutcase'">
216 <xsl:text><</xsl:text>
217 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
218 <xsl:text>> </xsl:text>
219 <FONT color="red">CASE </FONT>
220 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
221 <FONT color="red"> OF </FONT>
222 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
224 <xsl:when test="not(position() = 1)">
225 <xsl:text> | </xsl:text>
228 <xsl:apply-templates mode="inline" select="."/>
229 <FONT FACE="Symbol" SIZE="+2" mathcolor="green">Þ</FONT>
230 <xsl:apply-templates mode="inline"
231 select="following-sibling::*[position()= 1]"/>
235 <xsl:when test="$name='fix'">
236 <FONT color="red">FIX</FONT>
237 <xsl:value-of select="m:ci"/>
238 <xsl:text>{</xsl:text>
239 <xsl:for-each select="m:bvar">
240 <xsl:value-of select="m:ci"/>
241 <xsl:text>:</xsl:text>
242 <xsl:apply-templates mode="inline" select="m:type"/>
243 <xsl:text>:=</xsl:text>
244 <xsl:apply-templates mode="inline"
245 select="following-sibling::*[position() = 1]"/>
247 <xsl:when test="position()=last()">
248 <xsl:text>}</xsl:text>
251 <xsl:text>;</xsl:text>
257 <xsl:when test="$name='cofix'">
258 <xsl:text>COFIX</xsl:text>
259 <xsl:value-of select="m:ci"/>
260 <xsl:text>{</xsl:text>
261 <xsl:for-each select="m:bvar">
262 <xsl:value-of select="m:ci"/>
263 <xsl:text>:</xsl:text>
264 <xsl:apply-templates mode="inline" select="m:type"/>
265 <xsl:text>:=</xsl:text>
266 <xsl:apply-templates mode="inline"
267 select="following-sibling::*[position() = 1]"/>
269 <xsl:when test="position()=last()">
270 <xsl:text>}</xsl:text>
273 <xsl:text>;</xsl:text>
279 <xsl:when test="$name='proof'">
280 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
281 <FONT color="red"> proves </FONT>
282 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
285 <xsl:when test="$name='and_ind'">
286 <FONT color="red">From </FONT>
287 <xsl:apply-templates select="*[2]"/>
288 <FONT color="red"> we get</FONT>
290 <xsl:apply-templates select="*[3]"/>
292 <xsl:apply-templates mode="inline" select="*[4]"/>
293 <FONT color="red"> and </FONT>
295 <xsl:apply-templates select="*[5]"/>
297 <xsl:apply-templates mode="inline" select="*[6]"/>
299 <FONT color="red"> hence </FONT>
300 <xsl:apply-templates mode="inline" select="*[7]"/>
305 <xsl:template mode="inline" match="m:lambda">
306 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
307 <xsl:apply-templates select="m:bvar/m:ci"/>
308 <xsl:text>:</xsl:text>
309 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
310 <xsl:text>.</xsl:text>
311 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
314 <!--*********************************************************************-->
315 <!-- COUNTING MODE -->
316 <!--*********************************************************************-->
318 <xsl:template match="m:apply[m:csymbol]">
319 <xsl:param name="current_indent" select="0"/>
320 <xsl:param name="width" select="$framewidth"/>
321 <xsl:variable name="name">
322 <xsl:value-of select="m:csymbol"/>
324 <xsl:variable name="charlength">
325 <xsl:apply-templates select="m:csymbol" mode="charcount"/>
327 <!-- <xsl:value-of select="$current_indent"/> -->
328 <!-- <xsl:value-of select="$charlength"/> -->
331 <xsl:when test="$name='forall'">
333 <xsl:when test="$charlength > $framewidth">
335 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
336 <xsl:apply-templates select="m:bvar/m:ci"/>
337 <xsl:text>:</xsl:text>
338 <xsl:apply-templates select="m:bvar/m:type">
339 <xsl:with-param name="current_indent"
340 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
341 </xsl:apply-templates>
343 <xsl:call-template name="make_indent">
344 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
346 <xsl:text>.</xsl:text>
347 <xsl:apply-templates select="*[position()=3]">
348 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
349 </xsl:apply-templates>
352 <xsl:apply-templates mode="inline" select="."/>
357 <xsl:when test="$name='prod'">
359 <xsl:when test="$charlength > $framewidth">
360 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
361 <xsl:apply-templates select="m:bvar/m:ci"/>
362 <xsl:text>:</xsl:text>
363 <xsl:apply-templates select="m:bvar/m:type">
364 <xsl:with-param name="current_indent"
365 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
366 </xsl:apply-templates><br/>
367 <xsl:call-template name="make_indent">
368 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
370 <xsl:text>.</xsl:text>
371 <xsl:apply-templates select="*[position()=3]">
372 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
373 </xsl:apply-templates>
376 <xsl:apply-templates mode="inline" select="."/>
381 <xsl:when test="$name='arrow'">
383 <xsl:when test="$charlength > $framewidth">
384 <xsl:text>(</xsl:text>
385 <xsl:apply-templates select="*[position()=2]">
386 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
387 </xsl:apply-templates>
389 <xsl:call-template name="make_indent">
390 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
393 <FONT color="blue" FACE="symbol">
394 <xsl:text>®</xsl:text>
396 <xsl:apply-templates select="*[position()=3]">
397 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
398 </xsl:apply-templates>
399 <xsl:text>)</xsl:text>
402 <xsl:apply-templates mode="inline" select="."/>
407 <xsl:when test="$name='app'">
409 <xsl:when test="$charlength > $framewidth">
410 <xsl:text>(</xsl:text>
411 <xsl:apply-templates select="*[position()=2]">
412 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
413 </xsl:apply-templates>
414 <xsl:for-each select="*[position()>2]">
416 <xsl:call-template name="make_indent">
417 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
419 <xsl:apply-templates select=".">
420 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
421 </xsl:apply-templates>
423 <xsl:text>)</xsl:text>
426 <xsl:apply-templates mode="inline" select="."/>
430 <xsl:when test="$name='cast'">
432 <xsl:when test="$showcast = 1">
434 <xsl:when test="$charlength > $framewidth">
435 <xsl:text>(</xsl:text>
436 <xsl:apply-templates select="*[position()=2]">
437 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
438 </xsl:apply-templates><br/>
439 <xsl:call-template name="make_indent">
440 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
441 <xsl:text>:></xsl:text>
442 <xsl:apply-templates select="*[position()=3]">
443 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
444 </xsl:apply-templates>
445 <xsl:text>)</xsl:text>
448 <xsl:apply-templates mode="inline" select="."/>
453 <xsl:apply-templates select="*[position()=2]">
454 <xsl:with-param name="current_indent" select="$current_indent"/>
455 </xsl:apply-templates>
459 <xsl:when test="$name='Prop'">
460 <xsl:text>Prop</xsl:text>
462 <xsl:when test="$name='Set'">
463 <xsl:text>Set</xsl:text>
465 <xsl:when test="$name='Type'">
466 <xsl:text>Type</xsl:text>
468 <xsl:when test="$name='mutcase'">
470 <xsl:when test="$charlength > $framewidth">
471 <xsl:text><</xsl:text>
472 <xsl:apply-templates select="*[position()=2]">
473 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
474 </xsl:apply-templates>
475 <xsl:text>> </xsl:text>
476 <xsl:text>CASE </xsl:text>
477 <xsl:apply-templates select="*[position()=3]">
478 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
479 </xsl:apply-templates>
480 <xsl:text> OF </xsl:text>
481 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
483 <xsl:call-template name="make_indent">
484 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
487 <xsl:when test="position() = 1">
488 <xsl:text>  </xsl:text>
491 <xsl:text>| </xsl:text>
494 <xsl:apply-templates select="."/>
495 <FONT FACE="Symbol" SIZE="+2" mathcolor="green">Þ</FONT>
496 <xsl:apply-templates select="following-sibling::*[position()= 1]">
497 <xsl:with-param name="current_indent" select="$current_indent + 4 + string-length()"/>
498 </xsl:apply-templates>
502 <xsl:apply-templates mode="inline" select="."/>
507 <xsl:when test="$name='fix'">
509 <xsl:when test="$charlength > $framewidth">
510 <xsl:text>FIX</xsl:text>
511 <xsl:value-of select="m:ci"/>
512 <xsl:text>{</xsl:text>
513 <xsl:for-each select="m:bvar">
515 <xsl:call-template name="make_indent">
516 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
518 <xsl:value-of select="m:ci"/>
519 <xsl:text>:</xsl:text>
520 <xsl:apply-templates select="m:type">
521 <xsl:with-param name="current_indent"
522 select="$current_indent + 5 + string-length(m:ci)"/>
523 </xsl:apply-templates>
525 <xsl:call-template name="make_indent">
526 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
528 <xsl:text>:=</xsl:text>
529 <xsl:apply-templates select="following-sibling::*[position() = 1]">
530 <xsl:with-param name="current_indent" select="$current_indent +2"/>
531 </xsl:apply-templates>
534 <xsl:call-template name="make_indent">
535 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
537 <xsl:text>}</xsl:text>
540 <xsl:apply-templates mode="inline" select="."/>
545 <xsl:when test="$name='cofix'">
547 <xsl:when test="($charlength + 10) > $framewidth">
548 <xsl:text>COFIX</xsl:text>
549 <xsl:value-of select="m:ci"/>
550 <xsl:text>{</xsl:text>
552 <xsl:call-template name="make_indent">
553 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
555 <xsl:for-each select="m:bvar">
556 <xsl:value-of select="m:ci"/>
557 <xsl:text>:</xsl:text>
558 <xsl:apply-templates select="m:type">
559 <xsl:with-param name="current_indent"
560 select="$current_indent + 5 + string-length(m:ci)"/>
561 </xsl:apply-templates>
563 <xsl:call-template name="make_indent">
564 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
566 <xsl:text>:=</xsl:text>
567 <xsl:apply-templates select="following-sibling::*[position() = 1]">
568 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
569 </xsl:apply-templates>
573 <xsl:call-template name="make_indent">
574 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
576 <xsl:text>}</xsl:text>
579 <xsl:apply-templates mode="inline" select="m:type"/>
583 <!-- ***************************************** -->
584 <!-- *********** PROOF ELEMENTS ************** -->
585 <!-- ***************************************** -->
587 <xsl:when test="$name='proof'">
588 <xsl:apply-templates select="*[position()=2]">
589 <xsl:with-param name="current_indent" select="$current_indent"/>
590 </xsl:apply-templates>
592 <!-- <xsl:element name="br"/> -->
593 <xsl:call-template name="make_indent">
594 <xsl:with-param name="current_indent" select="$current_indent"/>
596 <FONT color="red">we proved </FONT>
597 <xsl:apply-templates select="*[position()=3]">
598 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
599 </xsl:apply-templates>
602 <xsl:when test="$name='letin1'">
603 <xsl:apply-templates select="*[position()=2]">
604 <xsl:with-param name="current_indent" select="$current_indent"/>
605 </xsl:apply-templates>
607 <xsl:call-template name="make_indent">
608 <xsl:with-param name="current_indent" select="$current_indent"/>
610 <xsl:apply-templates select="*[position()=3]">
611 <xsl:with-param name="current_indent" select="$current_indent"/>
612 </xsl:apply-templates>
615 <xsl:when test="$name='letin'">
616 <xsl:for-each select="*[position()>1 and last()>position()]">
617 <xsl:apply-templates select=".">
618 <xsl:with-param name="current_indent" select="$current_indent"/>
619 </xsl:apply-templates>
621 <xsl:call-template name="make_indent">
622 <xsl:with-param name="current_indent" select="$current_indent"/>
625 <xsl:apply-templates select="*[position()=last()]">
626 <xsl:with-param name="current_indent" select="$current_indent"/>
627 </xsl:apply-templates>
630 <xsl:when test="$name='let'">
632 <xsl:apply-templates select="m:ci"/>
634 <xsl:apply-templates select="*[3]">
635 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
636 </xsl:apply-templates>
639 <xsl:when test="$name='rw_step'">
641 <xsl:when test="name(*[2])='m:apply'">
642 <xsl:apply-templates select="*[2]">
643 <xsl:with-param name="current_indent" select="$current_indent"/>
644 </xsl:apply-templates>
647 <FONT color="red">Consider </FONT>
648 <xsl:apply-templates select="*[2]"/>
652 <xsl:call-template name="make_indent">
653 <xsl:with-param name="current_indent" select="$current_indent"/>
655 <FONT color="red">Rewrite </FONT>
656 <xsl:apply-templates select="*[3]"/>
657 <FONT color="red"> with </FONT>
658 <xsl:apply-templates select="*[4]"/>
659 <FONT color="red"> by </FONT>
660 <xsl:apply-templates select="*[5]"/>
662 <!-- rewrite and apply -->
663 <xsl:when test="$name='rewrite_and_apply'">
664 <xsl:apply-templates select="*[2]">
665 <xsl:with-param name="current_indent" select="$current_indent"/>
666 </xsl:apply-templates>
668 <xsl:call-template name="make_indent">
669 <xsl:with-param name="current_indent" select="$current_indent"/>
671 <FONT color="red">Then apply it to </FONT>
672 <xsl:apply-templates select="*[position()>2]"/>
675 <xsl:when test="$name='and_ind'">
677 <xsl:when test="name(*[2])='m:apply'">
678 <xsl:apply-templates select="*[2]">
679 <xsl:with-param name="current_indent" select="$current_indent"/>
680 </xsl:apply-templates>
683 <FONT color="red">Consider </FONT>
684 <xsl:apply-templates select="*[2]"/>
688 <xsl:call-template name="make_indent">
689 <xsl:with-param name="current_indent" select="$current_indent"/>
691 <FONT color="red">In particular, we have</FONT>
693 <xsl:call-template name="make_indent">
694 <xsl:with-param name="current_indent" select="$current_indent"/>
697 <xsl:apply-templates select="*[3]"/>
699 <xsl:apply-templates select="*[4]">
700 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
701 </xsl:apply-templates>
703 <xsl:call-template name="make_indent">
704 <xsl:with-param name="current_indent" select="$current_indent"/>
707 <xsl:apply-templates select="*[5]"/>
709 <xsl:apply-templates select="*[6]">
710 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
711 </xsl:apply-templates>
713 <xsl:call-template name="make_indent">
714 <xsl:with-param name="current_indent" select="$current_indent"/>
716 <xsl:apply-templates select="*[7]">
717 <xsl:with-param name="current_indent" select="$current_indent"/>
718 </xsl:apply-templates>
721 <xsl:when test="$name='or_ind'">
723 <xsl:when test="name(*[2])='m:apply'">
724 <xsl:apply-templates select="*[2]">
725 <xsl:with-param name="current_indent" select="$current_indent"/>
726 </xsl:apply-templates>
729 <FONT color="red">Consider </FONT>
730 <xsl:apply-templates select="*[2]"/>
734 <xsl:call-template name="make_indent">
735 <xsl:with-param name="current_indent" select="$current_indent"/>
737 <FONT color="red">We prove </FONT>
738 <xsl:apply-templates select="*[3]"/>
739 <FONT color="red"> by cases:</FONT>
741 <xsl:call-template name="make_indent">
742 <xsl:with-param name="current_indent" select="$current_indent"/>
745 <xsl:apply-templates select="*[4]">
746 <xsl:with-param name="current_indent" select="$current_indent"/>
747 </xsl:apply-templates>
749 <xsl:call-template name="make_indent">
750 <xsl:with-param name="current_indent" select="$current_indent"/>
753 <xsl:apply-templates select="*[5]">
754 <xsl:with-param name="current_indent" select="$current_indent"/>
755 </xsl:apply-templates>
758 <xsl:when test="$name='ex_ind'">
760 <xsl:when test="name(*[2])='m:apply'">
761 <xsl:apply-templates select="*[2]">
762 <xsl:with-param name="current_indent" select="$current_indent"/>
763 </xsl:apply-templates>
766 <FONT color="red">Consider </FONT>
767 <xsl:apply-templates select="*[2]">
768 <xsl:with-param name="current_indent" select="$current_indent"/>
769 </xsl:apply-templates>
773 <xsl:call-template name="make_indent">
774 <xsl:with-param name="current_indent" select="$current_indent"/>
776 <FONT color="red">Let </FONT>
777 <xsl:apply-templates mode="inline" select="*[3]"/>
779 <xsl:apply-templates mode="inline" select="*[4]"/>
780 <FONT color="red"> such that</FONT>
782 <xsl:call-template name="make_indent">
783 <xsl:with-param name="current_indent" select="$current_indent"/>
786 <xsl:apply-templates mode="inline" select="*[5]"/>
788 <xsl:apply-templates select="*[6]">
789 <xsl:with-param name="current_indent" select="$current_indent +7"/>
790 </xsl:apply-templates>
792 <xsl:call-template name="make_indent">
793 <xsl:with-param name="current_indent" select="$current_indent"/>
795 <xsl:apply-templates select="*[7]">
796 <xsl:with-param name="current_indent" select="$current_indent"/>
797 </xsl:apply-templates>
804 <xsl:template match="m:lambda">
805 <xsl:param name="current_indent" select="0"/>
806 <xsl:variable name="charlength">
807 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
808 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
810 <!-- <xsl:value-of select="$charlength"/> -->
811 <!-- <xsl:value-of select="$current_indent"/> -->
813 <xsl:when test="$charlength > $framewidth">
815 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
816 <xsl:apply-templates select="m:bvar/m:ci"/>
817 <xsl:text>:</xsl:text>
818 <xsl:apply-templates select="m:bvar/m:type">
819 <xsl:with-param name="current_indent"
820 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
821 </xsl:apply-templates><br/>
822 <xsl:call-template name="make_indent">
823 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
825 <xsl:text>.</xsl:text>
826 <xsl:apply-templates select="*[position()=2]">
827 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
828 </xsl:apply-templates>
831 <xsl:apply-templates mode="inline" select="."/>
837 <xsl:template match="m:ci">
839 <xsl:when test="boolean(@definitionURL)">
841 <xsl:attribute name="href">
842 <xsl:call-template name="makeURL">
843 <xsl:with-param name="url" select="@definitionURL"/>
846 <xsl:apply-templates/>
850 <xsl:value-of select="."/>
857 <xsl:template match="m:ci|m:csymbol" mode="charcount">
858 <xsl:param name="incurrent_length" select="0"/>
860 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
861 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/></xsl:apply-templates></xsl:variable>
863 <xsl:when test="string($siblength) = """>
864 <xsl:value-of select="$incurrent_length + string-length()"/>
867 <xsl:value-of select="number($siblength)"/>
872 <xsl:value-of select="$incurrent_length + string-length()"/>
877 <xsl:template match="*" mode="charcount">
878 <xsl:param name="incurrent_length" select="0"/>
880 <xsl:when test="count(child::*) = 0">
881 <xsl:value-of select="$incurrent_length"/>
884 <xsl:variable name="childlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/></xsl:apply-templates></xsl:variable>
886 <xsl:when test="$framewidth >= number($childlength)">
887 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$childlength"/></xsl:apply-templates></xsl:variable>
889 <xsl:when test="string($siblength) = """>
890 <xsl:value-of select="number($childlength)"/>
893 <xsl:value-of select="number($siblength)"/>
898 <xsl:value-of select="number($childlength)"/>
906 <!--***********************************************************************-->
908 <!--***********************************************************************-->
912 <xsl:template match="Definition">
913 <xsl:param name="current_indent" select="0"/>
915 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
917 <xsl:call-template name="make_indent">
918 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
920 <xsl:apply-templates select="type/*[1]">
921 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
922 </xsl:apply-templates><br/>
924 <xsl:call-template name="make_indent">
925 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
927 <xsl:apply-templates select="body/*[1]">
928 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
929 </xsl:apply-templates>
935 <xsl:template match="Axiom">
936 <xsl:param name="current_indent" select="0"/>
938 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
940 <xsl:call-template name="make_indent">
941 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
943 <xsl:apply-templates select="type/*[1]">
944 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
945 </xsl:apply-templates>
949 <!-- UNFINISHED PROOF -->
951 <xsl:template match="CurrentProof">
952 <xsl:param name="current_indent" select="0"/>
954 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
955 THESIS: <xsl:apply-templates select="type/*[1]">
956 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
957 </xsl:apply-templates><br/>
959 <xsl:for-each select="Conjecture">
961 <xsl:call-template name="make_indent">
962 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
964 <xsl:value-of select="./@no"/> :
965 <xsl:apply-templates select="./*[1]">
966 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
967 </xsl:apply-templates>
971 <xsl:apply-templates select="body/*[1]">
972 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
973 </xsl:apply-templates>
977 <!-- MUTUAL INDUCTIVE DEFINITION -->
979 <xsl:template match="InductiveDefinition">
980 <xsl:param name="current_indent" select="0"/>
982 <xsl:for-each select="InductiveType">
984 <xsl:when test="position() = 1">
986 <xsl:when test="string(./@inductive) = "true"">
990 COINDUCTIVE DEFINITION
998 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
1000 <xsl:if test="string(../Param) != """>
1001 <xsl:for-each select="../Param">
1002 <xsl:value-of select="./@name"/>
1004 <xsl:apply-templates select="*"/>
1009 <xsl:apply-templates select="./arity/*[1]">
1010 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1011 </xsl:apply-templates> <br/>
1013 <xsl:for-each select="./Constructor">
1015 <xsl:call-template name="make_indent">
1016 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1017 </xsl:call-template>
1019 <xsl:when test="position() = 1">
1020 <xsl:text>  </xsl:text>
1023 <xsl:text>| </xsl:text>
1026 <xsl:value-of select="./@name"/>
1027 <xsl:text>: </xsl:text>
1028 <xsl:apply-templates select="./*[1]">
1029 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
1030 </xsl:apply-templates>
1038 <xsl:template match="Variable">
1039 <xsl:param name="current_indent" select="0"/>
1041 VARIABLE <xsl:value-of select="@name"/><br/>
1042 TYPE = <xsl:apply-templates select="type/*[1]">
1043 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1044 </xsl:apply-templates>
1048 <!--***********************************************************************-->
1050 <!--***********************************************************************-->
1054 <xsl:template match="SECTION">
1055 <xsl:param name="current_indent" select="0"/>
1056 <h1>BEGIN OF SECTION</h1>
1057 <xsl:apply-templates/>
1058 <h1>END OF SECTION</h1>