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"/>
254 <!-- NuPRLDefinition -->
256 <xsl:template match="NuPrlDefinition">
259 <xsl:apply-templates select="*[1]"/>
261 <xsl:apply-templates select="*[2]"/>
268 <xsl:template match="Definition">
270 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
274 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
281 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
282 <xsl:apply-templates select="type/*[1]"/>
289 <m:mtext>AS</m:mtext>
296 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
297 <xsl:apply-templates select="body/Node"/> <!-- body/*[1]"/>-->
307 <xsl:template match="Axiom">
309 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
313 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
320 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
321 <xsl:apply-templates select="type/*[1]"/>
329 <!-- UNFINISHED PROOF -->
331 <xsl:template match="CurrentProof">
333 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
337 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
344 <m:mtext>THESIS:</m:mtext>
351 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
352 <xsl:apply-templates select="type/*[1]"/>
359 <m:mtext>CONJECTURES:</m:mtext>
363 <xsl:for-each select="Conjecture">
366 <m:mrow helm:xref="{@helm:xref}">
367 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
368 <xsl:for-each select="Decl|Def|Hidden">
370 <xsl:when test="name(.)='Decl'">
371 <m:mrow helm:xref="{@helm:xref}">
373 <xsl:when test="@name">
374 <m:mi><xsl:value-of select="@name"/></m:mi>
381 <xsl:apply-templates select="./*[1]"/>
384 <xsl:when test="name(.)='Def'">
385 <m:mrow helm:xref="{@helm:xref}">
387 <xsl:when test="@name">
388 <m:mi><xsl:value-of select="@name"/></m:mi>
395 <xsl:apply-templates select="./*[1]"/>
399 <m:mrow helm:xref="{@helm:xref}">
406 <xsl:if test="not (position() = last())">
411 <m:msub><m:mi>?</m:mi><m:mn><xsl:value-of select="@no"/></m:mn></m:msub>
413 <xsl:apply-templates select="./Goal/*[1]"/>
421 <m:mtext>PROOF:</m:mtext>
428 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
429 <xsl:apply-templates select="body/*[1]"/>
437 <!-- MUTUAL INDUCTIVE DEFINITION -->
439 <xsl:template match="InductiveDefinition">
441 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
442 <xsl:for-each select="InductiveType">
447 <xsl:when test="position() = 1">
449 <xsl:when test="string(./@inductive) = "true"">
450 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
453 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
458 <m:mtext>AND</m:mtext>
461 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
462 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
469 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
472 <xsl:when test="string(../Param) != """>
473 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
474 <xsl:for-each select="../Param">
478 <m:mi><xsl:value-of select="./@name"/></m:mi>
480 <xsl:apply-templates select="*"/>
504 <m:mtext>OF ARITY</m:mtext>
511 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
512 <xsl:apply-templates select="./arity/*[1]"/>
519 <m:mtext>BUILT FROM</m:mtext>
523 <xsl:for-each select="./Constructor">
528 <xsl:when test="position() = 1">
529 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
533 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
536 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
537 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
538 <xsl:apply-templates select="./*[1]"/>
550 <xsl:template match="Variable">
552 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
556 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
563 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
564 <xsl:apply-templates select="type/*[1]"/>
568 <xsl:if test="name(*[1])='body'">
572 <m:mtext>AS</m:mtext>
579 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
580 <xsl:apply-templates select="body/*[1]"/>
593 <xsl:template match="Sequent">
594 <xsl:variable name="rowlines">
595 <xsl:for-each select="Decl|Def">
596 <xsl:if test="position() != last()">
597 <xsl:text>none </xsl:text>
600 <xsl:text>solid</xsl:text>
602 <xsl:variable name="no" select="@no"/>
604 <m:mi><xsl:text>?</xsl:text><xsl:value-of select="$no"/></m:mi>
606 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
607 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}" rowlines="{$rowlines}">
608 <xsl:for-each select="Decl|Def">
611 <m:mrow helm:xref="{@helm:xref}">
612 <m:mi><xsl:value-of select="@name"/></m:mi>
614 <xsl:when test="name(.) = 'Decl'">
621 <xsl:apply-templates select="*[1]"/>
626 <xsl:if test="not(Decl|Def)">
630 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
638 <xsl:apply-templates select="Goal/*[1]"/>
646 <!--**********************-->
648 <!--**********************-->
650 <xsl:template match="m:bvar">
652 <xsl:when test="m:type">
653 <xsl:variable name="charlength">
654 <xsl:apply-templates select="m:ci" mode="charcount"/>
657 <xsl:when test="$charlength >= $framewidth">
658 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
662 <xsl:apply-templates select="m:ci"/>
670 <xsl:apply-templates select="m:type"/>
678 <xsl:apply-templates select="m:ci"/>
680 <xsl:apply-templates select="m:type"/>
686 <xsl:apply-templates select="m:ci"/>
691 <xsl:template match="m:apply[m:implies]">
692 <xsl:variable name="charlength"><xsl:apply-templates select="m:implies" mode="charcount"/></xsl:variable>
694 <xsl:when test="$charlength >= $framewidth">
695 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
699 <xsl:apply-templates select="*[2]"/>
707 <xsl:apply-templates select="*[position()=3]"/>
714 <xsl:apply-templates select="*[2]"/>
716 <xsl:apply-templates select="*[position()=3]"/>
723 <xsl:template match="m:apply[m:csymbol]">
724 <xsl:param name="nopar" select="0"/>
725 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
726 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
729 <xsl:attribute name="xref"><xsl:value-of select="@id"/></xsl:attribute>
731 <xsl:variable name="id" select="m:csymbol/@id"/>
734 <xsl:when test="$name='meta'">
736 <xsl:apply-templates select="*[position()=2]"/>
737 <m:mfenced open="[" close="]" separators=";">
738 <xsl:apply-templates select="*[position()>2]"/>
743 <xsl:when test="$name='forall'">
745 <xsl:when test="$charlength >= $framewidth">
746 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
750 <m:mo mathcolor="Blue">∀</m:mo>
751 <xsl:apply-templates select="m:bvar"/>
759 <xsl:apply-templates select="*[position()=3]"/>
766 <m:mo mathcolor="Blue">∀</m:mo>
767 <xsl:apply-templates select="m:bvar/m:ci"/>
769 <xsl:apply-templates select="m:bvar/m:type"/>
771 <xsl:apply-templates select="*[position()=3]"/>
776 <xsl:when test="$name='let_in'">
778 <xsl:when test="$charlength >= $framewidth">
779 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
784 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
785 <xsl:apply-templates select="m:bvar"/>
793 <xsl:apply-templates select="*[position()=3]"/>
801 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
802 <xsl:apply-templates select="*[position()=4]"/>
810 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
811 <xsl:apply-templates select="m:bvar/m:ci"/>
813 <xsl:apply-templates select="*[position()=3]"/>
814 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
815 <m:mtext>IN</m:mtext>
816 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
817 <xsl:apply-templates select="*[position()=4]"/>
822 <xsl:when test="$name='prod'">
824 <xsl:when test="$charlength >= $framewidth">
825 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
829 <m:mo mathcolor="Blue">Π</m:mo>
830 <xsl:apply-templates select="m:bvar"/>
838 <xsl:apply-templates select="*[position()=3]"/>
845 <m:mo mathcolor="Blue">Π</m:mo>
846 <xsl:apply-templates select="m:bvar/m:ci"/>
848 <xsl:apply-templates select="m:bvar/m:type"/>
850 <xsl:apply-templates select="*[position()=3]"/>
855 <xsl:when test="$name='arrow'">
857 <xsl:when test="$charlength >= $framewidth">
858 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
862 <xsl:if test="$nopar=0">
863 <m:mo stretchy="false">(</m:mo>
865 <xsl:apply-templates select="*[position()=2]"/>
872 <m:mo mathmathcolor="Blue">→</m:mo>
874 <xsl:when test="*[position()=3]/m:csymbol">
875 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
877 <xsl:when test="$nextp='arrow'">
878 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
881 <xsl:apply-templates select="*[position()=3]"/>
886 <xsl:apply-templates select="*[position()=3]"/>
892 <xsl:if test="$nopar=0">
896 <m:mo stretchy="false">)</m:mo>
904 <xsl:if test="$nopar=0">
905 <m:mo stretchy="false">(</m:mo>
907 <xsl:apply-templates select="*[position()=2]"/>
908 <m:mo mathcolor="Blue">→</m:mo>
910 <xsl:when test="*[position()=3]/m:csymbol">
911 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
913 <xsl:when test="$nextp='arrow'">
914 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
917 <xsl:apply-templates select="*[position()=3]"/>
922 <xsl:apply-templates select="*[position()=3]"/>
925 <xsl:if test="$nopar=0">
926 <m:mo stretchy="false">)</m:mo>
932 <xsl:when test="$name='type_of'">
934 <xsl:when test="$charlength >= $framewidth">
935 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
939 <xsl:value-of select="*[2]"/>
947 <xsl:apply-templates select="*[3]"/>
955 <xsl:apply-templates select="*[2]"/>
957 <xsl:apply-templates select="*[3]"/>
963 <xsl:when test="$name='product'">
965 <xsl:when test="$charlength >= $framewidth">
966 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
970 <m:mo mathcolor="Blue">Σ</m:mo>
971 <xsl:apply-templates select="m:bvar/m:ci"/>
973 <xsl:apply-templates select="m:bvar/m:type"/>
981 <xsl:apply-templates select="*[position()=3]"/>
989 <m:mo mathcolor="Blue">Σ</m:mo>
990 <xsl:apply-templates select="m:bvar/m:ci"/>
992 <xsl:apply-templates select="m:bvar/m:type"/>
994 <xsl:apply-templates select="*[position()=3]"/>
1000 <xsl:when test="$name='product_ind'">
1002 <xsl:when test="$charlength >= $framewidth">
1003 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1007 <m:mo stretchy="false">(</m:mo>
1008 <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>
1025 <m:mo stretchy="false">(</m:mo>
1026 <xsl:apply-templates select="m:type"/>
1027 <m:mo mathcolor="Blue">x</m:mo>
1028 <xsl:apply-templates select="*[position()=3]"/>
1029 <m:mo stretchy="false">)</m:mo>
1035 <xsl:when test="$name='pair'">
1037 <xsl:when test="$charlength >= $framewidth">
1038 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1042 <m:mo mathcolor="Blue"><</m:mo>
1043 <xsl:apply-templates select="*[2]"/>
1044 <m:mtext>, </m:mtext>
1051 <xsl:apply-templates select="*[3]"/>
1052 <m:mo mathcolor="Blue">></m:mo>
1060 <m:mo mathcolor="Blue"><</m:mo>
1061 <xsl:apply-templates select="*[2]"/>
1062 <m:mtext>, </m:mtext>
1063 <xsl:apply-templates select="*[3]"/>
1064 <m:mo mathcolor="Blue">></m:mo>
1070 <xsl:when test="$name='union'">
1072 <xsl:when test="$charlength >= $framewidth">
1073 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1076 <xsl:apply-templates select="*[2]"/>
1082 <m:mo mathcolor="Blue">+</m:mo>
1083 <xsl:apply-templates select="*[3]"/>
1091 <xsl:apply-templates select="*[2]"/>
1092 <m:mo mathcolor="Blue">+</m:mo>
1093 <xsl:apply-templates select="*[3]"/>
1099 <xsl:when test="$name='inl'">
1101 <m:mo stretchy="false" mathcolor="Blue">inl(</m:mo>
1102 <xsl:apply-templates select="*[position()=2]"/>
1103 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1107 <xsl:when test="$name='inr'">
1109 <m:mo stretchy="false" mathcolor="Blue">inr(</m:mo>
1110 <xsl:apply-templates select="*[position()=2]"/>
1111 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1115 <xsl:when test="$name='Ax'">
1116 <m:mo mathcolor="Blue">Ax</m:mo>
1119 <xsl:when test="$name='void'">
1120 <m:mo mathcolor="Blue">Void</m:mo>
1123 <xsl:when test="$name='atom'">
1124 <m:mo mathcolor="Blue">Atom</m:mo>
1127 <xsl:when test="$name='universe'">
1130 <xsl:apply-templates select="m:cn"/>
1134 <xsl:when test="$name='prop'">
1137 <xsl:apply-templates select="m:cn"/>
1141 <xsl:when test="$name='equal'">
1143 <xsl:when test="$charlength >= $framewidth">
1144 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1147 <xsl:apply-templates select="*[position()=3]"/>
1153 <m:mo mathcolor="Blue">=</m:mo>
1154 <xsl:apply-templates select="*[position()=4]"/>
1161 <m:mo mathcolor="Blue">∈</m:mo>
1162 <xsl:apply-templates select="*[position()=2]"/>
1170 <xsl:apply-templates select="*[position()=3]"/>
1171 <m:mo mathcolor="Blue">=</m:mo>
1172 <xsl:apply-templates select="*[position()=4]"/>
1173 <m:mo mathcolor="Blue">∈</m:mo>
1174 <xsl:apply-templates select="*[position()=2]"/>
1180 <xsl:when test="$name='token'">
1182 <m:mo mathcolor="Blue">"</m:mo>
1183 <xsl:apply-templates select="m:ci"/>
1184 <m:mo mathcolor="Blue">"</m:mo>
1188 <xsl:when test="$name='nil'">
1189 <m:mo mathcolor="Blue">[]</m:mo>
1192 <xsl:when test="$name='cons'">
1194 <xsl:when test="$charlength >= $framewidth">
1195 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1198 <xsl:apply-templates select="*[2]"/>
1204 <m:mo mathcolor="Blue">::</m:mo>
1205 <xsl:apply-templates select="*[3]"/>
1213 <xsl:apply-templates select="*[2]"/>
1214 <m:mo mathcolor="Blue">::</m:mo>
1215 <xsl:apply-templates select="*[3]"/>
1222 <xsl:when test="$name='rec'">
1224 <xsl:when test="$charlength >= $framewidth">
1225 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1229 <m:mo>rectype</m:mo>
1230 <xsl:apply-templates select="*[2]"/>
1238 <xsl:apply-templates select="*[3]"/>
1246 <m:mo>rectype</m:mo>
1247 <xsl:apply-templates select="*[2]"/>
1249 <xsl:apply-templates select="*[3]"/>
1256 <xsl:when test="$name='t_set'">
1258 <xsl:when test="$charlength >= $framewidth">
1259 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1263 <m:mo mathcolor="Blue" stretchy="false">{</m:mo>
1265 <xsl:when test="m:bvar/m:ci">
1266 <xsl:apply-templates select="m:bvar/m:ci"/>
1267 <m:mo mathcolor="Blue">:</m:mo>
1268 <xsl:apply-templates select="m:bvar/m:type"/>
1271 <xsl:apply-templates select="m:bvar/m:type"/>
1280 <m:mo mathcolor="Blue" stretchy="false">|</m:mo>
1281 <xsl:apply-templates select="*[3]"/>
1282 <m:mo mathcolor="Blue" stretchy="false">}</m:mo>
1290 <m:mo mathcolor="Blue" stretchy="false">{</m:mo>
1292 <xsl:when test="m:bvar/m:ci">
1293 <xsl:apply-templates select="m:bvar/m:ci"/>
1294 <m:mo mathcolor="Blue">:</m:mo>
1295 <xsl:apply-templates select="m:bvar/m:type"/>
1298 <xsl:apply-templates select="m:bvar/m:type"/>
1301 <m:mo mathcolor="Blue" stretchy="false">|</m:mo>
1302 <xsl:apply-templates select="*[3]"/>
1303 <m:mo mathcolor="Blue" stretchy="false">}</m:mo>
1310 <xsl:when test="$name='isect'">
1312 <xsl:when test="$charlength >= $framewidth">
1313 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1317 <m:mo mathcolor="Blue">Ç</m:mo>
1318 <xsl:apply-templates select="m:bvar/m:ci"/>
1319 <m:mo mathcolor="Blue">:</m:mo>
1320 <xsl:apply-templates select="m:bvar/m:type"/>
1327 <m:mo mathcolor="Blue">.</m:mo>
1328 <xsl:apply-templates select="*[3]"/>
1336 <m:mo mathcolor="Blue">Ç</m:mo>
1337 <xsl:apply-templates select="m:bvar/m:ci"/>
1338 <m:mo mathcolor="Blue">:</m:mo>
1339 <xsl:apply-templates select="m:bvar/m:type"/>
1340 <m:mo mathcolor="Blue">.</m:mo>
1341 <xsl:apply-templates select="*[3]"/>
1347 <xsl:when test="$name='quotient'">
1349 <xsl:when test="$charlength >= $framewidth">
1350 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1354 <xsl:apply-templates select="m:bvar[1]"/>
1355 <m:mo mathcolor="Blue">,</m:mo>
1356 <xsl:apply-templates select="m:bvar[2]"/>
1357 <m:mo mathcolor="Blue">:</m:mo>
1358 <xsl:apply-templates select="*[2]"/>
1365 <m:mo mathcolor="Blue">//</m:mo>
1366 <xsl:apply-templates select="*[5]"/>
1374 <xsl:apply-templates select="m:bvar[1]"/>
1375 <m:mo mathcolor="Blue">,</m:mo>
1376 <xsl:apply-templates select="m:bvar[2]"/>
1377 <m:mo mathcolor="Blue">:</m:mo>
1378 <xsl:apply-templates select="*[2]"/>
1379 <m:mo mathcolor="Blue">//</m:mo>
1380 <xsl:apply-templates select="*[5]"/>
1385 <!-- IF_THEN_ELSE -->
1386 <xsl:when test="$name='if_then_else'">
1388 <xsl:when test="$charlength >= $framewidth">
1389 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1394 <xsl:when test="m:where = 'atom_eq'">
1395 <m:mo stretchy="false" mathcolor="Blue">atom_eq (</m:mo>
1397 <xsl:when test="m:where = 'int_eq'">
1398 <m:mo stretchy="false" mathcolor="Blue">int_eq (</m:mo>
1400 <xsl:when test="m:where = 'less'">
1401 <m:mo stretchy="false" mathcolor="Blue">less (</m:mo>
1404 <xsl:apply-templates select="*[3]"/>
1405 <m:mo mathcolor="Blue">;</m:mo>
1412 <xsl:apply-templates select="*[4]"/>
1413 <m:mo mathcolor="Blue">;</m:mo>
1420 <xsl:apply-templates select="*[5]"/>
1421 <m:mo mathcolor="Blue">;</m:mo>
1428 <xsl:apply-templates select="*[6]"/>
1429 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1438 <xsl:when test="m:where = 'atom_eq'">
1439 <m:mo stretchy="false" mathcolor="Blue">atom_eq (</m:mo>
1441 <xsl:when test="m:where = 'int_eq'">
1442 <m:mo stretchy="false" mathcolor="Blue">int_eq (</m:mo>
1444 <xsl:when test="m:where = 'less'">
1445 <m:mo stretchy="false" mathcolor="Blue">less (</m:mo>
1448 <xsl:apply-templates select="*[3]"/>
1449 <m:mo mathcolor="Blue">;</m:mo>
1450 <xsl:apply-templates select="*[4]"/>
1451 <m:mo mathcolor="Blue">;</m:mo>
1452 <xsl:apply-templates select="*[5]"/>
1453 <m:mo mathcolor="Blue">;</m:mo>
1454 <xsl:apply-templates select="*[6]"/>
1455 <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
1461 <xsl:when test="$name='so_lambda'">
1463 <xsl:when test="($charlength - 4) >= $framewidth">
1464 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1468 <m:mo mathcolor="red">λ</m:mo>
1469 <xsl:apply-templates select="m:apply[1]/*[2]"/>
1477 <xsl:apply-templates select="*[3]"/>
1485 <m:mo mathcolor="red">λ</m:mo>
1486 <xsl:apply-templates select="m:apply[1]/m:ci[2]"/>
1488 <xsl:apply-templates select="*[3]"/>
1494 <xsl:when test="$name='so_apply'">
1496 <xsl:when test="($charlength - 4) >= $framewidth">
1497 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1501 <m:mo stretchy="false">(</m:mo>
1502 <xsl:apply-templates select="*[position()=2]">
1503 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1504 </xsl:apply-templates>
1508 <xsl:for-each select="*[position()>2]">
1512 <m:mphantom stretchy="false"><m:mtext>(</m:mtext></m:mphantom>
1513 <xsl:apply-templates select=".">
1514 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1515 </xsl:apply-templates>
1523 <m:mo stretchy="false">)</m:mo>
1530 <m:mo stretchy="false">(</m:mo>
1531 <xsl:apply-templates select="*[position()=2]">
1532 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1533 </xsl:apply-templates>
1534 <xsl:for-each select="*[position()>2]">
1535 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1536 <xsl:apply-templates select=".">
1537 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1538 </xsl:apply-templates>
1540 <m:mo stretchy="false">)</m:mo>
1545 <xsl:when test="$name='cast'">
1547 <xsl:when test="$charlength >= $framewidth">
1548 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1552 <m:mo stretchy="false">(</m:mo>
1553 <xsl:apply-templates select="*[position()=2]"/>
1560 <m:mo mathcolor="Maroon">:></m:mo>
1561 <xsl:apply-templates select="*[position()=3]"/>
1568 <m:mo stretchy="false">)</m:mo>
1575 <m:mo stretchy="false">(</m:mo>
1576 <xsl:apply-templates select="*[position()=2]"/>
1577 <m:mo mathcolor="Maroon">:></m:mo>
1578 <xsl:apply-templates select="*[position()=3]"/>
1579 <m:mo stretchy="false">)</m:mo>
1584 <xsl:when test="$name='app'">
1586 <xsl:when test="$charlength >= $framewidth">
1587 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1591 <m:mo stretchy="false">(</m:mo>
1592 <!-- added precedence to app = FUNCTION_PREC (99) -->
1593 <xsl:apply-templates select="*[position()=2]">
1594 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1595 </xsl:apply-templates>
1599 <xsl:for-each select="*[position()>2]">
1603 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
1604 <!-- added precedence to app = FUNCTION_PREC (99) -->
1605 <xsl:apply-templates select=".">
1606 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1607 </xsl:apply-templates>
1615 <m:mo stretchy="false">)</m:mo>
1622 <m:mo stretchy="false">(</m:mo>
1623 <!-- added precedence to app = FUNCTION_PREC (99) -->
1624 <xsl:apply-templates select="*[position()=2]">
1625 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1626 </xsl:apply-templates>
1627 <xsl:for-each select="*[position()>2]">
1628 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1629 <!-- added precedence to app = FUNCTION_PREC (99) -->
1630 <xsl:apply-templates select=".">
1631 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1632 </xsl:apply-templates>
1634 <m:mo stretchy="false">)</m:mo>
1639 <xsl:when test="$name='cast'">
1641 <xsl:when test="$charlength >= $framewidth">
1642 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1646 <m:mo stretchy="false">(</m:mo>
1647 <xsl:apply-templates select="*[position()=2]"/>
1654 <m:mo mathcolor="Maroon">:></m:mo>
1655 <xsl:apply-templates select="*[position()=3]"/>
1662 <m:mo stretchy="false">)</m:mo>
1669 <m:mo stretchy="false">(</m:mo>
1670 <xsl:apply-templates select="*[position()=2]"/>
1671 <m:mo mathcolor="Maroon">:></m:mo>
1672 <xsl:apply-templates select="*[position()=3]"/>
1673 <m:mo stretchy="false">)</m:mo>
1678 <!--<xsl:when test="$name='Prop'">
1682 <!--<xsl:when test="$name='Set'">
1686 <!--<xsl:when test="$name='Type'">
1690 <xsl:when test="$name='mutcase'">
1692 <xsl:when test="$charlength >= $framewidth">
1693 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1694 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1699 <xsl:apply-templates select="*[position()=2]"/>
1700 <xsl:if test="$framewidth > $charlength">
1703 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1704 <xsl:apply-templates select="*[position()=3]"/>
1709 <xsl:if test="$charlength >= $framewidth">
1715 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1716 <xsl:apply-templates select="*[position()=3]"/>
1728 <xsl:for-each select="m:piecewise/m:piece">
1729 <xsl:variable name="charlength"><xsl:apply-templates select="./*[2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1734 <xsl:when test="position() = 1">
1735 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
1738 <m:mo stretchy="false">|</m:mo>
1741 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1742 <xsl:apply-templates select="./*[2]"/>
1743 <xsl:if test="$framewidth > $charlength">
1744 <m:mo mathcolor="Green">⇒</m:mo>
1745 <xsl:apply-templates select="./*[1]"/>
1750 <xsl:if test="$charlength >= $framewidth">
1754 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
1755 <m:mo mathcolor="Green">⇒</m:mo>
1756 <xsl:apply-templates select="./*[1]"/>
1772 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
1774 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1775 <xsl:apply-templates select="*[position()=3]"/>
1776 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1778 <xsl:for-each select="m:piecewise/m:piece">
1780 <xsl:when test="position() != 1">
1781 <m:mo stretchy="false">|</m:mo>
1784 <xsl:apply-templates select="./*[2]"/>
1785 <m:mo mathcolor="Green">⇒</m:mo>
1786 <xsl:apply-templates select="./*[1]"/>
1788 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1794 <xsl:when test="$name='fix'">
1796 <xsl:when test="$charlength >= $framewidth">
1797 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1802 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1803 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1804 <m:mo stretchy="false">{</m:mo>
1811 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1812 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1813 <xsl:for-each select="m:bvar">
1814 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1818 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1820 <xsl:if test="$framewidth > $charlength">
1821 <xsl:apply-templates select="m:type"/>
1826 <xsl:if test="$charlength >= $framewidth">
1830 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
1831 <xsl:apply-templates select="m:type"/>
1840 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1852 <m:mo stretchy="false">}</m:mo>
1860 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1861 <m:mo stretchy="false">{</m:mo>
1862 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1863 <xsl:for-each select="m:bvar">
1867 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1869 <xsl:apply-templates select="m:type"/>
1871 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1872 <xsl:if test="position()=last()">
1873 <m:mo stretchy="false">}</m:mo>
1884 <xsl:when test="$name='cofix'">
1886 <xsl:when test="$charlength >= $framewidth">
1887 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1892 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1893 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1894 <m:mo stretchy="false">{</m:mo>
1901 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1902 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1903 <xsl:for-each select="m:bvar">
1904 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
1908 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1910 <xsl:if test="$framewidth > $charlength">
1911 <xsl:apply-templates select="m:type"/>
1916 <xsl:if test="$charlength >= $framewidth">
1920 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
1921 <xsl:apply-templates select="m:type"/>
1930 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1942 <m:mo stretchy="false">}</m:mo>
1950 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1951 <m:mo stretchy="false">{</m:mo>
1952 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1953 <xsl:for-each select="m:bvar">
1957 <m:mi><xsl:value-of select="m:ci"/></m:mi>
1959 <xsl:apply-templates select="m:type"/>
1961 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
1962 <xsl:if test="position()=last()">
1963 <m:mo stretchy="false">}</m:mo>
1973 <!-- ***************************************** -->
1974 <!-- *********** PROOF ELEMENTS ************** -->
1975 <!-- ***************************************** -->
1977 <xsl:when test="$name='proof'">
1978 <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
1979 <xsl:variable name="test" select="(not($explodeall)) and
1980 (not(preceding-sibling::*[1]/text()='letin1')) and
1981 (not(preceding-sibling::*[1]/text()='rw_step')) and
1982 (not(name(..)='m:lambda'))"/>
1983 <xsl:variable name="hidden_details">
1984 <xsl:if test="$test">
1985 <!-- Details hided (default) -->
1986 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1990 <m:mtext mathcolor="Red">We can prove</m:mtext>
1991 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1992 <!-- the last child is either the expected type, if provided,-->
1993 <!-- or the synthesized type. -->
1994 <xsl:apply-templates select="*[position()=last()]"/>
1996 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1997 <m:mtext mathcolor="Green">(explain)</m:mtext>
2005 <xsl:variable name="shown_details">
2006 <!-- Show details -->
2007 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2011 <xsl:apply-templates select="*[position()=2]"/>
2015 <xsl:variable name="hidedetails">
2018 <m:mtext>_</m:mtext>
2020 <xsl:if test="$test">
2021 <m:mtext mathcolor="Green">(hide details)</m:mtext>
2028 <m:mtext mathcolor="Red">we proved</m:mtext>
2029 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2030 <xsl:apply-templates select="*[position()=3]"/>
2031 <xsl:if test="not(*[4])">
2032 <xsl:copy-of select="$hidedetails"/>
2037 <xsl:if test="*[4]">
2041 <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
2042 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2043 <xsl:apply-templates select="*[position()=4]"/>
2044 <xsl:copy-of select="$hidedetails"/>
2052 <xsl:when test="$test">
2053 <m:maction actiontype="toggle">
2054 <xsl:copy-of select="$hidden_details"/>
2055 <xsl:copy-of select="$shown_details"/>
2059 <xsl:copy-of select="$shown_details"/>
2064 <xsl:when test="$name='side_proof'">
2065 <xsl:variable name="test" select="(not($explodeall))"/>
2066 <xsl:variable name="hidden_details">
2067 <xsl:if test="$test">
2068 <!-- Details hided (default) -->
2069 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2073 <m:mtext mathcolor="Red">We can prove</m:mtext>
2074 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2075 <!-- the last child is either the expected type, if provided,-->
2076 <!-- or the synthesized type. -->
2077 <xsl:apply-templates select="*[position()=last()]"/>
2079 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2080 <m:mtext mathcolor="Green">(explain)</m:mtext>
2088 <xsl:variable name="shown_details">
2089 <!-- Show details -->
2090 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2094 <xsl:apply-templates select="*[position()=2]"/>
2098 <xsl:variable name="hidedetails">
2101 <m:mtext>_</m:mtext>
2103 <xsl:if test="$test">
2104 <m:mtext mathcolor="Green">(hide details)</m:mtext>
2111 <m:mtext mathcolor="Red">we proved</m:mtext>
2112 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2113 <xsl:apply-templates select="*[position()=3]"/>
2114 <xsl:if test="not(*[4])">
2115 <xsl:copy-of select="$hidedetails"/>
2120 <xsl:if test="*[4]">
2124 <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
2125 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2126 <xsl:apply-templates select="*[position()=4]"/>
2127 <xsl:copy-of select="$hidedetails"/>
2135 <xsl:when test="$test">
2136 <m:maction actiontype="toggle">
2137 <xsl:copy-of select="$hidden_details"/>
2138 <xsl:copy-of select="$shown_details"/>
2142 <xsl:copy-of select="$shown_details"/>
2147 <xsl:when test="$name='letin1'">
2148 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2152 <xsl:apply-templates select="*[position()=2]"/>
2159 <xsl:apply-templates select="*[position()=3]"/>
2165 <xsl:when test="$name='by_induction'">
2166 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2170 <m:mtext mathcolor="Red">We prove</m:mtext>
2171 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2172 <xsl:apply-templates select="../*[3]"/>
2179 <m:mtext mathcolor="Red">by induction on</m:mtext>
2180 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2181 <xsl:apply-templates
2182 select="*[position()=last()]/*[position()=last()]"/>
2189 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2190 <xsl:for-each select="*[position()>3 and not(position()=last())]">
2194 <xsl:apply-templates select="."/>
2205 <!-- inductive_case -->
2206 <xsl:when test="$name='inductive_case'">
2207 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2211 <m:mtext mathcolor="Red">Case</m:mtext>
2212 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2213 <xsl:apply-templates select="*[2]"/>
2220 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2221 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2222 <xsl:if test="*[3]/*[position()>1]">
2226 <m:mtext mathcolor="Red">By induction hypothesis, we have:</m:mtext>
2233 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2234 <xsl:for-each select="*[3]/*[position()>1]">
2235 <m:mo stretchy="false">(</m:mo>
2236 <xsl:apply-templates select="m:ci"/>
2237 <m:mo stretchy="false">) </m:mo>
2238 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2239 <xsl:apply-templates select="m:type"/>
2248 <xsl:apply-templates select="*[4]"/>
2259 <xsl:when test="$name='case_lhs'">
2262 <xsl:when test="count(*)=2">
2263 <xsl:apply-templates select="*[2]"/>
2266 <m:mo stretchy="false">(</m:mo>
2267 <xsl:apply-templates select="*[2]"/>
2268 <xsl:for-each select="m:bvar">
2269 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2270 <xsl:apply-templates select="*[1]"/>
2271 <m:mtext>:</m:mtext>
2272 <xsl:apply-templates select="m:type/*[1]"/>
2274 <m:mo stretchy="false">)</m:mo>
2280 <xsl:when test="$name='false_ind'">
2281 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2285 <xsl:apply-templates select="*[3]"/>
2292 <m:mtext mathcolor="Red">Contradiction.</m:mtext>
2299 <xsl:when test="$name='letin'">
2300 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2301 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
2302 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
2306 <xsl:apply-templates select="."/>
2314 <xsl:apply-templates select="*[position()=last()]"/>
2321 <xsl:when test="$name='let'">
2322 <m:mtext>(</m:mtext>
2323 <xsl:apply-templates select="m:ci"/>
2324 <m:mtext>) </m:mtext>
2325 <xsl:apply-templates select="*[3]"/>
2328 <xsl:when test="$name='rw_step'">
2329 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2334 <xsl:when test="name(*[2])='m:apply'">
2335 <xsl:apply-templates select="*[2]"/>
2338 <m:mtext>Consider</m:mtext>
2339 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2340 <xsl:apply-templates select="*[2]"/>
2349 <m:mtext>Rewrite</m:mtext>
2350 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2351 <xsl:apply-templates select="*[3]"/>
2352 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2353 <m:mtext>with</m:mtext>
2354 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2355 <xsl:apply-templates select="*[4]"/>
2356 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2357 <m:mtext>by</m:mtext>
2358 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2359 <xsl:apply-templates select="*[5]"/>
2365 <!-- not existing any more
2366 <xsl:when test="$name='thread'">
2367 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2372 <xsl:when test="name(*[last()])='m:apply'">
2373 <xsl:apply-templates select="*[last()]"/>
2376 <m:mtext>Consider</m:mtext>
2377 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2378 <xsl:apply-templates select="*[last()]"/>
2384 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
2388 <!-- REWRITE_AND_APPLY -->
2389 <xsl:when test="$name='rewrite_and_apply'">
2390 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2394 <xsl:apply-templates select="*[2]"/>
2401 <m:mtext>Then apply it to</m:mtext>
2402 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2403 <xsl:apply-templates select="*[position()>2]"/>
2410 <xsl:when test="$name='and_ind'">
2411 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2416 <xsl:when test="name(*[2])='m:apply'">
2417 <xsl:apply-templates select="*[2]"/>
2420 <m:mtext>Consider</m:mtext>
2421 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2422 <xsl:apply-templates select="*[2]"/>
2431 <m:mtext>In particular, we have</m:mtext>
2438 <m:mtext>(</m:mtext>
2439 <xsl:apply-templates select="*[3]"/>
2440 <m:mtext>)</m:mtext>
2441 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2442 <xsl:apply-templates select="*[4]"/>
2449 <m:mtext>(</m:mtext>
2450 <xsl:apply-templates select="*[5]"/>
2451 <m:mtext>)</m:mtext>
2452 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2453 <xsl:apply-templates select="*[6]"/>
2460 <xsl:apply-templates select="*[7]"/>
2466 <!-- full_or_ind -->
2467 <xsl:when test="$name='full_or_ind'">
2468 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2473 <xsl:when test="name(*[2])='m:apply'">
2474 <xsl:apply-templates select="*[2]"/>
2477 <m:mtext>Consider</m:mtext>
2478 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2479 <xsl:apply-templates select="*[2]"/>
2488 <m:mtext>We proceed by cases to prove</m:mtext>
2489 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2490 <xsl:apply-templates select="*[3]"/>
2497 <m:mtext>Left: suppose</m:mtext>
2498 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2499 <m:mo stretchy="false">(</m:mo>
2500 <xsl:apply-templates select="*[4]/m:bvar/m:ci"/>
2501 <m:mo stretchy="false">)</m:mo>
2502 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2503 <xsl:apply-templates select="*[4]/m:bvar/m:type/*[1]"/>
2510 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2511 <xsl:apply-templates select="*[4]/*[3]"/>
2518 <m:mtext>Right: suppose</m:mtext>
2519 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2520 <m:mo stretchy="false">(</m:mo>
2521 <xsl:apply-templates select="*[5]/m:bvar/m:ci"/>
2522 <m:mo stretchy="false">)</m:mo>
2523 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2524 <xsl:apply-templates select="*[5]/m:bvar/m:type/*[1]"/>
2531 <xsl:apply-templates select="*[5]/*[3]"/>
2538 <xsl:when test="$name='or_ind'">
2539 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2544 <xsl:when test="name(*[2])='m:apply'">
2545 <xsl:apply-templates select="*[2]"/>
2548 <m:mtext>Consider</m:mtext>
2549 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2550 <xsl:apply-templates select="*[2]"/>
2559 <m:mtext>We prove</m:mtext>
2560 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2561 <xsl:apply-templates select="*[3]"/>
2562 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2563 <m:mtext>by cases:</m:mtext>
2570 <m:mtext>Left</m:mtext>
2571 <xsl:apply-templates select="*[4]"/>
2578 <m:mtext>Right</m:mtext>
2579 <xsl:apply-templates select="*[5]"/>
2586 <xsl:when test="$name='ex_ind'">
2587 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2592 <xsl:when test="name(*[2])='m:apply'">
2593 <xsl:apply-templates select="*[2]"/>
2596 <m:mtext>Consider</m:mtext>
2597 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2598 <xsl:apply-templates select="*[2]"/>
2607 <m:mtext>Let</m:mtext>
2608 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2609 <xsl:apply-templates select="*[3]"/>
2610 <m:mtext>:</m:mtext>
2611 <xsl:apply-templates select="*[4]"/>
2612 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2613 <m:mtext>such that</m:mtext>
2614 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2615 <m:mtext>(</m:mtext>
2616 <xsl:apply-templates select="*[5]"/>
2617 <m:mtext>)</m:mtext>
2618 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2619 <xsl:apply-templates select="*[6]"/>
2626 <xsl:apply-templates select="*[7]"/>
2633 <xsl:when test="$name='eq_chain'">
2634 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2638 <m:mtext mathcolor="Red">We have the following equality chain:</m:mtext>
2642 <xsl:for-each select="*[position() mod 2 = 0]">
2643 <xsl:variable name="pos" select="position()"/>
2648 <xsl:when test="$pos = 1">
2649 <xsl:apply-templates select="."/>
2650 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2655 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2656 <xsl:apply-templates select="."/>
2662 <xsl:if test="$pos != last()">
2666 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
2667 <xsl:apply-templates select="../*[position()=2*$pos +1]"/>
2675 <!-- DISEQ_CHAIN -->
2676 <xsl:when test="$name='diseq_chain'">
2677 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2681 <m:mtext mathcolor="Red">We have the following disequality chain:</m:mtext>
2685 <xsl:for-each select="*[position() mod 3 = 2]">
2686 <xsl:variable name="pos" select="position()"/>
2691 <xsl:when test="$pos = 1">
2692 <xsl:apply-templates select="."/>
2693 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2694 <mo><xsl:apply-templates select="../*[position()=3*$pos]"/></mo>
2697 <mo><xsl:apply-templates select="../*[position()=3*($pos - 1)]"/></mo>
2698 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2699 <xsl:apply-templates select="."/>
2705 <xsl:if test="$pos != last()">
2709 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
2710 <xsl:apply-templates select="../*[position()=3*$pos +1]"/>
2718 <!-- ***************************************** -->
2719 <!-- *********** NOTATIONS ******************* -->
2720 <!-- ***************************************** -->
2722 <xsl:when test="$name='subst'">
2723 <xsl:apply-templates select="*[3]"/>
2724 <!-- no font for ApplyFunction: <m:mo></m:mo> -->
2725 <m:mo stretchy="false">[</m:mo>
2726 <xsl:apply-templates select="*[4]"/>
2727 <m:mo mathcolor="Green">
2728 <xsl:if test="$id != ''">
2729 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2730 </xsl:if>←</m:mo>
2731 <xsl:apply-templates select="*[2]"/>
2732 <m:mo stretchy="false">]</m:mo>
2735 <xsl:when test="$name='lift'">
2737 <m:mo mathcolor="Green">
2738 <xsl:if test="$id != ''">
2739 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2740 </xsl:if>↑</m:mo>
2741 <xsl:apply-templates select="*[2]"/>
2744 <m:mo stretchy="false">(</m:mo>
2745 <xsl:apply-templates select="*[3]"/>
2746 <m:mo stretchy="false">)</m:mo>
2749 <!-- lift_with_base -->
2750 <xsl:when test="$name='lift_with_base'">
2752 <m:mo mathcolor="Green">
2753 <xsl:if test="$id != ''">
2754 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2755 </xsl:if>↑</m:mo>
2756 <xsl:apply-templates select="*[3]"/>
2757 <xsl:apply-templates select="*[4]"/>
2760 <m:mo stretchy="false">(</m:mo>
2761 <xsl:apply-templates select="*[2]"/>
2762 <m:mo stretchy="false">)</m:mo>
2766 <xsl:when test="$name='beta_red1'">
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>
2775 <xsl:apply-templates select="*[3]"/>
2778 <xsl:when test="$name='beta_red'">
2779 <xsl:apply-templates select="*[2]"/>
2781 <m:mo mathcolor="Green">
2782 <xsl:if test="$id != ''">
2783 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2784 </xsl:if>→</m:mo>
2785 <m:mi mathcolor="Green">β</m:mi>
2786 <m:mi mathcolor="Green">*</m:mi>
2788 <xsl:apply-templates select="*[3]"/>
2790 <!-- par_beta_red1 -->
2791 <xsl:when test="$name='par_beta_red1'">
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>
2800 <xsl:apply-templates select="*[3]"/>
2802 <!-- par_beta_red -->
2803 <xsl:when test="$name='par_beta_red'">
2804 <xsl:apply-templates select="*[2]"/>
2806 <m:mo mathcolor="Green">
2807 <xsl:if test="$id != ''">
2808 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2809 </xsl:if>⇒</m:mo>
2810 <m:mi mathcolor="Green">β</m:mi>
2811 <m:mi mathcolor="Green">*</m:mi>
2813 <xsl:apply-templates select="*[3]"/>
2816 <xsl:when test="$name='forgetful'">
2817 <m:mfenced open="|" close="|">
2818 <xsl:if test="$id != ''">
2819 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2821 <xsl:apply-templates select="*[2]"/>
2825 <xsl:when test="$name='isomorphic'">
2826 <xsl:apply-templates select="*[2]"/>
2827 <m:mo mathcolor="Green">
2828 <xsl:if test="$id != ''">
2829 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2830 </xsl:if>≅</m:mo>
2831 <xsl:apply-templates select="*[3]"/>
2834 <xsl:when test="$name='forgetful'">
2835 <m:mfenced open="[" close="]">
2836 <xsl:if test="$id != ''">
2837 <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
2839 <xsl:apply-templates select="*[2]"/>
2851 <!-- Il modo Thread non esiste piu'
2852 <xsl:template match="*" mode="thread">
2853 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
2855 <xsl:when test="$name='rw_step'">
2859 <m:mtext>Rewrite</m:mtext>
2860 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2861 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
2862 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2863 <m:mtext>with</m:mtext>
2864 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2865 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
2866 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2867 <m:mtext>by</m:mtext>
2868 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2869 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
2876 <m:mtext mathcolor="Red">we get</m:mtext>
2877 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2878 <xsl:apply-templates select="."/>
2887 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
2894 <m:mtext mathcolor="Red">we get</m:mtext>
2895 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
2896 <xsl:apply-templates select="."/>
2902 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
2908 <xsl:template match="m:lambda">
2909 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
2912 <xsl:attribute name="xref">
2913 <xsl:value-of select="@id"/>
2917 <xsl:when test="$charlength >= $framewidth">
2918 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
2922 <m:mo mathcolor="Red">λ</m:mo>
2923 <!--<xsl:apply-templates select="m:bvar"/>-->
2924 <xsl:apply-templates select="m:bvar/m:ci"/>
2932 <xsl:apply-templates select="*[position()=2]"/>
2939 <m:mo mathcolor="Red">λ</m:mo>
2940 <!--<xsl:apply-templates select="m:bvar/m:ci"/>
2942 <xsl:apply-templates select="m:bvar/m:type"/>-->
2943 <xsl:apply-templates select="m:bvar/m:ci"/>
2945 <xsl:apply-templates select="*[position()=2]"/>
2952 <!--**********************-->
2954 <!--**********************-->
2956 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
2957 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
2958 |m:plus|m:minus|m:times" mode="charcount">
2959 <xsl:param name="incurrent_length" select="0"/>
2961 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
2962 <xsl:variable name="siblength">
2963 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
2964 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
2965 </xsl:apply-templates>
2968 <xsl:when test="string($siblength) = """>
2969 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2972 <xsl:value-of select="number($siblength)"/>
2977 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2982 <xsl:template match="m:ci|m:csymbol" mode="charcount">
2983 <xsl:param name="incurrent_length" select="0"/>
2984 <xsl:param name="nosibling" select="0"/>
2986 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
2987 <xsl:variable name="siblength">
2988 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
2989 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
2990 </xsl:apply-templates>
2993 <xsl:when test="string($siblength) = """>
2994 <xsl:value-of select="$incurrent_length + string-length()"/>
2997 <xsl:value-of select="number($siblength)"/>
3002 <xsl:value-of select="$incurrent_length + string-length()"/>
3007 <xsl:template match="*" mode="charcount">
3008 <xsl:param name="incurrent_length" select="0"/>
3009 <xsl:param name="nosibling" select="0"/>
3011 <xsl:when test="count(child::*) = 0">
3012 <!-- CSC: tremendous bug fixed. An empty element can still have siblings!!! -->
3013 <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>
3015 <xsl:when test="string($siblength) = """>
3016 <xsl:value-of select="$incurrent_length"/>
3019 <xsl:value-of select="number($siblength)"/>
3024 <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>
3026 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
3027 <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>
3029 <xsl:when test="string($siblength) = """>
3030 <xsl:value-of select="number($childlength)"/>
3033 <xsl:value-of select="number($siblength)"/>
3038 <xsl:value-of select="number($childlength)"/>