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') or
1087 (preceding-sibling::*[1]/text()='rw_step')">
1089 <xsl:call-template name="make_indent">
1090 <xsl:with-param name="current_indent" select="$current_indent"/>
1091 </xsl:call-template>
1092 <FONT color="red">we proved </FONT>
1096 if(document.getElementById) {
1098 <span ID="{$freshid2}">\
1099 <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>\
1101 <span ID="{$freshid3}">\
1103 <xsl:call-template name="make_indent">
1104 <xsl:with-param name="current_indent" select="$current_indent"/>
1105 </xsl:call-template>\
1106 <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>\
1109 document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
1110 document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
1111 document.write(' ');
1115 <xsl:call-template name="make_indent">
1116 <xsl:with-param name="current_indent" select="$current_indent"/>
1117 </xsl:call-template>\
1118 <FONT color="red">we proved </FONT>\
1124 <xsl:apply-templates select="*[position()=3]">
1125 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
1126 </xsl:apply-templates>
1129 <xsl:when test="$name='letin1'">
1130 <xsl:apply-templates select="*[position()=2]">
1131 <xsl:with-param name="current_indent" select="$current_indent"/>
1132 </xsl:apply-templates>
1134 <xsl:call-template name="make_indent">
1135 <xsl:with-param name="current_indent" select="$current_indent"/>
1136 </xsl:call-template>
1137 <xsl:apply-templates select="*[position()=3]">
1138 <xsl:with-param name="current_indent" select="$current_indent"/>
1139 </xsl:apply-templates>
1142 <xsl:when test="$name='letin'">
1143 <xsl:for-each select="*[position()>1 and last()>position()]">
1144 <xsl:apply-templates select=".">
1145 <xsl:with-param name="current_indent" select="$current_indent"/>
1146 </xsl:apply-templates>
1148 <xsl:call-template name="make_indent">
1149 <xsl:with-param name="current_indent" select="$current_indent"/>
1150 </xsl:call-template>
1152 <xsl:apply-templates select="*[position()=last()]">
1153 <xsl:with-param name="current_indent" select="$current_indent"/>
1154 </xsl:apply-templates>
1157 <xsl:when test="$name='let'">
1159 <xsl:apply-templates select="m:ci"/>
1161 <xsl:apply-templates select="*[3]">
1162 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1163 </xsl:apply-templates>
1166 <xsl:when test="$name='rw_step'">
1168 <xsl:when test="name(*[2])='m:apply'">
1169 <xsl:apply-templates select="*[2]">
1170 <xsl:with-param name="current_indent" select="$current_indent"/>
1171 </xsl:apply-templates>
1174 <FONT color="red">Consider </FONT>
1175 <xsl:apply-templates select="*[2]"/>
1178 <xsl:variable name="charlength_first">
1179 <xsl:apply-templates select="*[3]" mode="root_charcount"/>
1181 <xsl:variable name="charlength_second">
1182 <xsl:apply-templates select="*[4]" mode="root_charcount"/>
1184 <xsl:variable name="charlength_side_proof">
1185 <xsl:apply-templates select="*[5]" mode="root_charcount"/>
1187 <xsl:variable name="split1"
1188 select="($charlength_first + $charlength_second) > $framewidth"/>
1189 <xsl:variable name="split2"
1190 select="($charlength_second + $charlength_side_proof) > $framewidth"/>
1191 <!-- <xsl:value-of select="$current_indent"/> -->
1192 <!-- <xsl:value-of select="string($charlength_second)"/> -->
1193 <!-- <xsl:value-of select="$charlength_side_proof"/> -->
1194 <!-- <xsl:value-of select="$split2"/> -->
1196 <xsl:call-template name="make_indent">
1197 <xsl:with-param name="current_indent" select="$current_indent"/>
1198 </xsl:call-template>
1199 <FONT color="red">Rewrite </FONT>
1200 <xsl:apply-templates mode="inline" select="*[3]"/>
1201 <xsl:text> </xsl:text>
1202 <xsl:if test="$split1">
1204 <xsl:call-template name="make_indent">
1205 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1206 </xsl:call-template>
1208 <FONT color="red">with </FONT>
1209 <xsl:apply-templates mode="inline" select="*[4]"/>
1210 <xsl:text> </xsl:text>
1211 <xsl:if test="$split2">
1213 <xsl:call-template name="make_indent">
1214 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1215 </xsl:call-template>
1217 <FONT color="red">by </FONT>
1218 <xsl:apply-templates select="*[5]">
1219 <xsl:with-param name="current_indent" select="$current_indent+7"/>
1220 </xsl:apply-templates>
1222 <!-- rewrite and apply -->
1223 <xsl:when test="$name='rewrite_and_apply'">
1224 <xsl:apply-templates select="*[2]">
1225 <xsl:with-param name="current_indent" select="$current_indent"/>
1226 </xsl:apply-templates>
1228 <xsl:call-template name="make_indent">
1229 <xsl:with-param name="current_indent" select="$current_indent"/>
1230 </xsl:call-template>
1231 <FONT color="red">Then apply it to </FONT>
1232 <xsl:apply-templates select="*[position()>2]"/>
1234 <!-- by_induction -->
1235 <xsl:when test="$name='by_induction'">
1236 <FONT color="red">We prove </FONT>
1237 <xsl:apply-templates select="../*[3]">
1238 <xsl:with-param name="current_indent" select="$current_indent+18"/>
1239 </xsl:apply-templates>
1241 <xsl:call-template name="make_indent">
1242 <xsl:with-param name="current_indent" select="$current_indent"/>
1243 </xsl:call-template>
1244 <FONT color="red">by induction on </FONT>
1245 <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
1246 <xsl:with-param name="current_indent" select="$current_indent+30"/>
1247 </xsl:apply-templates>
1250 <xsl:call-template name="make_indent">
1251 <xsl:with-param name="current_indent" select="$current_indent"/>
1252 </xsl:call-template>
1253 <xsl:text>The induction property is</xsl:text>
1255 <xsl:call-template name="make_indent">
1256 <xsl:with-param name="current_indent" select="$current_indent"/>
1257 </xsl:call-template>
1258 <xsl:apply-templates select="*[3]">
1259 <xsl:with-param name="current_indent" select="$current_indent"/>
1260 </xsl:apply-templates>
1262 <xsl:apply-templates
1263 select="*[position()>3 and not(position()=last())]">
1264 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1265 </xsl:apply-templates>
1267 <xsl:call-template name="make_indent">
1268 <xsl:with-param name="current_indent" select="$current_indent"/>
1269 </xsl:call-template>
1270 <xsl:text>End induction</xsl:text> -->
1272 <!-- inductive_case -->
1273 <xsl:when test="$name='inductive_case'">
1275 <xsl:call-template name="make_indent">
1276 <xsl:with-param name="current_indent" select="$current_indent"/>
1277 </xsl:call-template>
1278 <FONT color="red">Case </FONT>
1279 <xsl:apply-templates select="*[2]">
1280 <xsl:with-param name="current_indent" select="$current_indent +10"/>
1281 </xsl:apply-templates>
1282 <xsl:if test="*[3]/*[position()>1]">
1284 <xsl:call-template name="make_indent">
1285 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1286 </xsl:call-template>
1287 <FONT color="red">By induction hypothesis, we have:</FONT>
1288 <xsl:for-each select="*[3]/*[position()>1]">
1290 <xsl:call-template name="make_indent">
1291 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
1292 </xsl:call-template>
1293 <xsl:text>(</xsl:text>
1294 <xsl:apply-templates select="m:ci"/>
1295 <xsl:text>) </xsl:text>
1296 <xsl:apply-templates select="m:type">
1297 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1298 </xsl:apply-templates>
1302 <xsl:call-template name="make_indent">
1303 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
1304 </xsl:call-template>
1305 <xsl:apply-templates select="*[4]">
1306 <xsl:with-param name="current_indent" select="$current_indent +4"/>
1307 </xsl:apply-templates>
1309 <xsl:call-template name="make_indent">
1310 <xsl:with-param name="current_indent" select="$current_indent"/>
1311 </xsl:call-template>
1312 <xsl:text>End Case</xsl:text> -->
1315 <xsl:when test="$name='case_lhs'">
1317 <xsl:when test="count(*)=2">
1318 <xsl:apply-templates mode="inline" select="*[2]"/>
1321 <xsl:text>(</xsl:text>
1322 <xsl:apply-templates mode="inline" select="*[2]"/>
1323 <xsl:for-each select="m:bvar">
1324 <xsl:text> </xsl:text>
1325 <xsl:apply-templates mode="inline" select="*[1]"/>
1326 <xsl:text>:</xsl:text>
1327 <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
1329 <xsl:text>)</xsl:text>
1334 <xsl:when test="$name='false_ind'">
1335 <xsl:apply-templates select="*[3]">
1336 <xsl:with-param name="current_indent" select="$current_indent"/>
1337 </xsl:apply-templates>
1339 <xsl:call-template name="make_indent">
1340 <xsl:with-param name="current_indent" select="$current_indent"/>
1341 </xsl:call-template>
1342 <FONT color="red">Contradiction.</FONT>
1345 <xsl:when test="$name='and_ind'">
1347 <xsl:when test="name(*[2])='m:apply'">
1348 <xsl:apply-templates select="*[2]">
1349 <xsl:with-param name="current_indent" select="$current_indent"/>
1350 </xsl:apply-templates>
1353 <FONT color="red">Consider </FONT>
1354 <xsl:apply-templates select="*[2]"/>
1358 <xsl:call-template name="make_indent">
1359 <xsl:with-param name="current_indent" select="$current_indent"/>
1360 </xsl:call-template>
1361 <FONT color="red">In particular, we have</FONT>
1363 <xsl:call-template name="make_indent">
1364 <xsl:with-param name="current_indent" select="$current_indent"/>
1365 </xsl:call-template>
1367 <xsl:apply-templates select="*[3]"/>
1369 <xsl:apply-templates select="*[4]">
1370 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1371 </xsl:apply-templates>
1373 <xsl:call-template name="make_indent">
1374 <xsl:with-param name="current_indent" select="$current_indent"/>
1375 </xsl:call-template>
1377 <xsl:apply-templates select="*[5]"/>
1379 <xsl:apply-templates select="*[6]">
1380 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1381 </xsl:apply-templates>
1383 <xsl:call-template name="make_indent">
1384 <xsl:with-param name="current_indent" select="$current_indent"/>
1385 </xsl:call-template>
1386 <xsl:apply-templates select="*[7]">
1387 <xsl:with-param name="current_indent" select="$current_indent"/>
1388 </xsl:apply-templates>
1390 <!-- full_or_ind -->
1391 <xsl:when test="$name='full_or_ind'">
1393 <xsl:when test="name(*[2])='m:apply'">
1394 <xsl:apply-templates select="*[2]">
1395 <xsl:with-param name="current_indent" select="$current_indent"/>
1396 </xsl:apply-templates>
1399 <FONT color="red">Consider </FONT>
1400 <xsl:apply-templates select="*[2]"/>
1404 <xsl:call-template name="make_indent">
1405 <xsl:with-param name="current_indent" select="$current_indent"/>
1406 </xsl:call-template>
1407 <FONT color="red">We proceed by cases to prove </FONT>
1408 <xsl:apply-templates select="*[3]"/>
1410 <xsl:call-template name="make_indent">
1411 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1412 </xsl:call-template>
1413 <FONT color="red">Left: suppose </FONT>
1414 <xsl:text>(</xsl:text>
1415 <xsl:value-of select="*[4]/m:bvar/m:ci"/>
1416 <xsl:text>) </xsl:text>
1417 <xsl:apply-templates
1418 select="*[4]/m:bvar/m:type/*[1]"/>
1420 <xsl:call-template name="make_indent">
1421 <xsl:with-param name="current_indent" select="$current_indent+15"/>
1422 </xsl:call-template>
1423 <xsl:apply-templates
1425 <xsl:with-param name="current_indent" select="$current_indent+15"/>
1426 </xsl:apply-templates>
1428 <xsl:call-template name="make_indent">
1429 <xsl:with-param name="current_indent" select="$current_indent+4"/>
1430 </xsl:call-template>
1431 <FONT color="red">Right: suppose </FONT>
1432 <xsl:text>(</xsl:text>
1433 <xsl:value-of select="*[5]/m:bvar/m:ci"/>
1434 <xsl:text>) </xsl:text>
1435 <xsl:apply-templates
1436 select="*[5]/m:bvar/m:type/*[1]"/>
1438 <xsl:call-template name="make_indent">
1439 <xsl:with-param name="current_indent" select="$current_indent+16"/>
1440 </xsl:call-template>
1441 <xsl:apply-templates
1443 <xsl:with-param name="current_indent" select="$current_indent+16"/>
1444 </xsl:apply-templates>
1447 <xsl:when test="$name='or_ind'">
1449 <xsl:when test="name(*[2])='m:apply'">
1450 <xsl:apply-templates select="*[2]">
1451 <xsl:with-param name="current_indent" select="$current_indent"/>
1452 </xsl:apply-templates>
1455 <FONT color="red">Consider </FONT>
1456 <xsl:apply-templates select="*[2]"/>
1460 <xsl:call-template name="make_indent">
1461 <xsl:with-param name="current_indent" select="$current_indent"/>
1462 </xsl:call-template>
1463 <FONT color="red">We prove </FONT>
1464 <xsl:apply-templates select="*[3]"/>
1465 <FONT color="red"> by cases:</FONT>
1467 <xsl:call-template name="make_indent">
1468 <xsl:with-param name="current_indent" select="$current_indent"/>
1469 </xsl:call-template>
1471 <xsl:apply-templates select="*[4]">
1472 <xsl:with-param name="current_indent" select="$current_indent"/>
1473 </xsl:apply-templates>
1475 <xsl:call-template name="make_indent">
1476 <xsl:with-param name="current_indent" select="$current_indent"/>
1477 </xsl:call-template>
1479 <xsl:apply-templates select="*[5]">
1480 <xsl:with-param name="current_indent" select="$current_indent"/>
1481 </xsl:apply-templates>
1484 <xsl:when test="$name='ex_ind'">
1486 <xsl:when test="name(*[2])='m:apply'">
1487 <xsl:apply-templates select="*[2]">
1488 <xsl:with-param name="current_indent" select="$current_indent"/>
1489 </xsl:apply-templates>
1492 <FONT color="red">Consider </FONT>
1493 <xsl:apply-templates select="*[2]">
1494 <xsl:with-param name="current_indent" select="$current_indent"/>
1495 </xsl:apply-templates>
1499 <xsl:call-template name="make_indent">
1500 <xsl:with-param name="current_indent" select="$current_indent"/>
1501 </xsl:call-template>
1502 <FONT color="red">Let </FONT>
1503 <xsl:apply-templates mode="inline" select="*[3]"/>
1505 <xsl:apply-templates mode="inline" select="*[4]"/>
1506 <FONT color="red"> such that</FONT>
1508 <xsl:call-template name="make_indent">
1509 <xsl:with-param name="current_indent" select="$current_indent"/>
1510 </xsl:call-template>
1512 <xsl:apply-templates mode="inline" select="*[5]"/>
1514 <xsl:apply-templates select="*[6]">
1515 <xsl:with-param name="current_indent" select="$current_indent +7"/>
1516 </xsl:apply-templates>
1518 <xsl:call-template name="make_indent">
1519 <xsl:with-param name="current_indent" select="$current_indent"/>
1520 </xsl:call-template>
1521 <xsl:apply-templates select="*[7]">
1522 <xsl:with-param name="current_indent" select="$current_indent"/>
1523 </xsl:apply-templates>
1525 <!-- ***************************************** -->
1526 <!-- *********** LAMBDA ELEMENTS ************** -->
1527 <!-- ***************************************** -->
1528 <xsl:when test="$name='subst'">
1529 <xsl:apply-templates select="*[3]"/>
1530 <xsl:text>[</xsl:text>
1531 <xsl:apply-templates select="*[4]"/>
1533 <xsl:when test="$uri != ''">
1535 <xsl:call-template name="mksymbol-1">
1536 <xsl:with-param name="symbol" select="$name"/>
1537 <xsl:with-param name="color" select="'blue'"/>
1538 <xsl:with-param name="size" select="'+0'"/>
1539 </xsl:call-template>
1543 <xsl:call-template name="mksymbol-1">
1544 <xsl:with-param name="symbol" select="$name"/>
1545 <xsl:with-param name="color" select="'blue'"/>
1546 <xsl:with-param name="size" select="'+0'"/>
1547 </xsl:call-template>
1550 <xsl:apply-templates select="*[2]"/>
1551 <xsl:text>]</xsl:text>
1554 <xsl:when test="$name='lift_with_base'">
1556 <xsl:apply-templates select="*[3]" mode="inline"/>
1559 <xsl:when test="$uri != ''">
1561 <xsl:call-template name="mksymbol-1">
1562 <xsl:with-param name="symbol" select="$name"/>
1563 <xsl:with-param name="color" select="'green'"/>
1564 <xsl:with-param name="size" select="'+0'"/>
1565 </xsl:call-template>
1569 <xsl:call-template name="mksymbol-1">
1570 <xsl:with-param name="symbol" select="$name"/>
1571 <xsl:with-param name="color" select="'green'"/>
1572 <xsl:with-param name="size" select="'+0'"/>
1573 </xsl:call-template>
1577 <xsl:apply-templates select="*[4]" mode="inline"/>
1579 <xsl:text>(</xsl:text>
1580 <xsl:apply-templates select="*[2]" mode="inline"/>
1581 <xsl:text>)</xsl:text>
1584 <xsl:when test="$name='lift'">
1586 <xsl:when test="$uri != ''">
1588 <xsl:call-template name="mksymbol-1">
1589 <xsl:with-param name="symbol" select="$name"/>
1590 <xsl:with-param name="color" select="'green'"/>
1591 <xsl:with-param name="size" select="'+0'"/>
1592 </xsl:call-template>
1596 <xsl:call-template name="mksymbol-1">
1597 <xsl:with-param name="symbol" select="$name"/>
1598 <xsl:with-param name="color" select="'green'"/>
1599 <xsl:with-param name="size" select="'+0'"/>
1600 </xsl:call-template>
1604 <xsl:apply-templates select="*[2]" mode="inline"/>
1606 <xsl:text>(</xsl:text>
1607 <xsl:apply-templates select="*[3]" mode="inline"/>
1608 <xsl:text>)</xsl:text>
1612 <xsl:when test="$name='beta_red1'">
1613 <xsl:apply-templates select="*[2]" mode="inline"/>
1615 <xsl:when test="$uri != ''">
1617 <xsl:call-template name="mksymbol-1">
1618 <xsl:with-param name="symbol" select="$name"/>
1619 <xsl:with-param name="color" select="'green'"/>
1620 <xsl:with-param name="size" select="'+0'"/>
1621 </xsl:call-template>
1623 <xsl:call-template name="mksymbol-1">
1624 <xsl:with-param name="symbol" select="'beta'"/>
1625 <xsl:with-param name="color" select="'green'"/>
1626 <xsl:with-param name="size" select="'+0'"/>
1627 </xsl:call-template>
1632 <xsl:call-template name="mksymbol-1">
1633 <xsl:with-param name="symbol" select="$name"/>
1634 <xsl:with-param name="color" select="'green'"/>
1635 <xsl:with-param name="size" select="'+0'"/>
1636 </xsl:call-template>
1638 <xsl:call-template name="mksymbol-1">
1639 <xsl:with-param name="symbol" select="'beta'"/>
1640 <xsl:with-param name="color" select="'green'"/>
1641 <xsl:with-param name="size" select="'+0'"/>
1642 </xsl:call-template>
1646 <xsl:apply-templates select="*[3]" mode="inline"/>
1649 <xsl:when test="$name='beta_red'">
1650 <xsl:apply-templates select="*[2]" mode="inline"/>
1652 <xsl:when test="$uri != ''">
1654 <xsl:call-template name="mksymbol-1">
1655 <xsl:with-param name="symbol" select="$name"/>
1656 <xsl:with-param name="color" select="'green'"/>
1657 <xsl:with-param name="size" select="'+0'"/>
1658 </xsl:call-template>
1660 <xsl:call-template name="mksymbol-1">
1661 <xsl:with-param name="symbol" select="'beta'"/>
1662 <xsl:with-param name="color" select="'green'"/>
1663 <xsl:with-param name="size" select="'+0'"/>
1664 </xsl:call-template>
1665 <xsl:text>*</xsl:text>
1670 <xsl:call-template name="mksymbol-1">
1671 <xsl:with-param name="symbol" select="$name"/>
1672 <xsl:with-param name="color" select="'green'"/>
1673 <xsl:with-param name="size" select="'+0'"/>
1674 </xsl:call-template>
1676 <xsl:call-template name="mksymbol-1">
1677 <xsl:with-param name="symbol" select="'beta'"/>
1678 <xsl:with-param name="color" select="'green'"/>
1679 <xsl:with-param name="size" select="'+0'"/>
1680 </xsl:call-template>
1681 <xsl:text>*</xsl:text>
1685 <xsl:apply-templates select="*[3]" mode="inline"/>
1688 <xsl:when test="$name='par_beta_red1'">
1689 <xsl:apply-templates select="*[2]" mode="inline"/>
1691 <xsl:when test="$uri != ''">
1693 <xsl:call-template name="mksymbol-1">
1694 <xsl:with-param name="symbol" select="$name"/>
1695 <xsl:with-param name="color" select="'green'"/>
1696 <xsl:with-param name="size" select="'+0'"/>
1697 </xsl:call-template>
1699 <xsl:call-template name="mksymbol-1">
1700 <xsl:with-param name="symbol" select="'beta'"/>
1701 <xsl:with-param name="color" select="'green'"/>
1702 <xsl:with-param name="size" select="'+0'"/>
1703 </xsl:call-template>
1708 <xsl:call-template name="mksymbol-1">
1709 <xsl:with-param name="symbol" select="$name"/>
1710 <xsl:with-param name="color" select="'green'"/>
1711 <xsl:with-param name="size" select="'+0'"/>
1712 </xsl:call-template>
1714 <xsl:call-template name="mksymbol-1">
1715 <xsl:with-param name="symbol" select="'beta'"/>
1716 <xsl:with-param name="color" select="'green'"/>
1717 <xsl:with-param name="size" select="'+0'"/>
1718 </xsl:call-template>
1722 <xsl:apply-templates select="*[3]" mode="inline"/>
1725 <xsl:when test="$name='par_beta_red'">
1726 <xsl:apply-templates select="*[2]" mode="inline"/>
1728 <xsl:when test="$uri != ''">
1730 <xsl:call-template name="mksymbol-1">
1731 <xsl:with-param name="symbol" select="$name"/>
1732 <xsl:with-param name="color" select="'green'"/>
1733 <xsl:with-param name="size" select="'+0'"/>
1734 </xsl:call-template>
1736 <xsl:call-template name="mksymbol-1">
1737 <xsl:with-param name="symbol" select="'beta'"/>
1738 <xsl:with-param name="color" select="'green'"/>
1739 <xsl:with-param name="size" select="'+0'"/>
1740 </xsl:call-template>
1741 <xsl:text>*</xsl:text>
1746 <xsl:call-template name="mksymbol-1">
1747 <xsl:with-param name="symbol" select="$name"/>
1748 <xsl:with-param name="color" select="'green'"/>
1749 <xsl:with-param name="size" select="'+0'"/>
1750 </xsl:call-template>
1752 <xsl:call-template name="mksymbol-1">
1753 <xsl:with-param name="symbol" select="'beta'"/>
1754 <xsl:with-param name="color" select="'green'"/>
1755 <xsl:with-param name="size" select="'+0'"/>
1756 </xsl:call-template>
1757 <xsl:text>*</xsl:text>
1761 <xsl:apply-templates select="*[3]" mode="inline"/>
1765 <xsl:when test="$name='forgetful'">
1767 <xsl:when test="$uri != ''">
1768 <a href="{$uri}">|</a>
1774 <xsl:apply-templates select="*[2]" mode="inline"/>
1776 <xsl:when test="$uri != ''">
1777 <a href="{$uri}">|</a>
1785 <!-- boolean algebra of redexes -->
1788 <xsl:when test="$name='isomorphic'">
1789 <xsl:apply-templates select="*[2]" mode="inline"/>
1791 <xsl:when test="$uri != ''">
1793 <xsl:call-template name="mksymbol-1">
1794 <xsl:with-param name="symbol" select="$name"/>
1795 <xsl:with-param name="color" select="'green'"/>
1796 <xsl:with-param name="size" select="'+0'"/>
1797 </xsl:call-template>
1801 <xsl:call-template name="mksymbol-1">
1802 <xsl:with-param name="symbol" select="$name"/>
1803 <xsl:with-param name="color" select="'green'"/>
1804 <xsl:with-param name="size" select="'+0'"/>
1805 </xsl:call-template>
1808 <xsl:apply-templates select="*[3]" mode="inline"/>
1812 <xsl:when test="$name='interp'">
1813 <font color="green">[</font>
1814 <xsl:apply-templates select="*[2]"/>
1815 <font color="green">]</font>
1823 <xsl:template match="m:lambda">
1824 <xsl:param name="current_indent" select="0"/>
1825 <xsl:variable name="charlength">
1826 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
1827 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
1829 <!-- <xsl:value-of select="$charlength"/> -->
1830 <!-- <xsl:value-of select="$current_indent"/> -->
1832 <xsl:when test="$charlength > $framewidth">
1834 <xsl:call-template name="mksymbol-1">
1835 <xsl:with-param name="symbol" select="'lambda'"/>
1836 <xsl:with-param name="color" select="'red'"/>
1837 <xsl:with-param name="size" select="'+2'"/>
1838 </xsl:call-template>
1839 <xsl:apply-templates select="m:bvar/m:ci"/>
1840 <xsl:text>:</xsl:text>
1841 <xsl:apply-templates select="m:bvar/m:type">
1842 <xsl:with-param name="current_indent"
1843 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
1844 </xsl:apply-templates><br/>
1845 <xsl:call-template name="make_indent">
1846 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1847 </xsl:call-template>
1848 <xsl:text>.</xsl:text>
1849 <xsl:apply-templates select="*[position()=2]">
1850 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1851 </xsl:apply-templates>
1854 <xsl:apply-templates mode="inline" select="."/>
1860 <xsl:template match="m:ci">
1862 <xsl:when test="boolean(@definitionURL)">
1863 <a href="{@definitionURL}">
1864 <xsl:apply-templates/>
1868 <xsl:value-of select="."/>
1873 <!-- CHAR COUNTING -->
1875 <!-- enter this counting mode selecting the root -->
1876 <xsl:template match="*" mode="root_charcount">
1877 <xsl:param name="incurrent_length" select="0"/>
1879 <xsl:when test="count(*)=0">
1880 <xsl:value-of select="0"/>
1882 <xsl:when test="name()='m:ci'">
1883 <xsl:value-of select="string-length()"/>
1886 <xsl:apply-templates select="*[1]" mode="charcount">
1887 <xsl:with-param name="incurrent_length" select="$incurrent_length"/>
1888 </xsl:apply-templates>
1893 <!-- enter this mode selecting the first child -->
1895 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1896 <xsl:param name="incurrent_length" select="0"/>
1898 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
1899 <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>
1901 <xsl:when test="string($siblength) = """>
1902 <xsl:value-of select="$incurrent_length + string-length()"/>
1905 <xsl:value-of select="number($siblength)"/>
1910 <xsl:value-of select="$incurrent_length + string-length()"/>
1915 <xsl:template match="*" mode="charcount">
1916 <xsl:param name="incurrent_length" select="0"/>
1918 <xsl:when test="count(child::*) = 0">
1919 <xsl:value-of select="$incurrent_length"/>
1922 <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>
1924 <xsl:when test="$framewidth >= number($childlength)">
1925 <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>
1927 <xsl:when test="string($siblength) = """>
1928 <xsl:value-of select="number($childlength)"/>
1931 <xsl:value-of select="number($siblength)"/>
1936 <xsl:value-of select="number($childlength)"/>
1944 <!--***********************************************************************-->
1946 <!--***********************************************************************-->
1950 <xsl:template match="Definition">
1951 <xsl:param name="current_indent" select="0"/>
1953 DEFINITION <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><br/>
1962 <xsl:call-template name="make_indent">
1963 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1964 </xsl:call-template>
1965 <xsl:apply-templates select="body/*[1]">
1966 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1967 </xsl:apply-templates>
1973 <xsl:template match="Axiom">
1974 <xsl:param name="current_indent" select="0"/>
1976 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1978 <xsl:call-template name="make_indent">
1979 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1980 </xsl:call-template>
1981 <xsl:apply-templates select="type/*[1]">
1982 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1983 </xsl:apply-templates>
1987 <!-- UNFINISHED PROOF -->
1989 <xsl:template match="CurrentProof">
1990 <xsl:param name="current_indent" select="0"/>
1992 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1993 THESIS: <xsl:apply-templates select="type/*[1]">
1994 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1995 </xsl:apply-templates><br/>
1997 <xsl:for-each select="Conjecture">
1999 <xsl:call-template name="make_indent">
2000 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
2001 </xsl:call-template>
2002 <xsl:value-of select="./@no"/> :
2003 <xsl:apply-templates select="./*[1]">
2004 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
2005 </xsl:apply-templates>
2009 <xsl:apply-templates select="body/*[1]">
2010 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
2011 </xsl:apply-templates>
2015 <!-- MUTUAL INDUCTIVE DEFINITION -->
2017 <xsl:template match="InductiveDefinition">
2018 <xsl:param name="current_indent" select="0"/>
2020 <xsl:for-each select="InductiveType">
2022 <xsl:when test="position() = 1">
2024 <xsl:when test="string(./@inductive) = "true"">
2025 INDUCTIVE DEFINITION
2028 COINDUCTIVE DEFINITION
2036 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
2038 <xsl:if test="string(../Param) != """>
2039 <xsl:for-each select="../Param">
2040 <xsl:value-of select="./@name"/>
2042 <xsl:apply-templates select="*"/>
2047 <xsl:apply-templates select="./arity/*[1]">
2048 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
2049 </xsl:apply-templates> <br/>
2051 <xsl:for-each select="./Constructor">
2053 <xsl:call-template name="make_indent">
2054 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
2055 </xsl:call-template>
2057 <xsl:when test="position() = 1">
2058 <xsl:text>  </xsl:text>
2061 <xsl:text>| </xsl:text>
2064 <xsl:value-of select="./@name"/>
2065 <xsl:text>: </xsl:text>
2066 <xsl:apply-templates select="./*[1]">
2067 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
2068 </xsl:apply-templates>
2076 <xsl:template match="Variable">
2077 <xsl:param name="current_indent" select="0"/>
2079 VARIABLE <xsl:value-of select="@name"/><br/>
2080 TYPE = <xsl:apply-templates select="type/*[1]">
2081 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
2082 </xsl:apply-templates>
2086 <!--***********************************************************************-->
2088 <!--***********************************************************************-->
2092 <xsl:template match="SECTION">
2093 <xsl:param name="current_indent" select="0"/>
2094 <h1>BEGIN OF SECTION</h1>
2095 <xsl:apply-templates/>
2096 <h1>END OF SECTION</h1>