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 <xsl:when test="$name='thread'">
1049 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1054 <xsl:when test="name(*[last()])='m:apply'">
1055 <xsl:apply-templates select="*[last()]"/>
1058 <m:mtext>Consider</m:mtext>
1059 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1060 <xsl:apply-templates select="*[last()]"/>
1066 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1069 <xsl:when test="$name='rewrite_and_apply'">
1070 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1074 <xsl:apply-templates select="*[2]"/>
1081 <m:mtext>Then apply it to</m:mtext>
1082 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1083 <xsl:apply-templates select="*[position()>2]"/>
1090 <xsl:when test="$name='nat_ind'">
1091 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1094 <m:mtext>By induction</m:mtext>
1100 <m:mtext>base case:</m:mtext>
1101 <xsl:apply-templates select="*[2]"/>
1108 <m:mtext>inductive case:</m:mtext>
1109 <xsl:apply-templates select="*[3]"/>
1116 <xsl:when test="$name='and_ind'">
1117 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1122 <xsl:when test="name(*[2])='m:apply'">
1123 <xsl:apply-templates select="*[2]"/>
1126 <m:mtext>Consider</m:mtext>
1127 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1128 <xsl:apply-templates select="*[2]"/>
1136 <m:mtext>In particular, we have</m:mtext>
1142 <m:mtext>(</m:mtext>
1143 <xsl:apply-templates select="*[3]"/>
1144 <m:mtext>)</m:mtext>
1145 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1146 <xsl:apply-templates select="*[4]"/>
1153 <m:mtext>(</m:mtext>
1154 <xsl:apply-templates select="*[5]"/>
1155 <m:mtext>)</m:mtext>
1156 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1157 <xsl:apply-templates select="*[6]"/>
1164 <xsl:apply-templates select="*[7]"/>
1170 <xsl:when test="$name='or_ind'">
1171 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1176 <xsl:when test="name(*[2])='m:apply'">
1177 <xsl:apply-templates select="*[2]"/>
1180 <m:mtext>Consider</m:mtext>
1181 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1182 <xsl:apply-templates select="*[2]"/>
1190 <m:mtext>We prove</m:mtext>
1191 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1192 <xsl:apply-templates select="*[3]"/>
1193 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1194 <m:mtext>by cases:</m:mtext>
1200 <m:mtext>*</m:mtext>
1201 <xsl:apply-templates select="*[4]"/>
1208 <m:mtext>*</m:mtext>
1209 <xsl:apply-templates select="*[5]"/>
1215 <xsl:when test="$name='ex_ind'">
1216 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1221 <xsl:when test="name(*[2])='m:apply'">
1222 <xsl:apply-templates select="*[2]"/>
1225 <m:mtext>Consider</m:mtext>
1226 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1227 <xsl:apply-templates select="*[2]"/>
1235 <m:mtext>Let</m:mtext>
1236 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1237 <xsl:apply-templates select="*[3]"/>
1238 <m:mtext>:</m:mtext>
1239 <xsl:apply-templates select="*[4]"/>
1240 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1241 <m:mtext>such that</m:mtext>
1242 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1243 <m:mtext>(</m:mtext>
1244 <xsl:apply-templates select="*[5]"/>
1245 <m:mtext>)</m:mtext>
1246 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1247 <xsl:apply-templates select="*[6]"/>
1253 <xsl:apply-templates select="*[7]"/>
1266 <!-- Il modo Thread non esiste piu'
1267 <xsl:template match="*" mode="thread">
1268 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1270 <xsl:when test="$name='rw_step'">
1274 <m:mtext>Rewrite</m:mtext>
1275 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1276 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1277 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1278 <m:mtext>with</m:mtext>
1279 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1280 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1281 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1282 <m:mtext>by</m:mtext>
1283 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1284 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1291 <m:mtext mathcolor="Maroon">we get</m:mtext>
1292 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1293 <xsl:apply-templates select="."/>
1302 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1309 <m:mtext mathcolor="Maroon">we get</m:mtext>
1310 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1311 <xsl:apply-templates select="."/>
1317 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1323 <xsl:template match="m:lambda">
1324 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1325 <m:mrow helm:xref="{@helm:xref}">
1327 <xsl:when test="$charlength >= $framewidth">
1328 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1331 <m:mo mathcolor="Red">λ</m:mo>
1332 <xsl:apply-templates select="m:bvar"/>
1339 <xsl:apply-templates select="*[position()=2]"/>
1346 <m:mo mathcolor="Red">λ</m:mo>
1347 <xsl:apply-templates select="m:bvar/m:ci"/>
1349 <xsl:apply-templates select="m:bvar/m:type"/>
1351 <xsl:apply-templates select="*[position()=2]"/>
1357 <!-- *********************************** -->
1358 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1359 <!-- *********************************** -->
1363 <xsl:template match = "m:apply[m:eq[1]]">
1364 <xsl:variable name="charlength">
1365 <xsl:apply-templates select="*[1]" mode="charcount"/>
1368 <xsl:when test="$charlength >= $framewidth">
1369 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1370 <xsl:if test="@helm:xref">
1371 <xsl:attribute name="helm:xref">
1372 <xsl:value-of select="@helm:xref"/>
1377 <m:mo stretchy="false">(</m:mo>
1378 <xsl:apply-templates select="*[position()=2]"/>
1381 <xsl:for-each select = "*[position()>2]">
1384 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1385 <m:mo helm:xref="{m:in/@helm:xref}">=</m:mo>
1386 <xsl:apply-templates select="."/>
1392 <m:mo stretchy="false">)</m:mo>
1398 <xsl:apply-imports/>
1404 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1405 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1406 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1407 |m:prsubset|m:setdiff[1]]">
1408 <xsl:variable name="symbol">
1410 <xsl:when test="m:and[1]">
1411 <xsl:value-of select="'wedge'"/>
1413 <xsl:when test="m:or[1]">
1414 <xsl:value-of select="'vee'"/>
1416 <xsl:when test="m:geq[1]">
1417 <xsl:value-of select="'geq'"/>
1419 <xsl:when test="m:leq[1]">
1420 <xsl:value-of select="'leq'"/>
1422 <xsl:when test="m:gt[1]">
1423 <xsl:value-of select="'gt'"/>
1425 <xsl:when test="m:lt[1]">
1426 <xsl:value-of select="'lt'"/>
1428 <xsl:when test="m:eq[1]">
1429 <xsl:value-of select="'Equal'"/>
1431 <xsl:when test="m:in[1]">
1432 <xsl:value-of select="'Element'"/>
1434 <xsl:when test="m:subset[1]">
1435 <xsl:value-of select="'SubsetEqual'"/>
1437 <xsl:when test="m:prsubset[1]">
1438 <xsl:value-of select="'subset'"/>
1440 <xsl:when test="m:intersect[1]">
1441 <xsl:value-of select="'Intersection'"/>
1443 <xsl:when test="m:union[1]">
1444 <xsl:value-of select="'Union'"/>
1446 <xsl:when test="m:setdiff[1]">
1447 <xsl:value-of select="'Backslash'"/>
1451 <xsl:variable name="charlength">
1452 <xsl:apply-templates select="*[1]" mode="charcount"/>
1455 <xsl:when test="$charlength >= $framewidth">
1456 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1457 <xsl:if test="@helm:xref">
1458 <xsl:attribute name="helm:xref">
1459 <xsl:value-of select="@helm:xref"/>
1464 <m:mo stretchy="false">(</m:mo>
1465 <xsl:apply-templates select="*[position()=2]"/>
1468 <xsl:for-each select = "*[position()>2]">
1471 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1472 <m:mo helm:xref="{*[1]/@helm:xref}">
1473 <m:mchar name="{$symbol}"/>
1475 <xsl:apply-templates select="."/>
1481 <m:mo stretchy="false">)</m:mo>
1487 <xsl:apply-imports/>
1492 <xsl:template match = "m:set">
1494 <xsl:when test="count(child::*) = 0">
1496 <m:mchar name="emptyset"/>
1500 <xsl:variable name="charlength">
1501 <xsl:apply-templates select="*[1]" mode="charcount"/>
1504 <xsl:when test="$charlength >= $framewidth">
1506 <xsl:when test="name(*[1]) = 'm:bvar'">
1507 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1510 <m:mo stretchy="false">{</m:mo>
1511 <xsl:apply-templates select="*[position()=1]"/>
1516 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1517 <m:mo stretchy="false">|</m:mo>
1518 <xsl:apply-templates select="m:condition/*[1]"/>
1523 <m:mo stretchy="false">}</m:mo>
1529 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1532 <m:mo stretchy="false">{</m:mo>
1533 <xsl:apply-templates select="*[position()=1]"/>
1534 <xsl:if test="position() != last()">
1539 <xsl:for-each select = "*[position()>2]">
1542 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1543 <xsl:apply-templates select="."/>
1544 <xsl:if test="position() != last()">
1552 <m:mo stretchy="false">}</m:mo>
1560 <xsl:apply-imports/>
1567 <xsl:template match = "m:apply[m:card[1]]">
1568 <m:mo stretchy="false">|</m:mo>
1569 <xsl:apply-templates select="*[2]"/>
1570 <m:mo stretchy="false">|</m:mo>
1573 <!-- *********************************** -->
1574 <!-- PROOF ELEMENTS -->
1575 <!-- *********************************** -->
1579 <!--**********************-->
1581 <!--**********************-->
1583 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1584 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1585 |m:plus|m:minus|m:times" mode="charcount">
1586 <xsl:param name="incurrent_length" select="0"/>
1588 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1589 <xsl:variable name="siblength">
1590 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1591 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1592 </xsl:apply-templates>
1595 <xsl:when test="string($siblength) = """>
1596 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1599 <xsl:value-of select="number($siblength)"/>
1604 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1609 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1610 <xsl:param name="incurrent_length" select="0"/>
1611 <xsl:param name="nosibling" select="0"/>
1613 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1614 <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>
1616 <xsl:when test="string($siblength) = """>
1617 <xsl:value-of select="$incurrent_length + string-length()"/>
1620 <xsl:value-of select="number($siblength)"/>
1625 <xsl:value-of select="$incurrent_length + string-length()"/>
1630 <xsl:template match="*" mode="charcount">
1631 <xsl:param name="incurrent_length" select="0"/>
1632 <xsl:param name="nosibling" select="0"/>
1634 <xsl:when test="count(child::*) = 0">
1635 <xsl:value-of select="$incurrent_length"/>
1638 <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>
1640 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1641 <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>
1643 <xsl:when test="string($siblength) = """>
1644 <xsl:value-of select="number($childlength)"/>
1647 <xsl:value-of select="number($siblength)"/>
1652 <xsl:value-of select="number($childlength)"/>