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:template match="/">
67 <xsl:processing-instruction name="cocoon-format">type="text/xhtml"</xsl:processing-instruction>
69 <xsl:apply-templates select="*"/>
74 <xsl:template match="Definition">
76 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
80 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
87 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
88 <xsl:apply-templates select="type/*[1]"/>
102 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
103 <xsl:apply-templates select="body/*[1]"/>
113 <xsl:template match="Axiom">
115 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
119 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
126 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
127 <xsl:apply-templates select="type/*[1]"/>
135 <!-- UNFINISHED PROOF -->
137 <xsl:template match="CurrentProof">
139 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
143 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
150 <m:mtext>THESIS:</m:mtext>
157 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
158 <xsl:apply-templates select="type/*[1]"/>
165 <m:mtext>CONJECTURES:</m:mtext>
169 <xsl:for-each select="Conjecture">
173 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
174 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
175 <xsl:apply-templates select="./*[1]"/>
183 <m:mtext>CORRESPONDING PROOF:</m:mtext>
190 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
191 <xsl:apply-templates select="body/*[1]"/>
199 <!-- MUTUAL INDUCTIVE DEFINITION -->
201 <xsl:template match="InductiveDefinition">
203 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
204 <xsl:for-each select="InductiveType">
209 <xsl:when test="position() = 1">
211 <xsl:when test="string(./@inductive) = "true"">
212 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
215 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
220 <m:mtext>AND</m:mtext>
223 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
224 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
231 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
234 <xsl:when test="string(../Param) != """>
235 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
236 <xsl:for-each select="../Param">
240 <m:mi><xsl:value-of select="./@name"/></m:mi>
242 <xsl:apply-templates select="*"/>
266 <m:mtext>OF ARITY</m:mtext>
273 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
274 <xsl:apply-templates select="./arity/*[1]"/>
281 <m:mtext>BUILT FROM</m:mtext>
285 <xsl:for-each select="./Constructor">
290 <xsl:when test="position() = 1">
291 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
295 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
298 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
299 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
300 <xsl:apply-templates select="./*[1]"/>
312 <xsl:template match="Variable">
314 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
318 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
325 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
326 <xsl:apply-templates select="type/*[1]"/>
330 <xsl:if test="name(*[1])='body'">
334 <m:mtext>AS</m:mtext>
341 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
342 <xsl:apply-templates select="body/*[1]"/>
351 <!--**********************-->
353 <!--**********************-->
355 <xsl:template match="m:bvar">
357 <xsl:when test="m:type">
358 <xsl:variable name="charlength">
359 <xsl:apply-templates select="m:ci" mode="charcount"/>
362 <xsl:when test="$charlength >= $framewidth">
363 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
366 <xsl:apply-templates select="m:ci"/>
372 <xsl:apply-templates select="m:type"/>
378 <xsl:apply-templates select="m:ci"/>
380 <xsl:apply-templates select="m:type"/>
385 <xsl:apply-templates select="m:ci"/>
393 <xsl:template match="m:apply[m:csymbol]">
394 <xsl:param name="nopar" select="0"/>
395 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
396 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
398 <xsl:if test="@helm:xref">
399 <xsl:attribute name="m:xref"><xsl:value-of select="@id"/></xsl:attribute>
402 <xsl:when test="$name='forall'">
404 <xsl:when test="$charlength >= $framewidth">
405 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
409 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
410 <xsl:apply-templates select="m:bvar"/>
418 <xsl:apply-templates select="*[position()=3]"/>
425 <m:mo mathcolor="Blue"><m:mchar name="ForAll"/></m:mo>
426 <xsl:apply-templates select="m:bvar/m:ci"/>
428 <xsl:apply-templates select="m:bvar/m:type"/>
430 <xsl:apply-templates select="*[position()=3]"/>
434 <xsl:when test="$name='let_in'">
436 <xsl:when test="$charlength >= $framewidth">
437 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
442 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
443 <xsl:apply-templates select="m:bvar"/>
451 <xsl:apply-templates select="*[position()=3]"/>
459 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
460 <xsl:apply-templates select="*[position()=4]"/>
468 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
469 <xsl:apply-templates select="m:bvar/m:ci"/>
471 <xsl:apply-templates select="*[position()=3]"/>
472 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
473 <m:mtext>IN</m:mtext>
474 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
475 <xsl:apply-templates select="*[position()=4]"/>
479 <xsl:when test="$name='prod'">
481 <xsl:when test="$charlength >= $framewidth">
482 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
486 <m:mo mathcolor="Blue">Π</m:mo>
487 <xsl:apply-templates select="m:bvar"/>
495 <xsl:apply-templates select="*[position()=3]"/>
502 <m:mo mathcolor="Blue">Π</m:mo>
503 <xsl:apply-templates select="m:bvar/m:ci"/>
505 <xsl:apply-templates select="m:bvar/m:type"/>
507 <xsl:apply-templates select="*[position()=3]"/>
511 <xsl:when test="$name='arrow'">
513 <xsl:when test="$charlength >= $framewidth">
514 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
518 <xsl:if test="$nopar=0">
519 <m:mo stretchy="false">(</m:mo>
521 <xsl:apply-templates select="*[position()=2]"/>
528 <m:mo mathmathcolor="Blue">→</m:mo>
530 <xsl:when test="*[position()=3]/m:csymbol">
531 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
533 <xsl:when test="$nextp='arrow'">
534 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
537 <xsl:apply-templates select="*[position()=3]"/>
542 <xsl:apply-templates select="*[position()=3]"/>
548 <xsl:if test="$nopar=0">
552 <m:mo stretchy="false">)</m:mo>
560 <xsl:if test="$nopar=0">
561 <m:mo stretchy="false">(</m:mo>
563 <xsl:apply-templates select="*[position()=2]"/>
564 <m:mo mathcolor="Blue">→</m:mo>
566 <xsl:when test="*[position()=3]/m:csymbol">
567 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
569 <xsl:when test="$nextp='arrow'">
570 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
573 <xsl:apply-templates select="*[position()=3]"/>
578 <xsl:apply-templates select="*[position()=3]"/>
581 <xsl:if test="$nopar=0">
582 <m:mo stretchy="false">)</m:mo>
587 <xsl:when test="$name='app'">
589 <xsl:when test="$charlength >= $framewidth">
590 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
594 <m:mo stretchy="false">(</m:mo>
595 <xsl:apply-templates select="*[position()=2]"/>
599 <xsl:for-each select="*[position()>2]">
603 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
604 <xsl:apply-templates select="."/>
612 <m:mo stretchy="false">)</m:mo>
619 <m:mo stretchy="false">(</m:mo>
620 <xsl:apply-templates select="*[position()=2]"/>
621 <xsl:for-each select="*[position()>2]">
622 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
623 <xsl:apply-templates select="."/>
625 <m:mo stretchy="false">)</m:mo>
629 <xsl:when test="$name='cast'">
631 <xsl:when test="$charlength >= $framewidth">
632 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
636 <m:mo stretchy="false">(</m:mo>
637 <xsl:apply-templates select="*[position()=2]"/>
644 <m:mo mathcolor="Maroon">:></m:mo>
645 <xsl:apply-templates select="*[position()=3]"/>
652 <m:mo stretchy="false">)</m:mo>
659 <m:mo stretchy="false">(</m:mo>
660 <xsl:apply-templates select="*[position()=2]"/>
661 <m:mo mathcolor="Maroon">:></m:mo>
662 <xsl:apply-templates select="*[position()=3]"/>
663 <m:mo stretchy="false">)</m:mo>
667 <xsl:when test="$name='Prop'">
670 <xsl:when test="$name='Set'">
673 <xsl:when test="$name='Type'">
676 <xsl:when test="$name='mutcase'">
678 <xsl:when test="$charlength >= $framewidth">
679 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
680 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
685 <xsl:apply-templates select="*[position()=2]"/>
686 <xsl:if test="$framewidth > $charlength">
689 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
690 <xsl:apply-templates select="*[position()=3]"/>
695 <xsl:if test="$charlength >= $framewidth">
701 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
702 <xsl:apply-templates select="*[position()=3]"/>
714 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
715 <xsl:variable name="charlength"><xsl:apply-templates select="." mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
720 <xsl:when test="position() = 1">
721 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
724 <m:mo stretchy="false">|</m:mo>
727 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
728 <xsl:apply-templates select="."/>
729 <xsl:if test="$framewidth > $charlength">
730 <m:mo mathcolor="Green">⇒</m:mo>
731 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
736 <xsl:if test="$charlength >= $framewidth">
740 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
741 <m:mo mathcolor="Green">⇒</m:mo>
742 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
758 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
760 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
761 <xsl:apply-templates select="*[position()=3]"/>
762 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
764 <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
766 <xsl:when test="position() != 1">
767 <m:mo stretchy="false">|</m:mo>
770 <xsl:apply-templates select="."/>
771 <m:mo mathcolor="Green">⇒</m:mo>
772 <xsl:apply-templates select="following-sibling::*[position()= 1]"/>
774 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
779 <xsl:when test="$name='fix'">
781 <xsl:when test="$charlength >= $framewidth">
782 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
787 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
788 <m:mi><xsl:value-of select="m:ci"/></m:mi>
789 <m:mo stretchy="false">{</m:mo>
796 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
797 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
798 <xsl:for-each select="m:bvar">
799 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
803 <m:mi><xsl:value-of select="m:ci"/></m:mi>
805 <xsl:if test="$framewidth > $charlength">
806 <xsl:apply-templates select="m:type"/>
811 <xsl:if test="$charlength >= $framewidth">
815 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
816 <xsl:apply-templates select="m:type"/>
825 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
837 <m:mo stretchy="false">}</m:mo>
845 <m:mi><xsl:value-of select="m:ci"/></m:mi>
846 <m:mo stretchy="false">{</m:mo>
847 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
848 <xsl:for-each select="m:bvar">
852 <m:mi><xsl:value-of select="m:ci"/></m:mi>
854 <xsl:apply-templates select="m:type"/>
856 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
857 <xsl:if test="position()=last()">
858 <m:mo stretchy="false">}</m:mo>
868 <xsl:when test="$name='cofix'">
870 <xsl:when test="$charlength >= $framewidth">
871 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
876 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
877 <m:mi><xsl:value-of select="m:ci"/></m:mi>
878 <m:mo stretchy="false">{</m:mo>
885 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
886 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
887 <xsl:for-each select="m:bvar">
888 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
892 <m:mi><xsl:value-of select="m:ci"/></m:mi>
894 <xsl:if test="$framewidth > $charlength">
895 <xsl:apply-templates select="m:type"/>
900 <xsl:if test="$charlength >= $framewidth">
904 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
905 <xsl:apply-templates select="m:type"/>
914 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
926 <m:mo stretchy="false">}</m:mo>
934 <m:mi><xsl:value-of select="m:ci"/></m:mi>
935 <m:mo stretchy="false">{</m:mo>
936 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
937 <xsl:for-each select="m:bvar">
941 <m:mi><xsl:value-of select="m:ci"/></m:mi>
943 <xsl:apply-templates select="m:type"/>
945 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
946 <xsl:if test="position()=last()">
947 <m:mo stretchy="false">}</m:mo>
957 <!-- ***************************************** -->
958 <!-- *********** PROOF ELEMENTS ************** -->
959 <!-- ***************************************** -->
960 <xsl:when test="$name='proof'">
961 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
965 <xsl:apply-templates select="*[position()=2]"/>
972 <m:mtext mathcolor="Maroon">we proved </m:mtext>
973 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
974 <xsl:apply-templates select="*[position()=3]"/>
980 <xsl:when test="$name='letin1'">
981 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
985 <xsl:apply-templates select="*[2]"/>
992 <xsl:apply-templates select="*[3]"/>
998 <xsl:when test="$name='letin'">
999 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1000 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
1001 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
1005 <xsl:apply-templates select="."/>
1013 <xsl:apply-templates select="*[position()=last()]"/>
1019 <xsl:when test="$name='let'">
1020 <m:mtext>(</m:mtext>
1021 <xsl:apply-templates select="m:ci"/>
1022 <m:mtext>) </m:mtext>
1023 <xsl:apply-templates select="*[3]"/>
1025 <xsl:when test="$name='rw_step'">
1026 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1031 <xsl:when test="name(*[2])='m:apply'">
1032 <xsl:apply-templates select="*[2]"/>
1035 <m:mtext>Consider</m:mtext>
1036 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1037 <xsl:apply-templates select="*[2]"/>
1046 <m:mtext>Rewrite</m:mtext>
1047 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1048 <xsl:apply-templates select="*[3]"/>
1049 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1050 <m:mtext>with</m:mtext>
1051 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1052 <xsl:apply-templates select="*[4]"/>
1053 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1054 <m:mtext>by</m:mtext>
1055 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1056 <xsl:apply-templates select="*[5]"/>
1062 <!-- not existing any more
1063 <xsl:when test="$name='thread'">
1064 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1069 <xsl:when test="name(*[last()])='m:apply'">
1070 <xsl:apply-templates select="*[last()]"/>
1073 <m:mtext>Consider</m:mtext>
1074 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1075 <xsl:apply-templates select="*[last()]"/>
1081 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1085 <xsl:when test="$name='rewrite_and_apply'">
1086 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1090 <xsl:apply-templates select="*[2]"/>
1097 <m:mtext>Then apply it to</m:mtext>
1098 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1099 <xsl:apply-templates select="*[position()>2]"/>
1106 <xsl:when test="$name='nat_ind'">
1107 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1110 <m:mtext>By induction</m:mtext>
1116 <m:mtext>base case:</m:mtext>
1117 <xsl:apply-templates select="*[2]"/>
1124 <m:mtext>inductive case:</m:mtext>
1125 <xsl:apply-templates select="*[3]"/>
1132 <xsl:when test="$name='and_ind'">
1133 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1138 <xsl:when test="name(*[2])='m:apply'">
1139 <xsl:apply-templates select="*[2]"/>
1142 <m:mtext>Consider</m:mtext>
1143 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1144 <xsl:apply-templates select="*[2]"/>
1153 <m:mtext>In particular, we have</m:mtext>
1160 <m:mtext>(</m:mtext>
1161 <xsl:apply-templates select="*[3]"/>
1162 <m:mtext>)</m:mtext>
1163 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1164 <xsl:apply-templates select="*[4]"/>
1171 <m:mtext>(</m:mtext>
1172 <xsl:apply-templates select="*[5]"/>
1173 <m:mtext>)</m:mtext>
1174 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1175 <xsl:apply-templates select="*[6]"/>
1182 <xsl:apply-templates select="*[7]"/>
1188 <xsl:when test="$name='or_ind'">
1189 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1194 <xsl:when test="name(*[2])='m:apply'">
1195 <xsl:apply-templates select="*[2]"/>
1198 <m:mtext>Consider</m:mtext>
1199 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1200 <xsl:apply-templates select="*[2]"/>
1209 <m:mtext>We prove</m:mtext>
1210 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1211 <xsl:apply-templates select="*[3]"/>
1212 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1213 <m:mtext>by cases:</m:mtext>
1220 <m:mtext>*</m:mtext>
1221 <xsl:apply-templates select="*[4]"/>
1228 <m:mtext>*</m:mtext>
1229 <xsl:apply-templates select="*[5]"/>
1235 <xsl:when test="$name='ex_ind'">
1236 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1241 <xsl:when test="name(*[2])='m:apply'">
1242 <xsl:apply-templates select="*[2]"/>
1245 <m:mtext>Consider</m:mtext>
1246 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1247 <xsl:apply-templates select="*[2]"/>
1256 <m:mtext>Let</m:mtext>
1257 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1258 <xsl:apply-templates select="*[3]"/>
1259 <m:mtext>:</m:mtext>
1260 <xsl:apply-templates select="*[4]"/>
1261 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1262 <m:mtext>such that</m:mtext>
1263 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1264 <m:mtext>(</m:mtext>
1265 <xsl:apply-templates select="*[5]"/>
1266 <m:mtext>)</m:mtext>
1267 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1268 <xsl:apply-templates select="*[6]"/>
1275 <xsl:apply-templates select="*[7]"/>
1288 <!-- Il modo Thread non esiste piu'
1289 <xsl:template match="*" mode="thread">
1290 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1292 <xsl:when test="$name='rw_step'">
1296 <m:mtext>Rewrite</m:mtext>
1297 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1298 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1299 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1300 <m:mtext>with</m:mtext>
1301 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1302 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1303 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1304 <m:mtext>by</m:mtext>
1305 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1306 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1313 <m:mtext mathcolor="Maroon">we get</m:mtext>
1314 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1315 <xsl:apply-templates select="."/>
1324 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1331 <m:mtext mathcolor="Maroon">we get</m:mtext>
1332 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1333 <xsl:apply-templates select="."/>
1339 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1345 <xsl:template match="m:lambda">
1346 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1347 <m:mrow m:xref="{@id}">
1349 <xsl:when test="$charlength >= $framewidth">
1350 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1354 <m:mo mathcolor="Red">λ</m:mo>
1355 <xsl:apply-templates select="m:bvar"/>
1363 <xsl:apply-templates select="*[position()=2]"/>
1370 <m:mo mathcolor="Red">λ</m:mo>
1371 <xsl:apply-templates select="m:bvar/m:ci"/>
1373 <xsl:apply-templates select="m:bvar/m:type"/>
1375 <xsl:apply-templates select="*[position()=2]"/>
1381 <!-- *********************************** -->
1382 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1383 <!-- *********************************** -->
1387 <xsl:template match = "m:apply[m:eq[1]]">
1388 <xsl:variable name="charlength">
1389 <xsl:apply-templates select="*[1]" mode="charcount"/>
1392 <xsl:when test="$charlength >= $framewidth">
1393 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1394 <xsl:if test="@helm:xref">
1395 <xsl:attribute name="m:xref">
1396 <xsl:value-of select="@id"/>
1402 <m:mo stretchy="false">(</m:mo>
1403 <xsl:apply-templates select="*[position()=2]"/>
1407 <xsl:for-each select = "*[position()>2]">
1411 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1412 <m:mo m:xref="{m:in/@id}">=</m:mo>
1413 <xsl:apply-templates select="."/>
1421 <m:mo stretchy="false">)</m:mo>
1428 <xsl:apply-imports/>
1434 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1435 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1436 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1437 |m:prsubset|m:setdiff[1]]">
1438 <xsl:variable name="symbol">
1440 <xsl:when test="m:and[1]">
1441 <xsl:value-of select="'wedge'"/>
1443 <xsl:when test="m:or[1]">
1444 <xsl:value-of select="'vee'"/>
1446 <xsl:when test="m:geq[1]">
1447 <xsl:value-of select="'geq'"/>
1449 <xsl:when test="m:leq[1]">
1450 <xsl:value-of select="'leq'"/>
1452 <xsl:when test="m:gt[1]">
1453 <xsl:value-of select="'gt'"/>
1455 <xsl:when test="m:lt[1]">
1456 <xsl:value-of select="'lt'"/>
1458 <xsl:when test="m:eq[1]">
1459 <xsl:value-of select="'Equal'"/>
1461 <xsl:when test="m:in[1]">
1462 <xsl:value-of select="'Element'"/>
1464 <xsl:when test="m:subset[1]">
1465 <xsl:value-of select="'SubsetEqual'"/>
1467 <xsl:when test="m:prsubset[1]">
1468 <xsl:value-of select="'subset'"/>
1470 <xsl:when test="m:intersect[1]">
1471 <xsl:value-of select="'Intersection'"/>
1473 <xsl:when test="m:union[1]">
1474 <xsl:value-of select="'Union'"/>
1476 <xsl:when test="m:setdiff[1]">
1477 <xsl:value-of select="'Backslash'"/>
1481 <xsl:variable name="charlength">
1482 <xsl:apply-templates select="*[1]" mode="charcount"/>
1485 <xsl:when test="$charlength >= $framewidth">
1486 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1487 <xsl:if test="@helm:xref">
1488 <xsl:attribute name="m:xref">
1489 <xsl:value-of select="@id"/>
1495 <m:mo stretchy="false">(</m:mo>
1496 <xsl:apply-templates select="*[position()=2]"/>
1500 <xsl:for-each select = "*[position()>2]">
1504 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1505 <m:mo m:xref="{*[1]/@id}">
1506 <m:mchar name="{$symbol}"/>
1508 <xsl:apply-templates select="."/>
1516 <m:mo stretchy="false">)</m:mo>
1523 <xsl:apply-imports/>
1528 <xsl:template match = "m:set">
1530 <xsl:when test="count(child::*) = 0">
1532 <m:mchar name="emptyset"/>
1536 <xsl:variable name="charlength">
1537 <xsl:apply-templates select="*[1]" mode="charcount"/>
1540 <xsl:when test="$charlength >= $framewidth">
1542 <xsl:when test="name(*[1]) = 'm:bvar'">
1543 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1547 <m:mo stretchy="false">{</m:mo>
1548 <xsl:apply-templates select="*[position()=1]"/>
1555 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1556 <m:mo stretchy="false">|</m:mo>
1557 <xsl:apply-templates select="m:condition/*[1]"/>
1564 <m:mo stretchy="false">}</m:mo>
1571 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1575 <m:mo stretchy="false">{</m:mo>
1576 <xsl:apply-templates select="*[position()=1]"/>
1577 <xsl:if test="position() != last()">
1583 <xsl:for-each select = "*[position()>2]">
1587 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1588 <xsl:apply-templates select="."/>
1589 <xsl:if test="position() != last()">
1599 <m:mo stretchy="false">}</m:mo>
1608 <xsl:apply-imports/>
1615 <xsl:template match = "m:apply[m:card[1]]">
1616 <m:mfenced open="|" close="|" stretchy="false">
1617 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1618 <xsl:attribute name="m:xref">
1619 <xsl:value-of select="@id"/>
1622 <xsl:apply-templates select="*[2]"/>
1626 <!-- *********************************** -->
1627 <!-- PROOF ELEMENTS -->
1628 <!-- *********************************** -->
1632 <!--**********************-->
1634 <!--**********************-->
1636 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
1637 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
1638 |m:plus|m:minus|m:times" mode="charcount">
1639 <xsl:param name="incurrent_length" select="0"/>
1641 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
1642 <xsl:variable name="siblength">
1643 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
1644 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
1645 </xsl:apply-templates>
1648 <xsl:when test="string($siblength) = """>
1649 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1652 <xsl:value-of select="number($siblength)"/>
1657 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
1662 <xsl:template match="m:ci|m:csymbol" mode="charcount">
1663 <xsl:param name="incurrent_length" select="0"/>
1664 <xsl:param name="nosibling" select="0"/>
1666 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
1667 <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>
1669 <xsl:when test="string($siblength) = """>
1670 <xsl:value-of select="$incurrent_length + string-length()"/>
1673 <xsl:value-of select="number($siblength)"/>
1678 <xsl:value-of select="$incurrent_length + string-length()"/>
1683 <xsl:template match="*" mode="charcount">
1684 <xsl:param name="incurrent_length" select="0"/>
1685 <xsl:param name="nosibling" select="0"/>
1687 <xsl:when test="count(child::*) = 0">
1688 <xsl:value-of select="$incurrent_length"/>
1691 <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>
1693 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
1694 <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>
1696 <xsl:when test="string($siblength) = """>
1697 <xsl:value-of select="number($childlength)"/>
1700 <xsl:value-of select="number($siblength)"/>
1705 <xsl:value-of select="number($childlength)"/>