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 <!-- NOTE: the namespace declaration has to be done in the stylesheets
36 which generates the toplevel element (see for instance xlink) -->
37 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
38 xmlns:m="http://www.w3.org/1998/Math/MathML"
39 xmlns:helm="http://www.cs.unibo.it/helm"
40 xmlns:xlink="http://www.w3.org/1999/xlink">
42 <!-- OLD: <xsl:import href="mml2mmlv1_0.xsl"/> -->
44 <xsl:import href="mmlnotation.xsl"/>
46 <xsl:import href="mmltheoryextension.xsl"/>
49 <xsl:param name="explodeall" select="false()"/>
51 <!--***********************************************************************-->
52 <!-- Parameter affecting line-breaking -->
53 <!--***********************************************************************-->
55 <xsl:variable name="framewidth" select="35"/>
57 <!--***********************************************************************-->
58 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
59 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
60 <!-- sono i termini: la presentation per un termine e' generata come primo -->
61 <!-- figlio di un semantics e l'originario content viene inserito nel -->
62 <!-- nel secondo figlio di semantics, annotation-xml -->
63 <!--***********************************************************************-->
65 <!--**********************-->
67 <!--**********************-->
69 <xsl:param name="type" select="'standalone'"/>
71 <xsl:template match="/">
73 <xsl:when test="$type = 'standalone'">
74 <xsl:apply-templates select="*"/>
78 <xsl:apply-templates select="*"/>
86 <xsl:template match="Definition">
88 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
92 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
99 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
100 <xsl:apply-templates select="type/*[1]"/>
107 <m:mtext>AS</m:mtext>
114 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
115 <xsl:apply-templates select="body/*[1]"/>
125 <xsl:template match="Axiom">
127 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
131 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
138 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
139 <xsl:apply-templates select="type/*[1]"/>
147 <!-- UNFINISHED PROOF -->
149 <xsl:template match="CurrentProof">
151 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
155 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
162 <m:mtext>THESIS:</m:mtext>
169 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
170 <xsl:apply-templates select="type/*[1]"/>
177 <m:mtext>CONJECTURES:</m:mtext>
181 <xsl:for-each select="Conjecture">
184 <m:mrow helm:xref="{@helm:xref}">
185 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
186 <xsl:for-each select="Decl|Def|Hidden">
188 <xsl:when test="name(.)='Decl'">
189 <m:mrow helm:xref="{@helm:xref}">
191 <xsl:when test="@name">
192 <m:mi><xsl:value-of select="@name"/></m:mi>
199 <xsl:apply-templates select="./*[1]"/>
202 <xsl:when test="name(.)='Def'">
203 <m:mrow helm:xref="{@helm:xref}">
205 <xsl:when test="@name">
206 <m:mi><xsl:value-of select="@name"/></m:mi>
213 <xsl:apply-templates select="./*[1]"/>
217 <m:mrow helm:xref="{@helm:xref}">
224 <xsl:if test="not (position() = last())">
229 <m:msub><m:mi>?</m:mi><m:mn><xsl:value-of select="@no"/></m:mn></m:msub>
231 <xsl:apply-templates select="./Goal/*[1]"/>
239 <m:mtext>PROOF:</m:mtext>
246 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
247 <xsl:apply-templates select="body/*[1]"/>
255 <!-- MUTUAL INDUCTIVE DEFINITION -->
257 <xsl:template match="InductiveDefinition">
259 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
260 <xsl:for-each select="InductiveType">
265 <xsl:when test="position() = 1">
267 <xsl:when test="string(./@inductive) = "true"">
268 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
271 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
276 <m:mtext>AND</m:mtext>
279 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
280 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
287 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
290 <xsl:when test="string(../Param) != """>
291 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
292 <xsl:for-each select="../Param">
296 <m:mi><xsl:value-of select="./@name"/></m:mi>
298 <xsl:apply-templates select="*"/>
322 <m:mtext>OF ARITY</m:mtext>
329 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
330 <xsl:apply-templates select="./arity/*[1]"/>
337 <m:mtext>BUILT FROM</m:mtext>
341 <xsl:for-each select="./Constructor">
346 <xsl:when test="position() = 1">
347 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
351 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
354 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
355 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
356 <xsl:apply-templates select="./*[1]"/>
368 <xsl:template match="Variable">
370 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
374 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
381 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
382 <xsl:apply-templates select="type/*[1]"/>
386 <xsl:if test="name(*[1])='body'">
390 <m:mtext>AS</m:mtext>
397 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
398 <xsl:apply-templates select="body/*[1]"/>
409 <xsl:template match="Sequent">
410 <xsl:variable name="rowlines">
411 <xsl:for-each select="Decl|Def">
412 <xsl:if test="position() != last()">
413 <xsl:text>none </xsl:text>
416 <xsl:text>solid</xsl:text>
418 <xsl:variable name="no" select="@no"/>
420 <m:mi><xsl:text>?</xsl:text><xsl:value-of select="$no"/></m:mi>
422 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
423 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}" rowlines="{$rowlines}">
424 <xsl:for-each select="Decl|Def">
427 <m:mrow helm:xref="{@helm:xref}">
428 <m:mi><xsl:value-of select="@name"/></m:mi>
430 <xsl:when test="name(.) = 'Decl'">
437 <xsl:apply-templates select="*[1]"/>
442 <xsl:if test="not(Decl|Def)">
446 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
454 <xsl:apply-templates select="Goal/*[1]"/>
462 <!--**********************-->
464 <!--**********************-->
466 <xsl:template match="m:bvar">
468 <xsl:when test="m:type">
469 <xsl:variable name="charlength">
470 <xsl:apply-templates select="m:ci" mode="charcount"/>
473 <xsl:when test="$charlength >= $framewidth">
474 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
478 <xsl:apply-templates select="m:ci"/>
486 <xsl:apply-templates select="m:type"/>
494 <xsl:apply-templates select="m:ci"/>
496 <xsl:apply-templates select="m:type"/>
502 <xsl:apply-templates select="m:ci"/>
510 <xsl:template match="m:apply[m:csymbol]">
511 <xsl:param name="nopar" select="0"/>
512 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
513 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
516 <xsl:attribute name="xref"><xsl:value-of select="@id"/></xsl:attribute>
518 <xsl:variable name="id" select="m:csymbol/@id"/>
521 <xsl:when test="$name='meta'">
523 <xsl:apply-templates select="*[position()=2]"/>
524 <m:mfenced open="[" close="]" separators=";">
525 <xsl:apply-templates select="*[position()>2]"/>
530 <xsl:when test="$name='forall'">
532 <xsl:when test="$charlength >= $framewidth">
533 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
537 <m:mo mathcolor="Blue">∀</m:mo>
538 <xsl:apply-templates select="m:bvar"/>
546 <xsl:apply-templates select="*[position()=3]"/>
553 <m:mo mathcolor="Blue">∀</m:mo>
554 <xsl:apply-templates select="m:bvar/m:ci"/>
556 <xsl:apply-templates select="m:bvar/m:type"/>
558 <xsl:apply-templates select="*[position()=3]"/>
563 <xsl:when test="$name='let_in'">
565 <xsl:when test="$charlength >= $framewidth">
566 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
571 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
572 <xsl:apply-templates select="m:bvar"/>
580 <xsl:apply-templates select="*[position()=3]"/>
588 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
589 <xsl:apply-templates select="*[position()=4]"/>
597 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
598 <xsl:apply-templates select="m:bvar/m:ci"/>
600 <xsl:apply-templates select="*[position()=3]"/>
601 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
602 <m:mtext>IN</m:mtext>
603 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
604 <xsl:apply-templates select="*[position()=4]"/>
609 <xsl:when test="$name='prod'">
611 <xsl:when test="$charlength >= $framewidth">
612 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
616 <m:mo mathcolor="Blue">Π</m:mo>
617 <xsl:apply-templates select="m:bvar"/>
625 <xsl:apply-templates select="*[position()=3]"/>
632 <m:mo mathcolor="Blue">Π</m:mo>
633 <xsl:apply-templates select="m:bvar/m:ci"/>
635 <xsl:apply-templates select="m:bvar/m:type"/>
637 <xsl:apply-templates select="*[position()=3]"/>
642 <xsl:when test="$name='arrow'">
644 <xsl:when test="$charlength >= $framewidth">
645 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
649 <xsl:if test="$nopar=0">
650 <m:mo stretchy="false">(</m:mo>
652 <xsl:apply-templates select="*[position()=2]"/>
659 <m:mo mathmathcolor="Blue">→</m:mo>
661 <xsl:when test="*[position()=3]/m:csymbol">
662 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
664 <xsl:when test="$nextp='arrow'">
665 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
668 <xsl:apply-templates select="*[position()=3]"/>
673 <xsl:apply-templates select="*[position()=3]"/>
679 <xsl:if test="$nopar=0">
683 <m:mo stretchy="false">)</m:mo>
691 <xsl:if test="$nopar=0">
692 <m:mo stretchy="false">(</m:mo>
694 <xsl:apply-templates select="*[position()=2]"/>
695 <m:mo mathcolor="Blue">→</m:mo>
697 <xsl:when test="*[position()=3]/m:csymbol">
698 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
700 <xsl:when test="$nextp='arrow'">
701 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
704 <xsl:apply-templates select="*[position()=3]"/>
709 <xsl:apply-templates select="*[position()=3]"/>
712 <xsl:if test="$nopar=0">
713 <m:mo stretchy="false">)</m:mo>
719 <xsl:when test="$name='app'">
721 <xsl:when test="$charlength >= $framewidth">
722 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
726 <m:mo stretchy="false">(</m:mo>
727 <!-- added precedence to app = FUNCTION_PREC (99) -->
728 <xsl:apply-templates select="*[position()=2]">
729 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
730 </xsl:apply-templates>
734 <xsl:for-each select="*[position()>2]">
738 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
739 <!-- added precedence to app = FUNCTION_PREC (99) -->
740 <xsl:apply-templates select=".">
741 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
742 </xsl:apply-templates>
750 <m:mo stretchy="false">)</m:mo>
757 <m:mo stretchy="false">(</m:mo>
758 <!-- added precedence to app = FUNCTION_PREC (99) -->
759 <xsl:apply-templates select="*[position()=2]">
760 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
761 </xsl:apply-templates>
762 <xsl:for-each select="*[position()>2]">
763 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
764 <!-- added precedence to app = FUNCTION_PREC (99) -->
765 <xsl:apply-templates select=".">
766 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
767 </xsl:apply-templates>
769 <m:mo stretchy="false">)</m:mo>
774 <xsl:when test="$name='cast'">
776 <xsl:when test="$charlength >= $framewidth">
777 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
781 <m:mo stretchy="false">(</m:mo>
782 <xsl:apply-templates select="*[position()=2]"/>
789 <m:mo mathcolor="Maroon">:></m:mo>
790 <xsl:apply-templates select="*[position()=3]"/>
797 <m:mo stretchy="false">)</m:mo>
804 <m:mo stretchy="false">(</m:mo>
805 <xsl:apply-templates select="*[position()=2]"/>
806 <m:mo mathcolor="Maroon">:></m:mo>
807 <xsl:apply-templates select="*[position()=3]"/>
808 <m:mo stretchy="false">)</m:mo>
813 <xsl:when test="$name='Prop'">
817 <xsl:when test="$name='Set'">
821 <xsl:when test="$name='Type'">
825 <xsl:when test="$name='mutcase'">
827 <xsl:when test="$charlength >= $framewidth">
828 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
829 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
834 <xsl:apply-templates select="*[position()=2]"/>
835 <xsl:if test="$framewidth > $charlength">
838 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
839 <xsl:apply-templates select="*[position()=3]"/>
844 <xsl:if test="$charlength >= $framewidth">
850 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
851 <xsl:apply-templates select="*[position()=3]"/>
863 <xsl:for-each select="m:piecewise/m:piece">
864 <xsl:variable name="charlength"><xsl:apply-templates select="./*[2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
869 <xsl:when test="position() = 1">
870 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
873 <m:mo stretchy="false">|</m:mo>
876 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
877 <xsl:apply-templates select="./*[2]"/>
878 <xsl:if test="$framewidth > $charlength">
879 <m:mo mathcolor="Green">⇒</m:mo>
880 <xsl:apply-templates select="./*[1]"/>
885 <xsl:if test="$charlength >= $framewidth">
889 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
890 <m:mo mathcolor="Green">⇒</m:mo>
891 <xsl:apply-templates select="./*[1]"/>
907 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
909 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
910 <xsl:apply-templates select="*[position()=3]"/>
911 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
913 <xsl:for-each select="m:piecewise/m:piece">
915 <xsl:when test="position() != 1">
916 <m:mo stretchy="false">|</m:mo>
919 <xsl:apply-templates select="./*[2]"/>
920 <m:mo mathcolor="Green">⇒</m:mo>
921 <xsl:apply-templates select="./*[1]"/>
923 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
929 <xsl:when test="$name='fix'">
931 <xsl:when test="$charlength >= $framewidth">
932 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
937 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
938 <m:mi><xsl:value-of select="m:ci"/></m:mi>
939 <m:mo stretchy="false">{</m:mo>
946 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
947 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
948 <xsl:for-each select="m:bvar">
949 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
953 <m:mi><xsl:value-of select="m:ci"/></m:mi>
955 <xsl:if test="$framewidth > $charlength">
956 <xsl:apply-templates select="m:type"/>
961 <xsl:if test="$charlength >= $framewidth">
965 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
966 <xsl:apply-templates select="m:type"/>
975 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
987 <m:mo stretchy="false">}</m:mo>
995 <m:mi><xsl:value-of select="m:ci"/></m:mi>
996 <m:mo stretchy="false">{</m:mo>
997 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
998 <xsl:for-each select="m:bvar">
1002 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1004 <xsl:apply-templates select="m:type"/>
1006 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1007 <xsl:if test="position()=last()">
1008 <m:mo stretchy="false">}</m:mo>
1019 <xsl:when test="$name='cofix'">
1021 <xsl:when test="$charlength >= $framewidth">
1022 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1027 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1028 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1029 <m:mo stretchy="false">{</m:mo>
1036 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1037 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1038 <xsl:for-each select="m:bvar">
1039 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1043 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1045 <xsl:if test="$framewidth > $charlength">
1046 <xsl:apply-templates select="m:type"/>
1051 <xsl:if test="$charlength >= $framewidth">
1055 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
1056 <xsl:apply-templates select="m:type"/>
1065 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1077 <m:mo stretchy="false">}</m:mo>
1085 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1086 <m:mo stretchy="false">{</m:mo>
1087 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1088 <xsl:for-each select="m:bvar">
1092 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1094 <xsl:apply-templates select="m:type"/>
1096 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1097 <xsl:if test="position()=last()">
1098 <m:mo stretchy="false">}</m:mo>
1109 <xsl:when test="$name='inst'">
1111 <xsl:if test="$id != ''">
1112 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1114 <xsl:apply-templates select="*[2]"/>
1115 <m:mo stretchy="false">{</m:mo>
1116 <xsl:for-each select="*[(position()>2) and (position() mod 2 = 1)]">
1117 <xsl:apply-templates select="."/>
1118 <m:mo stretchy="false">:=</m:mo>
1119 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1121 <m:mo stretchy="false">}</m:mo>
1125 <xsl:when test="$name='ite'">
1127 <xsl:when test="$charlength >= $framewidth">
1128 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1133 <xsl:apply-templates select="*[2]"/>
1141 <xsl:apply-templates select="*[3]"/>
1149 <xsl:apply-templates select="*[4]"/>
1158 <xsl:apply-templates select="*[2]"/>
1160 <xsl:apply-templates select="*[3]"/>
1162 <xsl:apply-templates select="*[4]"/>
1167 <!-- ***************************************** -->
1168 <!-- *********** PROOF ELEMENTS ************** -->
1169 <!-- ***************************************** -->
1171 <xsl:when test="$name='proof'">
1172 <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
1173 <xsl:variable name="test" select="(not($explodeall)) and
1174 (not(preceding-sibling::*[1]/text()='letin1')) and
1175 (not(preceding-sibling::*[1]/text()='rw_step')) and
1176 (not(name(..)='m:lambda'))"/>
1177 <xsl:variable name="hidden_details">
1178 <xsl:if test="$test">
1179 <!-- Details hided (default) -->
1180 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1184 <m:mtext mathcolor="Red">We can prove</m:mtext>
1185 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1186 <!-- the last child is either the expected type, if provided,-->
1187 <!-- or the synthesized type. -->
1188 <xsl:apply-templates select="*[position()=last()]"/>
1190 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1191 <m:mtext mathcolor="Green">(explain)</m:mtext>
1199 <xsl:variable name="shown_details">
1200 <!-- Show details -->
1201 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1205 <xsl:apply-templates select="*[position()=2]"/>
1209 <xsl:variable name="hidedetails">
1212 <m:mtext>_</m:mtext>
1214 <xsl:if test="$test">
1215 <m:mtext mathcolor="Green">(hide details)</m:mtext>
1222 <m:mtext mathcolor="Red">we proved</m:mtext>
1223 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1224 <xsl:apply-templates select="*[position()=3]"/>
1225 <xsl:if test="not(*[4])">
1226 <xsl:copy-of select="$hidedetails"/>
1231 <xsl:if test="*[4]">
1235 <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
1236 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1237 <xsl:apply-templates select="*[position()=4]"/>
1238 <xsl:copy-of select="$hidedetails"/>
1246 <xsl:when test="$test">
1247 <m:maction actiontype="toggle">
1248 <xsl:copy-of select="$hidden_details"/>
1249 <xsl:copy-of select="$shown_details"/>
1253 <xsl:copy-of select="$shown_details"/>
1258 <xsl:when test="$name='side_proof'">
1259 <xsl:variable name="test" select="(not($explodeall))"/>
1260 <xsl:variable name="hidden_details">
1261 <xsl:if test="$test">
1262 <!-- Details hided (default) -->
1263 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1267 <m:mtext mathcolor="Red">We can prove</m:mtext>
1268 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1269 <!-- the last child is either the expected type, if provided,-->
1270 <!-- or the synthesized type. -->
1271 <xsl:apply-templates select="*[position()=last()]"/>
1273 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1274 <m:mtext mathcolor="Green">(explain)</m:mtext>
1282 <xsl:variable name="shown_details">
1283 <!-- Show details -->
1284 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1288 <xsl:apply-templates select="*[position()=2]"/>
1292 <xsl:variable name="hidedetails">
1295 <m:mtext>_</m:mtext>
1297 <xsl:if test="$test">
1298 <m:mtext mathcolor="Green">(hide details)</m:mtext>
1305 <m:mtext mathcolor="Red">we proved</m:mtext>
1306 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1307 <xsl:apply-templates select="*[position()=3]"/>
1308 <xsl:if test="not(*[4])">
1309 <xsl:copy-of select="$hidedetails"/>
1314 <xsl:if test="*[4]">
1318 <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
1319 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1320 <xsl:apply-templates select="*[position()=4]"/>
1321 <xsl:copy-of select="$hidedetails"/>
1329 <xsl:when test="$test">
1330 <m:maction actiontype="toggle">
1331 <xsl:copy-of select="$hidden_details"/>
1332 <xsl:copy-of select="$shown_details"/>
1336 <xsl:copy-of select="$shown_details"/>
1341 <xsl:when test="$name='letin1'">
1342 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1346 <xsl:apply-templates select="*[position()=2]"/>
1353 <xsl:apply-templates select="*[position()=3]"/>
1359 <xsl:when test="$name='by_induction'">
1360 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1364 <m:mtext mathcolor="Red">We prove</m:mtext>
1365 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1366 <xsl:apply-templates select="../*[3]"/>
1373 <m:mtext mathcolor="Red">by induction on</m:mtext>
1374 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1375 <xsl:apply-templates
1376 select="*[position()=last()]/*[position()=last()]"/>
1383 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1384 <xsl:for-each select="*[position()>3 and not(position()=last())]">
1388 <xsl:apply-templates select="."/>
1399 <!-- inductive_case -->
1400 <xsl:when test="$name='inductive_case'">
1401 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1405 <m:mtext mathcolor="Red">Case</m:mtext>
1406 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1407 <xsl:apply-templates select="*[2]"/>
1414 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1415 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1416 <xsl:if test="*[3]/*[position()>1]">
1420 <m:mtext mathcolor="Red">By induction hypothesis, we have:</m:mtext>
1427 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1428 <xsl:for-each select="*[3]/*[position()>1]">
1429 <m:mo stretchy="false">(</m:mo>
1430 <xsl:apply-templates select="m:ci"/>
1431 <m:mo stretchy="false">) </m:mo>
1432 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1433 <xsl:apply-templates select="m:type"/>
1442 <xsl:apply-templates select="*[4]"/>
1453 <xsl:when test="$name='case_lhs'">
1456 <xsl:when test="count(*)=2">
1457 <xsl:apply-templates select="*[2]"/>
1460 <m:mo stretchy="false">(</m:mo>
1461 <xsl:apply-templates select="*[2]"/>
1462 <xsl:for-each select="m:bvar">
1463 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1464 <xsl:apply-templates select="*[1]"/>
1465 <m:mtext>:</m:mtext>
1466 <xsl:apply-templates select="m:type/*[1]"/>
1468 <m:mo stretchy="false">)</m:mo>
1474 <xsl:when test="$name='false_ind'">
1475 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1479 <xsl:apply-templates select="*[3]"/>
1486 <m:mtext mathcolor="Red">Contradiction.</m:mtext>
1493 <xsl:when test="$name='letin'">
1494 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1495 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
1496 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
1500 <xsl:apply-templates select="."/>
1508 <xsl:apply-templates select="*[position()=last()]"/>
1515 <xsl:when test="$name='let'">
1516 <m:mtext>(</m:mtext>
1517 <xsl:apply-templates select="m:ci"/>
1518 <m:mtext>) </m:mtext>
1519 <xsl:apply-templates select="*[3]"/>
1522 <xsl:when test="$name='rw_step'">
1523 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1528 <xsl:when test="name(*[2])='m:apply'">
1529 <xsl:apply-templates select="*[2]"/>
1532 <m:mtext>Consider</m:mtext>
1533 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1534 <xsl:apply-templates select="*[2]"/>
1543 <m:mtext>Rewrite</m:mtext>
1544 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1545 <xsl:apply-templates select="*[3]"/>
1546 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1547 <m:mtext>with</m:mtext>
1548 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1549 <xsl:apply-templates select="*[4]"/>
1550 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1551 <m:mtext>by</m:mtext>
1552 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1553 <xsl:apply-templates select="*[5]"/>
1559 <!-- not existing any more
1560 <xsl:when test="$name='thread'">
1561 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1566 <xsl:when test="name(*[last()])='m:apply'">
1567 <xsl:apply-templates select="*[last()]"/>
1570 <m:mtext>Consider</m:mtext>
1571 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1572 <xsl:apply-templates select="*[last()]"/>
1578 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1582 <!-- REWRITE_AND_APPLY -->
1583 <xsl:when test="$name='rewrite_and_apply'">
1584 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1588 <xsl:apply-templates select="*[2]"/>
1595 <m:mtext>Then apply it to</m:mtext>
1596 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1597 <xsl:apply-templates select="*[position()>2]"/>
1604 <xsl:when test="$name='and_ind'">
1605 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1610 <xsl:when test="name(*[2])='m:apply'">
1611 <xsl:apply-templates select="*[2]"/>
1614 <m:mtext>Consider</m:mtext>
1615 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1616 <xsl:apply-templates select="*[2]"/>
1625 <m:mtext>In particular, we have</m:mtext>
1632 <m:mtext>(</m:mtext>
1633 <xsl:apply-templates select="*[3]"/>
1634 <m:mtext>)</m:mtext>
1635 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1636 <xsl:apply-templates select="*[4]"/>
1643 <m:mtext>(</m:mtext>
1644 <xsl:apply-templates select="*[5]"/>
1645 <m:mtext>)</m:mtext>
1646 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1647 <xsl:apply-templates select="*[6]"/>
1654 <xsl:apply-templates select="*[7]"/>
1660 <!-- full_or_ind -->
1661 <xsl:when test="$name='full_or_ind'">
1662 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1667 <xsl:when test="name(*[2])='m:apply'">
1668 <xsl:apply-templates select="*[2]"/>
1671 <m:mtext>Consider</m:mtext>
1672 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1673 <xsl:apply-templates select="*[2]"/>
1682 <m:mtext>We proceed by cases to prove</m:mtext>
1683 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1684 <xsl:apply-templates select="*[3]"/>
1691 <m:mtext>Left: suppose</m:mtext>
1692 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1693 <m:mo stretchy="false">(</m:mo>
1694 <xsl:apply-templates select="*[4]/m:bvar/m:ci"/>
1695 <m:mo stretchy="false">)</m:mo>
1696 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1697 <xsl:apply-templates select="*[4]/m:bvar/m:type/*[1]"/>
1704 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1705 <xsl:apply-templates select="*[4]/*[3]"/>
1712 <m:mtext>Right: suppose</m:mtext>
1713 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1714 <m:mo stretchy="false">(</m:mo>
1715 <xsl:apply-templates select="*[5]/m:bvar/m:ci"/>
1716 <m:mo stretchy="false">)</m:mo>
1717 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1718 <xsl:apply-templates select="*[5]/m:bvar/m:type/*[1]"/>
1725 <xsl:apply-templates select="*[5]/*[3]"/>
1732 <xsl:when test="$name='or_ind'">
1733 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1738 <xsl:when test="name(*[2])='m:apply'">
1739 <xsl:apply-templates select="*[2]"/>
1742 <m:mtext>Consider</m:mtext>
1743 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1744 <xsl:apply-templates select="*[2]"/>
1753 <m:mtext>We prove</m:mtext>
1754 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1755 <xsl:apply-templates select="*[3]"/>
1756 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1757 <m:mtext>by cases:</m:mtext>
1764 <m:mtext>Left</m:mtext>
1765 <xsl:apply-templates select="*[4]"/>
1772 <m:mtext>Right</m:mtext>
1773 <xsl:apply-templates select="*[5]"/>
1780 <xsl:when test="$name='ex_ind'">
1781 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1786 <xsl:when test="name(*[2])='m:apply'">
1787 <xsl:apply-templates select="*[2]"/>
1790 <m:mtext>Consider</m:mtext>
1791 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1792 <xsl:apply-templates select="*[2]"/>
1801 <m:mtext>Let</m:mtext>
1802 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1803 <xsl:apply-templates select="*[3]"/>
1804 <m:mtext>:</m:mtext>
1805 <xsl:apply-templates select="*[4]"/>
1806 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1807 <m:mtext>such that</m:mtext>
1808 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1809 <m:mtext>(</m:mtext>
1810 <xsl:apply-templates select="*[5]"/>
1811 <m:mtext>)</m:mtext>
1812 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1813 <xsl:apply-templates select="*[6]"/>
1820 <xsl:apply-templates select="*[7]"/>
1827 <xsl:when test="$name='eq_chain'">
1828 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1832 <m:mtext mathcolor="Red">We have the following equality chain:</m:mtext>
1836 <xsl:for-each select="*[position() mod 2 = 0]">
1837 <xsl:variable name="pos" select="position()"/>
1842 <xsl:when test="$pos = 1">
1843 <xsl:apply-templates select="."/>
1844 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1849 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1850 <xsl:apply-templates select="."/>
1856 <xsl:if test="$pos != last()">
1860 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1861 <xsl:apply-templates select="../*[position()=2*$pos +1]"/>
1869 <!-- DISEQ_CHAIN -->
1870 <xsl:when test="$name='diseq_chain'">
1871 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1875 <m:mtext mathcolor="Red">We have the following disequality chain:</m:mtext>
1879 <xsl:for-each select="*[position() mod 3 = 2]">
1880 <xsl:variable name="pos" select="position()"/>
1885 <xsl:when test="$pos = 1">
1886 <xsl:apply-templates select="."/>
1887 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1888 <mo><xsl:apply-templates select="../*[position()=3*$pos]"/></mo>
1891 <mo><xsl:apply-templates select="../*[position()=3*($pos - 1)]"/></mo>
1892 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1893 <xsl:apply-templates select="."/>
1899 <xsl:if test="$pos != last()">
1903 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1904 <xsl:apply-templates select="../*[position()=3*$pos +1]"/>
1912 <!-- ***************************************** -->
1913 <!-- *********** NOTATIONS ******************* -->
1914 <!-- ***************************************** -->
1916 <xsl:when test="$name='subst'">
1917 <xsl:apply-templates select="*[3]"/>
1918 <!-- no font for ApplyFunction: <m:mo></m:mo> -->
1919 <m:mo stretchy="false">[</m:mo>
1920 <xsl:apply-templates select="*[4]"/>
1921 <m:mo mathcolor="Green">
1922 <xsl:if test="$id != ''">
1923 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1924 </xsl:if>←</m:mo>
1925 <xsl:apply-templates select="*[2]"/>
1926 <m:mo stretchy="false">]</m:mo>
1929 <xsl:when test="$name='lift'">
1931 <m:mo mathcolor="Green">
1932 <xsl:if test="$id != ''">
1933 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1934 </xsl:if>↑</m:mo>
1935 <xsl:apply-templates select="*[2]"/>
1938 <m:mo stretchy="false">(</m:mo>
1939 <xsl:apply-templates select="*[3]"/>
1940 <m:mo stretchy="false">)</m:mo>
1943 <!-- lift_with_base -->
1944 <xsl:when test="$name='lift_with_base'">
1946 <m:mo mathcolor="Green">
1947 <xsl:if test="$id != ''">
1948 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1949 </xsl:if>↑</m:mo>
1950 <xsl:apply-templates select="*[3]"/>
1951 <xsl:apply-templates select="*[4]"/>
1954 <m:mo stretchy="false">(</m:mo>
1955 <xsl:apply-templates select="*[2]"/>
1956 <m:mo stretchy="false">)</m:mo>
1960 <xsl:when test="$name='beta_red1'">
1961 <xsl:apply-templates select="*[2]"/>
1963 <m:mo mathcolor="Green">
1964 <xsl:if test="$id != ''">
1965 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1966 </xsl:if>→</m:mo>
1967 <m:mi mathcolor="Green">β</m:mi>
1969 <xsl:apply-templates select="*[3]"/>
1972 <xsl:when test="$name='beta_red'">
1973 <xsl:apply-templates select="*[2]"/>
1975 <m:mo mathcolor="Green">
1976 <xsl:if test="$id != ''">
1977 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1978 </xsl:if>→</m:mo>
1979 <m:mi mathcolor="Green">β</m:mi>
1980 <m:mi mathcolor="Green">*</m:mi>
1982 <xsl:apply-templates select="*[3]"/>
1984 <!-- par_beta_red1 -->
1985 <xsl:when test="$name='par_beta_red1'">
1986 <xsl:apply-templates select="*[2]"/>
1988 <m:mo mathcolor="Green">
1989 <xsl:if test="$id != ''">
1990 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
1991 </xsl:if>⇒</m:mo>
1992 <m:mi mathcolor="Green">β</m:mi>
1994 <xsl:apply-templates select="*[3]"/>
1996 <!-- par_beta_red -->
1997 <xsl:when test="$name='par_beta_red'">
1998 <xsl:apply-templates select="*[2]"/>
2000 <m:mo mathcolor="Green">
2001 <xsl:if test="$id != ''">
2002 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2003 </xsl:if>⇒</m:mo>
2004 <m:mi mathcolor="Green">β</m:mi>
2005 <m:mi mathcolor="Green">*</m:mi>
2007 <xsl:apply-templates select="*[3]"/>
2010 <xsl:when test="$name='forgetful'">
2011 <m:mfenced open="|" close="|">
2012 <xsl:if test="$id != ''">
2013 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2015 <xsl:apply-templates select="*[2]"/>
2019 <xsl:when test="$name='isomorphic'">
2020 <xsl:apply-templates select="*[2]"/>
2021 <m:mo mathcolor="Green">
2022 <xsl:if test="$id != ''">
2023 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2024 </xsl:if>≅</m:mo>
2025 <xsl:apply-templates select="*[3]"/>
2028 <xsl:when test="$name='forgetful'">
2029 <m:mfenced open="[" close="]">
2030 <xsl:if test="$id != ''">
2031 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2033 <xsl:apply-templates select="*[2]"/>
2039 <m:mi>ERROR("<xsl:value-of select="$name"/>")</m:mi>
2045 <!-- Il modo Thread non esiste piu'
2046 <xsl:template match="*" mode="thread">
2047 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
2049 <xsl:when test="$name='rw_step'">
2053 <m:mtext>Rewrite</m:mtext>
2054 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2055 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
2056 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2057 <m:mtext>with</m:mtext>
2058 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2059 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
2060 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2061 <m:mtext>by</m:mtext>
2062 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2063 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
2070 <m:mtext mathcolor="Red">we get</m:mtext>
2071 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2072 <xsl:apply-templates select="."/>
2081 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
2088 <m:mtext mathcolor="Red">we get</m:mtext>
2089 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2090 <xsl:apply-templates select="."/>
2096 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
2102 <xsl:template match="m:lambda">
2103 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
2106 <xsl:attribute name="xref">
2107 <xsl:value-of select="@id"/>
2111 <xsl:when test="$charlength >= $framewidth">
2112 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2116 <m:mo mathcolor="Red">λ</m:mo>
2117 <xsl:apply-templates select="m:bvar"/>
2125 <xsl:apply-templates select="*[position()=2]"/>
2132 <m:mo mathcolor="Red">λ</m:mo>
2133 <xsl:apply-templates select="m:bvar/m:ci"/>
2135 <xsl:apply-templates select="m:bvar/m:type"/>
2137 <xsl:apply-templates select="*[position()=2]"/>
2144 <!--**********************-->
2146 <!--**********************-->
2148 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
2149 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
2150 |m:plus|m:minus|m:times" mode="charcount">
2151 <xsl:param name="incurrent_length" select="0"/>
2153 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
2154 <xsl:variable name="siblength">
2155 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
2156 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
2157 </xsl:apply-templates>
2160 <xsl:when test="string($siblength) = """>
2161 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2164 <xsl:value-of select="number($siblength)"/>
2169 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2174 <xsl:template match="m:ci|m:csymbol" mode="charcount">
2175 <xsl:param name="incurrent_length" select="0"/>
2176 <xsl:param name="nosibling" select="0"/>
2178 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
2179 <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>
2181 <xsl:when test="string($siblength) = """>
2182 <xsl:value-of select="$incurrent_length + string-length()"/>
2185 <xsl:value-of select="number($siblength)"/>
2190 <xsl:value-of select="$incurrent_length + string-length()"/>
2195 <xsl:template match="*" mode="charcount">
2196 <xsl:param name="incurrent_length" select="0"/>
2197 <xsl:param name="nosibling" select="0"/>
2199 <xsl:when test="count(child::*) = 0">
2200 <!-- tremendous bug fixed. An empty element can still have siblings!!! -->
2201 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/></xsl:apply-templates></xsl:variable>
2203 <xsl:when test="string($siblength) = """>
2204 <xsl:value-of select="$incurrent_length"/>
2207 <xsl:value-of select="number($siblength)"/>
2212 <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>
2214 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
2215 <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>
2217 <xsl:when test="string($siblength) = """>
2218 <xsl:value-of select="number($childlength)"/>
2221 <xsl:value-of select="number($siblength)"/>
2226 <xsl:value-of select="number($childlength)"/>