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 <!--***********************************************************************-->
28 <!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
29 <!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
30 <!-- Revised: March 3 2000, Irene Schena -->
31 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
32 <!-- Revised: March 21 2000, Irene Schena -->
33 <!--***********************************************************************-->
35 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
36 xmlns:m="http://www.w3.org/1998/Math/MathML"
37 xmlns:helm="http://www.cs.unibo.it/helm">
39 <xsl:import href="mml2mmlv1_0.xsl"/>
41 <!--***********************************************************************-->
42 <!-- Parameter affecting line-breaking -->
43 <!--***********************************************************************-->
45 <xsl:variable name="framewidth" select="35"/>
47 <!--***********************************************************************-->
48 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
49 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
50 <!-- sono i termini: la presentation per un termine e' generata come primo -->
51 <!-- figlio di un semantics e l'originario content viene inserito nel -->
52 <!-- nel secondo figlio di semantics, annotation-xml -->
53 <!--***********************************************************************-->
55 <!--**********************-->
57 <!--**********************-->
59 <xsl:template match="/">
60 <xsl:processing-instruction name="cocoon-format">type="text/xhtml"</xsl:processing-instruction>
61 <xsl:apply-templates select="*"/>
66 <xsl:template match="Definition">
68 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
72 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
79 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
80 <xsl:apply-templates select="type/*[1]"/>
94 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
95 <xsl:apply-templates select="body/*[1]"/>
105 <xsl:template match="Axiom">
107 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
111 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
118 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
119 <xsl:apply-templates select="type/*[1]"/>
127 <!-- UNFINISHED PROOF -->
129 <xsl:template match="CurrentProof">
131 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
135 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
142 <m:mtext>THESIS:</m:mtext>
149 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
150 <xsl:apply-templates select="type/*[1]"/>
157 <m:mtext>CONJECTURES:</m:mtext>
161 <xsl:for-each select="Conjecture">
165 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
166 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
167 <xsl:apply-templates select="./*[1]"/>
175 <m:mtext>CORRESPONDING PROOF:</m:mtext>
182 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
183 <xsl:apply-templates select="body/*[1]"/>
191 <!-- MUTUAL INDUCTIVE DEFINITION -->
193 <xsl:template match="InductiveDefinition">
195 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
196 <xsl:for-each select="InductiveType">
201 <xsl:when test="position() = 1">
203 <xsl:when test="string(./@inductive) = "true"">
204 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
207 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
212 <m:mtext>AND</m:mtext>
215 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
216 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
223 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
226 <xsl:when test="string(../Param) != """>
227 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
228 <xsl:for-each select="../Param">
232 <m:mi><xsl:value-of select="./@name"/></m:mi>
234 <xsl:apply-templates select="*"/>
258 <m:mtext>OF ARITY</m:mtext>
265 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
266 <xsl:apply-templates select="./arity/*[1]"/>
273 <m:mtext>BUILT FROM</m:mtext>
277 <xsl:for-each select="./Constructor">
282 <xsl:when test="position() = 1">
283 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
287 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
290 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
291 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
292 <xsl:apply-templates select="./*[1]"/>
304 <xsl:template match="Variable">
306 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
310 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
317 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
318 <xsl:apply-templates select="type/*[1]"/>
322 <xsl:if test="name(*[1])='body'">
326 <m:mtext>AS</m:mtext>
333 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
334 <xsl:apply-templates select="body/*[1]"/>
343 <!--**********************-->
345 <!--**********************-->
347 <xsl:template match="m:bvar">
349 <xsl:when test="m:type">
350 <xsl:variable name="charlength">
351 <xsl:apply-templates select="m:ci" mode="charcount"/>
354 <xsl:when test="$charlength >= $framewidth">
355 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
358 <xsl:apply-templates select="m:ci"/>
364 <xsl:apply-templates select="m:type"/>
370 <xsl:apply-templates select="m:ci"/>
372 <xsl:apply-templates select="m:type"/>
377 <xsl:apply-templates select="m:ci"/>
385 <xsl:template match="m:apply[m:csymbol]">
386 <xsl:param name="nopar" select="1"/>
387 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
388 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
390 <xsl:if test="@helm:xref">
391 <xsl:attribute name="helm:xref"><xsl:value-of select="@helm:xref"/></xsl:attribute>
394 <xsl:when test="$name='forall'">
396 <xsl:when test="$charlength >= $framewidth">
397 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
400 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
401 <xsl:apply-templates select="m:bvar"/>
408 <xsl:apply-templates select="*[position()=3]"/>
415 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
416 <xsl:apply-templates select="m:bvar/m:ci"/>
418 <xsl:apply-templates select="m:bvar/m:type"/>
420 <xsl:apply-templates select="*[position()=3]"/>
424 <xsl:when test="$name='let_in'">
426 <xsl:when test="$charlength >= $framewidth">
427 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
431 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
432 <xsl:apply-templates select="m:bvar"/>
439 <xsl:apply-templates select="*[position()=3]"/>
447 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
448 <xsl:apply-templates select="*[position()=4]"/>
456 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
457 <xsl:apply-templates select="m:bvar/m:ci"/>
459 <xsl:apply-templates select="*[position()=3]"/>
460 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
461 <m:mtext>IN</m:mtext>
462 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
463 <xsl:apply-templates select="*[position()=4]"/>
467 <xsl:when test="$name='prod'">
469 <xsl:when test="$charlength >= $framewidth">
470 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
473 <m:mo mathcolor="Blue">Π</m:mo>
474 <xsl:apply-templates select="m:bvar"/>
481 <xsl:apply-templates select="*[position()=3]"/>
488 <m:mo mathcolor="Blue">Π</m:mo>
489 <xsl:apply-templates select="m:bvar/m:ci"/>
491 <xsl:apply-templates select="m:bvar/m:type"/>
493 <xsl:apply-templates select="*[position()=3]"/>
497 <xsl:when test="$name='arrow'">
499 <xsl:when test="$charlength >= $framewidth">
500 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
504 <xsl:if test="$nopar=0">
505 <m:mo stretchy="false">(</m:mo>
507 <xsl:apply-templates select="*[position()=2]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
514 <m:mo mathmathcolor="Blue">→</m:mo>
516 <xsl:when test="*[position()=3]/m:csymbol">
517 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
519 <xsl:when test="$nextp='arrow'">
520 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
523 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
528 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
534 <xsl:if test="$nopar=0">
538 <m:mo stretchy="false">)</m:mo>
546 <xsl:if test="$nopar=0">
547 <m:mo stretchy="false">(</m:mo>
549 <xsl:apply-templates select="*[position()=2]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
550 <m:mo mathcolor="Blue">→</m:mo>
552 <xsl:when test="*[position()=3]/m:csymbol">
553 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
555 <xsl:when test="$nextp='arrow'">
556 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
559 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
564 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
567 <xsl:if test="$nopar=0">
568 <m:mo stretchy="false">)</m:mo>
573 <xsl:when test="$name='app'">
575 <xsl:when test="$charlength >= $framewidth">
576 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
580 <m:mo stretchy="false">(</m:mo>
581 <xsl:apply-templates select="*[position()=2]"/>
585 <xsl:for-each select="*[position()>2]">
589 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
590 <xsl:apply-templates select="."/>
598 <m:mo stretchy="false">)</m:mo>
605 <m:mo stretchy="false">(</m:mo>
606 <xsl:apply-templates select="*[position()=2]"/>
607 <xsl:for-each select="*[position()>2]">
608 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
609 <xsl:apply-templates select="."/>
611 <m:mo stretchy="false">)</m:mo>
615 <xsl:when test="$name='cast'">
617 <xsl:when test="$charlength >= $framewidth">
618 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
622 <m:mo stretchy="false">(</m:mo>
623 <xsl:apply-templates select="*[position()=2]"/>
630 <m:mo mathcolor="Maroon">:></m:mo>
631 <xsl:apply-templates select="*[position()=3]"/>
638 <m:mo stretchy="false">)</m:mo>
645 <m:mo stretchy="false">(</m:mo>
646 <xsl:apply-templates select="*[position()=2]"/>
647 <m:mo mathcolor="Maroon">:></m:mo>
648 <xsl:apply-templates select="*[position()=3]"/>
649 <m:mo stretchy="false">)</m:mo>
653 <xsl:when test="$name='Prop'">
656 <xsl:when test="$name='Set'">
659 <xsl:when test="$name='Type'">
662 <xsl:when test="$name='mutcase'">
664 <xsl:when test="$charlength >= $framewidth">
665 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
666 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
671 <xsl:apply-templates select="*[position()=2]"/>
672 <xsl:if test="$framewidth > $charlength">
675 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
676 <xsl:apply-templates select="*[position()=3]"/>
681 <xsl:if test="$charlength >= $framewidth">
687 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
688 <xsl:apply-templates select="*[position()=3]"/>
700 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
701 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
706 <xsl:when test="position() = 1">
707 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
710 <m:mo stretchy="false">|</m:mo>
713 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
714 <xsl:apply-templates select="."/>
715 <xsl:if test="$framewidth > $charlength">
716 <m:mo mathcolor="Green">⇒</m:mo>
717 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
722 <xsl:if test="$charlength >= $framewidth">
726 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
727 <m:mo mathcolor="Green">⇒</m:mo>
728 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
744 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
746 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
747 <xsl:apply-templates select="*[position()=3]"/>
748 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
750 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
752 <xsl:when test="position() != 1">
753 <m:mo stretchy="false">|</m:mo>
756 <xsl:apply-templates select="."/>
757 <m:mo mathcolor="Green">⇒</m:mo>
758 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
760 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
765 <xsl:when test="$name='fix'">
767 <xsl:when test="$charlength >= $framewidth">
768 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
773 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
774 <m:mi><xsl:value-of select="m:ci"/></m:mi>
775 <m:mo stretchy="false">{</m:mo>
782 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
783 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
784 <xsl:for-each select="m:bvar">
785 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
789 <m:mi><xsl:value-of select="m:ci"/></m:mi>
791 <xsl:if test="$framewidth > $charlength">
792 <xsl:apply-templates select="m:type"/>
797 <xsl:if test="$charlength >= $framewidth">
801 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
802 <xsl:apply-templates select="m:type"/>
811 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
823 <m:mo stretchy="false">}</m:mo>
831 <m:mi><xsl:value-of select="m:ci"/></m:mi>
832 <m:mo stretchy="false">{</m:mo>
833 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
834 <xsl:for-each select="m:bvar">
838 <m:mi><xsl:value-of select="m:ci"/></m:mi>
840 <xsl:apply-templates select="m:type"/>
842 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
843 <xsl:if test="position()=last()">
844 <m:mo stretchy="false">}</m:mo>
854 <xsl:when test="$name='cofix'">
856 <xsl:when test="$charlength >= $framewidth">
857 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
862 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
863 <m:mi><xsl:value-of select="m:ci"/></m:mi>
864 <m:mo stretchy="false">{</m:mo>
871 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
872 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
873 <xsl:for-each select="m:bvar">
874 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
878 <m:mi><xsl:value-of select="m:ci"/></m:mi>
880 <xsl:if test="$framewidth > $charlength">
881 <xsl:apply-templates select="m:type"/>
886 <xsl:if test="$charlength >= $framewidth">
890 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
891 <xsl:apply-templates select="m:type"/>
900 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
912 <m:mo stretchy="false">}</m:mo>
920 <m:mi><xsl:value-of select="m:ci"/></m:mi>
921 <m:mo stretchy="false">{</m:mo>
922 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
923 <xsl:for-each select="m:bvar">
927 <m:mi><xsl:value-of select="m:ci"/></m:mi>
929 <xsl:apply-templates select="m:type"/>
931 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
932 <xsl:if test="position()=last()">
933 <m:mo stretchy="false">}</m:mo>
943 <!-- ***************************************** -->
944 <!-- *********** PROOF ELEMENTS ************** -->
945 <!-- ***************************************** -->
946 <xsl:when test="$name='proof'">
947 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
951 <xsl:apply-templates select="*[position()=2]"/>
958 <m:mtext mathcolor="Maroon">we proved </m:mtext>
959 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
960 <xsl:apply-templates select="*[position()=3]"/>
966 <xsl:when test="$name='letin'">
967 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
968 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
969 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
973 <xsl:apply-templates select="."/>
981 <xsl:apply-templates select="*[position()=last()]"/>
987 <xsl:when test="$name='let'">
989 <xsl:apply-templates select="m:ci"/>
990 <m:mtext>) </m:mtext>
991 <xsl:apply-templates select="*[3]"/>
993 <xsl:when test="$name='thread'">
994 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
999 <xsl:when test="name(*[last()])='m:apply'">
1000 <xsl:apply-templates select="*[last()]"/>
1003 <m:mtext>Consider </m:mtext>
1004 <xsl:apply-templates select="*[last()]"/>
1010 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1013 <xsl:when test="$name='rewrite_and_apply'">
1018 <m:mtext>Rewrite</m:mtext>
1019 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1020 <xsl:apply-templates select="*[2]/*[2]"/>
1021 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1022 <m:mtext>with</m:mtext>
1023 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1024 <xsl:apply-templates select="*[2]/*[3]"/>
1025 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1026 <m:mtext>by</m:mtext>
1027 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1028 <xsl:apply-templates select="*[2]/*[4]"/>
1029 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1030 <m:mtext>in</m:mtext>
1031 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1032 <xsl:apply-templates select="*[3]"/>
1033 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1034 <m:mtext>and apply to</m:mtext>
1035 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1036 <xsl:apply-templates select="*[position()>3]"/>
1042 <xsl:when test="$name='and_ind'">
1043 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1048 <xsl:when test="name(*[2])='m:apply'">
1049 <xsl:apply-templates select="*[2]"/>
1052 <m:mtext>Consider </m:mtext>
1053 <xsl:apply-templates select="*[2]"/>
1061 <m:mtext>In particular, we have</m:mtext>
1067 <m:mtext>(</m:mtext>
1068 <xsl:apply-templates select="*[3]"/>
1069 <m:mtext>)</m:mtext>
1070 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1071 <xsl:apply-templates select="*[4]"/>
1078 <m:mtext>(</m:mtext>
1079 <xsl:apply-templates select="*[5]"/>
1080 <m:mtext>)</m:mtext>
1081 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1082 <xsl:apply-templates select="*[6]"/>
1089 <xsl:apply-templates select="*[7]"/>
1095 <xsl:when test="$name='or_ind'">
1096 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1101 <xsl:when test="name(*[2])='m:apply'">
1102 <xsl:apply-templates select="*[2]"/>
1105 <m:mtext>Consider</m:mtext>
1106 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1107 <xsl:apply-templates select="*[2]"/>
1115 <m:mtext>We prove</m:mtext>
1116 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1117 <xsl:apply-templates select="*[3]"/>
1118 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1119 <m:mtext>by cases:</m:mtext>
1125 <m:mtext>*</m:mtext>
1126 <xsl:apply-templates select="*[4]"/>
1133 <m:mtext>*</m:mtext>
1134 <xsl:apply-templates select="*[5]"/>
1140 <xsl:when test="$name='ex_ind'">
1141 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1146 <xsl:when test="name(*[2])='m:apply'">
1147 <xsl:apply-templates select="*[2]"/>
1150 <m:mtext>Consider </m:mtext>
1151 <xsl:apply-templates select="*[2]"/>
1159 <m:mtext>Let</m:mtext>
1160 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1161 <xsl:apply-templates select="*[3]"/>
1162 <m:mtext>:</m:mtext>
1163 <xsl:apply-templates select="*[4]"/>
1164 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1165 <m:mtext>such that</m:mtext>
1166 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1167 <m:mtext>(</m:mtext>
1168 <xsl:apply-templates select="*[5]"/>
1169 <m:mtext>)</m:mtext>
1170 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1171 <xsl:apply-templates select="*[6]"/>
1177 <xsl:apply-templates select="*[7]"/>
1190 <xsl:template match="*" mode="thread">
1191 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1193 <xsl:when test="$name='rw_step'">
1197 <m:mtext>Rewrite</m:mtext>
1198 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1199 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1200 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1201 <m:mtext>with</m:mtext>
1202 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1203 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1204 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1205 <m:mtext>by</m:mtext>
1206 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1207 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1214 <m:mtext mathcolor="Maroon">we get</m:mtext>
1215 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1216 <xsl:apply-templates select="."/>
1225 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1232 <m:mtext mathcolor="Maroon">we get</m:mtext>
1233 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1234 <xsl:apply-templates select="."/>
1240 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1246 <xsl:template match="m:lambda">
1247 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1248 <m:mrow helm:xref="{@helm:xref}">
1250 <xsl:when test="$charlength >= $framewidth">
1251 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1254 <m:mo mathcolor="Red">λ</m:mo>
1255 <xsl:apply-templates select="m:bvar"/>
1262 <xsl:apply-templates select="*[position()=2]"/>
1269 <m:mo mathcolor="Red">λ</m:mo>
1270 <xsl:apply-templates select="m:bvar/m:ci"/>
1272 <xsl:apply-templates select="m:bvar/m:type"/>
1274 <xsl:apply-templates select="*[position()=2]"/>
1280 <!-- *********************************** -->
1281 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1282 <!-- *********************************** -->
1286 <xsl:template match = "m:apply[m:eq[1]]">
1287 <xsl:variable name="charlength">
1288 <xsl:apply-templates select="*[1]" mode="charcount"/>
1291 <xsl:when test="$charlength >= $framewidth">
1292 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1293 <xsl:if test="@helm:xref">
1294 <xsl:attribute name="helm:xref">
1295 <xsl:value-of select="@helm:xref"/>
1300 <m:mo stretchy="false">(</m:mo>
1301 <xsl:apply-templates select="*[position()=2]"/>
1304 <xsl:for-each select = "*[position()>2]">
1307 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1308 <m:mo helm:xref="{m:in/@helm:xref}">=</m:mo>
1309 <xsl:apply-templates select="."/>
1315 <m:mo stretchy="false">)</m:mo>
1321 <xsl:apply-imports/>
1327 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1328 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1329 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1330 |m:prsubset|m:setdiff[1]]">
1331 <xsl:variable name="symbol">
1333 <xsl:when test="m:and[1]">
1334 <xsl:value-of select="'wedge'"/>
1336 <xsl:when test="m:or[1]">
1337 <xsl:value-of select="'vee'"/>
1339 <xsl:when test="m:geq[1]">
1340 <xsl:value-of select="'geq'"/>
1342 <xsl:when test="m:leq[1]">
1343 <xsl:value-of select="'leq'"/>
1345 <xsl:when test="m:gt[1]">
1346 <xsl:value-of select="'gt'"/>
1348 <xsl:when test="m:lt[1]">
1349 <xsl:value-of select="'lt'"/>
1351 <xsl:when test="m:eq[1]">
1352 <xsl:value-of select="'Equal'"/>
1354 <xsl:when test="m:in[1]">
1355 <xsl:value-of select="'Element'"/>
1357 <xsl:when test="m:subset[1]">
1358 <xsl:value-of select="'SubsetEqual'"/>
1360 <xsl:when test="m:prsubset[1]">
1361 <xsl:value-of select="'subset'"/>
1363 <xsl:when test="m:intersect[1]">
1364 <xsl:value-of select="'Intersection'"/>
1366 <xsl:when test="m:union[1]">
1367 <xsl:value-of select="'Union'"/>
1369 <xsl:when test="m:setdiff[1]">
1370 <xsl:value-of select="'Backslash'"/>
1374 <xsl:variable name="charlength">
1375 <xsl:apply-templates select="*[1]" mode="charcount"/>
1378 <xsl:when test="$charlength >= $framewidth">
1379 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1380 <xsl:if test="@helm:xref">
1381 <xsl:attribute name="helm:xref">
1382 <xsl:value-of select="@helm:xref"/>
1387 <m:mo stretchy="false">(</m:mo>
1388 <xsl:apply-templates select="*[position()=2]"/>
1391 <xsl:for-each select = "*[position()>2]">
1394 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1395 <m:mo helm:xref="{*[1]/@helm:xref}">
1396 <m:mchar name="{$symbol}"/>
1398 <xsl:apply-templates select="."/>
1404 <m:mo stretchy="false">)</m:mo>
1410 <xsl:apply-imports/>
1415 <xsl:template match = "m:set">
1417 <xsl:when test="count(child::*) = 0">
1419 <m:mchar name="emptyset"/>
1423 <xsl:variable name="charlength">
1424 <xsl:apply-templates select="*[1]" mode="charcount"/>
1427 <xsl:when test="$charlength >= $framewidth">
1429 <xsl:when test="name(*[1]) = 'm:bvar'">
1430 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1433 <m:mo stretchy="false">{</m:mo>
1434 <xsl:apply-templates select="*[position()=1]"/>
1439 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1440 <m:mo stretchy="false">|</m:mo>
1441 <xsl:apply-templates select="m:condition/*[1]"/>
1446 <m:mo stretchy="false">}</m:mo>
1452 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1455 <m:mo stretchy="false">{</m:mo>
1456 <xsl:apply-templates select="*[position()=1]"/>
1457 <xsl:if test="position() != last()">
1462 <xsl:for-each select = "*[position()>2]">
1465 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1466 <xsl:apply-templates select="."/>
1467 <xsl:if test="position() != last()">
1475 <m:mo stretchy="false">}</m:mo>
1483 <xsl:apply-imports/>
1490 <xsl:template match = "m:apply[m:card[1]]">
1491 <m:mo stretchy="false">|</m:mo>
1492 <xsl:apply-templates select="*[2]"/>
1493 <m:mo stretchy="false">|</m:mo>
1496 <!-- *********************************** -->
1497 <!-- PROOF ELEMENTS -->
1498 <!-- *********************************** -->
1502 <!--**********************-->
1504 <!--**********************-->
1506 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1507 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1508 |m:plus|m:minus|m:times" mode="charcount">
1509 <xsl:param name="incurrent_length" select="0"/>
1511 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1512 <xsl:variable name="siblength">
1513 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1514 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1515 </xsl:apply-templates>
1518 <xsl:when test="string($siblength) = """>
1519 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1522 <xsl:value-of select="number($siblength)"/>
1527 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1532 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1533 <xsl:param name="incurrent_length" select="0"/>
1534 <xsl:param name="nosibling" select="0"/>
1536 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1537 <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>
1539 <xsl:when test="string($siblength) = """>
1540 <xsl:value-of select="$incurrent_length + string-length()"/>
1543 <xsl:value-of select="number($siblength)"/>
1548 <xsl:value-of select="$incurrent_length + string-length()"/>
1553 <xsl:template match="*" mode="charcount">
1554 <xsl:param name="incurrent_length" select="0"/>
1555 <xsl:param name="nosibling" select="0"/>
1557 <xsl:when test="count(child::*) = 0">
1558 <xsl:value-of select="$incurrent_length"/>
1561 <xsl:variable name="childlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/><xsl:with-param name="nosibling" select="0"/></xsl:apply-templates></xsl:variable>
1563 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1564 <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>
1566 <xsl:when test="string($siblength) = """>
1567 <xsl:value-of select="number($childlength)"/>
1570 <xsl:value-of select="number($siblength)"/>
1575 <xsl:value-of select="number($childlength)"/>