<!-- ************************** ARITHMETICS ****************************** -->
<xsl:template match="APPLY[MUTIND/@uri='cic:/Coq/Init/Peano/le.ind']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="MUTIND"/>
<xsl:with-param name="m-tag" select="'leq'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/lt.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'lt'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/ge.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'geq'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/gt.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'gt'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/plus.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'plus'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Arith/Minus/minus.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'minus'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/mult.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'times'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Arith/Min/min.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'min'"/>
</m:apply>
</xsl:template>
-<!-- EQUALITY -->
-
-<xsl:template match="APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic/Equality/eq.ind'] and (count(child::*) = 4)]" mode="pure">
- <m:apply helm:xref="{@id}">
- <m:eq definitionURL="{MUTIND/@uri}" helm:xref="{MUTIND/@id}"/>
- <xsl:apply-templates select="*[3]" mode="noannot"/>
- <xsl:apply-templates select="*[4]" mode="noannot"/>
- </m:apply>
+<!-- EQUALITY and TYPE EQUALITY -->
+
+<xsl:template match="APPLY[MUTIND/@uri='cic:/Coq/Init/Logic/Equality/eq.ind']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="3"/>
+ <xsl:with-param name="c-tag" select="MUTIND"/>
+ <xsl:with-param name="m-tag" select="'eq'"/>
+ <xsl:with-param name="rnset" select="*[position() > 2]"/>
+ </xsl:call-template>
</xsl:template>
-
-<!-- TYPE EQUALITY -->
-
-<xsl:template match="APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic_Type/eqT.ind'] and (count(child::*) = 4)]" mode="pure">
- <m:apply helm:xref="{@id}">
- <m:eq definitionURL="{MUTIND/@uri}" helm:xref="{MUTIND/@id}"/>
- <xsl:apply-templates select="*[3]" mode="noannot"/>
- <xsl:apply-templates select="*[4]" mode="noannot"/>
- </m:apply>
+<xsl:template match="APPLY[MUTIND/@uri='cic:/Coq/Init/Logic_Type/eqT.ind']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="3"/>
+ <xsl:with-param name="c-tag" select="MUTIND"/>
+ <xsl:with-param name="m-tag" select="'eq'"/>
+ <xsl:with-param name="rnset" select="*[position() > 2]"/>
+ </xsl:call-template>
</xsl:template>
<!-- NOT-EQ -->
xmlns:helm="http://www.cs.unibo.it/helm"
xmlns:xlink="http://www.w3.org/1999/xlink">
-<xsl:template name="mkmml-op-noannot"> <!-- make MML node for operators (noannot mode) -->
- <xsl:param name="arity"/> <!-- operator arity -->
- <xsl:param name="c-tag"/> <!-- CIC tag -->
- <xsl:param name="m-tag"/> <!-- MathML tag -->
+<xsl:template name="out-mml-op"> <!-- outputs MML nodes for operators -->
+ <xsl:param name="arity"/> <!-- operator arity -->
+ <xsl:param name="c-tag"/> <!-- CIC tag -->
+ <xsl:param name="m-tag"/> <!-- MathML tag -->
+ <xsl:param name="mbody"/> <!-- other sons of m:apply -->
<xsl:choose>
<xsl:when test="count(child::*) = $arity + 1">
<m:apply helm:xref="{@id}">
<xsl:value-of select="$c-tag/@id"/>
</xsl:attribute>
</xsl:element>
- <xsl:apply-templates select="*[position() > 1]" mode="noannot"/>
+ <xsl:copy-of select="$mbody"/>
</m:apply>
</xsl:when>
<xsl:otherwise>
</xsl:choose>
</xsl:template>
+<!-- noannot -->
+
+<xsl:template name="mk-mml-op-noannot"> <!-- makes MML nodes for operators (noannot mode) -->
+ <xsl:param name="arity"/> <!-- operator arity -->
+ <xsl:param name="c-tag"/> <!-- CIC tag -->
+ <xsl:param name="m-tag"/> <!-- MathML tag -->
+ <xsl:param name="rnset"
+ select="*[position() > 1]"/> <!-- nodes for recursion -->
+ <xsl:variable name="mbody">
+ <xsl:apply-templates select="$rnset" mode="noannot"/>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="arity" select="$arity"/>
+ <xsl:with-param name="c-tag" select="$c-tag"/>
+ <xsl:with-param name="m-tag" select="$m-tag"/>
+ <xsl:with-param name="mbody" select="$mbody"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- interp -->
+
<xsl:template name="start-interp"> <!-- interp mode starter -->
<xsl:param name="rtree"/>
<xsl:param name="atree"/>
</m:apply>
</xsl:template>
-<xsl:template name="mkmml-op-interp"> <!-- make MML node for operators (interp mode) -->
- <xsl:param name="arity"/> <!-- operator arity -->
- <xsl:param name="c-tag"/> <!-- CIC tag -->
- <xsl:param name="m-tag"/> <!-- MathML tag -->
- <xsl:param name="atree"/> <!-- abstract tree pointer -->
- <xsl:choose>
- <xsl:when test="count(child::*) = $arity + 1">
- <m:apply helm:xref="{@id}">
- <xsl:element name="{concat('m:',$m-tag)}">
- <xsl:attribute name="definitionURL">
- <xsl:value-of select="$c-tag/@uri"/>
- </xsl:attribute>
- <xsl:attribute name="helm:xref">
- <xsl:value-of select="$c-tag/@id"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:apply-templates select="*[position() > 1]" mode="interp">
- <xsl:with-param name="atree" select="$atree"/>
- </xsl:apply-templates>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-imports/>
- </xsl:otherwise>
- </xsl:choose>
+<xsl:template name="mk-mml-op-interp"> <!-- make MML node for operators (interp mode) -->
+ <xsl:param name="arity"/> <!-- operator arity -->
+ <xsl:param name="c-tag"/> <!-- CIC tag -->
+ <xsl:param name="m-tag"/> <!-- MathML tag -->
+ <xsl:param name="atree"/> <!-- abstract tree pointer -->
+ <xsl:variable name="mbody">
+ <xsl:apply-templates select="*[position() > 1]" mode="interp">
+ <xsl:with-param name="atree" select="$atree"/>
+ </xsl:apply-templates>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="arity" select="$arity"/>
+ <xsl:with-param name="c-tag" select="$c-tag"/>
+ <xsl:with-param name="m-tag" select="$m-tag"/>
+ <xsl:with-param name="mbody" select="$mbody"/>
+ </xsl:call-template>
</xsl:template>
</xsl:stylesheet>
<!-- Unary Operations and power -->
-<xsl:template match="APPLY[CONST[
- attribute::uri='cic:/Coq/Reals/Rdefinitions/Ropp.con' or
- attribute::uri='cic:/Coq/Reals/Rbasic_fun/Rabsolu.con' or
- attribute::uri='cic:/Coq/Reals/Rfunctions/fact.con' or
- attribute::uri='cic:/Coq/Reals/Rbase/Rsqr.con']]" mode="pure">
- <xsl:choose>
- <xsl:when test="count(child::*) = 2">
- <xsl:variable name="elem">
- <xsl:choose>
- <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rdefinitions/Ropp.con'">
- <xsl:value-of select="'minus'"/>
- </xsl:when>
- <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rabsolu.con'">
- <xsl:value-of select="'abs'"/>
- </xsl:when>
- <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rfunctions/fact.con'">
- <xsl:value-of select="'factorial'"/>
- </xsl:when>
- <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rbase/Rsqr.con'">
- <xsl:value-of select="'power'"/>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <m:apply helm:xref="{@id}">
- <xsl:element name="{concat('m:',$elem)}">
- <xsl:attribute name="definitionURL">
- <xsl:value-of select="CONST/@uri"/>
- </xsl:attribute>
- <xsl:attribute name="helm:xref">
- <xsl:value-of select="CONST/@id"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:apply-templates select="*[2]" mode="noannot"/>
- <xsl:if test="string($elem)='power'">
- <m:cn><xsl:value-of select="*[2]/@value"/></m:cn>
- </xsl:if>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-imports/>
- </xsl:otherwise>
- </xsl:choose>
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Ropp.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'minus'"/>
+ </xsl:call-template>
</xsl:template>
-<xsl:template match="APPLY[CONST[
- attribute::uri='cic:/Coq/Reals/Rdefinitions/Rinv.con']]" mode="pure">
- <xsl:choose>
- <xsl:when test="count(child::*) = 2">
- <m:apply helm:xref="{@id}">
- <m:power/>
- <xsl:apply-templates select="*[2]" mode="noannot"/>
- <m:apply>
- <m:minus>
- <xsl:attribute name="definitionURL">
- <xsl:value-of select="CONST/@uri"/>
- </xsl:attribute>
- <xsl:attribute name="helm:xref">
- <xsl:value-of select="CONST/@id"/>
- </xsl:attribute>
- </m:minus>
- <m:cn>1</m:cn>
- </m:apply>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-imports/>
- </xsl:otherwise>
- </xsl:choose>
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rabsolu.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'abs'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rfunctions/fact.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'factorial'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbase/Rsqr.con']" mode="pure">
+ <xsl:variable name="mbody">
+ <xsl:apply-templates select="*[2]" mode="noannot"/>
+ <m:cn>2</m:cn>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'power'"/>
+ <xsl:with-param name="mbody" select="$mbody"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rinv.con']" mode="pure">
+ <xsl:variable name="mbody1">
+ <xsl:apply-templates select="*[2]" mode="noannot"/>
+ <xsl:variable name="mbody2">
+ <m:cn>1</m:cn>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'minus'"/>
+ <xsl:with-param name="mbody" select="$mbody2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'power'"/>
+ <xsl:with-param name="mbody" select="$mbody1"/>
+ </xsl:call-template>
</xsl:template>
<!-- Binary Operations and Relations -->
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rle.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'leq'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rlt.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'lt'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rge.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'geq'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rgt.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'gt'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rplus.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'plus'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rminus.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'minus'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rmult.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'times'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rdiv.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'divide'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rmin.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'min'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rmax.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'max'"/>
</xsl:template>
<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rfunctions/pow.con']" mode="pure">
- <xsl:call-template name="mkmml-op-noannot">
+ <xsl:call-template name="mk-mml-op-noannot">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="CONST"/>
<xsl:with-param name="m-tag" select="'power'"/>
<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind'
and @noConstr='4']]" mode="interp">
<xsl:param name="atree"/>
- <xsl:call-template name="mkmml-op-interp">
+ <xsl:call-template name="mk-mml-op-interp">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="MUTCONSTRUCT"/>
<xsl:with-param name="m-tag" select="'plus'"/>
<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind'
and @noConstr='5']]" mode="interp">
<xsl:param name="atree"/>
- <xsl:call-template name="mkmml-op-interp">
+ <xsl:call-template name="mk-mml-op-interp">
<xsl:with-param name="arity" select="2"/>
<xsl:with-param name="c-tag" select="MUTCONSTRUCT"/>
<xsl:with-param name="m-tag" select="'times'"/>
<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind'
and @noConstr='6']]" mode="interp">
<xsl:param name="atree"/>
- <xsl:call-template name="mkmml-op-interp">
+ <xsl:call-template name="mk-mml-op-interp">
<xsl:with-param name="arity" select="1"/>
<xsl:with-param name="c-tag" select="MUTCONSTRUCT"/>
<xsl:with-param name="m-tag" select="'minus'"/>