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 <xsl:template match="APPLY[MUTIND/@uri='cic:/Coq/Init/Peano/le.ind']" mode="pure">
73 <xsl:call-template name="mk-mml-op-noannot">
74 <xsl:with-param name="arity" select="2"/>
75 <xsl:with-param name="c-tag" select="MUTIND"/>
76 <xsl:with-param name="m-tag" select="'leq'"/>
80 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/lt.con']" mode="pure">
81 <xsl:call-template name="mk-mml-op-noannot">
82 <xsl:with-param name="arity" select="2"/>
83 <xsl:with-param name="c-tag" select="CONST"/>
84 <xsl:with-param name="m-tag" select="'lt'"/>
88 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/ge.con']" mode="pure">
89 <xsl:call-template name="mk-mml-op-noannot">
90 <xsl:with-param name="arity" select="2"/>
91 <xsl:with-param name="c-tag" select="CONST"/>
92 <xsl:with-param name="m-tag" select="'geq'"/>
96 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/gt.con']" mode="pure">
97 <xsl:call-template name="mk-mml-op-noannot">
98 <xsl:with-param name="arity" select="2"/>
99 <xsl:with-param name="c-tag" select="CONST"/>
100 <xsl:with-param name="m-tag" select="'gt'"/>
104 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/plus.con']" mode="pure">
105 <xsl:call-template name="mk-mml-op-noannot">
106 <xsl:with-param name="arity" select="2"/>
107 <xsl:with-param name="c-tag" select="CONST"/>
108 <xsl:with-param name="m-tag" select="'plus'"/>
112 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Arith/Minus/minus.con']" mode="pure">
113 <xsl:call-template name="mk-mml-op-noannot">
114 <xsl:with-param name="arity" select="2"/>
115 <xsl:with-param name="c-tag" select="CONST"/>
116 <xsl:with-param name="m-tag" select="'minus'"/>
120 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Init/Peano/mult.con']" mode="pure">
121 <xsl:call-template name="mk-mml-op-noannot">
122 <xsl:with-param name="arity" select="2"/>
123 <xsl:with-param name="c-tag" select="CONST"/>
124 <xsl:with-param name="m-tag" select="'times'"/>
128 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Arith/Min/min.con']" mode="pure">
129 <xsl:call-template name="mk-mml-op-noannot">
130 <xsl:with-param name="arity" select="2"/>
131 <xsl:with-param name="c-tag" select="CONST"/>
132 <xsl:with-param name="m-tag" select="'min'"/>
136 <!-- **************************** Zarith ******************************** -->
139 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/Zle.con']" mode="pure">
140 <xsl:call-template name="mk-mml-op-noannot">
141 <xsl:with-param name="arity" select="2"/>
142 <xsl:with-param name="c-tag" select="CONST"/>
143 <xsl:with-param name="m-tag" select="'leq'"/>
147 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/Zlt.con']" mode="pure">
148 <xsl:call-template name="mk-mml-op-noannot">
149 <xsl:with-param name="arity" select="2"/>
150 <xsl:with-param name="c-tag" select="CONST"/>
151 <xsl:with-param name="m-tag" select="'lt'"/>
155 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/Zge.con']" mode="pure">
156 <xsl:call-template name="mk-mml-op-noannot">
157 <xsl:with-param name="arity" select="2"/>
158 <xsl:with-param name="c-tag" select="CONST"/>
159 <xsl:with-param name="m-tag" select="'geq'"/>
163 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/Zgt.con']" mode="pure">
164 <xsl:call-template name="mk-mml-op-noannot">
165 <xsl:with-param name="arity" select="2"/>
166 <xsl:with-param name="c-tag" select="CONST"/>
167 <xsl:with-param name="m-tag" select="'gt'"/>
171 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Zplus.con']" mode="pure">
172 <xsl:call-template name="mk-mml-op-noannot">
173 <xsl:with-param name="arity" select="2"/>
174 <xsl:with-param name="c-tag" select="CONST"/>
175 <xsl:with-param name="m-tag" select="'plus'"/>
179 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/Zminus.con']" mode="pure">
180 <xsl:call-template name="mk-mml-op-noannot">
181 <xsl:with-param name="arity" select="2"/>
182 <xsl:with-param name="c-tag" select="CONST"/>
183 <xsl:with-param name="m-tag" select="'minus'"/>
187 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Zopp.con']" mode="pure">
188 <xsl:call-template name="mk-mml-op-noannot">
189 <xsl:with-param name="arity" select="1"/>
190 <xsl:with-param name="c-tag" select="CONST"/>
191 <xsl:with-param name="m-tag" select="'minus'"/>
195 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Zmult.con']" mode="pure">
196 <xsl:call-template name="mk-mml-op-noannot">
197 <xsl:with-param name="arity" select="2"/>
198 <xsl:with-param name="c-tag" select="CONST"/>
199 <xsl:with-param name="m-tag" select="'times'"/>
203 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/Zmin.con']" mode="pure">
204 <xsl:call-template name="mk-mml-op-noannot">
205 <xsl:with-param name="arity" select="2"/>
206 <xsl:with-param name="c-tag" select="CONST"/>
207 <xsl:with-param name="m-tag" select="'min'"/>
211 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/ZArith/zarith_aux/absolu.con']" mode="pure">
212 <xsl:call-template name="mk-mml-op-noannot">
213 <xsl:with-param name="arity" select="1"/>
214 <xsl:with-param name="c-tag" select="CONST"/>
215 <xsl:with-param name="m-tag" select="'abs'"/>
219 <!-- POS, NEG e ZERO -->
221 <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">
222 <xsl:apply-templates select="*[2]" mode="Zpositive">
223 <xsl:with-param name="base" select="0"/>
224 <xsl:with-param name="exp" select="1"/>
225 <xsl:with-param name="iden" select="*[2]/@id"/>
226 </xsl:apply-templates>
229 <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">
230 <m:apply helm:xref="{@id}">
231 <m:minus definitionURL="{*[1]/@uri}" helm:xref="{*[1]/@id}"/>
232 <xsl:apply-templates select="*[2]" mode="Zpositive">
233 <xsl:with-param name="base" select="0"/>
234 <xsl:with-param name="exp" select="1"/>
235 <xsl:with-param name="iden" select="*[2]/@id"/>
236 </xsl:apply-templates>
240 <xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='1']" mode="pure">
241 <m:ci definitionURL="{@uri}" helm:xref="{@id}">0</m:ci>
244 <!-- prova di notazione per positive -->
246 <xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind']]" mode="pure">
247 <xsl:apply-templates select="." mode="Zpositive">
248 <xsl:with-param name="base" select="0"/>
249 <xsl:with-param name="exp" select="1"/>
250 <xsl:with-param name="iden" select="@id"/>
251 </xsl:apply-templates>
254 <xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3']" mode="pure">
255 <m:ci definitionURL="{@uri}" helm:xref="{@id}">1</m:ci>
258 <xsl:template match="*" mode="Zpositive">
259 <xsl:param name="base" select="0"/>
260 <xsl:param name="exp" select="1"/>
261 <xsl:param name="iden" select="''"/>
263 <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT'
264 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='1']">
265 <xsl:apply-templates select="*[2]" mode="Zpositive">
266 <xsl:with-param name="base" select="$base + $exp"/>
267 <xsl:with-param name="exp" select="2 * $exp"/>
268 <xsl:with-param name="iden" select="$iden"/>
269 </xsl:apply-templates>
271 <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT'
272 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='2']">
273 <xsl:apply-templates select="*[2]" mode="Zpositive">
274 <xsl:with-param name="base" select="$base"/>
275 <xsl:with-param name="exp" select="2 * $exp"/>
276 <xsl:with-param name="iden" select="$iden"/>
277 </xsl:apply-templates>
279 <xsl:when test="name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3'">
280 <m:ci helm:xref="{$iden}"><xsl:value-of select="$base + $exp"/></m:ci>
284 <xsl:when test="$base = 0">
286 <xsl:when test="$exp = 1">
287 <xsl:apply-templates select="." mode="pure"/>
290 <m:apply helm:xref="{$iden}">
292 <m:ci><xsl:value-of select="$exp"/></m:ci>
293 <xsl:apply-templates select="." mode="pure"/>
299 <m:apply helm:xref="{$iden}">
301 <m:ci><xsl:value-of select="$base"/></m:ci>
303 <xsl:when test="$exp = 1">
304 <xsl:apply-templates select="." mode="pure"/>
307 <m:apply helm:xref="{$iden}">
309 <m:ci><xsl:value-of select="$exp"/></m:ci>
310 <xsl:apply-templates select="." mode="pure"/>