3 <!-- Copyright (C) 2000, HELM Team -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic -->
6 <!-- Library of Mathematics, developed at the Computer Science -->
7 <!-- Department, University of Bologna, Italy. -->
9 <!-- HELM is free software; you can redistribute it and/or -->
10 <!-- modify it under the terms of the GNU General Public License -->
11 <!-- as published by the Free Software Foundation; either version 2 -->
12 <!-- of the License, or (at your option) any later version. -->
14 <!-- HELM is distributed in the hope that it will be useful, -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
17 <!-- GNU General Public License for more details. -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
22 <!-- MA 02111-1307, USA. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <!--***********************************************************************-->
28 <!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
29 <!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
30 <!-- Revised: March 3 2000, Irene Schena -->
31 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
32 <!-- Revised: March 21 2000, Irene Schena -->
33 <!--***********************************************************************-->
35 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
36 xmlns:m="http://www.w3.org/1998/Math/MathML"
37 xmlns:helm="http://www.cs.unibo.it/helm">
39 <xsl:import href="mml2mmlv1_0.xsl"/>
41 <!--***********************************************************************-->
42 <!-- Parameter affecting line-breaking -->
43 <!--***********************************************************************-->
45 <xsl:variable name="framewidth" select="35"/>
47 <!--***********************************************************************-->
48 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
49 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
50 <!-- sono i termini: la presentation per un termine e' generata come primo -->
51 <!-- figlio di un semantics e l'originario content viene inserito nel -->
52 <!-- nel secondo figlio di semantics, annotation-xml -->
53 <!--***********************************************************************-->
55 <!--**********************-->
57 <!--**********************-->
59 <xsl:template match="/">
60 <xsl:processing-instruction name="cocoon-format">type="text/xhtml"</xsl:processing-instruction>
61 <xsl:apply-templates select="*"/>
66 <xsl:template match="Definition">
68 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
72 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
79 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
80 <xsl:apply-templates select="type/*[1]"/>
94 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
95 <xsl:apply-templates select="body/*[1]"/>
105 <xsl:template match="Axiom">
107 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
111 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
118 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
119 <xsl:apply-templates select="type/*[1]"/>
127 <!-- UNFINISHED PROOF -->
129 <xsl:template match="CurrentProof">
131 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
135 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
142 <m:mtext>THESIS:</m:mtext>
149 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
150 <xsl:apply-templates select="type/*[1]"/>
157 <m:mtext>CONJECTURES:</m:mtext>
161 <xsl:for-each select="Conjecture">
165 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
166 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
167 <xsl:apply-templates select="./*[1]"/>
175 <m:mtext>CORRESPONDING PROOF:</m:mtext>
182 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
183 <xsl:apply-templates select="body/*[1]"/>
191 <!-- MUTUAL INDUCTIVE DEFINITION -->
193 <xsl:template match="InductiveDefinition">
195 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
196 <xsl:for-each select="InductiveType">
201 <xsl:when test="position() = 1">
203 <xsl:when test="string(./@inductive) = "true"">
204 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
207 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
212 <m:mtext>AND</m:mtext>
215 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
216 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
223 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
226 <xsl:when test="string(../Param) != """>
227 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
228 <xsl:for-each select="../Param">
232 <m:mi><xsl:value-of select="./@name"/></m:mi>
234 <xsl:apply-templates select="*"/>
258 <m:mtext>OF ARITY</m:mtext>
265 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
266 <xsl:apply-templates select="./arity/*[1]"/>
273 <m:mtext>BUILT FROM</m:mtext>
277 <xsl:for-each select="./Constructor">
282 <xsl:when test="position() = 1">
283 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
287 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
290 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
291 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
292 <xsl:apply-templates select="./*[1]"/>
304 <xsl:template match="Variable">
306 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
310 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
317 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
318 <xsl:apply-templates select="type/*[1]"/>
322 <xsl:if test="name(*[1])='body'">
326 <m:mtext>AS</m:mtext>
333 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
334 <xsl:apply-templates select="body/*[1]"/>
343 <!--**********************-->
345 <!--**********************-->
347 <xsl:template match="m:bvar">
349 <xsl:when test="m:type">
350 <xsl:variable name="charlength">
351 <xsl:apply-templates select="m:ci" mode="charcount"/>
354 <xsl:when test="$charlength >= $framewidth">
355 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
358 <xsl:apply-templates select="m:ci"/>
364 <xsl:apply-templates select="m:type"/>
370 <xsl:apply-templates select="m:ci"/>
372 <xsl:apply-templates select="m:type"/>
377 <xsl:apply-templates select="m:ci"/>
385 <xsl:template match="m:apply[m:csymbol]">
386 <xsl:param name="nopar" select="0"/>
387 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
388 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
390 <xsl:if test="@helm:xref">
391 <xsl:attribute name="helm:xref"><xsl:value-of select="@helm:xref"/></xsl:attribute>
394 <xsl:when test="$name='forall'">
396 <xsl:when test="$charlength >= $framewidth">
397 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
400 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
401 <xsl:apply-templates select="m:bvar"/>
408 <xsl:apply-templates select="*[position()=3]"/>
415 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
416 <xsl:apply-templates select="m:bvar/m:ci"/>
418 <xsl:apply-templates select="m:bvar/m:type"/>
420 <xsl:apply-templates select="*[position()=3]"/>
424 <xsl:when test="$name='let_in'">
426 <xsl:when test="$charlength >= $framewidth">
427 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
431 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
432 <xsl:apply-templates select="m:bvar"/>
439 <xsl:apply-templates select="*[position()=3]"/>
447 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
448 <xsl:apply-templates select="*[position()=4]"/>
456 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
457 <xsl:apply-templates select="m:bvar/m:ci"/>
459 <xsl:apply-templates select="*[position()=3]"/>
460 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
461 <m:mtext>IN</m:mtext>
462 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
463 <xsl:apply-templates select="*[position()=4]"/>
467 <xsl:when test="$name='prod'">
469 <xsl:when test="$charlength >= $framewidth">
470 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
473 <m:mo mathcolor="Blue">Π</m:mo>
474 <xsl:apply-templates select="m:bvar"/>
481 <xsl:apply-templates select="*[position()=3]"/>
488 <m:mo mathcolor="Blue">Π</m:mo>
489 <xsl:apply-templates select="m:bvar/m:ci"/>
491 <xsl:apply-templates select="m:bvar/m:type"/>
493 <xsl:apply-templates select="*[position()=3]"/>
497 <xsl:when test="$name='arrow'">
499 <xsl:when test="$charlength >= $framewidth">
500 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
504 <xsl:if test="$nopar=0">
505 <m:mo stretchy="false">(</m:mo>
507 <xsl:apply-templates select="*[position()=2]"/>
514 <m:mo mathmathcolor="Blue">→</m:mo>
516 <xsl:when test="*[position()=3]/m:csymbol">
517 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
519 <xsl:when test="$nextp='arrow'">
520 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
523 <xsl:apply-templates select="*[position()=3]"/>
528 <xsl:apply-templates select="*[position()=3]"/>
534 <xsl:if test="$nopar=0">
538 <m:mo stretchy="false">)</m:mo>
546 <xsl:if test="$nopar=0">
547 <m:mo stretchy="false">(</m:mo>
549 <xsl:apply-templates select="*[position()=2]"/>
550 <m:mo mathcolor="Blue">→</m:mo>
552 <xsl:when test="*[position()=3]/m:csymbol">
553 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
555 <xsl:when test="$nextp='arrow'">
556 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
559 <xsl:apply-templates select="*[position()=3]"/>
564 <xsl:apply-templates select="*[position()=3]"/>
567 <xsl:if test="$nopar=0">
568 <m:mo stretchy="false">)</m:mo>
573 <xsl:when test="$name='app'">
575 <xsl:when test="$charlength >= $framewidth">
576 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
580 <m:mo stretchy="false">(</m:mo>
581 <xsl:apply-templates select="*[position()=2]"/>
585 <xsl:for-each select="*[position()>2]">
589 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
590 <xsl:apply-templates select="."/>
598 <m:mo stretchy="false">)</m:mo>
605 <m:mo stretchy="false">(</m:mo>
606 <xsl:apply-templates select="*[position()=2]"/>
607 <xsl:for-each select="*[position()>2]">
608 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
609 <xsl:apply-templates select="."/>
611 <m:mo stretchy="false">)</m:mo>
615 <xsl:when test="$name='cast'">
617 <xsl:when test="$charlength >= $framewidth">
618 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
622 <m:mo stretchy="false">(</m:mo>
623 <xsl:apply-templates select="*[position()=2]"/>
630 <m:mo mathcolor="Maroon">:></m:mo>
631 <xsl:apply-templates select="*[position()=3]"/>
638 <m:mo stretchy="false">)</m:mo>
645 <m:mo stretchy="false">(</m:mo>
646 <xsl:apply-templates select="*[position()=2]"/>
647 <m:mo mathcolor="Maroon">:></m:mo>
648 <xsl:apply-templates select="*[position()=3]"/>
649 <m:mo stretchy="false">)</m:mo>
653 <xsl:when test="$name='Prop'">
656 <xsl:when test="$name='Set'">
659 <xsl:when test="$name='Type'">
662 <xsl:when test="$name='mutcase'">
664 <xsl:when test="$charlength >= $framewidth">
665 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
666 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
671 <xsl:apply-templates select="*[position()=2]"/>
672 <xsl:if test="$framewidth > $charlength">
675 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
676 <xsl:apply-templates select="*[position()=3]"/>
681 <xsl:if test="$charlength >= $framewidth">
687 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
688 <xsl:apply-templates select="*[position()=3]"/>
700 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
701 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
706 <xsl:when test="position() = 1">
707 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
710 <m:mo stretchy="false">|</m:mo>
713 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
714 <xsl:apply-templates select="."/>
715 <xsl:if test="$framewidth > $charlength">
716 <m:mo mathcolor="Green">⇒</m:mo>
717 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
722 <xsl:if test="$charlength >= $framewidth">
726 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
727 <m:mo mathcolor="Green">⇒</m:mo>
728 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
744 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
746 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
747 <xsl:apply-templates select="*[position()=3]"/>
748 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
750 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
752 <xsl:when test="position() != 1">
753 <m:mo stretchy="false">|</m:mo>
756 <xsl:apply-templates select="."/>
757 <m:mo mathcolor="Green">⇒</m:mo>
758 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
760 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
765 <xsl:when test="$name='fix'">
767 <xsl:when test="$charlength >= $framewidth">
768 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
773 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
774 <m:mi><xsl:value-of select="m:ci"/></m:mi>
775 <m:mo stretchy="false">{</m:mo>
782 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
783 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
784 <xsl:for-each select="m:bvar">
785 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
789 <m:mi><xsl:value-of select="m:ci"/></m:mi>
791 <xsl:if test="$framewidth > $charlength">
792 <xsl:apply-templates select="m:type"/>
797 <xsl:if test="$charlength >= $framewidth">
801 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
802 <xsl:apply-templates select="m:type"/>
811 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
823 <m:mo stretchy="false">}</m:mo>
831 <m:mi><xsl:value-of select="m:ci"/></m:mi>
832 <m:mo stretchy="false">{</m:mo>
833 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
834 <xsl:for-each select="m:bvar">
838 <m:mi><xsl:value-of select="m:ci"/></m:mi>
840 <xsl:apply-templates select="m:type"/>
842 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
843 <xsl:if test="position()=last()">
844 <m:mo stretchy="false">}</m:mo>
854 <xsl:when test="$name='cofix'">
856 <xsl:when test="$charlength >= $framewidth">
857 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
862 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
863 <m:mi><xsl:value-of select="m:ci"/></m:mi>
864 <m:mo stretchy="false">{</m:mo>
871 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
872 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
873 <xsl:for-each select="m:bvar">
874 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
878 <m:mi><xsl:value-of select="m:ci"/></m:mi>
880 <xsl:if test="$framewidth > $charlength">
881 <xsl:apply-templates select="m:type"/>
886 <xsl:if test="$charlength >= $framewidth">
890 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
891 <xsl:apply-templates select="m:type"/>
900 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
912 <m:mo stretchy="false">}</m:mo>
920 <m:mi><xsl:value-of select="m:ci"/></m:mi>
921 <m:mo stretchy="false">{</m:mo>
922 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
923 <xsl:for-each select="m:bvar">
927 <m:mi><xsl:value-of select="m:ci"/></m:mi>
929 <xsl:apply-templates select="m:type"/>
931 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
932 <xsl:if test="position()=last()">
933 <m:mo stretchy="false">}</m:mo>
943 <!-- ***************************************** -->
944 <!-- *********** PROOF ELEMENTS ************** -->
945 <!-- ***************************************** -->
946 <xsl:when test="$name='proof'">
947 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
951 <xsl:apply-templates select="*[position()=2]"/>
958 <m:mtext mathcolor="Maroon">we proved </m:mtext>
959 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
960 <xsl:apply-templates select="*[position()=3]"/>
966 <xsl:when test="$name='letin1'">
967 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
971 <xsl:apply-templates select="*[2]"/>
978 <xsl:apply-templates select="*[3]"/>
984 <xsl:when test="$name='letin'">
985 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
986 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
987 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
991 <xsl:apply-templates select="."/>
999 <xsl:apply-templates select="*[position()=last()]"/>
1005 <xsl:when test="$name='let'">
1006 <m:mtext>(</m:mtext>
1007 <xsl:apply-templates select="m:ci"/>
1008 <m:mtext>) </m:mtext>
1009 <xsl:apply-templates select="*[3]"/>
1011 <xsl:when test="$name='rw_step'">
1012 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1017 <xsl:when test="name(*[2])='m:apply'">
1018 <xsl:apply-templates select="*[2]"/>
1021 <m:mtext>Consider</m:mtext>
1022 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1023 <xsl:apply-templates select="*[2]"/>
1032 <m:mtext>Rewrite</m:mtext>
1033 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1034 <xsl:apply-templates select="*[3]"/>
1035 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1036 <m:mtext>with</m:mtext>
1037 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1038 <xsl:apply-templates select="*[4]"/>
1039 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1040 <m:mtext>by</m:mtext>
1041 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1042 <xsl:apply-templates select="*[5]"/>
1048 <!-- not existing any more
1049 <xsl:when test="$name='thread'">
1050 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1055 <xsl:when test="name(*[last()])='m:apply'">
1056 <xsl:apply-templates select="*[last()]"/>
1059 <m:mtext>Consider</m:mtext>
1060 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1061 <xsl:apply-templates select="*[last()]"/>
1067 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1071 <xsl:when test="$name='rewrite_and_apply'">
1072 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1076 <xsl:apply-templates select="*[2]"/>
1083 <m:mtext>Then apply it to</m:mtext>
1084 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1085 <xsl:apply-templates select="*[position()>2]"/>
1092 <xsl:when test="$name='nat_ind'">
1093 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1096 <m:mtext>By induction</m:mtext>
1102 <m:mtext>base case:</m:mtext>
1103 <xsl:apply-templates select="*[2]"/>
1110 <m:mtext>inductive case:</m:mtext>
1111 <xsl:apply-templates select="*[3]"/>
1118 <xsl:when test="$name='and_ind'">
1119 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1124 <xsl:when test="name(*[2])='m:apply'">
1125 <xsl:apply-templates select="*[2]"/>
1128 <m:mtext>Consider</m:mtext>
1129 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1130 <xsl:apply-templates select="*[2]"/>
1138 <m:mtext>In particular, we have</m:mtext>
1144 <m:mtext>(</m:mtext>
1145 <xsl:apply-templates select="*[3]"/>
1146 <m:mtext>)</m:mtext>
1147 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1148 <xsl:apply-templates select="*[4]"/>
1155 <m:mtext>(</m:mtext>
1156 <xsl:apply-templates select="*[5]"/>
1157 <m:mtext>)</m:mtext>
1158 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1159 <xsl:apply-templates select="*[6]"/>
1166 <xsl:apply-templates select="*[7]"/>
1172 <xsl:when test="$name='or_ind'">
1173 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1178 <xsl:when test="name(*[2])='m:apply'">
1179 <xsl:apply-templates select="*[2]"/>
1182 <m:mtext>Consider</m:mtext>
1183 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1184 <xsl:apply-templates select="*[2]"/>
1192 <m:mtext>We prove</m:mtext>
1193 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1194 <xsl:apply-templates select="*[3]"/>
1195 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1196 <m:mtext>by cases:</m:mtext>
1202 <m:mtext>*</m:mtext>
1203 <xsl:apply-templates select="*[4]"/>
1210 <m:mtext>*</m:mtext>
1211 <xsl:apply-templates select="*[5]"/>
1217 <xsl:when test="$name='ex_ind'">
1218 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1223 <xsl:when test="name(*[2])='m:apply'">
1224 <xsl:apply-templates select="*[2]"/>
1227 <m:mtext>Consider</m:mtext>
1228 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1229 <xsl:apply-templates select="*[2]"/>
1237 <m:mtext>Let</m:mtext>
1238 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1239 <xsl:apply-templates select="*[3]"/>
1240 <m:mtext>:</m:mtext>
1241 <xsl:apply-templates select="*[4]"/>
1242 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1243 <m:mtext>such that</m:mtext>
1244 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1245 <m:mtext>(</m:mtext>
1246 <xsl:apply-templates select="*[5]"/>
1247 <m:mtext>)</m:mtext>
1248 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1249 <xsl:apply-templates select="*[6]"/>
1255 <xsl:apply-templates select="*[7]"/>
1268 <!-- Il modo Thread non esiste piu'
1269 <xsl:template match="*" mode="thread">
1270 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1272 <xsl:when test="$name='rw_step'">
1276 <m:mtext>Rewrite</m:mtext>
1277 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1278 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1279 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1280 <m:mtext>with</m:mtext>
1281 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1282 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1283 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1284 <m:mtext>by</m:mtext>
1285 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1286 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1293 <m:mtext mathcolor="Maroon">we get</m:mtext>
1294 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1295 <xsl:apply-templates select="."/>
1304 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1311 <m:mtext mathcolor="Maroon">we get</m:mtext>
1312 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1313 <xsl:apply-templates select="."/>
1319 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1325 <xsl:template match="m:lambda">
1326 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1327 <m:mrow helm:xref="{@helm:xref}">
1329 <xsl:when test="$charlength >= $framewidth">
1330 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1333 <m:mo mathcolor="Red">λ</m:mo>
1334 <xsl:apply-templates select="m:bvar"/>
1341 <xsl:apply-templates select="*[position()=2]"/>
1348 <m:mo mathcolor="Red">λ</m:mo>
1349 <xsl:apply-templates select="m:bvar/m:ci"/>
1351 <xsl:apply-templates select="m:bvar/m:type"/>
1353 <xsl:apply-templates select="*[position()=2]"/>
1359 <!-- *********************************** -->
1360 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1361 <!-- *********************************** -->
1365 <xsl:template match = "m:apply[m:eq[1]]">
1366 <xsl:variable name="charlength">
1367 <xsl:apply-templates select="*[1]" mode="charcount"/>
1370 <xsl:when test="$charlength >= $framewidth">
1371 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1372 <xsl:if test="@helm:xref">
1373 <xsl:attribute name="helm:xref">
1374 <xsl:value-of select="@helm:xref"/>
1379 <m:mo stretchy="false">(</m:mo>
1380 <xsl:apply-templates select="*[position()=2]"/>
1383 <xsl:for-each select = "*[position()>2]">
1386 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1387 <m:mo helm:xref="{m:in/@helm:xref}">=</m:mo>
1388 <xsl:apply-templates select="."/>
1394 <m:mo stretchy="false">)</m:mo>
1400 <xsl:apply-imports/>
1406 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1407 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1408 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1409 |m:prsubset|m:setdiff[1]]">
1410 <xsl:variable name="symbol">
1412 <xsl:when test="m:and[1]">
1413 <xsl:value-of select="'wedge'"/>
1415 <xsl:when test="m:or[1]">
1416 <xsl:value-of select="'vee'"/>
1418 <xsl:when test="m:geq[1]">
1419 <xsl:value-of select="'geq'"/>
1421 <xsl:when test="m:leq[1]">
1422 <xsl:value-of select="'leq'"/>
1424 <xsl:when test="m:gt[1]">
1425 <xsl:value-of select="'gt'"/>
1427 <xsl:when test="m:lt[1]">
1428 <xsl:value-of select="'lt'"/>
1430 <xsl:when test="m:eq[1]">
1431 <xsl:value-of select="'Equal'"/>
1433 <xsl:when test="m:in[1]">
1434 <xsl:value-of select="'Element'"/>
1436 <xsl:when test="m:subset[1]">
1437 <xsl:value-of select="'SubsetEqual'"/>
1439 <xsl:when test="m:prsubset[1]">
1440 <xsl:value-of select="'subset'"/>
1442 <xsl:when test="m:intersect[1]">
1443 <xsl:value-of select="'Intersection'"/>
1445 <xsl:when test="m:union[1]">
1446 <xsl:value-of select="'Union'"/>
1448 <xsl:when test="m:setdiff[1]">
1449 <xsl:value-of select="'Backslash'"/>
1453 <xsl:variable name="charlength">
1454 <xsl:apply-templates select="*[1]" mode="charcount"/>
1457 <xsl:when test="$charlength >= $framewidth">
1458 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1459 <xsl:if test="@helm:xref">
1460 <xsl:attribute name="helm:xref">
1461 <xsl:value-of select="@helm:xref"/>
1466 <m:mo stretchy="false">(</m:mo>
1467 <xsl:apply-templates select="*[position()=2]"/>
1470 <xsl:for-each select = "*[position()>2]">
1473 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1474 <m:mo helm:xref="{*[1]/@helm:xref}">
1475 <m:mchar name="{$symbol}"/>
1477 <xsl:apply-templates select="."/>
1483 <m:mo stretchy="false">)</m:mo>
1489 <xsl:apply-imports/>
1494 <xsl:template match = "m:set">
1496 <xsl:when test="count(child::*) = 0">
1498 <m:mchar name="emptyset"/>
1502 <xsl:variable name="charlength">
1503 <xsl:apply-templates select="*[1]" mode="charcount"/>
1506 <xsl:when test="$charlength >= $framewidth">
1508 <xsl:when test="name(*[1]) = 'm:bvar'">
1509 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1512 <m:mo stretchy="false">{</m:mo>
1513 <xsl:apply-templates select="*[position()=1]"/>
1518 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1519 <m:mo stretchy="false">|</m:mo>
1520 <xsl:apply-templates select="m:condition/*[1]"/>
1525 <m:mo stretchy="false">}</m:mo>
1531 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1534 <m:mo stretchy="false">{</m:mo>
1535 <xsl:apply-templates select="*[position()=1]"/>
1536 <xsl:if test="position() != last()">
1541 <xsl:for-each select = "*[position()>2]">
1544 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1545 <xsl:apply-templates select="."/>
1546 <xsl:if test="position() != last()">
1554 <m:mo stretchy="false">}</m:mo>
1562 <xsl:apply-imports/>
1569 <xsl:template match = "m:apply[m:card[1]]">
1570 <m:mo stretchy="false">|</m:mo>
1571 <xsl:apply-templates select="*[2]"/>
1572 <m:mo stretchy="false">|</m:mo>
1575 <!-- *********************************** -->
1576 <!-- PROOF ELEMENTS -->
1577 <!-- *********************************** -->
1581 <!--**********************-->
1583 <!--**********************-->
1585 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1586 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1587 |m:plus|m:minus|m:times" mode="charcount">
1588 <xsl:param name="incurrent_length" select="0"/>
1590 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1591 <xsl:variable name="siblength">
1592 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1593 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1594 </xsl:apply-templates>
1597 <xsl:when test="string($siblength) = """>
1598 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1601 <xsl:value-of select="number($siblength)"/>
1606 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1611 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1612 <xsl:param name="incurrent_length" select="0"/>
1613 <xsl:param name="nosibling" select="0"/>
1615 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1616 <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>
1618 <xsl:when test="string($siblength) = """>
1619 <xsl:value-of select="$incurrent_length + string-length()"/>
1622 <xsl:value-of select="number($siblength)"/>
1627 <xsl:value-of select="$incurrent_length + string-length()"/>
1632 <xsl:template match="*" mode="charcount">
1633 <xsl:param name="incurrent_length" select="0"/>
1634 <xsl:param name="nosibling" select="0"/>
1636 <xsl:when test="count(child::*) = 0">
1637 <xsl:value-of select="$incurrent_length"/>
1640 <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>
1642 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1643 <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>
1645 <xsl:when test="string($siblength) = """>
1646 <xsl:value-of select="number($childlength)"/>
1649 <xsl:value-of select="number($siblength)"/>
1654 <xsl:value-of select="number($childlength)"/>