]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/style_prima_del_linguaggio_naturale/reals.xsl
Added style before natural language synthesis
[helm.git] / helm / style / style_prima_del_linguaggio_naturale / reals.xsl
diff --git a/helm/style/style_prima_del_linguaggio_naturale/reals.xsl b/helm/style/style_prima_del_linguaggio_naturale/reals.xsl
new file mode 100644 (file)
index 0000000..0e4afef
--- /dev/null
@@ -0,0 +1,277 @@
+<?xml version="1.0"?>
+
+<!--******************************************************************--> 
+<!-- Reals                                                            -->
+<!-- First draft: April 3 2000                                        -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                 -->
+<!--******************************************************************-->
+
+<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"
+                              xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<!--******************************************************************-->
+<!-- Variable containing the absolute path of the CIC file            -->
+<!--******************************************************************-->
+
+<xsl:variable name="absPath">http://localhost:8081/get?url=</xsl:variable>
+
+<!-- ************************* LOGIC *********************************-->
+
+<!-- REALS -->
+
+<!--
+<xsl:template match="CONST[attribute::uri='cic:/coq/REALS/Raxioms/R.con']" mode="noannot">
+ <m:reals/>
+</xsl:template>
+-->
+
+<!-- 0 e 1 -->
+
+<xsl:template match="CONST[attribute::uri='cic:/coq/REALS/Raxioms/R0.con']" mode="noannot">
+ <m:cn definitionURL="{@uri}" helm:xref="{@id}">0</m:cn>
+</xsl:template>
+
+<xsl:template match="CONST[attribute::uri='cic:/coq/REALS/Raxioms/R1.con']" mode="noannot">
+ <m:cn definitionURL="{@uri}" helm:xref="{@id}">1</m:cn>
+</xsl:template>
+
+
+
+<!-- Unary Operations -->
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/coq/REALS/Raxioms/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="noannot">
+    <xsl:choose>
+     <xsl:when test="count(child::*) = 2">
+      <xsl:variable name="elem">
+       <xsl:choose>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/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="'root'"/>
+        </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"/>
+      </m:apply>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-imports/>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/coq/REALS/Raxioms/Rinv.con']]" mode="noannot">
+    <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>
+        </m:minus>
+        <xsl:attribute name="helm:xref">
+         <xsl:value-of select="CONST/@id"/>
+        </xsl:attribute>
+        <m:cn>1</m:cn>
+       </m:apply>
+      </m:apply>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-imports/>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- Binary Operations and Relations -->
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/coq/REALS/Raxioms/Rplus.con' or
+ attribute::uri='cic:/coq/REALS/Raxioms/Rminus.con' or
+ attribute::uri='cic:/coq/REALS/Raxioms/Rmult.con' or
+ attribute::uri='cic:/coq/REALS/Raxioms/Rle.con' or
+ attribute::uri='cic:/coq/REALS/Raxioms/Rlt.con' or
+ attribute::uri='cic:/coq/REALS/Raxioms/Rge.con' or
+ attribute::uri='cic:/coq/REALS/Raxioms/Rgt.con' or
+ attribute::uri='cic:/coq/REALS/Rbasic_fun/Rmin.con' or
+ attribute::uri='cic:/coq/REALS/Rfunctions/pow.con']]" mode="noannot">
+    <xsl:choose>
+     <xsl:when test="count(child::*) = 3">
+      <xsl:variable name="elem">
+       <xsl:choose>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rplus.con'">
+         <xsl:value-of select="'plus'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rminus.con'">
+         <xsl:value-of select="'minus'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rmult.con'">
+         <xsl:value-of select="'times'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rle.con'">
+         <xsl:value-of select="'leq'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rlt.con'">
+         <xsl:value-of select="'lt'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rge.con'">
+         <xsl:value-of select="'geq'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Raxioms/Rgt.con'">
+         <xsl:value-of select="'gt'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Rbasic_fun/Rmin.con'">
+         <xsl:value-of select="'min'"/>
+        </xsl:when>
+        <xsl:when test="CONST/@uri='cic:/coq/REALS/Rfunctions/pow.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:apply-templates select="*[3]" mode="noannot"/>
+      </m:apply>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-imports/>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- LIMIT -->
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/coq/REALS/Rlimit/limit1_in.con']]" mode="noannot">
+    <xsl:choose>
+     <xsl:when test="count(child::*) = 5">
+      <m:apply>
+       <m:eq/>
+       <xsl:choose>
+        <xsl:when test="name(*[2]) = 'LAMBDA'">
+         <m:apply helm:xref="{@id}">
+          <m:limit>
+           <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:limit>
+          <m:bvar>
+           <m:ci><xsl:value-of select="LAMBDA/target/@binder"/></m:ci>
+          </m:bvar>
+          <m:lowlimit>
+           <xsl:apply-templates select="*[5]" mode="noannot"/>
+          </m:lowlimit>
+          <xsl:apply-templates select="*[2]/target" mode="noannot"/>
+         </m:apply>
+        </xsl:when>
+        <xsl:otherwise>
+         <m:apply helm:xref="{@id}">
+          <m:limit/>
+          <m:bvar>
+           <m:ci>$x</m:ci>
+          </m:bvar>
+          <m:lowlimit>
+           <xsl:apply-templates select="*[5]" mode="noannot"/>
+          </m:lowlimit>
+          <m:apply>
+           <m:csymbol>app</m:csymbol>
+           <xsl:apply-templates select="*[2]" mode="noannot"/>
+           <m:ci>$x</m:ci>
+          </m:apply>
+         </m:apply>
+        </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[4]" mode="noannot"/>
+      </m:apply>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-imports/>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- DIFFERENTIATION -->
+
+<xsl:template match="APPLY[CONST[
+ attribute::uri='cic:/coq/REALS/Rderiv/D_in.con']]" mode="noannot">
+    <xsl:choose>
+     <xsl:when test="count(child::*) = 4">
+      <m:apply>
+       <m:eq/>
+       <xsl:choose>
+        <xsl:when test="name(*[2]) = 'LAMBDA'">
+         <m:apply helm:xref="{@id}">
+          <m:diff >
+           <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:diff>
+          <m:bvar>
+           <m:ci><xsl:value-of select="LAMBDA[1]/target/@binder"/></m:ci>
+          </m:bvar>
+          <xsl:apply-templates select="*[2]/target" mode="noannot"/>
+         </m:apply>
+        </xsl:when>
+        <xsl:otherwise>
+         <m:apply helm:xref="{@id}">
+          <m:diff/>
+          <m:bvar>
+           <m:ci>$x</m:ci>
+          </m:bvar>
+          <m:apply>
+           <m:csymbol>app</m:csymbol>
+           <xsl:apply-templates select="*[2]" mode="noannot"/>
+           <m:ci>$x</m:ci>
+          </m:apply>
+         </m:apply>
+        </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[4]" mode="noannot"/>
+      </m:apply>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-imports/>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>