+ <xsl:choose>
+ <xsl:when test="name()='APPLY'">
+ <!-- This is the case of an applicative expression wich is not
+ a proof but could contains proofs...
+ MODE LETIN OR MODE PURE ??? Big question -->
+ <xsl:apply-templates select="." mode="pure"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="pure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- si presuppone che il tipo induttivo non sia mutuamente
+ induttivo. Bisognerebbe andare a vedere l'utlimo 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>