]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/mmlextension.xsl
Added "-destdir" argument to "ocamlfind install" in "install:"
[helm.git] / helm / style / mmlextension.xsl
index 71a424d8bb52585e46c4b9aa829eee25a43e3021..6dce30b65a73b02bf009013469380fd523eb18a0 100644 (file)
@@ -411,9 +411,10 @@ which generates the toplevel element (see for instance xlink) -->
     <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
     <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
     <m:mrow>
-     <xsl:if test="@helm:xref">
+     <xsl:if test="@id">
       <xsl:attribute name="m:xref"><xsl:value-of select="@id"/></xsl:attribute>
      </xsl:if>
+     <xsl:variable name="id" select="m:csymbol/@id"/>
      <xsl:choose>
       <!-- FORALL -->
       <xsl:when test="$name='forall'">
@@ -987,52 +988,71 @@ which generates the toplevel element (see for instance xlink) -->
       <!-- ***************************************** -->
       <!-- PROOF -->
       <xsl:when test="$name='proof'">
-       <m:maction actiontype="toggle">
-        <!-- CSC: next if until the annotationHelper can handle mactions -->
-        <xsl:if test="not($explodeall)">
-         <!-- Details hided (default) -->
+        <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
+        <xsl:variable name="test" select="(not($explodeall)) and
+          (not(preceding-sibling::*[1]/text()='letin1')) and
+          (not(preceding-sibling::*[1]/text()='rw_step')) and
+          (not(name(..)='m:lambda'))"/>
+        <xsl:variable name="hidden_details">
+         <xsl:if test="$test">
+          <!-- Details hided (default) -->
+          <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+           <m:mtr>
+            <m:mtd>
+             <m:mrow>
+              <m:mtext mathcolor="Maroon">We&#x00a0;can&#x00a0;prove</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[position()=3]"/>
+              <m:mrow>
+               <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+               <m:mtext mathcolor="Green">(explain)</m:mtext>
+              </m:mrow>
+             </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </m:mtable>
+         </xsl:if>
+        </xsl:variable>
+        <xsl:variable name="shown_details">
+         <!-- Show details -->
          <m:mtable align="baseline 1" equalrows="false" columnalign="left">
           <m:mtr>
            <m:mtd>
             <m:mrow>
-             <m:mtext mathcolor="Maroon">We&#x00a0;can&#x00a0;prove</m:mtext>
+             <xsl:apply-templates select="*[position()=2]"/>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <m:mtext mathcolor="Maroon">we&#x00a0;proved</m:mtext>
              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
              <xsl:apply-templates select="*[position()=3]"/>
              <m:mrow>
-              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
-              <m:mtext mathcolor="Green">(explain)</m:mtext>
+              <m:mphantom>
+               <m:mtext>_</m:mtext>
+              </m:mphantom>
+              <xsl:if test="$test">
+               <m:mtext mathcolor="Green">(hide&#x00a0;details)</m:mtext>
+              </xsl:if>
              </m:mrow>
             </m:mrow>
            </m:mtd>
           </m:mtr>
          </m:mtable>
-        </xsl:if>
-        <!-- Show details -->
-        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
-         <m:mtr>
-          <m:mtd>
-           <m:mrow>
-            <xsl:apply-templates select="*[position()=2]"/>
-           </m:mrow>
-          </m:mtd>
-         </m:mtr>
-         <m:mtr>
-          <m:mtd>
-           <m:mrow>
-            <m:mtext mathcolor="Maroon">we&#x00a0;proved</m:mtext>
-            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
-            <xsl:apply-templates select="*[position()=3]"/>
-            <m:mrow>
-             <m:mphantom>
-              <m:mtext>_</m:mtext>
-             </m:mphantom>
-             <m:mtext mathcolor="Green">(hide&#x00a0;details)</m:mtext>
-            </m:mrow>
-           </m:mrow>
-          </m:mtd>
-         </m:mtr>
-        </m:mtable>
-       </m:maction>
+        </xsl:variable>
+        <xsl:choose>
+         <xsl:when test="$test">
+          <m:maction actiontype="toggle">
+           <xsl:copy-of select="$hidden_details"/>
+           <xsl:copy-of select="$shown_details"/>
+          </m:maction>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:copy-of select="$shown_details"/>
+         </xsl:otherwise>
+        </xsl:choose>
       </xsl:when>
       <!-- LETIN1 -->
       <xsl:when test="$name='letin1'">
@@ -1526,19 +1546,15 @@ which generates the toplevel element (see for instance xlink) -->
       <!-- subst -->
       <xsl:when test="$name='subst'">
         <xsl:apply-templates select="*[3]"/>
-        <m:mo>&#xe8a0;</m:mo>
-        <m:mrow>
-         <m:mo stretchy="false">[</m:mo>
-         <m:mrow>
-          <xsl:apply-templates select="*[4]"/>
-          <m:mo mathcolor="green">
-           <xsl:if test="$id != ''">
-            <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
-           </xsl:if>&#8592;</m:mo>
-          <xsl:apply-templates select="*[2]"/>
-         </m:mrow>
-         <m:mo stretchy="false">]</m:mo>
-        </m:mrow>
+<!-- no font for ApplyFunction: <m:mo>&#xe8a0;</m:mo> -->
+        <m:mo stretchy="false">[</m:mo>
+        <xsl:apply-templates select="*[4]"/>
+        <m:mo mathcolor="green">
+         <xsl:if test="$id != ''">
+          <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
+         </xsl:if>&#8592;</m:mo>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo stretchy="false">]</m:mo>
       </xsl:when>
       <!-- lift -->
       <xsl:when test="$name='lift'">
@@ -1716,7 +1732,12 @@ which generates the toplevel element (see for instance xlink) -->
 
 <xsl:template match="m:lambda">
     <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
-    <m:mrow m:xref="{@id}">
+    <m:mrow>
+     <xsl:if test="@id">
+      <xsl:attribute name="m:xref">
+       <xsl:value-of select="@id"/>
+      </xsl:attribute>
+     </xsl:if>
      <xsl:choose>
      <xsl:when test="$charlength >= $framewidth">
       <m:mtable align="baseline 1" equalrows="false" columnalign="left">
@@ -1763,7 +1784,7 @@ which generates the toplevel element (see for instance xlink) -->
  <xsl:choose>
   <xsl:when test="$charlength >= $framewidth">
    <m:mtable align="baseline 1" equalrows="false" columnalign="left">
-    <xsl:if test="@helm:xref">
+    <xsl:if test="@id">
      <xsl:attribute name="m:xref">
       <xsl:value-of select="@id"/>
      </xsl:attribute>
@@ -1781,7 +1802,12 @@ which generates the toplevel element (see for instance xlink) -->
       <m:mtd>
        <m:mrow>
         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
-        <m:mo m:xref="{m:in/@id}">=</m:mo>
+        <m:mo>
+         <xsl:if test="m:in/@id">
+          <xsl:attribute name="m:xref">
+           <xsl:value-of select="m:in/@id"/>
+          </xsl:attribute>
+         </xsl:if>=</m:mo>
         <xsl:apply-templates select="."/>
        </m:mrow>
       </m:mtd>
@@ -1856,7 +1882,7 @@ which generates the toplevel element (see for instance xlink) -->
  <xsl:choose>
   <xsl:when test="$charlength >= $framewidth">
    <m:mtable align="baseline 1" equalrows="false" columnalign="left">
-    <xsl:if test="@helm:xref">
+    <xsl:if test="@id">
      <xsl:attribute name="m:xref">
       <xsl:value-of select="@id"/>
      </xsl:attribute>
@@ -1874,7 +1900,12 @@ which generates the toplevel element (see for instance xlink) -->
       <m:mtd>
        <m:mrow>
         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
-        <m:mo m:xref="{*[1]/@id}"><xsl:value-of select="$symbol"/></m:mo>
+        <m:mo>
+         <xsl:if test="*[1]/@id">
+          <xsl:attribute name="m:xref">
+           <xsl:value-of select="*[1]/@id"/>
+          </xsl:attribute>
+         </xsl:if><xsl:value-of select="$symbol"/></m:mo>
         <xsl:apply-templates select="."/>
        </m:mrow>
       </m:mtd>
@@ -1898,7 +1929,12 @@ which generates the toplevel element (see for instance xlink) -->
 <xsl:template match = "m:set">
  <xsl:choose>
   <xsl:when test="count(child::*) = 0">
-   <m:mi>&#x02205;</m:mi>
+   <m:mi>
+    <xsl:if test="@id">
+     <xsl:attribute name="m:xref">
+      <xsl:value-of select="@id"/>
+     </xsl:attribute>
+    </xsl:if>&#x02205;</m:mi>
   </xsl:when>
   <xsl:otherwise>
    <xsl:variable name="charlength">
@@ -1912,7 +1948,12 @@ which generates the toplevel element (see for instance xlink) -->
         <m:mtr>
          <m:mtd>
           <m:mrow>
-           <m:mo stretchy="false">{</m:mo>
+           <m:mo stretchy="false">
+            <xsl:if test="@id">
+             <xsl:attribute name="m:xref">
+              <xsl:value-of select="@id"/>
+             </xsl:attribute>
+            </xsl:if>{</m:mo>
            <xsl:apply-templates select="*[position()=1]"/>
           </m:mrow>
          </m:mtd>
@@ -1929,7 +1970,12 @@ which generates the toplevel element (see for instance xlink) -->
         <m:mtr>
          <m:mtd>
           <m:mrow>
-           <m:mo stretchy="false">}</m:mo>
+           <m:mo stretchy="false">
+            <xsl:if test="@id">
+             <xsl:attribute name="m:xref">
+              <xsl:value-of select="@id"/>
+             </xsl:attribute>
+            </xsl:if>}</m:mo>
           </m:mrow>
          </m:mtd>
         </m:mtr>
@@ -1940,7 +1986,12 @@ which generates the toplevel element (see for instance xlink) -->
         <m:mtr>
          <m:mtd>
           <m:mrow>
-           <m:mo stretchy="false">{</m:mo>
+           <m:mo stretchy="false">
+            <xsl:if test="@id">
+             <xsl:attribute name="m:xref">
+              <xsl:value-of select="@id"/>
+             </xsl:attribute>
+            </xsl:if>{</m:mo>
            <xsl:apply-templates select="*[position()=1]"/>
            <xsl:if test="position() != last()">
             <mo>,</mo>
@@ -1964,7 +2015,12 @@ which generates the toplevel element (see for instance xlink) -->
         <m:mtr>
          <m:mtd>
           <m:mrow>
-           <m:mo stretchy="false">}</m:mo>
+           <m:mo stretchy="false">
+            <xsl:if test="@id">
+             <xsl:attribute name="m:xref">
+              <xsl:value-of select="@id"/>
+             </xsl:attribute>
+            </xsl:if>}</m:mo>
           </m:mrow>
          </m:mtd>
         </m:mtr>
@@ -1991,11 +2047,6 @@ which generates the toplevel element (see for instance xlink) -->
   </m:mfenced>
 </xsl:template>
 
-<!-- *********************************** -->
-<!--          PROOF ELEMENTS             -->
-<!-- *********************************** -->
-
-
 
 <!--**********************-->
 <!--       COUNTING       -->