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, Guidi -->
33 <!--***********************************************************************-->
35 <xsl:param name="CICURI" select="''"/>
37 <xsl:include href="html_init.xsl"/>
38 <xsl:include href="html_set.xsl"/>
39 <xsl:include href="html_reals.xsl"/>
41 <xsl:variable name="showcast" select="0"/>
43 <!--***********************************************************************-->
44 <!-- HTML Head and Body -->
45 <!--***********************************************************************-->
47 <!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
49 <!-- document needs method="xml" and searches locally for the dtd if -->
50 <!-- doctype-system is specified (the dtd must exist locally for parsing). -->
51 <!-- For having output html must be media-type="html" and for having the -->
52 <!-- correct <br /> you must specify at least the remote dtd by means of -->
53 <!-- doctype-public -->
57 media-type="text/html"
58 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
60 <xsl:variable name="framewidth" select="45"/>
62 <xsl:template match="/">
63 <xsl:param name="current_indent" select="0"/>
66 <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
67 <style> A { text-decoration: none } </style>
69 <body bgcolor="white">
71 <xsl:with-param name="current_indent" select="0"/>
72 </xsl:apply-templates>
77 <!--***********************************************************************-->
79 <!--***********************************************************************-->
81 <xsl:template name="make_indent">
82 <xsl:param name="current_indent" select="0"/>
83 <xsl:if test="$current_indent > 0">
84 <xsl:text> </xsl:text>
85 <xsl:call-template name="make_indent">
86 <xsl:with-param name="current_indent" select="$current_indent - 1"/>
91 <!-- Syntactic Sugar -->
92 <xsl:template match="m:type">
93 <xsl:param name="current_indent" select="0"/>
95 <xsl:with-param name="current_indent"
96 select="$current_indent"/>
97 </xsl:apply-templates>
100 <xsl:template match="m:condition">
101 <xsl:param name="current_indent" select="0"/>
102 <xsl:apply-templates>
103 <xsl:with-param name="current_indent"
104 select="$current_indent"/>
105 </xsl:apply-templates>
108 <xsl:template match="m:math">
109 <xsl:param name="current_indent" select="0"/>
110 <xsl:apply-templates>
111 <xsl:with-param name="current_indent"
112 select="$current_indent"/>
113 </xsl:apply-templates>
116 <!--*********************************************************************-->
118 <!--*********************************************************************-->
121 <xsl:template mode="inline" match="m:ci">
123 <xsl:when test="boolean(@definitionURL)">
124 <a href="{@definitionURL}">
125 <xsl:apply-templates/>
129 <xsl:value-of select="."/>
136 <xsl:template match="m:apply[m:csymbol]" mode="inline">
137 <xsl:variable name="name">
138 <xsl:value-of select="m:csymbol"/>
142 <xsl:when test="$name='forall'">
143 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
144 <xsl:apply-templates select="m:bvar/m:ci"/>
145 <xsl:text>:</xsl:text>
146 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
147 <xsl:text>.</xsl:text>
148 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
150 <xsl:when test="$name='prod'">
151 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
152 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
153 <xsl:text>:</xsl:text>
154 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
155 <xsl:text>.</xsl:text>
156 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
159 <xsl:when test="$name='arrow'">
160 <xsl:text>(</xsl:text>
161 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
162 <FONT color="blue" SIZE="+0" FACE="symbol">
163 <xsl:text>®</xsl:text>
165 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
166 <xsl:text>)</xsl:text>
169 <xsl:when test="$name='app'">
170 <xsl:text>(</xsl:text>
171 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
172 <xsl:for-each select="*[position()>2]">
173 <xsl:text> </xsl:text>
174 <xsl:apply-templates mode="inline" select="."/>
176 <xsl:text>)</xsl:text>
179 <xsl:when test="$name='cast'">
180 <xsl:text>(</xsl:text>
181 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
182 <xsl:text>:></xsl:text>
183 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
184 <xsl:text>)</xsl:text>
186 <xsl:when test="$name='Prop'">
187 <FONT color="violet">Prop</FONT>
189 <xsl:when test="$name='Set'">
190 <FONT color="violet">Set</FONT>
192 <xsl:when test="$name='Type'">
193 <FONT color="violet">Type</FONT>
196 <xsl:when test="$name='mutcase'">
197 <xsl:text><</xsl:text>
198 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
199 <xsl:text>> </xsl:text>
200 <FONT color="red">CASE </FONT>
201 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
202 <FONT color="red"> OF </FONT>
203 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
205 <xsl:when test="not(position() = 1)">
206 <xsl:text> | </xsl:text>
209 <xsl:apply-templates mode="inline" select="."/>
210 <FONT FACE="Symbol" SIZE="+0" mathcolor="green">Þ</FONT>
211 <xsl:apply-templates mode="inline"
212 select="following-sibling::*[position()= 1]"/>
216 <xsl:when test="$name='fix'">
217 <FONT color="red">FIX</FONT>
218 <xsl:value-of select="m:ci"/>
219 <xsl:text>{</xsl:text>
220 <xsl:for-each select="m:bvar">
221 <xsl:value-of select="m:ci"/>
222 <xsl:text>:</xsl:text>
223 <xsl:apply-templates mode="inline" select="m:type"/>
224 <xsl:text>:=</xsl:text>
225 <xsl:apply-templates mode="inline"
226 select="following-sibling::*[position() = 1]"/>
228 <xsl:when test="position()=last()">
229 <xsl:text>}</xsl:text>
232 <xsl:text>;</xsl:text>
238 <xsl:when test="$name='cofix'">
239 <xsl:text>COFIX</xsl:text>
240 <xsl:value-of select="m:ci"/>
241 <xsl:text>{</xsl:text>
242 <xsl:for-each select="m:bvar">
243 <xsl:value-of select="m:ci"/>
244 <xsl:text>:</xsl:text>
245 <xsl:apply-templates mode="inline" select="m:type"/>
246 <xsl:text>:=</xsl:text>
247 <xsl:apply-templates mode="inline"
248 select="following-sibling::*[position() = 1]"/>
250 <xsl:when test="position()=last()">
251 <xsl:text>}</xsl:text>
254 <xsl:text>;</xsl:text>
260 <xsl:when test="$name='proof'">
261 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
262 <FONT color="red"> proves </FONT>
263 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
266 <xsl:when test="$name='false_ind'">
267 <xsl:apply-templates mode="inline" select="*[3]"/>
268 <FONT color="red">Contradiction.</FONT>
271 <xsl:when test="$name='and_ind'">
272 <FONT color="red">From </FONT>
273 <xsl:apply-templates select="*[2]"/>
274 <FONT color="red"> we get</FONT>
276 <xsl:apply-templates select="*[3]"/>
278 <xsl:apply-templates mode="inline" select="*[4]"/>
279 <FONT color="red"> and </FONT>
281 <xsl:apply-templates select="*[5]"/>
283 <xsl:apply-templates mode="inline" select="*[6]"/>
285 <FONT color="red"> hence </FONT>
286 <xsl:apply-templates mode="inline" select="*[7]"/>
290 <xsl:when test="$name='interp'">
291 <font color="green">[</font>
292 <xsl:apply-templates select="*[2]"/>
293 <font color="green">]</font>
299 <xsl:template mode="inline" match="m:lambda">
300 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
301 <xsl:apply-templates select="m:bvar/m:ci"/>
302 <xsl:text>:</xsl:text>
303 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
304 <xsl:text>.</xsl:text>
305 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
308 <!--*********************************************************************-->
309 <!-- COUNTING MODE -->
310 <!--*********************************************************************-->
312 <xsl:template match="m:apply[m:csymbol]">
313 <xsl:param name="current_indent" select="0"/>
314 <xsl:param name="width" select="$framewidth"/>
315 <xsl:variable name="name">
316 <xsl:value-of select="m:csymbol"/>
318 <xsl:variable name="charlength">
319 <xsl:apply-templates select="m:csymbol" mode="charcount"/>
321 <!-- <xsl:value-of select="$current_indent"/> -->
322 <!-- <xsl:value-of select="$charlength"/> -->
325 <xsl:when test="$name='forall'">
327 <xsl:when test="$charlength > $framewidth">
329 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
330 <xsl:apply-templates select="m:bvar/m:ci"/>
331 <xsl:text>:</xsl:text>
332 <xsl:apply-templates select="m:bvar/m:type">
333 <xsl:with-param name="current_indent"
334 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
335 </xsl:apply-templates>
337 <xsl:call-template name="make_indent">
338 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
340 <xsl:text>.</xsl:text>
341 <xsl:apply-templates select="*[position()=3]">
342 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
343 </xsl:apply-templates>
346 <xsl:apply-templates mode="inline" select="."/>
351 <xsl:when test="$name='prod'">
353 <xsl:when test="$charlength > $framewidth">
354 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
355 <xsl:apply-templates select="m:bvar/m:ci"/>
356 <xsl:text>:</xsl:text>
357 <xsl:apply-templates select="m:bvar/m:type">
358 <xsl:with-param name="current_indent"
359 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
360 </xsl:apply-templates><br/>
361 <xsl:call-template name="make_indent">
362 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
364 <xsl:text>.</xsl:text>
365 <xsl:apply-templates select="*[position()=3]">
366 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
367 </xsl:apply-templates>
370 <xsl:apply-templates mode="inline" select="."/>
375 <xsl:when test="$name='arrow'">
377 <xsl:when test="$charlength > $framewidth">
378 <xsl:text>(</xsl:text>
379 <xsl:apply-templates select="*[position()=2]">
380 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
381 </xsl:apply-templates>
383 <xsl:call-template name="make_indent">
384 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
387 <FONT color="blue" SIZE="+0" FACE="symbol">
388 <xsl:text>®</xsl:text>
390 <xsl:apply-templates select="*[position()=3]">
391 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
392 </xsl:apply-templates>
393 <xsl:text>)</xsl:text>
396 <xsl:apply-templates mode="inline" select="."/>
401 <xsl:when test="$name='app'">
403 <xsl:when test="$charlength > $framewidth">
404 <xsl:text>(</xsl:text>
405 <xsl:apply-templates select="*[position()=2]">
406 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
407 </xsl:apply-templates>
408 <xsl:for-each select="*[position()>2]">
410 <xsl:call-template name="make_indent">
411 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
413 <xsl:apply-templates select=".">
414 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
415 </xsl:apply-templates>
417 <xsl:text>)</xsl:text>
420 <xsl:apply-templates mode="inline" select="."/>
424 <xsl:when test="$name='cast'">
426 <xsl:when test="$showcast = 1">
428 <xsl:when test="$charlength > $framewidth">
429 <xsl:text>(</xsl:text>
430 <xsl:apply-templates select="*[position()=2]">
431 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
432 </xsl:apply-templates><br/>
433 <xsl:call-template name="make_indent">
434 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
435 <xsl:text>:></xsl:text>
436 <xsl:apply-templates select="*[position()=3]">
437 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
438 </xsl:apply-templates>
439 <xsl:text>)</xsl:text>
442 <xsl:apply-templates mode="inline" select="."/>
447 <xsl:apply-templates select="*[position()=2]">
448 <xsl:with-param name="current_indent" select="$current_indent"/>
449 </xsl:apply-templates>
453 <xsl:when test="$name='Prop'">
454 <xsl:text>Prop</xsl:text>
456 <xsl:when test="$name='Set'">
457 <xsl:text>Set</xsl:text>
459 <xsl:when test="$name='Type'">
460 <xsl:text>Type</xsl:text>
462 <xsl:when test="$name='mutcase'">
464 <xsl:when test="$charlength > $framewidth">
465 <xsl:text><</xsl:text>
466 <xsl:apply-templates select="*[position()=2]">
467 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
468 </xsl:apply-templates>
469 <xsl:text>> </xsl:text>
471 <xsl:call-template name="make_indent">
472 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
473 <xsl:text>CASE </xsl:text>
474 <xsl:apply-templates select="*[position()=3]">
475 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
476 </xsl:apply-templates>
477 <xsl:text> OF </xsl:text>
478 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
480 <xsl:call-template name="make_indent">
481 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
484 <xsl:when test="position() = 1">
485 <xsl:text>  </xsl:text>
488 <xsl:text>| </xsl:text>
491 <xsl:apply-templates select="."/>
492 <FONT FACE="Symbol" SIZE="+0" mathcolor="green">Þ</FONT>
493 <xsl:variable name="body_size">
495 select="following-sibling::*[1]/*[1]" mode="charcount"/>
498 <xsl:when test="$body_size > $framewidth">
500 <xsl:call-template name="make_indent">
501 <xsl:with-param name="current_indent"
502 select="$current_indent + 8"/>
505 select="following-sibling::*[position()= 1]">
506 <xsl:with-param name="current_indent"
507 select="$current_indent + 8"/>
508 </xsl:apply-templates>
511 <xsl:apply-templates select="following-sibling::*[position()= 1]"
518 <xsl:apply-templates mode="inline" select="."/>
523 <xsl:when test="$name='fix'">
525 <xsl:when test="$charlength > $framewidth">
526 <xsl:text>FIX</xsl:text>
527 <xsl:value-of select="m:ci"/>
528 <xsl:text>{</xsl:text>
529 <xsl:for-each select="m:bvar">
531 <xsl:call-template name="make_indent">
532 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
534 <xsl:value-of select="m:ci"/>
535 <xsl:text>:</xsl:text>
536 <xsl:apply-templates select="m:type">
537 <xsl:with-param name="current_indent"
538 select="$current_indent + 5 + string-length(m:ci)"/>
539 </xsl:apply-templates>
541 <xsl:call-template name="make_indent">
542 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
544 <xsl:text>:=</xsl:text>
545 <xsl:apply-templates select="following-sibling::*[position() = 1]">
546 <xsl:with-param name="current_indent" select="$current_indent +2"/>
547 </xsl:apply-templates>
550 <xsl:call-template name="make_indent">
551 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
553 <xsl:text>}</xsl:text>
556 <xsl:apply-templates mode="inline" select="."/>
561 <xsl:when test="$name='cofix'">
563 <xsl:when test="($charlength + 10) > $framewidth">
564 <xsl:text>COFIX</xsl:text>
565 <xsl:value-of select="m:ci"/>
566 <xsl:text>{</xsl:text>
568 <xsl:call-template name="make_indent">
569 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
571 <xsl:for-each select="m:bvar">
572 <xsl:value-of select="m:ci"/>
573 <xsl:text>:</xsl:text>
574 <xsl:apply-templates select="m:type">
575 <xsl:with-param name="current_indent"
576 select="$current_indent + 5 + string-length(m:ci)"/>
577 </xsl:apply-templates>
579 <xsl:call-template name="make_indent">
580 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
582 <xsl:text>:=</xsl:text>
583 <xsl:apply-templates select="following-sibling::*[position() = 1]">
584 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
585 </xsl:apply-templates>
589 <xsl:call-template name="make_indent">
590 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
592 <xsl:text>}</xsl:text>
595 <xsl:apply-templates mode="inline" select="m:type"/>
599 <!-- ***************************************** -->
600 <!-- *********** PROOF ELEMENTS ************** -->
601 <!-- ***************************************** -->
603 <xsl:when test="$name='proof'">
604 <xsl:apply-templates select="*[position()=2]">
605 <xsl:with-param name="current_indent" select="$current_indent"/>
606 </xsl:apply-templates>
608 <!-- <xsl:element name="br"/> -->
609 <xsl:call-template name="make_indent">
610 <xsl:with-param name="current_indent" select="$current_indent"/>
612 <FONT color="red">we proved </FONT>
613 <xsl:apply-templates select="*[position()=3]">
614 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
615 </xsl:apply-templates>
618 <xsl:when test="$name='letin1'">
619 <xsl:apply-templates select="*[position()=2]">
620 <xsl:with-param name="current_indent" select="$current_indent"/>
621 </xsl:apply-templates>
623 <xsl:call-template name="make_indent">
624 <xsl:with-param name="current_indent" select="$current_indent"/>
626 <xsl:apply-templates select="*[position()=3]">
627 <xsl:with-param name="current_indent" select="$current_indent"/>
628 </xsl:apply-templates>
631 <xsl:when test="$name='letin'">
632 <xsl:for-each select="*[position()>1 and last()>position()]">
633 <xsl:apply-templates select=".">
634 <xsl:with-param name="current_indent" select="$current_indent"/>
635 </xsl:apply-templates>
637 <xsl:call-template name="make_indent">
638 <xsl:with-param name="current_indent" select="$current_indent"/>
641 <xsl:apply-templates select="*[position()=last()]">
642 <xsl:with-param name="current_indent" select="$current_indent"/>
643 </xsl:apply-templates>
646 <xsl:when test="$name='let'">
648 <xsl:apply-templates select="m:ci"/>
650 <xsl:apply-templates select="*[3]">
651 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
652 </xsl:apply-templates>
655 <xsl:when test="$name='rw_step'">
657 <xsl:when test="name(*[2])='m:apply'">
658 <xsl:apply-templates select="*[2]">
659 <xsl:with-param name="current_indent" select="$current_indent"/>
660 </xsl:apply-templates>
663 <FONT color="red">Consider </FONT>
664 <xsl:apply-templates select="*[2]"/>
667 <xsl:variable name="charlength_first">
668 <xsl:apply-templates select="*[3]/*[1]" mode="charcount"/>
670 <xsl:variable name="charlength_second">
671 <xsl:apply-templates select="*[4]/*[1]" mode="charcount"/>
673 <xsl:variable name="charlength_side_proof">
674 <xsl:apply-templates select="*[5]/*[1]" mode="charcount"/>
676 <xsl:variable name="split1"
677 select="$charlength_first + $charlength_second > $framewidth"/>
678 <xsl:variable name="split2"
679 select="$charlength_second + $charlength_side_proof > $framewidth"/>
680 <!-- <xsl:value-of select="$current_indent"/> -->
681 <!-- <xsl:value-of select="$charlength"/> -->
683 <xsl:call-template name="make_indent">
684 <xsl:with-param name="current_indent" select="$current_indent"/>
686 <FONT color="red">Rewrite </FONT>
687 <xsl:apply-templates mode="inline" select="*[3]"/>
688 <xsl:text> </xsl:text>
689 <xsl:if test="$split1">
691 <xsl:call-template name="make_indent">
692 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
695 <FONT color="red">with </FONT>
696 <xsl:apply-templates mode="inline" select="*[4]"/>
697 <xsl:text> </xsl:text>
698 <xsl:if test="$split2">
700 <xsl:call-template name="make_indent">
701 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
704 <FONT color="red">by </FONT>
705 <xsl:apply-templates select="*[5]">
706 <xsl:with-param name="current_indent" select="$current_indent+7"/>
707 </xsl:apply-templates>
709 <!-- rewrite and apply -->
710 <xsl:when test="$name='rewrite_and_apply'">
711 <xsl:apply-templates select="*[2]">
712 <xsl:with-param name="current_indent" select="$current_indent"/>
713 </xsl:apply-templates>
715 <xsl:call-template name="make_indent">
716 <xsl:with-param name="current_indent" select="$current_indent"/>
718 <FONT color="red">Then apply it to </FONT>
719 <xsl:apply-templates select="*[position()>2]"/>
721 <!-- by_induction -->
722 <xsl:when test="$name='by_induction'">
723 <FONT color="red">We prove </FONT>
724 <xsl:apply-templates select="../*[3]">
725 <xsl:with-param name="current_indent" select="$current_indent+18"/>
726 </xsl:apply-templates>
728 <xsl:call-template name="make_indent">
729 <xsl:with-param name="current_indent" select="$current_indent"/>
731 <FONT color="red">by induction on </FONT>
732 <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
733 <xsl:with-param name="current_indent" select="$current_indent+30"/>
734 </xsl:apply-templates>
737 <xsl:call-template name="make_indent">
738 <xsl:with-param name="current_indent" select="$current_indent"/>
740 <xsl:text>The induction property is</xsl:text>
742 <xsl:call-template name="make_indent">
743 <xsl:with-param name="current_indent" select="$current_indent"/>
745 <xsl:apply-templates select="*[3]">
746 <xsl:with-param name="current_indent" select="$current_indent"/>
747 </xsl:apply-templates>
750 select="*[position()>3 and not(position()=last())]">
751 <xsl:with-param name="current_indent" select="$current_indent+4"/>
752 </xsl:apply-templates>
754 <xsl:call-template name="make_indent">
755 <xsl:with-param name="current_indent" select="$current_indent"/>
757 <xsl:text>End induction</xsl:text> -->
759 <!-- inductive_case -->
760 <xsl:when test="$name='inductive_case'">
762 <xsl:call-template name="make_indent">
763 <xsl:with-param name="current_indent" select="$current_indent"/>
765 <FONT color="red">Case </FONT>
766 <xsl:apply-templates select="*[2]">
767 <xsl:with-param name="current_indent" select="$current_indent +10"/>
768 </xsl:apply-templates>
769 <xsl:if test="*[3]/*[position()>1]">
771 <xsl:call-template name="make_indent">
772 <xsl:with-param name="current_indent" select="$current_indent+4"/>
774 <FONT color="red">By induction hypothesis, we have:</FONT>
775 <xsl:for-each select="*[3]/*[position()>1]">
777 <xsl:call-template name="make_indent">
778 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
780 <xsl:text>(</xsl:text>
781 <xsl:apply-templates select="m:ci"/>
782 <xsl:text>) </xsl:text>
783 <xsl:apply-templates select="m:type">
784 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
785 </xsl:apply-templates>
789 <xsl:call-template name="make_indent">
790 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
792 <xsl:apply-templates select="*[4]">
793 <xsl:with-param name="current_indent" select="$current_indent +4"/>
794 </xsl:apply-templates>
796 <xsl:call-template name="make_indent">
797 <xsl:with-param name="current_indent" select="$current_indent"/>
799 <xsl:text>End Case</xsl:text> -->
802 <xsl:when test="$name='case_lhs'">
804 <xsl:when test="count(*)=2">
805 <xsl:apply-templates mode="inline" select="*[2]"/>
808 <xsl:text>(</xsl:text>
809 <xsl:apply-templates mode="inline" select="*[2]"/>
810 <xsl:for-each select="m:bvar">
811 <xsl:text> </xsl:text>
812 <xsl:apply-templates mode="inline" select="*[1]"/>
813 <xsl:text>:</xsl:text>
814 <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
816 <xsl:text>)</xsl:text>
821 <xsl:when test="$name='nat_ind_complete'">
822 <FONT color="red">By induction on </FONT>
823 <xsl:apply-templates select="*[2]"/>:
825 <xsl:call-template name="make_indent">
826 <xsl:with-param name="current_indent" select="$current_indent"/>
828 <xsl:text>0 </xsl:text>
829 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
830 <xsl:apply-templates select="*[3]">
831 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
832 </xsl:apply-templates>
834 <xsl:call-template name="make_indent">
835 <xsl:with-param name="current_indent" select="$current_indent"/>
837 <xsl:text>S(</xsl:text>
838 <xsl:apply-templates select="*[4]"/>
839 <xsl:text>) </xsl:text>
840 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
841 <FONT color="red">Assume by induction</FONT>
843 <xsl:call-template name="make_indent">
844 <xsl:with-param name="current_indent" select="$current_indent +10"/>
846 <xsl:text>(</xsl:text>
847 <xsl:apply-templates select="*[5]"/>
848 <xsl:text>)</xsl:text>
849 <xsl:apply-templates select="*[6]">
850 <xsl:with-param name="current_indent" select="$current_indent + 14"/>
851 </xsl:apply-templates>
853 <xsl:call-template name="make_indent">
854 <xsl:with-param name="current_indent" select="$current_indent +10"/>
856 <xsl:apply-templates select="*[7]">
857 <xsl:with-param name="current_indent" select="$current_indent + 10"/>
858 </xsl:apply-templates>
861 <xsl:when test="$name='false_ind'">
862 <xsl:apply-templates select="*[3]">
863 <xsl:with-param name="current_indent" select="$current_indent"/>
864 </xsl:apply-templates>
866 <xsl:call-template name="make_indent">
867 <xsl:with-param name="current_indent" select="$current_indent"/>
869 <FONT color="red">Contradiction.</FONT>
872 <xsl:when test="$name='and_ind'">
874 <xsl:when test="name(*[2])='m:apply'">
875 <xsl:apply-templates select="*[2]">
876 <xsl:with-param name="current_indent" select="$current_indent"/>
877 </xsl:apply-templates>
880 <FONT color="red">Consider </FONT>
881 <xsl:apply-templates select="*[2]"/>
885 <xsl:call-template name="make_indent">
886 <xsl:with-param name="current_indent" select="$current_indent"/>
888 <FONT color="red">In particular, we have</FONT>
890 <xsl:call-template name="make_indent">
891 <xsl:with-param name="current_indent" select="$current_indent"/>
894 <xsl:apply-templates select="*[3]"/>
896 <xsl:apply-templates select="*[4]">
897 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
898 </xsl:apply-templates>
900 <xsl:call-template name="make_indent">
901 <xsl:with-param name="current_indent" select="$current_indent"/>
904 <xsl:apply-templates select="*[5]"/>
906 <xsl:apply-templates select="*[6]">
907 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
908 </xsl:apply-templates>
910 <xsl:call-template name="make_indent">
911 <xsl:with-param name="current_indent" select="$current_indent"/>
913 <xsl:apply-templates select="*[7]">
914 <xsl:with-param name="current_indent" select="$current_indent"/>
915 </xsl:apply-templates>
918 <xsl:when test="$name='full_or_ind'">
920 <xsl:when test="name(*[2])='m:apply'">
921 <xsl:apply-templates select="*[2]">
922 <xsl:with-param name="current_indent" select="$current_indent"/>
923 </xsl:apply-templates>
926 <FONT color="red">Consider </FONT>
927 <xsl:apply-templates select="*[2]"/>
931 <xsl:call-template name="make_indent">
932 <xsl:with-param name="current_indent" select="$current_indent"/>
934 <FONT color="red">We proceed by cases to prove </FONT>
935 <xsl:apply-templates select="*[3]"/>
937 <xsl:call-template name="make_indent">
938 <xsl:with-param name="current_indent" select="$current_indent+4"/>
940 <FONT color="red">Left: suppose </FONT>
941 <xsl:text>(</xsl:text>
942 <xsl:value-of select="*[4]/m:bvar/m:ci"/>
943 <xsl:text>) </xsl:text>
945 select="*[4]/m:bvar/m:type/*[1]"/>
947 <xsl:call-template name="make_indent">
948 <xsl:with-param name="current_indent" select="$current_indent+15"/>
952 <xsl:with-param name="current_indent" select="$current_indent+15"/>
953 </xsl:apply-templates>
955 <xsl:call-template name="make_indent">
956 <xsl:with-param name="current_indent" select="$current_indent+4"/>
958 <FONT color="red">Right: suppose </FONT>
959 <xsl:text>(</xsl:text>
960 <xsl:value-of select="*[5]/m:bvar/m:ci"/>
961 <xsl:text>) </xsl:text>
963 select="*[5]/m:bvar/m:type/*[1]"/>
965 <xsl:call-template name="make_indent">
966 <xsl:with-param name="current_indent" select="$current_indent+16"/>
970 <xsl:with-param name="current_indent" select="$current_indent+16"/>
971 </xsl:apply-templates>
974 <xsl:when test="$name='or_ind'">
976 <xsl:when test="name(*[2])='m:apply'">
977 <xsl:apply-templates select="*[2]">
978 <xsl:with-param name="current_indent" select="$current_indent"/>
979 </xsl:apply-templates>
982 <FONT color="red">Consider </FONT>
983 <xsl:apply-templates select="*[2]"/>
987 <xsl:call-template name="make_indent">
988 <xsl:with-param name="current_indent" select="$current_indent"/>
990 <FONT color="red">We prove </FONT>
991 <xsl:apply-templates select="*[3]"/>
992 <FONT color="red"> by cases:</FONT>
994 <xsl:call-template name="make_indent">
995 <xsl:with-param name="current_indent" select="$current_indent"/>
998 <xsl:apply-templates select="*[4]">
999 <xsl:with-param name="current_indent" select="$current_indent"/>
1000 </xsl:apply-templates>
1002 <xsl:call-template name="make_indent">
1003 <xsl:with-param name="current_indent" select="$current_indent"/>
1004 </xsl:call-template>
1006 <xsl:apply-templates select="*[5]">
1007 <xsl:with-param name="current_indent" select="$current_indent"/>
1008 </xsl:apply-templates>
1011 <xsl:when test="$name='ex_ind'">
1013 <xsl:when test="name(*[2])='m:apply'">
1014 <xsl:apply-templates select="*[2]">
1015 <xsl:with-param name="current_indent" select="$current_indent"/>
1016 </xsl:apply-templates>
1019 <FONT color="red">Consider </FONT>
1020 <xsl:apply-templates select="*[2]">
1021 <xsl:with-param name="current_indent" select="$current_indent"/>
1022 </xsl:apply-templates>
1026 <xsl:call-template name="make_indent">
1027 <xsl:with-param name="current_indent" select="$current_indent"/>
1028 </xsl:call-template>
1029 <FONT color="red">Let </FONT>
1030 <xsl:apply-templates mode="inline" select="*[3]"/>
1032 <xsl:apply-templates mode="inline" select="*[4]"/>
1033 <FONT color="red"> such that</FONT>
1035 <xsl:call-template name="make_indent">
1036 <xsl:with-param name="current_indent" select="$current_indent"/>
1037 </xsl:call-template>
1039 <xsl:apply-templates mode="inline" select="*[5]"/>
1041 <xsl:apply-templates select="*[6]">
1042 <xsl:with-param name="current_indent" select="$current_indent +7"/>
1043 </xsl:apply-templates>
1045 <xsl:call-template name="make_indent">
1046 <xsl:with-param name="current_indent" select="$current_indent"/>
1047 </xsl:call-template>
1048 <xsl:apply-templates select="*[7]">
1049 <xsl:with-param name="current_indent" select="$current_indent"/>
1050 </xsl:apply-templates>
1054 <xsl:when test="$name='interp'">
1055 <font color="green">[</font>
1056 <xsl:apply-templates select="*[2]"/>
1057 <font color="green">]</font>
1065 <xsl:template match="m:lambda">
1066 <xsl:param name="current_indent" select="0"/>
1067 <xsl:variable name="charlength">
1068 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
1069 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
1071 <!-- <xsl:value-of select="$charlength"/> -->
1072 <!-- <xsl:value-of select="$current_indent"/> -->
1074 <xsl:when test="$charlength > $framewidth">
1076 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
1077 <xsl:apply-templates select="m:bvar/m:ci"/>
1078 <xsl:text>:</xsl:text>
1079 <xsl:apply-templates select="m:bvar/m:type">
1080 <xsl:with-param name="current_indent"
1081 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
1082 </xsl:apply-templates><br/>
1083 <xsl:call-template name="make_indent">
1084 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1085 </xsl:call-template>
1086 <xsl:text>.</xsl:text>
1087 <xsl:apply-templates select="*[position()=2]">
1088 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1089 </xsl:apply-templates>
1092 <xsl:apply-templates mode="inline" select="."/>
1098 <xsl:template match="m:ci">
1100 <xsl:when test="boolean(@definitionURL)">
1101 <a href="{@definitionURL}">
1102 <xsl:apply-templates/>
1106 <xsl:value-of select="."/>
1113 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1114 <xsl:param name="incurrent_length" select="0"/>
1116 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
1117 <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>
1119 <xsl:when test="string($siblength) = """>
1120 <xsl:value-of select="$incurrent_length + string-length()"/>
1123 <xsl:value-of select="number($siblength)"/>
1128 <xsl:value-of select="$incurrent_length + string-length()"/>
1133 <xsl:template match="*" mode="charcount">
1134 <xsl:param name="incurrent_length" select="0"/>
1136 <xsl:when test="count(child::*) = 0">
1137 <xsl:value-of select="$incurrent_length"/>
1140 <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>
1142 <xsl:when test="$framewidth >= number($childlength)">
1143 <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>
1145 <xsl:when test="string($siblength) = """>
1146 <xsl:value-of select="number($childlength)"/>
1149 <xsl:value-of select="number($siblength)"/>
1154 <xsl:value-of select="number($childlength)"/>
1162 <!--***********************************************************************-->
1164 <!--***********************************************************************-->
1168 <xsl:template match="Definition">
1169 <xsl:param name="current_indent" select="0"/>
1171 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1173 <xsl:call-template name="make_indent">
1174 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1175 </xsl:call-template>
1176 <xsl:apply-templates select="type/*[1]">
1177 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1178 </xsl:apply-templates><br/>
1180 <xsl:call-template name="make_indent">
1181 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1182 </xsl:call-template>
1183 <xsl:apply-templates select="body/*[1]">
1184 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1185 </xsl:apply-templates>
1191 <xsl:template match="Axiom">
1192 <xsl:param name="current_indent" select="0"/>
1194 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1196 <xsl:call-template name="make_indent">
1197 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1198 </xsl:call-template>
1199 <xsl:apply-templates select="type/*[1]">
1200 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1201 </xsl:apply-templates>
1205 <!-- UNFINISHED PROOF -->
1207 <xsl:template match="CurrentProof">
1208 <xsl:param name="current_indent" select="0"/>
1210 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1211 THESIS: <xsl:apply-templates select="type/*[1]">
1212 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1213 </xsl:apply-templates><br/>
1215 <xsl:for-each select="Conjecture">
1217 <xsl:call-template name="make_indent">
1218 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1219 </xsl:call-template>
1220 <xsl:value-of select="./@no"/> :
1221 <xsl:apply-templates select="./*[1]">
1222 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
1223 </xsl:apply-templates>
1227 <xsl:apply-templates select="body/*[1]">
1228 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1229 </xsl:apply-templates>
1233 <!-- MUTUAL INDUCTIVE DEFINITION -->
1235 <xsl:template match="InductiveDefinition">
1236 <xsl:param name="current_indent" select="0"/>
1238 <xsl:for-each select="InductiveType">
1240 <xsl:when test="position() = 1">
1242 <xsl:when test="string(./@inductive) = "true"">
1243 INDUCTIVE DEFINITION
1246 COINDUCTIVE DEFINITION
1254 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
1256 <xsl:if test="string(../Param) != """>
1257 <xsl:for-each select="../Param">
1258 <xsl:value-of select="./@name"/>
1260 <xsl:apply-templates select="*"/>
1265 <xsl:apply-templates select="./arity/*[1]">
1266 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1267 </xsl:apply-templates> <br/>
1269 <xsl:for-each select="./Constructor">
1271 <xsl:call-template name="make_indent">
1272 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1273 </xsl:call-template>
1275 <xsl:when test="position() = 1">
1276 <xsl:text>  </xsl:text>
1279 <xsl:text>| </xsl:text>
1282 <xsl:value-of select="./@name"/>
1283 <xsl:text>: </xsl:text>
1284 <xsl:apply-templates select="./*[1]">
1285 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
1286 </xsl:apply-templates>
1294 <xsl:template match="Variable">
1295 <xsl:param name="current_indent" select="0"/>
1297 VARIABLE <xsl:value-of select="@name"/><br/>
1298 TYPE = <xsl:apply-templates select="type/*[1]">
1299 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1300 </xsl:apply-templates>
1304 <!--***********************************************************************-->
1306 <!--***********************************************************************-->
1310 <xsl:template match="SECTION">
1311 <xsl:param name="current_indent" select="0"/>
1312 <h1>BEGIN OF SECTION</h1>
1313 <xsl:apply-templates/>
1314 <h1>END OF SECTION</h1>