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:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
387 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
389 <xsl:if test="@helm:xref">
390 <xsl:attribute name="helm:xref"><xsl:value-of select="@helm:xref"/></xsl:attribute>
393 <xsl:when test="$name='forall'">
395 <xsl:when test="$charlength >= $framewidth">
396 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
399 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
400 <xsl:apply-templates select="m:bvar"/>
407 <xsl:apply-templates select="*[position()=3]"/>
414 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
415 <xsl:apply-templates select="m:bvar/m:ci"/>
417 <xsl:apply-templates select="m:bvar/m:type"/>
419 <xsl:apply-templates select="*[position()=3]"/>
423 <xsl:when test="$name='letin'">
425 <xsl:when test="$charlength >= $framewidth">
426 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
430 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
431 <xsl:apply-templates select="m:bvar"/>
438 <xsl:apply-templates select="*[position()=3]"/>
446 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
447 <xsl:apply-templates select="*[position()=4]"/>
455 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
456 <xsl:apply-templates select="m:bvar/m:ci"/>
458 <xsl:apply-templates select="*[position()=3]"/>
459 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
460 <m:mtext>IN</m:mtext>
461 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
462 <xsl:apply-templates select="*[position()=4]"/>
466 <xsl:when test="$name='prod'">
468 <xsl:when test="$charlength >= $framewidth">
469 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
472 <m:mo mathcolor="Blue">Π</m:mo>
473 <xsl:apply-templates select="m:bvar"/>
480 <xsl:apply-templates select="*[position()=3]"/>
487 <m:mo mathcolor="Blue">Π</m:mo>
488 <xsl:apply-templates select="m:bvar/m:ci"/>
490 <xsl:apply-templates select="m:bvar/m:type"/>
492 <xsl:apply-templates select="*[position()=3]"/>
496 <xsl:when test="$name='arrow'">
498 <xsl:when test="$charlength >= $framewidth">
499 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
503 <m:mo stretchy="false">(</m:mo>
504 <xsl:apply-templates select="*[position()=2]"/>
511 <m:mo mathmathcolor="Blue">→</m:mo>
512 <xsl:apply-templates select="*[position()=3]"/>
519 <m:mo stretchy="false">)</m:mo>
526 <m:mo stretchy="false">(</m:mo>
527 <xsl:apply-templates select="*[position()=2]"/>
528 <m:mo mathcolor="Blue">→</m:mo>
529 <xsl:apply-templates select="*[position()=3]"/>
530 <m:mo stretchy="false">)</m:mo>
534 <xsl:when test="$name='app'">
536 <xsl:when test="$charlength >= $framewidth">
537 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
541 <m:mo stretchy="false">(</m:mo>
542 <xsl:apply-templates select="*[position()=2]"/>
546 <xsl:for-each select="*[position()>2]">
550 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
551 <xsl:apply-templates select="."/>
559 <m:mo stretchy="false">)</m:mo>
566 <m:mo stretchy="false">(</m:mo>
567 <xsl:apply-templates select="*[position()=2]"/>
568 <xsl:for-each select="*[position()>2]">
569 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
570 <xsl:apply-templates select="."/>
572 <m:mo stretchy="false">)</m:mo>
576 <xsl:when test="$name='cast'">
578 <xsl:when test="$charlength >= $framewidth">
579 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
583 <m:mo stretchy="false">(</m:mo>
584 <xsl:apply-templates select="*[position()=2]"/>
591 <m:mo mathcolor="Maroon">:></m:mo>
592 <xsl:apply-templates select="*[position()=3]"/>
599 <m:mo stretchy="false">)</m:mo>
606 <m:mo stretchy="false">(</m:mo>
607 <xsl:apply-templates select="*[position()=2]"/>
608 <m:mo mathcolor="Maroon">:></m:mo>
609 <xsl:apply-templates select="*[position()=3]"/>
610 <m:mo stretchy="false">)</m:mo>
614 <xsl:when test="$name='Prop'">
617 <xsl:when test="$name='Set'">
620 <xsl:when test="$name='Type'">
623 <xsl:when test="$name='mutcase'">
625 <xsl:when test="$charlength >= $framewidth">
626 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
627 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
632 <xsl:apply-templates select="*[position()=2]"/>
633 <xsl:if test="$framewidth > $charlength">
636 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
637 <xsl:apply-templates select="*[position()=3]"/>
642 <xsl:if test="$charlength >= $framewidth">
648 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
649 <xsl:apply-templates select="*[position()=3]"/>
661 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
662 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
667 <xsl:when test="position() = 1">
668 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
671 <m:mo stretchy="false">|</m:mo>
674 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
675 <xsl:apply-templates select="."/>
676 <xsl:if test="$framewidth > $charlength">
677 <m:mo mathcolor="Green">⇒</m:mo>
678 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
683 <xsl:if test="$charlength >= $framewidth">
687 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
688 <m:mo mathcolor="Green">⇒</m:mo>
689 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
705 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
707 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
708 <xsl:apply-templates select="*[position()=3]"/>
709 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
711 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
713 <xsl:when test="position() != 1">
714 <m:mo stretchy="false">|</m:mo>
717 <xsl:apply-templates select="."/>
718 <m:mo mathcolor="Green">⇒</m:mo>
719 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
721 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
726 <xsl:when test="$name='fix'">
728 <xsl:when test="$charlength >= $framewidth">
729 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
734 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
735 <m:mi><xsl:value-of select="m:ci"/></m:mi>
736 <m:mo stretchy="false">{</m:mo>
743 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
744 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
745 <xsl:for-each select="m:bvar">
746 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
750 <m:mi><xsl:value-of select="m:ci"/></m:mi>
752 <xsl:if test="$framewidth > $charlength">
753 <xsl:apply-templates select="m:type"/>
758 <xsl:if test="$charlength >= $framewidth">
762 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
763 <xsl:apply-templates select="m:type"/>
772 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
784 <m:mo stretchy="false">}</m:mo>
792 <m:mi><xsl:value-of select="m:ci"/></m:mi>
793 <m:mo stretchy="false">{</m:mo>
794 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
795 <xsl:for-each select="m:bvar">
799 <m:mi><xsl:value-of select="m:ci"/></m:mi>
801 <xsl:apply-templates select="m:type"/>
803 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
804 <xsl:if test="position()=last()">
805 <m:mo stretchy="false">}</m:mo>
815 <xsl:when test="$name='cofix'">
817 <xsl:when test="$charlength >= $framewidth">
818 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
823 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
824 <m:mi><xsl:value-of select="m:ci"/></m:mi>
825 <m:mo stretchy="false">{</m:mo>
832 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
833 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
834 <xsl:for-each select="m:bvar">
835 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
839 <m:mi><xsl:value-of select="m:ci"/></m:mi>
841 <xsl:if test="$framewidth > $charlength">
842 <xsl:apply-templates select="m:type"/>
847 <xsl:if test="$charlength >= $framewidth">
851 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
852 <xsl:apply-templates select="m:type"/>
861 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
873 <m:mo stretchy="false">}</m:mo>
881 <m:mi><xsl:value-of select="m:ci"/></m:mi>
882 <m:mo stretchy="false">{</m:mo>
883 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
884 <xsl:for-each select="m:bvar">
888 <m:mi><xsl:value-of select="m:ci"/></m:mi>
890 <xsl:apply-templates select="m:type"/>
892 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
893 <xsl:if test="position()=last()">
894 <m:mo stretchy="false">}</m:mo>
904 <!-- ***************************************** -->
905 <!-- *********** PROOF ELEMENTS ************** -->
906 <!-- ***************************************** -->
907 <xsl:when test="$name='proof'">
908 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
912 <xsl:apply-templates select="*[position()=2]"/>
919 <m:mtext mathcolor="Maroon">we proved </m:mtext>
920 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
921 <xsl:apply-templates select="*[position()=3]"/>
927 <xsl:when test="$name='letin'">
928 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
929 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
930 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
934 <xsl:apply-templates select="."/>
942 <xsl:apply-templates select="*[position()=last()]"/>
948 <xsl:when test="$name='let'">
950 <xsl:apply-templates select="m:ci"/>
951 <m:mtext>) </m:mtext>
952 <xsl:apply-templates select="*[3]"/>
954 <xsl:when test="$name='thread'">
955 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
960 <xsl:when test="name(*[last()])='m:apply'">
961 <xsl:apply-templates select="*[last()]"/>
964 <m:mtext>Consider </m:mtext>
965 <xsl:apply-templates select="*[last()]"/>
971 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
974 <xsl:when test="$name='rewrite_and_apply'">
979 <m:mtext>Rewrite</m:mtext>
980 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
981 <xsl:apply-templates select="*[2]/*[2]"/>
982 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
983 <m:mtext>with</m:mtext>
984 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
985 <xsl:apply-templates select="*[2]/*[3]"/>
986 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
987 <m:mtext>by</m:mtext>
988 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
989 <xsl:apply-templates select="*[2]/*[4]"/>
990 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
991 <m:mtext>in</m:mtext>
992 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
993 <xsl:apply-templates select="*[3]"/>
994 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
995 <m:mtext>and apply to</m:mtext>
996 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
997 <xsl:apply-templates select="*[position()>3]"/>
1003 <xsl:when test="$name='and_ind'">
1004 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1009 <xsl:when test="name(*[2])='m:apply'">
1010 <xsl:apply-templates select="*[2]"/>
1013 <m:mtext>Consider </m:mtext>
1014 <xsl:apply-templates select="*[2]"/>
1022 <m:mtext>In particular, we have</m:mtext>
1028 <m:mtext>(</m:mtext>
1029 <xsl:apply-templates select="*[3]"/>
1030 <m:mtext>)</m:mtext>
1031 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1032 <xsl:apply-templates select="*[4]"/>
1039 <m:mtext>(</m:mtext>
1040 <xsl:apply-templates select="*[5]"/>
1041 <m:mtext>)</m:mtext>
1042 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1043 <xsl:apply-templates select="*[6]"/>
1050 <xsl:apply-templates select="*[7]"/>
1056 <xsl:when test="$name='or_ind'">
1057 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1062 <xsl:when test="name(*[2])='m:apply'">
1063 <xsl:apply-templates select="*[2]"/>
1066 <m:mtext>Consider</m:mtext>
1067 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1068 <xsl:apply-templates select="*[2]"/>
1076 <m:mtext>We prove</m:mtext>
1077 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1078 <xsl:apply-templates select="*[3]"/>
1079 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1080 <m:mtext>by cases:</m:mtext>
1086 <m:mtext>*</m:mtext>
1087 <xsl:apply-templates select="*[4]"/>
1094 <m:mtext>*</m:mtext>
1095 <xsl:apply-templates select="*[5]"/>
1108 <xsl:template match="*" mode="thread">
1109 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1111 <xsl:when test="$name='rw_step'">
1115 <m:mtext>Rewrite</m:mtext>
1116 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1117 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1118 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1119 <m:mtext>with</m:mtext>
1120 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1121 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1122 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1123 <m:mtext>by</m:mtext>
1124 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1125 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1132 <m:mtext mathcolor="Maroon">we get</m:mtext>
1133 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1134 <xsl:apply-templates select="."/>
1143 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1150 <m:mtext mathcolor="Maroon">we get</m:mtext>
1151 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1152 <xsl:apply-templates select="."/>
1158 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1164 <xsl:template match="m:lambda">
1165 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1166 <m:mrow helm:xref="{@helm:xref}">
1168 <xsl:when test="$charlength >= $framewidth">
1169 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1172 <m:mo mathcolor="Red">λ</m:mo>
1173 <xsl:apply-templates select="m:bvar"/>
1180 <xsl:apply-templates select="*[position()=2]"/>
1187 <m:mo mathcolor="Red">λ</m:mo>
1188 <xsl:apply-templates select="m:bvar/m:ci"/>
1190 <xsl:apply-templates select="m:bvar/m:type"/>
1192 <xsl:apply-templates select="*[position()=2]"/>
1198 <!-- *********************************** -->
1199 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1200 <!-- *********************************** -->
1204 <xsl:template match = "m:apply[m:eq[1]]">
1205 <xsl:variable name="charlength">
1206 <xsl:apply-templates select="*[1]" mode="charcount"/>
1209 <xsl:when test="$charlength >= $framewidth">
1210 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1211 <xsl:if test="@helm:xref">
1212 <xsl:attribute name="helm:xref">
1213 <xsl:value-of select="@helm:xref"/>
1218 <m:mo stretchy="false">(</m:mo>
1219 <xsl:apply-templates select="*[position()=2]"/>
1222 <xsl:for-each select = "*[position()>2]">
1225 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1226 <m:mo helm:xref="m:in/@helm:xref">
1229 <xsl:apply-templates select="."/>
1235 <m:mo stretchy="false">)</m:mo>
1241 <xsl:apply-imports/>
1247 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1248 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1249 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1250 |m:prsubset|m:setdiff[1]]">
1251 <xsl:variable name="symbol">
1253 <xsl:when test="m:and[1]">
1254 <xsl:value-of select="'wedge'"/>
1256 <xsl:when test="m:or[1]">
1257 <xsl:value-of select="'vee'"/>
1259 <xsl:when test="m:geq[1]">
1260 <xsl:value-of select="'geq'"/>
1262 <xsl:when test="m:leq[1]">
1263 <xsl:value-of select="'leq'"/>
1265 <xsl:when test="m:gt[1]">
1266 <xsl:value-of select="'gt'"/>
1268 <xsl:when test="m:lt[1]">
1269 <xsl:value-of select="'lt'"/>
1271 <xsl:when test="m:eq[1]">
1272 <xsl:value-of select="'Equal'"/>
1274 <xsl:when test="m:in[1]">
1275 <xsl:value-of select="'Element'"/>
1277 <xsl:when test="m:subset[1]">
1278 <xsl:value-of select="'SubsetEqual'"/>
1280 <xsl:when test="m:prsubset[1]">
1281 <xsl:value-of select="'subset'"/>
1283 <xsl:when test="m:intersect[1]">
1284 <xsl:value-of select="'Intersection'"/>
1286 <xsl:when test="m:union[1]">
1287 <xsl:value-of select="'Union'"/>
1289 <xsl:when test="m:setdiff[1]">
1290 <xsl:value-of select="'Backslash'"/>
1294 <xsl:variable name="charlength">
1295 <xsl:apply-templates select="*[1]" mode="charcount"/>
1298 <xsl:when test="$charlength >= $framewidth">
1299 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1300 <xsl:if test="@helm:xref">
1301 <xsl:attribute name="helm:xref">
1302 <xsl:value-of select="@helm:xref"/>
1307 <m:mo stretchy="false">(</m:mo>
1308 <xsl:apply-templates select="*[position()=2]"/>
1311 <xsl:for-each select = "*[position()>2]">
1314 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1315 <m:mo helm:xref="{*[1]/@helm:xref}">
1316 <m:mchar name="{$symbol}"/>
1318 <xsl:apply-templates select="."/>
1324 <m:mo stretchy="false">)</m:mo>
1330 <xsl:apply-imports/>
1335 <xsl:template match = "m:set">
1337 <xsl:when test="count(child::*) = 0">
1339 <m:mchar name="emptyset"/>
1343 <xsl:variable name="charlength">
1344 <xsl:apply-templates select="*[1]" mode="charcount"/>
1347 <xsl:when test="$charlength >= $framewidth">
1349 <xsl:when test="name(*[1]) = 'm:bvar'">
1350 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1353 <m:mo stretchy="false">{</m:mo>
1354 <xsl:apply-templates select="*[position()=1]"/>
1359 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1360 <m:mo stretchy="false">|</m:mo>
1361 <xsl:apply-templates select="m:condition/*[1]"/>
1366 <m:mo stretchy="false">}</m:mo>
1372 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1375 <m:mo stretchy="false">{</m:mo>
1376 <xsl:apply-templates select="*[position()=1]"/>
1377 <xsl:if test="position() != last()">
1382 <xsl:for-each select = "*[position()>2]">
1385 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1386 <xsl:apply-templates select="."/>
1387 <xsl:if test="position() != last()">
1395 <m:mo stretchy="false">}</m:mo>
1403 <xsl:apply-imports/>
1410 <xsl:template match = "m:apply[m:card[1]]">
1411 <m:mo stretchy="false">|</m:mo>
1412 <xsl:apply-templates select="*[2]"/>
1413 <m:mo stretchy="false">|</m:mo>
1416 <!-- *********************************** -->
1417 <!-- PROOF ELEMENTS -->
1418 <!-- *********************************** -->
1422 <!--**********************-->
1424 <!--**********************-->
1426 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1427 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1428 |m:plus|m:minus|m:times" mode="charcount">
1429 <xsl:param name="incurrent_length" select="0"/>
1431 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1432 <xsl:variable name="siblength">
1433 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1434 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1435 </xsl:apply-templates>
1438 <xsl:when test="string($siblength) = """>
1439 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1442 <xsl:value-of select="number($siblength)"/>
1447 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1452 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1453 <xsl:param name="incurrent_length" select="0"/>
1454 <xsl:param name="nosibling" select="0"/>
1456 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1457 <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>
1459 <xsl:when test="string($siblength) = """>
1460 <xsl:value-of select="$incurrent_length + string-length()"/>
1463 <xsl:value-of select="number($siblength)"/>
1468 <xsl:value-of select="$incurrent_length + string-length()"/>
1473 <xsl:template match="*" mode="charcount">
1474 <xsl:param name="incurrent_length" select="0"/>
1475 <xsl:param name="nosibling" select="0"/>
1477 <xsl:when test="count(child::*) = 0">
1478 <xsl:value-of select="$incurrent_length"/>
1481 <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>
1483 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1484 <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>
1486 <xsl:when test="string($siblength) = """>
1487 <xsl:value-of select="number($childlength)"/>
1490 <xsl:value-of select="number($siblength)"/>
1495 <xsl:value-of select="number($childlength)"/>