<!-- <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:apply-templates select="." mode="pure"/>
</xsl:template>
-<xsl:template match="LAMBDA|CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
- <xsl:variable name="id" select="@id"/>
- <xsl:choose>
- <!-- <xsl:when test="//InnerTypes and key('typeid',@id)"> -->
- <!-- <xsl:when test="//InnerTypes/TYPE[@of=$id]"> -->
- <xsl:when test="@sort='Prop'">
- <xsl:choose>
- <xsl:when test="name()= 'APPLY' and CONST[
+<!-- LAMBDA has inner type only if it is not nested inside another lambda -->
+<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="@sort='Prop' and //InnerTypes/TYPE[@of=$id]"> -->
+ <xsl:call-template name="has_inner_type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="pure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- ALL this elements have inner type -->
+<xsl:template match="CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
+ <xsl:choose>
+ <!-- <xsl:when test="//InnerTypes and key('typeid',@id)"> -->
+ <!-- <xsl:when test="//InnerTypes/TYPE[@of=$id]"> -->
+ <xsl:when test="@sort='Prop'">
+ <xsl:call-template name="has_inner_type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="pure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="has_inner_type">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:choose>
+ <xsl:when test="name()= 'APPLY' and CONST[
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">
- <m:apply helm:xref="{@id}">
- <m:csymbol>thread</m:csymbol>
- <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="pure" select="*[6]"/>
- <xsl:apply-templates mode="pure" select="*[7]"/>
- </m:apply>
- <xsl:apply-templates mode="thread" select="*[5]"/>
- </m:apply>
- </xsl:when>
- <!-- aggiungere la verifica dell'esistenza dei lambda per and_ind -->
- <xsl:when test="name()= 'APPLY' and CONST[
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>thread</m:csymbol>
+ <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="pure" select="*[6]"/>
+ <xsl:apply-templates mode="pure" select="*[7]"/>
+ </m:apply>
+ <xsl:apply-templates mode="thread" select="*[5]"/>
+ </m:apply>
+ </xsl:when>
+ <!-- aggiungere la verifica dell'esistenza dei lambda per and_ind -->
+ <xsl:when test="name()= 'APPLY' and CONST[
attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']
and count(child::*) = 6">
- <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="noannot" select="*[5]/target/LAMBDA/target/*"/>
- </m:apply>
- </xsl:when>
- <xsl:when test="name()= 'APPLY' and CONST[
+ <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="noannot" select="*[5]/target/LAMBDA/target/*"/>
+ </m:apply>
+ </xsl:when>
+ <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:when>
- <xsl:when test="count(*[@id = //InnerTypes/TYPE/@of]) = 1">
- <m:apply helm:xref="{@id}">
- <m:csymbol>thread</m:csymbol>
- <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]"/>
- </m:apply>
- </xsl:when>
- <xsl:otherwise>
- <m:apply helm:xref="{@id}">
- <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"/>
- </m:apply>
- </xsl:otherwise>
- </xsl:choose>
- </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/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">
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>thread</m:csymbol>
+ <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]"/>
+ </m:apply>
+ </xsl:when>
+ <xsl:otherwise>
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>proof</m:csymbol>
<xsl:apply-templates select="." mode="pure"/>
- </xsl:otherwise>
- </xsl:choose>
+ <!-- <xsl:apply-templates select="key('typeid',@id)" mode="pure"/> -->
+ <xsl:apply-templates select="//InnerTypes/TYPE[@of=$id]" mode="pure"/>
+ </m:apply>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="*" mode="copy-of-no-prop">