3 <!-- Copyright (C) 2000, HELM Team -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic -->
6 <!-- Library of Mathematics, developed at the Computer Science -->
7 <!-- Department, University of Bologna, Italy. -->
9 <!-- HELM is free software; you can redistribute it and/or -->
10 <!-- modify it under the terms of the GNU General Public License -->
11 <!-- as published by the Free Software Foundation; either version 2 -->
12 <!-- of the License, or (at your option) any later version. -->
14 <!-- HELM is distributed in the hope that it will be useful, -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
17 <!-- GNU General Public License for more details. -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
22 <!-- MA 02111-1307, USA. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <!--***********************************************************************-->
28 <!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
29 <!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
30 <!-- Revised: March 3 2000, Irene Schena -->
31 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
32 <!-- Revised: March 21 2000, Irene Schena -->
33 <!--***********************************************************************-->
35 <!-- NOTE: the namespace declaration has to be done in the stylesheets
36 which generates the toplevel element (see for instance xlink) -->
37 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
38 xmlns:m="http://www.w3.org/1998/Math/MathML"
39 xmlns:helm="http://www.cs.unibo.it/helm"
40 xmlns:xlink="http://www.w3.org/1999/xlink">
42 <!-- OLD: <xsl:import href="mml2mmlv1_0.xsl"/> -->
43 <xsl:import href="mmlctop.xsl-0.14"/>
45 <xsl:import href="mmltheoryextension.xsl"/>
47 <!--***********************************************************************-->
48 <!-- Parameter affecting line-breaking -->
49 <!--***********************************************************************-->
51 <xsl:variable name="framewidth" select="35"/>
53 <!--***********************************************************************-->
54 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
55 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
56 <!-- sono i termini: la presentation per un termine e' generata come primo -->
57 <!-- figlio di un semantics e l'originario content viene inserito nel -->
58 <!-- nel secondo figlio di semantics, annotation-xml -->
59 <!--***********************************************************************-->
61 <!--**********************-->
63 <!--**********************-->
65 <xsl:param name="type" select="'standalone'"/>
67 <xsl:template match="/">
69 <xsl:when test="$type = 'standalone'">
70 <xsl:apply-templates select="*"/>
74 <xsl:apply-templates select="*"/>
82 <xsl:template match="Definition">
84 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
88 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
95 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
96 <xsl:apply-templates select="type/*[1]"/>
103 <m:mtext>AS</m:mtext>
110 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
111 <xsl:apply-templates select="body/*[1]"/>
121 <xsl:template match="Axiom">
123 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
127 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
134 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
135 <xsl:apply-templates select="type/*[1]"/>
143 <!-- UNFINISHED PROOF -->
145 <xsl:template match="CurrentProof">
147 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
151 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
158 <m:mtext>THESIS:</m:mtext>
165 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
166 <xsl:apply-templates select="type/*[1]"/>
173 <m:mtext>CONJECTURES:</m:mtext>
177 <xsl:for-each select="Conjecture">
181 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
182 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
183 <xsl:apply-templates select="./*[1]"/>
191 <m:mtext>CORRESPONDING PROOF:</m:mtext>
198 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
199 <xsl:apply-templates select="body/*[1]"/>
207 <!-- MUTUAL INDUCTIVE DEFINITION -->
209 <xsl:template match="InductiveDefinition">
211 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
212 <xsl:for-each select="InductiveType">
217 <xsl:when test="position() = 1">
219 <xsl:when test="string(./@inductive) = "true"">
220 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
223 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
228 <m:mtext>AND</m:mtext>
231 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
232 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
239 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
242 <xsl:when test="string(../Param) != """>
243 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
244 <xsl:for-each select="../Param">
248 <m:mi><xsl:value-of select="./@name"/></m:mi>
250 <xsl:apply-templates select="*"/>
274 <m:mtext>OF ARITY</m:mtext>
281 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
282 <xsl:apply-templates select="./arity/*[1]"/>
289 <m:mtext>BUILT FROM</m:mtext>
293 <xsl:for-each select="./Constructor">
298 <xsl:when test="position() = 1">
299 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
303 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
306 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
307 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
308 <xsl:apply-templates select="./*[1]"/>
320 <xsl:template match="Variable">
322 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
326 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
333 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
334 <xsl:apply-templates select="type/*[1]"/>
338 <xsl:if test="name(*[1])='body'">
342 <m:mtext>AS</m:mtext>
349 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
350 <xsl:apply-templates select="body/*[1]"/>
359 <!--**********************-->
361 <!--**********************-->
363 <xsl:template match="m:bvar">
365 <xsl:when test="m:type">
366 <xsl:variable name="charlength">
367 <xsl:apply-templates select="m:ci" mode="charcount"/>
370 <xsl:when test="$charlength >= $framewidth">
371 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
374 <xsl:apply-templates select="m:ci"/>
380 <xsl:apply-templates select="m:type"/>
386 <xsl:apply-templates select="m:ci"/>
388 <xsl:apply-templates select="m:type"/>
393 <xsl:apply-templates select="m:ci"/>
401 <xsl:template match="m:apply[m:csymbol]">
402 <xsl:param name="nopar" select="0"/>
403 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
404 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
406 <xsl:if test="@helm:xref">
407 <xsl:attribute name="m:xref"><xsl:value-of select="@id"/></xsl:attribute>
410 <xsl:when test="$name='forall'">
412 <xsl:when test="$charlength >= $framewidth">
413 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
417 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
418 <xsl:apply-templates select="m:bvar"/>
426 <xsl:apply-templates select="*[position()=3]"/>
433 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
434 <xsl:apply-templates select="m:bvar/m:ci"/>
436 <xsl:apply-templates select="m:bvar/m:type"/>
438 <xsl:apply-templates select="*[position()=3]"/>
442 <xsl:when test="$name='let_in'">
444 <xsl:when test="$charlength >= $framewidth">
445 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
450 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
451 <xsl:apply-templates select="m:bvar"/>
459 <xsl:apply-templates select="*[position()=3]"/>
467 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
468 <xsl:apply-templates select="*[position()=4]"/>
476 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
477 <xsl:apply-templates select="m:bvar/m:ci"/>
479 <xsl:apply-templates select="*[position()=3]"/>
480 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
481 <m:mtext>IN</m:mtext>
482 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
483 <xsl:apply-templates select="*[position()=4]"/>
487 <xsl:when test="$name='prod'">
489 <xsl:when test="$charlength >= $framewidth">
490 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
494 <m:mo mathcolor="Blue">Π</m:mo>
495 <xsl:apply-templates select="m:bvar"/>
503 <xsl:apply-templates select="*[position()=3]"/>
510 <m:mo mathcolor="Blue">Π</m:mo>
511 <xsl:apply-templates select="m:bvar/m:ci"/>
513 <xsl:apply-templates select="m:bvar/m:type"/>
515 <xsl:apply-templates select="*[position()=3]"/>
519 <xsl:when test="$name='arrow'">
521 <xsl:when test="$charlength >= $framewidth">
522 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
526 <xsl:if test="$nopar=0">
527 <m:mo stretchy="false">(</m:mo>
529 <xsl:apply-templates select="*[position()=2]"/>
536 <m:mo mathmathcolor="Blue">→</m:mo>
538 <xsl:when test="*[position()=3]/m:csymbol">
539 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
541 <xsl:when test="$nextp='arrow'">
542 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
545 <xsl:apply-templates select="*[position()=3]"/>
550 <xsl:apply-templates select="*[position()=3]"/>
556 <xsl:if test="$nopar=0">
560 <m:mo stretchy="false">)</m:mo>
568 <xsl:if test="$nopar=0">
569 <m:mo stretchy="false">(</m:mo>
571 <xsl:apply-templates select="*[position()=2]"/>
572 <m:mo mathcolor="Blue">→</m:mo>
574 <xsl:when test="*[position()=3]/m:csymbol">
575 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
577 <xsl:when test="$nextp='arrow'">
578 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
581 <xsl:apply-templates select="*[position()=3]"/>
586 <xsl:apply-templates select="*[position()=3]"/>
589 <xsl:if test="$nopar=0">
590 <m:mo stretchy="false">)</m:mo>
595 <xsl:when test="$name='app'">
597 <xsl:when test="$charlength >= $framewidth">
598 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
602 <m:mo stretchy="false">(</m:mo>
603 <xsl:apply-templates select="*[position()=2]"/>
607 <xsl:for-each select="*[position()>2]">
611 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
612 <xsl:apply-templates select="."/>
620 <m:mo stretchy="false">)</m:mo>
627 <m:mo stretchy="false">(</m:mo>
628 <xsl:apply-templates select="*[position()=2]"/>
629 <xsl:for-each select="*[position()>2]">
630 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
631 <xsl:apply-templates select="."/>
633 <m:mo stretchy="false">)</m:mo>
637 <xsl:when test="$name='cast'">
639 <xsl:when test="$charlength >= $framewidth">
640 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
644 <m:mo stretchy="false">(</m:mo>
645 <xsl:apply-templates select="*[position()=2]"/>
652 <m:mo mathcolor="Maroon">:></m:mo>
653 <xsl:apply-templates select="*[position()=3]"/>
660 <m:mo stretchy="false">)</m:mo>
667 <m:mo stretchy="false">(</m:mo>
668 <xsl:apply-templates select="*[position()=2]"/>
669 <m:mo mathcolor="Maroon">:></m:mo>
670 <xsl:apply-templates select="*[position()=3]"/>
671 <m:mo stretchy="false">)</m:mo>
675 <xsl:when test="$name='Prop'">
678 <xsl:when test="$name='Set'">
681 <xsl:when test="$name='Type'">
684 <xsl:when test="$name='mutcase'">
686 <xsl:when test="$charlength >= $framewidth">
687 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
688 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
693 <xsl:apply-templates select="*[position()=2]"/>
694 <xsl:if test="$framewidth > $charlength">
697 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
698 <xsl:apply-templates select="*[position()=3]"/>
703 <xsl:if test="$charlength >= $framewidth">
709 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
710 <xsl:apply-templates select="*[position()=3]"/>
722 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
723 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
728 <xsl:when test="position() = 1">
729 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
732 <m:mo stretchy="false">|</m:mo>
735 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
736 <xsl:apply-templates select="."/>
737 <xsl:if test="$framewidth > $charlength">
738 <m:mo mathcolor="Green">⇒</m:mo>
739 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
744 <xsl:if test="$charlength >= $framewidth">
748 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
749 <m:mo mathcolor="Green">⇒</m:mo>
750 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
766 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
768 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
769 <xsl:apply-templates select="*[position()=3]"/>
770 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
772 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
774 <xsl:when test="position() != 1">
775 <m:mo stretchy="false">|</m:mo>
778 <xsl:apply-templates select="."/>
779 <m:mo mathcolor="Green">⇒</m:mo>
780 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
782 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
787 <xsl:when test="$name='fix'">
789 <xsl:when test="$charlength >= $framewidth">
790 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
795 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
796 <m:mi><xsl:value-of select="m:ci"/></m:mi>
797 <m:mo stretchy="false">{</m:mo>
804 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
805 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
806 <xsl:for-each select="m:bvar">
807 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
811 <m:mi><xsl:value-of select="m:ci"/></m:mi>
813 <xsl:if test="$framewidth > $charlength">
814 <xsl:apply-templates select="m:type"/>
819 <xsl:if test="$charlength >= $framewidth">
823 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
824 <xsl:apply-templates select="m:type"/>
833 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
845 <m:mo stretchy="false">}</m:mo>
853 <m:mi><xsl:value-of select="m:ci"/></m:mi>
854 <m:mo stretchy="false">{</m:mo>
855 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
856 <xsl:for-each select="m:bvar">
860 <m:mi><xsl:value-of select="m:ci"/></m:mi>
862 <xsl:apply-templates select="m:type"/>
864 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
865 <xsl:if test="position()=last()">
866 <m:mo stretchy="false">}</m:mo>
876 <xsl:when test="$name='cofix'">
878 <xsl:when test="$charlength >= $framewidth">
879 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
884 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
885 <m:mi><xsl:value-of select="m:ci"/></m:mi>
886 <m:mo stretchy="false">{</m:mo>
893 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
894 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
895 <xsl:for-each select="m:bvar">
896 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
900 <m:mi><xsl:value-of select="m:ci"/></m:mi>
902 <xsl:if test="$framewidth > $charlength">
903 <xsl:apply-templates select="m:type"/>
908 <xsl:if test="$charlength >= $framewidth">
912 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
913 <xsl:apply-templates select="m:type"/>
922 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
934 <m:mo stretchy="false">}</m:mo>
942 <m:mi><xsl:value-of select="m:ci"/></m:mi>
943 <m:mo stretchy="false">{</m:mo>
944 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
945 <xsl:for-each select="m:bvar">
949 <m:mi><xsl:value-of select="m:ci"/></m:mi>
951 <xsl:apply-templates select="m:type"/>
953 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
954 <xsl:if test="position()=last()">
955 <m:mo stretchy="false">}</m:mo>
965 <!-- ***************************************** -->
966 <!-- *********** PROOF ELEMENTS ************** -->
967 <!-- ***************************************** -->
968 <xsl:when test="$name='proof'">
969 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
973 <xsl:apply-templates select="*[position()=2]"/>
980 <m:mtext mathcolor="Maroon">we proved </m:mtext>
981 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
982 <xsl:apply-templates select="*[position()=3]"/>
988 <xsl:when test="$name='letin1'">
989 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
993 <xsl:apply-templates select="*[2]"/>
1000 <xsl:apply-templates select="*[3]"/>
1006 <xsl:when test="$name='letin'">
1007 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1008 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
1009 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
1013 <xsl:apply-templates select="."/>
1021 <xsl:apply-templates select="*[position()=last()]"/>
1027 <xsl:when test="$name='let'">
1028 <m:mtext>(</m:mtext>
1029 <xsl:apply-templates select="m:ci"/>
1030 <m:mtext>) </m:mtext>
1031 <xsl:apply-templates select="*[3]"/>
1033 <xsl:when test="$name='rw_step'">
1034 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1039 <xsl:when test="name(*[2])='m:apply'">
1040 <xsl:apply-templates select="*[2]"/>
1043 <m:mtext>Consider</m:mtext>
1044 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1045 <xsl:apply-templates select="*[2]"/>
1054 <m:mtext>Rewrite</m:mtext>
1055 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1056 <xsl:apply-templates select="*[3]"/>
1057 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1058 <m:mtext>with</m:mtext>
1059 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1060 <xsl:apply-templates select="*[4]"/>
1061 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1062 <m:mtext>by</m:mtext>
1063 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1064 <xsl:apply-templates select="*[5]"/>
1070 <!-- not existing any more
1071 <xsl:when test="$name='thread'">
1072 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1077 <xsl:when test="name(*[last()])='m:apply'">
1078 <xsl:apply-templates select="*[last()]"/>
1081 <m:mtext>Consider</m:mtext>
1082 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1083 <xsl:apply-templates select="*[last()]"/>
1089 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1093 <xsl:when test="$name='rewrite_and_apply'">
1094 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1098 <xsl:apply-templates select="*[2]"/>
1105 <m:mtext>Then apply it to</m:mtext>
1106 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1107 <xsl:apply-templates select="*[position()>2]"/>
1114 <xsl:when test="$name='nat_ind'">
1115 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1118 <m:mtext>By induction</m:mtext>
1124 <m:mtext>base case:</m:mtext>
1125 <xsl:apply-templates select="*[2]"/>
1132 <m:mtext>inductive case:</m:mtext>
1133 <xsl:apply-templates select="*[3]"/>
1140 <xsl:when test="$name='and_ind'">
1141 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1146 <xsl:when test="name(*[2])='m:apply'">
1147 <xsl:apply-templates select="*[2]"/>
1150 <m:mtext>Consider</m:mtext>
1151 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1152 <xsl:apply-templates select="*[2]"/>
1161 <m:mtext>In particular, we have</m:mtext>
1168 <m:mtext>(</m:mtext>
1169 <xsl:apply-templates select="*[3]"/>
1170 <m:mtext>)</m:mtext>
1171 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1172 <xsl:apply-templates select="*[4]"/>
1179 <m:mtext>(</m:mtext>
1180 <xsl:apply-templates select="*[5]"/>
1181 <m:mtext>)</m:mtext>
1182 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1183 <xsl:apply-templates select="*[6]"/>
1190 <xsl:apply-templates select="*[7]"/>
1196 <xsl:when test="$name='or_ind'">
1197 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1202 <xsl:when test="name(*[2])='m:apply'">
1203 <xsl:apply-templates select="*[2]"/>
1206 <m:mtext>Consider</m:mtext>
1207 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1208 <xsl:apply-templates select="*[2]"/>
1217 <m:mtext>We prove</m:mtext>
1218 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1219 <xsl:apply-templates select="*[3]"/>
1220 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1221 <m:mtext>by cases:</m:mtext>
1228 <m:mtext>*</m:mtext>
1229 <xsl:apply-templates select="*[4]"/>
1236 <m:mtext>*</m:mtext>
1237 <xsl:apply-templates select="*[5]"/>
1243 <xsl:when test="$name='ex_ind'">
1244 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1249 <xsl:when test="name(*[2])='m:apply'">
1250 <xsl:apply-templates select="*[2]"/>
1253 <m:mtext>Consider</m:mtext>
1254 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1255 <xsl:apply-templates select="*[2]"/>
1264 <m:mtext>Let</m:mtext>
1265 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1266 <xsl:apply-templates select="*[3]"/>
1267 <m:mtext>:</m:mtext>
1268 <xsl:apply-templates select="*[4]"/>
1269 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1270 <m:mtext>such that</m:mtext>
1271 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1272 <m:mtext>(</m:mtext>
1273 <xsl:apply-templates select="*[5]"/>
1274 <m:mtext>)</m:mtext>
1275 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1276 <xsl:apply-templates select="*[6]"/>
1283 <xsl:apply-templates select="*[7]"/>
1296 <!-- Il modo Thread non esiste piu'
1297 <xsl:template match="*" mode="thread">
1298 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1300 <xsl:when test="$name='rw_step'">
1304 <m:mtext>Rewrite</m:mtext>
1305 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1306 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1307 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1308 <m:mtext>with</m:mtext>
1309 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1310 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1311 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1312 <m:mtext>by</m:mtext>
1313 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1314 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1321 <m:mtext mathcolor="Maroon">we get</m:mtext>
1322 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1323 <xsl:apply-templates select="."/>
1332 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1339 <m:mtext mathcolor="Maroon">we get</m:mtext>
1340 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1341 <xsl:apply-templates select="."/>
1347 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1353 <xsl:template match="m:lambda">
1354 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1355 <m:mrow m:xref="{@id}">
1357 <xsl:when test="$charlength >= $framewidth">
1358 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1362 <m:mo mathcolor="Red">λ</m:mo>
1363 <xsl:apply-templates select="m:bvar"/>
1371 <xsl:apply-templates select="*[position()=2]"/>
1378 <m:mo mathcolor="Red">λ</m:mo>
1379 <xsl:apply-templates select="m:bvar/m:ci"/>
1381 <xsl:apply-templates select="m:bvar/m:type"/>
1383 <xsl:apply-templates select="*[position()=2]"/>
1389 <!-- *********************************** -->
1390 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1391 <!-- *********************************** -->
1395 <xsl:template match = "m:apply[m:eq[1]]">
1396 <xsl:variable name="charlength">
1397 <xsl:apply-templates select="*[1]" mode="charcount"/>
1400 <xsl:when test="$charlength >= $framewidth">
1401 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1402 <xsl:if test="@helm:xref">
1403 <xsl:attribute name="m:xref">
1404 <xsl:value-of select="@id"/>
1410 <m:mo stretchy="false">(</m:mo>
1411 <xsl:apply-templates select="*[position()=2]"/>
1415 <xsl:for-each select = "*[position()>2]">
1419 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1420 <m:mo m:xref="{m:in/@id}">=</m:mo>
1421 <xsl:apply-templates select="."/>
1429 <m:mo stretchy="false">)</m:mo>
1436 <xsl:apply-imports/>
1442 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1443 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1444 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1445 |m:prsubset|m:setdiff[1]]">
1446 <xsl:variable name="symbol">
1448 <xsl:when test="m:and[1]">
1449 <xsl:value-of select="'wedge'"/>
1451 <xsl:when test="m:or[1]">
1452 <xsl:value-of select="'vee'"/>
1454 <xsl:when test="m:geq[1]">
1455 <xsl:value-of select="'geq'"/>
1457 <xsl:when test="m:leq[1]">
1458 <xsl:value-of select="'leq'"/>
1460 <xsl:when test="m:gt[1]">
1461 <xsl:value-of select="'gt'"/>
1463 <xsl:when test="m:lt[1]">
1464 <xsl:value-of select="'lt'"/>
1466 <xsl:when test="m:eq[1]">
1467 <xsl:value-of select="'Equal'"/>
1469 <xsl:when test="m:in[1]">
1470 <xsl:value-of select="'Element'"/>
1472 <xsl:when test="m:subset[1]">
1473 <xsl:value-of select="'SubsetEqual'"/>
1475 <xsl:when test="m:prsubset[1]">
1476 <xsl:value-of select="'subset'"/>
1478 <xsl:when test="m:intersect[1]">
1479 <xsl:value-of select="'Intersection'"/>
1481 <xsl:when test="m:union[1]">
1482 <xsl:value-of select="'Union'"/>
1484 <xsl:when test="m:setdiff[1]">
1485 <xsl:value-of select="'Backslash'"/>
1489 <xsl:variable name="charlength">
1490 <xsl:apply-templates select="*[1]" mode="charcount"/>
1493 <xsl:when test="$charlength >= $framewidth">
1494 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1495 <xsl:if test="@helm:xref">
1496 <xsl:attribute name="m:xref">
1497 <xsl:value-of select="@id"/>
1503 <m:mo stretchy="false">(</m:mo>
1504 <xsl:apply-templates select="*[position()=2]"/>
1508 <xsl:for-each select = "*[position()>2]">
1512 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1513 <m:mo m:xref="{*[1]/@id}">
1514 <m:mchar name="{$symbol}"/>
1516 <xsl:apply-templates select="."/>
1524 <m:mo stretchy="false">)</m:mo>
1531 <xsl:apply-imports/>
1536 <xsl:template match = "m:set">
1538 <xsl:when test="count(child::*) = 0">
1540 <m:mchar name="emptyset"/>
1544 <xsl:variable name="charlength">
1545 <xsl:apply-templates select="*[1]" mode="charcount"/>
1548 <xsl:when test="$charlength >= $framewidth">
1550 <xsl:when test="name(*[1]) = 'm:bvar'">
1551 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1555 <m:mo stretchy="false">{</m:mo>
1556 <xsl:apply-templates select="*[position()=1]"/>
1563 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1564 <m:mo stretchy="false">|</m:mo>
1565 <xsl:apply-templates select="m:condition/*[1]"/>
1572 <m:mo stretchy="false">}</m:mo>
1579 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1583 <m:mo stretchy="false">{</m:mo>
1584 <xsl:apply-templates select="*[position()=1]"/>
1585 <xsl:if test="position() != last()">
1591 <xsl:for-each select = "*[position()>2]">
1595 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1596 <xsl:apply-templates select="."/>
1597 <xsl:if test="position() != last()">
1607 <m:mo stretchy="false">}</m:mo>
1616 <xsl:apply-imports/>
1623 <xsl:template match = "m:apply[m:card[1]]">
1624 <m:mfenced open="|" close="|" stretchy="false">
1625 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1626 <xsl:attribute name="m:xref">
1627 <xsl:value-of select="@id"/>
1630 <xsl:apply-templates select="*[2]"/>
1634 <!-- *********************************** -->
1635 <!-- PROOF ELEMENTS -->
1636 <!-- *********************************** -->
1640 <!--**********************-->
1642 <!--**********************-->
1644 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1645 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1646 |m:plus|m:minus|m:times" mode="charcount">
1647 <xsl:param name="incurrent_length" select="0"/>
1649 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1650 <xsl:variable name="siblength">
1651 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1652 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1653 </xsl:apply-templates>
1656 <xsl:when test="string($siblength) = """>
1657 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1660 <xsl:value-of select="number($siblength)"/>
1665 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1670 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1671 <xsl:param name="incurrent_length" select="0"/>
1672 <xsl:param name="nosibling" select="0"/>
1674 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1675 <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>
1677 <xsl:when test="string($siblength) = """>
1678 <xsl:value-of select="$incurrent_length + string-length()"/>
1681 <xsl:value-of select="number($siblength)"/>
1686 <xsl:value-of select="$incurrent_length + string-length()"/>
1691 <xsl:template match="*" mode="charcount">
1692 <xsl:param name="incurrent_length" select="0"/>
1693 <xsl:param name="nosibling" select="0"/>
1695 <xsl:when test="count(child::*) = 0">
1696 <xsl:value-of select="$incurrent_length"/>
1699 <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>
1701 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1702 <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>
1704 <xsl:when test="string($siblength) = """>
1705 <xsl:value-of select="number($childlength)"/>
1708 <xsl:value-of select="number($siblength)"/>
1713 <xsl:value-of select="number($childlength)"/>