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>
470 <xsl:text>CASE </xsl:text>
471 <xsl:apply-templates select="*[position()=3]">
472 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
473 </xsl:apply-templates>
474 <xsl:text> OF </xsl:text>
475 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
477 <xsl:call-template name="make_indent">
478 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
481 <xsl:when test="position() = 1">
482 <xsl:text>  </xsl:text>
485 <xsl:text>| </xsl:text>
488 <xsl:apply-templates select="."/>
489 <FONT FACE="Symbol" SIZE="+0" mathcolor="green">Þ</FONT>
490 <xsl:apply-templates select="following-sibling::*[position()= 1]">
491 <xsl:with-param name="current_indent" select="$current_indent + 4 + string-length()"/>
492 </xsl:apply-templates>
496 <xsl:apply-templates mode="inline" select="."/>
501 <xsl:when test="$name='fix'">
503 <xsl:when test="$charlength > $framewidth">
504 <xsl:text>FIX</xsl:text>
505 <xsl:value-of select="m:ci"/>
506 <xsl:text>{</xsl:text>
507 <xsl:for-each select="m:bvar">
509 <xsl:call-template name="make_indent">
510 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
512 <xsl:value-of select="m:ci"/>
513 <xsl:text>:</xsl:text>
514 <xsl:apply-templates select="m:type">
515 <xsl:with-param name="current_indent"
516 select="$current_indent + 5 + string-length(m:ci)"/>
517 </xsl:apply-templates>
519 <xsl:call-template name="make_indent">
520 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
522 <xsl:text>:=</xsl:text>
523 <xsl:apply-templates select="following-sibling::*[position() = 1]">
524 <xsl:with-param name="current_indent" select="$current_indent +2"/>
525 </xsl:apply-templates>
528 <xsl:call-template name="make_indent">
529 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
531 <xsl:text>}</xsl:text>
534 <xsl:apply-templates mode="inline" select="."/>
539 <xsl:when test="$name='cofix'">
541 <xsl:when test="($charlength + 10) > $framewidth">
542 <xsl:text>COFIX</xsl:text>
543 <xsl:value-of select="m:ci"/>
544 <xsl:text>{</xsl:text>
546 <xsl:call-template name="make_indent">
547 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
549 <xsl:for-each select="m:bvar">
550 <xsl:value-of select="m:ci"/>
551 <xsl:text>:</xsl:text>
552 <xsl:apply-templates select="m:type">
553 <xsl:with-param name="current_indent"
554 select="$current_indent + 5 + string-length(m:ci)"/>
555 </xsl:apply-templates>
557 <xsl:call-template name="make_indent">
558 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
560 <xsl:text>:=</xsl:text>
561 <xsl:apply-templates select="following-sibling::*[position() = 1]">
562 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
563 </xsl:apply-templates>
567 <xsl:call-template name="make_indent">
568 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
570 <xsl:text>}</xsl:text>
573 <xsl:apply-templates mode="inline" select="m:type"/>
577 <!-- ***************************************** -->
578 <!-- *********** PROOF ELEMENTS ************** -->
579 <!-- ***************************************** -->
581 <xsl:when test="$name='proof'">
582 <xsl:apply-templates select="*[position()=2]">
583 <xsl:with-param name="current_indent" select="$current_indent"/>
584 </xsl:apply-templates>
586 <!-- <xsl:element name="br"/> -->
587 <xsl:call-template name="make_indent">
588 <xsl:with-param name="current_indent" select="$current_indent"/>
590 <FONT color="red">we proved </FONT>
591 <xsl:apply-templates select="*[position()=3]">
592 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
593 </xsl:apply-templates>
596 <xsl:when test="$name='letin1'">
597 <xsl:apply-templates select="*[position()=2]">
598 <xsl:with-param name="current_indent" select="$current_indent"/>
599 </xsl:apply-templates>
601 <xsl:call-template name="make_indent">
602 <xsl:with-param name="current_indent" select="$current_indent"/>
604 <xsl:apply-templates select="*[position()=3]">
605 <xsl:with-param name="current_indent" select="$current_indent"/>
606 </xsl:apply-templates>
609 <xsl:when test="$name='letin'">
610 <xsl:for-each select="*[position()>1 and last()>position()]">
611 <xsl:apply-templates select=".">
612 <xsl:with-param name="current_indent" select="$current_indent"/>
613 </xsl:apply-templates>
615 <xsl:call-template name="make_indent">
616 <xsl:with-param name="current_indent" select="$current_indent"/>
619 <xsl:apply-templates select="*[position()=last()]">
620 <xsl:with-param name="current_indent" select="$current_indent"/>
621 </xsl:apply-templates>
624 <xsl:when test="$name='let'">
626 <xsl:apply-templates select="m:ci"/>
628 <xsl:apply-templates select="*[3]">
629 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
630 </xsl:apply-templates>
633 <xsl:when test="$name='rw_step'">
635 <xsl:when test="name(*[2])='m:apply'">
636 <xsl:apply-templates select="*[2]">
637 <xsl:with-param name="current_indent" select="$current_indent"/>
638 </xsl:apply-templates>
641 <FONT color="red">Consider </FONT>
642 <xsl:apply-templates select="*[2]"/>
645 <xsl:variable name="charlength_first">
646 <xsl:apply-templates select="*[3]" mode="charcount"/>
648 <xsl:variable name="charlength_second">
649 <xsl:apply-templates select="*[4]" mode="charcount"/>
651 <xsl:variable name="charlength_side_proof">
652 <xsl:apply-templates select="*[5]" mode="charcount"/>
654 <xsl:variable name="split1"
655 select="$charlength_first + $charlength_second > $framewidth"/>
656 <xsl:variable name="split2"
657 select="$charlength_second + $charlength_side_proof > $framewidth"/>
658 <!-- <xsl:value-of select="$current_indent"/> -->
659 <!-- <xsl:value-of select="$charlength"/> -->
661 <xsl:call-template name="make_indent">
662 <xsl:with-param name="current_indent" select="$current_indent"/>
664 <FONT color="red">Rewrite </FONT>
665 <xsl:apply-templates mode="inline" select="*[3]"/>
666 <xsl:text> </xsl:text>
667 <xsl:if test="$split1">
669 <xsl:call-template name="make_indent">
670 <xsl:with-param name="current_indent" select="$current_indent"/>
673 <FONT color="red">with </FONT>
674 <xsl:apply-templates mode="inline" select="*[4]"/>
675 <xsl:text> </xsl:text>
676 <xsl:if test="$split2">
678 <xsl:call-template name="make_indent">
679 <xsl:with-param name="current_indent" select="$current_indent"/>
682 <FONT color="red">by </FONT>
683 <xsl:apply-templates select="*[5]">
684 <xsl:with-param name="current_indent" select="$current_indent+5"/>
685 </xsl:apply-templates>
687 <!-- rewrite and apply -->
688 <xsl:when test="$name='rewrite_and_apply'">
689 <xsl:apply-templates select="*[2]">
690 <xsl:with-param name="current_indent" select="$current_indent"/>
691 </xsl:apply-templates>
693 <xsl:call-template name="make_indent">
694 <xsl:with-param name="current_indent" select="$current_indent"/>
696 <FONT color="red">Then apply it to </FONT>
697 <xsl:apply-templates select="*[position()>2]"/>
699 <!-- by_induction -->
700 <xsl:when test="$name='by_induction'">
701 <FONT color="red">We prove </FONT>
702 <xsl:apply-templates select="../*[3]">
703 <xsl:with-param name="current_indent" select="$current_indent+18"/>
704 </xsl:apply-templates>
706 <xsl:call-template name="make_indent">
707 <xsl:with-param name="current_indent" select="$current_indent"/>
709 <FONT color="red">by induction on </FONT>
710 <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
711 <xsl:with-param name="current_indent" select="$current_indent+30"/>
712 </xsl:apply-templates>
715 <xsl:call-template name="make_indent">
716 <xsl:with-param name="current_indent" select="$current_indent"/>
718 <xsl:text>The induction property is</xsl:text>
720 <xsl:call-template name="make_indent">
721 <xsl:with-param name="current_indent" select="$current_indent"/>
723 <xsl:apply-templates select="*[3]">
724 <xsl:with-param name="current_indent" select="$current_indent"/>
725 </xsl:apply-templates>
728 select="*[position()>3 and not(position()=last())]">
729 <xsl:with-param name="current_indent" select="$current_indent+4"/>
730 </xsl:apply-templates>
732 <xsl:call-template name="make_indent">
733 <xsl:with-param name="current_indent" select="$current_indent"/>
735 <xsl:text>End induction</xsl:text> -->
737 <!-- inductive_case -->
738 <xsl:when test="$name='inductive_case'">
740 <xsl:call-template name="make_indent">
741 <xsl:with-param name="current_indent" select="$current_indent"/>
743 <FONT color="red">Case </FONT>
744 <xsl:apply-templates select="*[2]">
745 <xsl:with-param name="current_indent" select="$current_indent +10"/>
746 </xsl:apply-templates>
747 <xsl:if test="*[3]/*[position()>1]">
749 <xsl:call-template name="make_indent">
750 <xsl:with-param name="current_indent" select="$current_indent+4"/>
752 <FONT color="red">By induction hypothesis, we have:</FONT>
753 <xsl:for-each select="*[3]/*[position()>1]">
755 <xsl:call-template name="make_indent">
756 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
758 <xsl:text>(</xsl:text>
759 <xsl:apply-templates select="m:ci"/>
760 <xsl:text>) </xsl:text>
761 <xsl:apply-templates select="m:type">
762 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
763 </xsl:apply-templates>
767 <xsl:call-template name="make_indent">
768 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
770 <xsl:apply-templates select="*[4]">
771 <xsl:with-param name="current_indent" select="$current_indent +4"/>
772 </xsl:apply-templates>
774 <xsl:call-template name="make_indent">
775 <xsl:with-param name="current_indent" select="$current_indent"/>
777 <xsl:text>End Case</xsl:text> -->
780 <xsl:when test="$name='case_lhs'">
782 <xsl:when test="count(*)=2">
783 <xsl:apply-templates mode="inline" select="*[2]"/>
786 <xsl:text>(</xsl:text>
787 <xsl:apply-templates mode="inline" select="*[2]"/>
788 <xsl:for-each select="m:bvar">
789 <xsl:text> </xsl:text>
790 <xsl:apply-templates mode="inline" select="*[1]"/>
791 <xsl:text>:</xsl:text>
792 <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
794 <xsl:text>)</xsl:text>
799 <xsl:when test="$name='nat_ind_complete'">
800 <FONT color="red">By induction on </FONT>
801 <xsl:apply-templates select="*[2]"/>:
803 <xsl:call-template name="make_indent">
804 <xsl:with-param name="current_indent" select="$current_indent"/>
806 <xsl:text>0 </xsl:text>
807 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
808 <xsl:apply-templates select="*[3]">
809 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
810 </xsl:apply-templates>
812 <xsl:call-template name="make_indent">
813 <xsl:with-param name="current_indent" select="$current_indent"/>
815 <xsl:text>S(</xsl:text>
816 <xsl:apply-templates select="*[4]"/>
817 <xsl:text>) </xsl:text>
818 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
819 <FONT color="red">Assume by induction</FONT>
821 <xsl:call-template name="make_indent">
822 <xsl:with-param name="current_indent" select="$current_indent +10"/>
824 <xsl:text>(</xsl:text>
825 <xsl:apply-templates select="*[5]"/>
826 <xsl:text>)</xsl:text>
827 <xsl:apply-templates select="*[6]">
828 <xsl:with-param name="current_indent" select="$current_indent + 14"/>
829 </xsl:apply-templates>
831 <xsl:call-template name="make_indent">
832 <xsl:with-param name="current_indent" select="$current_indent +10"/>
834 <xsl:apply-templates select="*[7]">
835 <xsl:with-param name="current_indent" select="$current_indent + 10"/>
836 </xsl:apply-templates>
839 <xsl:when test="$name='false_ind'">
840 <xsl:apply-templates select="*[3]">
841 <xsl:with-param name="current_indent" select="$current_indent"/>
842 </xsl:apply-templates>
844 <xsl:call-template name="make_indent">
845 <xsl:with-param name="current_indent" select="$current_indent"/>
847 <FONT color="red">Contradiction.</FONT>
850 <xsl:when test="$name='and_ind'">
852 <xsl:when test="name(*[2])='m:apply'">
853 <xsl:apply-templates select="*[2]">
854 <xsl:with-param name="current_indent" select="$current_indent"/>
855 </xsl:apply-templates>
858 <FONT color="red">Consider </FONT>
859 <xsl:apply-templates select="*[2]"/>
863 <xsl:call-template name="make_indent">
864 <xsl:with-param name="current_indent" select="$current_indent"/>
866 <FONT color="red">In particular, we have</FONT>
868 <xsl:call-template name="make_indent">
869 <xsl:with-param name="current_indent" select="$current_indent"/>
872 <xsl:apply-templates select="*[3]"/>
874 <xsl:apply-templates select="*[4]">
875 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
876 </xsl:apply-templates>
878 <xsl:call-template name="make_indent">
879 <xsl:with-param name="current_indent" select="$current_indent"/>
882 <xsl:apply-templates select="*[5]"/>
884 <xsl:apply-templates select="*[6]">
885 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
886 </xsl:apply-templates>
888 <xsl:call-template name="make_indent">
889 <xsl:with-param name="current_indent" select="$current_indent"/>
891 <xsl:apply-templates select="*[7]">
892 <xsl:with-param name="current_indent" select="$current_indent"/>
893 </xsl:apply-templates>
896 <xsl:when test="$name='full_or_ind'">
898 <xsl:when test="name(*[2])='m:apply'">
899 <xsl:apply-templates select="*[2]">
900 <xsl:with-param name="current_indent" select="$current_indent"/>
901 </xsl:apply-templates>
904 <FONT color="red">Consider </FONT>
905 <xsl:apply-templates select="*[2]"/>
909 <xsl:call-template name="make_indent">
910 <xsl:with-param name="current_indent" select="$current_indent"/>
912 <FONT color="red">We proceed by cases to prove </FONT>
913 <xsl:apply-templates select="*[3]"/>
915 <xsl:call-template name="make_indent">
916 <xsl:with-param name="current_indent" select="$current_indent+4"/>
918 <FONT color="red">Left: suppose </FONT>
919 <xsl:text>(</xsl:text>
920 <xsl:value-of select="*[4]/m:bvar/m:ci"/>
921 <xsl:text>) </xsl:text>
923 select="*[4]/m:bvar/m:type/*[1]"/>
925 <xsl:call-template name="make_indent">
926 <xsl:with-param name="current_indent" select="$current_indent+15"/>
930 <xsl:with-param name="current_indent" select="$current_indent+15"/>
931 </xsl:apply-templates>
933 <xsl:call-template name="make_indent">
934 <xsl:with-param name="current_indent" select="$current_indent+4"/>
936 <FONT color="red">Right: suppose </FONT>
937 <xsl:text>(</xsl:text>
938 <xsl:value-of select="*[5]/m:bvar/m:ci"/>
939 <xsl:text>) </xsl:text>
941 select="*[5]/m:bvar/m:type/*[1]"/>
943 <xsl:call-template name="make_indent">
944 <xsl:with-param name="current_indent" select="$current_indent+16"/>
948 <xsl:with-param name="current_indent" select="$current_indent+16"/>
949 </xsl:apply-templates>
952 <xsl:when test="$name='or_ind'">
954 <xsl:when test="name(*[2])='m:apply'">
955 <xsl:apply-templates select="*[2]">
956 <xsl:with-param name="current_indent" select="$current_indent"/>
957 </xsl:apply-templates>
960 <FONT color="red">Consider </FONT>
961 <xsl:apply-templates select="*[2]"/>
965 <xsl:call-template name="make_indent">
966 <xsl:with-param name="current_indent" select="$current_indent"/>
968 <FONT color="red">We prove </FONT>
969 <xsl:apply-templates select="*[3]"/>
970 <FONT color="red"> by cases:</FONT>
972 <xsl:call-template name="make_indent">
973 <xsl:with-param name="current_indent" select="$current_indent"/>
976 <xsl:apply-templates select="*[4]">
977 <xsl:with-param name="current_indent" select="$current_indent"/>
978 </xsl:apply-templates>
980 <xsl:call-template name="make_indent">
981 <xsl:with-param name="current_indent" select="$current_indent"/>
984 <xsl:apply-templates select="*[5]">
985 <xsl:with-param name="current_indent" select="$current_indent"/>
986 </xsl:apply-templates>
989 <xsl:when test="$name='ex_ind'">
991 <xsl:when test="name(*[2])='m:apply'">
992 <xsl:apply-templates select="*[2]">
993 <xsl:with-param name="current_indent" select="$current_indent"/>
994 </xsl:apply-templates>
997 <FONT color="red">Consider </FONT>
998 <xsl:apply-templates select="*[2]">
999 <xsl:with-param name="current_indent" select="$current_indent"/>
1000 </xsl:apply-templates>
1004 <xsl:call-template name="make_indent">
1005 <xsl:with-param name="current_indent" select="$current_indent"/>
1006 </xsl:call-template>
1007 <FONT color="red">Let </FONT>
1008 <xsl:apply-templates mode="inline" select="*[3]"/>
1010 <xsl:apply-templates mode="inline" select="*[4]"/>
1011 <FONT color="red"> such that</FONT>
1013 <xsl:call-template name="make_indent">
1014 <xsl:with-param name="current_indent" select="$current_indent"/>
1015 </xsl:call-template>
1017 <xsl:apply-templates mode="inline" select="*[5]"/>
1019 <xsl:apply-templates select="*[6]">
1020 <xsl:with-param name="current_indent" select="$current_indent +7"/>
1021 </xsl:apply-templates>
1023 <xsl:call-template name="make_indent">
1024 <xsl:with-param name="current_indent" select="$current_indent"/>
1025 </xsl:call-template>
1026 <xsl:apply-templates select="*[7]">
1027 <xsl:with-param name="current_indent" select="$current_indent"/>
1028 </xsl:apply-templates>
1032 <xsl:when test="$name='interp'">
1033 <font color="green">[</font>
1034 <xsl:apply-templates select="*[2]"/>
1035 <font color="green">]</font>
1043 <xsl:template match="m:lambda">
1044 <xsl:param name="current_indent" select="0"/>
1045 <xsl:variable name="charlength">
1046 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
1047 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
1049 <!-- <xsl:value-of select="$charlength"/> -->
1050 <!-- <xsl:value-of select="$current_indent"/> -->
1052 <xsl:when test="$charlength > $framewidth">
1054 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
1055 <xsl:apply-templates select="m:bvar/m:ci"/>
1056 <xsl:text>:</xsl:text>
1057 <xsl:apply-templates select="m:bvar/m:type">
1058 <xsl:with-param name="current_indent"
1059 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
1060 </xsl:apply-templates><br/>
1061 <xsl:call-template name="make_indent">
1062 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1063 </xsl:call-template>
1064 <xsl:text>.</xsl:text>
1065 <xsl:apply-templates select="*[position()=2]">
1066 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1067 </xsl:apply-templates>
1070 <xsl:apply-templates mode="inline" select="."/>
1076 <xsl:template match="m:ci">
1078 <xsl:when test="boolean(@definitionURL)">
1079 <a href="{@definitionURL}">
1080 <xsl:apply-templates/>
1084 <xsl:value-of select="."/>
1091 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1092 <xsl:param name="incurrent_length" select="0"/>
1094 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
1095 <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>
1097 <xsl:when test="string($siblength) = """>
1098 <xsl:value-of select="$incurrent_length + string-length()"/>
1101 <xsl:value-of select="number($siblength)"/>
1106 <xsl:value-of select="$incurrent_length + string-length()"/>
1111 <xsl:template match="*" mode="charcount">
1112 <xsl:param name="incurrent_length" select="0"/>
1114 <xsl:when test="count(child::*) = 0">
1115 <xsl:value-of select="$incurrent_length"/>
1118 <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>
1120 <xsl:when test="$framewidth >= number($childlength)">
1121 <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>
1123 <xsl:when test="string($siblength) = """>
1124 <xsl:value-of select="number($childlength)"/>
1127 <xsl:value-of select="number($siblength)"/>
1132 <xsl:value-of select="number($childlength)"/>
1140 <!--***********************************************************************-->
1142 <!--***********************************************************************-->
1146 <xsl:template match="Definition">
1147 <xsl:param name="current_indent" select="0"/>
1149 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1151 <xsl:call-template name="make_indent">
1152 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1153 </xsl:call-template>
1154 <xsl:apply-templates select="type/*[1]">
1155 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1156 </xsl:apply-templates><br/>
1158 <xsl:call-template name="make_indent">
1159 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1160 </xsl:call-template>
1161 <xsl:apply-templates select="body/*[1]">
1162 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1163 </xsl:apply-templates>
1169 <xsl:template match="Axiom">
1170 <xsl:param name="current_indent" select="0"/>
1172 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1174 <xsl:call-template name="make_indent">
1175 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1176 </xsl:call-template>
1177 <xsl:apply-templates select="type/*[1]">
1178 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1179 </xsl:apply-templates>
1183 <!-- UNFINISHED PROOF -->
1185 <xsl:template match="CurrentProof">
1186 <xsl:param name="current_indent" select="0"/>
1188 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1189 THESIS: <xsl:apply-templates select="type/*[1]">
1190 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1191 </xsl:apply-templates><br/>
1193 <xsl:for-each select="Conjecture">
1195 <xsl:call-template name="make_indent">
1196 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1197 </xsl:call-template>
1198 <xsl:value-of select="./@no"/> :
1199 <xsl:apply-templates select="./*[1]">
1200 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
1201 </xsl:apply-templates>
1205 <xsl:apply-templates select="body/*[1]">
1206 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1207 </xsl:apply-templates>
1211 <!-- MUTUAL INDUCTIVE DEFINITION -->
1213 <xsl:template match="InductiveDefinition">
1214 <xsl:param name="current_indent" select="0"/>
1216 <xsl:for-each select="InductiveType">
1218 <xsl:when test="position() = 1">
1220 <xsl:when test="string(./@inductive) = "true"">
1221 INDUCTIVE DEFINITION
1224 COINDUCTIVE DEFINITION
1232 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
1234 <xsl:if test="string(../Param) != """>
1235 <xsl:for-each select="../Param">
1236 <xsl:value-of select="./@name"/>
1238 <xsl:apply-templates select="*"/>
1243 <xsl:apply-templates select="./arity/*[1]">
1244 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1245 </xsl:apply-templates> <br/>
1247 <xsl:for-each select="./Constructor">
1249 <xsl:call-template name="make_indent">
1250 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1251 </xsl:call-template>
1253 <xsl:when test="position() = 1">
1254 <xsl:text>  </xsl:text>
1257 <xsl:text>| </xsl:text>
1260 <xsl:value-of select="./@name"/>
1261 <xsl:text>: </xsl:text>
1262 <xsl:apply-templates select="./*[1]">
1263 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
1264 </xsl:apply-templates>
1272 <xsl:template match="Variable">
1273 <xsl:param name="current_indent" select="0"/>
1275 VARIABLE <xsl:value-of select="@name"/><br/>
1276 TYPE = <xsl:apply-templates select="type/*[1]">
1277 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1278 </xsl:apply-templates>
1282 <!--***********************************************************************-->
1284 <!--***********************************************************************-->
1288 <xsl:template match="SECTION">
1289 <xsl:param name="current_indent" select="0"/>
1290 <h1>BEGIN OF SECTION</h1>
1291 <xsl:apply-templates/>
1292 <h1>END OF SECTION</h1>