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 <!--******************************************************************-->
29 <!-- First draft: March 20 2001, Ferruccio Guidi -->
30 <!-- Zarith: July 2001, Andrea Asperti -->
31 <!--******************************************************************-->
33 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34 xmlns:m="http://www.w3.org/1998/Math/MathML"
35 xmlns:helm="http://www.cs.unibo.it/helm">
37 <!-- ************************** ARITHMETICS ****************************** -->
40 <xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2'] and count(*)=2]" mode="pure">
41 <xsl:apply-templates select="*[2]" mode="succ">
42 <xsl:with-param name="n" select="1"/>
43 <xsl:with-param name="iden" select="@id"/>
44 </xsl:apply-templates>
47 <xsl:template match="*" mode="succ">
48 <xsl:param name="n" select="0"/>
49 <xsl:param name="iden" select="''"/>
51 <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT'
52 and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2']">
53 <xsl:apply-templates select="*[2]" mode="succ">
54 <xsl:with-param name="n" select="$n +1"/>
55 <xsl:with-param name="iden" select="$iden"/>
56 </xsl:apply-templates>
58 <xsl:when test="name()='MUTCONSTRUCT' and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='1'">
59 <m:cn helm:xref="{$iden}"><xsl:value-of select="$n"/></m:cn>
62 <m:apply helm:xref="{$iden}">
64 <m:cn><xsl:value-of select="$n"/></m:cn>
65 <xsl:apply-templates select="." mode="pure"/>
72 <!-- **************************** Zarith ******************************** -->
76 <xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='2'] and count(*)=2]" mode="pure">
77 <xsl:apply-templates select="*[2]" mode="Zpositive">
78 <xsl:with-param name="base" select="0"/>
79 <xsl:with-param name="exp" select="1"/>
80 <xsl:with-param name="iden" select="*[2]/@id"/>
81 </xsl:apply-templates>
84 <xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='3'] and count(*)=2]" mode="pure">
85 <m:apply helm:xref="{@id}">
86 <m:minus definitionURL="{*[1]/@uri}" helm:xref="{*[1]/@id}"/>
87 <xsl:apply-templates select="*[2]" mode="Zpositive">
88 <xsl:with-param name="base" select="0"/>
89 <xsl:with-param name="exp" select="1"/>
90 <xsl:with-param name="iden" select="*[2]/@id"/>
91 </xsl:apply-templates>
95 <xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='1']" mode="pure">
96 <m:ci definitionURL="{@uri}" helm:xref="{@id}">0</m:ci>
99 <!-- prova di notazione per positive -->
101 <xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind']]" mode="pure">
102 <xsl:apply-templates select="." mode="Zpositive">
103 <xsl:with-param name="base" select="0"/>
104 <xsl:with-param name="exp" select="1"/>
105 <xsl:with-param name="iden" select="@id"/>
106 </xsl:apply-templates>
109 <xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3']" mode="pure">
110 <m:ci definitionURL="{@uri}" helm:xref="{@id}">1</m:ci>
113 <xsl:template match="*" mode="Zpositive">
114 <xsl:param name="base" select="0"/>
115 <xsl:param name="exp" select="1"/>
116 <xsl:param name="iden" select="''"/>
118 <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT'
119 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='1']">
120 <xsl:apply-templates select="*[2]" mode="Zpositive">
121 <xsl:with-param name="base" select="$base + $exp"/>
122 <xsl:with-param name="exp" select="2 * $exp"/>
123 <xsl:with-param name="iden" select="$iden"/>
124 </xsl:apply-templates>
126 <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT'
127 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='2']">
128 <xsl:apply-templates select="*[2]" mode="Zpositive">
129 <xsl:with-param name="base" select="$base"/>
130 <xsl:with-param name="exp" select="2 * $exp"/>
131 <xsl:with-param name="iden" select="$iden"/>
132 </xsl:apply-templates>
134 <xsl:when test="name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3'">
135 <m:ci helm:xref="{$iden}"><xsl:value-of select="$base + $exp"/></m:ci>
139 <xsl:when test="$base = 0">
141 <xsl:when test="$exp = 1">
142 <xsl:apply-templates select="." mode="pure"/>
145 <m:apply helm:xref="{$iden}">
147 <m:ci><xsl:value-of select="$exp"/></m:ci>
148 <xsl:apply-templates select="." mode="pure"/>
154 <m:apply helm:xref="{$iden}">
156 <m:ci><xsl:value-of select="$base"/></m:ci>
158 <xsl:when test="$exp = 1">
159 <xsl:apply-templates select="." mode="pure"/>
162 <m:apply helm:xref="{$iden}">
164 <m:ci><xsl:value-of select="$exp"/></m:ci>
165 <xsl:apply-templates select="." mode="pure"/>