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'"/>
40 <xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getciconly?uri=</xsl:variable>
42 <xsl:variable name="header"><xsl:value-of select="$processorURL"/>apply?keys=<xsl:value-of select="$keys"/>&param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&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>
44 <xsl:include href="html_init.xsl"/>
45 <xsl:include href="html_set.xsl"/>
46 <xsl:include href="html_reals.xsl"/>
48 <xsl:variable name="showcast" select="0"/>
50 <xsl:template name="makeURL">
51 <xsl:param name="url" select="''"/>
52 <xsl:value-of select="concat(string($header),string($url),'&param.CICURI=',string($url))"/>
55 <!--***********************************************************************-->
56 <!-- HTML Head and Body -->
57 <!--***********************************************************************-->
59 <!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
61 <!-- document needs method="xml" and searches locally for the dtd if -->
62 <!-- doctype-system is specified (the dtd must exist locally for parsing). -->
63 <!-- For having output html must be media-type="html" and for having the -->
64 <!-- correct <br /> you must specify at least the remote dtd by means of -->
65 <!-- doctype-public -->
69 media-type="text/html"
70 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
72 <xsl:variable name="framewidth" select="36"/>
74 <xsl:template match="/">
75 <xsl:param name="current_indent" select="0"/>
79 A { text-decoration: none }
82 <body bgcolor="white">
84 <xsl:with-param name="current_indent" select="0"/>
85 </xsl:apply-templates>
90 <!--***********************************************************************-->
92 <!--***********************************************************************-->
94 <xsl:template name="make_indent">
95 <xsl:param name="current_indent" select="0"/>
96 <xsl:if test="$current_indent > 0">
97 <xsl:text> </xsl:text>
98 <xsl:call-template name="make_indent">
99 <xsl:with-param name="current_indent" select="$current_indent - 1"/>
104 <!-- Syntactic Sugar -->
105 <xsl:template match="m:type">
106 <xsl:param name="current_indent" select="0"/>
107 <xsl:apply-templates>
108 <xsl:with-param name="current_indent"
109 select="$current_indent"/>
110 </xsl:apply-templates>
113 <xsl:template match="m:condition">
114 <xsl:param name="current_indent" select="0"/>
115 <xsl:apply-templates>
116 <xsl:with-param name="current_indent"
117 select="$current_indent"/>
118 </xsl:apply-templates>
121 <xsl:template match="m:math">
122 <xsl:param name="current_indent" select="0"/>
123 <xsl:apply-templates>
124 <xsl:with-param name="current_indent"
125 select="$current_indent"/>
126 </xsl:apply-templates>
129 <!--*********************************************************************-->
131 <!--*********************************************************************-->
134 <xsl:template mode="inline" match="m:ci">
136 <xsl:when test="boolean(@definitionURL)">
138 <xsl:attribute name="href">
139 <xsl:call-template name="makeURL">
140 <xsl:with-param name="url" select="@definitionURL"/>
143 <xsl:apply-templates/>
147 <xsl:value-of select="."/>
154 <xsl:template match="m:apply[m:csymbol]" mode="inline">
155 <xsl:variable name="name">
156 <xsl:value-of select="m:csymbol"/>
160 <xsl:when test="$name='forall'">
161 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
162 <xsl:apply-templates select="m:bvar/m:ci"/>
163 <xsl:text>:</xsl:text>
164 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
165 <xsl:text>.</xsl:text>
166 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
168 <xsl:when test="$name='prod'">
169 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
170 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
171 <xsl:text>:</xsl:text>
172 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
173 <xsl:text>.</xsl:text>
174 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
177 <xsl:when test="$name='arrow'">
178 <xsl:text>(</xsl:text>
179 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
180 <FONT color="blue" FACE="symbol">
181 <xsl:text>®</xsl:text>
183 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
184 <xsl:text>)</xsl:text>
187 <xsl:when test="$name='app'">
188 <xsl:text>(</xsl:text>
189 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
190 <xsl:for-each select="*[position()>2]">
191 <xsl:text> </xsl:text>
192 <xsl:apply-templates mode="inline" select="."/>
194 <xsl:text>)</xsl:text>
197 <xsl:when test="$name='cast'">
198 <xsl:text>(</xsl:text>
199 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
200 <xsl:text>:></xsl:text>
201 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
202 <xsl:text>)</xsl:text>
204 <xsl:when test="$name='Prop'">
205 <FONT color="violet">Prop</FONT>
207 <xsl:when test="$name='Set'">
208 <FONT color="violet">Set</FONT>
210 <xsl:when test="$name='Type'">
211 <FONT color="violet">Type</FONT>
214 <xsl:when test="$name='mutcase'">
215 <xsl:text><</xsl:text>
216 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
217 <xsl:text>> </xsl:text>
218 <FONT color="red">CASE </FONT>
219 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
220 <FONT color="red"> OF </FONT>
221 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
223 <xsl:when test="not(position() = 1)">
224 <xsl:text> | </xsl:text>
227 <xsl:apply-templates mode="inline" select="."/>
228 <FONT FACE="Symbol" SIZE="+2" mathcolor="green">Þ</FONT>
229 <xsl:apply-templates mode="inline"
230 select="following-sibling::*[position()= 1]"/>
234 <xsl:when test="$name='fix'">
235 <FONT color="red">FIX</FONT>
236 <xsl:value-of select="m:ci"/>
237 <xsl:text>{</xsl:text>
238 <xsl:for-each select="m:bvar">
239 <xsl:value-of select="m:ci"/>
240 <xsl:text>:</xsl:text>
241 <xsl:apply-templates mode="inline" select="m:type"/>
242 <xsl:text>:=</xsl:text>
243 <xsl:apply-templates mode="inline"
244 select="following-sibling::*[position() = 1]"/>
246 <xsl:when test="position()=last()">
247 <xsl:text>}</xsl:text>
250 <xsl:text>;</xsl:text>
256 <xsl:when test="$name='cofix'">
257 <xsl:text>COFIX</xsl:text>
258 <xsl:value-of select="m:ci"/>
259 <xsl:text>{</xsl:text>
260 <xsl:for-each select="m:bvar">
261 <xsl:value-of select="m:ci"/>
262 <xsl:text>:</xsl:text>
263 <xsl:apply-templates mode="inline" select="m:type"/>
264 <xsl:text>:=</xsl:text>
265 <xsl:apply-templates mode="inline"
266 select="following-sibling::*[position() = 1]"/>
268 <xsl:when test="position()=last()">
269 <xsl:text>}</xsl:text>
272 <xsl:text>;</xsl:text>
278 <xsl:when test="$name='proof'">
279 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
280 <FONT color="red"> proves </FONT>
281 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
284 <xsl:when test="$name='and_ind'">
285 <FONT color="red">From </FONT>
286 <xsl:apply-templates select="*[2]"/>
287 <FONT color="red"> we get</FONT>
289 <xsl:apply-templates select="*[3]"/>
291 <xsl:apply-templates mode="inline" select="*[4]"/>
292 <FONT color="red"> and </FONT>
294 <xsl:apply-templates select="*[5]"/>
296 <xsl:apply-templates mode="inline" select="*[6]"/>
298 <FONT color="red"> hence </FONT>
299 <xsl:apply-templates mode="inline" select="*[7]"/>
304 <xsl:template mode="inline" match="m:lambda">
305 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
306 <xsl:apply-templates select="m:bvar/m:ci"/>
307 <xsl:text>:</xsl:text>
308 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
309 <xsl:text>.</xsl:text>
310 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
313 <!--*********************************************************************-->
314 <!-- COUNTING MODE -->
315 <!--*********************************************************************-->
317 <xsl:template match="m:apply[m:csymbol]">
318 <xsl:param name="current_indent" select="0"/>
319 <xsl:param name="width" select="$framewidth"/>
320 <xsl:variable name="name">
321 <xsl:value-of select="m:csymbol"/>
323 <xsl:variable name="charlength">
324 <xsl:apply-templates select="m:csymbol" mode="charcount"/>
326 <!-- <xsl:value-of select="$current_indent"/> -->
327 <!-- <xsl:value-of select="$charlength"/> -->
330 <xsl:when test="$name='forall'">
332 <xsl:when test="$charlength > $framewidth">
334 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
335 <xsl:apply-templates select="m:bvar/m:ci"/>
336 <xsl:text>:</xsl:text>
337 <xsl:apply-templates select="m:bvar/m:type">
338 <xsl:with-param name="current_indent"
339 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
340 </xsl:apply-templates>
342 <xsl:call-template name="make_indent">
343 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
345 <xsl:text>.</xsl:text>
346 <xsl:apply-templates select="*[position()=3]">
347 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
348 </xsl:apply-templates>
351 <xsl:apply-templates mode="inline" select="."/>
356 <xsl:when test="$name='prod'">
358 <xsl:when test="$charlength > $framewidth">
359 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
360 <xsl:apply-templates select="m:bvar/m:ci"/>
361 <xsl:text>:</xsl:text>
362 <xsl:apply-templates select="m:bvar/m:type">
363 <xsl:with-param name="current_indent"
364 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
365 </xsl:apply-templates><br/>
366 <xsl:call-template name="make_indent">
367 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
369 <xsl:text>.</xsl:text>
370 <xsl:apply-templates select="*[position()=3]">
371 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
372 </xsl:apply-templates>
375 <xsl:apply-templates mode="inline" select="."/>
380 <xsl:when test="$name='arrow'">
382 <xsl:when test="$charlength > $framewidth">
383 <xsl:text>(</xsl:text>
384 <xsl:apply-templates select="*[position()=2]">
385 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
386 </xsl:apply-templates>
388 <xsl:call-template name="make_indent">
389 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
392 <FONT color="blue" FACE="symbol">
393 <xsl:text>®</xsl:text>
395 <xsl:apply-templates select="*[position()=3]">
396 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
397 </xsl:apply-templates>
398 <xsl:text>)</xsl:text>
401 <xsl:apply-templates mode="inline" select="."/>
406 <xsl:when test="$name='app'">
408 <xsl:when test="$charlength > $framewidth">
409 <xsl:text>(</xsl:text>
410 <xsl:apply-templates select="*[position()=2]">
411 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
412 </xsl:apply-templates>
413 <xsl:for-each select="*[position()>2]">
415 <xsl:call-template name="make_indent">
416 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
418 <xsl:apply-templates select=".">
419 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
420 </xsl:apply-templates>
422 <xsl:text>)</xsl:text>
425 <xsl:apply-templates mode="inline" select="."/>
429 <xsl:when test="$name='cast'">
431 <xsl:when test="$showcast = 1">
433 <xsl:when test="$charlength > $framewidth">
434 <xsl:text>(</xsl:text>
435 <xsl:apply-templates select="*[position()=2]">
436 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
437 </xsl:apply-templates><br/>
438 <xsl:call-template name="make_indent">
439 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
440 <xsl:text>:></xsl:text>
441 <xsl:apply-templates select="*[position()=3]">
442 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
443 </xsl:apply-templates>
444 <xsl:text>)</xsl:text>
447 <xsl:apply-templates mode="inline" select="."/>
452 <xsl:apply-templates select="*[position()=2]">
453 <xsl:with-param name="current_indent" select="$current_indent"/>
454 </xsl:apply-templates>
458 <xsl:when test="$name='Prop'">
459 <xsl:text>Prop</xsl:text>
461 <xsl:when test="$name='Set'">
462 <xsl:text>Set</xsl:text>
464 <xsl:when test="$name='Type'">
465 <xsl:text>Type</xsl:text>
467 <xsl:when test="$name='mutcase'">
469 <xsl:when test="$charlength > $framewidth">
470 <xsl:text><</xsl:text>
471 <xsl:apply-templates select="*[position()=2]">
472 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
473 </xsl:apply-templates>
474 <xsl:text>> </xsl:text>
475 <xsl:text>CASE </xsl:text>
476 <xsl:apply-templates select="*[position()=3]">
477 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
478 </xsl:apply-templates>
479 <xsl:text> OF </xsl:text>
480 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
482 <xsl:call-template name="make_indent">
483 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
486 <xsl:when test="position() = 1">
487 <xsl:text>  </xsl:text>
490 <xsl:text>| </xsl:text>
493 <xsl:apply-templates select="."/>
494 <FONT FACE="Symbol" SIZE="+2" mathcolor="green">Þ</FONT>
495 <xsl:apply-templates select="following-sibling::*[position()= 1]">
496 <xsl:with-param name="current_indent" select="$current_indent + 4 + string-length()"/>
497 </xsl:apply-templates>
501 <xsl:apply-templates mode="inline" select="."/>
506 <xsl:when test="$name='fix'">
508 <xsl:when test="$charlength > $framewidth">
509 <xsl:text>FIX</xsl:text>
510 <xsl:value-of select="m:ci"/>
511 <xsl:text>{</xsl:text>
512 <xsl:for-each select="m:bvar">
514 <xsl:call-template name="make_indent">
515 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
517 <xsl:value-of select="m:ci"/>
518 <xsl:text>:</xsl:text>
519 <xsl:apply-templates select="m:type">
520 <xsl:with-param name="current_indent"
521 select="$current_indent + 5 + string-length(m:ci)"/>
522 </xsl:apply-templates>
524 <xsl:call-template name="make_indent">
525 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
527 <xsl:text>:=</xsl:text>
528 <xsl:apply-templates select="following-sibling::*[position() = 1]">
529 <xsl:with-param name="current_indent" select="$current_indent +2"/>
530 </xsl:apply-templates>
533 <xsl:call-template name="make_indent">
534 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
536 <xsl:text>}</xsl:text>
539 <xsl:apply-templates mode="inline" select="."/>
544 <xsl:when test="$name='cofix'">
546 <xsl:when test="($charlength + 10) > $framewidth">
547 <xsl:text>COFIX</xsl:text>
548 <xsl:value-of select="m:ci"/>
549 <xsl:text>{</xsl:text>
551 <xsl:call-template name="make_indent">
552 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
554 <xsl:for-each select="m:bvar">
555 <xsl:value-of select="m:ci"/>
556 <xsl:text>:</xsl:text>
557 <xsl:apply-templates select="m:type">
558 <xsl:with-param name="current_indent"
559 select="$current_indent + 5 + string-length(m:ci)"/>
560 </xsl:apply-templates>
562 <xsl:call-template name="make_indent">
563 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
565 <xsl:text>:=</xsl:text>
566 <xsl:apply-templates select="following-sibling::*[position() = 1]">
567 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
568 </xsl:apply-templates>
572 <xsl:call-template name="make_indent">
573 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
575 <xsl:text>}</xsl:text>
578 <xsl:apply-templates mode="inline" select="m:type"/>
582 <!-- ***************************************** -->
583 <!-- *********** PROOF ELEMENTS ************** -->
584 <!-- ***************************************** -->
586 <xsl:when test="$name='proof'">
587 <xsl:apply-templates select="*[position()=2]">
588 <xsl:with-param name="current_indent" select="$current_indent"/>
589 </xsl:apply-templates>
591 <!-- <xsl:element name="br"/> -->
592 <xsl:call-template name="make_indent">
593 <xsl:with-param name="current_indent" select="$current_indent"/>
595 <FONT color="red">we proved </FONT>
596 <xsl:apply-templates select="*[position()=3]">
597 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
598 </xsl:apply-templates>
601 <xsl:when test="$name='letin1'">
602 <xsl:apply-templates select="*[position()=2]">
603 <xsl:with-param name="current_indent" select="$current_indent"/>
604 </xsl:apply-templates>
606 <xsl:call-template name="make_indent">
607 <xsl:with-param name="current_indent" select="$current_indent"/>
609 <xsl:apply-templates select="*[position()=3]">
610 <xsl:with-param name="current_indent" select="$current_indent"/>
611 </xsl:apply-templates>
614 <xsl:when test="$name='letin'">
615 <xsl:for-each select="*[position()>1 and last()>position()]">
616 <xsl:apply-templates select=".">
617 <xsl:with-param name="current_indent" select="$current_indent"/>
618 </xsl:apply-templates>
620 <xsl:call-template name="make_indent">
621 <xsl:with-param name="current_indent" select="$current_indent"/>
624 <xsl:apply-templates select="*[position()=last()]">
625 <xsl:with-param name="current_indent" select="$current_indent"/>
626 </xsl:apply-templates>
629 <xsl:when test="$name='let'">
631 <xsl:apply-templates select="m:ci"/>
633 <xsl:apply-templates select="*[3]">
634 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
635 </xsl:apply-templates>
638 <xsl:when test="$name='rw_step'">
640 <xsl:when test="name(*[2])='m:apply'">
641 <xsl:apply-templates select="*[2]">
642 <xsl:with-param name="current_indent" select="$current_indent"/>
643 </xsl:apply-templates>
646 <FONT color="red">Consider </FONT>
647 <xsl:apply-templates select="*[2]"/>
651 <xsl:call-template name="make_indent">
652 <xsl:with-param name="current_indent" select="$current_indent"/>
654 <FONT color="red">Rewrite </FONT>
655 <xsl:apply-templates select="*[3]"/>
656 <FONT color="red"> with </FONT>
657 <xsl:apply-templates select="*[4]"/>
658 <FONT color="red"> by </FONT>
659 <xsl:apply-templates select="*[5]"/>
661 <!-- rewrite and apply -->
662 <xsl:when test="$name='rewrite_and_apply'">
663 <xsl:apply-templates select="*[2]">
664 <xsl:with-param name="current_indent" select="$current_indent"/>
665 </xsl:apply-templates>
667 <xsl:call-template name="make_indent">
668 <xsl:with-param name="current_indent" select="$current_indent"/>
670 <FONT color="red">Then apply it to </FONT>
671 <xsl:apply-templates select="*[position()>2]"/>
674 <xsl:when test="$name='and_ind'">
676 <xsl:when test="name(*[2])='m:apply'">
677 <xsl:apply-templates select="*[2]">
678 <xsl:with-param name="current_indent" select="$current_indent"/>
679 </xsl:apply-templates>
682 <FONT color="red">Consider </FONT>
683 <xsl:apply-templates select="*[2]"/>
687 <xsl:call-template name="make_indent">
688 <xsl:with-param name="current_indent" select="$current_indent"/>
690 <FONT color="red">In particular, we have</FONT>
692 <xsl:call-template name="make_indent">
693 <xsl:with-param name="current_indent" select="$current_indent"/>
696 <xsl:apply-templates select="*[3]"/>
698 <xsl:apply-templates select="*[4]">
699 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
700 </xsl:apply-templates>
702 <xsl:call-template name="make_indent">
703 <xsl:with-param name="current_indent" select="$current_indent"/>
706 <xsl:apply-templates select="*[5]"/>
708 <xsl:apply-templates select="*[6]">
709 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
710 </xsl:apply-templates>
712 <xsl:call-template name="make_indent">
713 <xsl:with-param name="current_indent" select="$current_indent"/>
715 <xsl:apply-templates select="*[7]">
716 <xsl:with-param name="current_indent" select="$current_indent"/>
717 </xsl:apply-templates>
720 <xsl:when test="$name='or_ind'">
722 <xsl:when test="name(*[2])='m:apply'">
723 <xsl:apply-templates select="*[2]">
724 <xsl:with-param name="current_indent" select="$current_indent"/>
725 </xsl:apply-templates>
728 <FONT color="red">Consider </FONT>
729 <xsl:apply-templates select="*[2]"/>
733 <xsl:call-template name="make_indent">
734 <xsl:with-param name="current_indent" select="$current_indent"/>
736 <FONT color="red">We prove </FONT>
737 <xsl:apply-templates select="*[3]"/>
738 <FONT color="red"> by cases:</FONT>
740 <xsl:call-template name="make_indent">
741 <xsl:with-param name="current_indent" select="$current_indent"/>
744 <xsl:apply-templates select="*[4]">
745 <xsl:with-param name="current_indent" select="$current_indent"/>
746 </xsl:apply-templates>
748 <xsl:call-template name="make_indent">
749 <xsl:with-param name="current_indent" select="$current_indent"/>
752 <xsl:apply-templates select="*[5]">
753 <xsl:with-param name="current_indent" select="$current_indent"/>
754 </xsl:apply-templates>
757 <xsl:when test="$name='ex_ind'">
759 <xsl:when test="name(*[2])='m:apply'">
760 <xsl:apply-templates select="*[2]">
761 <xsl:with-param name="current_indent" select="$current_indent"/>
762 </xsl:apply-templates>
765 <FONT color="red">Consider </FONT>
766 <xsl:apply-templates select="*[2]">
767 <xsl:with-param name="current_indent" select="$current_indent"/>
768 </xsl:apply-templates>
772 <xsl:call-template name="make_indent">
773 <xsl:with-param name="current_indent" select="$current_indent"/>
775 <FONT color="red">Let </FONT>
776 <xsl:apply-templates mode="inline" select="*[3]"/>
778 <xsl:apply-templates mode="inline" select="*[4]"/>
779 <FONT color="red"> such that</FONT>
781 <xsl:call-template name="make_indent">
782 <xsl:with-param name="current_indent" select="$current_indent"/>
785 <xsl:apply-templates mode="inline" select="*[5]"/>
787 <xsl:apply-templates select="*[6]">
788 <xsl:with-param name="current_indent" select="$current_indent +7"/>
789 </xsl:apply-templates>
791 <xsl:call-template name="make_indent">
792 <xsl:with-param name="current_indent" select="$current_indent"/>
794 <xsl:apply-templates select="*[7]">
795 <xsl:with-param name="current_indent" select="$current_indent"/>
796 </xsl:apply-templates>
803 <xsl:template match="m:lambda">
804 <xsl:param name="current_indent" select="0"/>
805 <xsl:variable name="charlength">
806 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
807 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
809 <!-- <xsl:value-of select="$charlength"/> -->
810 <!-- <xsl:value-of select="$current_indent"/> -->
812 <xsl:when test="$charlength > $framewidth">
814 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
815 <xsl:apply-templates select="m:bvar/m:ci"/>
816 <xsl:text>:</xsl:text>
817 <xsl:apply-templates select="m:bvar/m:type">
818 <xsl:with-param name="current_indent"
819 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
820 </xsl:apply-templates><br/>
821 <xsl:call-template name="make_indent">
822 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
824 <xsl:text>.</xsl:text>
825 <xsl:apply-templates select="*[position()=2]">
826 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
827 </xsl:apply-templates>
830 <xsl:apply-templates mode="inline" select="."/>
836 <xsl:template match="m:ci">
838 <xsl:when test="boolean(@definitionURL)">
840 <xsl:attribute name="href">
841 <xsl:call-template name="makeURL">
842 <xsl:with-param name="url" select="@definitionURL"/>
845 <xsl:apply-templates/>
849 <xsl:value-of select="."/>
856 <xsl:template match="m:ci|m:csymbol" mode="charcount">
857 <xsl:param name="incurrent_length" select="0"/>
859 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
860 <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>
862 <xsl:when test="string($siblength) = """>
863 <xsl:value-of select="$incurrent_length + string-length()"/>
866 <xsl:value-of select="number($siblength)"/>
871 <xsl:value-of select="$incurrent_length + string-length()"/>
876 <xsl:template match="*" mode="charcount">
877 <xsl:param name="incurrent_length" select="0"/>
879 <xsl:when test="count(child::*) = 0">
880 <xsl:value-of select="$incurrent_length"/>
883 <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>
885 <xsl:when test="$framewidth >= number($childlength)">
886 <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>
888 <xsl:when test="string($siblength) = """>
889 <xsl:value-of select="number($childlength)"/>
892 <xsl:value-of select="number($siblength)"/>
897 <xsl:value-of select="number($childlength)"/>
905 <!--***********************************************************************-->
907 <!--***********************************************************************-->
911 <xsl:template match="Definition">
912 <xsl:param name="current_indent" select="0"/>
914 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
916 <xsl:call-template name="make_indent">
917 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
919 <xsl:apply-templates select="type/*[1]">
920 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
921 </xsl:apply-templates><br/>
923 <xsl:call-template name="make_indent">
924 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
926 <xsl:apply-templates select="body/*[1]">
927 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
928 </xsl:apply-templates>
934 <xsl:template match="Axiom">
935 <xsl:param name="current_indent" select="0"/>
937 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
939 <xsl:call-template name="make_indent">
940 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
942 <xsl:apply-templates select="type/*[1]">
943 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
944 </xsl:apply-templates>
948 <!-- UNFINISHED PROOF -->
950 <xsl:template match="CurrentProof">
951 <xsl:param name="current_indent" select="0"/>
953 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
954 THESIS: <xsl:apply-templates select="type/*[1]">
955 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
956 </xsl:apply-templates><br/>
958 <xsl:for-each select="Conjecture">
960 <xsl:call-template name="make_indent">
961 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
963 <xsl:value-of select="./@no"/> :
964 <xsl:apply-templates select="./*[1]">
965 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
966 </xsl:apply-templates>
970 <xsl:apply-templates select="body/*[1]">
971 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
972 </xsl:apply-templates>
976 <!-- MUTUAL INDUCTIVE DEFINITION -->
978 <xsl:template match="InductiveDefinition">
979 <xsl:param name="current_indent" select="0"/>
981 <xsl:for-each select="InductiveType">
983 <xsl:when test="position() = 1">
985 <xsl:when test="string(./@inductive) = "true"">
989 COINDUCTIVE DEFINITION
997 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
999 <xsl:if test="string(../Param) != """>
1000 <xsl:for-each select="../Param">
1001 <xsl:value-of select="./@name"/>
1003 <xsl:apply-templates select="*"/>
1008 <xsl:apply-templates select="./arity/*[1]">
1009 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1010 </xsl:apply-templates> <br/>
1012 <xsl:for-each select="./Constructor">
1014 <xsl:call-template name="make_indent">
1015 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1016 </xsl:call-template>
1018 <xsl:when test="position() = 1">
1019 <xsl:text>  </xsl:text>
1022 <xsl:text>| </xsl:text>
1025 <xsl:value-of select="./@name"/>
1026 <xsl:text>: </xsl:text>
1027 <xsl:apply-templates select="./*[1]">
1028 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
1029 </xsl:apply-templates>
1037 <xsl:template match="Variable">
1038 <xsl:param name="current_indent" select="0"/>
1040 VARIABLE <xsl:value-of select="@name"/><br/>
1041 TYPE = <xsl:apply-templates select="type/*[1]">
1042 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1043 </xsl:apply-templates>
1047 <!--***********************************************************************-->
1049 <!--***********************************************************************-->
1053 <xsl:template match="SECTION">
1054 <xsl:param name="current_indent" select="0"/>
1055 <h1>BEGIN OF SECTION</h1>
1056 <xsl:apply-templates/>
1057 <h1>END OF SECTION</h1>