+<?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/. -->
+
+<!--******************************************************************-->
+<!-- Algebra -->
+<!-- First draft: October 2001 -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena, Guidi -->
+<!--******************************************************************-->
+
+<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">
+
+
+<!-- ************************* ALGEBRA *********************************-->
+
+
+
+<!-- 0 and 1 -->
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CSemiGroups/csg_unit.con']" mode="pure">
+ <m:ci definitionURL="{CONST/@uri}" helm:xref="{@id}">0</m:ci>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/cr_one.con']" mode="pure">
+ <m:ci definitionURL="{CONST/@uri}" helm:xref="{@id}">1</m:ci>
+</xsl:template>
+
+<!-- Unary Operations -->
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CGroups/cg_inv.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="1"/>
+ <xsl:with-param name="hide" 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/@uri='cic:/Algebra/CMetricFields/CMetric_Fields/cmf_abs.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'abs'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- inv (uri errata)
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/exponentiation/nexp.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 -->
+
+<!-- setoid equality -->
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CSetoids/cs_eq.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'eq'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- apart -->
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CSetoids/cs_ap.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'neq'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/COrdFields/leEq.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="arity" select="2"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'leq'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/COrdFields/cof_less.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'lt'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!--
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rge.con']" mode="pure">
+ <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:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rgt.con']" mode="pure">
+ <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:call-template>
+</xsl:template>
+-->
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/cr_plus.con' or
+CONST/@uri='cic:/Algebra/CSemiGroups/csg_op.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'plus'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/cr_minus.con' or
+ CONST/@uri='cic:/Algebra/CGroups/cg_minus.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" 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/@uri='cic:/Algebra/CRings/cr_mult.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'times'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CFields/cf_div.con']" mode="pure">
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="arity" select="2"/>
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'divide'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/Ring_constructions/nzpro.con' and count(*)='4']" mode="pure">
+ <xsl:apply-templates select="*[3]" mode="pure"/>
+</xsl:template>
+
+<!--
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rmin.con']" mode="pure">
+ <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:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rmax.con']" mode="pure">
+ <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:call-template>
+</xsl:template>
+-->
+
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/exponentiation/nexp.con']" mode="pure">
+ <xsl:variable name="no_params">
+ <xsl:call-template name="get_no_params">
+ <xsl:with-param name="first_uri" select="$CICURI"/>
+ <xsl:with-param name="second_uri" select="CONST/@uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="mk-mml-op-noannot">
+ <xsl:with-param name="hide" select="$no_params"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'power'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CRings/exponentiation/nexp_op.con' or CONST/@uri='cic:/Algebra/Expon/Zexp_def/zexp.con']" mode="pure">
+ <xsl:variable name="no_params">
+ <xsl:call-template name="get_no_params">
+ <xsl:with-param name="first_uri" select="$CICURI"/>
+ <xsl:with-param name="second_uri" select="CONST/@uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mbody">
+ <xsl:apply-templates mode="noannot" select="*[3+$no_params]"/>
+ <xsl:apply-templates mode="noannot" select="*[2+$no_params]"/>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="hide" select="$no_params"/>
+ <xsl:with-param name="arity" select="2"/>
+ <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:/Algebra/COrdFields/absSmall.con']" mode="pure">
+ <xsl:variable name="mbody">
+ <m:apply helm:xref="{@id}">
+ <m:abs definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <xsl:apply-templates select="*[4]" mode="noannot"/>
+ </m:apply>
+ <xsl:apply-templates select="*[3]" mode="noannot"/>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="hide" select="1"/>
+ <xsl:with-param name="arity" select="2"/>
+ <xsl:with-param name="c-tag" select="CONST"/>
+ <xsl:with-param name="m-tag" select="'lt'"/>
+ <xsl:with-param name="mbody" select="$mbody"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/Algebra/COrdFields/OrdField_Cauchy/seqLimit.con']]" mode="pure">
+ <xsl:variable name="no_params">
+ <xsl:call-template name="get_no_params">
+ <xsl:with-param name="first_uri" select="$CICURI"/>
+ <xsl:with-param name="second_uri" select="CONST/@uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="count(child::*) = 3+$no_params">
+ <m:apply helm:xref="{@id}">
+ <m:eq definitionURL="{CONST/@uri}" helm:xref="{@id}" />
+ <xsl:choose>
+ <xsl:when test="name(*[2+$no_params]) = 'LAMBDA'">
+ <m:apply helm:xref="{CONST/@id}">
+ <m:limit definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ </m:bvar>
+ <m:lowlimit>
+ <m:infinity/>
+ </m:lowlimit>
+ <xsl:apply-templates select="*[2+$no_params]/target/*[1]" mode="noannot"/>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <m:apply helm:xref="{CONST/@id}">
+ <m:limit definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <m:bvar>
+ <m:ci>$x</m:ci>
+ </m:bvar>
+ <m:lowlimit>
+ <m:infinity/>
+ </m:lowlimit>
+ <m:apply>
+ <m:csymbol>app</m:csymbol>
+ <xsl:apply-templates select="*[2+$no_params]" mode="noannot"/>
+ <m:ci>$x</m:ci>
+ </m:apply>
+ </m:apply>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="*[3+$no_params]" mode="noannot"/>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/Algebra/CSums/Sums/sum0.con']]" mode="pure">
+ <xsl:variable name="no_params">
+ <xsl:call-template name="get_no_params">
+ <xsl:with-param name="first_uri" select="$CICURI"/>
+ <xsl:with-param name="second_uri" select="CONST/@uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="count(child::*) = 3+$no_params">
+ <xsl:choose>
+ <xsl:when test="name(*[3+$no_params]) = 'LAMBDA'">
+ <m:apply helm:xref="{CONST/@id}">
+ <m:sum definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ </m:bvar>
+ <m:condition>
+ <m:apply>
+ <m:lt/>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ <xsl:apply-templates mode="noannot" select="*[2+$no_params]"/>
+ </m:apply>
+ </m:condition>
+ <xsl:apply-templates select="*[3+$no_params]/target/*[1]" mode="noannot"/>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <m:apply helm:xref="{CONST/@id}">
+ <m:sum definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <m:bvar>
+ <m:ci>$x</m:ci>
+ </m:bvar>
+ <m:condition>
+ <m:apply>
+ <m:lt/>
+ <m:ci>$x</m:ci>
+ <xsl:apply-templates mode="noannot" select="*[2+$no_params]"/>
+ </m:apply>
+ </m:condition>
+ <m:apply>
+ <m:csymbol>app</m:csymbol>
+ <xsl:apply-templates select="*[3+$no_params]" mode="noannot"/>
+ <m:ci>$x</m:ci>
+ </m:apply>
+ </m:apply>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- sum -->
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/Algebra/CSums/Sums/sum.con']]" mode="pure">
+ <xsl:variable name="no_params">
+ <xsl:call-template name="get_no_params">
+ <xsl:with-param name="first_uri" select="$CICURI"/>
+ <xsl:with-param name="second_uri" select="CONST/@uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="count(child::*) = 4+$no_params">
+ <xsl:choose>
+ <xsl:when test="name(*[4+$no_params]) = 'LAMBDA'">
+ <m:apply helm:xref="{CONST/@id}">
+ <m:sum definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ </m:bvar>
+ <m:lowlimit>
+ <xsl:apply-templates mode="noannot" select="*[2+$no_params]"/>
+ </m:lowlimit>
+ <m:uplimit>
+ <xsl:apply-templates mode="noannot" select="*[3+$no_params]"/>
+ </m:uplimit>
+ <xsl:apply-templates select="*[4+$no_params]/target/*[1]" mode="noannot"/>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <m:apply helm:xref="{CONST/@id}">
+ <m:sum definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
+ <m:bvar>
+ <m:ci>$x</m:ci>
+ </m:bvar>
+ <m:lowlimit>
+ <xsl:apply-templates mode="noannot" select="*[2+$no_params]"/>
+ </m:lowlimit>
+ <m:uplimit>
+ <xsl:apply-templates mode="noannot" select="*[3+$no_params]"/>
+ </m:uplimit>
+ <m:apply>
+ <m:csymbol>app</m:csymbol>
+ <xsl:apply-templates select="*[4+$no_params]" mode="noannot"/>
+ <m:ci>$x</m:ci>
+ </m:apply>
+ </m:apply>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- polynomials -->
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Algebra/CPolynomials/CPoly_CRing_ctd/cpoly_apply_fun.con']" mode="pure">
+ <xsl:variable name="no_params">
+ <xsl:call-template name="get_no_params">
+ <xsl:with-param name="first_uri" select="$CICURI"/>
+ <xsl:with-param name="second_uri" select="CONST/@uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="count(child::*) = 3+$no_params">
+ <m:apply>
+ <m:csymbol>app</m:csymbol>
+ <xsl:apply-templates mode="noannot" select="*[2+$no_params]"/>
+ <xsl:apply-templates mode="noannot" select="*[3+$no_params]"/>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
+
+