]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/proofs.xsl
added support for compressed files
[helm.git] / helm / style / proofs.xsl
index 1f9c6c8f8f6ff0b88301672432d7e2bc2284f74a..09045cef239c866d0b4ebba8c3b02ed2f1484e11 100644 (file)
@@ -1,5 +1,29 @@
 <?xml version="1.0"?>
 
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
 <!--******************************************************************--> 
 <!-- Basic Logic                                                      -->
 <!-- First draft: April 3 2000                                        -->
@@ -23,7 +47,7 @@
 <!-- <xsl:key name="typeid" use="@of" match="TYPE"/> -->
 
 <!-- ALL this elements does not have inner type -->
-<xsl:template match="PROD|REL|SORT|VAR|META|CONST|MUTIND|MUTCONSTRUCT" mode="noannot">
+<xsl:template match="LETIN|PROD|REL|SORT|VAR|META|CONST|MUTIND|MUTCONSTRUCT" mode="noannot">
 <xsl:apply-templates select="." mode="pure"/>
 </xsl:template>
 
@@ -31,7 +55,7 @@
 <xsl:template match="LAMBDA" mode="noannot">
  <xsl:variable name="id" select="@id"/>
  <xsl:choose>
-  <xsl:when test="@sort='Prop' and name(../..) != 'LAMBDA'">
+  <xsl:when test="//InnerTypes and @sort='Prop' and name(../..) != 'LAMBDA'">
   <!-- <xsl:when test="@sort='Prop' and //InnerTypes/TYPE[@of=$id]"> -->
    <xsl:call-template name="has_inner_type"/>
   </xsl:when>
@@ -46,7 +70,7 @@
  <xsl:choose>
   <!-- <xsl:when test="//InnerTypes and key('typeid',@id)"> -->
   <!-- <xsl:when test="//InnerTypes/TYPE[@of=$id]"> -->
-  <xsl:when test="@sort='Prop'">
+  <xsl:when test="//InnerTypes and @sort='Prop'">
    <xsl:call-template name="has_inner_type"/>
   </xsl:when>
   <xsl:otherwise>
@@ -63,7 +87,7 @@
  attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7">
      <m:apply helm:xref="{@id}">
       <m:csymbol>thread</m:csymbol>
-      <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
+      <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
       <m:apply>
        <m:csymbol>rw_step</m:csymbol>
        <xsl:apply-templates mode="pure" select="*[3]"/>
       <xsl:apply-templates mode="thread" select="*[5]"/>
      </m:apply>
     </xsl:when>
-    <!-- aggiungere la verifica dell'esistenza dei lambda per and_ind -->
+    <!-- gestire meglio il caso di and_ind quando la prova 
+         non e' della forma \x.\y.M -->
     <xsl:when test="name()= 'APPLY' and CONST[
  attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con'] 
- and count(child::*) = 6">
+ and count(child::*) = 6 
+ and name(*[5])='LAMBDA' 
+ and name(*[5]/target/*[1])='LAMBDA'"> 
      <m:apply helm:xref="{@id}">
       <m:csymbol>and_ind</m:csymbol>
       <xsl:apply-templates mode="noannot" select="*[6]"/>
      <m:apply helm:xref="{@id}">
       <m:csymbol>or_ind</m:csymbol>
       <xsl:apply-templates mode="noannot" select="*[7]"/>
-      <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
+      <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
       <xsl:apply-templates mode="pure" select="*[5]"/>
       <xsl:apply-templates mode="pure" select="*[6]"/>
      </m:apply>
     </xsl:when>
-    <xsl:when test="count(*[@id = //InnerTypes/TYPE/@of]) = 1">
+    <!-- ex_ind, exT_ind -->
+    <xsl:when test="name()= 'APPLY' 
+ and (CONST[attribute::uri='cic:/Coq/Init/Logic_Type/exT_ind.con'] or
+      CONST[attribute::uri='cic:/Coq/Init/Logic/First_order_quantifiers/ex_ind.con'])  
+ and count(child::*) = 6 
+ and name(*[5])='LAMBDA' 
+ and name(*[5]/target/*[1])='LAMBDA'"> 
+     <m:apply helm:xref="{@id}">
+      <m:csymbol>ex_ind</m:csymbol>
+      <xsl:apply-templates mode="noannot" select="*[6]"/>
+      <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
+      <xsl:apply-templates mode="pure" select="*[5]/source/*"/>
+      <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
+      <xsl:apply-templates mode="pure" select="*[5]/target/LAMBDA/source/*"/>
+      <xsl:apply-templates mode="noannot" select="*[5]/target/LAMBDA/target/*"/>
+     </m:apply>
+    </xsl:when>
+    <!-- Threads -->
+    <!-- <xsl:when test="count(*[@id = //InnerTypes/TYPE/@of]) = 1"> -->
+    <xsl:when test="count(*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) = 1">
      <m:apply helm:xref="{@id}">
       <m:csymbol>thread</m:csymbol>
-      <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
+      <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
       <m:apply>
        <m:csymbol>app</m:csymbol>
        <xsl:apply-templates mode="copy-of-no-prop" select="*[1]"/>
       </m:apply>
-      <xsl:apply-templates mode="thread" select="*[@id = //InnerTypes/TYPE/@of]"/>
+      <xsl:apply-templates mode="thread" select="*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]"/>
      </m:apply>
     </xsl:when>
     <xsl:otherwise>
       <m:csymbol>proof</m:csymbol>
       <xsl:apply-templates select="." mode="pure"/>
       <!-- <xsl:apply-templates select="key('typeid',@id)" mode="pure"/> -->
-      <xsl:apply-templates select="//InnerTypes/TYPE[@of=$id]" mode="pure"/>
+      <xsl:apply-templates select="//InnerTypes/TYPE[@of=$id]/*" mode="pure"/>
      </m:apply>
     </xsl:otherwise>
    </xsl:choose>
 
 <xsl:template match="*" mode="copy-of-no-prop">
  <xsl:choose>
-  <xsl:when test="@id = //InnerTypes/TYPE/@of">
+  <!-- <xsl:when test="@id = //InnerTypes/TYPE/@of"> -->
+  <xsl:when test="@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>
  attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
  attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7">
     <xsl:variable name="id" select="@id"/>
-     <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
+     <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
      <m:apply>
       <m:csymbol>rw_step</m:csymbol>
       <xsl:apply-templates mode="pure" select="*[3]"/>
      <xsl:apply-templates mode="thread" select="*[5]"/>
    </xsl:when>
 <!--**** Patch temporanea, per il problema dei threads ***-->
-<xsl:when test="(name()= 'APPLY' and CONST[
- attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con'] 
- and count(child::*) = 6) or
+<xsl:when test="(name()= 'APPLY' and 
+ (CONST[attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con'] or
+  CONST[attribute::uri='cic:/Coq/Init/Logic_Type/exT_ind.con'] or
+  CONST[attribute::uri='cic:/Coq/Init/Logic/First_order_quantifiers/ex_ind.con'])
+ and count(child::*) = 6 
+ and name(*[5])='LAMBDA' 
+ and name(*[5]/target/*[1])='LAMBDA')
+ or
 (name()= 'APPLY' and CONST[
  attribute::uri='cic:/Coq/Init/Logic/Disjunction/or_ind.con'] 
  and count(child::*) = 7)">
  <xsl:apply-templates mode="noannot" select="."/>
 </xsl:when>
 <!--**** Fine Patch temporanea, per il problema dei threads ***-->
-   <xsl:when test="count(*[@id = //InnerTypes/TYPE/@of]) = 1">
+   <xsl:when test="//InnerTypes and count(*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) = 1">
        <xsl:variable name="id" select="@id"/>
        <m:apply helm:xref="{@id}">
         <m:csymbol>thread</m:csymbol>
-        <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
+        <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
         <m:apply>
          <m:csymbol>app</m:csymbol>
          <xsl:apply-templates mode="copy-of-no-prop" select="*[1]"/>
         </m:apply>
-        <xsl:apply-templates mode="thread" select="*[@id = //InnerTypes/TYPE/@of]"/>
+        <!-- <xsl:apply-templates mode="thread" select="*[@id = //InnerTypes/TYPE/@of]"/> -->
+        <xsl:apply-templates mode="thread" select="*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]"/>
        </m:apply>
    </xsl:when>
    <xsl:otherwise>
       <xsl:variable name="id" select="@id"/>
       <xsl:variable name="ideqp" select="*[7]/@id"/>
       <xsl:variable name="idsubp" select="*[5]/@id"/>
+<!--
       <xsl:variable name="leteqp" select="boolean(//InnerTypes/TYPE[@of=$ideqp])"/>
       <xsl:variable name="letsubp" select="boolean(//InnerTypes/TYPE[@of=$idsubp])"/>
+-->
+      <xsl:variable name="leteqp" select="boolean(*[7][@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>
+      <xsl:variable name="letsubp" select="boolean(*[5][@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>
       <m:apply helm:xref="{@id}">
        <m:csymbol>rewrite_and_apply</m:csymbol>
        <m:apply>