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 -->
33 <!--***********************************************************************-->
35 <xsl:include href="html_init.xsl"/>
36 <xsl:include href="html_set.xsl"/>
37 <xsl:include href="html_reals.xsl"/>
39 <xsl:variable name="showcast" select="0"/>
41 <!--***********************************************************************-->
42 <!-- HTML Head and Body -->
43 <!--***********************************************************************-->
45 <!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
47 <!-- document needs method="xml" and searches locally for the dtd if -->
48 <!-- doctype-system is specified (the dtd must exist locally for parsing). -->
49 <!-- For having output html must be media-type="html" and for having the -->
50 <!-- correct <br /> you must specify at least the remote dtd by means of -->
51 <!-- doctype-public -->
55 media-type="text/html"
56 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
58 <xsl:variable name="framewidth" select="45"/>
60 <xsl:template match="/">
61 <xsl:param name="current_indent" select="0"/>
65 A { text-decoration: none }
68 <body bgcolor="white">
70 <xsl:with-param name="current_indent" select="0"/>
71 </xsl:apply-templates>
76 <!--***********************************************************************-->
78 <!--***********************************************************************-->
80 <xsl:template name="make_indent">
81 <xsl:param name="current_indent" select="0"/>
82 <xsl:if test="$current_indent > 0">
83 <xsl:text> </xsl:text>
84 <xsl:call-template name="make_indent">
85 <xsl:with-param name="current_indent" select="$current_indent - 1"/>
90 <!-- Syntactic Sugar -->
91 <xsl:template match="m:type">
92 <xsl:param name="current_indent" select="0"/>
94 <xsl:with-param name="current_indent"
95 select="$current_indent"/>
96 </xsl:apply-templates>
99 <xsl:template match="m:condition">
100 <xsl:param name="current_indent" select="0"/>
101 <xsl:apply-templates>
102 <xsl:with-param name="current_indent"
103 select="$current_indent"/>
104 </xsl:apply-templates>
107 <xsl:template match="m:math">
108 <xsl:param name="current_indent" select="0"/>
109 <xsl:apply-templates>
110 <xsl:with-param name="current_indent"
111 select="$current_indent"/>
112 </xsl:apply-templates>
115 <!--*********************************************************************-->
117 <!--*********************************************************************-->
120 <xsl:template mode="inline" match="m:ci">
122 <xsl:when test="boolean(@definitionURL)">
123 <a href="{@definitionURL}">
124 <xsl:apply-templates/>
128 <xsl:value-of select="."/>
135 <xsl:template match="m:apply[m:csymbol]" mode="inline">
136 <xsl:variable name="name">
137 <xsl:value-of select="m:csymbol"/>
141 <xsl:when test="$name='forall'">
142 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
143 <xsl:apply-templates select="m:bvar/m:ci"/>
144 <xsl:text>:</xsl:text>
145 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
146 <xsl:text>.</xsl:text>
147 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
149 <xsl:when test="$name='prod'">
150 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
151 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
152 <xsl:text>:</xsl:text>
153 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
154 <xsl:text>.</xsl:text>
155 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
158 <xsl:when test="$name='arrow'">
159 <xsl:text>(</xsl:text>
160 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
161 <FONT color="blue" FACE="symbol">
162 <xsl:text>®</xsl:text>
164 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
165 <xsl:text>)</xsl:text>
168 <xsl:when test="$name='app'">
169 <xsl:text>(</xsl:text>
170 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
171 <xsl:for-each select="*[position()>2]">
172 <xsl:text> </xsl:text>
173 <xsl:apply-templates mode="inline" select="."/>
175 <xsl:text>)</xsl:text>
178 <xsl:when test="$name='cast'">
179 <xsl:text>(</xsl:text>
180 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
181 <xsl:text>:></xsl:text>
182 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
183 <xsl:text>)</xsl:text>
185 <xsl:when test="$name='Prop'">
186 <FONT color="violet">Prop</FONT>
188 <xsl:when test="$name='Set'">
189 <FONT color="violet">Set</FONT>
191 <xsl:when test="$name='Type'">
192 <FONT color="violet">Type</FONT>
195 <xsl:when test="$name='mutcase'">
196 <xsl:text><</xsl:text>
197 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
198 <xsl:text>> </xsl:text>
199 <FONT color="red">CASE </FONT>
200 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
201 <FONT color="red"> OF </FONT>
202 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
204 <xsl:when test="not(position() = 1)">
205 <xsl:text> | </xsl:text>
208 <xsl:apply-templates mode="inline" select="."/>
209 <FONT FACE="Symbol" SIZE="+2" mathcolor="green">Þ</FONT>
210 <xsl:apply-templates mode="inline"
211 select="following-sibling::*[position()= 1]"/>
215 <xsl:when test="$name='fix'">
216 <FONT color="red">FIX</FONT>
217 <xsl:value-of select="m:ci"/>
218 <xsl:text>{</xsl:text>
219 <xsl:for-each select="m:bvar">
220 <xsl:value-of select="m:ci"/>
221 <xsl:text>:</xsl:text>
222 <xsl:apply-templates mode="inline" select="m:type"/>
223 <xsl:text>:=</xsl:text>
224 <xsl:apply-templates mode="inline"
225 select="following-sibling::*[position() = 1]"/>
227 <xsl:when test="position()=last()">
228 <xsl:text>}</xsl:text>
231 <xsl:text>;</xsl:text>
237 <xsl:when test="$name='cofix'">
238 <xsl:text>COFIX</xsl:text>
239 <xsl:value-of select="m:ci"/>
240 <xsl:text>{</xsl:text>
241 <xsl:for-each select="m:bvar">
242 <xsl:value-of select="m:ci"/>
243 <xsl:text>:</xsl:text>
244 <xsl:apply-templates mode="inline" select="m:type"/>
245 <xsl:text>:=</xsl:text>
246 <xsl:apply-templates mode="inline"
247 select="following-sibling::*[position() = 1]"/>
249 <xsl:when test="position()=last()">
250 <xsl:text>}</xsl:text>
253 <xsl:text>;</xsl:text>
259 <xsl:when test="$name='proof'">
260 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
261 <FONT color="red"> proves </FONT>
262 <xsl:apply-templates mode="inline" select="*[position()=3]"/>
265 <xsl:when test="$name='false_ind'">
266 <xsl:apply-templates mode="inline" select="*[3]"/>
267 <FONT color="red">Contradiction.</FONT>
270 <xsl:when test="$name='and_ind'">
271 <FONT color="red">From </FONT>
272 <xsl:apply-templates select="*[2]"/>
273 <FONT color="red"> we get</FONT>
275 <xsl:apply-templates select="*[3]"/>
277 <xsl:apply-templates mode="inline" select="*[4]"/>
278 <FONT color="red"> and </FONT>
280 <xsl:apply-templates select="*[5]"/>
282 <xsl:apply-templates mode="inline" select="*[6]"/>
284 <FONT color="red"> hence </FONT>
285 <xsl:apply-templates mode="inline" select="*[7]"/>
290 <xsl:template mode="inline" match="m:lambda">
291 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
292 <xsl:apply-templates select="m:bvar/m:ci"/>
293 <xsl:text>:</xsl:text>
294 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
295 <xsl:text>.</xsl:text>
296 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
299 <!--*********************************************************************-->
300 <!-- COUNTING MODE -->
301 <!--*********************************************************************-->
303 <xsl:template match="m:apply[m:csymbol]">
304 <xsl:param name="current_indent" select="0"/>
305 <xsl:param name="width" select="$framewidth"/>
306 <xsl:variable name="name">
307 <xsl:value-of select="m:csymbol"/>
309 <xsl:variable name="charlength">
310 <xsl:apply-templates select="m:csymbol" mode="charcount"/>
312 <!-- <xsl:value-of select="$current_indent"/> -->
313 <!-- <xsl:value-of select="$charlength"/> -->
316 <xsl:when test="$name='forall'">
318 <xsl:when test="$charlength > $framewidth">
320 <FONT FACE="Symbol" SIZE="+2" color="blue">"</FONT>
321 <xsl:apply-templates select="m:bvar/m:ci"/>
322 <xsl:text>:</xsl:text>
323 <xsl:apply-templates select="m:bvar/m:type">
324 <xsl:with-param name="current_indent"
325 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
326 </xsl:apply-templates>
328 <xsl:call-template name="make_indent">
329 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
331 <xsl:text>.</xsl:text>
332 <xsl:apply-templates select="*[position()=3]">
333 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
334 </xsl:apply-templates>
337 <xsl:apply-templates mode="inline" select="."/>
342 <xsl:when test="$name='prod'">
344 <xsl:when test="$charlength > $framewidth">
345 <FONT FACE="Symbol" SIZE="+2" color="blue">Õ</FONT>
346 <xsl:apply-templates select="m:bvar/m:ci"/>
347 <xsl:text>:</xsl:text>
348 <xsl:apply-templates select="m:bvar/m:type">
349 <xsl:with-param name="current_indent"
350 select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
351 </xsl:apply-templates><br/>
352 <xsl:call-template name="make_indent">
353 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
355 <xsl:text>.</xsl:text>
356 <xsl:apply-templates select="*[position()=3]">
357 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
358 </xsl:apply-templates>
361 <xsl:apply-templates mode="inline" select="."/>
366 <xsl:when test="$name='arrow'">
368 <xsl:when test="$charlength > $framewidth">
369 <xsl:text>(</xsl:text>
370 <xsl:apply-templates select="*[position()=2]">
371 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
372 </xsl:apply-templates>
374 <xsl:call-template name="make_indent">
375 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
378 <FONT color="blue" FACE="symbol">
379 <xsl:text>®</xsl:text>
381 <xsl:apply-templates select="*[position()=3]">
382 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
383 </xsl:apply-templates>
384 <xsl:text>)</xsl:text>
387 <xsl:apply-templates mode="inline" select="."/>
392 <xsl:when test="$name='app'">
394 <xsl:when test="$charlength > $framewidth">
395 <xsl:text>(</xsl:text>
396 <xsl:apply-templates select="*[position()=2]">
397 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
398 </xsl:apply-templates>
399 <xsl:for-each select="*[position()>2]">
401 <xsl:call-template name="make_indent">
402 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
404 <xsl:apply-templates select=".">
405 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
406 </xsl:apply-templates>
408 <xsl:text>)</xsl:text>
411 <xsl:apply-templates mode="inline" select="."/>
415 <xsl:when test="$name='cast'">
417 <xsl:when test="$showcast = 1">
419 <xsl:when test="$charlength > $framewidth">
420 <xsl:text>(</xsl:text>
421 <xsl:apply-templates select="*[position()=2]">
422 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
423 </xsl:apply-templates><br/>
424 <xsl:call-template name="make_indent">
425 <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
426 <xsl:text>:></xsl:text>
427 <xsl:apply-templates select="*[position()=3]">
428 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
429 </xsl:apply-templates>
430 <xsl:text>)</xsl:text>
433 <xsl:apply-templates mode="inline" select="."/>
438 <xsl:apply-templates select="*[position()=2]">
439 <xsl:with-param name="current_indent" select="$current_indent"/>
440 </xsl:apply-templates>
444 <xsl:when test="$name='Prop'">
445 <xsl:text>Prop</xsl:text>
447 <xsl:when test="$name='Set'">
448 <xsl:text>Set</xsl:text>
450 <xsl:when test="$name='Type'">
451 <xsl:text>Type</xsl:text>
453 <xsl:when test="$name='mutcase'">
455 <xsl:when test="$charlength > $framewidth">
456 <xsl:text><</xsl:text>
457 <xsl:apply-templates select="*[position()=2]">
458 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
459 </xsl:apply-templates>
460 <xsl:text>> </xsl:text>
461 <xsl:text>CASE </xsl:text>
462 <xsl:apply-templates select="*[position()=3]">
463 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
464 </xsl:apply-templates>
465 <xsl:text> OF </xsl:text>
466 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
468 <xsl:call-template name="make_indent">
469 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
472 <xsl:when test="position() = 1">
473 <xsl:text>  </xsl:text>
476 <xsl:text>| </xsl:text>
479 <xsl:apply-templates select="."/>
480 <FONT FACE="Symbol" SIZE="+2" mathcolor="green">Þ</FONT>
481 <xsl:apply-templates select="following-sibling::*[position()= 1]">
482 <xsl:with-param name="current_indent" select="$current_indent + 4 + string-length()"/>
483 </xsl:apply-templates>
487 <xsl:apply-templates mode="inline" select="."/>
492 <xsl:when test="$name='fix'">
494 <xsl:when test="$charlength > $framewidth">
495 <xsl:text>FIX</xsl:text>
496 <xsl:value-of select="m:ci"/>
497 <xsl:text>{</xsl:text>
498 <xsl:for-each select="m:bvar">
500 <xsl:call-template name="make_indent">
501 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
503 <xsl:value-of select="m:ci"/>
504 <xsl:text>:</xsl:text>
505 <xsl:apply-templates select="m:type">
506 <xsl:with-param name="current_indent"
507 select="$current_indent + 5 + string-length(m:ci)"/>
508 </xsl:apply-templates>
510 <xsl:call-template name="make_indent">
511 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
513 <xsl:text>:=</xsl:text>
514 <xsl:apply-templates select="following-sibling::*[position() = 1]">
515 <xsl:with-param name="current_indent" select="$current_indent +2"/>
516 </xsl:apply-templates>
519 <xsl:call-template name="make_indent">
520 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
522 <xsl:text>}</xsl:text>
525 <xsl:apply-templates mode="inline" select="."/>
530 <xsl:when test="$name='cofix'">
532 <xsl:when test="($charlength + 10) > $framewidth">
533 <xsl:text>COFIX</xsl:text>
534 <xsl:value-of select="m:ci"/>
535 <xsl:text>{</xsl:text>
537 <xsl:call-template name="make_indent">
538 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
540 <xsl:for-each select="m:bvar">
541 <xsl:value-of select="m:ci"/>
542 <xsl:text>:</xsl:text>
543 <xsl:apply-templates select="m:type">
544 <xsl:with-param name="current_indent"
545 select="$current_indent + 5 + string-length(m:ci)"/>
546 </xsl:apply-templates>
548 <xsl:call-template name="make_indent">
549 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
551 <xsl:text>:=</xsl:text>
552 <xsl:apply-templates select="following-sibling::*[position() = 1]">
553 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
554 </xsl:apply-templates>
558 <xsl:call-template name="make_indent">
559 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
561 <xsl:text>}</xsl:text>
564 <xsl:apply-templates mode="inline" select="m:type"/>
568 <!-- ***************************************** -->
569 <!-- *********** PROOF ELEMENTS ************** -->
570 <!-- ***************************************** -->
572 <xsl:when test="$name='proof'">
573 <xsl:apply-templates select="*[position()=2]">
574 <xsl:with-param name="current_indent" select="$current_indent"/>
575 </xsl:apply-templates>
577 <!-- <xsl:element name="br"/> -->
578 <xsl:call-template name="make_indent">
579 <xsl:with-param name="current_indent" select="$current_indent"/>
581 <FONT color="red">we proved </FONT>
582 <xsl:apply-templates select="*[position()=3]">
583 <xsl:with-param name="current_indent" select="$current_indent + 16"/>
584 </xsl:apply-templates>
587 <xsl:when test="$name='letin1'">
588 <xsl:apply-templates select="*[position()=2]">
589 <xsl:with-param name="current_indent" select="$current_indent"/>
590 </xsl:apply-templates>
592 <xsl:call-template name="make_indent">
593 <xsl:with-param name="current_indent" select="$current_indent"/>
595 <xsl:apply-templates select="*[position()=3]">
596 <xsl:with-param name="current_indent" select="$current_indent"/>
597 </xsl:apply-templates>
600 <xsl:when test="$name='letin'">
601 <xsl:for-each select="*[position()>1 and last()>position()]">
602 <xsl:apply-templates select=".">
603 <xsl:with-param name="current_indent" select="$current_indent"/>
604 </xsl:apply-templates>
606 <xsl:call-template name="make_indent">
607 <xsl:with-param name="current_indent" select="$current_indent"/>
610 <xsl:apply-templates select="*[position()=last()]">
611 <xsl:with-param name="current_indent" select="$current_indent"/>
612 </xsl:apply-templates>
615 <xsl:when test="$name='let'">
617 <xsl:apply-templates select="m:ci"/>
619 <xsl:apply-templates select="*[3]">
620 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
621 </xsl:apply-templates>
624 <xsl:when test="$name='rw_step'">
626 <xsl:when test="name(*[2])='m:apply'">
627 <xsl:apply-templates select="*[2]">
628 <xsl:with-param name="current_indent" select="$current_indent"/>
629 </xsl:apply-templates>
632 <FONT color="red">Consider </FONT>
633 <xsl:apply-templates select="*[2]"/>
636 <xsl:variable name="charlength_first">
637 <xsl:apply-templates select="*[3]" mode="charcount"/>
639 <xsl:variable name="charlength_second">
640 <xsl:apply-templates select="*[4]" mode="charcount"/>
642 <xsl:variable name="charlength_side_proof">
643 <xsl:apply-templates select="*[5]" mode="charcount"/>
645 <xsl:variable name="split1"
646 select="$charlength_first + $charlength_second > $framewidth"/>
647 <xsl:variable name="split2"
648 select="$charlength_second + $charlength_side_proof > $framewidth"/>
649 <!-- <xsl:value-of select="$current_indent"/> -->
650 <!-- <xsl:value-of select="$charlength"/> -->
652 <xsl:call-template name="make_indent">
653 <xsl:with-param name="current_indent" select="$current_indent"/>
655 <FONT color="red">Rewrite </FONT>
656 <xsl:apply-templates mode="inline" select="*[3]"/>
657 <xsl:text> </xsl:text>
658 <xsl:if test="$split1">
660 <xsl:call-template name="make_indent">
661 <xsl:with-param name="current_indent" select="$current_indent"/>
664 <FONT color="red">with </FONT>
665 <xsl:apply-templates mode="inline" select="*[4]"/>
666 <xsl:text> </xsl:text>
667 <xsl:if test="$split2">
669 <xsl:call-template name="make_indent">
670 <xsl:with-param name="current_indent" select="$current_indent"/>
673 <FONT color="red">by </FONT>
674 <xsl:apply-templates select="*[5]">
675 <xsl:with-param name="current_indent" select="$current_indent+5"/>
676 </xsl:apply-templates>
678 <!-- rewrite and apply -->
679 <xsl:when test="$name='rewrite_and_apply'">
680 <xsl:apply-templates select="*[2]">
681 <xsl:with-param name="current_indent" select="$current_indent"/>
682 </xsl:apply-templates>
684 <xsl:call-template name="make_indent">
685 <xsl:with-param name="current_indent" select="$current_indent"/>
687 <FONT color="red">Then apply it to </FONT>
688 <xsl:apply-templates select="*[position()>2]"/>
690 <!-- by_induction -->
691 <xsl:when test="$name='by_induction'">
692 <FONT color="red">We prove </FONT>
693 <xsl:apply-templates select="../*[3]">
694 <xsl:with-param name="current_indent" select="$current_indent+18"/>
695 </xsl:apply-templates>
697 <xsl:call-template name="make_indent">
698 <xsl:with-param name="current_indent" select="$current_indent"/>
700 <FONT color="red">by induction on </FONT>
701 <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
702 <xsl:with-param name="current_indent" select="$current_indent+30"/>
703 </xsl:apply-templates>
706 <xsl:call-template name="make_indent">
707 <xsl:with-param name="current_indent" select="$current_indent"/>
709 <xsl:text>The induction property is</xsl:text>
711 <xsl:call-template name="make_indent">
712 <xsl:with-param name="current_indent" select="$current_indent"/>
714 <xsl:apply-templates select="*[3]">
715 <xsl:with-param name="current_indent" select="$current_indent"/>
716 </xsl:apply-templates>
719 select="*[position()>3 and not(position()=last())]">
720 <xsl:with-param name="current_indent" select="$current_indent+4"/>
721 </xsl:apply-templates>
723 <xsl:call-template name="make_indent">
724 <xsl:with-param name="current_indent" select="$current_indent"/>
726 <xsl:text>End induction</xsl:text> -->
728 <!-- inductive_case -->
729 <xsl:when test="$name='inductive_case'">
731 <xsl:call-template name="make_indent">
732 <xsl:with-param name="current_indent" select="$current_indent"/>
734 <FONT color="red">Case </FONT>
735 <xsl:apply-templates select="*[2]">
736 <xsl:with-param name="current_indent" select="$current_indent +10"/>
737 </xsl:apply-templates>
738 <xsl:if test="*[3]/*[position()>1]">
740 <xsl:call-template name="make_indent">
741 <xsl:with-param name="current_indent" select="$current_indent+4"/>
743 <FONT color="red">By induction hypothesis, we have:</FONT>
744 <xsl:for-each select="*[3]/*[position()>1]">
746 <xsl:call-template name="make_indent">
747 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
749 <xsl:text>(</xsl:text>
750 <xsl:apply-templates select="m:ci"/>
751 <xsl:text>) </xsl:text>
752 <xsl:apply-templates select="m:type">
753 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
754 </xsl:apply-templates>
758 <xsl:call-template name="make_indent">
759 <xsl:with-param name="current_indent" select="$current_indent + 4"/>
761 <xsl:apply-templates select="*[4]">
762 <xsl:with-param name="current_indent" select="$current_indent +4"/>
763 </xsl:apply-templates>
765 <xsl:call-template name="make_indent">
766 <xsl:with-param name="current_indent" select="$current_indent"/>
768 <xsl:text>End Case</xsl:text> -->
771 <xsl:when test="$name='case_lhs'">
773 <xsl:when test="count(*)=2">
774 <xsl:apply-templates mode="inline" select="*[2]"/>
777 <xsl:text>(</xsl:text>
778 <xsl:apply-templates mode="inline" select="*[2]"/>
779 <xsl:for-each select="m:bvar">
780 <xsl:text> </xsl:text>
781 <xsl:apply-templates mode="inline" select="*[1]"/>
782 <xsl:text>:</xsl:text>
783 <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
785 <xsl:text>)</xsl:text>
790 <xsl:when test="$name='nat_ind_complete'">
791 <FONT color="red">By induction on </FONT>
792 <xsl:apply-templates select="*[2]"/>:
794 <xsl:call-template name="make_indent">
795 <xsl:with-param name="current_indent" select="$current_indent"/>
797 <xsl:text>0 </xsl:text>
798 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
799 <xsl:apply-templates select="*[3]">
800 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
801 </xsl:apply-templates>
803 <xsl:call-template name="make_indent">
804 <xsl:with-param name="current_indent" select="$current_indent"/>
806 <xsl:text>S(</xsl:text>
807 <xsl:apply-templates select="*[4]"/>
808 <xsl:text>) </xsl:text>
809 <FONT FACE="Symbol" mathcolor="green">Þ</FONT>
810 <FONT color="red">Assume by induction</FONT>
812 <xsl:call-template name="make_indent">
813 <xsl:with-param name="current_indent" select="$current_indent +10"/>
815 <xsl:text>(</xsl:text>
816 <xsl:apply-templates select="*[5]"/>
817 <xsl:text>)</xsl:text>
818 <xsl:apply-templates select="*[6]">
819 <xsl:with-param name="current_indent" select="$current_indent + 14"/>
820 </xsl:apply-templates>
822 <xsl:call-template name="make_indent">
823 <xsl:with-param name="current_indent" select="$current_indent +10"/>
825 <xsl:apply-templates select="*[7]">
826 <xsl:with-param name="current_indent" select="$current_indent + 10"/>
827 </xsl:apply-templates>
830 <xsl:when test="$name='false_ind'">
831 <xsl:apply-templates select="*[3]">
832 <xsl:with-param name="current_indent" select="$current_indent"/>
833 </xsl:apply-templates>
835 <xsl:call-template name="make_indent">
836 <xsl:with-param name="current_indent" select="$current_indent"/>
838 <FONT color="red">Contradiction.</FONT>
841 <xsl:when test="$name='and_ind'">
843 <xsl:when test="name(*[2])='m:apply'">
844 <xsl:apply-templates select="*[2]">
845 <xsl:with-param name="current_indent" select="$current_indent"/>
846 </xsl:apply-templates>
849 <FONT color="red">Consider </FONT>
850 <xsl:apply-templates select="*[2]"/>
854 <xsl:call-template name="make_indent">
855 <xsl:with-param name="current_indent" select="$current_indent"/>
857 <FONT color="red">In particular, we have</FONT>
859 <xsl:call-template name="make_indent">
860 <xsl:with-param name="current_indent" select="$current_indent"/>
863 <xsl:apply-templates select="*[3]"/>
865 <xsl:apply-templates select="*[4]">
866 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
867 </xsl:apply-templates>
869 <xsl:call-template name="make_indent">
870 <xsl:with-param name="current_indent" select="$current_indent"/>
873 <xsl:apply-templates select="*[5]"/>
875 <xsl:apply-templates select="*[6]">
876 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
877 </xsl:apply-templates>
879 <xsl:call-template name="make_indent">
880 <xsl:with-param name="current_indent" select="$current_indent"/>
882 <xsl:apply-templates select="*[7]">
883 <xsl:with-param name="current_indent" select="$current_indent"/>
884 </xsl:apply-templates>
887 <xsl:when test="$name='full_or_ind'">
889 <xsl:when test="name(*[2])='m:apply'">
890 <xsl:apply-templates select="*[2]">
891 <xsl:with-param name="current_indent" select="$current_indent"/>
892 </xsl:apply-templates>
895 <FONT color="red">Consider </FONT>
896 <xsl:apply-templates select="*[2]"/>
900 <xsl:call-template name="make_indent">
901 <xsl:with-param name="current_indent" select="$current_indent"/>
903 <FONT color="red">We proceed by cases to prove </FONT>
904 <xsl:apply-templates select="*[3]"/>
906 <xsl:call-template name="make_indent">
907 <xsl:with-param name="current_indent" select="$current_indent+4"/>
909 <FONT color="red">Left: suppose </FONT>
910 <xsl:text>(</xsl:text>
911 <xsl:value-of select="*[4]/m:bvar/m:ci"/>
912 <xsl:text>) </xsl:text>
914 select="*[4]/m:bvar/m:type/*[1]"/>
916 <xsl:call-template name="make_indent">
917 <xsl:with-param name="current_indent" select="$current_indent+15"/>
921 <xsl:with-param name="current_indent" select="$current_indent+15"/>
922 </xsl:apply-templates>
924 <xsl:call-template name="make_indent">
925 <xsl:with-param name="current_indent" select="$current_indent+4"/>
927 <FONT color="red">Right: suppose </FONT>
928 <xsl:text>(</xsl:text>
929 <xsl:value-of select="*[5]/m:bvar/m:ci"/>
930 <xsl:text>) </xsl:text>
932 select="*[5]/m:bvar/m:type/*[1]"/>
934 <xsl:call-template name="make_indent">
935 <xsl:with-param name="current_indent" select="$current_indent+16"/>
939 <xsl:with-param name="current_indent" select="$current_indent+16"/>
940 </xsl:apply-templates>
943 <xsl:when test="$name='or_ind'">
945 <xsl:when test="name(*[2])='m:apply'">
946 <xsl:apply-templates select="*[2]">
947 <xsl:with-param name="current_indent" select="$current_indent"/>
948 </xsl:apply-templates>
951 <FONT color="red">Consider </FONT>
952 <xsl:apply-templates select="*[2]"/>
956 <xsl:call-template name="make_indent">
957 <xsl:with-param name="current_indent" select="$current_indent"/>
959 <FONT color="red">We prove </FONT>
960 <xsl:apply-templates select="*[3]"/>
961 <FONT color="red"> by cases:</FONT>
963 <xsl:call-template name="make_indent">
964 <xsl:with-param name="current_indent" select="$current_indent"/>
967 <xsl:apply-templates select="*[4]">
968 <xsl:with-param name="current_indent" select="$current_indent"/>
969 </xsl:apply-templates>
971 <xsl:call-template name="make_indent">
972 <xsl:with-param name="current_indent" select="$current_indent"/>
975 <xsl:apply-templates select="*[5]">
976 <xsl:with-param name="current_indent" select="$current_indent"/>
977 </xsl:apply-templates>
980 <xsl:when test="$name='ex_ind'">
982 <xsl:when test="name(*[2])='m:apply'">
983 <xsl:apply-templates select="*[2]">
984 <xsl:with-param name="current_indent" select="$current_indent"/>
985 </xsl:apply-templates>
988 <FONT color="red">Consider </FONT>
989 <xsl:apply-templates select="*[2]">
990 <xsl:with-param name="current_indent" select="$current_indent"/>
991 </xsl:apply-templates>
995 <xsl:call-template name="make_indent">
996 <xsl:with-param name="current_indent" select="$current_indent"/>
998 <FONT color="red">Let </FONT>
999 <xsl:apply-templates mode="inline" select="*[3]"/>
1001 <xsl:apply-templates mode="inline" select="*[4]"/>
1002 <FONT color="red"> such that</FONT>
1004 <xsl:call-template name="make_indent">
1005 <xsl:with-param name="current_indent" select="$current_indent"/>
1006 </xsl:call-template>
1008 <xsl:apply-templates mode="inline" select="*[5]"/>
1010 <xsl:apply-templates select="*[6]">
1011 <xsl:with-param name="current_indent" select="$current_indent +7"/>
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>
1017 <xsl:apply-templates select="*[7]">
1018 <xsl:with-param name="current_indent" select="$current_indent"/>
1019 </xsl:apply-templates>
1026 <xsl:template match="m:lambda">
1027 <xsl:param name="current_indent" select="0"/>
1028 <xsl:variable name="charlength">
1029 <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
1030 <!-- <xsl:apply-templates select="." mode="charcount"/> -->
1032 <!-- <xsl:value-of select="$charlength"/> -->
1033 <!-- <xsl:value-of select="$current_indent"/> -->
1035 <xsl:when test="$charlength > $framewidth">
1037 <FONT SIZE="+2" color="red" FACE="symbol">l</FONT>
1038 <xsl:apply-templates select="m:bvar/m:ci"/>
1039 <xsl:text>:</xsl:text>
1040 <xsl:apply-templates select="m:bvar/m:type">
1041 <xsl:with-param name="current_indent"
1042 select="$current_indent + 4 + 2*string-length(m:bvar/m:ci)"/>
1043 </xsl:apply-templates><br/>
1044 <xsl:call-template name="make_indent">
1045 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1046 </xsl:call-template>
1047 <xsl:text>.</xsl:text>
1048 <xsl:apply-templates select="*[position()=2]">
1049 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
1050 </xsl:apply-templates>
1053 <xsl:apply-templates mode="inline" select="."/>
1059 <xsl:template match="m:ci">
1061 <xsl:when test="boolean(@definitionURL)">
1062 <a href="{@definitionURL}">
1063 <xsl:apply-templates/>
1067 <xsl:value-of select="."/>
1074 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1075 <xsl:param name="incurrent_length" select="0"/>
1077 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
1078 <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>
1080 <xsl:when test="string($siblength) = """>
1081 <xsl:value-of select="$incurrent_length + string-length()"/>
1084 <xsl:value-of select="number($siblength)"/>
1089 <xsl:value-of select="$incurrent_length + string-length()"/>
1094 <xsl:template match="*" mode="charcount">
1095 <xsl:param name="incurrent_length" select="0"/>
1097 <xsl:when test="count(child::*) = 0">
1098 <xsl:value-of select="$incurrent_length"/>
1101 <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>
1103 <xsl:when test="$framewidth >= number($childlength)">
1104 <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>
1106 <xsl:when test="string($siblength) = """>
1107 <xsl:value-of select="number($childlength)"/>
1110 <xsl:value-of select="number($siblength)"/>
1115 <xsl:value-of select="number($childlength)"/>
1123 <!--***********************************************************************-->
1125 <!--***********************************************************************-->
1129 <xsl:template match="Definition">
1130 <xsl:param name="current_indent" select="0"/>
1132 DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1134 <xsl:call-template name="make_indent">
1135 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1136 </xsl:call-template>
1137 <xsl:apply-templates select="type/*[1]">
1138 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1139 </xsl:apply-templates><br/>
1141 <xsl:call-template name="make_indent">
1142 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1143 </xsl:call-template>
1144 <xsl:apply-templates select="body/*[1]">
1145 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1146 </xsl:apply-templates>
1152 <xsl:template match="Axiom">
1153 <xsl:param name="current_indent" select="0"/>
1155 AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1157 <xsl:call-template name="make_indent">
1158 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1159 </xsl:call-template>
1160 <xsl:apply-templates select="type/*[1]">
1161 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1162 </xsl:apply-templates>
1166 <!-- UNFINISHED PROOF -->
1168 <xsl:template match="CurrentProof">
1169 <xsl:param name="current_indent" select="0"/>
1171 UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)<br/>
1172 THESIS: <xsl:apply-templates select="type/*[1]">
1173 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1174 </xsl:apply-templates><br/>
1176 <xsl:for-each select="Conjecture">
1178 <xsl:call-template name="make_indent">
1179 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1180 </xsl:call-template>
1181 <xsl:value-of select="./@no"/> :
1182 <xsl:apply-templates select="./*[1]">
1183 <xsl:with-param name="current_indent" select="$current_indent + 11"/>
1184 </xsl:apply-templates>
1188 <xsl:apply-templates select="body/*[1]">
1189 <xsl:with-param name="current_indent" select="$current_indent + 8"/>
1190 </xsl:apply-templates>
1194 <!-- MUTUAL INDUCTIVE DEFINITION -->
1196 <xsl:template match="InductiveDefinition">
1197 <xsl:param name="current_indent" select="0"/>
1199 <xsl:for-each select="InductiveType">
1201 <xsl:when test="position() = 1">
1203 <xsl:when test="string(./@inductive) = "true"">
1204 INDUCTIVE DEFINITION
1207 COINDUCTIVE DEFINITION
1215 <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)
1217 <xsl:if test="string(../Param) != """>
1218 <xsl:for-each select="../Param">
1219 <xsl:value-of select="./@name"/>
1221 <xsl:apply-templates select="*"/>
1226 <xsl:apply-templates select="./arity/*[1]">
1227 <xsl:with-param name="current_indent" select="$current_indent + 9"/>
1228 </xsl:apply-templates> <br/>
1230 <xsl:for-each select="./Constructor">
1232 <xsl:call-template name="make_indent">
1233 <xsl:with-param name="current_indent" select="$current_indent + 3"/>
1234 </xsl:call-template>
1236 <xsl:when test="position() = 1">
1237 <xsl:text>  </xsl:text>
1240 <xsl:text>| </xsl:text>
1243 <xsl:value-of select="./@name"/>
1244 <xsl:text>: </xsl:text>
1245 <xsl:apply-templates select="./*[1]">
1246 <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
1247 </xsl:apply-templates>
1255 <xsl:template match="Variable">
1256 <xsl:param name="current_indent" select="0"/>
1258 VARIABLE <xsl:value-of select="@name"/><br/>
1259 TYPE = <xsl:apply-templates select="type/*[1]">
1260 <xsl:with-param name="current_indent" select="$current_indent + 7"/>
1261 </xsl:apply-templates>
1265 <!--***********************************************************************-->
1267 <!--***********************************************************************-->
1271 <xsl:template match="SECTION">
1272 <xsl:param name="current_indent" select="0"/>
1273 <h1>BEGIN OF SECTION</h1>
1274 <xsl:apply-templates/>
1275 <h1>END OF SECTION</h1>