3 <!--***********************************************************************-->
4 <!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
5 <!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
6 <!-- Revised: March 3 2000, Irene Schena -->
7 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
8 <!-- Revised: March 21 2000, Irene Schena -->
9 <!--***********************************************************************-->
11 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12 xmlns:m="http://www.w3.org/1998/Math/MathML"
13 xmlns:helm="http://www.cs.unibo.it/helm">
15 <xsl:import href="mml2mmlv1_0.xsl"/>
17 <!--***********************************************************************-->
18 <!-- Parameter affecting line-breaking -->
19 <!--***********************************************************************-->
21 <xsl:variable name="framewidth" select="35"/>
23 <!--***********************************************************************-->
24 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
25 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
26 <!-- sono i termini: la presentation per un termine e' generata come primo -->
27 <!-- figlio di un semantics e l'originario content viene inserito nel -->
28 <!-- nel secondo figlio di semantics, annotation-xml -->
29 <!--***********************************************************************-->
31 <!--**********************-->
33 <!--**********************-->
35 <xsl:template match="/">
36 <xsl:processing-instruction name="cocoon-format">type="text/xhtml"</xsl:processing-instruction>
37 <xsl:apply-templates select="*"/>
42 <xsl:template match="Definition">
44 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
48 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
55 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
56 <xsl:apply-templates select="type/*[1]"/>
70 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
71 <xsl:apply-templates select="body/*[1]"/>
81 <xsl:template match="Axiom">
83 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
87 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
94 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
95 <xsl:apply-templates select="type/*[1]"/>
103 <!-- UNFINISHED PROOF -->
105 <xsl:template match="CurrentProof">
107 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
111 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
118 <m:mtext>THESIS:</m:mtext>
125 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
126 <xsl:apply-templates select="type/*[1]"/>
133 <m:mtext>CONJECTURES:</m:mtext>
137 <xsl:for-each select="Conjecture">
141 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
142 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
143 <xsl:apply-templates select="./*[1]"/>
151 <m:mtext>CORRESPONDING PROOF:</m:mtext>
158 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
159 <xsl:apply-templates select="body/*[1]"/>
167 <!-- MUTUAL INDUCTIVE DEFINITION -->
169 <xsl:template match="InductiveDefinition">
171 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
172 <xsl:for-each select="InductiveType">
177 <xsl:when test="position() = 1">
179 <xsl:when test="string(./@inductive) = "true"">
180 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
183 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
188 <m:mtext>AND</m:mtext>
191 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
192 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
199 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
202 <xsl:when test="string(../Param) != """>
203 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
204 <xsl:for-each select="../Param">
208 <m:mi><xsl:value-of select="./@name"/></m:mi>
210 <xsl:apply-templates select="*"/>
234 <m:mtext>OF ARITY</m:mtext>
241 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
242 <xsl:apply-templates select="./arity/*[1]"/>
249 <m:mtext>BUILT FROM</m:mtext>
253 <xsl:for-each select="./Constructor">
258 <xsl:when test="position() = 1">
259 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
263 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
266 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
267 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
268 <xsl:apply-templates select="./*[1]"/>
280 <xsl:template match="Variable">
282 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
286 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
293 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
294 <xsl:apply-templates select="type/*[1]"/>
302 <!--**********************-->
304 <!--**********************-->
306 <xsl:template match="m:bvar">
308 <xsl:when test="m:type">
309 <xsl:variable name="charlength">
310 <xsl:apply-templates select="m:ci" mode="charcount"/>
313 <xsl:when test="$charlength >= $framewidth">
314 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
317 <xsl:apply-templates select="m:ci"/>
323 <xsl:apply-templates select="m:type"/>
329 <xsl:apply-templates select="m:ci"/>
331 <xsl:apply-templates select="m:type"/>
336 <xsl:apply-templates select="m:ci"/>
344 <xsl:template match="m:apply[m:csymbol]">
345 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
346 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
348 <xsl:if test="@helm:xref">
349 <xsl:attribute name="helm:xref"><xsl:value-of select="@helm:xref"/></xsl:attribute>
352 <xsl:when test="$name='forall'">
354 <xsl:when test="$charlength >= $framewidth">
355 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
358 <m:mo color="Blue"><m:mchar name="ForAll"/></m:mo>
359 <xsl:apply-templates select="m:bvar"/>
366 <xsl:apply-templates select="*[position()=3]"/>
373 <m:mo color="Blue"><m:mchar name="ForAll"/></m:mo>
374 <xsl:apply-templates select="m:bvar/m:ci"/>
376 <xsl:apply-templates select="m:bvar/m:type"/>
378 <xsl:apply-templates select="*[position()=3]"/>
382 <xsl:when test="$name='prod'">
384 <xsl:when test="$charlength >= $framewidth">
385 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
388 <m:mo color="Blue">Π</m:mo>
389 <xsl:apply-templates select="m:bvar"/>
396 <xsl:apply-templates select="*[position()=3]"/>
403 <m:mo color="Blue">Π</m:mo>
404 <xsl:apply-templates select="m:bvar/m:ci"/>
406 <xsl:apply-templates select="m:bvar/m:type"/>
408 <xsl:apply-templates select="*[position()=3]"/>
412 <xsl:when test="$name='arrow'">
414 <xsl:when test="$charlength >= $framewidth">
415 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
419 <m:mo stretchy="false">(</m:mo>
420 <xsl:apply-templates select="*[position()=2]"/>
427 <m:mo color="Blue">→</m:mo>
428 <xsl:apply-templates select="*[position()=3]"/>
435 <m:mo stretchy="false">)</m:mo>
442 <m:mo stretchy="false">(</m:mo>
443 <xsl:apply-templates select="*[position()=2]"/>
444 <m:mo color="Blue">→</m:mo>
445 <xsl:apply-templates select="*[position()=3]"/>
446 <m:mo stretchy="false">)</m:mo>
450 <xsl:when test="$name='app'">
452 <xsl:when test="$charlength >= $framewidth">
453 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
457 <m:mo stretchy="false">(</m:mo>
458 <xsl:apply-templates select="*[position()=2]"/>
462 <xsl:for-each select="*[position()>2]">
466 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
467 <xsl:apply-templates select="."/>
475 <m:mo stretchy="false">)</m:mo>
482 <m:mo stretchy="false">(</m:mo>
483 <xsl:apply-templates select="*[position()=2]"/>
484 <xsl:for-each select="*[position()>2]">
485 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
486 <xsl:apply-templates select="."/>
488 <m:mo stretchy="false">)</m:mo>
492 <xsl:when test="$name='cast'">
494 <xsl:when test="$charlength >= $framewidth">
495 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
499 <m:mo stretchy="false">(</m:mo>
500 <xsl:apply-templates select="*[position()=2]"/>
507 <m:mo color="Maroon">:></m:mo>
508 <xsl:apply-templates select="*[position()=3]"/>
515 <m:mo stretchy="false">)</m:mo>
522 <m:mo stretchy="false">(</m:mo>
523 <xsl:apply-templates select="*[position()=2]"/>
524 <m:mo color="Maroon">:></m:mo>
525 <xsl:apply-templates select="*[position()=3]"/>
526 <m:mo stretchy="false">)</m:mo>
530 <xsl:when test="$name='Prop'">
533 <xsl:when test="$name='Set'">
536 <xsl:when test="$name='Type'">
539 <xsl:when test="$name='mutcase'">
541 <xsl:when test="$charlength >= $framewidth">
542 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
543 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
548 <xsl:apply-templates select="*[position()=2]"/>
549 <xsl:if test="$framewidth > $charlength">
552 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
553 <xsl:apply-templates select="*[position()=3]"/>
558 <xsl:if test="$charlength >= $framewidth">
564 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
565 <xsl:apply-templates select="*[position()=3]"/>
577 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
578 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
583 <xsl:when test="position() = 1">
584 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
587 <m:mo stretchy="false">|</m:mo>
590 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
591 <xsl:apply-templates select="."/>
592 <xsl:if test="$framewidth > $charlength">
593 <m:mo color="Green">⇒</m:mo>
594 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
599 <xsl:if test="$charlength >= $framewidth">
603 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
604 <m:mo color="Green">⇒</m:mo>
605 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
621 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
623 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
624 <xsl:apply-templates select="*[position()=3]"/>
625 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
627 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
629 <xsl:when test="position() != 1">
630 <m:mo stretchy="false">|</m:mo>
633 <xsl:apply-templates select="."/>
634 <m:mo color="Green">⇒</m:mo>
635 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
637 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
642 <xsl:when test="$name='fix'">
644 <xsl:when test="$charlength >= $framewidth">
645 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
650 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
651 <m:mi><xsl:value-of select="m:ci"/></m:mi>
652 <m:mo stretchy="false">{</m:mo>
659 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
660 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
661 <xsl:for-each select="m:bvar">
662 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
666 <m:mi><xsl:value-of select="m:ci"/></m:mi>
668 <xsl:if test="$framewidth > $charlength">
669 <xsl:apply-templates select="m:type"/>
674 <xsl:if test="$charlength >= $framewidth">
678 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
679 <xsl:apply-templates select="m:type"/>
688 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
700 <m:mo stretchy="false">}</m:mo>
708 <m:mi><xsl:value-of select="m:ci"/></m:mi>
709 <m:mo stretchy="false">{</m:mo>
710 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
711 <xsl:for-each select="m:bvar">
715 <m:mi><xsl:value-of select="m:ci"/></m:mi>
717 <xsl:apply-templates select="m:type"/>
719 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
720 <xsl:if test="position()=last()">
721 <m:mo stretchy="false">}</m:mo>
731 <xsl:when test="$name='cofix'">
733 <xsl:when test="$charlength >= $framewidth">
734 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
739 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
740 <m:mi><xsl:value-of select="m:ci"/></m:mi>
741 <m:mo stretchy="false">{</m:mo>
748 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
749 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
750 <xsl:for-each select="m:bvar">
751 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
755 <m:mi><xsl:value-of select="m:ci"/></m:mi>
757 <xsl:if test="$framewidth > $charlength">
758 <xsl:apply-templates select="m:type"/>
763 <xsl:if test="$charlength >= $framewidth">
767 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
768 <xsl:apply-templates select="m:type"/>
777 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
789 <m:mo stretchy="false">}</m:mo>
797 <m:mi><xsl:value-of select="m:ci"/></m:mi>
798 <m:mo stretchy="false">{</m:mo>
799 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
800 <xsl:for-each select="m:bvar">
804 <m:mi><xsl:value-of select="m:ci"/></m:mi>
806 <xsl:apply-templates select="m:type"/>
808 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
809 <xsl:if test="position()=last()">
810 <m:mo stretchy="false">}</m:mo>
820 <!-- ***************************************** -->
821 <!-- *********** PROOF ELEMENTS ************** -->
822 <!-- ***************************************** -->
823 <xsl:when test="$name='proof'">
824 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
828 <xsl:apply-templates select="*[position()=2]"/>
835 <m:mtext color="Maroon">we proved </m:mtext>
836 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
837 <xsl:apply-templates select="*[position()=3]"/>
843 <xsl:when test="$name='letin'">
844 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
845 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
846 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
850 <xsl:apply-templates select="."/>
858 <xsl:apply-templates select="*[position()=last()]"/>
864 <xsl:when test="$name='let'">
866 <xsl:apply-templates select="m:ci"/>
867 <m:mtext>) </m:mtext>
868 <xsl:apply-templates select="*[3]"/>
870 <xsl:when test="$name='thread'">
871 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
876 <xsl:when test="name(*[last()])='m:apply'">
877 <xsl:apply-templates select="*[last()]"/>
880 <m:mtext>Consider </m:mtext>
881 <xsl:apply-templates select="*[last()]"/>
887 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
890 <xsl:when test="$name='rewrite_and_apply'">
895 <m:mtext>Rewrite</m:mtext>
896 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
897 <xsl:apply-templates select="*[2]/*[2]"/>
898 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
899 <m:mtext>with</m:mtext>
900 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
901 <xsl:apply-templates select="*[2]/*[3]"/>
902 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
903 <m:mtext>by</m:mtext>
904 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
905 <xsl:apply-templates select="*[2]/*[4]"/>
906 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
907 <m:mtext>in</m:mtext>
908 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
909 <xsl:apply-templates select="*[3]"/>
910 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
911 <m:mtext>and apply to</m:mtext>
912 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
913 <xsl:apply-templates select="*[position()>3]"/>
919 <xsl:when test="$name='and_ind'">
920 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
925 <xsl:when test="name(*[2])='m:apply'">
926 <xsl:apply-templates select="*[2]"/>
929 <m:mtext>Consider </m:mtext>
930 <xsl:apply-templates select="*[2]"/>
938 <m:mtext>In particular, we have</m:mtext>
945 <xsl:apply-templates select="*[3]"/>
947 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
948 <xsl:apply-templates select="*[4]"/>
956 <xsl:apply-templates select="*[5]"/>
958 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
959 <xsl:apply-templates select="*[6]"/>
966 <xsl:apply-templates select="*[7]"/>
972 <xsl:when test="$name='or_ind'">
973 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
978 <xsl:when test="name(*[2])='m:apply'">
979 <xsl:apply-templates select="*[2]"/>
982 <m:mtext>Consider</m:mtext>
983 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
984 <xsl:apply-templates select="*[2]"/>
992 <m:mtext>We prove</m:mtext>
993 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
994 <xsl:apply-templates select="*[3]"/>
995 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
996 <m:mtext>by cases:</m:mtext>
1002 <m:mtext>*</m:mtext>
1003 <xsl:apply-templates select="*[4]"/>
1010 <m:mtext>*</m:mtext>
1011 <xsl:apply-templates select="*[5]"/>
1024 <xsl:template match="*" mode="thread">
1025 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1027 <xsl:when test="$name='rw_step'">
1031 <m:mtext>Rewrite</m:mtext>
1032 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1033 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1034 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1035 <m:mtext>with</m:mtext>
1036 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1037 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1038 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1039 <m:mtext>by</m:mtext>
1040 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1041 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1048 <m:mtext color="Maroon">we get</m:mtext>
1049 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1050 <xsl:apply-templates select="."/>
1059 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1066 <m:mtext color="Maroon">we get</m:mtext>
1067 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1068 <xsl:apply-templates select="."/>
1074 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1080 <xsl:template match="m:lambda">
1081 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1082 <m:mrow helm:xref="{@helm:xref}">
1084 <xsl:when test="$charlength >= $framewidth">
1085 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1088 <m:mo color="Red">λ</m:mo>
1089 <xsl:apply-templates select="m:bvar"/>
1096 <xsl:apply-templates select="*[position()=2]"/>
1103 <m:mo color="Red">λ</m:mo>
1104 <xsl:apply-templates select="m:bvar/m:ci"/>
1106 <xsl:apply-templates select="m:bvar/m:type"/>
1108 <xsl:apply-templates select="*[position()=2]"/>
1114 <!-- *********************************** -->
1115 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1116 <!-- *********************************** -->
1120 <xsl:template match = "m:apply[m:eq[1]]">
1121 <xsl:variable name="charlength">
1122 <xsl:apply-templates select="*[1]" mode="charcount"/>
1125 <xsl:when test="$charlength >= $framewidth">
1126 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1127 <xsl:if test="@helm:xref">
1128 <xsl:attribute name="helm:xref">
1129 <xsl:value-of select="@helm:xref"/>
1134 <m:mo stretchy="false">(</m:mo>
1135 <xsl:apply-templates select="*[position()=2]"/>
1138 <xsl:for-each select = "*[position()>2]">
1141 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1142 <m:mo helm:xref="m:in/@helm:xref">
1145 <xsl:apply-templates select="."/>
1151 <m:mo stretchy="false">)</m:mo>
1157 <xsl:apply-imports/>
1163 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1164 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1165 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1166 |m:prsubset|m:setdiff[1]]">
1167 <xsl:variable name="symbol">
1169 <xsl:when test="m:and[1]">
1170 <xsl:value-of select="'wedge'"/>
1172 <xsl:when test="m:or[1]">
1173 <xsl:value-of select="'vee'"/>
1175 <xsl:when test="m:geq[1]">
1176 <xsl:value-of select="'geq'"/>
1178 <xsl:when test="m:leq[1]">
1179 <xsl:value-of select="'leq'"/>
1181 <xsl:when test="m:gt[1]">
1182 <xsl:value-of select="'gt'"/>
1184 <xsl:when test="m:lt[1]">
1185 <xsl:value-of select="'lt'"/>
1187 <xsl:when test="m:eq[1]">
1188 <xsl:value-of select="'Equal'"/>
1190 <xsl:when test="m:in[1]">
1191 <xsl:value-of select="'Element'"/>
1193 <xsl:when test="m:subset[1]">
1194 <xsl:value-of select="'SubsetEqual'"/>
1196 <xsl:when test="m:prsubset[1]">
1197 <xsl:value-of select="'subset'"/>
1199 <xsl:when test="m:intersect[1]">
1200 <xsl:value-of select="'Intersection'"/>
1202 <xsl:when test="m:union[1]">
1203 <xsl:value-of select="'Union'"/>
1205 <xsl:when test="m:setdiff[1]">
1206 <xsl:value-of select="'Backslash'"/>
1210 <xsl:variable name="charlength">
1211 <xsl:apply-templates select="*[1]" mode="charcount"/>
1214 <xsl:when test="$charlength >= $framewidth">
1215 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1216 <xsl:if test="@helm:xref">
1217 <xsl:attribute name="helm:xref">
1218 <xsl:value-of select="@helm:xref"/>
1223 <m:mo stretchy="false">(</m:mo>
1224 <xsl:apply-templates select="*[position()=2]"/>
1227 <xsl:for-each select = "*[position()>2]">
1230 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1231 <m:mo helm:xref="{*[1]/@helm:xref}">
1232 <m:mchar name="{$symbol}"/>
1234 <xsl:apply-templates select="."/>
1240 <m:mo stretchy="false">)</m:mo>
1246 <xsl:apply-imports/>
1251 <xsl:template match = "m:set">
1253 <xsl:when test="count(child::*) = 0">
1255 <m:mchar name="emptyset"/>
1259 <xsl:variable name="charlength">
1260 <xsl:apply-templates select="*[1]" mode="charcount"/>
1263 <xsl:when test="$charlength >= $framewidth">
1265 <xsl:when test="name(*[1]) = 'm:bvar'">
1266 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1269 <m:mo stretchy="false">{</m:mo>
1270 <xsl:apply-templates select="*[position()=1]"/>
1275 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1276 <m:mo stretchy="false">|</m:mo>
1277 <xsl:apply-templates select="m:condition/*[1]"/>
1282 <m:mo stretchy="false">}</m:mo>
1288 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1291 <m:mo stretchy="false">{</m:mo>
1292 <xsl:apply-templates select="*[position()=1]"/>
1293 <xsl:if test="position() != last()">
1298 <xsl:for-each select = "*[position()>2]">
1301 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1302 <xsl:apply-templates select="."/>
1303 <xsl:if test="position() != last()">
1311 <m:mo stretchy="false">}</m:mo>
1319 <xsl:apply-imports/>
1326 <xsl:template match = "m:apply[m:card[1]]">
1327 <m:mo stretchy="false">|</m:mo>
1328 <xsl:apply-templates select="*[2]"/>
1329 <m:mo stretchy="false">|</m:mo>
1332 <!-- *********************************** -->
1333 <!-- PROOF ELEMENTS -->
1334 <!-- *********************************** -->
1338 <!--**********************-->
1340 <!--**********************-->
1342 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1343 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1344 |m:plus|m:minus|m:times" mode="charcount">
1345 <xsl:param name="incurrent_length" select="0"/>
1347 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1348 <xsl:variable name="siblength">
1349 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1350 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1351 </xsl:apply-templates>
1354 <xsl:when test="string($siblength) = """>
1355 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1358 <xsl:value-of select="number($siblength)"/>
1363 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1368 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1369 <xsl:param name="incurrent_length" select="0"/>
1370 <xsl:param name="nosibling" select="0"/>
1372 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1373 <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>
1375 <xsl:when test="string($siblength) = """>
1376 <xsl:value-of select="$incurrent_length + string-length()"/>
1379 <xsl:value-of select="number($siblength)"/>
1384 <xsl:value-of select="$incurrent_length + string-length()"/>
1389 <xsl:template match="*" mode="charcount">
1390 <xsl:param name="incurrent_length" select="0"/>
1391 <xsl:param name="nosibling" select="0"/>
1393 <xsl:when test="count(child::*) = 0">
1394 <xsl:value-of select="$incurrent_length"/>
1397 <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>
1399 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1400 <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>
1402 <xsl:when test="string($siblength) = """>
1403 <xsl:value-of select="number($childlength)"/>
1406 <xsl:value-of select="number($siblength)"/>
1411 <xsl:value-of select="number($childlength)"/>