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'"/>
38 <xsl:include href="html_init.xsl"/>
39 <xsl:include href="html_set.xsl"/>
40 <xsl:include href="html_reals.xsl"/>
42 <xsl:variable name="showcast" select="0"/>
44 <!--***********************************************************************-->
45 <!-- HTML Head and Body -->
46 <!--***********************************************************************-->
48 <!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
50 <!-- document needs method="xml" and searches locally for the dtd if -->
51 <!-- doctype-system is specified (the dtd must exist locally for parsing). -->
52 <!-- For having output html must be media-type="html" and for having the -->
53 <!-- correct <br /> you must specify at least the remote dtd by means of -->
54 <!-- doctype-public -->
58 media-type="text/html"
59 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
61 <xsl:variable name="framewidth" select="45"/>
63 <xsl:template match="/">
64 <xsl:param name="current_indent" select="0"/>
66 <xsl:when test="$type = 'standalone'">
69 <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
70 <style> A { text-decoration: none } </style>
72 <body bgcolor="white">
74 <xsl:with-param name="current_indent" select="0"/>
75 </xsl:apply-templates>
82 <xsl:with-param name="current_indent" select="0"/>
83 </xsl:apply-templates>
89 <!--***********************************************************************-->
91 <!--***********************************************************************-->
93 <xsl:template name="make_indent">
94 <xsl:param name="current_indent" select="0"/>
95 <xsl:if test="$current_indent > 0">
96 <xsl:text> </xsl:text>
97 <xsl:call-template name="make_indent">
98 <xsl:with-param name="current_indent" select="$current_indent - 1"/>
103 <!-- Syntactic Sugar -->
104 <xsl:template match="m:type">
105 <xsl:param name="current_indent" select="0"/>
106 <xsl:apply-templates>
107 <xsl:with-param name="current_indent"
108 select="$current_indent"/>
109 </xsl:apply-templates>
112 <xsl:template match="m:condition">
113 <xsl:param name="current_indent" select="0"/>
114 <xsl:apply-templates>
115 <xsl:with-param name="current_indent"
116 select="$current_indent"/>
117 </xsl:apply-templates>
120 <xsl:template match="m:math">
121 <xsl:param name="current_indent" select="0"/>
122 <xsl:apply-templates>
123 <xsl:with-param name="current_indent"
124 select="$current_indent"/>
125 </xsl:apply-templates>
128 <!--*********************************************************************-->
130 <!--*********************************************************************-->
133 <xsl:template mode="inline" match="m:ci">
135 <xsl:when test="boolean(@definitionURL)">
136 <a href="{@definitionURL}">
137 <xsl:apply-templates/>
141 <xsl:value-of select="."/>
148 <xsl:template match="m:apply[m:csymbol]" mode="inline">
149 <xsl:variable name="name">
150 <xsl:value-of select="m:csymbol"/>
154 <xsl:when test="$name='forall'">
155 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
156 <xsl:apply-templates select="m:bvar/m:ci"/>
157 <xsl:text>:</xsl:text>
158 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
159 <xsl:text>.</xsl:text>
160 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
162 <xsl:when test="$name='prod'">
163 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
164 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
165 <xsl:text>:</xsl:text>
166 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
167 <xsl:text>.</xsl:text>
168 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
171 <xsl:when test="$name='arrow'">
172 <xsl:text>(</xsl:text>
173 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
174 <FONT color="blue" SIZE="+0" FACE="symbol">
175 <xsl:text>®</xsl:text>
177 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
178 <xsl:text>)</xsl:text>
181 <xsl:when test="$name='app'">
182 <xsl:text>(</xsl:text>
183 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
184 <xsl:for-each select="*[position()>2]">
185 <xsl:text> </xsl:text>
186 <xsl:apply-templates mode="inline" select="."/>
188 <xsl:text>)</xsl:text>
191 <xsl:when test="$name='cast'">
192 <xsl:text>(</xsl:text>
193 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
194 <xsl:text>:></xsl:text>
195 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
196 <xsl:text>)</xsl:text>
198 <xsl:when test="$name='Prop'">
199 <FONT color="violet">Prop</FONT>
201 <xsl:when test="$name='Set'">
202 <FONT color="violet">Set</FONT>
204 <xsl:when test="$name='Type'">
205 <FONT color="violet">Type</FONT>
208 <xsl:when test="$name='mutcase'">
209 <xsl:text><</xsl:text>
210 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
211 <xsl:text>> </xsl:text>
212 <FONT color="red">CASE </FONT>
213 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
214 <FONT color="red"> OF </FONT>
215 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
217 <xsl:when test="not(position() = 1)">
218 <xsl:text> | </xsl:text>
221 <xsl:apply-templates mode="inline" select="."/>
222 <FONT FACE="Symbol" SIZE="+0" mathcolor="green">Þ</FONT>
223 <xsl:apply-templates mode="inline"
224 select="following-sibling::*[position()= 1]"/>
228 <xsl:when test="$name='fix'">
229 <FONT color="red">FIX</FONT>
230 <xsl:value-of select="m:ci"/>
231 <xsl:text>{</xsl:text>
232 <xsl:for-each select="m:bvar">
233 <xsl:value-of select="m:ci"/>
234 <xsl:text>:</xsl:text>
235 <xsl:apply-templates mode="inline" select="m:type"/>
236 <xsl:text>:=</xsl:text>
237 <xsl:apply-templates mode="inline"
238 select="following-sibling::*[position() = 1]"/>
240 <xsl:when test="position()=last()">
241 <xsl:text>}</xsl:text>
244 <xsl:text>;</xsl:text>
250 <xsl:when test="$name='cofix'">
251 <xsl:text>COFIX</xsl:text>
252 <xsl:value-of select="m:ci"/>
253 <xsl:text>{</xsl:text>
254 <xsl:for-each select="m:bvar">
255 <xsl:value-of select="m:ci"/>
256 <xsl:text>:</xsl:text>
257 <xsl:apply-templates mode="inline" select="m:type"/>
258 <xsl:text>:=</xsl:text>
259 <xsl:apply-templates mode="inline"
260 select="following-sibling::*[position() = 1]"/>
262 <xsl:when test="position()=last()">
263 <xsl:text>}</xsl:text>
266 <xsl:text>;</xsl:text>
272 <xsl:when test="$name='proof'">
273 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
274 <FONT color="red"> proves </FONT>
275 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
278 <xsl:when test="$name='false_ind'">
279 <xsl:apply-templates mode="inline" select="*[3]"/>
280 <FONT color="red">Contradiction.</FONT>
283 <xsl:when test="$name='and_ind'">
284 <FONT color="red">From </FONT>
285 <xsl:apply-templates select="*[2]"/>
286 <FONT color="red"> we get</FONT>
288 <xsl:apply-templates select="*[3]"/>
290 <xsl:apply-templates mode="inline" select="*[4]"/>
291 <FONT color="red"> and </FONT>
293 <xsl:apply-templates select="*[5]"/>
295 <xsl:apply-templates mode="inline" select="*[6]"/>
297 <FONT color="red"> hence </FONT>
298 <xsl:apply-templates mode="inline" select="*[7]"/>
302 <xsl:when test="$name='interp'">
303 <font color="green">[</font>
304 <xsl:apply-templates select="*[2]"/>
305 <font color="green">]</font>
311 <xsl:template mode="inline" match="m:lambda">
312 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
313 <xsl:apply-templates select="m:bvar/m:ci"/>
314 <xsl:text>:</xsl:text>
315 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
316 <xsl:text>.</xsl:text>
317 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
320 <!--*********************************************************************-->
321 <!-- COUNTING MODE -->
322 <!--*********************************************************************-->
324 <xsl:template match="m:apply[m:csymbol]">
325 <xsl:param name="current_indent" select="0"/>
326 <xsl:param name="width" select="$framewidth"/>
327 <xsl:variable name="name">
328 <xsl:value-of select="m:csymbol"/>
330 <xsl:variable name="charlength">
331 <xsl:apply-templates select="m:csymbol" mode="charcount"/>
333 <!-- <xsl:value-of select="$current_indent"/> -->
334 <!-- <xsl:value-of select="$charlength"/> -->
337 <xsl:when test="$name='forall'">
339 <xsl:when test="$charlength > $framewidth">
341 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
342 <xsl:apply-templates select="m:bvar/m:ci"/>
343 <xsl:text>:</xsl:text>
344 <xsl:apply-templates select="m:bvar/m:type">
345 <xsl:with-param name="current_indent"
346 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
347 </xsl:apply-templates>
349 <xsl:call-template name="make_indent">
350 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
352 <xsl:text>.</xsl:text>
353 <xsl:apply-templates select="*[position()=3]">
354 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
355 </xsl:apply-templates>
358 <xsl:apply-templates mode="inline" select="."/>
363 <xsl:when test="$name='prod'">
365 <xsl:when test="$charlength > $framewidth">
366 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
367 <xsl:apply-templates select="m:bvar/m:ci"/>
368 <xsl:text>:</xsl:text>
369 <xsl:apply-templates select="m:bvar/m:type">
370 <xsl:with-param name="current_indent"
371 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
372 </xsl:apply-templates><br/>
373 <xsl:call-template name="make_indent">
374 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
376 <xsl:text>.</xsl:text>
377 <xsl:apply-templates select="*[position()=3]">
378 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
379 </xsl:apply-templates>
382 <xsl:apply-templates mode="inline" select="."/>
387 <xsl:when test="$name='arrow'">
389 <xsl:when test="$charlength > $framewidth">
390 <xsl:text>(</xsl:text>
391 <xsl:apply-templates select="*[position()=2]">
392 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
393 </xsl:apply-templates>
395 <xsl:call-template name="make_indent">
396 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
399 <FONT color="blue" SIZE="+0" FACE="symbol">
400 <xsl:text>®</xsl:text>
402 <xsl:apply-templates select="*[position()=3]">
403 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
404 </xsl:apply-templates>
405 <xsl:text>)</xsl:text>
408 <xsl:apply-templates mode="inline" select="."/>
413 <xsl:when test="$name='app'">
415 <xsl:when test="$charlength > $framewidth">
416 <xsl:text>(</xsl:text>
417 <xsl:apply-templates select="*[position()=2]">
418 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
419 </xsl:apply-templates>
420 <xsl:for-each select="*[position()>2]">
422 <xsl:call-template name="make_indent">
423 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
425 <xsl:apply-templates select=".">
426 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
427 </xsl:apply-templates>
429 <xsl:text>)</xsl:text>
432 <xsl:apply-templates mode="inline" select="."/>
436 <xsl:when test="$name='cast'">
438 <xsl:when test="$showcast = 1">
440 <xsl:when test="$charlength > $framewidth">
441 <xsl:text>(</xsl:text>
442 <xsl:apply-templates select="*[position()=2]">
443 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
444 </xsl:apply-templates><br/>
445 <xsl:call-template name="make_indent">
446 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
447 <xsl:text>:></xsl:text>
448 <xsl:apply-templates select="*[position()=3]">
449 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
450 </xsl:apply-templates>
451 <xsl:text>)</xsl:text>
454 <xsl:apply-templates mode="inline" select="."/>
459 <xsl:apply-templates select="*[position()=2]">
460 <xsl:with-param name="current_indent" select="$current_indent"/>
461 </xsl:apply-templates>
465 <xsl:when test="$name='Prop'">
466 <xsl:text>Prop</xsl:text>
468 <xsl:when test="$name='Set'">
469 <xsl:text>Set</xsl:text>
471 <xsl:when test="$name='Type'">
472 <xsl:text>Type</xsl:text>
474 <xsl:when test="$name='mutcase'">
476 <xsl:when test="$charlength > $framewidth">
477 <xsl:text><</xsl:text>
478 <xsl:apply-templates select="*[position()=2]">
479 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
480 </xsl:apply-templates>
481 <xsl:text>> </xsl:text>
483 <xsl:call-template name="make_indent">
484 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
485 <xsl:text>CASE </xsl:text>
486 <xsl:apply-templates select="*[position()=3]">
487 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
488 </xsl:apply-templates>
489 <xsl:text> OF </xsl:text>
490 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
492 <xsl:call-template name="make_indent">
493 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
496 <xsl:when test="position() = 1">
497 <xsl:text>  </xsl:text>
500 <xsl:text>| </xsl:text>
503 <xsl:apply-templates select="."/>
504 <FONT FACE="Symbol" SIZE="+0" mathcolor="green">Þ</FONT>
505 <xsl:variable name="body_size">
507 select="following-sibling::*[1]/*[1]" mode="charcount"/>
510 <xsl:when test="$body_size > $framewidth">
512 <xsl:call-template name="make_indent">
513 <xsl:with-param name="current_indent"
514 select="$current_indent + 8"/>
517 select="following-sibling::*[position()= 1]">
518 <xsl:with-param name="current_indent"
519 select="$current_indent + 8"/>
520 </xsl:apply-templates>
523 <xsl:apply-templates select="following-sibling::*[position()= 1]"
530 <xsl:apply-templates mode="inline" select="."/>
535 <xsl:when test="$name='fix'">
537 <xsl:when test="$charlength > $framewidth">
538 <xsl:text>FIX</xsl:text>
539 <xsl:value-of select="m:ci"/>
540 <xsl:text>{</xsl:text>
541 <xsl:for-each select="m:bvar">
543 <xsl:call-template name="make_indent">
544 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
546 <xsl:value-of select="m:ci"/>
547 <xsl:text>:</xsl:text>
548 <xsl:apply-templates select="m:type">
549 <xsl:with-param name="current_indent"
550 select="$current_indent + 5 + string-length(m:ci)"/>
551 </xsl:apply-templates>
553 <xsl:call-template name="make_indent">
554 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
556 <xsl:text>:=</xsl:text>
557 <xsl:apply-templates select="following-sibling::*[position() = 1]">
558 <xsl:with-param name="current_indent" select="$current_indent +2"/>
559 </xsl:apply-templates>
562 <xsl:call-template name="make_indent">
563 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
565 <xsl:text>}</xsl:text>
568 <xsl:apply-templates mode="inline" select="."/>
573 <xsl:when test="$name='cofix'">
575 <xsl:when test="($charlength + 10) > $framewidth">
576 <xsl:text>COFIX</xsl:text>
577 <xsl:value-of select="m:ci"/>
578 <xsl:text>{</xsl:text>
580 <xsl:call-template name="make_indent">
581 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
583 <xsl:for-each select="m:bvar">
584 <xsl:value-of select="m:ci"/>
585 <xsl:text>:</xsl:text>
586 <xsl:apply-templates select="m:type">
587 <xsl:with-param name="current_indent"
588 select="$current_indent + 5 + string-length(m:ci)"/>
589 </xsl:apply-templates>
591 <xsl:call-template name="make_indent">
592 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
594 <xsl:text>:=</xsl:text>
595 <xsl:apply-templates select="following-sibling::*[position() = 1]">
596 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
597 </xsl:apply-templates>
601 <xsl:call-template name="make_indent">
602 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
604 <xsl:text>}</xsl:text>
607 <xsl:apply-templates mode="inline" select="m:type"/>
611 <!-- ***************************************** -->
612 <!-- *********** PROOF ELEMENTS ************** -->
613 <!-- ***************************************** -->
615 <xsl:when test="$name='proof'">
616 <xsl:apply-templates select="*[position()=2]">
617 <xsl:with-param name="current_indent" select="$current_indent"/>
618 </xsl:apply-templates>
620 <!-- <xsl:element name="br"/> -->
621 <xsl:call-template name="make_indent">
622 <xsl:with-param name="current_indent" select="$current_indent"/>
624 <FONT color="red">we proved </FONT>
625 <xsl:apply-templates select="*[position()=3]">
626 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
627 </xsl:apply-templates>
630 <xsl:when test="$name='letin1'">
631 <xsl:apply-templates select="*[position()=2]">
632 <xsl:with-param name="current_indent" select="$current_indent"/>
633 </xsl:apply-templates>
635 <xsl:call-template name="make_indent">
636 <xsl:with-param name="current_indent" select="$current_indent"/>
638 <xsl:apply-templates select="*[position()=3]">
639 <xsl:with-param name="current_indent" select="$current_indent"/>
640 </xsl:apply-templates>
643 <xsl:when test="$name='letin'">
644 <xsl:for-each select="*[position()>1 and last()>position()]">
645 <xsl:apply-templates select=".">
646 <xsl:with-param name="current_indent" select="$current_indent"/>
647 </xsl:apply-templates>
649 <xsl:call-template name="make_indent">
650 <xsl:with-param name="current_indent" select="$current_indent"/>
653 <xsl:apply-templates select="*[position()=last()]">
654 <xsl:with-param name="current_indent" select="$current_indent"/>
655 </xsl:apply-templates>
658 <xsl:when test="$name='let'">
660 <xsl:apply-templates select="m:ci"/>
662 <xsl:apply-templates select="*[3]">
663 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
664 </xsl:apply-templates>
667 <xsl:when test="$name='rw_step'">
669 <xsl:when test="name(*[2])='m:apply'">
670 <xsl:apply-templates select="*[2]">
671 <xsl:with-param name="current_indent" select="$current_indent"/>
672 </xsl:apply-templates>
675 <FONT color="red">Consider </FONT>
676 <xsl:apply-templates select="*[2]"/>
679 <xsl:variable name="charlength_first">
680 <xsl:apply-templates select="*[3]/*[1]" mode="charcount"/>
682 <xsl:variable name="charlength_second">
683 <xsl:apply-templates select="*[4]/*[1]" mode="charcount"/>
685 <xsl:variable name="charlength_side_proof">
686 <xsl:apply-templates select="*[5]/*[1]" mode="charcount"/>
688 <xsl:variable name="split1"
689 select="$charlength_first + $charlength_second > $framewidth"/>
690 <xsl:variable name="split2"
691 select="$charlength_second + $charlength_side_proof > $framewidth"/>
692 <!-- <xsl:value-of select="$current_indent"/> -->
693 <!-- <xsl:value-of select="$charlength"/> -->
695 <xsl:call-template name="make_indent">
696 <xsl:with-param name="current_indent" select="$current_indent"/>
698 <FONT color="red">Rewrite </FONT>
699 <xsl:apply-templates mode="inline" select="*[3]"/>
700 <xsl:text> </xsl:text>
701 <xsl:if test="$split1">
703 <xsl:call-template name="make_indent">
704 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
707 <FONT color="red">with </FONT>
708 <xsl:apply-templates mode="inline" select="*[4]"/>
709 <xsl:text> </xsl:text>
710 <xsl:if test="$split2">
712 <xsl:call-template name="make_indent">
713 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
716 <FONT color="red">by </FONT>
717 <xsl:apply-templates select="*[5]">
718 <xsl:with-param name="current_indent" select="$current_indent+7"/>
719 </xsl:apply-templates>
721 <!-- rewrite and apply -->
722 <xsl:when test="$name='rewrite_and_apply'">
723 <xsl:apply-templates select="*[2]">
724 <xsl:with-param name="current_indent" select="$current_indent"/>
725 </xsl:apply-templates>
727 <xsl:call-template name="make_indent">
728 <xsl:with-param name="current_indent" select="$current_indent"/>
730 <FONT color="red">Then apply it to </FONT>
731 <xsl:apply-templates select="*[position()>2]"/>
733 <!-- by_induction -->
734 <xsl:when test="$name='by_induction'">
735 <FONT color="red">We prove </FONT>
736 <xsl:apply-templates select="../*[3]">
737 <xsl:with-param name="current_indent" select="$current_indent+18"/>
738 </xsl:apply-templates>
740 <xsl:call-template name="make_indent">
741 <xsl:with-param name="current_indent" select="$current_indent"/>
743 <FONT color="red">by induction on </FONT>
744 <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
745 <xsl:with-param name="current_indent" select="$current_indent+30"/>
746 </xsl:apply-templates>
749 <xsl:call-template name="make_indent">
750 <xsl:with-param name="current_indent" select="$current_indent"/>
752 <xsl:text>The induction property is</xsl:text>
754 <xsl:call-template name="make_indent">
755 <xsl:with-param name="current_indent" select="$current_indent"/>
757 <xsl:apply-templates select="*[3]">
758 <xsl:with-param name="current_indent" select="$current_indent"/>
759 </xsl:apply-templates>
762 select="*[position()>3 and not(position()=last())]">
763 <xsl:with-param name="current_indent" select="$current_indent+4"/>
764 </xsl:apply-templates>
766 <xsl:call-template name="make_indent">
767 <xsl:with-param name="current_indent" select="$current_indent"/>
769 <xsl:text>End induction</xsl:text> -->
771 <!-- inductive_case -->
772 <xsl:when test="$name='inductive_case'">
774 <xsl:call-template name="make_indent">
775 <xsl:with-param name="current_indent" select="$current_indent"/>
777 <FONT color="red">Case </FONT>
778 <xsl:apply-templates select="*[2]">
779 <xsl:with-param name="current_indent" select="$current_indent +10"/>
780 </xsl:apply-templates>
781 <xsl:if test="*[3]/*[position()>1]">
783 <xsl:call-template name="make_indent">
784 <xsl:with-param name="current_indent" select="$current_indent+4"/>
786 <FONT color="red">By induction hypothesis, we have:</FONT>
787 <xsl:for-each select="*[3]/*[position()>1]">
789 <xsl:call-template name="make_indent">
790 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
792 <xsl:text>(</xsl:text>
793 <xsl:apply-templates select="m:ci"/>
794 <xsl:text>) </xsl:text>
795 <xsl:apply-templates select="m:type">
796 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
797 </xsl:apply-templates>
801 <xsl:call-template name="make_indent">
802 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
804 <xsl:apply-templates select="*[4]">
805 <xsl:with-param name="current_indent" select="$current_indent +4"/>
806 </xsl:apply-templates>
808 <xsl:call-template name="make_indent">
809 <xsl:with-param name="current_indent" select="$current_indent"/>
811 <xsl:text>End Case</xsl:text> -->
814 <xsl:when test="$name='case_lhs'">
816 <xsl:when test="count(*)=2">
817 <xsl:apply-templates mode="inline" select="*[2]"/>
820 <xsl:text>(</xsl:text>
821 <xsl:apply-templates mode="inline" select="*[2]"/>
822 <xsl:for-each select="m:bvar">
823 <xsl:text> </xsl:text>
824 <xsl:apply-templates mode="inline" select="*[1]"/>
825 <xsl:text>:</xsl:text>
826 <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
828 <xsl:text>)</xsl:text>
833 <xsl:when test="$name='nat_ind_complete'">
834 <FONT color="red">By induction on </FONT>
835 <xsl:apply-templates select="*[2]"/>:
837 <xsl:call-template name="make_indent">
838 <xsl:with-param name="current_indent" select="$current_indent"/>
840 <xsl:text>0 </xsl:text>
841 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
842 <xsl:apply-templates select="*[3]">
843 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
844 </xsl:apply-templates>
846 <xsl:call-template name="make_indent">
847 <xsl:with-param name="current_indent" select="$current_indent"/>
849 <xsl:text>S(</xsl:text>
850 <xsl:apply-templates select="*[4]"/>
851 <xsl:text>) </xsl:text>
852 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
853 <FONT color="red">Assume by induction</FONT>
855 <xsl:call-template name="make_indent">
856 <xsl:with-param name="current_indent" select="$current_indent +10"/>
858 <xsl:text>(</xsl:text>
859 <xsl:apply-templates select="*[5]"/>
860 <xsl:text>)</xsl:text>
861 <xsl:apply-templates select="*[6]">
862 <xsl:with-param name="current_indent" select="$current_indent + 14"/>
863 </xsl:apply-templates>
865 <xsl:call-template name="make_indent">
866 <xsl:with-param name="current_indent" select="$current_indent +10"/>
868 <xsl:apply-templates select="*[7]">
869 <xsl:with-param name="current_indent" select="$current_indent + 10"/>
870 </xsl:apply-templates>
873 <xsl:when test="$name='false_ind'">
874 <xsl:apply-templates select="*[3]">
875 <xsl:with-param name="current_indent" select="$current_indent"/>
876 </xsl:apply-templates>
878 <xsl:call-template name="make_indent">
879 <xsl:with-param name="current_indent" select="$current_indent"/>
881 <FONT color="red">Contradiction.</FONT>
884 <xsl:when test="$name='and_ind'">
886 <xsl:when test="name(*[2])='m:apply'">
887 <xsl:apply-templates select="*[2]">
888 <xsl:with-param name="current_indent" select="$current_indent"/>
889 </xsl:apply-templates>
892 <FONT color="red">Consider </FONT>
893 <xsl:apply-templates select="*[2]"/>
897 <xsl:call-template name="make_indent">
898 <xsl:with-param name="current_indent" select="$current_indent"/>
900 <FONT color="red">In particular, we have</FONT>
902 <xsl:call-template name="make_indent">
903 <xsl:with-param name="current_indent" select="$current_indent"/>
906 <xsl:apply-templates select="*[3]"/>
908 <xsl:apply-templates select="*[4]">
909 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
910 </xsl:apply-templates>
912 <xsl:call-template name="make_indent">
913 <xsl:with-param name="current_indent" select="$current_indent"/>
916 <xsl:apply-templates select="*[5]"/>
918 <xsl:apply-templates select="*[6]">
919 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
920 </xsl:apply-templates>
922 <xsl:call-template name="make_indent">
923 <xsl:with-param name="current_indent" select="$current_indent"/>
925 <xsl:apply-templates select="*[7]">
926 <xsl:with-param name="current_indent" select="$current_indent"/>
927 </xsl:apply-templates>
930 <xsl:when test="$name='full_or_ind'">
932 <xsl:when test="name(*[2])='m:apply'">
933 <xsl:apply-templates select="*[2]">
934 <xsl:with-param name="current_indent" select="$current_indent"/>
935 </xsl:apply-templates>
938 <FONT color="red">Consider </FONT>
939 <xsl:apply-templates select="*[2]"/>
943 <xsl:call-template name="make_indent">
944 <xsl:with-param name="current_indent" select="$current_indent"/>
946 <FONT color="red">We proceed by cases to prove </FONT>
947 <xsl:apply-templates select="*[3]"/>
949 <xsl:call-template name="make_indent">
950 <xsl:with-param name="current_indent" select="$current_indent+4"/>
952 <FONT color="red">Left: suppose </FONT>
953 <xsl:text>(</xsl:text>
954 <xsl:value-of select="*[4]/m:bvar/m:ci"/>
955 <xsl:text>) </xsl:text>
957 select="*[4]/m:bvar/m:type/*[1]"/>
959 <xsl:call-template name="make_indent">
960 <xsl:with-param name="current_indent" select="$current_indent+15"/>
964 <xsl:with-param name="current_indent" select="$current_indent+15"/>
965 </xsl:apply-templates>
967 <xsl:call-template name="make_indent">
968 <xsl:with-param name="current_indent" select="$current_indent+4"/>
970 <FONT color="red">Right: suppose </FONT>
971 <xsl:text>(</xsl:text>
972 <xsl:value-of select="*[5]/m:bvar/m:ci"/>
973 <xsl:text>) </xsl:text>
975 select="*[5]/m:bvar/m:type/*[1]"/>
977 <xsl:call-template name="make_indent">
978 <xsl:with-param name="current_indent" select="$current_indent+16"/>
982 <xsl:with-param name="current_indent" select="$current_indent+16"/>
983 </xsl:apply-templates>
986 <xsl:when test="$name='or_ind'">
988 <xsl:when test="name(*[2])='m:apply'">
989 <xsl:apply-templates select="*[2]">
990 <xsl:with-param name="current_indent" select="$current_indent"/>
991 </xsl:apply-templates>
994 <FONT color="red">Consider </FONT>
995 <xsl:apply-templates select="*[2]"/>
999 <xsl:call-template name="make_indent">
1000 <xsl:with-param name="current_indent" select="$current_indent"/>
1001 </xsl:call-template>
1002 <FONT color="red">We prove </FONT>
1003 <xsl:apply-templates select="*[3]"/>
1004 <FONT color="red"> by cases:</FONT>
1006 <xsl:call-template name="make_indent">
1007 <xsl:with-param name="current_indent" select="$current_indent"/>
1008 </xsl:call-template>
1010 <xsl:apply-templates select="*[4]">
1011 <xsl:with-param name="current_indent" select="$current_indent"/>
1012 </xsl:apply-templates>
1014 <xsl:call-template name="make_indent">
1015 <xsl:with-param name="current_indent" select="$current_indent"/>
1016 </xsl:call-template>
1018 <xsl:apply-templates select="*[5]">
1019 <xsl:with-param name="current_indent" select="$current_indent"/>
1020 </xsl:apply-templates>
1023 <xsl:when test="$name='ex_ind'">
1025 <xsl:when test="name(*[2])='m:apply'">
1026 <xsl:apply-templates select="*[2]">
1027 <xsl:with-param name="current_indent" select="$current_indent"/>
1028 </xsl:apply-templates>
1031 <FONT color="red">Consider </FONT>
1032 <xsl:apply-templates select="*[2]">
1033 <xsl:with-param name="current_indent" select="$current_indent"/>
1034 </xsl:apply-templates>
1038 <xsl:call-template name="make_indent">
1039 <xsl:with-param name="current_indent" select="$current_indent"/>
1040 </xsl:call-template>
1041 <FONT color="red">Let </FONT>
1042 <xsl:apply-templates mode="inline" select="*[3]"/>
1044 <xsl:apply-templates mode="inline" select="*[4]"/>
1045 <FONT color="red"> such that</FONT>
1047 <xsl:call-template name="make_indent">
1048 <xsl:with-param name="current_indent" select="$current_indent"/>
1049 </xsl:call-template>
1051 <xsl:apply-templates mode="inline" select="*[5]"/>
1053 <xsl:apply-templates select="*[6]">
1054 <xsl:with-param name="current_indent" select="$current_indent +7"/>
1055 </xsl:apply-templates>
1057 <xsl:call-template name="make_indent">
1058 <xsl:with-param name="current_indent" select="$current_indent"/>
1059 </xsl:call-template>
1060 <xsl:apply-templates select="*[7]">
1061 <xsl:with-param name="current_indent" select="$current_indent"/>
1062 </xsl:apply-templates>
1066 <xsl:when test="$name='interp'">
1067 <font color="green">[</font>
1068 <xsl:apply-templates select="*[2]"/>
1069 <font color="green">]</font>
1077 <xsl:template match="m:lambda">
1078 <xsl:param name="current_indent" select="0"/>
1079 <xsl:variable name="charlength">
1080 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
1081 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
1083 <!-- <xsl:value-of select="$charlength"/> -->
1084 <!-- <xsl:value-of select="$current_indent"/> -->
1086 <xsl:when test="$charlength > $framewidth">
1088 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
1089 <xsl:apply-templates select="m:bvar/m:ci"/>
1090 <xsl:text>:</xsl:text>
1091 <xsl:apply-templates select="m:bvar/m:type">
1092 <xsl:with-param name="current_indent"
1093 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
1094 </xsl:apply-templates><br/>
1095 <xsl:call-template name="make_indent">
1096 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1097 </xsl:call-template>
1098 <xsl:text>.</xsl:text>
1099 <xsl:apply-templates select="*[position()=2]">
1100 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1101 </xsl:apply-templates>
1104 <xsl:apply-templates mode="inline" select="."/>
1110 <xsl:template match="m:ci">
1112 <xsl:when test="boolean(@definitionURL)">
1113 <a href="{@definitionURL}">
1114 <xsl:apply-templates/>
1118 <xsl:value-of select="."/>
1125 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1126 <xsl:param name="incurrent_length" select="0"/>
1128 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
1129 <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>
1131 <xsl:when test="string($siblength) = """>
1132 <xsl:value-of select="$incurrent_length + string-length()"/>
1135 <xsl:value-of select="number($siblength)"/>
1140 <xsl:value-of select="$incurrent_length + string-length()"/>
1145 <xsl:template match="*" mode="charcount">
1146 <xsl:param name="incurrent_length" select="0"/>
1148 <xsl:when test="count(child::*) = 0">
1149 <xsl:value-of select="$incurrent_length"/>
1152 <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>
1154 <xsl:when test="$framewidth >= number($childlength)">
1155 <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>
1157 <xsl:when test="string($siblength) = """>
1158 <xsl:value-of select="number($childlength)"/>
1161 <xsl:value-of select="number($siblength)"/>
1166 <xsl:value-of select="number($childlength)"/>
1174 <!--***********************************************************************-->
1176 <!--***********************************************************************-->
1180 <xsl:template match="Definition">
1181 <xsl:param name="current_indent" select="0"/>
1183 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1185 <xsl:call-template name="make_indent">
1186 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1187 </xsl:call-template>
1188 <xsl:apply-templates select="type/*[1]">
1189 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1190 </xsl:apply-templates><br/>
1192 <xsl:call-template name="make_indent">
1193 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1194 </xsl:call-template>
1195 <xsl:apply-templates select="body/*[1]">
1196 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1197 </xsl:apply-templates>
1203 <xsl:template match="Axiom">
1204 <xsl:param name="current_indent" select="0"/>
1206 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1208 <xsl:call-template name="make_indent">
1209 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1210 </xsl:call-template>
1211 <xsl:apply-templates select="type/*[1]">
1212 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1213 </xsl:apply-templates>
1217 <!-- UNFINISHED PROOF -->
1219 <xsl:template match="CurrentProof">
1220 <xsl:param name="current_indent" select="0"/>
1222 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1223 THESIS: <xsl:apply-templates select="type/*[1]">
1224 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1225 </xsl:apply-templates><br/>
1227 <xsl:for-each select="Conjecture">
1229 <xsl:call-template name="make_indent">
1230 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1231 </xsl:call-template>
1232 <xsl:value-of select="./@no"/> :
1233 <xsl:apply-templates select="./*[1]">
1234 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
1235 </xsl:apply-templates>
1239 <xsl:apply-templates select="body/*[1]">
1240 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1241 </xsl:apply-templates>
1245 <!-- MUTUAL INDUCTIVE DEFINITION -->
1247 <xsl:template match="InductiveDefinition">
1248 <xsl:param name="current_indent" select="0"/>
1250 <xsl:for-each select="InductiveType">
1252 <xsl:when test="position() = 1">
1254 <xsl:when test="string(./@inductive) = "true"">
1255 INDUCTIVE DEFINITION
1258 COINDUCTIVE DEFINITION
1266 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
1268 <xsl:if test="string(../Param) != """>
1269 <xsl:for-each select="../Param">
1270 <xsl:value-of select="./@name"/>
1272 <xsl:apply-templates select="*"/>
1277 <xsl:apply-templates select="./arity/*[1]">
1278 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1279 </xsl:apply-templates> <br/>
1281 <xsl:for-each select="./Constructor">
1283 <xsl:call-template name="make_indent">
1284 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1285 </xsl:call-template>
1287 <xsl:when test="position() = 1">
1288 <xsl:text>  </xsl:text>
1291 <xsl:text>| </xsl:text>
1294 <xsl:value-of select="./@name"/>
1295 <xsl:text>: </xsl:text>
1296 <xsl:apply-templates select="./*[1]">
1297 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
1298 </xsl:apply-templates>
1306 <xsl:template match="Variable">
1307 <xsl:param name="current_indent" select="0"/>
1309 VARIABLE <xsl:value-of select="@name"/><br/>
1310 TYPE = <xsl:apply-templates select="type/*[1]">
1311 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1312 </xsl:apply-templates>
1316 <!--***********************************************************************-->
1318 <!--***********************************************************************-->
1322 <xsl:template match="SECTION">
1323 <xsl:param name="current_indent" select="0"/>
1324 <h1>BEGIN OF SECTION</h1>
1325 <xsl:apply-templates/>
1326 <h1>END OF SECTION</h1>