]> matita.cs.unibo.it Git - helm.git/commitdiff
"Recursive" notation for Z.
authorAndrea Asperti <andrea.asperti@unibo.it>
Wed, 25 Jul 2001 08:55:25 +0000 (08:55 +0000)
committerAndrea Asperti <andrea.asperti@unibo.it>
Wed, 25 Jul 2001 08:55:25 +0000 (08:55 +0000)
helm/style/arith.xsl
helm/style/proofs.xsl

index 6393d272280229930af40d0345ec8db7c27e0d84..e436df28c5cc6a72c62b40a765a803f88a19df8f 100644 (file)
    </xsl:call-template>
 </xsl:template>
 
+<!-- POS, NEG e ZERO -->
+
+<xsl:template match="APPLY[MUTCONSTRUCT[position()=1 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='2'] and count(*)=2]" mode="pure">
+   <xsl:apply-templates select="*[2]" mode="Zpositive">
+    <xsl:with-param name="base" select="0"/>
+    <xsl:with-param name="exp" select="1"/>
+    <xsl:with-param name="iden" select="*[2]/@id"/>
+   </xsl:apply-templates>
+</xsl:template>
+<xsl:template match="APPLY[MUTCONSTRUCT[position()=1 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='3'] and count(*)=2]" mode="pure">
+   <m:apply helm:xref="{@id}">
+    <m:minus definitionURL="{*[1]/@uri}" helm:xref="{*[1]/@id}"/>
+    <xsl:apply-templates select="*[2]" mode="Zpositive">
+     <xsl:with-param name="base" select="0"/>
+     <xsl:with-param name="exp" select="1"/>
+     <xsl:with-param name="iden" select="*[2]/@id"/>
+    </xsl:apply-templates>
+   </m:apply>
+</xsl:template>
+
+<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='1']" mode="pure">
+   <m:ci definitionURL="{@uri}" helm:xref="{@id}">0</m:ci>
+</xsl:template>
+
+<!-- prova di notazione per positive -->
+
+<xsl:template match="APPLY[MUTCONSTRUCT[position()=1 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind']]" mode="pure">
+   <xsl:apply-templates select="." mode="Zpositive">
+    <xsl:with-param name="base" select="0"/>
+    <xsl:with-param name="exp" select="1"/>
+    <xsl:with-param name="iden" select="@id"/>
+   </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="*" mode="Zpositive">
+ <xsl:param name="base" select="0"/>
+ <xsl:param name="exp" select="1"/>
+ <xsl:param name="iden" select="''"/>
+ <xsl:choose>
+  <xsl:when test="name()='APPLY' and MUTCONSTRUCT[position()=1 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='1']">
+   <xsl:apply-templates select="*[2]" mode="Zpositive">
+    <xsl:with-param name="base" select="$base + $exp"/>
+    <xsl:with-param name="exp" select="2 * $exp"/>
+    <xsl:with-param name="iden" select="$iden"/>
+   </xsl:apply-templates>
+  </xsl:when>
+  <xsl:when test="name()='APPLY' and MUTCONSTRUCT[position()=1 and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='2']">
+   <xsl:apply-templates select="*[2]" mode="Zpositive">
+    <xsl:with-param name="base" select="$base"/>
+    <xsl:with-param name="exp" select="2 * $exp"/>
+    <xsl:with-param name="iden" select="$iden"/>
+   </xsl:apply-templates>
+  </xsl:when>
+  <xsl:when test="name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3'">
+   <m:ci helm:xref="{$iden}"><xsl:value-of select="$base + $exp"/></m:ci>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:choose>
+    <xsl:when test="$base = 0">
+     <xsl:choose>
+      <xsl:when test="$exp = 1">
+       <m:ci helm:xref="{$iden}"><xsl:value-of select="$exp"/></m:ci>
+      </xsl:when>
+      <xsl:otherwise>
+       <m:apply helm:xref="{$iden}">
+        <m:times/>
+        <m:ci><xsl:value-of select="$exp"/></m:ci>
+        <xsl:apply-templates select="." mode="pure"/>
+       </m:apply>
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:apply helm:xref="{$iden}">
+      <m:plus/>
+      <m:ci><xsl:value-of select="$base"/></m:ci>
+      <xsl:choose>
+       <xsl:when test="$exp = 1">
+        <m:ci><xsl:value-of select="$exp"/></m:ci>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:apply helm:xref="{$iden}">
+         <m:times/>
+         <m:ci><xsl:value-of select="$exp"/></m:ci>
+         <xsl:apply-templates select="." mode="pure"/>
+        </m:apply>
+       </xsl:otherwise>
+      </xsl:choose>
+     </m:apply>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
 </xsl:stylesheet>
index b3596889174ce264678da62bc43b315c02b01599..9fd99d5d1f428bae49b03611cab694aee57154b9 100644 (file)
     <m:ci>.</m:ci>
    </xsl:otherwise>
    </xsl:choose>
- <xsl:apply-templates mode="previous" select="following-sibling::*[1]"/>
+ <xsl:apply-templates mode="erase" select="following-sibling::*[1]"/>
 </xsl:template>
 
 <xsl:template match="*" mode="previous">
  <xsl:choose>
-  <xsl:when test="$naturalLanguage='yes' and(@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX'))">
+  <xsl:when test="$naturalLanguage='yes' and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')">
    <m:ci>previous</m:ci>
   </xsl:when>
   <xsl:otherwise>
+   <!-- forse bisognerebbe trattare solo l'elemento di testa -->
    <xsl:choose>
-   <xsl:when test="@sort='Prop' or $naturalLanguage='no' ">
+   <xsl:when test="@sort='Prop' or $naturalLanguage='no'">
     <xsl:apply-templates mode="pure" select="."/>
    </xsl:when>
    <xsl:otherwise>
  <xsl:param name="n" select="1"/>
  <xsl:variable name="id" select="@id"/>
  <xsl:choose>
-  <!-- <xsl:when test="key('typeid',@id)"> -->
-  <!-- <xsl:when test="$InnerTypes/InnerTypes/TYPE[@of=$id]"> -->
   <xsl:when test="$naturalLanguage='yes' and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')">
    <m:ci>
     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',$n)"/></xsl:with-param></xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:choose>
-   <xsl:when test="@sort='Prop' or $naturalLanguage='no'">
-    <xsl:apply-templates mode="pure" select="."/>
-   </xsl:when>
-   <xsl:otherwise>
-    <m:ci>.</m:ci>
-   </xsl:otherwise>
+    <xsl:when test="name()='REL' or @sort='Prop' or $naturalLanguage='no'">
+     <xsl:apply-templates mode="pure" select="."/>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:ci>.</m:ci>
+    </xsl:otherwise>
    </xsl:choose>
    <!-- <xsl:apply-templates mode="pure" select="."/> -->
    <xsl:apply-templates mode="flat" select="following-sibling::*[1]">