+ <xsl:apply-templates select="." mode="letin"/>
+ </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="is_simple">
+ <xsl:param name="proof" select="/.."/>
+ <xsl:value-of select="(count($proof/*)=0) or ((name($proof)='APPLY') and (count($proof/*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) = 0))"/>
+</xsl:template>
+
+<xsl:template name="generate_side_proof">
+ <xsl:param name="proof" select="/.."/>
+<!--
+ <xsl:variable name="is_simple">
+ <xsl:call-template name="is_simple">
+ <xsl:with-param name="proof" select="$proof"/>
+ </xsl:call-template>
+ </xsl:variable> -->
+<xsl:variable name="is_simple" select="(count($proof/*)=0) or ((name($proof)='APPLY') and (count($proof/*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) = 0))"/>
+ <xsl:choose>
+ <xsl:when test="$is_simple">
+ <xsl:choose>
+ <xsl:when test="name($proof)='APPLY'">
+ <xsl:apply-templates select="$proof" mode="letin"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$proof" mode="pure"/>