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="''"/>
36 <xsl:param name="type" select="'standalone'"/>
37 <xsl:param name="UNICODEvsSYMBOL" select="'symbol'"/>
39 <xsl:include href="html_init.xsl"/>
40 <xsl:include href="html_set.xsl"/>
41 <xsl:include href="html_reals.xsl"/>
43 <xsl:variable name="showcast" select="0"/>
45 <!--***********************************************************************-->
46 <!-- HTML Head and Body -->
47 <!--***********************************************************************-->
49 <!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
51 <!-- document needs method="xml" and searches locally for the dtd if -->
52 <!-- doctype-system is specified (the dtd must exist locally for parsing). -->
53 <!-- For having output html must be media-type="html" and for having the -->
54 <!-- correct <br /> you must specify at least the remote dtd by means of -->
55 <!-- doctype-public -->
59 media-type="text/html"
60 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
62 <xsl:variable name="framewidth" select="45"/>
64 <xsl:template name="mksymbol-1">
65 <xsl:param name="symbol" select="''"/>
66 <xsl:param name="color" select="''"/>
67 <xsl:param name="size" select="''"/>
69 <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
70 <xsl:variable name="fontsymbol">
72 <xsl:when test="$symbol = 'forall'">
73 <xsl:value-of select="'"'"/>
75 <xsl:when test="$symbol = 'lambda'">
76 <xsl:value-of select="'l'"/>
78 <xsl:when test="$symbol = 'prod'">
79 <xsl:value-of select="'Õ'"/>
81 <xsl:when test="$symbol = 'arrow'">
82 <xsl:value-of select="'®'"/>
84 <xsl:when test="$symbol = 'RightArrow'">
85 <xsl:value-of select="'Þ'"/>
87 <xsl:when test="$symbol = 'subst'">
88 <xsl:value-of select="'¬'"/>
90 <xsl:when test="$symbol = 'lift' or $symbol = 'lift_with_base'">
91 <xsl:value-of select="'­'"/>
93 <xsl:when test="$symbol = 'beta_red' or $symbol = 'beta_red1'">
94 <xsl:value-of select="'®'"/>
96 <xsl:when test="$symbol = 'beta'">
97 <xsl:value-of select="'b'"/>
99 <xsl:when test="$symbol = 'par_beta_red' or $symbol = 'par_beta_red1'">
100 <xsl:value-of select="'Þ'"/>
102 <xsl:when test="$symbol = 'isomorphic'">
103 <xsl:value-of select="'@'"/>
106 <xsl:text>???</xsl:text>
110 <FONT FACE="symbol" SIZE="{$size}" color="{$color}">
111 <xsl:value-of select="$fontsymbol"/>
115 <xsl:variable name="unicodesymbol">
117 <xsl:when test="$symbol = 'forall'">
118 <xsl:value-of select="'∀'"/>
120 <xsl:when test="$symbol = 'lambda'">
121 <xsl:value-of select="'λ'"/>
123 <xsl:when test="$symbol = 'prod'">
124 <xsl:value-of select="'Π'"/>
126 <xsl:when test="$symbol = 'arrow'">
127 <xsl:value-of select="'→'"/>
129 <xsl:when test="$symbol = 'RightArrow'">
130 <xsl:value-of select="'⇒'"/>
132 <xsl:when test="$symbol = 'subst'">
133 <xsl:value-of select="'←'"/>
135 <xsl:when test="$symbol = 'lift' or $symbol = 'lift_with_base'">
136 <xsl:value-of select="'↑'"/>
138 <xsl:when test="$symbol = 'beta_red' or $symbol = 'beta_red1'">
139 <xsl:value-of select="'→'"/>
141 <xsl:when test="$symbol = 'beta'">
142 <xsl:value-of select="'β'"/>
144 <xsl:when test="$symbol = 'par_beta_red' or $symbol = 'par_beta_red1'">
145 <xsl:value-of select="'⇒'"/>
147 <xsl:when test="$symbol = 'isomorphic'">
148 <xsl:value-of select="'≅'"/>
151 <xsl:text>???</xsl:text>
155 <FONT color="{$color}">
156 <xsl:value-of select="$unicodesymbol"/>
162 <xsl:template match="/">
163 <xsl:param name="current_indent" select="0"/>
165 <xsl:when test="$type = 'standalone'">
168 <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
169 <style> A { text-decoration: none } </style>
171 <xsl:text disable-output-escaping="yes">
173 function Hide(which){
174 if (!document.getElementById)
176 which.style.display="none"
179 function Show(which){
180 if (!document.getElementById)
182 which.style.display=""
185 document.to_be_deleted = new Array();
190 <body bgcolor="white">
191 <xsl:attribute name="onLoad">
192 if(document.getElementById)
193 for(var i=0;i<document.to_be_deleted.length;i++)
194 Hide(document.getElementById(document.to_be_deleted[i]));
196 <xsl:apply-templates>
197 <xsl:with-param name="current_indent" select="0"/>
198 </xsl:apply-templates>
204 <xsl:apply-templates>
205 <xsl:with-param name="current_indent" select="0"/>
206 </xsl:apply-templates>
212 <!--***********************************************************************-->
214 <!--***********************************************************************-->
216 <xsl:template name="make_indent">
217 <xsl:param name="current_indent" select="0"/>
218 <xsl:if test="$current_indent > 0">
219 <xsl:text> </xsl:text>
220 <xsl:call-template name="make_indent">
221 <xsl:with-param name="current_indent" select="$current_indent - 1"/>
226 <!-- Syntactic Sugar -->
227 <xsl:template match="m:type">
228 <xsl:param name="current_indent" select="0"/>
229 <xsl:apply-templates>
230 <xsl:with-param name="current_indent"
231 select="$current_indent"/>
232 </xsl:apply-templates>
235 <xsl:template match="m:condition">
236 <xsl:param name="current_indent" select="0"/>
237 <xsl:apply-templates>
238 <xsl:with-param name="current_indent"
239 select="$current_indent"/>
240 </xsl:apply-templates>
243 <xsl:template match="m:math">
244 <xsl:param name="current_indent" select="0"/>
245 <xsl:apply-templates>
246 <xsl:with-param name="current_indent"
247 select="$current_indent"/>
248 </xsl:apply-templates>
251 <!--*********************************************************************-->
253 <!--*********************************************************************-->
256 <xsl:template mode="inline" match="m:ci">
258 <xsl:when test="boolean(@definitionURL)">
259 <a href="{@definitionURL}">
260 <xsl:apply-templates/>
264 <xsl:value-of select="."/>
271 <xsl:template match="m:apply[m:csymbol]" mode="inline">
272 <xsl:variable name="name">
273 <xsl:value-of select="m:csymbol"/>
275 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
278 <xsl:when test="$name='forall'">
279 <xsl:call-template name="mksymbol-1">
280 <xsl:with-param name="symbol" select="$name"/>
281 <xsl:with-param name="color" select="'blue'"/>
282 <xsl:with-param name="size" select="'+2'"/>
284 <xsl:apply-templates select="m:bvar/m:ci"/>
285 <xsl:text>:</xsl:text>
286 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
287 <xsl:text>.</xsl:text>
288 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
290 <xsl:when test="$name='prod'">
291 <xsl:call-template name="mksymbol-1">
292 <xsl:with-param name="symbol" select="$name"/>
293 <xsl:with-param name="color" select="'blue'"/>
294 <xsl:with-param name="size" select="'+2'"/>
296 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
297 <xsl:text>:</xsl:text>
298 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
299 <xsl:text>.</xsl:text>
300 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
303 <xsl:when test="$name='arrow'">
304 <xsl:text>(</xsl:text>
305 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
306 <xsl:call-template name="mksymbol-1">
307 <xsl:with-param name="symbol" select="$name"/>
308 <xsl:with-param name="color" select="'blue'"/>
309 <xsl:with-param name="size" select="'+0'"/>
311 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
312 <xsl:text>)</xsl:text>
315 <xsl:when test="$name='app'">
316 <xsl:text>(</xsl:text>
317 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
318 <xsl:for-each select="*[position()>2]">
319 <xsl:text> </xsl:text>
320 <xsl:apply-templates mode="inline" select="."/>
322 <xsl:text>)</xsl:text>
325 <xsl:when test="$name='cast'">
326 <xsl:text>(</xsl:text>
327 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
328 <xsl:text>:></xsl:text>
329 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
330 <xsl:text>)</xsl:text>
332 <xsl:when test="$name='Prop'">
333 <FONT color="violet">Prop</FONT>
335 <xsl:when test="$name='Set'">
336 <FONT color="violet">Set</FONT>
338 <xsl:when test="$name='Type'">
339 <FONT color="violet">Type</FONT>
342 <xsl:when test="$name='mutcase'">
343 <xsl:text><</xsl:text>
344 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
345 <xsl:text>> </xsl:text>
346 <FONT color="red">CASE </FONT>
347 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
348 <FONT color="red"> OF </FONT>
349 <xsl:for-each select="piecewise/piece">
350 <!--<xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
352 <xsl:when test="not(position() = 1)">
353 <xsl:text> | </xsl:text>
356 <xsl:apply-templates mode="inline" select="./*[2]"/>
357 <xsl:call-template name="mksymbol-1">
358 <xsl:with-param name="symbol" select="'RightArrow'"/>
359 <xsl:with-param name="color" select="'green'"/>
360 <xsl:with-param name="size" select="'+0'"/>
362 <xsl:apply-templates mode="inline"
367 <xsl:when test="$name='fix'">
368 <FONT color="red">FIX</FONT>
369 <xsl:value-of select="m:ci"/>
370 <xsl:text>{</xsl:text>
371 <xsl:for-each select="m:bvar">
372 <xsl:value-of select="m:ci"/>
373 <xsl:text>:</xsl:text>
374 <xsl:apply-templates mode="inline" select="m:type"/>
375 <xsl:text>:=</xsl:text>
376 <xsl:apply-templates mode="inline"
377 select="following-sibling::*[position() = 1]"/>
379 <xsl:when test="position()=last()">
380 <xsl:text>}</xsl:text>
383 <xsl:text>;</xsl:text>
389 <xsl:when test="$name='cofix'">
390 <xsl:text>COFIX</xsl:text>
391 <xsl:value-of select="m:ci"/>
392 <xsl:text>{</xsl:text>
393 <xsl:for-each select="m:bvar">
394 <xsl:value-of select="m:ci"/>
395 <xsl:text>:</xsl:text>
396 <xsl:apply-templates mode="inline" select="m:type"/>
397 <xsl:text>:=</xsl:text>
398 <xsl:apply-templates mode="inline"
399 select="following-sibling::*[position() = 1]"/>
401 <xsl:when test="position()=last()">
402 <xsl:text>}</xsl:text>
405 <xsl:text>;</xsl:text>
411 <xsl:when test="$name='proof'">
412 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
413 <FONT color="red"> proves </FONT>
414 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
417 <xsl:when test="$name='false_ind'">
418 <xsl:apply-templates mode="inline" select="*[3]"/>
419 <FONT color="red">Contradiction.</FONT>
422 <xsl:when test="$name='and_ind'">
423 <FONT color="red">From </FONT>
424 <xsl:apply-templates select="*[2]"/>
425 <FONT color="red"> we get</FONT>
427 <xsl:apply-templates select="*[3]"/>
429 <xsl:apply-templates mode="inline" select="*[4]"/>
430 <FONT color="red"> and </FONT>
432 <xsl:apply-templates select="*[5]"/>
434 <xsl:apply-templates mode="inline" select="*[6]"/>
436 <FONT color="red"> hence </FONT>
437 <xsl:apply-templates mode="inline" select="*[7]"/>
440 <xsl:when test="$name='subst'">
441 <xsl:apply-templates select="*[3]" mode="inline"/>
442 <xsl:text>[</xsl:text>
443 <xsl:apply-templates select="*[4]" mode="inline"/>
445 <xsl:when test="$uri != ''">
447 <xsl:call-template name="mksymbol-1">
448 <xsl:with-param name="symbol" select="$name"/>
449 <xsl:with-param name="color" select="'green'"/>
450 <xsl:with-param name="size" select="'+0'"/>
455 <xsl:call-template name="mksymbol-1">
456 <xsl:with-param name="symbol" select="$name"/>
457 <xsl:with-param name="color" select="'green'"/>
458 <xsl:with-param name="size" select="'+0'"/>
462 <xsl:apply-templates select="*[2]" mode="inline"/>
463 <xsl:text>]</xsl:text>
466 <xsl:when test="$name='lift_with_base'">
468 <xsl:apply-templates select="*[3]" mode="inline"/>
471 <xsl:when test="$uri != ''">
473 <xsl:call-template name="mksymbol-1">
474 <xsl:with-param name="symbol" select="$name"/>
475 <xsl:with-param name="color" select="'green'"/>
476 <xsl:with-param name="size" select="'+0'"/>
481 <xsl:call-template name="mksymbol-1">
482 <xsl:with-param name="symbol" select="$name"/>
483 <xsl:with-param name="color" select="'green'"/>
484 <xsl:with-param name="size" select="'+0'"/>
489 <xsl:apply-templates select="*[4]" mode="inline"/>
491 <xsl:text>(</xsl:text>
492 <xsl:apply-templates select="*[2]" mode="inline"/>
493 <xsl:text>)</xsl:text>
496 <xsl:when test="$name='lift'">
498 <xsl:when test="$uri != ''">
500 <xsl:call-template name="mksymbol-1">
501 <xsl:with-param name="symbol" select="$name"/>
502 <xsl:with-param name="color" select="'green'"/>
503 <xsl:with-param name="size" select="'+0'"/>
508 <xsl:call-template name="mksymbol-1">
509 <xsl:with-param name="symbol" select="$name"/>
510 <xsl:with-param name="color" select="'green'"/>
511 <xsl:with-param name="size" select="'+0'"/>
516 <xsl:apply-templates select="*[2]" mode="inline"/>
518 <xsl:text>(</xsl:text>
519 <xsl:apply-templates select="*[3]" mode="inline"/>
520 <xsl:text>)</xsl:text>
524 <xsl:when test="$name='beta_red1'">
525 <xsl:apply-templates select="*[2]" mode="inline"/>
527 <xsl:when test="$uri != ''">
529 <xsl:call-template name="mksymbol-1">
530 <xsl:with-param name="symbol" select="$name"/>
531 <xsl:with-param name="color" select="'green'"/>
532 <xsl:with-param name="size" select="'+0'"/>
535 <xsl:call-template name="mksymbol-1">
536 <xsl:with-param name="symbol" select="'beta'"/>
537 <xsl:with-param name="color" select="'green'"/>
538 <xsl:with-param name="size" select="'+0'"/>
544 <xsl:call-template name="mksymbol-1">
545 <xsl:with-param name="symbol" select="$name"/>
546 <xsl:with-param name="color" select="'green'"/>
547 <xsl:with-param name="size" select="'+0'"/>
550 <xsl:call-template name="mksymbol-1">
551 <xsl:with-param name="symbol" select="'beta'"/>
552 <xsl:with-param name="color" select="'green'"/>
553 <xsl:with-param name="size" select="'+0'"/>
558 <xsl:apply-templates select="*[3]" mode="inline"/>
561 <xsl:when test="$name='beta_red'">
562 <xsl:apply-templates select="*[2]" mode="inline"/>
564 <xsl:when test="$uri != ''">
566 <xsl:call-template name="mksymbol-1">
567 <xsl:with-param name="symbol" select="$name"/>
568 <xsl:with-param name="color" select="'green'"/>
569 <xsl:with-param name="size" select="'+0'"/>
572 <xsl:call-template name="mksymbol-1">
573 <xsl:with-param name="symbol" select="'beta'"/>
574 <xsl:with-param name="color" select="'green'"/>
575 <xsl:with-param name="size" select="'+0'"/>
577 <xsl:text>*</xsl:text>
582 <xsl:call-template name="mksymbol-1">
583 <xsl:with-param name="symbol" select="$name"/>
584 <xsl:with-param name="color" select="'green'"/>
585 <xsl:with-param name="size" select="'+0'"/>
588 <xsl:call-template name="mksymbol-1">
589 <xsl:with-param name="symbol" select="'beta'"/>
590 <xsl:with-param name="color" select="'green'"/>
591 <xsl:with-param name="size" select="'+0'"/>
593 <xsl:text>*</xsl:text>
597 <xsl:apply-templates select="*[3]" mode="inline"/>
600 <xsl:when test="$name='par_beta_red1'">
601 <xsl:apply-templates select="*[2]" mode="inline"/>
603 <xsl:when test="$uri != ''">
605 <xsl:call-template name="mksymbol-1">
606 <xsl:with-param name="symbol" select="$name"/>
607 <xsl:with-param name="color" select="'green'"/>
608 <xsl:with-param name="size" select="'+0'"/>
611 <xsl:call-template name="mksymbol-1">
612 <xsl:with-param name="symbol" select="'beta'"/>
613 <xsl:with-param name="color" select="'green'"/>
614 <xsl:with-param name="size" select="'+0'"/>
620 <xsl:call-template name="mksymbol-1">
621 <xsl:with-param name="symbol" select="$name"/>
622 <xsl:with-param name="color" select="'green'"/>
623 <xsl:with-param name="size" select="'+0'"/>
626 <xsl:call-template name="mksymbol-1">
627 <xsl:with-param name="symbol" select="'beta'"/>
628 <xsl:with-param name="color" select="'green'"/>
629 <xsl:with-param name="size" select="'+0'"/>
634 <xsl:apply-templates select="*[3]" mode="inline"/>
637 <xsl:when test="$name='par_beta_red'">
638 <xsl:apply-templates select="*[2]" mode="inline"/>
640 <xsl:when test="$uri != ''">
642 <xsl:call-template name="mksymbol-1">
643 <xsl:with-param name="symbol" select="$name"/>
644 <xsl:with-param name="color" select="'green'"/>
645 <xsl:with-param name="size" select="'+0'"/>
648 <xsl:call-template name="mksymbol-1">
649 <xsl:with-param name="symbol" select="'beta'"/>
650 <xsl:with-param name="color" select="'green'"/>
651 <xsl:with-param name="size" select="'+0'"/>
653 <xsl:text>*</xsl:text>
658 <xsl:call-template name="mksymbol-1">
659 <xsl:with-param name="symbol" select="$name"/>
660 <xsl:with-param name="color" select="'green'"/>
661 <xsl:with-param name="size" select="'+0'"/>
664 <xsl:call-template name="mksymbol-1">
665 <xsl:with-param name="symbol" select="'beta'"/>
666 <xsl:with-param name="color" select="'green'"/>
667 <xsl:with-param name="size" select="'+0'"/>
669 <xsl:text>*</xsl:text>
673 <xsl:apply-templates select="*[3]" mode="inline"/>
677 <xsl:when test="$name='forgetful'">
679 <xsl:when test="$uri != ''">
680 <a href="{$uri}">|</a>
686 <xsl:apply-templates select="*[2]" mode="inline"/>
688 <xsl:when test="$uri != ''">
689 <a href="{$uri}">|</a>
697 <!-- boolean algebra of redexes -->
700 <xsl:when test="$name='isomorphic'">
701 <xsl:apply-templates select="*[2]" mode="inline"/>
703 <xsl:when test="$uri != ''">
705 <xsl:call-template name="mksymbol-1">
706 <xsl:with-param name="symbol" select="$name"/>
707 <xsl:with-param name="color" select="'green'"/>
708 <xsl:with-param name="size" select="'+0'"/>
713 <xsl:call-template name="mksymbol-1">
714 <xsl:with-param name="symbol" select="$name"/>
715 <xsl:with-param name="color" select="'green'"/>
716 <xsl:with-param name="size" select="'+0'"/>
720 <xsl:apply-templates select="*[3]" mode="inline"/>
724 <xsl:when test="$name='interp'">
725 <font color="green">[</font>
726 <xsl:apply-templates select="*[2]"/>
727 <font color="green">]</font>
733 <xsl:template mode="inline" match="m:lambda">
734 <xsl:call-template name="mksymbol-1">
735 <xsl:with-param name="symbol" select="'lambda'"/>
736 <xsl:with-param name="color" select="'red'"/>
737 <xsl:with-param name="size" select="'+2'"/>
739 <xsl:apply-templates select="m:bvar/m:ci"/>
740 <xsl:text>:</xsl:text>
741 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
742 <xsl:text>.</xsl:text>
743 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
746 <!--*********************************************************************-->
747 <!-- COUNTING MODE -->
748 <!--*********************************************************************-->
750 <xsl:template match="m:apply[m:csymbol]">
751 <xsl:param name="current_indent" select="0"/>
752 <xsl:param name="width" select="$framewidth"/>
753 <xsl:variable name="name">
754 <xsl:value-of select="m:csymbol"/>
756 <xsl:variable name="charlength">
757 <xsl:apply-templates select="m:csymbol" mode="charcount"/>
759 <!-- <xsl:value-of select="$current_indent"/> -->
760 <!-- <xsl:value-of select="$charlength"/> -->
761 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
764 <xsl:when test="$name='forall'">
766 <xsl:when test="$charlength > $framewidth">
768 <xsl:call-template name="mksymbol-1">
769 <xsl:with-param name="symbol" select="$name"/>
770 <xsl:with-param name="color" select="'blue'"/>
771 <xsl:with-param name="size" select="'+2'"/>
773 <xsl:apply-templates select="m:bvar/m:ci"/>
774 <xsl:text>:</xsl:text>
775 <xsl:apply-templates select="m:bvar/m:type">
776 <xsl:with-param name="current_indent"
777 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
778 </xsl:apply-templates>
780 <xsl:call-template name="make_indent">
781 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
783 <xsl:text>.</xsl:text>
784 <xsl:apply-templates select="*[position()=3]">
785 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
786 </xsl:apply-templates>
789 <xsl:apply-templates mode="inline" select="."/>
794 <xsl:when test="$name='prod'">
796 <xsl:when test="$charlength > $framewidth">
797 <xsl:call-template name="mksymbol-1">
798 <xsl:with-param name="symbol" select="$name"/>
799 <xsl:with-param name="color" select="'blue'"/>
800 <xsl:with-param name="size" select="'+2'"/>
802 <xsl:apply-templates select="m:bvar/m:ci"/>
803 <xsl:text>:</xsl:text>
804 <xsl:apply-templates select="m:bvar/m:type">
805 <xsl:with-param name="current_indent"
806 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
807 </xsl:apply-templates><br/>
808 <xsl:call-template name="make_indent">
809 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
811 <xsl:text>.</xsl:text>
812 <xsl:apply-templates select="*[position()=3]">
813 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
814 </xsl:apply-templates>
817 <xsl:apply-templates mode="inline" select="."/>
822 <xsl:when test="$name='arrow'">
824 <xsl:when test="$charlength > $framewidth">
825 <xsl:text>(</xsl:text>
826 <xsl:apply-templates select="*[position()=2]">
827 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
828 </xsl:apply-templates>
830 <xsl:call-template name="make_indent">
831 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
834 <xsl:call-template name="mksymbol-1">
835 <xsl:with-param name="symbol" select="$name"/>
836 <xsl:with-param name="color" select="'blue'"/>
837 <xsl:with-param name="size" select="'+0'"/>
839 <xsl:apply-templates select="*[position()=3]">
840 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
841 </xsl:apply-templates>
842 <xsl:text>)</xsl:text>
845 <xsl:apply-templates mode="inline" select="."/>
850 <xsl:when test="$name='app'">
852 <xsl:when test="$charlength > $framewidth">
853 <xsl:text>(</xsl:text>
854 <xsl:apply-templates select="*[position()=2]">
855 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
856 </xsl:apply-templates>
857 <xsl:for-each select="*[position()>2]">
859 <xsl:call-template name="make_indent">
860 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
862 <xsl:apply-templates select=".">
863 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
864 </xsl:apply-templates>
866 <xsl:text>)</xsl:text>
869 <xsl:apply-templates mode="inline" select="."/>
873 <xsl:when test="$name='cast'">
875 <xsl:when test="$showcast = 1">
877 <xsl:when test="$charlength > $framewidth">
878 <xsl:text>(</xsl:text>
879 <xsl:apply-templates select="*[position()=2]">
880 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
881 </xsl:apply-templates><br/>
882 <xsl:call-template name="make_indent">
883 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
884 <xsl:text>:></xsl:text>
885 <xsl:apply-templates select="*[position()=3]">
886 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
887 </xsl:apply-templates>
888 <xsl:text>)</xsl:text>
891 <xsl:apply-templates mode="inline" select="."/>
896 <xsl:apply-templates select="*[position()=2]">
897 <xsl:with-param name="current_indent" select="$current_indent"/>
898 </xsl:apply-templates>
902 <xsl:when test="$name='Prop'">
903 <xsl:text>Prop</xsl:text>
905 <xsl:when test="$name='Set'">
906 <xsl:text>Set</xsl:text>
908 <xsl:when test="$name='Type'">
909 <xsl:text>Type</xsl:text>
911 <xsl:when test="$name='mutcase'">
913 <xsl:when test="$charlength > $framewidth">
914 <xsl:text><</xsl:text>
915 <xsl:apply-templates select="*[position()=2]">
916 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
917 </xsl:apply-templates>
918 <xsl:text>> </xsl:text>
920 <xsl:call-template name="make_indent">
921 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
922 <xsl:text>CASE </xsl:text>
923 <xsl:apply-templates select="*[position()=3]">
924 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
925 </xsl:apply-templates>
926 <xsl:text> OF </xsl:text>
927 <xsl:for-each select="piecewise/piece">
928 <!-- <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
930 <xsl:call-template name="make_indent">
931 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
934 <xsl:when test="position() = 1">
935 <xsl:text>  </xsl:text>
938 <xsl:text>| </xsl:text>
941 <xsl:apply-templates select="./*[2]"/>
942 <xsl:call-template name="mksymbol-1">
943 <xsl:with-param name="symbol" select="'RightArrow'"/>
944 <xsl:with-param name="color" select="'green'"/>
945 <xsl:with-param name="size" select="'+0'"/>
947 <xsl:variable name="body_size">
949 select="./*[1]/*[1]" mode="charcount"/>
952 <xsl:when test="$body_size > $framewidth">
954 <xsl:call-template name="make_indent">
955 <xsl:with-param name="current_indent"
956 select="$current_indent + 8"/>
960 <xsl:with-param name="current_indent"
961 select="$current_indent + 8"/>
962 </xsl:apply-templates>
965 <xsl:apply-templates select="./*[1]"
972 <xsl:apply-templates mode="inline" select="."/>
977 <xsl:when test="$name='fix'">
979 <xsl:when test="$charlength > $framewidth">
980 <xsl:text>FIX</xsl:text>
981 <xsl:value-of select="m:ci"/>
982 <xsl:text>{</xsl:text>
983 <xsl:for-each select="m:bvar">
985 <xsl:call-template name="make_indent">
986 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
988 <xsl:value-of select="m:ci"/>
989 <xsl:text>:</xsl:text>
990 <xsl:apply-templates select="m:type">
991 <xsl:with-param name="current_indent"
992 select="$current_indent + 5 + string-length(m:ci)"/>
993 </xsl:apply-templates>
995 <xsl:call-template name="make_indent">
996 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
998 <xsl:text>:=</xsl:text>
999 <xsl:apply-templates select="following-sibling::*[position() = 1]">
1000 <xsl:with-param name="current_indent" select="$current_indent +2"/>
1001 </xsl:apply-templates>
1004 <xsl:call-template name="make_indent">
1005 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1006 </xsl:call-template>
1007 <xsl:text>}</xsl:text>
1010 <xsl:apply-templates mode="inline" select="."/>
1015 <xsl:when test="$name='cofix'">
1017 <xsl:when test="($charlength + 10) > $framewidth">
1018 <xsl:text>COFIX</xsl:text>
1019 <xsl:value-of select="m:ci"/>
1020 <xsl:text>{</xsl:text>
1022 <xsl:call-template name="make_indent">
1023 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1024 </xsl:call-template>
1025 <xsl:for-each select="m:bvar">
1026 <xsl:value-of select="m:ci"/>
1027 <xsl:text>:</xsl:text>
1028 <xsl:apply-templates select="m:type">
1029 <xsl:with-param name="current_indent"
1030 select="$current_indent + 5 + string-length(m:ci)"/>
1031 </xsl:apply-templates>
1033 <xsl:call-template name="make_indent">
1034 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1035 </xsl:call-template>
1036 <xsl:text>:=</xsl:text>
1037 <xsl:apply-templates select="following-sibling::*[position() = 1]">
1038 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1039 </xsl:apply-templates>
1043 <xsl:call-template name="make_indent">
1044 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1045 </xsl:call-template>
1046 <xsl:text>}</xsl:text>
1049 <xsl:apply-templates mode="inline" select="m:type"/>
1053 <xsl:when test="$name='let_in'">
1054 <xsl:text>let </xsl:text>
1055 <xsl:apply-templates select="m:bvar/m:ci"/>
1056 <xsl:text> := </xsl:text>
1057 <xsl:apply-templates select="*[3]">
1058 <xsl:with-param name="current_indent" select="$current_indent+14"/>
1059 </xsl:apply-templates>
1061 <xsl:call-template name="make_indent">
1062 <xsl:with-param name="current_indent" select="$current_indent"/>
1063 </xsl:call-template>
1064 <xsl:text>in </xsl:text>
1065 <xsl:apply-templates select="*[4]">
1066 <xsl:with-param name="current_indent" select="$current_indent+5"/>
1067 </xsl:apply-templates>
1070 <!-- ***************************************** -->
1071 <!-- *********** PROOF ELEMENTS ************** -->
1072 <!-- ***************************************** -->
1074 <xsl:when test="$name='proof'">
1075 <xsl:variable name="nonce" select="generate-id()"/>
1076 <xsl:variable name="freshid1" select="concat('a',$nonce)"/>
1077 <xsl:variable name="freshid2" select="concat('b',$nonce)"/>
1078 <xsl:variable name="freshid3" select="concat('c',$nonce)"/>
1079 <span ID="{$freshid1}">
1080 <xsl:apply-templates select="*[position()=2]">
1081 <xsl:with-param name="current_indent" select="$current_indent"/>
1082 </xsl:apply-templates>
1086 <xsl:when test="preceding-sibling::*[1]/text()='letin1'">
1088 <xsl:call-template name="make_indent">
1089 <xsl:with-param name="current_indent" select="$current_indent"/>
1090 </xsl:call-template>
1091 <FONT color="red">we proved </FONT>
1095 if(document.getElementById) {
1097 <span ID="{$freshid2}">\
1098 <a style="text-decoration:underline ; color:green" href="" onClick="Show(document.getElementById(\'{$freshid1}\')); Hide(document.getElementById(\'{$freshid2}\'));Show(document.getElementById(\'{$freshid3}\'));return (0==1);">Proof of</a>\
1100 <span ID="{$freshid3}">\
1102 <xsl:call-template name="make_indent">
1103 <xsl:with-param name="current_indent" select="$current_indent"/>
1104 </xsl:call-template>\
1105 <a style="text-decoration:underline ; color:red" href="" onClick="Hide(document.getElementById(\'{$freshid1}\')); Show(document.getElementById(\'{$freshid2}\'));Hide(document.getElementById(\'{$freshid3}\'));return (0==1);">we proved</a>\
1108 document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
1109 document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
1110 document.write(' ');
1114 <xsl:call-template name="make_indent">
1115 <xsl:with-param name="current_indent" select="$current_indent"/>
1116 </xsl:call-template>\
1117 <FONT color="red">we proved </FONT>\
1123 <xsl:apply-templates select="*[position()=3]">
1124 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
1125 </xsl:apply-templates>
1128 <xsl:when test="$name='letin1'">
1129 <xsl:apply-templates select="*[position()=2]">
1130 <xsl:with-param name="current_indent" select="$current_indent"/>
1131 </xsl:apply-templates>
1133 <xsl:call-template name="make_indent">
1134 <xsl:with-param name="current_indent" select="$current_indent"/>
1135 </xsl:call-template>
1136 <xsl:apply-templates select="*[position()=3]">
1137 <xsl:with-param name="current_indent" select="$current_indent"/>
1138 </xsl:apply-templates>
1141 <xsl:when test="$name='letin'">
1142 <xsl:for-each select="*[position()>1 and last()>position()]">
1143 <xsl:apply-templates select=".">
1144 <xsl:with-param name="current_indent" select="$current_indent"/>
1145 </xsl:apply-templates>
1147 <xsl:call-template name="make_indent">
1148 <xsl:with-param name="current_indent" select="$current_indent"/>
1149 </xsl:call-template>
1151 <xsl:apply-templates select="*[position()=last()]">
1152 <xsl:with-param name="current_indent" select="$current_indent"/>
1153 </xsl:apply-templates>
1156 <xsl:when test="$name='let'">
1158 <xsl:apply-templates select="m:ci"/>
1160 <xsl:apply-templates select="*[3]">
1161 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1162 </xsl:apply-templates>
1165 <xsl:when test="$name='rw_step'">
1167 <xsl:when test="name(*[2])='m:apply'">
1168 <xsl:apply-templates select="*[2]">
1169 <xsl:with-param name="current_indent" select="$current_indent"/>
1170 </xsl:apply-templates>
1173 <FONT color="red">Consider </FONT>
1174 <xsl:apply-templates select="*[2]"/>
1177 <xsl:variable name="charlength_first">
1178 <xsl:apply-templates select="*[3]/*[1]" mode="charcount"/>
1180 <xsl:variable name="charlength_second">
1181 <xsl:apply-templates select="*[4]/*[1]" mode="charcount"/>
1183 <xsl:variable name="charlength_side_proof">
1184 <xsl:apply-templates select="*[5]/*[1]" mode="charcount"/>
1186 <xsl:variable name="split1"
1187 select="$charlength_first + $charlength_second > $framewidth"/>
1188 <xsl:variable name="split2"
1189 select="$charlength_second + $charlength_side_proof > $framewidth"/>
1190 <!-- <xsl:value-of select="$current_indent"/> -->
1191 <!-- <xsl:value-of select="$charlength"/> -->
1193 <xsl:call-template name="make_indent">
1194 <xsl:with-param name="current_indent" select="$current_indent"/>
1195 </xsl:call-template>
1196 <FONT color="red">Rewrite </FONT>
1197 <xsl:apply-templates mode="inline" select="*[3]"/>
1198 <xsl:text> </xsl:text>
1199 <xsl:if test="$split1">
1201 <xsl:call-template name="make_indent">
1202 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1203 </xsl:call-template>
1205 <FONT color="red">with </FONT>
1206 <xsl:apply-templates mode="inline" select="*[4]"/>
1207 <xsl:text> </xsl:text>
1208 <xsl:if test="$split2">
1210 <xsl:call-template name="make_indent">
1211 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1212 </xsl:call-template>
1214 <FONT color="red">by </FONT>
1215 <xsl:apply-templates select="*[5]">
1216 <xsl:with-param name="current_indent" select="$current_indent+7"/>
1217 </xsl:apply-templates>
1219 <!-- rewrite and apply -->
1220 <xsl:when test="$name='rewrite_and_apply'">
1221 <xsl:apply-templates select="*[2]">
1222 <xsl:with-param name="current_indent" select="$current_indent"/>
1223 </xsl:apply-templates>
1225 <xsl:call-template name="make_indent">
1226 <xsl:with-param name="current_indent" select="$current_indent"/>
1227 </xsl:call-template>
1228 <FONT color="red">Then apply it to </FONT>
1229 <xsl:apply-templates select="*[position()>2]"/>
1231 <!-- by_induction -->
1232 <xsl:when test="$name='by_induction'">
1233 <FONT color="red">We prove </FONT>
1234 <xsl:apply-templates select="../*[3]">
1235 <xsl:with-param name="current_indent" select="$current_indent+18"/>
1236 </xsl:apply-templates>
1238 <xsl:call-template name="make_indent">
1239 <xsl:with-param name="current_indent" select="$current_indent"/>
1240 </xsl:call-template>
1241 <FONT color="red">by induction on </FONT>
1242 <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
1243 <xsl:with-param name="current_indent" select="$current_indent+30"/>
1244 </xsl:apply-templates>
1247 <xsl:call-template name="make_indent">
1248 <xsl:with-param name="current_indent" select="$current_indent"/>
1249 </xsl:call-template>
1250 <xsl:text>The induction property is</xsl:text>
1252 <xsl:call-template name="make_indent">
1253 <xsl:with-param name="current_indent" select="$current_indent"/>
1254 </xsl:call-template>
1255 <xsl:apply-templates select="*[3]">
1256 <xsl:with-param name="current_indent" select="$current_indent"/>
1257 </xsl:apply-templates>
1259 <xsl:apply-templates
1260 select="*[position()>3 and not(position()=last())]">
1261 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1262 </xsl:apply-templates>
1264 <xsl:call-template name="make_indent">
1265 <xsl:with-param name="current_indent" select="$current_indent"/>
1266 </xsl:call-template>
1267 <xsl:text>End induction</xsl:text> -->
1269 <!-- inductive_case -->
1270 <xsl:when test="$name='inductive_case'">
1272 <xsl:call-template name="make_indent">
1273 <xsl:with-param name="current_indent" select="$current_indent"/>
1274 </xsl:call-template>
1275 <FONT color="red">Case </FONT>
1276 <xsl:apply-templates select="*[2]">
1277 <xsl:with-param name="current_indent" select="$current_indent +10"/>
1278 </xsl:apply-templates>
1279 <xsl:if test="*[3]/*[position()>1]">
1281 <xsl:call-template name="make_indent">
1282 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1283 </xsl:call-template>
1284 <FONT color="red">By induction hypothesis, we have:</FONT>
1285 <xsl:for-each select="*[3]/*[position()>1]">
1287 <xsl:call-template name="make_indent">
1288 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
1289 </xsl:call-template>
1290 <xsl:text>(</xsl:text>
1291 <xsl:apply-templates select="m:ci"/>
1292 <xsl:text>) </xsl:text>
1293 <xsl:apply-templates select="m:type">
1294 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1295 </xsl:apply-templates>
1299 <xsl:call-template name="make_indent">
1300 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
1301 </xsl:call-template>
1302 <xsl:apply-templates select="*[4]">
1303 <xsl:with-param name="current_indent" select="$current_indent +4"/>
1304 </xsl:apply-templates>
1306 <xsl:call-template name="make_indent">
1307 <xsl:with-param name="current_indent" select="$current_indent"/>
1308 </xsl:call-template>
1309 <xsl:text>End Case</xsl:text> -->
1312 <xsl:when test="$name='case_lhs'">
1314 <xsl:when test="count(*)=2">
1315 <xsl:apply-templates mode="inline" select="*[2]"/>
1318 <xsl:text>(</xsl:text>
1319 <xsl:apply-templates mode="inline" select="*[2]"/>
1320 <xsl:for-each select="m:bvar">
1321 <xsl:text> </xsl:text>
1322 <xsl:apply-templates mode="inline" select="*[1]"/>
1323 <xsl:text>:</xsl:text>
1324 <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
1326 <xsl:text>)</xsl:text>
1331 <xsl:when test="$name='false_ind'">
1332 <xsl:apply-templates select="*[3]">
1333 <xsl:with-param name="current_indent" select="$current_indent"/>
1334 </xsl:apply-templates>
1336 <xsl:call-template name="make_indent">
1337 <xsl:with-param name="current_indent" select="$current_indent"/>
1338 </xsl:call-template>
1339 <FONT color="red">Contradiction.</FONT>
1342 <xsl:when test="$name='and_ind'">
1344 <xsl:when test="name(*[2])='m:apply'">
1345 <xsl:apply-templates select="*[2]">
1346 <xsl:with-param name="current_indent" select="$current_indent"/>
1347 </xsl:apply-templates>
1350 <FONT color="red">Consider </FONT>
1351 <xsl:apply-templates select="*[2]"/>
1355 <xsl:call-template name="make_indent">
1356 <xsl:with-param name="current_indent" select="$current_indent"/>
1357 </xsl:call-template>
1358 <FONT color="red">In particular, we have</FONT>
1360 <xsl:call-template name="make_indent">
1361 <xsl:with-param name="current_indent" select="$current_indent"/>
1362 </xsl:call-template>
1364 <xsl:apply-templates select="*[3]"/>
1366 <xsl:apply-templates select="*[4]">
1367 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1368 </xsl:apply-templates>
1370 <xsl:call-template name="make_indent">
1371 <xsl:with-param name="current_indent" select="$current_indent"/>
1372 </xsl:call-template>
1374 <xsl:apply-templates select="*[5]"/>
1376 <xsl:apply-templates select="*[6]">
1377 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1378 </xsl:apply-templates>
1380 <xsl:call-template name="make_indent">
1381 <xsl:with-param name="current_indent" select="$current_indent"/>
1382 </xsl:call-template>
1383 <xsl:apply-templates select="*[7]">
1384 <xsl:with-param name="current_indent" select="$current_indent"/>
1385 </xsl:apply-templates>
1387 <!-- full_or_ind -->
1388 <xsl:when test="$name='full_or_ind'">
1390 <xsl:when test="name(*[2])='m:apply'">
1391 <xsl:apply-templates select="*[2]">
1392 <xsl:with-param name="current_indent" select="$current_indent"/>
1393 </xsl:apply-templates>
1396 <FONT color="red">Consider </FONT>
1397 <xsl:apply-templates select="*[2]"/>
1401 <xsl:call-template name="make_indent">
1402 <xsl:with-param name="current_indent" select="$current_indent"/>
1403 </xsl:call-template>
1404 <FONT color="red">We proceed by cases to prove </FONT>
1405 <xsl:apply-templates select="*[3]"/>
1407 <xsl:call-template name="make_indent">
1408 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1409 </xsl:call-template>
1410 <FONT color="red">Left: suppose </FONT>
1411 <xsl:text>(</xsl:text>
1412 <xsl:value-of select="*[4]/m:bvar/m:ci"/>
1413 <xsl:text>) </xsl:text>
1414 <xsl:apply-templates
1415 select="*[4]/m:bvar/m:type/*[1]"/>
1417 <xsl:call-template name="make_indent">
1418 <xsl:with-param name="current_indent" select="$current_indent+15"/>
1419 </xsl:call-template>
1420 <xsl:apply-templates
1422 <xsl:with-param name="current_indent" select="$current_indent+15"/>
1423 </xsl:apply-templates>
1425 <xsl:call-template name="make_indent">
1426 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1427 </xsl:call-template>
1428 <FONT color="red">Right: suppose </FONT>
1429 <xsl:text>(</xsl:text>
1430 <xsl:value-of select="*[5]/m:bvar/m:ci"/>
1431 <xsl:text>) </xsl:text>
1432 <xsl:apply-templates
1433 select="*[5]/m:bvar/m:type/*[1]"/>
1435 <xsl:call-template name="make_indent">
1436 <xsl:with-param name="current_indent" select="$current_indent+16"/>
1437 </xsl:call-template>
1438 <xsl:apply-templates
1440 <xsl:with-param name="current_indent" select="$current_indent+16"/>
1441 </xsl:apply-templates>
1444 <xsl:when test="$name='or_ind'">
1446 <xsl:when test="name(*[2])='m:apply'">
1447 <xsl:apply-templates select="*[2]">
1448 <xsl:with-param name="current_indent" select="$current_indent"/>
1449 </xsl:apply-templates>
1452 <FONT color="red">Consider </FONT>
1453 <xsl:apply-templates select="*[2]"/>
1457 <xsl:call-template name="make_indent">
1458 <xsl:with-param name="current_indent" select="$current_indent"/>
1459 </xsl:call-template>
1460 <FONT color="red">We prove </FONT>
1461 <xsl:apply-templates select="*[3]"/>
1462 <FONT color="red"> by cases:</FONT>
1464 <xsl:call-template name="make_indent">
1465 <xsl:with-param name="current_indent" select="$current_indent"/>
1466 </xsl:call-template>
1468 <xsl:apply-templates select="*[4]">
1469 <xsl:with-param name="current_indent" select="$current_indent"/>
1470 </xsl:apply-templates>
1472 <xsl:call-template name="make_indent">
1473 <xsl:with-param name="current_indent" select="$current_indent"/>
1474 </xsl:call-template>
1476 <xsl:apply-templates select="*[5]">
1477 <xsl:with-param name="current_indent" select="$current_indent"/>
1478 </xsl:apply-templates>
1481 <xsl:when test="$name='ex_ind'">
1483 <xsl:when test="name(*[2])='m:apply'">
1484 <xsl:apply-templates select="*[2]">
1485 <xsl:with-param name="current_indent" select="$current_indent"/>
1486 </xsl:apply-templates>
1489 <FONT color="red">Consider </FONT>
1490 <xsl:apply-templates select="*[2]">
1491 <xsl:with-param name="current_indent" select="$current_indent"/>
1492 </xsl:apply-templates>
1496 <xsl:call-template name="make_indent">
1497 <xsl:with-param name="current_indent" select="$current_indent"/>
1498 </xsl:call-template>
1499 <FONT color="red">Let </FONT>
1500 <xsl:apply-templates mode="inline" select="*[3]"/>
1502 <xsl:apply-templates mode="inline" select="*[4]"/>
1503 <FONT color="red"> such that</FONT>
1505 <xsl:call-template name="make_indent">
1506 <xsl:with-param name="current_indent" select="$current_indent"/>
1507 </xsl:call-template>
1509 <xsl:apply-templates mode="inline" select="*[5]"/>
1511 <xsl:apply-templates select="*[6]">
1512 <xsl:with-param name="current_indent" select="$current_indent +7"/>
1513 </xsl:apply-templates>
1515 <xsl:call-template name="make_indent">
1516 <xsl:with-param name="current_indent" select="$current_indent"/>
1517 </xsl:call-template>
1518 <xsl:apply-templates select="*[7]">
1519 <xsl:with-param name="current_indent" select="$current_indent"/>
1520 </xsl:apply-templates>
1522 <!-- ***************************************** -->
1523 <!-- *********** LAMBDA ELEMENTS ************** -->
1524 <!-- ***************************************** -->
1525 <xsl:when test="$name='subst'">
1526 <xsl:apply-templates select="*[3]"/>
1527 <xsl:text>[</xsl:text>
1528 <xsl:apply-templates select="*[4]"/>
1530 <xsl:when test="$uri != ''">
1532 <xsl:call-template name="mksymbol-1">
1533 <xsl:with-param name="symbol" select="$name"/>
1534 <xsl:with-param name="color" select="'blue'"/>
1535 <xsl:with-param name="size" select="'+0'"/>
1536 </xsl:call-template>
1540 <xsl:call-template name="mksymbol-1">
1541 <xsl:with-param name="symbol" select="$name"/>
1542 <xsl:with-param name="color" select="'blue'"/>
1543 <xsl:with-param name="size" select="'+0'"/>
1544 </xsl:call-template>
1547 <xsl:apply-templates select="*[2]"/>
1548 <xsl:text>]</xsl:text>
1551 <xsl:when test="$name='lift_with_base'">
1553 <xsl:apply-templates select="*[3]" mode="inline"/>
1556 <xsl:when test="$uri != ''">
1558 <xsl:call-template name="mksymbol-1">
1559 <xsl:with-param name="symbol" select="$name"/>
1560 <xsl:with-param name="color" select="'green'"/>
1561 <xsl:with-param name="size" select="'+0'"/>
1562 </xsl:call-template>
1566 <xsl:call-template name="mksymbol-1">
1567 <xsl:with-param name="symbol" select="$name"/>
1568 <xsl:with-param name="color" select="'green'"/>
1569 <xsl:with-param name="size" select="'+0'"/>
1570 </xsl:call-template>
1574 <xsl:apply-templates select="*[4]" mode="inline"/>
1576 <xsl:text>(</xsl:text>
1577 <xsl:apply-templates select="*[2]" mode="inline"/>
1578 <xsl:text>)</xsl:text>
1581 <xsl:when test="$name='lift'">
1583 <xsl:when test="$uri != ''">
1585 <xsl:call-template name="mksymbol-1">
1586 <xsl:with-param name="symbol" select="$name"/>
1587 <xsl:with-param name="color" select="'green'"/>
1588 <xsl:with-param name="size" select="'+0'"/>
1589 </xsl:call-template>
1593 <xsl:call-template name="mksymbol-1">
1594 <xsl:with-param name="symbol" select="$name"/>
1595 <xsl:with-param name="color" select="'green'"/>
1596 <xsl:with-param name="size" select="'+0'"/>
1597 </xsl:call-template>
1601 <xsl:apply-templates select="*[2]" mode="inline"/>
1603 <xsl:text>(</xsl:text>
1604 <xsl:apply-templates select="*[3]" mode="inline"/>
1605 <xsl:text>)</xsl:text>
1609 <xsl:when test="$name='beta_red1'">
1610 <xsl:apply-templates select="*[2]" mode="inline"/>
1612 <xsl:when test="$uri != ''">
1614 <xsl:call-template name="mksymbol-1">
1615 <xsl:with-param name="symbol" select="$name"/>
1616 <xsl:with-param name="color" select="'green'"/>
1617 <xsl:with-param name="size" select="'+0'"/>
1618 </xsl:call-template>
1620 <xsl:call-template name="mksymbol-1">
1621 <xsl:with-param name="symbol" select="'beta'"/>
1622 <xsl:with-param name="color" select="'green'"/>
1623 <xsl:with-param name="size" select="'+0'"/>
1624 </xsl:call-template>
1629 <xsl:call-template name="mksymbol-1">
1630 <xsl:with-param name="symbol" select="$name"/>
1631 <xsl:with-param name="color" select="'green'"/>
1632 <xsl:with-param name="size" select="'+0'"/>
1633 </xsl:call-template>
1635 <xsl:call-template name="mksymbol-1">
1636 <xsl:with-param name="symbol" select="'beta'"/>
1637 <xsl:with-param name="color" select="'green'"/>
1638 <xsl:with-param name="size" select="'+0'"/>
1639 </xsl:call-template>
1643 <xsl:apply-templates select="*[3]" mode="inline"/>
1646 <xsl:when test="$name='beta_red'">
1647 <xsl:apply-templates select="*[2]" mode="inline"/>
1649 <xsl:when test="$uri != ''">
1651 <xsl:call-template name="mksymbol-1">
1652 <xsl:with-param name="symbol" select="$name"/>
1653 <xsl:with-param name="color" select="'green'"/>
1654 <xsl:with-param name="size" select="'+0'"/>
1655 </xsl:call-template>
1657 <xsl:call-template name="mksymbol-1">
1658 <xsl:with-param name="symbol" select="'beta'"/>
1659 <xsl:with-param name="color" select="'green'"/>
1660 <xsl:with-param name="size" select="'+0'"/>
1661 </xsl:call-template>
1662 <xsl:text>*</xsl:text>
1667 <xsl:call-template name="mksymbol-1">
1668 <xsl:with-param name="symbol" select="$name"/>
1669 <xsl:with-param name="color" select="'green'"/>
1670 <xsl:with-param name="size" select="'+0'"/>
1671 </xsl:call-template>
1673 <xsl:call-template name="mksymbol-1">
1674 <xsl:with-param name="symbol" select="'beta'"/>
1675 <xsl:with-param name="color" select="'green'"/>
1676 <xsl:with-param name="size" select="'+0'"/>
1677 </xsl:call-template>
1678 <xsl:text>*</xsl:text>
1682 <xsl:apply-templates select="*[3]" mode="inline"/>
1685 <xsl:when test="$name='par_beta_red1'">
1686 <xsl:apply-templates select="*[2]" mode="inline"/>
1688 <xsl:when test="$uri != ''">
1690 <xsl:call-template name="mksymbol-1">
1691 <xsl:with-param name="symbol" select="$name"/>
1692 <xsl:with-param name="color" select="'green'"/>
1693 <xsl:with-param name="size" select="'+0'"/>
1694 </xsl:call-template>
1696 <xsl:call-template name="mksymbol-1">
1697 <xsl:with-param name="symbol" select="'beta'"/>
1698 <xsl:with-param name="color" select="'green'"/>
1699 <xsl:with-param name="size" select="'+0'"/>
1700 </xsl:call-template>
1705 <xsl:call-template name="mksymbol-1">
1706 <xsl:with-param name="symbol" select="$name"/>
1707 <xsl:with-param name="color" select="'green'"/>
1708 <xsl:with-param name="size" select="'+0'"/>
1709 </xsl:call-template>
1711 <xsl:call-template name="mksymbol-1">
1712 <xsl:with-param name="symbol" select="'beta'"/>
1713 <xsl:with-param name="color" select="'green'"/>
1714 <xsl:with-param name="size" select="'+0'"/>
1715 </xsl:call-template>
1719 <xsl:apply-templates select="*[3]" mode="inline"/>
1722 <xsl:when test="$name='par_beta_red'">
1723 <xsl:apply-templates select="*[2]" mode="inline"/>
1725 <xsl:when test="$uri != ''">
1727 <xsl:call-template name="mksymbol-1">
1728 <xsl:with-param name="symbol" select="$name"/>
1729 <xsl:with-param name="color" select="'green'"/>
1730 <xsl:with-param name="size" select="'+0'"/>
1731 </xsl:call-template>
1733 <xsl:call-template name="mksymbol-1">
1734 <xsl:with-param name="symbol" select="'beta'"/>
1735 <xsl:with-param name="color" select="'green'"/>
1736 <xsl:with-param name="size" select="'+0'"/>
1737 </xsl:call-template>
1738 <xsl:text>*</xsl:text>
1743 <xsl:call-template name="mksymbol-1">
1744 <xsl:with-param name="symbol" select="$name"/>
1745 <xsl:with-param name="color" select="'green'"/>
1746 <xsl:with-param name="size" select="'+0'"/>
1747 </xsl:call-template>
1749 <xsl:call-template name="mksymbol-1">
1750 <xsl:with-param name="symbol" select="'beta'"/>
1751 <xsl:with-param name="color" select="'green'"/>
1752 <xsl:with-param name="size" select="'+0'"/>
1753 </xsl:call-template>
1754 <xsl:text>*</xsl:text>
1758 <xsl:apply-templates select="*[3]" mode="inline"/>
1762 <xsl:when test="$name='forgetful'">
1764 <xsl:when test="$uri != ''">
1765 <a href="{$uri}">|</a>
1771 <xsl:apply-templates select="*[2]" mode="inline"/>
1773 <xsl:when test="$uri != ''">
1774 <a href="{$uri}">|</a>
1782 <!-- boolean algebra of redexes -->
1785 <xsl:when test="$name='isomorphic'">
1786 <xsl:apply-templates select="*[2]" mode="inline"/>
1788 <xsl:when test="$uri != ''">
1790 <xsl:call-template name="mksymbol-1">
1791 <xsl:with-param name="symbol" select="$name"/>
1792 <xsl:with-param name="color" select="'green'"/>
1793 <xsl:with-param name="size" select="'+0'"/>
1794 </xsl:call-template>
1798 <xsl:call-template name="mksymbol-1">
1799 <xsl:with-param name="symbol" select="$name"/>
1800 <xsl:with-param name="color" select="'green'"/>
1801 <xsl:with-param name="size" select="'+0'"/>
1802 </xsl:call-template>
1805 <xsl:apply-templates select="*[3]" mode="inline"/>
1809 <xsl:when test="$name='interp'">
1810 <font color="green">[</font>
1811 <xsl:apply-templates select="*[2]"/>
1812 <font color="green">]</font>
1820 <xsl:template match="m:lambda">
1821 <xsl:param name="current_indent" select="0"/>
1822 <xsl:variable name="charlength">
1823 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
1824 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
1826 <!-- <xsl:value-of select="$charlength"/> -->
1827 <!-- <xsl:value-of select="$current_indent"/> -->
1829 <xsl:when test="$charlength > $framewidth">
1831 <xsl:call-template name="mksymbol-1">
1832 <xsl:with-param name="symbol" select="'lambda'"/>
1833 <xsl:with-param name="color" select="'red'"/>
1834 <xsl:with-param name="size" select="'+2'"/>
1835 </xsl:call-template>
1836 <xsl:apply-templates select="m:bvar/m:ci"/>
1837 <xsl:text>:</xsl:text>
1838 <xsl:apply-templates select="m:bvar/m:type">
1839 <xsl:with-param name="current_indent"
1840 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
1841 </xsl:apply-templates><br/>
1842 <xsl:call-template name="make_indent">
1843 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1844 </xsl:call-template>
1845 <xsl:text>.</xsl:text>
1846 <xsl:apply-templates select="*[position()=2]">
1847 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1848 </xsl:apply-templates>
1851 <xsl:apply-templates mode="inline" select="."/>
1857 <xsl:template match="m:ci">
1859 <xsl:when test="boolean(@definitionURL)">
1860 <a href="{@definitionURL}">
1861 <xsl:apply-templates/>
1865 <xsl:value-of select="."/>
1872 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1873 <xsl:param name="incurrent_length" select="0"/>
1875 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
1876 <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>
1878 <xsl:when test="string($siblength) = """>
1879 <xsl:value-of select="$incurrent_length + string-length()"/>
1882 <xsl:value-of select="number($siblength)"/>
1887 <xsl:value-of select="$incurrent_length + string-length()"/>
1892 <xsl:template match="*" mode="charcount">
1893 <xsl:param name="incurrent_length" select="0"/>
1895 <xsl:when test="count(child::*) = 0">
1896 <xsl:value-of select="$incurrent_length"/>
1899 <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>
1901 <xsl:when test="$framewidth >= number($childlength)">
1902 <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>
1904 <xsl:when test="string($siblength) = """>
1905 <xsl:value-of select="number($childlength)"/>
1908 <xsl:value-of select="number($siblength)"/>
1913 <xsl:value-of select="number($childlength)"/>
1921 <!--***********************************************************************-->
1923 <!--***********************************************************************-->
1927 <xsl:template match="Definition">
1928 <xsl:param name="current_indent" select="0"/>
1930 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1932 <xsl:call-template name="make_indent">
1933 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1934 </xsl:call-template>
1935 <xsl:apply-templates select="type/*[1]">
1936 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1937 </xsl:apply-templates><br/>
1939 <xsl:call-template name="make_indent">
1940 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1941 </xsl:call-template>
1942 <xsl:apply-templates select="body/*[1]">
1943 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1944 </xsl:apply-templates>
1950 <xsl:template match="Axiom">
1951 <xsl:param name="current_indent" select="0"/>
1953 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1955 <xsl:call-template name="make_indent">
1956 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1957 </xsl:call-template>
1958 <xsl:apply-templates select="type/*[1]">
1959 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1960 </xsl:apply-templates>
1964 <!-- UNFINISHED PROOF -->
1966 <xsl:template match="CurrentProof">
1967 <xsl:param name="current_indent" select="0"/>
1969 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1970 THESIS: <xsl:apply-templates select="type/*[1]">
1971 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1972 </xsl:apply-templates><br/>
1974 <xsl:for-each select="Conjecture">
1976 <xsl:call-template name="make_indent">
1977 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1978 </xsl:call-template>
1979 <xsl:value-of select="./@no"/> :
1980 <xsl:apply-templates select="./*[1]">
1981 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
1982 </xsl:apply-templates>
1986 <xsl:apply-templates select="body/*[1]">
1987 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1988 </xsl:apply-templates>
1992 <!-- MUTUAL INDUCTIVE DEFINITION -->
1994 <xsl:template match="InductiveDefinition">
1995 <xsl:param name="current_indent" select="0"/>
1997 <xsl:for-each select="InductiveType">
1999 <xsl:when test="position() = 1">
2001 <xsl:when test="string(./@inductive) = "true"">
2002 INDUCTIVE DEFINITION
2005 COINDUCTIVE DEFINITION
2013 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
2015 <xsl:if test="string(../Param) != """>
2016 <xsl:for-each select="../Param">
2017 <xsl:value-of select="./@name"/>
2019 <xsl:apply-templates select="*"/>
2024 <xsl:apply-templates select="./arity/*[1]">
2025 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
2026 </xsl:apply-templates> <br/>
2028 <xsl:for-each select="./Constructor">
2030 <xsl:call-template name="make_indent">
2031 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
2032 </xsl:call-template>
2034 <xsl:when test="position() = 1">
2035 <xsl:text>  </xsl:text>
2038 <xsl:text>| </xsl:text>
2041 <xsl:value-of select="./@name"/>
2042 <xsl:text>: </xsl:text>
2043 <xsl:apply-templates select="./*[1]">
2044 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
2045 </xsl:apply-templates>
2053 <xsl:template match="Variable">
2054 <xsl:param name="current_indent" select="0"/>
2056 VARIABLE <xsl:value-of select="@name"/><br/>
2057 TYPE = <xsl:apply-templates select="type/*[1]">
2058 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
2059 </xsl:apply-templates>
2063 <!--***********************************************************************-->
2065 <!--***********************************************************************-->
2069 <xsl:template match="SECTION">
2070 <xsl:param name="current_indent" select="0"/>
2071 <h1>BEGIN OF SECTION</h1>
2072 <xsl:apply-templates/>
2073 <h1>END OF SECTION</h1>