+++ /dev/null
-<?xml version="1.0"?>
-
-<!-- Copyright (C) 2000, HELM Team -->
-<!-- -->
-<!-- This file is part of HELM, an Hypertextual, Electronic -->
-<!-- Library of Mathematics, developed at the Computer Science -->
-<!-- Department, University of Bologna, Italy. -->
-<!-- -->
-<!-- HELM is free software; you can redistribute it and/or -->
-<!-- modify it under the terms of the GNU General Public License -->
-<!-- as published by the Free Software Foundation; either version 2 -->
-<!-- of the License, or (at your option) any later version. -->
-<!-- -->
-<!-- HELM is distributed in the hope that it will be useful, -->
-<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
-<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
-<!-- GNU General Public License for more details. -->
-<!-- -->
-<!-- You should have received a copy of the GNU General Public License -->
-<!-- along with HELM; if not, write to the Free Software -->
-<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
-<!-- MA 02111-1307, USA. -->
-<!-- -->
-<!-- For details, see the HELM World-Wide-Web page, -->
-<!-- http://cs.unibo.it/helm/. -->
-
-<!--***********************************************************************-->
-<!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
-<!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
-<!-- Revised: March 3 2000, Irene Schena -->
-<!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
-<!-- Revised: March 21 2000, Irene Schena -->
-<!--***********************************************************************-->
-
-<!-- NOTE: the namespace declaration has to be done in the stylesheets
-which generates the toplevel element (see for instance xlink) -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:m="http://www.w3.org/1998/Math/MathML"
- xmlns:helm="http://www.cs.unibo.it/helm"
- xmlns:xlink="http://www.w3.org/1999/xlink">
-
-<!-- OLD: <xsl:import href="mml2mmlv1_0.xsl"/> -->
-
-<xsl:import href="mmlnotation.xsl"/>
-
-<xsl:import href="mmltheoryextension.xsl"/>
-
-
-<xsl:param name="explodeall" select="false()"/>
-
-<!--***********************************************************************-->
-<!-- Parameter affecting line-breaking -->
-<!--***********************************************************************-->
-
-<xsl:variable name="framewidth" select="35"/>
-
-<!--***********************************************************************-->
-<!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
-<!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
-<!-- sono i termini: la presentation per un termine e' generata come primo -->
-<!-- figlio di un semantics e l'originario content viene inserito nel -->
-<!-- nel secondo figlio di semantics, annotation-xml -->
-<!--***********************************************************************-->
-
-<!--**********************-->
-<!-- OBJECTS -->
-<!--**********************-->
-
-<xsl:param name="type" select="'standalone'"/>
-
-<xsl:template match="/">
- <xsl:choose>
- <xsl:when test="$type = 'standalone'">
- <xsl:apply-templates select="*"/>
- </xsl:when>
- <xsl:otherwise>
- <to_be_embedded>
- <xsl:apply-templates select="*"/>
- </to_be_embedded>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!-- DEFINITION -->
-
-<xsl:template match="Definition">
- <m:math>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="type/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>AS</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="body/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </m:math>
-</xsl:template>
-
-<!-- AXIOM -->
-
-<xsl:template match="Axiom">
- <m:math>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="type/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </m:math>
-</xsl:template>
-
-<!-- UNFINISHED PROOF -->
-
-<xsl:template match="CurrentProof">
- <m:math>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>THESIS:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="type/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>CONJECTURES:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:for-each select="Conjecture">
- <m:mtr>
- <m:mtd>
- <m:mrow helm:xref="{@helm:xref}">
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:for-each select="Decl|Def|Hidden">
- <xsl:choose>
- <xsl:when test="name(.)='Decl'">
- <m:mrow helm:xref="{@helm:xref}">
- <xsl:choose>
- <xsl:when test="@name">
- <m:mi><xsl:value-of select="@name"/></m:mi>
- </xsl:when>
- <xsl:otherwise>
- <m:mi>_</m:mi>
- </xsl:otherwise>
- </xsl:choose>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="./*[1]"/>
- </m:mrow>
- </xsl:when>
- <xsl:when test="name(.)='Def'">
- <m:mrow helm:xref="{@helm:xref}">
- <xsl:choose>
- <xsl:when test="@name">
- <m:mi><xsl:value-of select="@name"/></m:mi>
- </xsl:when>
- <xsl:otherwise>
- <m:mi>_</m:mi>
- </xsl:otherwise>
- </xsl:choose>
- <m:mo>:=</m:mo>
- <xsl:apply-templates select="./*[1]"/>
- </m:mrow>
- </xsl:when>
- <xsl:otherwise>
- <m:mrow helm:xref="{@helm:xref}">
- <m:mi>_</m:mi>
- <m:mo>:?</m:mo>
- <m:mi>_</m:mi>
- </m:mrow>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="not (position() = last())">
- <m:mo>;</m:mo>
- </xsl:if>
- </xsl:for-each>
- <m:mo>|-</m:mo>
- <m:msub><m:mi>?</m:mi><m:mn><xsl:value-of select="@no"/></m:mn></m:msub>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="./Goal/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>PROOF:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="body/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </m:math>
-</xsl:template>
-
-<!-- MUTUAL INDUCTIVE DEFINITION -->
-
-<xsl:template match="InductiveDefinition">
- <m:math>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
- <xsl:for-each select="InductiveType">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="position() = 1">
- <xsl:choose>
- <xsl:when test="string(./@inductive) = "true"">
- <m:mtext>INDUCTIVE DEFINITION</m:mtext>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>AND</m:mtext>
- </xsl:otherwise>
- </xsl:choose>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <m:mtext>[</m:mtext>
- <xsl:choose>
- <xsl:when test="string(../Param) != """>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:for-each select="../Param">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mi><xsl:value-of select="./@name"/></m:mi>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="*"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>]</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>]</m:mtext>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>OF ARITY</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="./arity/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>BUILT FROM</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:for-each select="./Constructor">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="position() = 1">
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>|</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- </xsl:otherwise>
- </xsl:choose>
- <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="./*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- </xsl:for-each>
- </m:mtable>
- </m:math>
-</xsl:template>
-
-<!-- VARIABLE -->
-
-<xsl:template match="Variable">
- <m:math>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="type/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="name(*[1])='body'">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>AS</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="body/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </m:mtable>
- </m:math>
-</xsl:template>
-
-<!-- SEQUENT -->
-
-<xsl:template match="Sequent">
- <xsl:variable name="rowlines">
- <xsl:for-each select="Decl|Def">
- <xsl:if test="position() != last()">
- <xsl:text>none </xsl:text>
- </xsl:if>
- </xsl:for-each>
- <xsl:text>solid</xsl:text>
- </xsl:variable>
- <xsl:variable name="no" select="@no"/>
- <m:math>
- <m:mi><xsl:text>?</xsl:text><xsl:value-of select="$no"/></m:mi>
- <m:mo>:</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}" rowlines="{$rowlines}">
- <xsl:for-each select="Decl|Def">
- <m:mtr>
- <m:mtd>
- <m:mrow helm:xref="{@helm:xref}">
- <m:mi><xsl:value-of select="@name"/></m:mi>
- <xsl:choose>
- <xsl:when test="name(.) = 'Decl'">
- <m:mo>:</m:mo>
- </xsl:when>
- <xsl:otherwise>
- <m:mo>:=</m:mo>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- <xsl:if test="not(Decl|Def)">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="Goal/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </m:math>
-</xsl:template>
-
-<!--**********************-->
-<!-- TERMS -->
-<!--**********************-->
-
-<xsl:template match="m:bvar">
- <xsl:choose>
- <xsl:when test="m:type">
- <xsl:variable name="charlength">
- <xsl:apply-templates select="m:ci" mode="charcount"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="m:ci"/>
- <m:mo>:</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="m:type"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mrow>
- <xsl:apply-templates select="m:ci"/>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="m:type"/>
- </m:mrow>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="m:ci"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-
-<!-- CSYMBOL -->
-
-<xsl:template match="m:apply[m:csymbol]">
-<xsl:param name="nopar" select="0"/>
- <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
- <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
- <m:mrow>
- <xsl:if test="@id">
- <xsl:attribute name="xref"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:variable name="id" select="m:csymbol/@id"/>
- <xsl:choose>
- <!-- META -->
- <xsl:when test="$name='meta'">
- <m:mrow>
- <xsl:apply-templates select="*[position()=2]"/>
- <m:mfenced open="[" close="]" separators=";">
- <xsl:apply-templates select="*[position()>2]"/>
- </m:mfenced>
- </m:mrow>
- </xsl:when>
- <!-- FORALL -->
- <xsl:when test="$name='forall'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo mathcolor="Blue">∀</m:mo>
- <xsl:apply-templates select="m:bvar"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>.</m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo mathcolor="Blue">∀</m:mo>
- <xsl:apply-templates select="m:bvar/m:ci"/>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="m:bvar/m:type"/>
- <m:mo>.</m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- LET-IN -->
- <xsl:when test="$name='let_in'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>LET</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="m:bvar"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>=</m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>IN</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=4]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo>LET</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="m:bvar/m:ci"/>
- <m:mo>=</m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>IN</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=4]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- PROD -->
- <xsl:when test="$name='prod'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo mathcolor="Blue">Π</m:mo>
- <xsl:apply-templates select="m:bvar"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>.</m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo mathcolor="Blue">Π</m:mo>
- <xsl:apply-templates select="m:bvar/m:ci"/>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="m:bvar/m:type"/>
- <m:mo>.</m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- ARROW -->
- <xsl:when test="$name='arrow'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:if test="$nopar=0">
- <m:mo stretchy="false">(</m:mo>
- </xsl:if>
- <xsl:apply-templates select="*[position()=2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo mathmathcolor="Blue">→</m:mo>
- <xsl:choose>
- <xsl:when test="*[position()=3]/m:csymbol">
- <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="$nextp='arrow'">
- <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$nopar=0">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">)</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$nopar=0">
- <m:mo stretchy="false">(</m:mo>
- </xsl:if>
- <xsl:apply-templates select="*[position()=2]"/>
- <m:mo mathcolor="Blue">→</m:mo>
- <xsl:choose>
- <xsl:when test="*[position()=3]/m:csymbol">
- <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="$nextp='arrow'">
- <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="$nopar=0">
- <m:mo stretchy="false">)</m:mo>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- APP -->
- <xsl:when test="$name='app'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">(</m:mo>
-<!-- added precedence to app = FUNCTION_PREC (99) -->
- <xsl:apply-templates select="*[position()=2]">
- <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
- </xsl:apply-templates>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:for-each select="*[position()>2]">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
-<!-- added precedence to app = FUNCTION_PREC (99) -->
- <xsl:apply-templates select=".">
- <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
- </xsl:apply-templates>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">)</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo stretchy="false">(</m:mo>
-<!-- added precedence to app = FUNCTION_PREC (99) -->
- <xsl:apply-templates select="*[position()=2]">
- <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
- </xsl:apply-templates>
- <xsl:for-each select="*[position()>2]">
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
-<!-- added precedence to app = FUNCTION_PREC (99) -->
- <xsl:apply-templates select=".">
- <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
- </xsl:apply-templates>
- </xsl:for-each>
- <m:mo stretchy="false">)</m:mo>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- CAST -->
- <xsl:when test="$name='cast'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[position()=2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo mathcolor="Maroon">:></m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">)</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[position()=2]"/>
- <m:mo mathcolor="Maroon">:></m:mo>
- <xsl:apply-templates select="*[position()=3]"/>
- <m:mo stretchy="false">)</m:mo>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- PROP -->
- <xsl:when test="$name='Prop'">
- <m:mo>Prop</m:mo>
- </xsl:when>
- <!-- SET -->
- <xsl:when test="$name='Set'">
- <m:mo>Set</m:mo>
- </xsl:when>
- <!-- TYPE -->
- <xsl:when test="$name='Type'">
- <m:mo>Type</m:mo>
- </xsl:when>
- <!-- MUTCASE -->
- <xsl:when test="$name='mutcase'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo><</m:mo>
- <xsl:apply-templates select="*[position()=2]"/>
- <xsl:if test="$framewidth > $charlength">
- <m:mo>></m:mo>
- <m:mo>CASES</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$charlength >= $framewidth">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>></m:mo>
- <m:mo>CASES</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>OF</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:for-each select="m:piecewise/m:piece">
- <xsl:variable name="charlength"><xsl:apply-templates select="./*[2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="position() = 1">
- <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
- </xsl:when>
- <xsl:otherwise>
- <m:mo stretchy="false">|</m:mo>
- </xsl:otherwise>
- </xsl:choose>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="./*[2]"/>
- <xsl:if test="$framewidth > $charlength">
- <m:mo mathcolor="Green">⇒</m:mo>
- <xsl:apply-templates select="./*[1]"/>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$charlength >= $framewidth">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
- <m:mo mathcolor="Green">⇒</m:mo>
- <xsl:apply-templates select="./*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </xsl:for-each>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>END</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
- <m:mo>CASES</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mo>OF</m:mo>
- <xsl:for-each select="m:piecewise/m:piece">
- <xsl:choose>
- <xsl:when test="position() != 1">
- <m:mo stretchy="false">|</m:mo>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select="./*[2]"/>
- <m:mo mathcolor="Green">⇒</m:mo>
- <xsl:apply-templates select="./*[1]"/>
- </xsl:for-each>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mo>END</m:mo>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- FIX -->
- <xsl:when test="$name='fix'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>FIX</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo stretchy="false">{</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:for-each select="m:bvar">
- <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo>:</m:mo>
- <xsl:if test="$framewidth > $charlength">
- <xsl:apply-templates select="m:type"/>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$charlength >= $framewidth">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
- <xsl:apply-templates select="m:type"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>:=</m:mo>
- <xsl:apply-templates select="following-sibling::*[position()=1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- </m:mtable>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">}</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo>FIX</m:mo>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo stretchy="false">{</m:mo>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:for-each select="m:bvar">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="m:type"/>
- <m:mo>:=</m:mo>
- <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
- <xsl:if test="position()=last()">
- <m:mo stretchy="false">}</m:mo>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- </m:mtable>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- COFIX -->
- <xsl:when test="$name='cofix'">
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>COFIX</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo stretchy="false">{</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:for-each select="m:bvar">
- <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo>:</m:mo>
- <xsl:if test="$framewidth > $charlength">
- <xsl:apply-templates select="m:type"/>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$charlength >= $framewidth">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
- <xsl:apply-templates select="m:type"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>:=</m:mo>
- <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- </m:mtable>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo stretchy="false">}</m:mo>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo>COFIX</m:mo>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo stretchy="false">{</m:mo>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:for-each select="m:bvar">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mi><xsl:value-of select="m:ci"/></m:mi>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="m:type"/>
- <m:mo>:=</m:mo>
- <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
- <xsl:if test="position()=last()">
- <m:mo stretchy="false">}</m:mo>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- </m:mtable>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- ***************************************** -->
- <!-- *********** PROOF ELEMENTS ************** -->
- <!-- ***************************************** -->
- <!-- PROOF -->
- <xsl:when test="$name='proof'">
- <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
- <xsl:variable name="test" select="(not($explodeall)) and
- (not(preceding-sibling::*[1]/text()='letin1')) and
- (not(preceding-sibling::*[1]/text()='rw_step')) and
- (not(name(..)='m:lambda'))"/>
- <xsl:variable name="hidden_details">
- <xsl:if test="$test">
- <!-- Details hided (default) -->
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">We can prove</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <!-- the last child is either the expected type, if provided,-->
- <!-- or the synthesized type. -->
- <xsl:apply-templates select="*[position()=last()]"/>
- <m:mrow>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext mathcolor="Green">(explain)</m:mtext>
- </m:mrow>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="shown_details">
- <!-- Show details -->
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[position()=2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:variable name="hidedetails">
- <m:mrow>
- <m:mphantom>
- <m:mtext>_</m:mtext>
- </m:mphantom>
- <xsl:if test="$test">
- <m:mtext mathcolor="Green">(hide details)</m:mtext>
- </xsl:if>
- </m:mrow>
- </xsl:variable>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">we proved</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
- <xsl:if test="not(*[4])">
- <xsl:copy-of select="$hidedetails"/>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="*[4]">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=4]"/>
- <xsl:copy-of select="$hidedetails"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </m:mtable>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$test">
- <m:maction actiontype="toggle">
- <xsl:copy-of select="$hidden_details"/>
- <xsl:copy-of select="$shown_details"/>
- </m:maction>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$shown_details"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- SIDE_PROOF -->
- <xsl:when test="$name='side_proof'">
- <xsl:variable name="test" select="(not($explodeall))"/>
- <xsl:variable name="hidden_details">
- <xsl:if test="$test">
- <!-- Details hided (default) -->
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">We can prove</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <!-- the last child is either the expected type, if provided,-->
- <!-- or the synthesized type. -->
- <xsl:apply-templates select="*[position()=last()]"/>
- <m:mrow>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext mathcolor="Green">(explain)</m:mtext>
- </m:mrow>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="shown_details">
- <!-- Show details -->
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[position()=2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:variable name="hidedetails">
- <m:mrow>
- <m:mphantom>
- <m:mtext>_</m:mtext>
- </m:mphantom>
- <xsl:if test="$test">
- <m:mtext mathcolor="Green">(hide details)</m:mtext>
- </xsl:if>
- </m:mrow>
- </xsl:variable>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">we proved</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
- <xsl:if test="not(*[4])">
- <xsl:copy-of select="$hidedetails"/>
- </xsl:if>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="*[4]">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=4]"/>
- <xsl:copy-of select="$hidedetails"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </m:mtable>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$test">
- <m:maction actiontype="toggle">
- <xsl:copy-of select="$hidden_details"/>
- <xsl:copy-of select="$shown_details"/>
- </m:maction>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$shown_details"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- LETIN1 -->
- <xsl:when test="$name='letin1'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[position()=2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[position()=3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:when test="$name='by_induction'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">We prove</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="../*[3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">by induction on</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates
- select="*[position()=last()]/*[position()=last()]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:for-each select="*[position()>3 and not(position()=last())]">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="."/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- </m:mtable>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- inductive_case -->
- <xsl:when test="$name='inductive_case'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">Case</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <xsl:if test="*[3]/*[position()>1]">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">By induction hypothesis, we have:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:for-each select="*[3]/*[position()>1]">
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="m:ci"/>
- <m:mo stretchy="false">) </m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="m:type"/>
- </xsl:for-each>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[4]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- case_lhs -->
- <xsl:when test="$name='case_lhs'">
- <m:mrow>
- <xsl:choose>
- <xsl:when test="count(*)=2">
- <xsl:apply-templates select="*[2]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[2]"/>
- <xsl:for-each select="m:bvar">
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[1]"/>
- <m:mtext>:</m:mtext>
- <xsl:apply-templates select="m:type/*[1]"/>
- </xsl:for-each>
- <m:mo stretchy="false">)</m:mo>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </xsl:when>
- <!-- false_ind -->
- <xsl:when test="$name='false_ind'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">Contradiction.</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- LET-IN -->
- <xsl:when test="$name='letin'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
- <xsl:for-each select="*[(last() > position()) and (position()>1)]">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="."/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:for-each>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[position()=last()]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- LET -->
- <xsl:when test="$name='let'">
- <m:mtext>(</m:mtext>
- <xsl:apply-templates select="m:ci"/>
- <m:mtext>) </m:mtext>
- <xsl:apply-templates select="*[3]"/>
- </xsl:when>
- <!-- RW_STEP -->
- <xsl:when test="$name='rw_step'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="name(*[2])='m:apply'">
- <xsl:apply-templates select="*[2]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>Consider</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[2]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Rewrite</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[3]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>with</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[4]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>by</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[5]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- not existing any more
- <xsl:when test="$name='thread'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="name(*[last()])='m:apply'">
- <xsl:apply-templates select="*[last()]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>Consider</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[last()]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
- </m:mtable>
- </xsl:when>
- -->
- <!-- REWRITE_AND_APPLY -->
- <xsl:when test="$name='rewrite_and_apply'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Then apply it to</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()>2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- AND_IND -->
- <xsl:when test="$name='and_ind'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="name(*[2])='m:apply'">
- <xsl:apply-templates select="*[2]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>Consider</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[2]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>In particular, we have</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>(</m:mtext>
- <xsl:apply-templates select="*[3]"/>
- <m:mtext>)</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[4]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>(</m:mtext>
- <xsl:apply-templates select="*[5]"/>
- <m:mtext>)</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[6]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[7]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- full_or_ind -->
- <xsl:when test="$name='full_or_ind'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="name(*[2])='m:apply'">
- <xsl:apply-templates select="*[2]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>Consider</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[2]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>We proceed by cases to prove</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Left: suppose</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[4]/m:bvar/m:ci"/>
- <m:mo stretchy="false">)</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[4]/m:bvar/m:type/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[4]/*[3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Right: suppose</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[5]/m:bvar/m:ci"/>
- <m:mo stretchy="false">)</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[5]/m:bvar/m:type/*[1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[5]/*[3]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- OR_IND -->
- <xsl:when test="$name='or_ind'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="name(*[2])='m:apply'">
- <xsl:apply-templates select="*[2]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>Consider</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[2]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>We prove</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[3]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>by cases:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Left</m:mtext>
- <xsl:apply-templates select="*[4]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Right</m:mtext>
- <xsl:apply-templates select="*[5]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- EX_IND -->
- <xsl:when test="$name='ex_ind'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="name(*[2])='m:apply'">
- <xsl:apply-templates select="*[2]"/>
- </xsl:when>
- <xsl:otherwise>
- <m:mtext>Consider</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[2]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Let</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[3]"/>
- <m:mtext>:</m:mtext>
- <xsl:apply-templates select="*[4]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>such that</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>(</m:mtext>
- <xsl:apply-templates select="*[5]"/>
- <m:mtext>)</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[6]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="*[7]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <!-- EQ_CHAIN -->
- <xsl:when test="$name='eq_chain'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">We have the following equality chain:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:for-each select="*[position() mod 2 = 0]">
- <xsl:variable name="pos" select="position()"/>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="$pos = 1">
- <xsl:apply-templates select="."/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mo>=</m:mo>
- </xsl:when>
- <xsl:otherwise>
- <m:mo>=</m:mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$pos != last()">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="../*[position()=2*$pos +1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </xsl:for-each>
- </m:mtable>
- </xsl:when>
- <!-- DISEQ_CHAIN -->
- <xsl:when test="$name='diseq_chain'">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">We have the following disequality chain:</m:mtext>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:for-each select="*[position() mod 3 = 2]">
- <xsl:variable name="pos" select="position()"/>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:choose>
- <xsl:when test="$pos = 1">
- <xsl:apply-templates select="."/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <mo><xsl:apply-templates select="../*[position()=3*$pos]"/></mo>
- </xsl:when>
- <xsl:otherwise>
- <mo><xsl:apply-templates select="../*[position()=3*($pos - 1)]"/></mo>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <xsl:if test="$pos != last()">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
- <xsl:apply-templates select="../*[position()=3*$pos +1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:if>
- </xsl:for-each>
- </m:mtable>
- </xsl:when>
- <!-- ***************************************** -->
- <!-- *********** NOTATIONS ******************* -->
- <!-- ***************************************** -->
- <!-- subst -->
- <xsl:when test="$name='subst'">
- <xsl:apply-templates select="*[3]"/>
-<!-- no font for ApplyFunction: <m:mo></m:mo> -->
- <m:mo stretchy="false">[</m:mo>
- <xsl:apply-templates select="*[4]"/>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>←</m:mo>
- <xsl:apply-templates select="*[2]"/>
- <m:mo stretchy="false">]</m:mo>
- </xsl:when>
- <!-- lift -->
- <xsl:when test="$name='lift'">
- <m:msup>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>↑</m:mo>
- <xsl:apply-templates select="*[2]"/>
- </m:msup>
- <m:mrow>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[3]"/>
- <m:mo stretchy="false">)</m:mo>
- </m:mrow>
- </xsl:when>
- <!-- lift_with_base -->
- <xsl:when test="$name='lift_with_base'">
- <m:msubsup>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>↑</m:mo>
- <xsl:apply-templates select="*[3]"/>
- <xsl:apply-templates select="*[4]"/>
- </m:msubsup>
- <m:mrow>
- <m:mo stretchy="false">(</m:mo>
- <xsl:apply-templates select="*[2]"/>
- <m:mo stretchy="false">)</m:mo>
- </m:mrow>
- </xsl:when>
- <!-- beta_red1 -->
- <xsl:when test="$name='beta_red1'">
- <xsl:apply-templates select="*[2]"/>
- <m:munder>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>→</m:mo>
- <m:mi mathcolor="Green">β</m:mi>
- </m:munder>
- <xsl:apply-templates select="*[3]"/>
- </xsl:when>
- <!-- beta_red -->
- <xsl:when test="$name='beta_red'">
- <xsl:apply-templates select="*[2]"/>
- <m:munderover>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>→</m:mo>
- <m:mi mathcolor="Green">β</m:mi>
- <m:mi mathcolor="Green">*</m:mi>
- </m:munderover>
- <xsl:apply-templates select="*[3]"/>
- </xsl:when>
- <!-- par_beta_red1 -->
- <xsl:when test="$name='par_beta_red1'">
- <xsl:apply-templates select="*[2]"/>
- <m:munder>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>⇒</m:mo>
- <m:mi mathcolor="Green">β</m:mi>
- </m:munder>
- <xsl:apply-templates select="*[3]"/>
- </xsl:when>
- <!-- par_beta_red -->
- <xsl:when test="$name='par_beta_red'">
- <xsl:apply-templates select="*[2]"/>
- <m:munderover>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>⇒</m:mo>
- <m:mi mathcolor="Green">β</m:mi>
- <m:mi mathcolor="Green">*</m:mi>
- </m:munderover>
- <xsl:apply-templates select="*[3]"/>
- </xsl:when>
- <!-- forgetful -->
- <xsl:when test="$name='forgetful'">
- <m:mfenced open="|" close="|">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="*[2]"/>
- </m:mfenced>
- </xsl:when>
- <!-- isomorphic -->
- <xsl:when test="$name='isomorphic'">
- <xsl:apply-templates select="*[2]"/>
- <m:mo mathcolor="Green">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>≅</m:mo>
- <xsl:apply-templates select="*[3]"/>
- </xsl:when>
- <!-- interp -->
- <xsl:when test="$name='forgetful'">
- <m:mfenced open="[" close="]">
- <xsl:if test="$id != ''">
- <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="*[2]"/>
- </m:mfenced>
- </xsl:when>
-
- <!-- ERROR -->
- <xsl:otherwise>
- <m:mi>ERROR</m:mi>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
-</xsl:template>
-
-<!-- Il modo Thread non esiste piu'
-<xsl:template match="*" mode="thread">
- <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="$name='rw_step'">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext>Rewrite</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>with</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>by</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">we get</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="."/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:when>
- <xsl:otherwise>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <xsl:apply-templates select="following-sibling::*[position()=1]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mtext mathcolor="Red">we get</m:mtext>
- <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="."/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
-</xsl:template>
--->
-
-<!-- LAMBDA -->
-
-<xsl:template match="m:lambda">
- <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
- <m:mrow>
- <xsl:if test="@id">
- <xsl:attribute name="xref">
- <xsl:value-of select="@id"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="$charlength >= $framewidth">
- <m:mtable align="baseline 1" equalrows="false" columnalign="left">
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo mathcolor="Red">λ</m:mo>
- <xsl:apply-templates select="m:bvar"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- <m:mtr>
- <m:mtd>
- <m:mrow>
- <m:mo>.</m:mo>
- <xsl:apply-templates select="*[position()=2]"/>
- </m:mrow>
- </m:mtd>
- </m:mtr>
- </m:mtable>
- </xsl:when>
- <xsl:otherwise>
- <m:mo mathcolor="Red">λ</m:mo>
- <xsl:apply-templates select="m:bvar/m:ci"/>
- <m:mo>:</m:mo>
- <xsl:apply-templates select="m:bvar/m:type"/>
- <m:mo>.</m:mo>
- <xsl:apply-templates select="*[position()=2]"/>
- </xsl:otherwise>
- </xsl:choose>
- </m:mrow>
-</xsl:template>
-
-
-<!--**********************-->
-<!-- COUNTING -->
-<!--**********************-->
-
-<xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
- |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
- |m:plus|m:minus|m:times" mode="charcount">
-<xsl:param name="incurrent_length" select="0"/>
- <xsl:choose>
- <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
- <xsl:variable name="siblength">
- <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
- <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
- </xsl:apply-templates>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string($siblength) = """>
- <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($siblength)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="m:ci|m:csymbol" mode="charcount">
-<xsl:param name="incurrent_length" select="0"/>
-<xsl:param name="nosibling" select="0"/>
- <xsl:choose>
- <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
- <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/></xsl:apply-templates></xsl:variable>
- <xsl:choose>
- <xsl:when test="string($siblength) = """>
- <xsl:value-of select="$incurrent_length + string-length()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($siblength)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$incurrent_length + string-length()"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="*" mode="charcount">
-<xsl:param name="incurrent_length" select="0"/>
-<xsl:param name="nosibling" select="0"/>
- <xsl:choose>
- <xsl:when test="count(child::*) = 0">
- <!-- tremendous bug fixed. An empty element can still have siblings!!! -->
- <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>
- <xsl:choose>
- <xsl:when test="string($siblength) = """>
- <xsl:value-of select="$incurrent_length"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($siblength)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <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>
- <xsl:choose>
- <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
- <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>
- <xsl:choose>
- <xsl:when test="string($siblength) = """>
- <xsl:value-of select="number($childlength)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($siblength)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($childlength)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-</xsl:stylesheet>
-