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"/> -->
44 <xsl:import href="mmlnotation.xsl"/>
46 <xsl:import href="mmltheoryextension.xsl"/>
48 <xsl:key name="sequent_number" use="@id" match="Sequent"/>
50 <xsl:param name="explodeall" select="false()"/>
52 <!--***********************************************************************-->
53 <!-- Parameter affecting line-breaking -->
54 <!--***********************************************************************-->
56 <xsl:variable name="framewidth" select="35"/>
58 <!--***********************************************************************-->
59 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
60 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
61 <!-- sono i termini: la presentation per un termine e' generata come primo -->
62 <!-- figlio di un semantics e l'originario content viene inserito nel -->
63 <!-- nel secondo figlio di semantics, annotation-xml -->
64 <!--***********************************************************************-->
66 <!--**********************-->
68 <!--**********************-->
71 <!--<xsl:key name="variable" use="@name" match="Decl"/> -->
73 <xsl:param name="type" select="'standalone'"/>
75 <xsl:template match="/">
77 <xsl:when test="$type = 'standalone'">
78 <xsl:apply-templates select="*"/>
82 <xsl:apply-templates select="*"/>
91 <xsl:template match="Node">
93 <xsl:when test="count(Node)=0"> <!-- E' una foglia -->
94 <m:mtable align="baseline 1" equalrows="false" columnalign="left" stretchy="false">
98 <m:mtext mathcolor="red">Sequent <xsl:apply-templates select="Sequent/@id"/>
104 <xsl:if test="*[Decl]">
105 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
106 <xsl:for-each select="Sequent/Decl">
107 <m:mtr columnalign="left">
108 <m:mtd columnalign="left">
110 <xsl:variable name="num" select="position()"/>
112 <xsl:value-of select="$num"/>)
114 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
115 <xsl:if test="@name">
116 <m:mo mathcolor="green"><xsl:value-of select="@name"/></m:mo>
117 <m:mo mathcolor="green" stretchy="false">:</m:mo>
119 <xsl:apply-templates select="."/>
129 <m:mtext mathcolor="red" mathvariant="bold">|-</m:mtext>
134 <xsl:apply-templates select="Sequent/Goal"/>
140 <m:mo mathcolor="red">Rule: </m:mo>
142 <xsl:when test="Rule[m:apply]">
143 <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:apply/m:ci"/></m:mo>
145 <xsl:when test="count(Rule)=0">
146 <m:mi>NESSUNA REGOLA</m:mi>
149 <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:ci"/></m:mo>
155 <m:mspace height="1ex"/>
159 <xsl:otherwise> <!--E' un nodo -->
160 <m:mtable equalrows="false" columnalign="left">
162 <m:mtable align="baseline 1" equalrows="false" columnalign="left" stretchy="false">
166 <m:mtext mathcolor="red">Sequent <xsl:apply-templates select="Sequent/@id"/>
172 <xsl:if test="*[Decl]">
173 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
174 <xsl:for-each select="Sequent/Decl">
175 <m:mtr columnalign="left">
176 <m:mtd columnalign="left">
178 <xsl:variable name="num" select="position()"/>
180 <xsl:value-of select="$num"/>)
182 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
183 <xsl:if test="@name">
184 <m:mo mathcolor="green"><xsl:value-of select="@name"/></m:mo>
185 <m:mo mathcolor="green" stretchy="false">:</m:mo>
187 <xsl:apply-templates select="."/>
197 <m:mtext mathcolor="red" mathvariant="bold">|-</m:mtext>
202 <xsl:apply-templates select="Sequent/Goal"/>
208 <m:mo mathcolor="red">Rule: </m:mo>
210 <xsl:when test="Rule[m:apply]">
211 <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:apply/m:ci"/></m:mo>
213 <xsl:when test="count(Rule)=0">
214 <m:mi>NESSUNA REGOLA</m:mi>
217 <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:ci"/></m:mo>
228 <xsl:when test="count(Node)=1">
229 <m:mi mathcolor="blue" mathvariant="script">Subgoal</m:mi>
232 <m:mi mathcolor="blue" mathvariant="script">Subgoals</m:mi>
236 <m:mspace width="1em"/>
237 <m:mtable equalrows="false" columnalign="left">
238 <xsl:for-each select="Node">
240 <xsl:apply-templates select="."/>
242 <m:mspace height="1ex"/>
256 <xsl:template match="Definition">
258 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
262 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
269 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
270 <xsl:apply-templates select="type/*[1]"/>
277 <m:mtext>AS</m:mtext>
284 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
285 <xsl:apply-templates select="body/Node"/> <!-- body/*[1]"/>-->
295 <xsl:template match="Axiom">
297 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
301 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
308 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
309 <xsl:apply-templates select="type/*[1]"/>
317 <!-- UNFINISHED PROOF -->
319 <xsl:template match="CurrentProof">
321 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
325 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
332 <m:mtext>THESIS:</m:mtext>
339 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
340 <xsl:apply-templates select="type/*[1]"/>
347 <m:mtext>CONJECTURES:</m:mtext>
351 <xsl:for-each select="Conjecture">
354 <m:mrow helm:xref="{@helm:xref}">
355 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
356 <xsl:for-each select="Decl|Def|Hidden">
358 <xsl:when test="name(.)='Decl'">
359 <m:mrow helm:xref="{@helm:xref}">
361 <xsl:when test="@name">
362 <m:mi><xsl:value-of select="@name"/></m:mi>
369 <xsl:apply-templates select="./*[1]"/>
372 <xsl:when test="name(.)='Def'">
373 <m:mrow helm:xref="{@helm:xref}">
375 <xsl:when test="@name">
376 <m:mi><xsl:value-of select="@name"/></m:mi>
383 <xsl:apply-templates select="./*[1]"/>
387 <m:mrow helm:xref="{@helm:xref}">
394 <xsl:if test="not (position() = last())">
399 <m:msub><m:mi>?</m:mi><m:mn><xsl:value-of select="@no"/></m:mn></m:msub>
401 <xsl:apply-templates select="./Goal/*[1]"/>
409 <m:mtext>PROOF:</m:mtext>
416 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
417 <xsl:apply-templates select="body/*[1]"/>
425 <!-- MUTUAL INDUCTIVE DEFINITION -->
427 <xsl:template match="InductiveDefinition">
429 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
430 <xsl:for-each select="InductiveType">
435 <xsl:when test="position() = 1">
437 <xsl:when test="string(./@inductive) = "true"">
438 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
441 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
446 <m:mtext>AND</m:mtext>
449 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
450 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
457 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
460 <xsl:when test="string(../Param) != """>
461 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
462 <xsl:for-each select="../Param">
466 <m:mi><xsl:value-of select="./@name"/></m:mi>
468 <xsl:apply-templates select="*"/>
492 <m:mtext>OF ARITY</m:mtext>
499 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
500 <xsl:apply-templates select="./arity/*[1]"/>
507 <m:mtext>BUILT FROM</m:mtext>
511 <xsl:for-each select="./Constructor">
516 <xsl:when test="position() = 1">
517 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
521 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
524 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
525 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
526 <xsl:apply-templates select="./*[1]"/>
538 <xsl:template match="Variable">
540 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
544 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
551 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
552 <xsl:apply-templates select="type/*[1]"/>
556 <xsl:if test="name(*[1])='body'">
560 <m:mtext>AS</m:mtext>
567 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
568 <xsl:apply-templates select="body/*[1]"/>
581 <xsl:template match="Sequent">
582 <xsl:variable name="rowlines">
583 <xsl:for-each select="Decl|Def">
584 <xsl:if test="position() != last()">
585 <xsl:text>none </xsl:text>
588 <xsl:text>solid</xsl:text>
590 <xsl:variable name="no" select="@no"/>
592 <m:mi><xsl:text>?</xsl:text><xsl:value-of select="$no"/></m:mi>
594 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
595 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}" rowlines="{$rowlines}">
596 <xsl:for-each select="Decl|Def">
599 <m:mrow helm:xref="{@helm:xref}">
600 <m:mi><xsl:value-of select="@name"/></m:mi>
602 <xsl:when test="name(.) = 'Decl'">
609 <xsl:apply-templates select="*[1]"/>
614 <xsl:if test="not(Decl|Def)">
618 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
626 <xsl:apply-templates select="Goal/*[1]"/>
634 <!--**********************-->
636 <!--**********************-->
638 <xsl:template match="m:bvar">
640 <xsl:when test="m:type">
641 <xsl:variable name="charlength">
642 <xsl:apply-templates select="m:ci" mode="charcount"/>
645 <xsl:when test="$charlength >= $framewidth">
646 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
650 <xsl:apply-templates select="m:ci"/>
658 <xsl:apply-templates select="m:type"/>
666 <xsl:apply-templates select="m:ci"/>
668 <xsl:apply-templates select="m:type"/>
674 <xsl:apply-templates select="m:ci"/>
679 <xsl:template match="m:apply[m:implies]">
680 <xsl:variable name="charlength"><xsl:apply-templates select="m:implies" mode="charcount"/></xsl:variable>
682 <xsl:when test="$charlength >= $framewidth">
683 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
687 <xsl:apply-templates select="*[2]"/>
695 <xsl:apply-templates select="*[position()=3]"/>
702 <xsl:apply-templates select="*[2]"/>
704 <xsl:apply-templates select="*[position()=3]"/>
711 <xsl:template match="m:apply[m:csymbol]">
712 <xsl:param name="nopar" select="0"/>
713 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
714 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
717 <xsl:attribute name="xref"><xsl:value-of select="@id"/></xsl:attribute>
719 <xsl:variable name="id" select="m:csymbol/@id"/>
722 <xsl:when test="$name='meta'">
724 <xsl:apply-templates select="*[position()=2]"/>
725 <m:mfenced open="[" close="]" separators=";">
726 <xsl:apply-templates select="*[position()>2]"/>
731 <xsl:when test="$name='forall'">
733 <xsl:when test="$charlength >= $framewidth">
734 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
738 <m:mo mathcolor="Blue">∀</m:mo>
739 <xsl:apply-templates select="m:bvar"/>
747 <xsl:apply-templates select="*[position()=3]"/>
754 <m:mo mathcolor="Blue">∀</m:mo>
755 <xsl:apply-templates select="m:bvar/m:ci"/>
757 <xsl:apply-templates select="m:bvar/m:type"/>
759 <xsl:apply-templates select="*[position()=3]"/>
764 <xsl:when test="$name='let_in'">
766 <xsl:when test="$charlength >= $framewidth">
767 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
772 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
773 <xsl:apply-templates select="m:bvar"/>
781 <xsl:apply-templates select="*[position()=3]"/>
789 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
790 <xsl:apply-templates select="*[position()=4]"/>
798 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
799 <xsl:apply-templates select="m:bvar/m:ci"/>
801 <xsl:apply-templates select="*[position()=3]"/>
802 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
803 <m:mtext>IN</m:mtext>
804 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
805 <xsl:apply-templates select="*[position()=4]"/>
810 <xsl:when test="$name='prod'">
812 <xsl:when test="$charlength >= $framewidth">
813 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
817 <m:mo mathcolor="Blue">Π</m:mo>
818 <xsl:apply-templates select="m:bvar"/>
826 <xsl:apply-templates select="*[position()=3]"/>
833 <m:mo mathcolor="Blue">Π</m:mo>
834 <xsl:apply-templates select="m:bvar/m:ci"/>
836 <xsl:apply-templates select="m:bvar/m:type"/>
838 <xsl:apply-templates select="*[position()=3]"/>
843 <xsl:when test="$name='arrow'">
845 <xsl:when test="$charlength >= $framewidth">
846 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
850 <xsl:if test="$nopar=0">
851 <m:mo stretchy="false">(</m:mo>
853 <xsl:apply-templates select="*[position()=2]"/>
860 <m:mo mathmathcolor="Blue">→</m:mo>
862 <xsl:when test="*[position()=3]/m:csymbol">
863 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
865 <xsl:when test="$nextp='arrow'">
866 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
869 <xsl:apply-templates select="*[position()=3]"/>
874 <xsl:apply-templates select="*[position()=3]"/>
880 <xsl:if test="$nopar=0">
884 <m:mo stretchy="false">)</m:mo>
892 <xsl:if test="$nopar=0">
893 <m:mo stretchy="false">(</m:mo>
895 <xsl:apply-templates select="*[position()=2]"/>
896 <m:mo mathcolor="Blue">→</m:mo>
898 <xsl:when test="*[position()=3]/m:csymbol">
899 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
901 <xsl:when test="$nextp='arrow'">
902 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
905 <xsl:apply-templates select="*[position()=3]"/>
910 <xsl:apply-templates select="*[position()=3]"/>
913 <xsl:if test="$nopar=0">
914 <m:mo stretchy="false">)</m:mo>
920 <xsl:when test="$name='type_of'">
922 <xsl:when test="$charlength >= $framewidth">
923 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
927 <xsl:value-of select="*[2]"/>
935 <xsl:apply-templates select="*[3]"/>
943 <xsl:apply-templates select="*[2]"/>
945 <xsl:apply-templates select="*[3]"/>
951 <xsl:when test="$name='product'">
953 <xsl:when test="$charlength >= $framewidth">
954 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
958 <m:mo mathcolor="Blue">Σ</m:mo>
959 <xsl:apply-templates select="m:bvar/m:ci"/>
961 <xsl:apply-templates select="m:bvar/m:type"/>
969 <xsl:apply-templates select="*[position()=3]"/>
977 <m:mo mathcolor="Blue">Σ</m:mo>
978 <xsl:apply-templates select="m:bvar/m:ci"/>
980 <xsl:apply-templates select="m:bvar/m:type"/>
982 <xsl:apply-templates select="*[position()=3]"/>
988 <xsl:when test="$name='product_ind'">
990 <xsl:when test="$charlength >= $framewidth">
991 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
995 <m:mo stretchy="false">(</m:mo>
996 <xsl:apply-templates select="m:type"/>
1003 <m:mo mathcolor="Blue">x</m:mo>
1004 <xsl:apply-templates select="*[position()=3]"/>
1005 <m:mo stretchy="false">)</m:mo>
1013 <m:mo stretchy="false">(</m:mo>
1014 <xsl:apply-templates select="m:type"/>
1015 <m:mo mathcolor="Blue">x</m:mo>
1016 <xsl:apply-templates select="*[position()=3]"/>
1017 <m:mo stretchy="false">)</m:mo>
1023 <xsl:when test="$name='pair'">
1025 <xsl:when test="$charlength >= $framewidth">
1026 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1030 <m:mo mathcolor="Blue"><</m:mo>
1031 <xsl:apply-templates select="*[2]"/>
1032 <m:mtext>, </m:mtext>
1039 <xsl:apply-templates select="*[3]"/>
1040 <m:mo mathcolor="Blue">></m:mo>
1048 <m:mo mathcolor="Blue"><</m:mo>
1049 <xsl:apply-templates select="*[2]"/>
1050 <m:mtext>, </m:mtext>
1051 <xsl:apply-templates select="*[3]"/>
1052 <m:mo mathcolor="Blue">></m:mo>
1058 <xsl:when test="$name='union'">
1060 <xsl:when test="$charlength >= $framewidth">
1061 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1064 <xsl:apply-templates select="*[2]"/>
1070 <m:mo mathcolor="Blue">+</m:mo>
1071 <xsl:apply-templates select="*[3]"/>
1079 <xsl:apply-templates select="*[2]"/>
1080 <m:mo mathcolor="Blue">+</m:mo>
1081 <xsl:apply-templates select="*[3]"/>
1087 <xsl:when test="$name='inl'">
1089 <m:mo stretchy="false" mathcolor="Blue">inl(</m:mo>
1090 <xsl:apply-templates select="*[position()=2]"/>
1091 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1095 <xsl:when test="$name='inr'">
1097 <m:mo stretchy="false" mathcolor="Blue">inr(</m:mo>
1098 <xsl:apply-templates select="*[position()=2]"/>
1099 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1103 <xsl:when test="$name='Ax'">
1104 <m:mo mathcolor="Blue">Ax</m:mo>
1107 <xsl:when test="$name='void'">
1108 <m:mo mathcolor="Blue">Void</m:mo>
1111 <xsl:when test="$name='atom'">
1112 <m:mo mathcolor="Blue">Atom</m:mo>
1115 <xsl:when test="$name='universe'">
1118 <xsl:apply-templates select="m:cn"/>
1122 <xsl:when test="$name='prop'">
1125 <xsl:apply-templates select="m:cn"/>
1129 <xsl:when test="$name='equal'">
1131 <xsl:when test="$charlength >= $framewidth">
1132 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1135 <xsl:apply-templates select="*[position()=3]"/>
1141 <m:mo mathcolor="Blue">=</m:mo>
1142 <xsl:apply-templates select="*[position()=4]"/>
1149 <m:mo mathcolor="Blue">∈</m:mo>
1150 <xsl:apply-templates select="*[position()=2]"/>
1158 <xsl:apply-templates select="*[position()=3]"/>
1159 <m:mo mathcolor="Blue">=</m:mo>
1160 <xsl:apply-templates select="*[position()=4]"/>
1161 <m:mo mathcolor="Blue">∈</m:mo>
1162 <xsl:apply-templates select="*[position()=2]"/>
1168 <xsl:when test="$name='token'">
1170 <m:mo mathcolor="Blue">"</m:mo>
1171 <xsl:apply-templates select="m:ci"/>
1172 <m:mo mathcolor="Blue">"</m:mo>
1176 <xsl:when test="$name='nil'">
1177 <m:mo mathcolor="Blue">[]</m:mo>
1180 <xsl:when test="$name='cons'">
1182 <xsl:when test="$charlength >= $framewidth">
1183 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1186 <xsl:apply-templates select="*[2]"/>
1192 <m:mo mathcolor="Blue">::</m:mo>
1193 <xsl:apply-templates select="*[3]"/>
1201 <xsl:apply-templates select="*[2]"/>
1202 <m:mo mathcolor="Blue">::</m:mo>
1203 <xsl:apply-templates select="*[3]"/>
1210 <xsl:when test="$name='rec'">
1212 <xsl:when test="$charlength >= $framewidth">
1213 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1217 <m:mo>rectype</m:mo>
1218 <xsl:apply-templates select="*[2]"/>
1226 <xsl:apply-templates select="*[3]"/>
1234 <m:mo>rectype</m:mo>
1235 <xsl:apply-templates select="*[2]"/>
1237 <xsl:apply-templates select="*[3]"/>
1244 <xsl:when test="$name='t_set'">
1246 <xsl:when test="$charlength >= $framewidth">
1247 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1251 <m:mo mathcolor="Blue" stretchy="false">{</m:mo>
1253 <xsl:when test="m:bvar/m:ci">
1254 <xsl:apply-templates select="m:bvar/m:ci"/>
1255 <m:mo mathcolor="Blue">:</m:mo>
1256 <xsl:apply-templates select="m:bvar/m:type"/>
1259 <xsl:apply-templates select="m:bvar/m:type"/>
1268 <m:mo mathcolor="Blue" stretchy="false">|</m:mo>
1269 <xsl:apply-templates select="*[3]"/>
1270 <m:mo mathcolor="Blue" stretchy="false">}</m:mo>
1278 <m:mo mathcolor="Blue" stretchy="false">{</m:mo>
1280 <xsl:when test="m:bvar/m:ci">
1281 <xsl:apply-templates select="m:bvar/m:ci"/>
1282 <m:mo mathcolor="Blue">:</m:mo>
1283 <xsl:apply-templates select="m:bvar/m:type"/>
1286 <xsl:apply-templates select="m:bvar/m:type"/>
1289 <m:mo mathcolor="Blue" stretchy="false">|</m:mo>
1290 <xsl:apply-templates select="*[3]"/>
1291 <m:mo mathcolor="Blue" stretchy="false">}</m:mo>
1298 <xsl:when test="$name='isect'">
1300 <xsl:when test="$charlength >= $framewidth">
1301 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1305 <m:mo mathcolor="Blue">Ç</m:mo>
1306 <xsl:apply-templates select="m:bvar/m:ci"/>
1307 <m:mo mathcolor="Blue">:</m:mo>
1308 <xsl:apply-templates select="m:bvar/m:type"/>
1315 <m:mo mathcolor="Blue">.</m:mo>
1316 <xsl:apply-templates select="*[3]"/>
1324 <m:mo mathcolor="Blue">Ç</m:mo>
1325 <xsl:apply-templates select="m:bvar/m:ci"/>
1326 <m:mo mathcolor="Blue">:</m:mo>
1327 <xsl:apply-templates select="m:bvar/m:type"/>
1328 <m:mo mathcolor="Blue">.</m:mo>
1329 <xsl:apply-templates select="*[3]"/>
1335 <xsl:when test="$name='quotient'">
1337 <xsl:when test="$charlength >= $framewidth">
1338 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1342 <xsl:apply-templates select="m:bvar[1]"/>
1343 <m:mo mathcolor="Blue">,</m:mo>
1344 <xsl:apply-templates select="m:bvar[2]"/>
1345 <m:mo mathcolor="Blue">:</m:mo>
1346 <xsl:apply-templates select="*[2]"/>
1353 <m:mo mathcolor="Blue">//</m:mo>
1354 <xsl:apply-templates select="*[5]"/>
1362 <xsl:apply-templates select="m:bvar[1]"/>
1363 <m:mo mathcolor="Blue">,</m:mo>
1364 <xsl:apply-templates select="m:bvar[2]"/>
1365 <m:mo mathcolor="Blue">:</m:mo>
1366 <xsl:apply-templates select="*[2]"/>
1367 <m:mo mathcolor="Blue">//</m:mo>
1368 <xsl:apply-templates select="*[5]"/>
1373 <!-- IF_THEN_ELSE -->
1374 <xsl:when test="$name='if_then_else'">
1376 <xsl:when test="$charlength >= $framewidth">
1377 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1382 <xsl:when test="m:where = 'atom_eq'">
1383 <m:mo stretchy="false" mathcolor="Blue">atom_eq (</m:mo>
1385 <xsl:when test="m:where = 'int_eq'">
1386 <m:mo stretchy="false" mathcolor="Blue">int_eq (</m:mo>
1388 <xsl:when test="m:where = 'less'">
1389 <m:mo stretchy="false" mathcolor="Blue">less (</m:mo>
1392 <xsl:apply-templates select="*[3]"/>
1393 <m:mo mathcolor="Blue">;</m:mo>
1400 <xsl:apply-templates select="*[4]"/>
1401 <m:mo mathcolor="Blue">;</m:mo>
1408 <xsl:apply-templates select="*[5]"/>
1409 <m:mo mathcolor="Blue">;</m:mo>
1416 <xsl:apply-templates select="*[6]"/>
1417 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1426 <xsl:when test="m:where = 'atom_eq'">
1427 <m:mo stretchy="false" mathcolor="Blue">atom_eq (</m:mo>
1429 <xsl:when test="m:where = 'int_eq'">
1430 <m:mo stretchy="false" mathcolor="Blue">int_eq (</m:mo>
1432 <xsl:when test="m:where = 'less'">
1433 <m:mo stretchy="false" mathcolor="Blue">less (</m:mo>
1436 <xsl:apply-templates select="*[3]"/>
1437 <m:mo mathcolor="Blue">;</m:mo>
1438 <xsl:apply-templates select="*[4]"/>
1439 <m:mo mathcolor="Blue">;</m:mo>
1440 <xsl:apply-templates select="*[5]"/>
1441 <m:mo mathcolor="Blue">;</m:mo>
1442 <xsl:apply-templates select="*[6]"/>
1443 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1449 <xsl:when test="$name='so_lambda'">
1451 <xsl:when test="($charlength - 4) >= $framewidth">
1452 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1456 <m:mo mathcolor="red">λ</m:mo>
1457 <xsl:apply-templates select="m:apply[1]/*[2]"/>
1465 <xsl:apply-templates select="*[3]"/>
1473 <m:mo mathcolor="red">λ</m:mo>
1474 <xsl:apply-templates select="m:apply[1]/m:ci[2]"/>
1476 <xsl:apply-templates select="*[3]"/>
1482 <xsl:when test="$name='so_apply'">
1484 <xsl:when test="($charlength - 4) >= $framewidth">
1485 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1489 <m:mo stretchy="false">(</m:mo>
1490 <xsl:apply-templates select="*[position()=2]">
1491 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1492 </xsl:apply-templates>
1496 <xsl:for-each select="*[position()>2]">
1500 <m:mphantom stretchy="false"><m:mtext>(</m:mtext></m:mphantom>
1501 <xsl:apply-templates select=".">
1502 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1503 </xsl:apply-templates>
1511 <m:mo stretchy="false">)</m:mo>
1518 <m:mo stretchy="false">(</m:mo>
1519 <xsl:apply-templates select="*[position()=2]">
1520 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1521 </xsl:apply-templates>
1522 <xsl:for-each select="*[position()>2]">
1523 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1524 <xsl:apply-templates select=".">
1525 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1526 </xsl:apply-templates>
1528 <m:mo stretchy="false">)</m:mo>
1533 <xsl:when test="$name='cast'">
1535 <xsl:when test="$charlength >= $framewidth">
1536 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1540 <m:mo stretchy="false">(</m:mo>
1541 <xsl:apply-templates select="*[position()=2]"/>
1548 <m:mo mathcolor="Maroon">:></m:mo>
1549 <xsl:apply-templates select="*[position()=3]"/>
1556 <m:mo stretchy="false">)</m:mo>
1563 <m:mo stretchy="false">(</m:mo>
1564 <xsl:apply-templates select="*[position()=2]"/>
1565 <m:mo mathcolor="Maroon">:></m:mo>
1566 <xsl:apply-templates select="*[position()=3]"/>
1567 <m:mo stretchy="false">)</m:mo>
1572 <xsl:when test="$name='app'">
1574 <xsl:when test="$charlength >= $framewidth">
1575 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1579 <m:mo stretchy="false">(</m:mo>
1580 <!-- added precedence to app = FUNCTION_PREC (99) -->
1581 <xsl:apply-templates select="*[position()=2]">
1582 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1583 </xsl:apply-templates>
1587 <xsl:for-each select="*[position()>2]">
1591 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
1592 <!-- added precedence to app = FUNCTION_PREC (99) -->
1593 <xsl:apply-templates select=".">
1594 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1595 </xsl:apply-templates>
1603 <m:mo stretchy="false">)</m:mo>
1610 <m:mo stretchy="false">(</m:mo>
1611 <!-- added precedence to app = FUNCTION_PREC (99) -->
1612 <xsl:apply-templates select="*[position()=2]">
1613 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1614 </xsl:apply-templates>
1615 <xsl:for-each select="*[position()>2]">
1616 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1617 <!-- added precedence to app = FUNCTION_PREC (99) -->
1618 <xsl:apply-templates select=".">
1619 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1620 </xsl:apply-templates>
1622 <m:mo stretchy="false">)</m:mo>
1627 <xsl:when test="$name='cast'">
1629 <xsl:when test="$charlength >= $framewidth">
1630 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1634 <m:mo stretchy="false">(</m:mo>
1635 <xsl:apply-templates select="*[position()=2]"/>
1642 <m:mo mathcolor="Maroon">:></m:mo>
1643 <xsl:apply-templates select="*[position()=3]"/>
1650 <m:mo stretchy="false">)</m:mo>
1657 <m:mo stretchy="false">(</m:mo>
1658 <xsl:apply-templates select="*[position()=2]"/>
1659 <m:mo mathcolor="Maroon">:></m:mo>
1660 <xsl:apply-templates select="*[position()=3]"/>
1661 <m:mo stretchy="false">)</m:mo>
1666 <!--<xsl:when test="$name='Prop'">
1670 <!--<xsl:when test="$name='Set'">
1674 <!--<xsl:when test="$name='Type'">
1678 <xsl:when test="$name='mutcase'">
1680 <xsl:when test="$charlength >= $framewidth">
1681 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1682 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1687 <xsl:apply-templates select="*[position()=2]"/>
1688 <xsl:if test="$framewidth > $charlength">
1691 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1692 <xsl:apply-templates select="*[position()=3]"/>
1697 <xsl:if test="$charlength >= $framewidth">
1703 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1704 <xsl:apply-templates select="*[position()=3]"/>
1716 <xsl:for-each select="m:piecewise/m:piece">
1717 <xsl:variable name="charlength"><xsl:apply-templates select="./*[2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1722 <xsl:when test="position() = 1">
1723 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
1726 <m:mo stretchy="false">|</m:mo>
1729 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1730 <xsl:apply-templates select="./*[2]"/>
1731 <xsl:if test="$framewidth > $charlength">
1732 <m:mo mathcolor="Green">⇒</m:mo>
1733 <xsl:apply-templates select="./*[1]"/>
1738 <xsl:if test="$charlength >= $framewidth">
1742 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
1743 <m:mo mathcolor="Green">⇒</m:mo>
1744 <xsl:apply-templates select="./*[1]"/>
1760 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
1762 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1763 <xsl:apply-templates select="*[position()=3]"/>
1764 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1766 <xsl:for-each select="m:piecewise/m:piece">
1768 <xsl:when test="position() != 1">
1769 <m:mo stretchy="false">|</m:mo>
1772 <xsl:apply-templates select="./*[2]"/>
1773 <m:mo mathcolor="Green">⇒</m:mo>
1774 <xsl:apply-templates select="./*[1]"/>
1776 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1782 <xsl:when test="$name='fix'">
1784 <xsl:when test="$charlength >= $framewidth">
1785 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1790 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1791 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1792 <m:mo stretchy="false">{</m:mo>
1799 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1800 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1801 <xsl:for-each select="m:bvar">
1802 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1806 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1808 <xsl:if test="$framewidth > $charlength">
1809 <xsl:apply-templates select="m:type"/>
1814 <xsl:if test="$charlength >= $framewidth">
1818 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
1819 <xsl:apply-templates select="m:type"/>
1828 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1840 <m:mo stretchy="false">}</m:mo>
1848 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1849 <m:mo stretchy="false">{</m:mo>
1850 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1851 <xsl:for-each select="m:bvar">
1855 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1857 <xsl:apply-templates select="m:type"/>
1859 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1860 <xsl:if test="position()=last()">
1861 <m:mo stretchy="false">}</m:mo>
1872 <xsl:when test="$name='cofix'">
1874 <xsl:when test="$charlength >= $framewidth">
1875 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1880 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1881 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1882 <m:mo stretchy="false">{</m:mo>
1889 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1890 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1891 <xsl:for-each select="m:bvar">
1892 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1896 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1898 <xsl:if test="$framewidth > $charlength">
1899 <xsl:apply-templates select="m:type"/>
1904 <xsl:if test="$charlength >= $framewidth">
1908 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
1909 <xsl:apply-templates select="m:type"/>
1918 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1930 <m:mo stretchy="false">}</m:mo>
1938 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1939 <m:mo stretchy="false">{</m:mo>
1940 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1941 <xsl:for-each select="m:bvar">
1945 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1947 <xsl:apply-templates select="m:type"/>
1949 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1950 <xsl:if test="position()=last()">
1951 <m:mo stretchy="false">}</m:mo>
1961 <!-- ***************************************** -->
1962 <!-- *********** PROOF ELEMENTS ************** -->
1963 <!-- ***************************************** -->
1965 <xsl:when test="$name='proof'">
1966 <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
1967 <xsl:variable name="test" select="(not($explodeall)) and
1968 (not(preceding-sibling::*[1]/text()='letin1')) and
1969 (not(preceding-sibling::*[1]/text()='rw_step')) and
1970 (not(name(..)='m:lambda'))"/>
1971 <xsl:variable name="hidden_details">
1972 <xsl:if test="$test">
1973 <!-- Details hided (default) -->
1974 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1978 <m:mtext mathcolor="Red">We can prove</m:mtext>
1979 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1980 <!-- the last child is either the expected type, if provided,-->
1981 <!-- or the synthesized type. -->
1982 <xsl:apply-templates select="*[position()=last()]"/>
1984 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1985 <m:mtext mathcolor="Green">(explain)</m:mtext>
1993 <xsl:variable name="shown_details">
1994 <!-- Show details -->
1995 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1999 <xsl:apply-templates select="*[position()=2]"/>
2003 <xsl:variable name="hidedetails">
2006 <m:mtext>_</m:mtext>
2008 <xsl:if test="$test">
2009 <m:mtext mathcolor="Green">(hide details)</m:mtext>
2016 <m:mtext mathcolor="Red">we proved</m:mtext>
2017 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2018 <xsl:apply-templates select="*[position()=3]"/>
2019 <xsl:if test="not(*[4])">
2020 <xsl:copy-of select="$hidedetails"/>
2025 <xsl:if test="*[4]">
2029 <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
2030 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2031 <xsl:apply-templates select="*[position()=4]"/>
2032 <xsl:copy-of select="$hidedetails"/>
2040 <xsl:when test="$test">
2041 <m:maction actiontype="toggle">
2042 <xsl:copy-of select="$hidden_details"/>
2043 <xsl:copy-of select="$shown_details"/>
2047 <xsl:copy-of select="$shown_details"/>
2052 <xsl:when test="$name='side_proof'">
2053 <xsl:variable name="test" select="(not($explodeall))"/>
2054 <xsl:variable name="hidden_details">
2055 <xsl:if test="$test">
2056 <!-- Details hided (default) -->
2057 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2061 <m:mtext mathcolor="Red">We can prove</m:mtext>
2062 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2063 <!-- the last child is either the expected type, if provided,-->
2064 <!-- or the synthesized type. -->
2065 <xsl:apply-templates select="*[position()=last()]"/>
2067 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2068 <m:mtext mathcolor="Green">(explain)</m:mtext>
2076 <xsl:variable name="shown_details">
2077 <!-- Show details -->
2078 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2082 <xsl:apply-templates select="*[position()=2]"/>
2086 <xsl:variable name="hidedetails">
2089 <m:mtext>_</m:mtext>
2091 <xsl:if test="$test">
2092 <m:mtext mathcolor="Green">(hide details)</m:mtext>
2099 <m:mtext mathcolor="Red">we proved</m:mtext>
2100 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2101 <xsl:apply-templates select="*[position()=3]"/>
2102 <xsl:if test="not(*[4])">
2103 <xsl:copy-of select="$hidedetails"/>
2108 <xsl:if test="*[4]">
2112 <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
2113 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2114 <xsl:apply-templates select="*[position()=4]"/>
2115 <xsl:copy-of select="$hidedetails"/>
2123 <xsl:when test="$test">
2124 <m:maction actiontype="toggle">
2125 <xsl:copy-of select="$hidden_details"/>
2126 <xsl:copy-of select="$shown_details"/>
2130 <xsl:copy-of select="$shown_details"/>
2135 <xsl:when test="$name='letin1'">
2136 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2140 <xsl:apply-templates select="*[position()=2]"/>
2147 <xsl:apply-templates select="*[position()=3]"/>
2153 <xsl:when test="$name='by_induction'">
2154 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2158 <m:mtext mathcolor="Red">We prove</m:mtext>
2159 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2160 <xsl:apply-templates select="../*[3]"/>
2167 <m:mtext mathcolor="Red">by induction on</m:mtext>
2168 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2169 <xsl:apply-templates
2170 select="*[position()=last()]/*[position()=last()]"/>
2177 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2178 <xsl:for-each select="*[position()>3 and not(position()=last())]">
2182 <xsl:apply-templates select="."/>
2193 <!-- inductive_case -->
2194 <xsl:when test="$name='inductive_case'">
2195 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2199 <m:mtext mathcolor="Red">Case</m:mtext>
2200 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2201 <xsl:apply-templates select="*[2]"/>
2208 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2209 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2210 <xsl:if test="*[3]/*[position()>1]">
2214 <m:mtext mathcolor="Red">By induction hypothesis, we have:</m:mtext>
2221 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2222 <xsl:for-each select="*[3]/*[position()>1]">
2223 <m:mo stretchy="false">(</m:mo>
2224 <xsl:apply-templates select="m:ci"/>
2225 <m:mo stretchy="false">) </m:mo>
2226 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2227 <xsl:apply-templates select="m:type"/>
2236 <xsl:apply-templates select="*[4]"/>
2247 <xsl:when test="$name='case_lhs'">
2250 <xsl:when test="count(*)=2">
2251 <xsl:apply-templates select="*[2]"/>
2254 <m:mo stretchy="false">(</m:mo>
2255 <xsl:apply-templates select="*[2]"/>
2256 <xsl:for-each select="m:bvar">
2257 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2258 <xsl:apply-templates select="*[1]"/>
2259 <m:mtext>:</m:mtext>
2260 <xsl:apply-templates select="m:type/*[1]"/>
2262 <m:mo stretchy="false">)</m:mo>
2268 <xsl:when test="$name='false_ind'">
2269 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2273 <xsl:apply-templates select="*[3]"/>
2280 <m:mtext mathcolor="Red">Contradiction.</m:mtext>
2287 <xsl:when test="$name='letin'">
2288 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2289 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
2290 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
2294 <xsl:apply-templates select="."/>
2302 <xsl:apply-templates select="*[position()=last()]"/>
2309 <xsl:when test="$name='let'">
2310 <m:mtext>(</m:mtext>
2311 <xsl:apply-templates select="m:ci"/>
2312 <m:mtext>) </m:mtext>
2313 <xsl:apply-templates select="*[3]"/>
2316 <xsl:when test="$name='rw_step'">
2317 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2322 <xsl:when test="name(*[2])='m:apply'">
2323 <xsl:apply-templates select="*[2]"/>
2326 <m:mtext>Consider</m:mtext>
2327 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2328 <xsl:apply-templates select="*[2]"/>
2337 <m:mtext>Rewrite</m:mtext>
2338 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2339 <xsl:apply-templates select="*[3]"/>
2340 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2341 <m:mtext>with</m:mtext>
2342 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2343 <xsl:apply-templates select="*[4]"/>
2344 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2345 <m:mtext>by</m:mtext>
2346 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2347 <xsl:apply-templates select="*[5]"/>
2353 <!-- not existing any more
2354 <xsl:when test="$name='thread'">
2355 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2360 <xsl:when test="name(*[last()])='m:apply'">
2361 <xsl:apply-templates select="*[last()]"/>
2364 <m:mtext>Consider</m:mtext>
2365 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2366 <xsl:apply-templates select="*[last()]"/>
2372 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
2376 <!-- REWRITE_AND_APPLY -->
2377 <xsl:when test="$name='rewrite_and_apply'">
2378 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2382 <xsl:apply-templates select="*[2]"/>
2389 <m:mtext>Then apply it to</m:mtext>
2390 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2391 <xsl:apply-templates select="*[position()>2]"/>
2398 <xsl:when test="$name='and_ind'">
2399 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2404 <xsl:when test="name(*[2])='m:apply'">
2405 <xsl:apply-templates select="*[2]"/>
2408 <m:mtext>Consider</m:mtext>
2409 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2410 <xsl:apply-templates select="*[2]"/>
2419 <m:mtext>In particular, we have</m:mtext>
2426 <m:mtext>(</m:mtext>
2427 <xsl:apply-templates select="*[3]"/>
2428 <m:mtext>)</m:mtext>
2429 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2430 <xsl:apply-templates select="*[4]"/>
2437 <m:mtext>(</m:mtext>
2438 <xsl:apply-templates select="*[5]"/>
2439 <m:mtext>)</m:mtext>
2440 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2441 <xsl:apply-templates select="*[6]"/>
2448 <xsl:apply-templates select="*[7]"/>
2454 <!-- full_or_ind -->
2455 <xsl:when test="$name='full_or_ind'">
2456 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2461 <xsl:when test="name(*[2])='m:apply'">
2462 <xsl:apply-templates select="*[2]"/>
2465 <m:mtext>Consider</m:mtext>
2466 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2467 <xsl:apply-templates select="*[2]"/>
2476 <m:mtext>We proceed by cases to prove</m:mtext>
2477 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2478 <xsl:apply-templates select="*[3]"/>
2485 <m:mtext>Left: suppose</m:mtext>
2486 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2487 <m:mo stretchy="false">(</m:mo>
2488 <xsl:apply-templates select="*[4]/m:bvar/m:ci"/>
2489 <m:mo stretchy="false">)</m:mo>
2490 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2491 <xsl:apply-templates select="*[4]/m:bvar/m:type/*[1]"/>
2498 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2499 <xsl:apply-templates select="*[4]/*[3]"/>
2506 <m:mtext>Right: suppose</m:mtext>
2507 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2508 <m:mo stretchy="false">(</m:mo>
2509 <xsl:apply-templates select="*[5]/m:bvar/m:ci"/>
2510 <m:mo stretchy="false">)</m:mo>
2511 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2512 <xsl:apply-templates select="*[5]/m:bvar/m:type/*[1]"/>
2519 <xsl:apply-templates select="*[5]/*[3]"/>
2526 <xsl:when test="$name='or_ind'">
2527 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2532 <xsl:when test="name(*[2])='m:apply'">
2533 <xsl:apply-templates select="*[2]"/>
2536 <m:mtext>Consider</m:mtext>
2537 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2538 <xsl:apply-templates select="*[2]"/>
2547 <m:mtext>We prove</m:mtext>
2548 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2549 <xsl:apply-templates select="*[3]"/>
2550 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2551 <m:mtext>by cases:</m:mtext>
2558 <m:mtext>Left</m:mtext>
2559 <xsl:apply-templates select="*[4]"/>
2566 <m:mtext>Right</m:mtext>
2567 <xsl:apply-templates select="*[5]"/>
2574 <xsl:when test="$name='ex_ind'">
2575 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2580 <xsl:when test="name(*[2])='m:apply'">
2581 <xsl:apply-templates select="*[2]"/>
2584 <m:mtext>Consider</m:mtext>
2585 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2586 <xsl:apply-templates select="*[2]"/>
2595 <m:mtext>Let</m:mtext>
2596 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2597 <xsl:apply-templates select="*[3]"/>
2598 <m:mtext>:</m:mtext>
2599 <xsl:apply-templates select="*[4]"/>
2600 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2601 <m:mtext>such that</m:mtext>
2602 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2603 <m:mtext>(</m:mtext>
2604 <xsl:apply-templates select="*[5]"/>
2605 <m:mtext>)</m:mtext>
2606 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2607 <xsl:apply-templates select="*[6]"/>
2614 <xsl:apply-templates select="*[7]"/>
2621 <xsl:when test="$name='eq_chain'">
2622 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2626 <m:mtext mathcolor="Red">We have the following equality chain:</m:mtext>
2630 <xsl:for-each select="*[position() mod 2 = 0]">
2631 <xsl:variable name="pos" select="position()"/>
2636 <xsl:when test="$pos = 1">
2637 <xsl:apply-templates select="."/>
2638 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2643 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2644 <xsl:apply-templates select="."/>
2650 <xsl:if test="$pos != last()">
2654 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
2655 <xsl:apply-templates select="../*[position()=2*$pos +1]"/>
2663 <!-- DISEQ_CHAIN -->
2664 <xsl:when test="$name='diseq_chain'">
2665 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2669 <m:mtext mathcolor="Red">We have the following disequality chain:</m:mtext>
2673 <xsl:for-each select="*[position() mod 3 = 2]">
2674 <xsl:variable name="pos" select="position()"/>
2679 <xsl:when test="$pos = 1">
2680 <xsl:apply-templates select="."/>
2681 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2682 <mo><xsl:apply-templates select="../*[position()=3*$pos]"/></mo>
2685 <mo><xsl:apply-templates select="../*[position()=3*($pos - 1)]"/></mo>
2686 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2687 <xsl:apply-templates select="."/>
2693 <xsl:if test="$pos != last()">
2697 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
2698 <xsl:apply-templates select="../*[position()=3*$pos +1]"/>
2706 <!-- ***************************************** -->
2707 <!-- *********** NOTATIONS ******************* -->
2708 <!-- ***************************************** -->
2710 <xsl:when test="$name='subst'">
2711 <xsl:apply-templates select="*[3]"/>
2712 <!-- no font for ApplyFunction: <m:mo></m:mo> -->
2713 <m:mo stretchy="false">[</m:mo>
2714 <xsl:apply-templates select="*[4]"/>
2715 <m:mo mathcolor="Green">
2716 <xsl:if test="$id != ''">
2717 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2718 </xsl:if>←</m:mo>
2719 <xsl:apply-templates select="*[2]"/>
2720 <m:mo stretchy="false">]</m:mo>
2723 <xsl:when test="$name='lift'">
2725 <m:mo mathcolor="Green">
2726 <xsl:if test="$id != ''">
2727 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2728 </xsl:if>↑</m:mo>
2729 <xsl:apply-templates select="*[2]"/>
2732 <m:mo stretchy="false">(</m:mo>
2733 <xsl:apply-templates select="*[3]"/>
2734 <m:mo stretchy="false">)</m:mo>
2737 <!-- lift_with_base -->
2738 <xsl:when test="$name='lift_with_base'">
2740 <m:mo mathcolor="Green">
2741 <xsl:if test="$id != ''">
2742 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2743 </xsl:if>↑</m:mo>
2744 <xsl:apply-templates select="*[3]"/>
2745 <xsl:apply-templates select="*[4]"/>
2748 <m:mo stretchy="false">(</m:mo>
2749 <xsl:apply-templates select="*[2]"/>
2750 <m:mo stretchy="false">)</m:mo>
2754 <xsl:when test="$name='beta_red1'">
2755 <xsl:apply-templates select="*[2]"/>
2757 <m:mo mathcolor="Green">
2758 <xsl:if test="$id != ''">
2759 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2760 </xsl:if>→</m:mo>
2761 <m:mi mathcolor="Green">β</m:mi>
2763 <xsl:apply-templates select="*[3]"/>
2766 <xsl:when test="$name='beta_red'">
2767 <xsl:apply-templates select="*[2]"/>
2769 <m:mo mathcolor="Green">
2770 <xsl:if test="$id != ''">
2771 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2772 </xsl:if>→</m:mo>
2773 <m:mi mathcolor="Green">β</m:mi>
2774 <m:mi mathcolor="Green">*</m:mi>
2776 <xsl:apply-templates select="*[3]"/>
2778 <!-- par_beta_red1 -->
2779 <xsl:when test="$name='par_beta_red1'">
2780 <xsl:apply-templates select="*[2]"/>
2782 <m:mo mathcolor="Green">
2783 <xsl:if test="$id != ''">
2784 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2785 </xsl:if>⇒</m:mo>
2786 <m:mi mathcolor="Green">β</m:mi>
2788 <xsl:apply-templates select="*[3]"/>
2790 <!-- par_beta_red -->
2791 <xsl:when test="$name='par_beta_red'">
2792 <xsl:apply-templates select="*[2]"/>
2794 <m:mo mathcolor="Green">
2795 <xsl:if test="$id != ''">
2796 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2797 </xsl:if>⇒</m:mo>
2798 <m:mi mathcolor="Green">β</m:mi>
2799 <m:mi mathcolor="Green">*</m:mi>
2801 <xsl:apply-templates select="*[3]"/>
2804 <xsl:when test="$name='forgetful'">
2805 <m:mfenced open="|" close="|">
2806 <xsl:if test="$id != ''">
2807 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2809 <xsl:apply-templates select="*[2]"/>
2813 <xsl:when test="$name='isomorphic'">
2814 <xsl:apply-templates select="*[2]"/>
2815 <m:mo mathcolor="Green">
2816 <xsl:if test="$id != ''">
2817 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2818 </xsl:if>≅</m:mo>
2819 <xsl:apply-templates select="*[3]"/>
2822 <xsl:when test="$name='forgetful'">
2823 <m:mfenced open="[" close="]">
2824 <xsl:if test="$id != ''">
2825 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2827 <xsl:apply-templates select="*[2]"/>
2839 <!-- Il modo Thread non esiste piu'
2840 <xsl:template match="*" mode="thread">
2841 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
2843 <xsl:when test="$name='rw_step'">
2847 <m:mtext>Rewrite</m:mtext>
2848 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2849 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
2850 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2851 <m:mtext>with</m:mtext>
2852 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2853 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
2854 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2855 <m:mtext>by</m:mtext>
2856 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2857 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
2864 <m:mtext mathcolor="Red">we get</m:mtext>
2865 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2866 <xsl:apply-templates select="."/>
2875 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
2882 <m:mtext mathcolor="Red">we get</m:mtext>
2883 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2884 <xsl:apply-templates select="."/>
2890 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
2896 <xsl:template match="m:lambda">
2897 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
2900 <xsl:attribute name="xref">
2901 <xsl:value-of select="@id"/>
2905 <xsl:when test="$charlength >= $framewidth">
2906 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2910 <m:mo mathcolor="Red">λ</m:mo>
2911 <!--<xsl:apply-templates select="m:bvar"/>-->
2912 <xsl:apply-templates select="m:bvar/m:ci"/>
2920 <xsl:apply-templates select="*[position()=2]"/>
2927 <m:mo mathcolor="Red">λ</m:mo>
2928 <!--<xsl:apply-templates select="m:bvar/m:ci"/>
2930 <xsl:apply-templates select="m:bvar/m:type"/>-->
2931 <xsl:apply-templates select="m:bvar/m:ci"/>
2933 <xsl:apply-templates select="*[position()=2]"/>
2940 <!--**********************-->
2942 <!--**********************-->
2944 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
2945 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
2946 |m:plus|m:minus|m:times" mode="charcount">
2947 <xsl:param name="incurrent_length" select="0"/>
2949 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
2950 <xsl:variable name="siblength">
2951 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
2952 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
2953 </xsl:apply-templates>
2956 <xsl:when test="string($siblength) = """>
2957 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2960 <xsl:value-of select="number($siblength)"/>
2965 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2970 <xsl:template match="m:ci|m:csymbol" mode="charcount">
2971 <xsl:param name="incurrent_length" select="0"/>
2972 <xsl:param name="nosibling" select="0"/>
2974 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
2975 <xsl:variable name="siblength">
2976 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
2977 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
2978 </xsl:apply-templates>
2981 <xsl:when test="string($siblength) = """>
2982 <xsl:value-of select="$incurrent_length + string-length()"/>
2985 <xsl:value-of select="number($siblength)"/>
2990 <xsl:value-of select="$incurrent_length + string-length()"/>
2995 <xsl:template match="*" mode="charcount">
2996 <xsl:param name="incurrent_length" select="0"/>
2997 <xsl:param name="nosibling" select="0"/>
2999 <xsl:when test="count(child::*) = 0">
3000 <!-- CSC: tremendous bug fixed. An empty element can still have siblings!!! -->
3001 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/></xsl:apply-templates></xsl:variable>
3003 <xsl:when test="string($siblength) = """>
3004 <xsl:value-of select="$incurrent_length"/>
3007 <xsl:value-of select="number($siblength)"/>
3012 <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>
3014 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
3015 <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>
3017 <xsl:when test="string($siblength) = """>
3018 <xsl:value-of select="number($childlength)"/>
3021 <xsl:value-of select="number($siblength)"/>
3026 <xsl:value-of select="number($childlength)"/>