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"/>
40 <xsl:import href="mmltheoryextension.xsl"/>
42 <!--***********************************************************************-->
43 <!-- Parameter affecting line-breaking -->
44 <!--***********************************************************************-->
46 <xsl:variable name="framewidth" select="35"/>
48 <!--***********************************************************************-->
49 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
50 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
51 <!-- sono i termini: la presentation per un termine e' generata come primo -->
52 <!-- figlio di un semantics e l'originario content viene inserito nel -->
53 <!-- nel secondo figlio di semantics, annotation-xml -->
54 <!--***********************************************************************-->
56 <!--**********************-->
58 <!--**********************-->
60 <xsl:template match="/">
62 <xsl:processing-instruction name="cocoon-format">type="text/xhtml"</xsl:processing-instruction>
64 <xsl:apply-templates select="*"/>
69 <xsl:template match="Definition">
71 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
75 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
82 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
83 <xsl:apply-templates select="type/*[1]"/>
97 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
98 <xsl:apply-templates select="body/*[1]"/>
108 <xsl:template match="Axiom">
110 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
114 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
121 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
122 <xsl:apply-templates select="type/*[1]"/>
130 <!-- UNFINISHED PROOF -->
132 <xsl:template match="CurrentProof">
134 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
138 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
145 <m:mtext>THESIS:</m:mtext>
152 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
153 <xsl:apply-templates select="type/*[1]"/>
160 <m:mtext>CONJECTURES:</m:mtext>
164 <xsl:for-each select="Conjecture">
168 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
169 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
170 <xsl:apply-templates select="./*[1]"/>
178 <m:mtext>CORRESPONDING PROOF:</m:mtext>
185 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
186 <xsl:apply-templates select="body/*[1]"/>
194 <!-- MUTUAL INDUCTIVE DEFINITION -->
196 <xsl:template match="InductiveDefinition">
198 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
199 <xsl:for-each select="InductiveType">
204 <xsl:when test="position() = 1">
206 <xsl:when test="string(./@inductive) = "true"">
207 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
210 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
215 <m:mtext>AND</m:mtext>
218 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
219 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
226 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
229 <xsl:when test="string(../Param) != """>
230 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
231 <xsl:for-each select="../Param">
235 <m:mi><xsl:value-of select="./@name"/></m:mi>
237 <xsl:apply-templates select="*"/>
261 <m:mtext>OF ARITY</m:mtext>
268 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
269 <xsl:apply-templates select="./arity/*[1]"/>
276 <m:mtext>BUILT FROM</m:mtext>
280 <xsl:for-each select="./Constructor">
285 <xsl:when test="position() = 1">
286 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
290 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
293 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
294 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
295 <xsl:apply-templates select="./*[1]"/>
307 <xsl:template match="Variable">
309 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
313 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
320 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
321 <xsl:apply-templates select="type/*[1]"/>
325 <xsl:if test="name(*[1])='body'">
329 <m:mtext>AS</m:mtext>
336 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
337 <xsl:apply-templates select="body/*[1]"/>
346 <!--**********************-->
348 <!--**********************-->
350 <xsl:template match="m:bvar">
352 <xsl:when test="m:type">
353 <xsl:variable name="charlength">
354 <xsl:apply-templates select="m:ci" mode="charcount"/>
357 <xsl:when test="$charlength >= $framewidth">
358 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
361 <xsl:apply-templates select="m:ci"/>
367 <xsl:apply-templates select="m:type"/>
373 <xsl:apply-templates select="m:ci"/>
375 <xsl:apply-templates select="m:type"/>
380 <xsl:apply-templates select="m:ci"/>
388 <xsl:template match="m:apply[m:csymbol]">
389 <xsl:param name="nopar" select="0"/>
390 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
391 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
393 <xsl:if test="@helm:xref">
394 <xsl:attribute name="helm:xref"><xsl:value-of select="@helm:xref"/></xsl:attribute>
397 <xsl:when test="$name='forall'">
399 <xsl:when test="$charlength >= $framewidth">
400 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
403 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
404 <xsl:apply-templates select="m:bvar"/>
411 <xsl:apply-templates select="*[position()=3]"/>
418 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
419 <xsl:apply-templates select="m:bvar/m:ci"/>
421 <xsl:apply-templates select="m:bvar/m:type"/>
423 <xsl:apply-templates select="*[position()=3]"/>
427 <xsl:when test="$name='let_in'">
429 <xsl:when test="$charlength >= $framewidth">
430 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
434 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
435 <xsl:apply-templates select="m:bvar"/>
442 <xsl:apply-templates select="*[position()=3]"/>
450 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
451 <xsl:apply-templates select="*[position()=4]"/>
459 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
460 <xsl:apply-templates select="m:bvar/m:ci"/>
462 <xsl:apply-templates select="*[position()=3]"/>
463 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
464 <m:mtext>IN</m:mtext>
465 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
466 <xsl:apply-templates select="*[position()=4]"/>
470 <xsl:when test="$name='prod'">
472 <xsl:when test="$charlength >= $framewidth">
473 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
476 <m:mo mathcolor="Blue">Π</m:mo>
477 <xsl:apply-templates select="m:bvar"/>
484 <xsl:apply-templates select="*[position()=3]"/>
491 <m:mo mathcolor="Blue">Π</m:mo>
492 <xsl:apply-templates select="m:bvar/m:ci"/>
494 <xsl:apply-templates select="m:bvar/m:type"/>
496 <xsl:apply-templates select="*[position()=3]"/>
500 <xsl:when test="$name='arrow'">
502 <xsl:when test="$charlength >= $framewidth">
503 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
507 <xsl:if test="$nopar=0">
508 <m:mo stretchy="false">(</m:mo>
510 <xsl:apply-templates select="*[position()=2]"/>
517 <m:mo mathmathcolor="Blue">→</m:mo>
519 <xsl:when test="*[position()=3]/m:csymbol">
520 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
522 <xsl:when test="$nextp='arrow'">
523 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
526 <xsl:apply-templates select="*[position()=3]"/>
531 <xsl:apply-templates select="*[position()=3]"/>
537 <xsl:if test="$nopar=0">
541 <m:mo stretchy="false">)</m:mo>
549 <xsl:if test="$nopar=0">
550 <m:mo stretchy="false">(</m:mo>
552 <xsl:apply-templates select="*[position()=2]"/>
553 <m:mo mathcolor="Blue">→</m:mo>
555 <xsl:when test="*[position()=3]/m:csymbol">
556 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
558 <xsl:when test="$nextp='arrow'">
559 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
562 <xsl:apply-templates select="*[position()=3]"/>
567 <xsl:apply-templates select="*[position()=3]"/>
570 <xsl:if test="$nopar=0">
571 <m:mo stretchy="false">)</m:mo>
576 <xsl:when test="$name='app'">
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]"/>
588 <xsl:for-each select="*[position()>2]">
592 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
593 <xsl:apply-templates select="."/>
601 <m:mo stretchy="false">)</m:mo>
608 <m:mo stretchy="false">(</m:mo>
609 <xsl:apply-templates select="*[position()=2]"/>
610 <xsl:for-each select="*[position()>2]">
611 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
612 <xsl:apply-templates select="."/>
614 <m:mo stretchy="false">)</m:mo>
618 <xsl:when test="$name='cast'">
620 <xsl:when test="$charlength >= $framewidth">
621 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
625 <m:mo stretchy="false">(</m:mo>
626 <xsl:apply-templates select="*[position()=2]"/>
633 <m:mo mathcolor="Maroon">:></m:mo>
634 <xsl:apply-templates select="*[position()=3]"/>
641 <m:mo stretchy="false">)</m:mo>
648 <m:mo stretchy="false">(</m:mo>
649 <xsl:apply-templates select="*[position()=2]"/>
650 <m:mo mathcolor="Maroon">:></m:mo>
651 <xsl:apply-templates select="*[position()=3]"/>
652 <m:mo stretchy="false">)</m:mo>
656 <xsl:when test="$name='Prop'">
659 <xsl:when test="$name='Set'">
662 <xsl:when test="$name='Type'">
665 <xsl:when test="$name='mutcase'">
667 <xsl:when test="$charlength >= $framewidth">
668 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
669 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
674 <xsl:apply-templates select="*[position()=2]"/>
675 <xsl:if test="$framewidth > $charlength">
678 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
679 <xsl:apply-templates select="*[position()=3]"/>
684 <xsl:if test="$charlength >= $framewidth">
690 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
691 <xsl:apply-templates select="*[position()=3]"/>
703 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
704 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
709 <xsl:when test="position() = 1">
710 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
713 <m:mo stretchy="false">|</m:mo>
716 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
717 <xsl:apply-templates select="."/>
718 <xsl:if test="$framewidth > $charlength">
719 <m:mo mathcolor="Green">⇒</m:mo>
720 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
725 <xsl:if test="$charlength >= $framewidth">
729 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
730 <m:mo mathcolor="Green">⇒</m:mo>
731 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
747 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
749 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
750 <xsl:apply-templates select="*[position()=3]"/>
751 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
753 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
755 <xsl:when test="position() != 1">
756 <m:mo stretchy="false">|</m:mo>
759 <xsl:apply-templates select="."/>
760 <m:mo mathcolor="Green">⇒</m:mo>
761 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
763 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
768 <xsl:when test="$name='fix'">
770 <xsl:when test="$charlength >= $framewidth">
771 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
776 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
777 <m:mi><xsl:value-of select="m:ci"/></m:mi>
778 <m:mo stretchy="false">{</m:mo>
785 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
786 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
787 <xsl:for-each select="m:bvar">
788 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
792 <m:mi><xsl:value-of select="m:ci"/></m:mi>
794 <xsl:if test="$framewidth > $charlength">
795 <xsl:apply-templates select="m:type"/>
800 <xsl:if test="$charlength >= $framewidth">
804 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
805 <xsl:apply-templates select="m:type"/>
814 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
826 <m:mo stretchy="false">}</m:mo>
834 <m:mi><xsl:value-of select="m:ci"/></m:mi>
835 <m:mo stretchy="false">{</m:mo>
836 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
837 <xsl:for-each select="m:bvar">
841 <m:mi><xsl:value-of select="m:ci"/></m:mi>
843 <xsl:apply-templates select="m:type"/>
845 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
846 <xsl:if test="position()=last()">
847 <m:mo stretchy="false">}</m:mo>
857 <xsl:when test="$name='cofix'">
859 <xsl:when test="$charlength >= $framewidth">
860 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
865 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
866 <m:mi><xsl:value-of select="m:ci"/></m:mi>
867 <m:mo stretchy="false">{</m:mo>
874 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
875 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
876 <xsl:for-each select="m:bvar">
877 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
881 <m:mi><xsl:value-of select="m:ci"/></m:mi>
883 <xsl:if test="$framewidth > $charlength">
884 <xsl:apply-templates select="m:type"/>
889 <xsl:if test="$charlength >= $framewidth">
893 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
894 <xsl:apply-templates select="m:type"/>
903 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
915 <m:mo stretchy="false">}</m:mo>
923 <m:mi><xsl:value-of select="m:ci"/></m:mi>
924 <m:mo stretchy="false">{</m:mo>
925 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
926 <xsl:for-each select="m:bvar">
930 <m:mi><xsl:value-of select="m:ci"/></m:mi>
932 <xsl:apply-templates select="m:type"/>
934 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
935 <xsl:if test="position()=last()">
936 <m:mo stretchy="false">}</m:mo>
946 <!-- ***************************************** -->
947 <!-- *********** PROOF ELEMENTS ************** -->
948 <!-- ***************************************** -->
949 <xsl:when test="$name='proof'">
950 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
954 <xsl:apply-templates select="*[position()=2]"/>
961 <m:mtext mathcolor="Maroon">we proved </m:mtext>
962 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
963 <xsl:apply-templates select="*[position()=3]"/>
969 <xsl:when test="$name='letin1'">
970 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
974 <xsl:apply-templates select="*[2]"/>
981 <xsl:apply-templates select="*[3]"/>
987 <xsl:when test="$name='letin'">
988 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
989 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
990 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
994 <xsl:apply-templates select="."/>
1002 <xsl:apply-templates select="*[position()=last()]"/>
1008 <xsl:when test="$name='let'">
1009 <m:mtext>(</m:mtext>
1010 <xsl:apply-templates select="m:ci"/>
1011 <m:mtext>) </m:mtext>
1012 <xsl:apply-templates select="*[3]"/>
1014 <xsl:when test="$name='rw_step'">
1015 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1020 <xsl:when test="name(*[2])='m:apply'">
1021 <xsl:apply-templates select="*[2]"/>
1024 <m:mtext>Consider</m:mtext>
1025 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1026 <xsl:apply-templates select="*[2]"/>
1035 <m:mtext>Rewrite</m:mtext>
1036 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1037 <xsl:apply-templates select="*[3]"/>
1038 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1039 <m:mtext>with</m:mtext>
1040 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1041 <xsl:apply-templates select="*[4]"/>
1042 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1043 <m:mtext>by</m:mtext>
1044 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1045 <xsl:apply-templates select="*[5]"/>
1051 <!-- not existing any more
1052 <xsl:when test="$name='thread'">
1053 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1058 <xsl:when test="name(*[last()])='m:apply'">
1059 <xsl:apply-templates select="*[last()]"/>
1062 <m:mtext>Consider</m:mtext>
1063 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1064 <xsl:apply-templates select="*[last()]"/>
1070 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1074 <xsl:when test="$name='rewrite_and_apply'">
1075 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1079 <xsl:apply-templates select="*[2]"/>
1086 <m:mtext>Then apply it to</m:mtext>
1087 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1088 <xsl:apply-templates select="*[position()>2]"/>
1095 <xsl:when test="$name='nat_ind'">
1096 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1099 <m:mtext>By induction</m:mtext>
1105 <m:mtext>base case:</m:mtext>
1106 <xsl:apply-templates select="*[2]"/>
1113 <m:mtext>inductive case:</m:mtext>
1114 <xsl:apply-templates select="*[3]"/>
1121 <xsl:when test="$name='and_ind'">
1122 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1127 <xsl:when test="name(*[2])='m:apply'">
1128 <xsl:apply-templates select="*[2]"/>
1131 <m:mtext>Consider</m:mtext>
1132 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1133 <xsl:apply-templates select="*[2]"/>
1141 <m:mtext>In particular, we have</m:mtext>
1147 <m:mtext>(</m:mtext>
1148 <xsl:apply-templates select="*[3]"/>
1149 <m:mtext>)</m:mtext>
1150 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1151 <xsl:apply-templates select="*[4]"/>
1158 <m:mtext>(</m:mtext>
1159 <xsl:apply-templates select="*[5]"/>
1160 <m:mtext>)</m:mtext>
1161 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1162 <xsl:apply-templates select="*[6]"/>
1169 <xsl:apply-templates select="*[7]"/>
1175 <xsl:when test="$name='or_ind'">
1176 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1181 <xsl:when test="name(*[2])='m:apply'">
1182 <xsl:apply-templates select="*[2]"/>
1185 <m:mtext>Consider</m:mtext>
1186 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1187 <xsl:apply-templates select="*[2]"/>
1195 <m:mtext>We prove</m:mtext>
1196 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1197 <xsl:apply-templates select="*[3]"/>
1198 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1199 <m:mtext>by cases:</m:mtext>
1205 <m:mtext>*</m:mtext>
1206 <xsl:apply-templates select="*[4]"/>
1213 <m:mtext>*</m:mtext>
1214 <xsl:apply-templates select="*[5]"/>
1220 <xsl:when test="$name='ex_ind'">
1221 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1226 <xsl:when test="name(*[2])='m:apply'">
1227 <xsl:apply-templates select="*[2]"/>
1230 <m:mtext>Consider</m:mtext>
1231 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1232 <xsl:apply-templates select="*[2]"/>
1240 <m:mtext>Let</m:mtext>
1241 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1242 <xsl:apply-templates select="*[3]"/>
1243 <m:mtext>:</m:mtext>
1244 <xsl:apply-templates select="*[4]"/>
1245 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1246 <m:mtext>such that</m:mtext>
1247 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1248 <m:mtext>(</m:mtext>
1249 <xsl:apply-templates select="*[5]"/>
1250 <m:mtext>)</m:mtext>
1251 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1252 <xsl:apply-templates select="*[6]"/>
1258 <xsl:apply-templates select="*[7]"/>
1271 <!-- Il modo Thread non esiste piu'
1272 <xsl:template match="*" mode="thread">
1273 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1275 <xsl:when test="$name='rw_step'">
1279 <m:mtext>Rewrite</m:mtext>
1280 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1281 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1282 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1283 <m:mtext>with</m:mtext>
1284 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1285 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1286 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1287 <m:mtext>by</m:mtext>
1288 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1289 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1296 <m:mtext mathcolor="Maroon">we get</m:mtext>
1297 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1298 <xsl:apply-templates select="."/>
1307 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1314 <m:mtext mathcolor="Maroon">we get</m:mtext>
1315 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1316 <xsl:apply-templates select="."/>
1322 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1328 <xsl:template match="m:lambda">
1329 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1330 <m:mrow helm:xref="{@helm:xref}">
1332 <xsl:when test="$charlength >= $framewidth">
1333 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1336 <m:mo mathcolor="Red">λ</m:mo>
1337 <xsl:apply-templates select="m:bvar"/>
1344 <xsl:apply-templates select="*[position()=2]"/>
1351 <m:mo mathcolor="Red">λ</m:mo>
1352 <xsl:apply-templates select="m:bvar/m:ci"/>
1354 <xsl:apply-templates select="m:bvar/m:type"/>
1356 <xsl:apply-templates select="*[position()=2]"/>
1362 <!-- *********************************** -->
1363 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1364 <!-- *********************************** -->
1368 <xsl:template match = "m:apply[m:eq[1]]">
1369 <xsl:variable name="charlength">
1370 <xsl:apply-templates select="*[1]" mode="charcount"/>
1373 <xsl:when test="$charlength >= $framewidth">
1374 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1375 <xsl:if test="@helm:xref">
1376 <xsl:attribute name="helm:xref">
1377 <xsl:value-of select="@helm:xref"/>
1382 <m:mo stretchy="false">(</m:mo>
1383 <xsl:apply-templates select="*[position()=2]"/>
1386 <xsl:for-each select = "*[position()>2]">
1389 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1390 <m:mo helm:xref="{m:in/@helm:xref}">=</m:mo>
1391 <xsl:apply-templates select="."/>
1397 <m:mo stretchy="false">)</m:mo>
1403 <xsl:apply-imports/>
1409 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1410 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1411 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1412 |m:prsubset|m:setdiff[1]]">
1413 <xsl:variable name="symbol">
1415 <xsl:when test="m:and[1]">
1416 <xsl:value-of select="'wedge'"/>
1418 <xsl:when test="m:or[1]">
1419 <xsl:value-of select="'vee'"/>
1421 <xsl:when test="m:geq[1]">
1422 <xsl:value-of select="'geq'"/>
1424 <xsl:when test="m:leq[1]">
1425 <xsl:value-of select="'leq'"/>
1427 <xsl:when test="m:gt[1]">
1428 <xsl:value-of select="'gt'"/>
1430 <xsl:when test="m:lt[1]">
1431 <xsl:value-of select="'lt'"/>
1433 <xsl:when test="m:eq[1]">
1434 <xsl:value-of select="'Equal'"/>
1436 <xsl:when test="m:in[1]">
1437 <xsl:value-of select="'Element'"/>
1439 <xsl:when test="m:subset[1]">
1440 <xsl:value-of select="'SubsetEqual'"/>
1442 <xsl:when test="m:prsubset[1]">
1443 <xsl:value-of select="'subset'"/>
1445 <xsl:when test="m:intersect[1]">
1446 <xsl:value-of select="'Intersection'"/>
1448 <xsl:when test="m:union[1]">
1449 <xsl:value-of select="'Union'"/>
1451 <xsl:when test="m:setdiff[1]">
1452 <xsl:value-of select="'Backslash'"/>
1456 <xsl:variable name="charlength">
1457 <xsl:apply-templates select="*[1]" mode="charcount"/>
1460 <xsl:when test="$charlength >= $framewidth">
1461 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1462 <xsl:if test="@helm:xref">
1463 <xsl:attribute name="helm:xref">
1464 <xsl:value-of select="@helm:xref"/>
1469 <m:mo stretchy="false">(</m:mo>
1470 <xsl:apply-templates select="*[position()=2]"/>
1473 <xsl:for-each select = "*[position()>2]">
1476 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1477 <m:mo helm:xref="{*[1]/@helm:xref}">
1478 <m:mchar name="{$symbol}"/>
1480 <xsl:apply-templates select="."/>
1486 <m:mo stretchy="false">)</m:mo>
1492 <xsl:apply-imports/>
1497 <xsl:template match = "m:set">
1499 <xsl:when test="count(child::*) = 0">
1501 <m:mchar name="emptyset"/>
1505 <xsl:variable name="charlength">
1506 <xsl:apply-templates select="*[1]" mode="charcount"/>
1509 <xsl:when test="$charlength >= $framewidth">
1511 <xsl:when test="name(*[1]) = 'm:bvar'">
1512 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1515 <m:mo stretchy="false">{</m:mo>
1516 <xsl:apply-templates select="*[position()=1]"/>
1521 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1522 <m:mo stretchy="false">|</m:mo>
1523 <xsl:apply-templates select="m:condition/*[1]"/>
1528 <m:mo stretchy="false">}</m:mo>
1534 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1537 <m:mo stretchy="false">{</m:mo>
1538 <xsl:apply-templates select="*[position()=1]"/>
1539 <xsl:if test="position() != last()">
1544 <xsl:for-each select = "*[position()>2]">
1547 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1548 <xsl:apply-templates select="."/>
1549 <xsl:if test="position() != last()">
1557 <m:mo stretchy="false">}</m:mo>
1565 <xsl:apply-imports/>
1572 <xsl:template match = "m:apply[m:card[1]]">
1573 <m:mo stretchy="false">|</m:mo>
1574 <xsl:apply-templates select="*[2]"/>
1575 <m:mo stretchy="false">|</m:mo>
1578 <!-- *********************************** -->
1579 <!-- PROOF ELEMENTS -->
1580 <!-- *********************************** -->
1584 <!--**********************-->
1586 <!--**********************-->
1588 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1589 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1590 |m:plus|m:minus|m:times" mode="charcount">
1591 <xsl:param name="incurrent_length" select="0"/>
1593 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1594 <xsl:variable name="siblength">
1595 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1596 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1597 </xsl:apply-templates>
1600 <xsl:when test="string($siblength) = """>
1601 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1604 <xsl:value-of select="number($siblength)"/>
1609 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1614 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1615 <xsl:param name="incurrent_length" select="0"/>
1616 <xsl:param name="nosibling" select="0"/>
1618 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1619 <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>
1621 <xsl:when test="string($siblength) = """>
1622 <xsl:value-of select="$incurrent_length + string-length()"/>
1625 <xsl:value-of select="number($siblength)"/>
1630 <xsl:value-of select="$incurrent_length + string-length()"/>
1635 <xsl:template match="*" mode="charcount">
1636 <xsl:param name="incurrent_length" select="0"/>
1637 <xsl:param name="nosibling" select="0"/>
1639 <xsl:when test="count(child::*) = 0">
1640 <xsl:value-of select="$incurrent_length"/>
1643 <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>
1645 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1646 <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>
1648 <xsl:when test="string($siblength) = """>
1649 <xsl:value-of select="number($childlength)"/>
1652 <xsl:value-of select="number($siblength)"/>
1657 <xsl:value-of select="number($childlength)"/>