xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:helm="http://www.cs.unibo.it/helm">
+<xsl:include href="logic.xsl"/>
+<xsl:include href="inductive.xsl"/>
+<xsl:include href="rewrite.xsl"/>
+<xsl:include href="diseq.xsl"/>
+
<!-- ************************* LOGIC *********************************-->
<!-- Proof objects -->
-<!-- <xsl:key name="typeid" use="@of" match="TYPE"/> -->
<xsl:key name="typeid" use="@of" match="TYPE"/>
-<!-- ALL this elements does not have inner type -->
-<xsl:template match="PROD|SORT|MUTIND" mode="noannot">
+<!-- These elements do not have inner type -->
+<xsl:template match="PROD|SORT|MUTIND|instantiate" mode="noannot">
<xsl:apply-templates select="." mode="pure"/>
</xsl:template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$naturalLanguage='yes' and @sort='Prop' and $innertype_available='yes'">
+ <!--xsl:when test="@sort='Prop'"-->
<m:apply helm:xref="{@id}">
<m:csymbol>proof</m:csymbol>
<xsl:apply-templates mode="proof_transform" select="."/>
- <!-- <xsl:apply-templates mode="try_inductive" select="."/> -->
<xsl:for-each select="$InnerTypes">
<xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
</xsl:for-each>
<!-- ALL ELEMENTS WITH A TYPE ARE TRANSLATED AS A PROOF-ELEMENT -->
-<!-- LAMBDA has inner type only if it is not nested inside another lambda -->
<xsl:template match="LAMBDA" mode="noannot">
+ <xsl:choose>
+ <xsl:when test="@sort='Prop'">
+ <xsl:apply-templates select="*[1]" mode="lambda_prop"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- mode lambda is defined in content.xsl -->
+ <xsl:apply-templates select="*[1]" mode="lambda"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="decl" mode="lambda_prop">
<xsl:variable name="id" select="@id"/>
<xsl:variable name="innertype_available">
<xsl:for-each select="$InnerTypes">
</xsl:for-each>
</xsl:variable>
<xsl:choose>
- <xsl:when test="$naturalLanguage='yes' and @sort='Prop' and $innertype_available='yes'">
+ <xsl:when test="$naturalLanguage='yes' and $innertype_available='yes'">
<m:apply helm:xref="{@id}">
<m:csymbol>proof</m:csymbol>
- <xsl:apply-templates mode="proof_transform" select="."/>
+ <m:lambda helm:xref="{@id}">
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ <m:type>
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+ </m:type>
+ </m:bvar>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="lambda_prop"/>
+ </m:lambda>
<xsl:for-each select="$InnerTypes">
<xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
</xsl:for-each>
</m:apply>
</xsl:when>
<xsl:otherwise>
- <xsl:apply-templates select="." mode="pure"/>
+ <m:lambda helm:xref="{@id}">
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ <m:type>
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+ </m:type>
+ </m:bvar>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="lambda_prop"/>
+ </m:lambda>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="target" mode="lambda_prop">
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+</xsl:template>
+
+<!-- LETIN -->
+
+<xsl:template match="LETIN" mode="noannot">
+ <xsl:choose>
+ <xsl:when test="@sort='Prop'">
+ <xsl:apply-templates select="*[1]" mode="letin_prop"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- mode letin is defined in content.xsl -->
+ <xsl:apply-templates select="*[1]" mode="letin_pure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="def" mode="letin_prop">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="innertype_available">
+ <xsl:for-each select="$InnerTypes">
+ <xsl:if test="key('typeid',$id)/*">
+ <xsl:text>yes</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$naturalLanguage='yes' and $innertype_available='yes'">
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>proof</m:csymbol>
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>let_in</m:csymbol>
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ </m:bvar>
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="letin_prop"/>
+ </m:apply>
+ <xsl:for-each select="$InnerTypes">
+ <xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
+ </xsl:for-each>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>let_in</m:csymbol>
+ <m:bvar>
+ <m:ci>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+ </m:ci>
+ </m:bvar>
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="letin_prop"/>
+ </m:apply>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+<xsl:template match="target" mode="letin_prop">
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+</xsl:template>
+
<!-- ALL these elements have inner type -->
-<xsl:template match="LETIN|CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
+<xsl:template match="CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
<xsl:variable name="id" select="@id"/>
<xsl:choose>
<xsl:when test="$naturalLanguage='yes' and @sort='Prop'">
<m:apply helm:xref="{@id}">
<m:csymbol>proof</m:csymbol>
<xsl:apply-templates mode="proof_transform" select="."/>
- <!-- <xsl:apply-templates mode="try_inductive" select="."/> -->
<xsl:for-each select="$InnerTypes">
<xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
</xsl:for-each>
</xsl:choose>
</xsl:template>
-<!-- si presuppone che il tipo induttivo non sia mutuamente
- induttivo. Bisognerebbe andare a vedere l'ultimo parametro
- del presunto "principio di induzione", tirare fuori il tipo induttivo
- e vedere se il suo nome coincide con il prefisso di _ind.
- Ad esempio nat_double_ind e' definito dall'utente. L'ultimo
- parametro di nat_double_ind e' di tipo nat, e nat e' diverso
- da nat_double. Per ora, verifico solo l'esistenza di nat_double,
- ma questo, benche' non porti ad errore, non copre tutti i
- casi per quelli mutuamente induttivi -->
-
-<xsl:template mode="try_inductive" match="APPLY">
- <xsl:variable name="id" select="@id"/>
- <xsl:choose>
- <xsl:when test="CONST[1]">
- <xsl:variable name="uri" select="CONST[1]/@uri"/>
- <xsl:choose>
- <xsl:when test="contains($uri,'_ind.con')">
- <xsl:variable name="ind_uri"
- select="concat(substring-before($uri,'_ind.con'),'.ind')"/>
- <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$ind_uri"/></xsl:call-template></xsl:variable>
- <xsl:variable name="inductive_def"
- select="document($InductiveTypeUrl)/InductiveDefinition"/>
- <!-- check if the corresponding inductive definition actually
- exists -->
- <xsl:choose>
- <xsl:when test="$inductive_def">
- <xsl:variable name="ind_name">
- <xsl:call-template name="get_name">
- <xsl:with-param name="uri" select="$uri"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="no_params">
- <xsl:call-template name="get_no_params">
- <xsl:with-param name="first_uri" select="$CICURI"/>
- <xsl:with-param name="second_uri" select="$uri"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:apply-templates mode="inductive" select=".">
- <xsl:with-param name="inductive_def_uri"
- select="$ind_uri"/>
- <xsl:with-param name="inductive_def"
- select="$inductive_def"/>
- <xsl:with-param name="section_params" select="$no_params"/>
- <xsl:with-param name="inductive_def_index" select="1"/>
- <xsl:with-param name="inductive_def_name" select="$ind_name"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode="letin" select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode="letin" select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode="letin" select="."/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template mode="eq_transitive" match="*">
- <!-- <m:ci>eccomi-1: <xsl:value-of select="name()"/></m:ci> -->
- <xsl:choose>
- <xsl:when test="name()='APPLY'">
- <!-- <m:ci>eccomi-2: <xsl:value-of select="CONST[1]/@uri"/></m:ci> -->
- <xsl:variable name="id" select="@id"/>
- <xsl:choose>
- <!-- ricordarsi di trattare il parametro -->
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7">
- <!-- <m:ci>eccomi-3</m:ci> -->
- <xsl:apply-templates mode="eq_transitive" select="*[6]"/>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="eq_transitive" select="*[7]"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="."/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="."/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template mode="diseq" match="*">
- <xsl:param name="rel" select="'eq'"/>
- <xsl:choose>
- <xsl:when test="name()='APPLY'">
- <xsl:variable name="id" select="@id"/>
- <xsl:choose>
- <!-- ricordarsi di trattare il parametro -->
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_transitive.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdl.con'] and count(child::*) = 7">
- <m:eq/>
- <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_less_trans.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/less_leEq_trans.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdr.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'eq'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_transitive_unfolded.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdr.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'eq'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdl.con'] and count(child::*) = 7">
- <m:eq/>
- <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- </xsl:when>
- <!--
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7">
- <xsl:apply-templates mode="diseq" select="*[6]"/>
- <m:eq/>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <m:eq/>
- <xsl:apply-templates mode="diseq" select="*[7]"/>
- </xsl:when>
- -->
- <xsl:otherwise>
- <xsl:element name="{concat('m:',$rel)}"/>
- <!-- <m:ci><xsl:value-of select="$rel"/></m:ci> -->
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="."/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="{concat('m:',$rel)}"/>
- <!-- <m:ci><xsl:value-of select="$rel"/></m:ci> -->
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="."/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
<xsl:template mode="proof_transform" match="*">
<xsl:choose>
<xsl:when test="name()='APPLY'">
<xsl:variable name="id" select="@id"/>
<xsl:choose>
- <!-- Algebra equality (eq_transitive_unfolded) -->
- <!-- It requires a special mode "eq_transitive"-->
- <!-- togliere il parametro -->
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>eq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="eq_transitive" select="*[6]"/>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="eq_transitive" select="*[7]"/>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <!-- Algebra disequalities -->
- <!-- It requires a special mode "diseq"-->
- <!-- togliere il parametro -->
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_transitive.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdl.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- <m:eq/>
- <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_less_trans.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/less_leEq_trans.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdr.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'leq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'eq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_transitive_unfolded.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <!-- togliere il parametro -->
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdr.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- <xsl:apply-templates mode="diseq" select="*[7]">
- <xsl:with-param name="rel" select="'eq'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <!-- togliere il parametro -->
- <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdl.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>diseq_chain</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- <m:eq/>
- <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- <xsl:with-param name="show_statement" select="0"/>
- </xsl:call-template>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="diseq" select="*[6]">
- <xsl:with-param name="rel" select="'lt'"/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
- </m:apply>
- </xsl:when>
- <!-- EQUALITY -->
- <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Equality/eq_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic/Logic_lemmas/eq_ind_r.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
- attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7">
- <m:apply>
- <m:csymbol>rw_step</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- <xsl:apply-templates mode="pure" select="*[3]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- </xsl:call-template>
- <!-- <xsl:apply-templates mode="proof_transform" select="*[7]"/> -->
- </m:apply>
- </xsl:when>
- <!-- EQUALITY with extra-parameters -->
- <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Equality/eq_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic/Logic_lemmas/eq_ind_r.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
- attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) > 7">
- <xsl:variable name="no_extraproofs" select="count(*[position()>7 and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>
- <xsl:choose>
- <xsl:when test="$no_extraproofs=0">
- <m:apply>
- <m:csymbol>rewrite_and_apply</m:csymbol>
- <m:apply>
- <m:csymbol>rw_step</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- <xsl:apply-templates mode="pure" select="*[3]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- </xsl:call-template>
- <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
- </m:apply>
- <xsl:apply-templates mode="noannot" select="*[position()>7]"/>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="*[5]/@sort='Prop'">
- <m:apply helm:xref="{@id}">
- <m:csymbol>letin</m:csymbol>
- <m:apply>
- <m:csymbol>let</m:csymbol>
- <m:ci>
- <xsl:call-template name="insert_subscript">
- <xsl:with-param name="node_value" select="'h1'"/>
- </xsl:call-template>
- </m:ci>
- <xsl:apply-templates mode="noannot" select="*[5]"/>
- </m:apply>
- <xsl:call-template name="gen_let">
- <xsl:with-param name="init_pos" select="1"/>
- <xsl:with-param name="from" select="7"/>
- </xsl:call-template>
- <m:apply>
- <m:csymbol>rewrite_and_apply</m:csymbol>
- <m:apply>
- <m:csymbol>rw_step</m:csymbol>
- <m:ci>
- <xsl:call-template name="insert_subscript">
- <xsl:with-param name="node_value" select="'h1'"/>
- </xsl:call-template>
- </m:ci>
- <xsl:apply-templates mode="pure" select="*[3]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- </xsl:call-template>
- <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
- </m:apply>
- <xsl:apply-templates mode="flat" select="*[8]">
- <xsl:with-param name="n">
- <xsl:value-of select="2"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </m:apply>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <m:apply helm:xref="{@id}">
- <m:csymbol>letin</m:csymbol>
- <xsl:call-template name="gen_let">
- <xsl:with-param name="init_pos" select="0"/>
- <xsl:with-param name="form" select="7"/>
- </xsl:call-template>
- <m:apply>
- <m:csymbol>rewrite_and_apply</m:csymbol>
- <m:apply>
- <m:csymbol>rw_step</m:csymbol>
- <xsl:apply-templates mode="pure" select="*[5]"/>
- <xsl:apply-templates mode="pure" select="*[3]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="*[7]"/>
- </xsl:call-template>
- <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
- </m:apply>
- <xsl:apply-templates mode="flat" select="*[8]">
- <xsl:with-param name="n">
- <xsl:value-of select="1"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </m:apply>
- </m:apply>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- False_ind -->
- <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/False_ind.con'] and
- count(child::*) = 3">
- <m:apply helm:xref="{@id}">
- <m:csymbol>false_ind</m:csymbol>
- <m:ci>cic:/Coq/Init/Logic/False_ind.con</m:ci>
- <xsl:apply-templates mode="noannot" select="*[3]"/>
- </m:apply>
- </xsl:when>
- <!-- gestire meglio il caso di and_ind quando la prova
- non e' della forma \x.\y.M -->
- <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']
- 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: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="proof_transform" select="*[5]/target/LAMBDA/target/*"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Disjunction/or_ind.con']
- and count(child::*) = 7">
- <xsl:choose>
- <xsl:when test="name(*[5])='LAMBDA'
- and name(*[6])='LAMBDA'">
- <xsl:variable name="definition_url"
- select="'cic:/Coq/Init/Logic/Disjunction/or.ind'"/>
- <m:apply helm:xref="{@id}">
- <m:csymbol>full_or_ind</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[7]"/>
- <xsl:for-each select="$InnerTypes">
- <xsl:apply-templates mode="pure" select="key('typeid',$id)/*[1]"/>
- </xsl:for-each>
- <m:apply>
- <m:csymbol>left_case</m:csymbol>
- <m:bvar>
- <m:ci>
- <xsl:value-of select="*[5]/target/@binder"/>
- </m:ci>
- <m:type>
- <xsl:apply-templates mode="pure" select="*[5]/source/*[1]"/>
- </m:type>
- </m:bvar>
- <xsl:apply-templates mode="noannot" select="*[5]/target/*[1]"/>
- </m:apply>
- <m:apply>
- <m:csymbol>right_case</m:csymbol>
- <m:bvar>
- <m:ci>
- <xsl:apply-templates mode="pure" select="*[6]/target/@binder"/>
- </m:ci>
- <m:type>
- <xsl:apply-templates mode="pure" select="*[6]/source/*[1]"/>
- </m:type>
- </m:bvar>
- <xsl:apply-templates mode="noannot" select="*[6]/target/*[1]"/>
- </m:apply>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <m:apply helm:xref="{@id}">
- <m:csymbol>or_ind</m:csymbol>
- <xsl:apply-templates mode="noannot" select="*[7]"/>
- <xsl:for-each select="$InnerTypes">
- <xsl:apply-templates mode="pure" select="key('typeid',$id)/*[1]"/>
- </xsl:for-each>
- <xsl:apply-templates mode="pure" select="*[5]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- </m:apply>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- ex_ind, exT_ind -->
- <xsl:when test="(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="proof_transform" select="*[5]/target/LAMBDA/target/*"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="name(*[1])='CONST'">
+ <xsl:when test="name(*[1])='CONST' or
+ (name(*[1])='instantiate' and name(*[1]/*[1])='CONST')">
<xsl:apply-templates mode="try_inductive" select="."/>
</xsl:when>
<!-- patch temporanea per la gestione di redex -->
- <xsl:when test="name(*[1])='LAMBDA' and count(child::*)=2
- and *[2]/@sort='Prop'">
+ <xsl:when test="name(*[1])='LAMBDA' and count(child::*)=2">
+ <!-- old
+ and *[2]/@sort='Prop'"> -->
<m:apply helm:xref="{@id}">
- <m:csymbol>letin</m:csymbol>
- <m:apply>
- <m:csymbol>let</m:csymbol>
+ <m:csymbol>let_in</m:csymbol>
+ <m:bvar>
<m:ci>
<xsl:call-template name="insert_subscript">
<xsl:with-param name="node_value">
- <xsl:value-of select="*[1]/target/@binder"/>
+ <xsl:value-of select="*[1]/*[1]/@binder"/>
</xsl:with-param>
</xsl:call-template>
</m:ci>
- <xsl:apply-templates mode="noannot" select="*[2]"/>
- </m:apply>
- <xsl:apply-templates mode="proof_transform" select="*[1]/target/*[1]"/>
+ </m:bvar>
+ <xsl:apply-templates mode="noannot" select="*[2]"/>
+ <xsl:apply-templates mode="lambda_prop" select="*[1]/*[2]"/>
</m:apply>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
- <xsl:when test="name()='LAMBDA'">
- <xsl:choose>
- <xsl:when test="(name(target/*[1])='APPLY' and
- name(target/*[1]/*[1])='CONST' and
- (target/*[1]/*[1]/@uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
- target/*[1]/*[1]/@uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
- target/*[1]/*[1]/@uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con')
- and count(target/*[1]/*) = 8
- and name(target/*[1]/*[8])='REL'
- and target/@binder = target/*[1]/*[8]/@binder )">
- <m:apply>
- <m:csymbol>rw_step</m:csymbol>
- <xsl:apply-templates mode="noannot" select="target/*[1]/*[5]"/>
- <xsl:apply-templates mode="pure" select="target/*[1]/*[3]"/>
- <xsl:apply-templates mode="pure" select="target/*[1]/*[6]"/>
- <xsl:call-template name="generate_side_proof">
- <xsl:with-param name="proof" select="target/*[1]/*[7]"/>
- </xsl:call-template>
- <!-- <xsl:apply-templates mode="proof_transform" select="target/*[1]/*[7]"/> -->
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode="pure" select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="pure"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+<xsl:template name="gen_let">
+ <xsl:param name="init_pos" select="1"/>
+ <xsl:param name="from" select="0"/>
+ <xsl:apply-templates mode="gen_let_aux" select="*[position() = ($from+1)]">
+ <xsl:with-param name="init_pos" select="$init_pos"/>
+ </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template mode="gen_let_aux" match="*">
+ <xsl:param name="init_pos" select="1"/>
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="innertype_available">
+ <xsl:for-each select="$InnerTypes">
+ <xsl:if test="key('typeid',$id)/*">
+ <xsl:text>yes</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX' or ((name(.)='REL' or name(.)='VAR' or name(.)='META' or name(.)='CONST' or name(.)='MUTCONSTRUCT') and $innertype_available='yes'))">
+ <m:apply>
+ <m:csymbol>let</m:csymbol>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',$init_pos)"/></xsl:with-param></xsl:call-template></m:ci>
+ <xsl:apply-templates mode="noannot" select="."/>
+ </m:apply>
+ <xsl:if test="following-sibling::*[1]">
+ <xsl:apply-templates mode="gen_let_aux" select="following-sibling::*[1]">
+ <xsl:with-param name="init_pos" select="$init_pos+1"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="following-sibling::*[1]">
+ <xsl:apply-templates mode="gen_let_aux" select="following-sibling::*[1]">
+ <xsl:with-param name="init_pos" select="$init_pos"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- questa vecchia versione (di Claudio??) sembra bacata come un melone.
+
<xsl:template name="gen_let">
<xsl:param name="init_pos" select="0"/>
<xsl:param name="from" select="0"/>
</m:apply>
</xsl:if>
</xsl:for-each>
-</xsl:template>
+</xsl:template> -->
<xsl:template match="*" mode="erase">
<xsl:choose>
- <xsl:when test="@sort='Prop' or $naturalLanguage='no'">
+ <xsl:when test="@sort='Prop'
+ or name()='instantiate' or $naturalLanguage='no'">
<xsl:apply-templates mode="pure" select="."/>
</xsl:when>
<xsl:otherwise>
<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 name()='instantiate' or $naturalLanguage='no'">
<xsl:apply-templates mode="pure" select="."/>
</xsl:when>
<xsl:otherwise>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
- <xsl:when test="name()='REL' or @sort='Prop' or $naturalLanguage='no'">
+ <xsl:when test="name()='REL' or name()='instantiate' or @sort='Prop' or $naturalLanguage='no'">
<xsl:apply-templates mode="pure" select="."/>
</xsl:when>
<xsl:otherwise>
</xsl:choose>
</xsl:template>
-<!-- <xsl:template match="APPLY[CONST[
- attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']]" mode="appflat">
- <xsl:choose>
- <xsl:when test="count(child::*) > 4">
- <m:apply helm:xref="{@id}">
- <m:csymbol>app</m:csymbol>
- <xsl:apply-templates mode="pure" select="*[1]"/>
- <m:ci>*</m:ci>
- <m:ci>*</m:ci>
- <m:ci>*</m:ci>
- <xsl:apply-templates mode="flat" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <m:apply helm:xref="{@id}">
- <m:csymbol>app</m:csymbol>
- <xsl:apply-templates mode="flat" select="*[1]"/>
- </m:apply>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template> -->
-
</xsl:stylesheet>