+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- ARROW -->
+ <xsl:when test="$name='arrow'">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <!-- -> -->
+ <xsl:call-template name="mksymbol-1">
+ <xsl:with-param name="symbol" select="$name"/>
+ <xsl:with-param name="color" select="'blue'"/>
+ <xsl:with-param name="size" select="'+0'"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- IFF -->
+ <xsl:when test="$name='iff'">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <!-- -> -->
+ <xsl:call-template name="mksymbol-1">
+ <xsl:with-param name="symbol" select="$name"/>
+ <xsl:with-param name="color" select="'blue'"/>
+ <xsl:with-param name="size" select="'+0'"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- APPEND -->
+ <xsl:when test="$name='append'">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <!-- -> -->
+ <xsl:call-template name="mksymbol-1">
+ <xsl:with-param name="symbol" select="$name"/>
+ <xsl:with-param name="color" select="'blue'"/>
+ <xsl:with-param name="size" select="'+0'"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- APP -->
+ <xsl:when test="$name='app'">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates>
+ <xsl:for-each select="*[position()>2]">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$name='cast'">
+ <xsl:choose>
+ <xsl:when test="$showcast = 1">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates><br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
+ <xsl:text>:></xsl:text>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 3"/>
+ </xsl:apply-templates>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$name='Prop'">
+ <xsl:text>Prop</xsl:text>
+ </xsl:when>
+ <xsl:when test="$name='Set'">
+ <xsl:text>Set</xsl:text>
+ </xsl:when>
+ <xsl:when test="$name='Type'">
+ <xsl:text>Type</xsl:text>
+ </xsl:when>
+ <xsl:when test="$name='mutcase'">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text><</xsl:text>
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:apply-templates>
+ <xsl:text>> </xsl:text>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/> </xsl:call-template>
+ <xsl:text>CASE </xsl:text>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+ </xsl:apply-templates>
+ <xsl:text> OF </xsl:text>
+ <xsl:for-each select="m:piecewise/m:piece">
+ <!-- <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:text>  </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>| </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="./*[2]"/>
+ <xsl:call-template name="mksymbol-1">
+ <xsl:with-param name="symbol" select="'RightArrow'"/>
+ <xsl:with-param name="color" select="'green'"/>
+ <xsl:with-param name="size" select="'+0'"/>
+ </xsl:call-template>
+ <xsl:variable name="body_size">
+ <xsl:apply-templates
+ select="./*[1]/*[1]" mode="charcount"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$body_size > $framewidth">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent"
+ select="$current_indent + 8"/>
+ </xsl:call-template>
+<xsl:apply-templates
+ select="./*[1]">
+ <xsl:with-param name="current_indent"
+ select="$current_indent + 8"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="./*[1]"
+ mode="inline" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- FIX -->
+ <xsl:when test="$name='fix'">
+ <xsl:choose>
+ <xsl:when test="$charlength > $framewidth">
+ <xsl:text>FIX</xsl:text>
+ <xsl:value-of select="m:ci"/>
+ <xsl:text>{</xsl:text>
+ <xsl:for-each select="m:bvar">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:value-of select="m:ci"/>
+ <xsl:text>:</xsl:text>
+ <xsl:apply-templates select="m:type">
+ <xsl:with-param name="current_indent"
+ select="$current_indent + 5 + string-length(m:ci)"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:text>:=</xsl:text>
+ <xsl:apply-templates select="following-sibling::*[position() = 1]">
+ <xsl:with-param name="current_indent" select="$current_indent +2"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:text>}</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- COFIX -->
+ <xsl:when test="$name='cofix'">
+ <xsl:choose>
+ <xsl:when test="($charlength + 10) > $framewidth">
+ <xsl:text>COFIX</xsl:text>
+ <xsl:value-of select="m:ci"/>
+ <xsl:text>{</xsl:text>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:for-each select="m:bvar">
+ <xsl:value-of select="m:ci"/>
+ <xsl:text>:</xsl:text>
+ <xsl:apply-templates select="m:type">
+ <xsl:with-param name="current_indent"
+ select="$current_indent + 5 + string-length(m:ci)"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:text>:=</xsl:text>
+ <xsl:apply-templates select="following-sibling::*[position() = 1]">
+ <xsl:with-param name="current_indent" select="$current_indent + 3"/>
+ </xsl:apply-templates>
+
+ </xsl:for-each>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:text>}</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="m:type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$name='let_in'">
+ <xsl:text>let </xsl:text>
+ <xsl:apply-templates select="m:bvar/m:ci"/>
+ <xsl:text> := </xsl:text>
+ <xsl:apply-templates select="*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent+14"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:text>in </xsl:text>
+ <xsl:apply-templates select="*[4]">
+ <xsl:with-param name="current_indent" select="$current_indent+5"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- it then else -->
+ <xsl:when test="$name='ite'">
+ <xsl:text>if </xsl:text>
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ <BR/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:text> then </xsl:text>
+ <xsl:apply-templates select="*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 12"/>
+ </xsl:apply-templates>
+ <BR/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ <xsl:text> else </xsl:text>
+ <xsl:apply-templates select="*[4]">
+ <xsl:with-param name="current_indent" select="$current_indent + 12"/>
+ </xsl:apply-templates>
+ </xsl:when>
+
+ <!-- ***************************************** -->
+ <!-- *********** PROOF ELEMENTS ************** -->
+ <!-- ***************************************** -->
+ <!-- PROOF -->
+ <xsl:when test="$name='proof'">
+ <xsl:variable name="nonce" select="generate-id()"/>
+ <xsl:variable name="freshid1" select="concat('a',$nonce)"/>
+ <xsl:variable name="freshid2" select="concat('b',$nonce)"/>
+ <xsl:variable name="freshid3" select="concat('c',$nonce)"/>
+ <span ID="{$freshid1}">
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+  
+ <xsl:if test="*[4]">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">we proved </FONT>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent+16"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">and by delta equivalence</FONT>
+ <xsl:apply-templates select="*[position()=5]">
+ <xsl:with-param name="current_indent" select="$current_indent+16"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </span>
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::*[1]/text()='letin1') or
+ (preceding-sibling::*[1]/text()='rw_step') or
+ (name(..)='m:lambda')">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">we proved </FONT>
+ </xsl:when>
+ <xsl:otherwise>
+ <script>
+ if(document.getElementById) {
+ document.write('\
+ <span ID="{$freshid2}">\
+ <a style="text-decoration:underline ; color:green" href="" onClick="Show(document.getElementById(\'{$freshid1}\')); Hide(document.getElementById(\'{$freshid2}\'));Show(document.getElementById(\'{$freshid3}\'));return (0==1);">Proof of</a>\
+ </span>\
+ <span ID="{$freshid3}">\
+ <br/>\
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>\
+ <a style="text-decoration:underline ; color:red" href="" onClick="Hide(document.getElementById(\'{$freshid1}\')); Show(document.getElementById(\'{$freshid2}\'));Hide(document.getElementById(\'{$freshid3}\'));return (0==1);">we obtain</a>\
+ </span>\
+ ');
+ document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
+ document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+ document.write(' ');
+ } else {
+ document.write('\
+ <br/>\
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>\
+ <FONT color="red">we proved </FONT>\
+ ');
+ }
+ </script>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="*[position()=last()]">
+ <xsl:with-param name="current_indent" select="$current_indent + 16"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- side_proof -->
+ <xsl:when test="$name='side_proof'">
+ <xsl:variable name="nonce" select="generate-id()"/>
+ <xsl:variable name="freshid1" select="concat('a',$nonce)"/>
+ <xsl:variable name="freshid2" select="concat('b',$nonce)"/>
+ <xsl:variable name="freshid3" select="concat('c',$nonce)"/>
+ <xsl:variable name="freshid4" select="concat('d',$nonce)"/>
+ <span ID="{$freshid1}">
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+  
+ </span>
+ <script>
+ if(document.getElementById) {
+ document.write('\
+ <span ID="{$freshid2}">\
+ <a style="text-decoration:underline ; color:green" href="" onClick="Show(document.getElementById(\'{$freshid1}\')); Hide(document.getElementById(\'{$freshid2}\'));Show(document.getElementById(\'{$freshid3}\'));Show(document.getElementById(\'{$freshid4}\'));return (0==1);">Justification</a>\
+ </span>\
+ <span ID="{$freshid3}">\
+ <br/>\
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>\
+ <a style="text-decoration:underline ; color:red" href="" onClick="Hide(document.getElementById(\'{$freshid1}\')); Show(document.getElementById(\'{$freshid2}\'));Hide(document.getElementById(\'{$freshid3}\'));Hide(document.getElementById(\'{$freshid4}\'));return (0==1);">we proved</a>\
+ </span>\
+ ');
+ document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
+ document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+ document.to_be_deleted.push('<xsl:value-of select="$freshid4"/>');
+ document.write(' ');
+ } else {
+ document.write('\
+ <br/>\
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>\
+ <FONT color="red">we proved </FONT>\
+ ');
+ }
+ </script>
+ <span ID="{$freshid4}">
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 16"/>
+ </xsl:apply-templates>
+ </span>
+ </xsl:when>
+ <!-- eq_chain -->
+ <xsl:when test="$name='eq_chain'">
+ <FONT color="red">We have the following equality chain:</FONT>
+ <xsl:for-each select="*[position() mod 2 = 0]">
+ <xsl:variable name="pos" select="position()"/>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$pos=1">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ <xsl:text> =</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>= </xsl:text>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$pos != last()">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="../*[position()=2*$pos +1]">
+ <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <!-- diseq_chain -->
+ <xsl:when test="$name='diseq_chain'">
+ <FONT color="red">We have the following chain of disequalities:</FONT>
+ <xsl:for-each select="*[position() mod 3 = 2]">
+ <xsl:variable name="pos" select="position()"/>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$pos=1">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates mode="inline" select="../*[position()=3*$pos]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="inline" select="../*[position()=3*($pos - 1)]"/>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$pos != last()">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="../*[position()=3*$pos +1]">
+ <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <!-- letin1 -->
+ <xsl:when test="$name='letin1'">
+ <xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[position()=3]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- letin -->
+ <xsl:when test="$name='letin'">
+ <xsl:for-each select="*[position()>1 and last()>position()]">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:apply-templates select="*[position()=last()]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- Let -->
+ <xsl:when test="$name='let'">
+ (
+ <xsl:apply-templates select="m:ci"/>
+ )
+ <xsl:apply-templates select="*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- rw_step -->
+ <xsl:when test="$name='rw_step'">
+ <xsl:choose>
+ <xsl:when test="name(*[2])='m:apply'">
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <FONT color="red">Consider </FONT>
+ <xsl:apply-templates select="*[2]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="charlength_first">
+ <xsl:apply-templates select="*[3]" mode="root_charcount"/>
+ </xsl:variable>
+ <xsl:variable name="charlength_second">
+ <xsl:apply-templates select="*[4]" mode="root_charcount"/>
+ </xsl:variable>
+ <xsl:variable name="charlength_side_proof">
+ <xsl:apply-templates select="*[5]" mode="root_charcount"/>
+ </xsl:variable>
+ <xsl:variable name="split1"
+ select="($charlength_first + $charlength_second) > $framewidth"/>
+ <xsl:variable name="split2"
+ select="($charlength_second + $charlength_side_proof) > $framewidth"/>
+ <!-- <xsl:value-of select="$current_indent"/> -->
+ <!-- <xsl:value-of select="string($charlength_second)"/> -->
+ <!-- <xsl:value-of select="$charlength_side_proof"/> -->
+ <!-- <xsl:value-of select="$split2"/> -->
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">Rewrite </FONT>
+ <xsl:apply-templates mode="inline" select="*[3]"/>
+ <xsl:text> </xsl:text>
+ <xsl:if test="$split1">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ </xsl:if>
+ <FONT color="red">with </FONT>
+ <xsl:apply-templates mode="inline" select="*[4]"/>
+ <xsl:text> </xsl:text>
+ <xsl:if test="$split2">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+ </xsl:call-template>
+ </xsl:if>
+ <FONT color="red">by </FONT>
+ <xsl:apply-templates select="*[5]">
+ <xsl:with-param name="current_indent" select="$current_indent+7"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- rewrite and apply -->
+ <xsl:when test="$name='rewrite_and_apply'">
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">Then apply it to </FONT>
+ <xsl:apply-templates select="*[position()>2]"/>
+ </xsl:when>
+ <!-- by_induction -->
+ <xsl:when test="$name='by_induction'">
+ <FONT color="red">We prove </FONT>
+ <xsl:apply-templates select="../*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent+18"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">by induction on </FONT>
+ <xsl:apply-templates select="*[position()=last()]/*[position()=last()]">
+ <xsl:with-param name="current_indent" select="$current_indent+30"/>
+ </xsl:apply-templates>
+ <!--
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:text>The induction property is</xsl:text>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ -->
+ <xsl:apply-templates
+ select="*[position()>3 and not(position()=last())]">
+ <xsl:with-param name="current_indent" select="$current_indent+4"/>
+ </xsl:apply-templates>
+ <!-- <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:text>End induction</xsl:text> -->
+ </xsl:when>
+ <!-- inductive_case -->
+ <xsl:when test="$name='inductive_case'">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">Case </FONT>
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent +10"/>
+ </xsl:apply-templates>
+ <xsl:if test="*[3]/*[position()>1]">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent+4"/>
+ </xsl:call-template>
+ <FONT color="red">By induction hypothesis, we have:</FONT>
+ <xsl:for-each select="*[3]/*[position()>1]">
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 4"/>
+ </xsl:call-template>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="m:ci"/>
+ <xsl:text>) </xsl:text>
+ <xsl:apply-templates select="m:type">
+ <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </xsl:if>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent + 4"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[4]">
+ <xsl:with-param name="current_indent" select="$current_indent +4"/>
+ </xsl:apply-templates>
+ <!-- <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:text>End Case</xsl:text> -->
+ </xsl:when>
+ <!-- case_lhs -->
+ <xsl:when test="$name='case_lhs'">
+ <xsl:choose>
+ <xsl:when test="count(*)=2">
+ <xsl:apply-templates mode="inline" select="*[2]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates mode="inline" select="*[2]"/>
+ <xsl:for-each select="m:bvar">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates mode="inline" select="*[1]"/>
+ <xsl:text>:</xsl:text>
+ <xsl:apply-templates mode="inline" select="m:type/*[1]"/>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- false_ind -->
+ <xsl:when test="$name='false_ind'">
+ <xsl:apply-templates select="*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">Contradiction.</FONT>
+ </xsl:when>
+ <!-- and_ind -->
+ <xsl:when test="$name='and_ind'">
+ <xsl:choose>
+ <xsl:when test="name(*[2])='m:apply'">
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <FONT color="red">Consider </FONT>
+ <xsl:apply-templates select="*[2]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">In particular, we have</FONT>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ (
+ <xsl:apply-templates select="*[3]"/>
+ ) 
+ <xsl:apply-templates select="*[4]">
+ <xsl:with-param name="current_indent" select="$current_indent + 9"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ (
+ <xsl:apply-templates select="*[5]"/>
+ ) 
+ <xsl:apply-templates select="*[6]">
+ <xsl:with-param name="current_indent" select="$current_indent + 9"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[7]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- full_or_ind -->
+ <xsl:when test="$name='full_or_ind'">
+ <xsl:choose>
+ <xsl:when test="name(*[2])='m:apply'">
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <FONT color="red">Consider </FONT>
+ <xsl:apply-templates select="*[2]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">We proceed by cases to prove </FONT>
+ <xsl:apply-templates select="*[3]"/>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent+4"/>
+ </xsl:call-template>
+ <FONT color="red">Left: suppose </FONT>
+ <xsl:text>(</xsl:text>
+ <xsl:value-of select="*[4]/m:bvar/m:ci"/>
+ <xsl:text>) </xsl:text>
+ <xsl:apply-templates
+ select="*[4]/m:bvar/m:type/*[1]"/>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent+15"/>
+ </xsl:call-template>
+ <xsl:apply-templates
+ select="*[4]/*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent+15"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent+4"/>
+ </xsl:call-template>
+ <FONT color="red">Right: suppose </FONT>
+ <xsl:text>(</xsl:text>
+ <xsl:value-of select="*[5]/m:bvar/m:ci"/>
+ <xsl:text>) </xsl:text>
+ <xsl:apply-templates
+ select="*[5]/m:bvar/m:type/*[1]"/>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent+16"/>
+ </xsl:call-template>
+ <xsl:apply-templates
+ select="*[5]/*[3]">
+ <xsl:with-param name="current_indent" select="$current_indent+16"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- or_ind -->
+ <xsl:when test="$name='or_ind'">
+ <xsl:choose>
+ <xsl:when test="name(*[2])='m:apply'">
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <FONT color="red">Consider </FONT>
+ <xsl:apply-templates select="*[2]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">We prove </FONT>
+ <xsl:apply-templates select="*[3]"/>
+ <FONT color="red"> by cases:</FONT>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ Left: 
+ <xsl:apply-templates select="*[4]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ Right: 
+ <xsl:apply-templates select="*[5]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- Ex_ind -->
+ <xsl:when test="$name='ex_ind'">
+ <xsl:choose>
+ <xsl:when test="name(*[2])='m:apply'">
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <FONT color="red">Consider </FONT>
+ <xsl:apply-templates select="*[2]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <FONT color="red">Let </FONT>
+ <xsl:apply-templates mode="inline" select="*[3]"/>
+ :
+ <xsl:apply-templates mode="inline" select="*[4]"/>
+ <FONT color="red"> such that</FONT>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ (
+ <xsl:apply-templates mode="inline" select="*[5]"/>
+ )
+ <xsl:apply-templates select="*[6]">
+ <xsl:with-param name="current_indent" select="$current_indent +7"/>
+ </xsl:apply-templates>
+ <br/>
+ <xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="*[7]">
+ <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- ***************************************** -->
+ <!-- *********** LAMBDA ELEMENTS ************** -->
+ <!-- ***************************************** -->
+ <xsl:when test="$name='subst'">
+ <xsl:apply-templates select="*[3]"/>
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates select="*[4]"/>
+ <xsl:choose>
+ <xsl:when test="$uri != ''">
+ <a href="{$uri}">
+ <xsl:call-template name="mksymbol-1">
+ <xsl:with-param name="symbol" select="$name"/>
+ <xsl:with-param name="color" select="'blue'"/>
+ <xsl:with-param name="size" select="'+0'"/>
+ </xsl:call-template>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="mksymbol-1">
+ <xsl:with-param name="symbol" select="$name"/>
+ <xsl:with-param name="color" select="'blue'"/>
+ <xsl:with-param name="size" select="'+0'"/>
+ </xsl:call-template>