<xsl:template match="LAMBDA" mode="noannot">
<xsl:variable name="id" select="@id"/>
<xsl:choose>
- <xsl:when test="//InnerTypes and @sort='Prop' and name(../..) != 'LAMBDA'">
+ <xsl:when test="$naturalLanguage='yes' and @sort='Prop' and name(../..) != 'LAMBDA'">
<m:apply helm:xref="{@id}">
<m:csymbol>proof</m:csymbol>
<xsl:apply-templates mode="proof_transform" select="."/>
- <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
+ <!-- <xsl:apply-templates mode="try_inductive" select="."/> -->
+ <xsl:apply-templates mode="pure" select="$InnerTypes/InnerTypes/TYPE[@of=$id]/*"/>
</m:apply>
</xsl:when>
<xsl:otherwise>
<xsl:template match="CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
<xsl:variable name="id" select="@id"/>
<xsl:choose>
- <xsl:when test="//InnerTypes and @sort='Prop'">
+ <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="pure" select="//InnerTypes/TYPE[@of=$id]/*"/>
+ <!-- <xsl:apply-templates mode="try_inductive" select="."/> -->
+ <xsl:apply-templates mode="pure" select="$InnerTypes/InnerTypes/TYPE[@of=$id]/*"/>
</m:apply>
</xsl:when>
<xsl:otherwise>
</xsl:choose>
</xsl:template>
+<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_name">
+ <xsl:call-template name="get_name">
+ <xsl:with-param name="uri" select="$uri"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ind_uri"
+ select="concat(substring-before($uri,'_ind.con'),'.ind')"/>
+ <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="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:template>
+
+
<xsl:template mode="proof_transform" match="*">
<xsl:variable name="id" select="@id"/>
<xsl:choose>
<xsl:apply-templates mode="noannot" select="*[4]"/>
</m:apply>
</xsl:when>
- <!-- NATIND 4 parametri -->
+ <!-- NATIND 4 parametri (nuova versione) -->
+ <!--
<xsl:when test="name()='APPLY' and CONST[
- attribute::uri='cic:/Coq/Init/Datatypes/nat_ind.con'] and count(child::*) = 5">
+ attribute::uri='cic:/Coq/Init/Datatypes/nat_ind.con']
+ and count(child::*) = 5
+ and name(*[4])='LAMBDA'
+ and name(*[4]/target/*[1])='LAMBDA'">
<m:apply>
- <m:csymbol>nat_ind</m:csymbol>
+ <m:csymbol>nat_ind_complete</m:csymbol>
+ <xsl:apply-templates mode="noannot" select="*[5]"/>
<xsl:apply-templates mode="noannot" select="*[3]"/>
- <xsl:apply-templates mode="noannot" select="*[4]"/>
+ <m:ci><xsl:value-of select="*[4]/target/@binder"/></m:ci>
+ <m:ci><xsl:value-of select="*[4]/target/*[1]/target/@binder"/></m:ci>
+ <xsl:apply-templates mode="noannot" select="*[4]/target/*[1]/source/*"/>
+ <xsl:apply-templates mode="noannot" select="*[4]/target/*[1]/target/*"/>
</m:apply>
- </xsl:when>
+ </xsl:when>
+ -->
<!-- EQUALITY -->
<xsl:when test="name()= 'APPLY' and 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:when>
<!-- EQUALITY with extra-parameters -->
<xsl:when test="name()= 'APPLY' and 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:otherwise>
</xsl:choose>
</xsl:when>
+ <!-- False_ind -->
+ <xsl:when test="name()= 'APPLY' and 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="name()= 'APPLY' and CONST[
<xsl:when test="name()= 'APPLY' and CONST[
attribute::uri='cic:/Coq/Init/Logic/Disjunction/or_ind.con']
and count(child::*) = 7">
- <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="*[5]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- </m:apply>
+ <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:apply-templates mode="pure"
+ select="$InnerTypes/InnerTypes/TYPE[@of=$id]/*"/>
+ <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:apply-templates mode="pure"
+ select="$InnerTypes/InnerTypes/TYPE[@of=$id]/*"/>
+ <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="name()= 'APPLY'
<xsl:apply-templates mode="proof_transform" select="*[5]/target/LAMBDA/target/*"/>
</m:apply>
</xsl:when>
+ <xsl:when test="(name()='APPLY') and (name(*[1])='CONST')">
+ <xsl:apply-templates mode="try_inductive" select="."/>
+ </xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="name()='APPLY'">
<xsl:variable name="no_subproofs" select="count(*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>
<!-- <m:cn><xsl:value-of select="$no_subproofs"/></m:cn> -->
<xsl:choose>
- <xsl:when test="//InnerTypes and ($no_subproofs = 1)">
+ <xsl:when test="$naturalLanguage='yes' and ($no_subproofs = 1)">
<m:apply helm:xref="{@id}">
<m:csymbol>letin1</m:csymbol>
<xsl:apply-templates mode="noannot" select="*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]"/>
</m:apply>
</m:apply>
</xsl:when>
- <xsl:when test="//InnerTypes and ($no_subproofs > 1)">
+ <xsl:when test="$naturalLanguage='yes' and ($no_subproofs > 1)">
<m:apply helm:xref="{@id}">
<m:csymbol>letin</m:csymbol>
<!-- first process all subproofs (let-in) -->
<xsl:template match="*" mode="previous">
<xsl:choose>
- <xsl:when test="//InnerTypes 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>
<xsl:variable name="id" select="@id"/>
<xsl:choose>
<!-- <xsl:when test="key('typeid',@id)"> -->
- <!-- <xsl:when test="//InnerTypes/TYPE[@of=$id]"> -->
- <xsl:when test="//InnerTypes and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')">
+ <!-- <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>
</m:ci>
</xsl:choose>
</xsl:template>
+<!-- Auxiliary functions -->
+<xsl:template name="get_name">
+ <xsl:param name="uri" select="''"/>
+ <xsl:variable name="sub_after" select="substring-after($uri,'/')"/>
+ <xsl:choose>
+ <xsl:when test="contains($sub_after,'/')">
+ <xsl:call-template name="get_name">
+ <xsl:with-param name="uri" select="$sub_after"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($sub_after,'_ind.con')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
<!-- <xsl:template match="APPLY[CONST[
attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']]" mode="appflat">