]> matita.cs.unibo.it Git - helm.git/commitdiff
First commit of the NuPRL stylesheets.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 8 Apr 2003 14:44:51 +0000 (14:44 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 8 Apr 2003 14:44:51 +0000 (14:44 +0000)
15 files changed:
helm/nuprl_stylesheets/nuprl_abstract.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_annotatedpres.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_content_to_html.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_content_to_html2.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_expand.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_html_arith.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_html_basic.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_link.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_links_library.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_mmlextension.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_proof.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_rules.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_term.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/nuprl_tree.xsl [new file with mode: 0644]
helm/nuprl_stylesheets/xslt_index.txt [new file with mode: 0644]

diff --git a/helm/nuprl_stylesheets/nuprl_abstract.xsl b/helm/nuprl_stylesheets/nuprl_abstract.xsl
new file mode 100644 (file)
index 0000000..fa6d815
--- /dev/null
@@ -0,0 +1,170 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+
+<xsl:template match="term">
+  <xsl:choose>
+  
+  <xsl:when test="@opid=&quot;le&quot;">
+    <m:apply>
+      <m:leq definitionURL="{@uri}"/>
+        <xsl:apply-templates select="*"/>
+    </m:apply>
+  </xsl:when>
+  <xsl:when test="string(@opid)=&quot;exists&quot;">
+    <m:apply>
+      <m:exists definitionURL="{@uri}"/>
+      <m:bvar>
+        <m:ci>
+         <xsl:value-of select="binder[1]/@var"/>
+       </m:ci>
+      </m:bvar>
+      <m:condition>
+        <xsl:apply-templates select="*[1]"/>
+      </m:condition>
+      <xsl:apply-templates select="*[3]"/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;all&quot;">
+    <m:apply>
+      <m:csymbol definitionURL="{@uri}">forall</m:csymbol>
+      <m:bvar>
+        <m:ci>
+          <xsl:value-of select="binder[1]/@var"/>
+        </m:ci>
+        <m:type>
+          <xsl:apply-templates select="*[1]"/>
+        </m:type>
+      </m:bvar>
+      <xsl:apply-templates select="*[3]"/>
+    </m:apply>
+  </xsl:when>
+
+  <xsl:when test="string(@opid)=&quot;and&quot;">
+    <m:apply>
+      <m:and definitionURL="{@uri}"/>
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;or&quot;">
+    <m:apply>
+      <m:or definitionURL="{@uri}"/>
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;member&quot;">
+    <m:apply>
+      <m:in definitionURL="{@uri}"/>
+      <xsl:apply-templates select="*[2]"/>
+      <xsl:apply-templates select="*[1]"/>
+    </m:apply>
+  </xsl:when>
+    
+  <xsl:when test="string(@opid)=&quot;implies&quot;">
+    <m:apply>
+      <m:implies definitionURL="{@uri}"/>
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;not&quot;">
+    <m:apply>
+      <m:not definitionURL="{@uri}"/>
+      <xsl:apply-templates select="*[1]"/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;nat&quot;">
+    <m:naturalnumbers definitionURL="{@uri}"/>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;so_lambda&quot;">
+    <m:apply>
+      <m:csymbol definitionURL="{@uri}">so_lambda</m:csymbol>
+      <xsl:choose>
+      <xsl:when test="*[1]=so_variable">
+        <m:apply>
+        <m:ci>so_variable</m:ci>
+        <m:ci>
+          <xsl:value-of select="so_variable/@var"/>
+       </m:ci>
+        </m:apply>
+        <!--<xsl:apply-templates select="*[2]"/>
+        <xsl:apply-templates select="*[3]"/>-->
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="*[1]"/>
+        <xsl:apply-templates select="*[2]"/>
+      </xsl:otherwise>
+      </xsl:choose>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;so_apply&quot;">
+    <m:apply>
+      <m:csymbol definitionURL="{@uri}">so_apply</m:csymbol>
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:when>  
+  
+  <xsl:when test="string(@opid)=&quot;gcd_p&quot;">
+    <m:apply>
+      <m:ci definitionURL="{@uri}">gcd_p</m:ci>
+      <xsl:apply-templates/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;decidable&quot;">
+    <m:apply>
+      <m:ci definitionURL="{@uri}">decidable</m:ci>
+      <xsl:apply-templates/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;int_seg&quot;">
+    <m:interval definitionURL="{@uri}">
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:interval>
+  </xsl:when>
+  <xsl:when test="string(@opid)=&quot;ge&quot;">
+    <m:apply>
+      <m:geq definitionURL="{@uri}"/>
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;false&quot;">
+    <m:false definitionURL="{@uri}"/>
+  </xsl:when>
+  
+  <xsl:when test="string(@opid)=&quot;true&quot;">
+    <m:true definitionURL="{@uri}"/>
+  </xsl:when>
+  
+    <!-- ALTRE ASTRAZIONI -->
+  <xsl:otherwise>
+    <m:apply>
+     <m:csymbol>app</m:csymbol>
+     <m:ci definitionURL="{@uri}">
+       <xsl:value-of select="@opid"/>
+     </m:ci>
+     <xsl:apply-templates/>
+    </m:apply>
+  </xsl:otherwise>
+  
+  </xsl:choose>
+  
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_annotatedpres.xsl b/helm/nuprl_stylesheets/nuprl_annotatedpres.xsl
new file mode 100644 (file)
index 0000000..f97a08b
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<!--***********************************************************************--> 
+<!-- XSLT version 0.1 of annotated MathML content to MathML presentation:  -->
+<!-- First draft: March 29 2000, Claudio Sacerdoti Coen, Irene Schena      -->
+<!--***********************************************************************--> 
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:helm="http://www.cs.unibo.it/helm">
+
+<xsl:import href="nuprl_mmlextension.xsl"/>
+
+<!-- ANNOTATION -->
+
+<xsl:template match="annotation">
+    <xsl:choose>
+    <xsl:when test=". = /">
+      <m:math><m:mrow helm:xref="{@helm:xref}">
+      <xsl:apply-templates/>
+      </m:mrow>
+      </m:math>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:mrow helm:xref="{@helm:xref}"><xsl:apply-templates/></m:mrow>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="text()">
+ <xsl:variable name="text" select="normalize-space(.)"/>
+ <xsl:if test="$text != ''">
+  <m:mtext><xsl:value-of select="$text"/></m:mtext>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet> 
diff --git a/helm/nuprl_stylesheets/nuprl_content_to_html.xsl b/helm/nuprl_stylesheets/nuprl_content_to_html.xsl
new file mode 100644 (file)
index 0000000..a2dbe9c
--- /dev/null
@@ -0,0 +1,2807 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+<!--***********************************************************************--> 
+<!-- From MathML content to HTML                                           -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena, Guidi               -->
+<!--***********************************************************************--> 
+
+<xsl:param name="CICURI" select="''"/>
+<xsl:param name="type" select="'standalone'"/>
+<xsl:param name="UNICODEvsSYMBOL" select="'symbol'"/>
+
+<xsl:include href="nuprl_html_arith.xsl"/>
+<xsl:include href="nuprl_html_basic.xsl"/>
+
+<xsl:variable name="showcast" select="0"/>
+
+<!--***********************************************************************-->
+<!-- HTML Head and Body                                                    -->
+<!--***********************************************************************-->
+
+<!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
+
+<!-- document needs method="xml" and searches locally for the dtd if        -->
+<!-- doctype-system is specified (the dtd must exist locally for parsing).  -->
+<!-- For having output html must be media-type="html" and for having the    -->
+<!-- correct <br /> you must specify at least the remote dtd by means of    -->
+<!-- doctype-public                                                         -->
+<xsl:output 
+       method="xml" 
+       encoding="iso-8859-1" 
+       media-type="text/html"
+       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
+
+<xsl:variable name="framewidth" select="55"/>
+
+<xsl:template match="m:ci">
+       <xsl:if test="m:ci=Ax">
+               <FONT color="blue" size="+1">
+               <xsl:text>Ax</xsl:text>
+               </FONT>
+       </xsl:if>
+       <xsl:if test="m:ci=void">
+               <FONT color="blue" size="+1">
+               <xsl:text>Void</xsl:text>
+               </FONT>
+       </xsl:if>
+</xsl:template>
+
+<!--forall-->
+  <xsl:variable name="forall">
+    <xsl:choose>
+      <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">&quot;</xsl:when>
+      <xsl:when test="$UNICODEvsSYMBOL = 'unicode'">&#x2200;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--lambda-->
+  <xsl:variable name="lambda">
+    <xsl:choose>
+      <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">l</xsl:when>
+      <xsl:when test="$UNICODEvsSYMBOL = 'unicode'">&#x3BB;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--prod-->
+  <xsl:variable name="prod">
+    <xsl:choose>
+      <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">&#xD5;</xsl:when>
+      <xsl:when test="$UNICODEvsSYMBOL = 'unicode'">&#x3A0;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--arrow-->
+  <xsl:variable name="arrow">
+    <xsl:choose>
+      <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">&#xAE;</xsl:when>
+      <xsl:when test="$UNICODEvsSYMBOL = 'unicode'">&#x2192;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--RightArrow-->
+  <xsl:variable name="RightArrow">
+    <xsl:choose>
+      <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">&#xDE;</xsl:when>
+      <xsl:when test="$UNICODEvsSYMBOL = 'unicode'">&#x21D2;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+
+<xsl:template name="mksymbol">
+        <xsl:param name="symbol" select="'???'"/>
+        <xsl:param name="color"  select="'blue'"/>
+        <xsl:param name="size"   select="''"/>
+
+        <xsl:choose>
+                <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
+                        <FONT FACE="symbol" SIZE="{$size}" COLOR="{$color}">
+                                <xsl:value-of select="$symbol"/>
+                        </FONT>
+                </xsl:when>
+                <xsl:otherwise>
+                        <FONT COLOR="{$color}">
+                                <xsl:value-of select="$symbol"/>
+                        </FONT>
+                </xsl:otherwise>
+        </xsl:choose>
+</xsl:template>
+
+<xsl:template match="/">
+ <xsl:param name="current_indent" select="0"/>
+ <xsl:choose>
+  <xsl:when test="$type = 'standalone'">
+   <html> 
+      <head>
+        <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
+         <style> A { text-decoration: none } </style>
+         <script>
+          <xsl:text disable-output-escaping="yes">
+           <![CDATA[
+            function Hide(which){
+             if (!document.getElementById)
+              return
+             which.style.display="none"
+            }
+
+            function Show(which){
+             if (!document.getElementById)
+              return
+             which.style.display=""
+            }
+
+            document.to_be_deleted = new Array();
+          ]]>
+          </xsl:text>
+         </script>
+      </head>
+      <body bgcolor="white">
+         <xsl:attribute name="onLoad">
+          if(document.getElementById)
+           for(var i=0;i&lt;document.to_be_deleted.length;i++)
+            Hide(document.getElementById(document.to_be_deleted[i]));
+         </xsl:attribute>
+         <xsl:apply-templates>
+            <xsl:with-param name="current_indent" select="0"/>
+         </xsl:apply-templates>
+      </body>
+   </html>
+  </xsl:when>
+  <xsl:otherwise>
+   <to_be_embedded>
+    <xsl:apply-templates>
+     <xsl:with-param name="current_indent" select="0"/>
+    </xsl:apply-templates>
+   </to_be_embedded>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!--***********************************************************************-->
+<!-- Indentation                                                          -->
+<!--***********************************************************************-->
+
+<xsl:template name="make_indent">
+ <xsl:param name="current_indent" select="0"/>
+  <xsl:if test="$current_indent > 0">
+   <xsl:text>&#x00a0;</xsl:text>
+   <xsl:call-template name="make_indent">
+    <xsl:with-param name="current_indent" select="$current_indent - 1"/> 
+   </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<!-- Syntactic Sugar -->
+<xsl:template match="m:type">
+<xsl:param name="current_indent" select="0"/> 
+<xsl:apply-templates>
+ <xsl:with-param name="current_indent" 
+           select="$current_indent"/>
+</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="m:condition">
+<xsl:param name="current_indent" select="0"/> 
+<xsl:apply-templates>
+ <xsl:with-param name="current_indent" 
+           select="$current_indent"/>
+</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="m:math">
+<xsl:param name="current_indent" select="0"/> 
+<xsl:apply-templates>
+ <xsl:with-param name="current_indent" 
+           select="$current_indent"/>
+</xsl:apply-templates>
+</xsl:template>
+
+
+
+<!--*********************************************************************-->
+<!--                         INLINE MODE                                 -->
+<!--*********************************************************************-->
+
+<!-- href -->
+<xsl:template mode="inline" match="m:ci">
+ <xsl:choose>
+  <xsl:when test="boolean(@definitionURL)">
+   <a href="{@definitionURL}">
+   <xsl:apply-templates/>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="."/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- CSYMBOL -->
+
+<xsl:template match="m:apply[m:csymbol]" mode="inline">
+   <xsl:variable name="name">
+    <xsl:value-of select="m:csymbol"/>
+   </xsl:variable>
+   <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
+   <xsl:choose>
+
+    <!-- FUNCTION (PROD) -->
+       <xsl:when test="$name='prod'">
+               <xsl:if test="m:bvar[m:ci]">
+                       <xsl:if test="m:bvar/m:ci=&quot;&quot;">
+                               <xsl:text>""</xsl:text>
+                       </xsl:if>
+               <xsl:value-of select="m:bvar/m:ci"/>
+                       <xsl:text>:</xsl:text>
+               </xsl:if>
+               <xsl:if test="m:bvar/m:type/*[*]">
+                               <xsl:text>( </xsl:text>
+               </xsl:if>
+               <xsl:apply-templates select="m:bvar/m:type"/>
+               <xsl:if test="m:bvar/m:type/*[*]">
+                       <xsl:text> )</xsl:text>
+               </xsl:if>
+               <xsl:call-template name="mksymbol">
+                       <xsl:with-param name="symbol" select="$arrow"/>
+                       <xsl:with-param name="color" select="'blue'"/>
+                       <xsl:with-param name="size" select="'+2'"/>
+               </xsl:call-template>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+    
+    <!-- FORALL -->
+    <xsl:when test="$name='forall'">
+     <xsl:call-template name="mksymbol">
+      <xsl:with-param name="symbol" select="$forall"/>
+      <xsl:with-param name="color" select="'blue'"/>
+      <xsl:with-param name="size" select="'+2'"/>
+     </xsl:call-template>
+     <xsl:apply-templates select="m:bvar/m:ci"/>
+     <xsl:text>:</xsl:text>
+     <xsl:if test="count(m:bvar/m:type/m:apply/*) > 1">
+       <xsl:text>(</xsl:text>
+     </xsl:if>
+     <xsl:apply-templates select="m:bvar/m:type"/>
+     <xsl:if test="count(m:bvar/m:type/m:apply/*) > 1">
+     <xsl:text>)</xsl:text>
+     </xsl:if>
+     <xsl:text>.</xsl:text>
+     <xsl:apply-templates select="*[position()=3]"/>
+     <xsl:if test="count(m:bvar/m:type/m:apply/*) > 1">
+     <xsl:text>)</xsl:text>
+     </xsl:if>
+    </xsl:when>
+   
+   
+    <!-- PROD -->
+    <xsl:when test="$name='product'">
+     <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
+     <xsl:text>:</xsl:text>
+     <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
+     <FONT color="blue">
+     <xsl:text>x</xsl:text>
+     </FONT>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+    </xsl:when>
+    
+    <!-- PROD_IND -->
+    <xsl:when test="$name='product_ind'">
+     <xsl:apply-templates mode="inline" select="m:type"/>
+     <FONT color="blue">
+     <xsl:text>x</xsl:text>
+     </FONT>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+    </xsl:when>
+   
+   <!-- PAIR -->
+   <xsl:when test="$name='pair'">
+       <FONT color="blue" size="+1">
+       <xsl:text>&lt;</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text>, </xsl:text>
+       <xsl:apply-templates select="*[3]"/>
+       <FONT color="blue" size="+1">
+       <xsl:text>&gt;</xsl:text>
+       </FONT>
+   </xsl:when>
+
+   <!-- UNION -->
+   <xsl:when test="$name='union'">
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue" size="+1">
+       <xsl:text>+</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[3]"/>
+  </xsl:when>
+
+  <!-- INL -->
+  <xsl:when test="$name='inl'">
+       <FONT color="blue">
+       <xsl:text>inl (</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue">
+       <xsl:text> )</xsl:text>
+       </FONT>
+  </xsl:when>
+
+   <!-- INR -->
+  <xsl:when test="$name='inr'">
+       <FONT color="blue" size="+1">
+       <xsl:text>inr (</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue" size="+1">
+       <xsl:text> )</xsl:text>
+       </FONT>
+  </xsl:when>
+
+       <!-- EQUAL -->
+       <xsl:when test="$name='equal'">
+               <xsl:apply-templates select="*[position()=3]"/>
+               <FONT color="blue" size="+1">
+               <xsl:text> = </xsl:text>
+               </FONT>
+                       <xsl:apply-templates select="*[position()=4]"/>
+               <!-- member -->
+               <xsl:text> </xsl:text>
+                       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$member"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+                       </xsl:call-template>
+               <xsl:text> </xsl:text>
+                       <xsl:apply-templates select="*[position()=2]">
+               <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+                       </xsl:apply-templates>
+               </xsl:when>
+       
+       <!-- CONS -->
+       <xsl:when test="$name='cons'">
+               <xsl:apply-templates select="*[2]"/>
+               <FONT color="blue">
+               <xsl:text>::</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- REC -->
+
+       <xsl:when test="$name='rec'">
+               <FONT color="blue">
+               <xsl:text>rectype</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[2]"/>
+               <FONT color="blue">
+               <xsl:text>=</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+
+       <!-- SET -->
+
+       <xsl:when test="$name='t_set'">
+               <FONT color="blue">
+               <xsl:text>{</xsl:text>
+               </FONT>
+               <xsl:choose>
+               <xsl:when test="m:bvar/m:ci">
+                       <xsl:apply-templates select="m:bvar/m:ci"/>
+                       <FONT color="blue">
+                       <xsl:text>:</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="m:bvar/m:type"/>
+               </xsl:when>
+               <xsl:otherwise>
+               <xsl:apply-templates select="m:bvar/m:type"/>
+               </xsl:otherwise>
+               </xsl:choose>
+               <FONT color="blue">
+               <xsl:text>|</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- ISECT -->
+
+       <xsl:when test="$name='isect'">
+               <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$intersection"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+                       </xsl:call-template>
+               <xsl:apply-templates select="m:bvar/m:ci"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="m:bvar/m:type"/>
+               <FONT color="blue">
+               <xsl:text>.</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- QUOTIENT --> 
+
+       <xsl:when test="$name='quotient'">
+               <xsl:apply-templates select="m:bvar[1]"/>
+               <xsl:text>,</xsl:text>
+               <xsl:apply-templates select="m:bvar[2]"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[2]"/>
+               <FONT color="blue">
+               <xsl:text>//</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[5]"/>
+       </xsl:when>
+
+    <!-- ARROW --> <!-- FUNCTION (IND) -->
+    <xsl:when test="$name='arrow'">
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$arrow"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+       </xsl:call-template>
+       <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+       <xsl:text>)</xsl:text>
+    </xsl:when>
+   
+   <!-- APP -->
+    <xsl:when test="$name='app'">
+     <xsl:text>(</xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:for-each select="*[position()>2]">
+      <xsl:text>&#x00A0;</xsl:text>
+      <xsl:apply-templates mode="inline" select="."/>
+     </xsl:for-each>
+     <xsl:text>)</xsl:text>
+    </xsl:when>
+    <!-- CAST -->
+    <xsl:when test="$name='cast'">
+     <xsl:text>(</xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:text>:></xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <xsl:text>)</xsl:text>
+    </xsl:when>
+    <xsl:when test="$name='Prop'">
+     <FONT color="violet">Prop</FONT>
+    </xsl:when>
+    <xsl:when test="$name='Set'">
+     <FONT color="violet">Set</FONT>
+    </xsl:when>
+    <xsl:when test="$name='Type'">
+     <FONT color="violet">Type</FONT>
+    </xsl:when>
+   
+   <!-- MUTCASE -->
+    <xsl:when test="$name='mutcase'">
+     <xsl:text>&lt;</xsl:text> 
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/> 
+     <xsl:text>&gt; </xsl:text>
+     <FONT color="red">CASE </FONT>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <FONT color="red"> OF </FONT>
+<xsl:for-each select="piecewise/piece">
+<!--<xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
+      <xsl:choose>
+       <xsl:when test="not(position() = 1)">
+        <xsl:text> | </xsl:text> 
+       </xsl:when> 
+      </xsl:choose>
+<xsl:apply-templates mode="inline" select="./*[2]"/>
+      <xsl:call-template name="mksymbol">
+       <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:apply-templates mode="inline"
+           select="./*[1]"/>
+     </xsl:for-each>
+    </xsl:when>
+   
+   <!-- FIX -->
+    <xsl:when test="$name='fix'">
+     <FONT color="red">FIX</FONT>
+     <xsl:value-of select="m:ci"/>
+     <xsl:text>{</xsl:text>
+     <xsl:for-each select="m:bvar"> 
+      <xsl:value-of select="m:ci"/>
+      <xsl:text>:</xsl:text>
+      <xsl:apply-templates mode="inline" select="m:type"/>
+      <xsl:text>:=</xsl:text>
+      <xsl:apply-templates mode="inline" 
+             select="following-sibling::*[position() = 1]"/>
+      <xsl:choose>
+       <xsl:when test="position()=last()">
+        <xsl:text>}</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>;</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:for-each>
+    </xsl:when>
+   
+   <!-- COFIX -->
+    <xsl:when test="$name='cofix'">
+     <xsl:text>COFIX</xsl:text>
+     <xsl:value-of select="m:ci"/>
+     <xsl:text>{</xsl:text>
+     <xsl:for-each select="m:bvar"> 
+      <xsl:value-of select="m:ci"/>
+      <xsl:text>:</xsl:text>
+      <xsl:apply-templates mode="inline" select="m:type"/>
+      <xsl:text>:=</xsl:text>
+      <xsl:apply-templates mode="inline" 
+          select="following-sibling::*[position() = 1]"/>
+      <xsl:choose>
+       <xsl:when test="position()=last()">
+        <xsl:text>}</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>;</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:for-each>
+    </xsl:when>
+   
+   <!-- proof -->
+    <xsl:when test="$name='proof' or $name='side_proof'">
+       <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+       <FONT color="red">&#x00a0;proves&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+    </xsl:when>
+    <xsl:when test="$name='letin1'">
+     <xsl:text>letin1 (inline error)</xsl:text>
+    </xsl:when>
+    <!-- false_ind -->
+    <xsl:when test="$name='false_ind'">
+    <xsl:apply-templates mode="inline" select="*[3]"/>
+    <FONT color="red">Contradiction.</FONT>
+    </xsl:when>
+    <!-- and_ind -->
+    <xsl:when test="$name='and_ind'">
+     <FONT color="red">From&#x00a0;</FONT>
+     <xsl:apply-templates select="*[2]"/>
+     <FONT color="red">&#x00a0;we get</FONT>
+     (
+     <xsl:apply-templates select="*[3]"/>
+     )&#x00a0;
+     <xsl:apply-templates mode="inline" select="*[4]"/>
+     <FONT color="red">&#x00a0;and&#x00a0;</FONT>
+     (
+     <xsl:apply-templates select="*[5]"/>
+     )&#x00a0;
+     <xsl:apply-templates mode="inline" select="*[6]"/>
+     ;
+     <FONT color="red">&#x00a0;hence&#x00a0;</FONT>
+     <xsl:apply-templates mode="inline" select="*[7]"/>
+    </xsl:when>
+
+   </xsl:choose>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:lambda">
+       <xsl:call-template name="mksymbol">
+                       <xsl:with-param name="symbol" select="'lambda'"/>
+                       <xsl:with-param name="color" select="'red'"/>
+                       <xsl:with-param name="size" select="'+2'"/>
+       </xsl:call-template>
+      
+      <!-- IN NuPrl non e' specificato il tipo -->
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:if test="m:bvar[m:mtype]">
+               <xsl:text>:</xsl:text>
+               <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
+       </xsl:if>
+       <xsl:text>.</xsl:text>
+      <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+</xsl:template>
+
+<!--*********************************************************************-->
+<!--                       COUNTING MODE                                 -->
+<!--*********************************************************************-->
+
+<xsl:template match="m:apply[m:csymbol]">
+  <xsl:param name="current_indent" select="0"/> 
+  <xsl:param name="width" select="$framewidth"/> 
+  <xsl:variable name="name">
+   <xsl:value-of select="m:csymbol"/>
+  </xsl:variable>
+  <xsl:variable name="charlength">
+   <xsl:apply-templates select="m:csymbol" mode="charcount"/>
+  </xsl:variable>
+     <!-- <xsl:value-of select="$current_indent"/> -->
+     <!-- <xsl:value-of select="$charlength"/> -->
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
+     <xsl:choose>
+     
+     <!-- FUNCTION (PROD) -->
+     <xsl:when test="$name='prod'">
+       <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <xsl:apply-templates select="m:bvar/m:ci"/>
+                       <xsl:text>:</xsl:text>
+                       <xsl:if test="m:bvar/m:type/*[*]">
+                               <xsl:text>( </xsl:text>
+                       </xsl:if>
+                       <xsl:apply-templates select="m:bvar/m:type">
+                               <xsl:with-param name="current_indent" 
+                               select="$current_indent + 5 + 2*string-length(m:bvar/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:call-template name="mksymbol">
+                               <xsl:with-param name="symbol" select="'arrow'"/>
+                               <xsl:with-param name="color" select="'blue'"/>
+                               <xsl:with-param name="size" select="'+2'"/>
+                       </xsl:call-template>
+                       <xsl:apply-templates select="*[position()=3]">
+                       <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+                       <xsl:if test="m:bvar/m:type/*[*]">
+                               <xsl:text>( </xsl:text>
+                       </xsl:if>
+                       </xsl:when>
+                       <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+    
+     <!-- TYPE_OF --> 
+     <xsl:when test="$name='type_of'">
+               <xsl:value-of select="*[2]"/>
+         <xsl:text>:</xsl:text>
+       
+       <!--<xsl:value-of select="*[3]"/>-->
+       <xsl:if test="count(*[3]/*) > 1">
+               <xsl:text>(</xsl:text>
+       </xsl:if>
+               <xsl:apply-templates select="*[3]"/>
+       <xsl:if test="count(*[3]/*) > 1">
+               <xsl:text>)</xsl:text>
+       </xsl:if>
+
+       <br/>
+       <xsl:call-template name="make_indent">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
+        </xsl:call-template>
+      </xsl:when>      
+
+     <!-- FORALL -->
+     <xsl:when test="$name='forall'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <!-- &#x03a0; -->
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$forall"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+2'"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="m:bvar/m:ci"/>
+         <xsl:text>:</xsl:text>
+         <xsl:apply-templates select="m:bvar/m:type">
+          <xsl:with-param name="current_indent" 
+           select="$current_indent + 5 + 2*string-length(m:bvar/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="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+      <!-- PROD -->
+      <xsl:when test="$name='prod'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+2'"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="m:bvar/m:ci"/>
+         <xsl:text>:</xsl:text>
+         <xsl:apply-templates select="m:bvar/m:type">
+          <xsl:with-param name="current_indent" 
+           select="$current_indent + 5 + 2*string-length(m:bvar/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="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      
+       <!-- PROD_IND -->
+      <xsl:when test="$name='prod_ind'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+2'"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="m:type">
+          <xsl:with-param name="current_indent" 
+           select="$current_indent + 5 + 2*string-length(m:bvar/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="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+      <!-- PAIR -->
+       <xsl:when test="$name='pair'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <FONT color="blue" size="+1">
+                       <xsl:text>&lt;</xsl:text>
+                       </FONT>
+                       <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:apply-templates select="*[position()=3]"/> 
+                       <FONT color="blue" size="+1">
+                       <xsl:text>&gt;</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- UNION -->  
+               <xsl:when test="$name='union'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <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>
+                       <FONT color="blue" size="+1">
+                       <xsl:text>+</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[position()=3]"/>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+       
+     <!-- INL -->
+       <xsl:when test="$name='inl'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <FONT color="blue">
+                       <xsl:text>inl (</xsl:text>
+                       </FONT>
+                       <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>
+                       <FONT color="blue">
+                       <xsl:text> )</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- INR -->
+       <xsl:when test="$name='inr'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <FONT color="blue" size="+1">
+                       <xsl:text>inr (</xsl:text>
+                       </FONT>
+                       <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>
+                       <FONT color="blue" size="+1">
+                       <xsl:text> )</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- PROP -->
+       <xsl:when test="$name='prop'">
+               <FONT color="blue" size="+1">
+               <xsl:text>P</xsl:text>
+               </FONT>
+               <FONT color="blue" size="2"> 
+               <xsl:apply-templates select="m:cn"/>
+               </FONT>
+       </xsl:when>
+
+       <!-- UNIVERSE -->
+       <xsl:when test="$name='universe'">
+               <FONT color="blue" size="+1">
+               <xsl:text>U</xsl:text>
+               </FONT>
+               <FONT color="blue" size="2"> 
+               <xsl:apply-templates select="m:cn"/>
+               </FONT>
+       </xsl:when>
+
+       <!-- EQUAL -->
+       <xsl:when test="$name='equal'">
+                       <xsl:choose>
+                               <xsl:when test="$charlength > $framewidth">
+                       <xsl:apply-templates select="*[position()=3]"/>
+                       <FONT color="blue" size="+1">
+                       <xsl:text>=</xsl:text>
+                       </FONT>
+                               <xsl:apply-templates select="*[position()=4]">
+                       <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>
+                               <!-- member -->
+                               <xsl:call-template name="mksymbol">
+                       <xsl:with-param name="symbol" select="'member'"/>
+                       <xsl:with-param name="color" select="'blue'"/>
+                       <xsl:with-param name="size" select="'+0'"/>
+                               </xsl:call-template>
+                               <xsl:apply-templates select="*[position()=2]">
+                       <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+                               </xsl:apply-templates>
+                       </xsl:when>
+                       <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+       <!-- TOKEN -->
+
+       <xsl:when test="$name='token'">
+               <FONT color="blue">
+               <xsl:text>"</xsl:text>
+               </FONT> 
+               <xsl:apply-templates select="m:ci"/>
+               <FONT color="blue">
+               <xsl:text>"</xsl:text>
+               </FONT> 
+       </xsl:when>
+
+       <!-- NIL -->
+
+       <xsl:when test="$name='nil'">
+               <FONT color="blue">
+               <xsl:text>[]</xsl:text>
+               </FONT> 
+       </xsl:when>
+
+       <!-- CONS -->
+       <xsl:when test="$name='cons'">
+               <xsl:apply-templates select="*[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>
+               <FONT color="blue">
+               <xsl:text>::</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+       
+       
+       <!-- REC --> 
+
+       <xsl:when test="$name='rec'">
+               <FONT color="blue">
+               <xsl:text>rectype</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[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>
+               <FONT color="blue">
+               <xsl:text>=</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- SET -->
+
+       <xsl:when test="$name='t_set'">
+               <FONT color="blue">
+               <xsl:text>{</xsl:text>
+               </FONT>
+               <xsl:choose>
+               <xsl:when test="m:bvar/m:ci">
+                       <xsl:apply-templates select="m:bvar/m:ci"/>
+                       <FONT color="blue">
+                       <xsl:text>:</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="m:bvar/m:type">
+                       <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:when>
+               <xsl:otherwise>
+               <xsl:apply-templates select="m:bvar/m:type">
+               <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:otherwise>
+               </xsl:choose>
+               <FONT color="blue">
+               <xsl:text>|</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- ISECT -->
+
+       <xsl:when test="$name='isect'">
+               <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="'intersection'"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+                       </xsl:call-template>
+               <xsl:apply-templates select="m:bvar/m:ci"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="m:bvar/m:type">
+               <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>
+               <FONT color="blue">
+               <xsl:text>.</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- QUOTIENT --> 
+
+       <xsl:when test="$name='quotient'">
+               <xsl:apply-templates select="m:bvar[1]"/>
+               <xsl:text>,</xsl:text>
+               <xsl:apply-templates select="m:bvar[2]"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[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>
+               <FONT color="blue">
+               <xsl:text>//</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[5]"/>
+       </xsl:when>
+
+       <!-- IF_THEN_ELSE -->
+
+       <xsl:when test="$name='if_then_else'">
+               <xsl:choose>
+               <xsl:when test="m:where = 'atom_eq'">
+                       <FONT color="blue">
+                       <xsl:text>atom_eq (</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:when test="m:where = 'int_eq'">
+                       <FONT color="blue">
+                       <xsl:text>int_eq (</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:when test="m:where = 'less'">
+                       <FONT color="blue">
+                       <xsl:text>less (</xsl:text>
+                       </FONT>
+               </xsl:when>
+               </xsl:choose>
+               <xsl:apply-templates select="*[3]"/>
+               <xsl:text>; </xsl:text>
+               <xsl:apply-templates select="*[4]"/>
+               <xsl:text>; </xsl:text>
+               <xsl:apply-templates select="*[5]"/>
+               <xsl:text>; </xsl:text> 
+               <xsl:apply-templates select="*[6]"/>
+               <FONT color="blue">
+               <xsl:text>)</xsl:text>
+               </FONT>
+       </xsl:when>
+
+
+       <!-- MUTCASE -->
+       <xsl:when test="$name='mutcase'">
+               <xsl:choose>
+               <!-- SPREAD -->
+               <xsl:when test="*[4]/*[1]/m:csymbol = 'pair'">
+                       <FONT color="blue">
+                       <xsl:text>spread (</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[3]"/>
+                       <xsl:text>; </xsl:text>
+                       <xsl:apply-templates select="*[4]/*[1]/*[2]"/>
+                       <xsl:text>, </xsl:text>
+                       <xsl:apply-templates select="*[4]/*[1]/*[3]"/>
+                       <xsl:text>. </xsl:text>
+                       <xsl:apply-templates select="*[4]/*[2]"/>
+                       <FONT color="blue">
+                       <xsl:text>)</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <!-- DECIDE -->
+               <xsl:when test="*[4]/*[1]/m:csymbol = 'inl'">
+                       <FONT color="blue">
+                       <xsl:text>decide (</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[3]"/>
+                       <xsl:text>; </xsl:text>
+                       <xsl:apply-templates select="*[4]/*[1]/*[2]"/>
+                       <xsl:text>.</xsl:text>
+                       <xsl:apply-templates select="*[4]/*[2]"/>
+                       <xsl:text>; </xsl:text>
+                       <xsl:apply-templates select="*[5]/*[1]/*[2]"/>
+                       <xsl:text>.</xsl:text>
+                       <xsl:apply-templates select="*[5]/*[2]"/>
+                       <FONT color="blue">
+                       <xsl:text>)</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <FONT color="blue">
+                       <xsl:text>any (</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[3]"/>
+                       <FONT color="blue">
+                       <xsl:text>)</xsl:text>
+                       </FONT>
+               </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- SO_LAMBDA -->
+       <xsl:when test="$name='so_lambda'">
+               <FONT color="green">
+               <xsl:text>so_</xsl:text>
+               </FONT>
+               <xsl:call-template name="mksymbol">
+                               <xsl:with-param name="symbol" select="'lambda'"/>
+                               <xsl:with-param name="color" select="'green'"/>
+                               <xsl:with-param name="size" select="'+2'"/>
+               </xsl:call-template>
+               <xsl:choose>
+               <xsl:when test="*[2]/*[1]='so_variable'">
+                       <FONT color="green">
+                       <xsl:text>(</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[2]/*[2]"/>
+                       <xsl:text>, </xsl:text>
+                       <xsl:apply-templates select="*[3]"/>
+                       <FONT color="green">    
+                               <xsl:text>)</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise> <xsl:apply-templates select="*[2]"/>
+                       <xsl:text>.</xsl:text>
+                       <xsl:apply-templates select="*[3]"/>
+               </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+       
+       
+       <!-- SO_APPLY -->
+       <xsl:when test="$name='so_apply'">
+               <FONT color="green">
+               <xsl:text>so_apply</xsl:text>
+               <xsl:text> (</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[2]"/>
+               <xsl:text>  </xsl:text>
+               <xsl:apply-templates select="*[3]"/>
+               <FONT color="green">
+               <xsl:text> )</xsl:text>
+               </FONT>
+       <!--    <xsl:choose>
+               <xsl:when test="*[2]/*[1]=so_variable">
+                       <FONT color="blue">
+                       <xsl:text>(</xsl:text>
+                       <xsl:apply-templates select="*[2]/*[2]"/>
+                       <xsl:text>)</xsl:text>
+                       </FONT>
+                       <xsl:text> (</xsl:text>
+                       <xsl:apply-templates select="*[3]"/>
+                       <xsl:text>  </xsl:text>
+                       <xsl:apply-templates select="*[4]"/>
+                       <xsl:text> )</xsl:text>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:text> (</xsl:text>
+                       <xsl:apply-templates select="*[2]"/>
+                       <xsl:text>  </xsl:text>
+                       <xsl:apply-templates select="*[3]"/>
+                       <xsl:text> )</xsl:text>
+               </xsl:otherwise>
+               </xsl:choose> -->
+       </xsl:when>
+
+
+
+       <!-- ARROW --> <!-- FUNCTION IND -->
+<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">
+                       <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>&lt;</xsl:text>
+         <xsl:apply-templates select="*[position()=2]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+         <xsl:text>&gt; </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="piecewise/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>&#x00A0;&#x00A0;</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+             <xsl:text>| </xsl:text>
+            </xsl:otherwise>
+            </xsl:choose>
+          <xsl:apply-templates select="./*[2]"/>
+            <xsl:call-template name="mksymbol">
+             <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&#x00a0;</xsl:text>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>&#x00a0;:=&#x00a0;</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&#x00a0;</xsl:text>
+       <xsl:apply-templates select="*[4]">
+        <xsl:with-param name="current_indent" select="$current_indent+5"/>
+       </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>
+        &#x00a0;
+       </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&#x00a0;</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 proved</a>\
+            </span>\
+           ');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+           document.write('&#x00a0;');
+          } 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&#x00a0;</FONT>\
+           ');
+          }
+         </script>
+        </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[position()=3]">
+        <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>
+        &#x00a0;
+       </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('&#x00a0;');
+          } 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&#x00a0;</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>&#x00a0;=</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:text>=&#x00a0;</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>&#x00a0;</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>&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[3]"/>
+       <xsl:text>&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[4]"/>
+       <xsl:text>&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates select="*[position()>2]"/>
+      </xsl:when>
+      <!-- by_induction -->
+      <xsl:when test="$name='by_induction'">
+       <FONT color="red">We prove&#x00a0;</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&#x00a0;</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&#x00a0;</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>)&#x00a0;</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>&#x00a0;</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&#x00a0;</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]"/>
+       )&#x00a0;
+       <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]"/>
+       )&#x00a0;
+       <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&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:text>(</xsl:text>
+       <xsl:value-of select="*[4]/m:bvar/m:ci"/>
+       <xsl:text>)&#x00a0;</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&#x00a0;</FONT>
+       <xsl:text>(</xsl:text>
+       <xsl:value-of select="*[5]/m:bvar/m:ci"/>
+       <xsl:text>)&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates select="*[3]"/>
+       <FONT color="red">&#x00a0;by cases:</FONT>
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:call-template>
+       Left:&#x00a0;
+       <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:&#x00a0;
+       <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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[3]"/>
+       :
+       <xsl:apply-templates mode="inline" select="*[4]"/>
+       <FONT color="red">&#x00a0;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">
+          <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">
+          <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:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text>]</xsl:text>
+      </xsl:when>
+
+      <xsl:when test="$name='lift_with_base'">
+       <SUB>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+       </SUB>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
+       <SUP>
+       <xsl:apply-templates select="*[4]" mode="inline"/>
+       </SUP>
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:text>)</xsl:text>
+      </xsl:when>
+
+      <xsl:when test="$name='lift'">
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
+       <SUP>
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       </SUP>
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+       <xsl:text>)</xsl:text>
+      </xsl:when>
+
+      <!-- reduction --> 
+      <xsl:when test="$name='beta_red1'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+      <xsl:when test="$name='beta_red'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='par_beta_red1'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='par_beta_red'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <!-- forgetful -->
+      <xsl:when test="$name='forgetful'">
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">|</a>
+       </xsl:when>
+       <xsl:otherwise>
+        |
+       </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">|</a>
+       </xsl:when>
+       <xsl:otherwise>
+        |
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- boolean algebra of redexes -->
+
+      <!-- isomorphic -->
+      <xsl:when test="$name='isomorphic'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <!-- INTERP -->
+      <xsl:when test="$name='interp'">
+         <font color="green">[</font>
+            <xsl:apply-templates select="*[2]"/>
+         <font color="green">]</font>
+      </xsl:when>
+
+     </xsl:choose>
+</xsl:template>
+
+<!-- LAMBDA -->
+
+<xsl:template match="m:lambda">
+<xsl:param name="current_indent" select="0"/>
+    <xsl:variable name="charlength">
+     <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
+     <!-- <xsl:apply-templates select="." mode="charcount"/> -->
+    </xsl:variable>
+    <!-- <xsl:value-of select="$charlength"/> -->
+    <!-- <xsl:value-of select="$current_indent"/> -->
+     <xsl:choose>
+     <xsl:when test="$charlength > $framewidth">
+       <!-- &#x03bb; -->
+       <xsl:call-template name="mksymbol">
+        <xsl:with-param name="symbol" select="'lambda'"/>
+        <xsl:with-param name="color" select="'red'"/>
+        <xsl:with-param name="size" select="'+2'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>:</xsl:text>
+       <xsl:apply-templates select="m:bvar/m:type">
+        <xsl:with-param name="current_indent" 
+           select="$current_indent + 4 + 2*string-length(m:bvar/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="*[position()=2]">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-templates mode="inline" select="."/>
+     </xsl:otherwise>
+     </xsl:choose>
+</xsl:template>
+
+<!-- href -->
+<xsl:template match="m:ci">
+ <xsl:choose>
+  <xsl:when test="boolean(@definitionURL)">
+   <a href="{@definitionURL}">
+   <xsl:apply-templates/>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="."/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- CHAR COUNTING -->
+
+<!-- enter this counting mode selecting the root -->
+<xsl:template match="*" mode="root_charcount">
+<xsl:param name="incurrent_length" select="0"/>
+ <xsl:choose>
+  <xsl:when test="count(*)=0">
+   <xsl:value-of select="0"/>
+  </xsl:when>
+  <xsl:when test="name()='m:ci'">
+   <xsl:value-of select="string-length()"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:apply-templates select="*[1]" mode="charcount">
+    <xsl:with-param name="incurrent_length" select="$incurrent_length"/>
+   </xsl:apply-templates>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+       <!-- CASI PARTICOLARI -->
+       
+<xsl:template match="m:apply[m:in]">
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text> </xsl:text>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="'member'"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+       <xsl:text> </xsl:text>
+       <xsl:apply-templates select="*[3]"/>
+</xsl:template>
+
+<xsl:template match="m:apply[m:implies]">
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text> </xsl:text>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="'implies'"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+       <xsl:text> </xsl:text>
+       <xsl:apply-templates select="*[3]"/>
+       <xsl:text>)</xsl:text>
+</xsl:template>
+
+<!-- enter this mode selecting the first child --> 
+
+<xsl:template match="m:ci|m:csymbol" mode="charcount">
+<xsl:param name="incurrent_length" select="0"/> 
+    <xsl:choose>
+    <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
+     <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/></xsl:apply-templates></xsl:variable>
+     <xsl:choose>
+     <xsl:when test="string($siblength) = &quot;&quot;">
+      <xsl:value-of select="$incurrent_length + string-length()"/>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($siblength)"/>
+     </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$incurrent_length + string-length()"/>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template> 
+
+<xsl:template match="*" mode="charcount">
+ <xsl:param name="incurrent_length" select="0"/>
+ <xsl:choose>
+  <xsl:when test="count(child::*) = 0">
+   <xsl:value-of select="$incurrent_length"/>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:variable name="childlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/></xsl:apply-templates></xsl:variable>
+    <xsl:choose>
+     <xsl:when test="$framewidth >= number($childlength)">
+      <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$childlength"/></xsl:apply-templates></xsl:variable>
+      <xsl:choose>
+       <xsl:when test="string($siblength) = &quot;&quot;">
+        <xsl:value-of select="number($childlength)"/>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:value-of select="number($siblength)"/>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($childlength)"/>
+     </xsl:otherwise>
+    </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<!--***********************************************************************-->
+<!-- OBJECTS                                                               -->
+<!--***********************************************************************-->
+
+<!-- Rule -->
+
+<xsl:template match="Rule">
+<xsl:param name="current_indent" select="0"/>
+<p>
+Rule:
+<br/>
+<xsl:choose>
+       <xsl:when test="m:ci">
+               <FONT color="red">
+               <xsl:apply-templates/>
+               </FONT>
+       </xsl:when>
+       <xsl:otherwise>
+               <FONT color="red">
+               <xsl:apply-templates select="m:apply/*[1]"/>
+               <xsl:text> ( </xsl:text>
+               </FONT>
+               <xsl:for-each select="m:apply/*[position()!=1]">
+               <xsl:choose>
+                       <xsl:when test="*[1]='level-exp'">
+                               <xsl:text>level-exp(</xsl:text>
+                               <xsl:apply-templates select="*[2]"/>
+                               <xsl:text>)</xsl:text>
+                       </xsl:when>
+                       <xsl:when test="m:apply">
+                               <xsl:apply-templates select="."/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:apply-templates/>
+                       </xsl:otherwise>
+               </xsl:choose>
+               <xsl:if test="position()!=last()">
+                       <xsl:text>, </xsl:text>
+               </xsl:if>
+               </xsl:for-each>
+               <FONT color="red">
+               <xsl:text> )</xsl:text>
+               </FONT>
+       </xsl:otherwise>
+</xsl:choose>
+</p>
+</xsl:template>
+
+<!-- Sequent -->
+
+<xsl:template match="Sequent">
+<xsl:param name="current_indent" select="0"/>
+<p>
+Sequent (<xsl:value-of select="@id"/>) :
+<br/>
+<xsl:for-each select="Decl">
+       <!--    <xsl:choose>
+               <xsl:when test="position()=1"/>
+                       <xsl:call-template name="make_indent">
+                       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:call-template name="make_indent">
+                       <xsl:with-param name="current_indent" select="$current_indent"/> 
+                       </xsl:call-template>
+               </xsl:otherwise>
+       </xsl:choose>-->
+       <xsl:variable name="num" select="position()"/>
+       <xsl:value-of select="$num"/>
+       <xsl:text>) </xsl:text>
+       <FONT color="yellow">
+       <xsl:value-of select="@name"/><xsl:text>(</xsl:text>
+       </FONT>
+       <xsl:choose>
+               <xsl:when test="m:apply">
+                       <xsl:apply-templates select="."/>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates/>
+               </xsl:otherwise>
+       </xsl:choose>
+       <FONT color="yellow">
+       <xsl:text> )</xsl:text>
+       </FONT>
+       
+ </xsl:for-each>
+ <br/>
+=====================================
+ <br/>
+ <xsl:call-template name="make_indent">
+  <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+ </xsl:call-template>
+ <xsl:apply-templates select="Goal"/>
+</p>
+</xsl:template>
+
+<!-- Node -->
+
+<xsl:template match="Node">
+<xsl:param name="current_indent" select="0"/>
+
+<p>
+Node:<br/>
+ <xsl:call-template name="make_indent">
+  <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+ </xsl:call-template>
+ <xsl:apply-templates select="Sequent"/>
+ <xsl:apply-templates select="Rule"/>
+</p>
+
+</xsl:template>
+
+<!-- DEFINITION -->
+
+<xsl:template match="Definition">
+<xsl:param name="current_indent" select="0"/>
+<p>
+DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)<br/>
+TYPE =<br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+      </xsl:call-template>
+       <xsl:apply-templates select="type/*[1]">
+        <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates><br/>
+BODY =<br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+      </xsl:call-template>
+       <xsl:apply-templates select="body/*">
+        <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</p>
+</xsl:template>
+
+<!-- AXIOM -->
+
+<xsl:template match="Axiom">
+<xsl:param name="current_indent" select="0"/>
+<p>
+AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)<br/>
+TYPE =<br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+      </xsl:call-template> 
+<xsl:apply-templates select="type/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</p>
+</xsl:template>
+
+<!-- UNFINISHED PROOF -->
+
+<xsl:template match="CurrentProof">
+<xsl:param name="current_indent" select="0"/>
+<p>
+UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)<br/>
+THESIS:  <xsl:apply-templates select="type/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+         </xsl:apply-templates><br/>
+CONJECTURES: 
+      <xsl:for-each select="Conjecture">
+      <br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 8"/> 
+      </xsl:call-template>
+      <xsl:for-each select="Decl|Def|Hidden">
+       <xsl:choose>
+        <xsl:when test="name(.)='Decl'">
+         <xsl:choose>
+          <xsl:when test="@name">
+           <xsl:value-of select="@name"/>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>_</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> : </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:when test="name(.)='Def'">
+         <xsl:choose>
+          <xsl:when test="@name">
+           <xsl:value-of select="@name"/>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>_</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> := </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:text> _ :? _ </xsl:text>
+        </xsl:otherwise>
+       </xsl:choose>
+      </xsl:for-each>
+      |- <xsl:value-of select="./@no"/> : 
+      <xsl:apply-templates select="./Goal/*[1]">
+       <xsl:with-param name="current_indent" select="$current_indent + 11"/>
+      </xsl:apply-templates>
+      </xsl:for-each> 
+      <br/>
+PROOF:
+      <xsl:apply-templates select="body/*[1]">
+        <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+      </xsl:apply-templates>
+</p>
+</xsl:template>
+
+<!-- MUTUAL INDUCTIVE DEFINITION -->
+
+<xsl:template match="InductiveDefinition">
+<xsl:param name="current_indent" select="0"/>
+<p>
+     <xsl:for-each select="InductiveType">
+         <xsl:choose>
+         <xsl:when test="position() = 1">
+          <xsl:choose>
+          <xsl:when test="string(./@inductive) = &quot;true&quot;">
+          INDUCTIVE DEFINITION 
+          </xsl:when>
+          <xsl:otherwise>
+          COINDUCTIVE DEFINITION 
+          </xsl:otherwise>
+          </xsl:choose>  
+         </xsl:when>
+         <xsl:otherwise>
+          AND 
+         </xsl:otherwise>
+         </xsl:choose>
+         <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != &quot;&quot;"><xsl:value-of select="../Params"/></xsl:if>)
+         [
+          <xsl:if test="string(../Param) != &quot;&quot;">         
+           <xsl:for-each select="../Param">
+            <xsl:value-of select="./@name"/>
+            :
+            <xsl:apply-templates select="*"/>
+           </xsl:for-each>
+          </xsl:if>
+         ] <br/>
+         OF ARITY 
+         <xsl:apply-templates select="./arity/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 9"/>
+         </xsl:apply-templates> <br/>
+         BUILT FROM:
+      <xsl:for-each select="./Constructor">
+      <br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 3"/> 
+      </xsl:call-template>
+         <xsl:choose>
+         <xsl:when test="position() = 1">
+         <xsl:text>&#x00A0;&#x00A0;</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+         <xsl:text>| </xsl:text>
+         </xsl:otherwise>
+         </xsl:choose>
+         <xsl:value-of select="./@name"/>
+         <xsl:text>: </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
+         </xsl:apply-templates>
+      </xsl:for-each>
+     </xsl:for-each>
+</p>
+</xsl:template>
+
+<!-- VARIABLE -->
+
+<xsl:template match="Variable">
+<xsl:param name="current_indent" select="0"/>
+<p>
+VARIABLE <xsl:value-of select="@name"/><br/>
+TYPE = <xsl:apply-templates select="type/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+<xsl:if test="body">
+<br/>
+BODY = <xsl:apply-templates select="body/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</xsl:if>
+</p>
+</xsl:template>
+
+<!--***********************************************************************-->
+<!-- SECTIONS                                                              -->
+<!--***********************************************************************-->
+
+<!-- SECTION -->
+
+<xsl:template match="SECTION">
+<xsl:param name="current_indent" select="0"/>
+ <h1>BEGIN OF SECTION</h1>
+  <xsl:apply-templates/>
+ <h1>END OF SECTION</h1>
+</xsl:template>
+
+</xsl:stylesheet> 
diff --git a/helm/nuprl_stylesheets/nuprl_content_to_html2.xsl b/helm/nuprl_stylesheets/nuprl_content_to_html2.xsl
new file mode 100644 (file)
index 0000000..d45eb8b
--- /dev/null
@@ -0,0 +1,3042 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+<!--***********************************************************************--> 
+<!-- From MathML content to HTML                                           -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena, Guidi               -->
+<!--***********************************************************************--> 
+
+<xsl:param name="CICURI" select="''"/>
+<xsl:param name="type" select="'standalone'"/>
+<xsl:variable name="PIPPOUNICODEvsSYMBOL" select="'symbol'"/>
+<xsl:param name="explode_tactics" select="false()"/>
+
+<xsl:include href="nuprl_html_arith.xsl"/>
+<xsl:include href="nuprl_html_basic.xsl"/>
+
+<xsl:variable name="showcast" select="0"/>
+
+<!--***********************************************************************-->
+<!-- HTML Head and Body                                                    -->
+<!--***********************************************************************-->
+
+<!-- <xsl:output method="html" encoding="iso-8859-1"/> -->
+
+<!-- document needs method="xml" and searches locally for the dtd if        -->
+<!-- doctype-system is specified (the dtd must exist locally for parsing).  -->
+<!-- For having output html must be media-type="html" and for having the    -->
+<!-- correct <br /> you must specify at least the remote dtd by means of    -->
+<!-- doctype-public                                                         -->
+
+<!-- Commentd out by Zack, a try-fix for NuPRL stylesheets with OCaml UWOBO -->
+<!--
+<xsl:output 
+       method="xml" 
+       encoding="iso-8859-1" 
+       media-type="text/html"
+       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
+-->
+<xsl:output 
+       method="html" 
+       encoding="iso-8859-1" 
+       media-type="text/html"
+       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
+
+<xsl:variable name="framewidth" select="55"/>
+
+<!--forall-->
+  <xsl:variable name="forall">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&quot;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2200;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--lambda-->
+  <xsl:variable name="lambda">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">l</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x3BB;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--prod-->
+  <xsl:variable name="prod">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xD5;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x3A0;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--arrow-->
+  <xsl:variable name="arrow">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xAE;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2192;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--RightArrow-->
+  <xsl:variable name="RightArrow">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xDE;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x21D2;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--product-->
+  <xsl:variable name="product">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">S</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#931;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--member-->
+  <xsl:variable name="member">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xce;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#8712;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--member-->
+  <xsl:variable name="intersection">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xc7;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#8745;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--integers-->
+  <xsl:variable name="integers">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">I</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#921;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--naturalnumbers-->
+  <xsl:variable name="naturalnumbers">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">N</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#925;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--implies-->
+  <xsl:variable name="implies">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xee;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#8658;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--exists-->
+  <xsl:variable name="exists">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#x24;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#8707;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+
+
+<xsl:template name="mksymbol">
+        <xsl:param name="symbol" select="'???'"/>
+        <xsl:param name="color"  select="'blue'"/>
+        <xsl:param name="size"   select="''"/>
+
+        <xsl:choose>
+                <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">
+                        <FONT FACE="symbol" SIZE="{$size}" COLOR="{$color}">
+                                <xsl:value-of select="$symbol"/>
+                        </FONT>
+                </xsl:when>
+                <xsl:otherwise>
+                        <FONT COLOR="{$color}">
+                                <xsl:value-of select="$symbol"/>
+                        </FONT>
+                </xsl:otherwise>
+        </xsl:choose>
+</xsl:template>
+
+<xsl:template match="/">
+ <xsl:param name="current_indent" select="0"/>
+ <xsl:choose>
+  <xsl:when test="$type = 'standalone'">
+   <html> 
+      <head>
+        <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
+         <style> A { text-decoration: none } </style>
+         <script>
+          <xsl:text disable-output-escaping="yes">
+           <![CDATA[
+            function Hide(which){
+             if (!document.getElementById)
+              return
+             which.style.display="none"
+            }
+
+            function Show(which){
+             if (!document.getElementById)
+              return
+             which.style.display=""
+            }
+
+            document.to_be_deleted = new Array();
+          ]]>
+          </xsl:text>
+         </script>
+       </head>
+      <body bgcolor="white">
+         <xsl:attribute name="onLoad">
+          if(document.getElementById)
+           for(var i=0;i&lt;document.to_be_deleted.length;i++)
+            Hide(document.getElementById(document.to_be_deleted[i]));
+         </xsl:attribute>
+         <xsl:apply-templates>
+            <xsl:with-param name="current_indent" select="0"/>
+         </xsl:apply-templates>
+      </body>
+   </html>
+  </xsl:when>
+  <xsl:otherwise>
+   <to_be_embedded>
+    <xsl:apply-templates>
+     <xsl:with-param name="current_indent" select="0"/>
+    </xsl:apply-templates>
+   </to_be_embedded>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!--***********************************************************************-->
+<!-- Indentation                                                          -->
+<!--***********************************************************************-->
+
+<xsl:template name="make_indent">
+       <xsl:param name="current_indent" select="0"/>
+       <xsl:if test="$current_indent > 0">
+               <xsl:text>&#x00a0;</xsl:text>
+               <xsl:call-template name="make_indent">
+               <xsl:with-param name="current_indent" select="$current_indent - 1"/> 
+               </xsl:call-template>
+       </xsl:if>
+</xsl:template>
+
+<!-- Syntactic Sugar -->
+<xsl:template match="m:type">
+<xsl:param name="current_indent" select="0"/> 
+<xsl:apply-templates>
+ <xsl:with-param name="current_indent" 
+           select="$current_indent"/>
+</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="m:condition">
+<xsl:param name="current_indent" select="0"/> 
+<xsl:apply-templates>
+ <xsl:with-param name="current_indent" 
+           select="$current_indent"/>
+</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="m:math">
+<xsl:param name="current_indent" select="0"/> 
+<xsl:apply-templates>
+ <xsl:with-param name="current_indent" 
+           select="$current_indent"/>
+</xsl:apply-templates>
+</xsl:template>
+
+
+
+<!--*********************************************************************-->
+<!--                         INLINE MODE                                 -->
+<!--*********************************************************************-->
+
+<!-- href -->
+<xsl:template mode="inline" match="m:ci">
+ <xsl:choose>
+  <xsl:when test="boolean(@definitionURL)">
+   <a href="{@definitionURL}">
+   <xsl:apply-templates/>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="."/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- CSYMBOL -->
+
+<xsl:template match="m:apply[m:csymbol]" mode="inline">
+ <xsl:param name="current_indent" select="0"/>
+   <xsl:variable name="name">
+    <xsl:value-of select="m:csymbol"/>
+   </xsl:variable>
+   <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
+   <xsl:choose>
+
+    <!-- FUNCTION-DIP (PROD) -->
+       <xsl:when test="$name='prod'">
+               <xsl:call-template name="mksymbol">
+                       <xsl:with-param name="symbol" select="$prod"/>
+                       <xsl:with-param name="color" select="'blue'"/>
+                       <xsl:with-param name="size" select="'+2'"/>
+               </xsl:call-template>
+               <xsl:apply-templates select="m:bvar/m:ci"/>
+               <xsl:if test="m:bvar/m:ci=&quot;&quot;">
+                       <xsl:text>""</xsl:text>
+               </xsl:if>
+               <xsl:text>:</xsl:text>
+               <!--<xsl:if test="m:bvar/m:type/*[*]">
+                       <xsl:text>( </xsl:text>
+               </xsl:if>-->
+               <xsl:apply-templates select="m:bvar/m:type"/>
+               <!--<xsl:if test="m:bvar/m:type/*[*]">
+                       <xsl:text>) </xsl:text>
+               </xsl:if>-->
+               <xsl:text>.</xsl:text>
+               <xsl:apply-templates select="*[position()=3]"/>
+       </xsl:when>
+       
+       <!-- ARROW --> <!-- FUNCTION (IND) -->
+    <xsl:when test="$name='arrow'">
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$arrow"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+       </xsl:call-template>
+       <xsl:apply-templates  select="*[position()=3]"/>
+       <xsl:text>)</xsl:text>
+    </xsl:when>
+
+    
+    <!-- FORALL -->
+    <xsl:when test="$name='forall'">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$forall"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+2'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>:</xsl:text>
+       <!--<xsl:if test="count(m:bvar/m:type/m:apply/*) > 1">
+               <xsl:text>(</xsl:text>
+       </xsl:if>-->
+       <xsl:apply-templates select="m:bvar/m:type"/>
+       <!--<xsl:if test="count(m:bvar/m:type/m:apply/*) > 1">
+               <xsl:text>)</xsl:text>
+       </xsl:if>-->
+       <xsl:text>.</xsl:text>
+       <xsl:apply-templates select="*[position()=3]"/>
+   </xsl:when>
+   
+   
+    <!-- PRODUCT -->
+    <xsl:when test="$name='product'">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$product"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+2'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>:</xsl:text>
+       <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
+       <xsl:text>.</xsl:text>
+       <xsl:apply-templates select="*[position()=3]"/>
+    </xsl:when>
+    
+    <!-- PROD_IND -->
+    <xsl:when test="$name='product_ind'">
+     <FONT color="blue">
+     <xsl:text>( </xsl:text>
+     </FONT>
+     <xsl:apply-templates mode="inline" select="m:type"/>
+     <FONT color="blue" size="+2">
+     <xsl:text>x</xsl:text>
+     </FONT>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <FONT color="blue">
+     <xsl:text> )</xsl:text>
+     </FONT>
+
+    </xsl:when>
+   
+   <!-- PAIR -->
+   <xsl:when test="$name='pair'">
+       <FONT color="blue" size="+1">
+       <xsl:text>&lt;</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text>, </xsl:text>
+       <xsl:apply-templates select="*[3]"/>
+       <FONT color="blue" size="+1">
+       <xsl:text>&gt;</xsl:text>
+       </FONT>
+   </xsl:when>
+
+   <!-- UNION -->
+   <xsl:when test="$name='union'">
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue" size="+2">
+       <xsl:text>+</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[3]"/>
+  </xsl:when>
+
+  <!-- INL -->
+  <xsl:when test="$name='inl'">
+       <FONT color="blue">
+       <xsl:text>inl (</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue">
+       <xsl:text> )</xsl:text>
+       </FONT>
+  </xsl:when>
+
+   <!-- INR -->
+  <xsl:when test="$name='inr'">
+       <FONT color="blue" size="+1">
+       <xsl:text>inr (</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue" size="+1">
+       <xsl:text> )</xsl:text>
+       </FONT>
+  </xsl:when>
+
+       <!-- EQUAL -->
+       <xsl:when test="$name='equal'">
+               <xsl:apply-templates select="*[position()=3]"/>
+               <FONT color="blue" size="+1">
+               <xsl:text> = </xsl:text>
+               </FONT>
+                       <xsl:apply-templates select="*[position()=4]"/>
+               <xsl:text> </xsl:text>
+                       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$member"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+                       </xsl:call-template>
+               <xsl:text> </xsl:text>
+                       <xsl:apply-templates select="*[position()=2]">
+                <xsl:with-param name="current_indent" select="$current_indent"/>
+                       </xsl:apply-templates>
+               </xsl:when>
+       
+       <!-- CONS -->
+       <xsl:when test="$name='cons'">
+               <xsl:apply-templates select="*[2]"/>
+               <FONT color="blue">
+               <xsl:text>::</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- REC -->
+
+       <xsl:when test="$name='rec'">
+               <FONT color="blue">
+               <xsl:text>rectype</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[2]"/>
+               <FONT color="blue">
+               <xsl:text>=</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+
+       <!-- SET -->
+
+       <xsl:when test="$name='t_set'">
+               <FONT color="blue">
+               <xsl:text>{</xsl:text>
+               </FONT>
+               <xsl:choose>
+               <xsl:when test="m:bvar/m:ci">
+                       <xsl:apply-templates select="m:bvar/m:ci"/>
+                       <FONT color="blue">
+                       <xsl:text>:</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="m:bvar/m:type"/>
+               </xsl:when>
+               <xsl:otherwise>
+               <xsl:apply-templates select="m:bvar/m:type"/>
+               </xsl:otherwise>
+               </xsl:choose>
+               <FONT color="blue">
+               <xsl:text>|</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+               <FONT color="blue">
+                       <xsl:text>}</xsl:text>
+               </FONT>
+
+       </xsl:when>
+
+       <!-- ISECT -->
+
+       <xsl:when test="$name='isect'">
+               <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$intersection"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+                       </xsl:call-template>
+               <xsl:apply-templates select="m:bvar/m:ci"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="m:bvar/m:type"/>
+               <FONT color="blue">
+               <xsl:text>.</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]"/>
+       </xsl:when>
+
+       <!-- QUOTIENT --> 
+
+       <xsl:when test="$name='quotient'">
+               <xsl:apply-templates select="m:bvar[1]"/>
+               <xsl:text>,</xsl:text>
+               <xsl:apply-templates select="m:bvar[2]"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[2]"/>
+               <FONT color="blue">
+               <xsl:text>//</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[5]"/>
+       </xsl:when>
+
+       <!-- SO_LAMBDA -->
+       <xsl:when test="$name='so_lambda'">
+                               <xsl:call-template name="mksymbol">
+                               <xsl:with-param name="symbol" select="$lambda"/>
+                               <xsl:with-param name="color" select="'red'"/>
+                               <xsl:with-param name="size" select="'+2'"/>
+                               </xsl:call-template>
+                               <xsl:apply-templates select="m:apply[1]/*[2]"/>
+                               <xsl:text>.</xsl:text>
+                               <xsl:apply-templates select="*[3]"/>
+     </xsl:when>
+
+
+       <!-- SO_APPLY -->
+
+       <xsl:when test="$name='so_apply'">
+               <xsl:text>(</xsl:text>
+               <xsl:apply-templates select="*[position()=2]"/>
+                       <xsl:for-each select="*[position()>2]">
+                       <xsl:text>&#x00A0;</xsl:text>
+                       <xsl:apply-templates mode="inline" select="."/>
+               </xsl:for-each>
+               <xsl:text>)</xsl:text>
+      </xsl:when>
+   <!-- APP -->
+    <xsl:when test="$name='app'">
+     <!-- NuPRL rendering -->
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:if test="count(*) &gt; 2">
+      <xsl:text>(</xsl:text>
+      <xsl:for-each select="*[position() &gt; 2]">
+       <xsl:apply-templates select="." mode="inline"/>
+       <xsl:if test="not(position() = last())">
+        <xsl:text>,</xsl:text>
+       </xsl:if>
+      </xsl:for-each>
+      <xsl:text>)</xsl:text>
+     </xsl:if>
+     <!-- CIC rendering
+     <xsl:text>(</xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:for-each select="*[position()>2]">
+      <xsl:text>&#x00A0;</xsl:text>
+      <xsl:apply-templates mode="inline" select="."/>
+     </xsl:for-each>
+     <xsl:text>)</xsl:text>
+     -->
+    </xsl:when>
+    <!-- CAST -->
+    <xsl:when test="$name='cast'">
+     <xsl:text>(</xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:text>:></xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <xsl:text>)</xsl:text>
+    </xsl:when>
+    <xsl:when test="$name='Prop'">
+     <FONT color="violet">Prop</FONT>
+    </xsl:when>
+    <xsl:when test="$name='Set'">
+     <FONT color="violet">Set</FONT>
+    </xsl:when>
+    <xsl:when test="$name='Type'">
+     <FONT color="violet">Type</FONT>
+    </xsl:when>
+   
+   <!-- MUTCASE -->
+    <xsl:when test="$name='mutcase'">
+     <xsl:text>&lt;</xsl:text> 
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/> 
+     <xsl:text>&gt; </xsl:text>
+     <FONT color="red">CASE </FONT>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <FONT color="red"> OF </FONT>
+<xsl:for-each select="m:piecewise/m:piece">
+<!--<xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
+      <xsl:choose>
+       <xsl:when test="not(position() = 1)">
+        <xsl:text> | </xsl:text> 
+       </xsl:when> 
+      </xsl:choose>
+<xsl:apply-templates mode="inline" select="./*[2]"/>
+      <xsl:call-template name="mksymbol">
+       <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:apply-templates mode="inline"
+           select="./*[1]"/>
+     </xsl:for-each>
+    </xsl:when>
+   
+   <!-- FIX -->
+    <xsl:when test="$name='fix'">
+     <FONT color="red">FIX</FONT>
+     <xsl:value-of select="m:ci"/>
+     <xsl:text>{</xsl:text>
+     <xsl:for-each select="m:bvar"> 
+      <xsl:value-of select="m:ci"/>
+      <xsl:text>:</xsl:text>
+      <xsl:apply-templates mode="inline" select="m:type"/>
+      <xsl:text>:=</xsl:text>
+      <xsl:apply-templates mode="inline" 
+             select="following-sibling::*[position() = 1]"/>
+      <xsl:choose>
+       <xsl:when test="position()=last()">
+        <xsl:text>}</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>;</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:for-each>
+    </xsl:when>
+   
+   <!-- COFIX -->
+    <xsl:when test="$name='cofix'">
+     <xsl:text>COFIX</xsl:text>
+     <xsl:value-of select="m:ci"/>
+     <xsl:text>{</xsl:text>
+     <xsl:for-each select="m:bvar"> 
+      <xsl:value-of select="m:ci"/>
+      <xsl:text>:</xsl:text>
+      <xsl:apply-templates mode="inline" select="m:type"/>
+      <xsl:text>:=</xsl:text>
+      <xsl:apply-templates mode="inline" 
+          select="following-sibling::*[position() = 1]"/>
+      <xsl:choose>
+       <xsl:when test="position()=last()">
+        <xsl:text>}</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>;</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:for-each>
+    </xsl:when>
+   
+   <!-- proof -->
+    <xsl:when test="$name='proof' or $name='side_proof'">
+       <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+       <FONT color="red">&#x00a0;proves&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+    </xsl:when>
+    <xsl:when test="$name='letin1'">
+     <xsl:text>letin1 (inline error)</xsl:text>
+    </xsl:when>
+    <!-- false_ind -->
+    <xsl:when test="$name='false_ind'">
+    <xsl:apply-templates mode="inline" select="*[3]"/>
+    <FONT color="red">Contradiction.</FONT>
+    </xsl:when>
+    <!-- and_ind -->
+    <xsl:when test="$name='and_ind'">
+     <FONT color="red">From&#x00a0;</FONT>
+     <xsl:apply-templates select="*[2]"/>
+     <FONT color="red">&#x00a0;we get</FONT>
+     (
+     <xsl:apply-templates select="*[3]"/>
+     )&#x00a0;
+     <xsl:apply-templates mode="inline" select="*[4]"/>
+     <FONT color="red">&#x00a0;and&#x00a0;</FONT>
+     (
+     <xsl:apply-templates select="*[5]"/>
+     )&#x00a0;
+     <xsl:apply-templates mode="inline" select="*[6]"/>
+     ;
+     <FONT color="red">&#x00a0;hence&#x00a0;</FONT>
+     <xsl:apply-templates mode="inline" select="*[7]"/>
+    </xsl:when>
+   </xsl:choose>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:lambda">
+       <xsl:call-template name="mksymbol">
+                       <xsl:with-param name="symbol" select="$lambda"/>
+                       <xsl:with-param name="color" select="'red'"/>
+                       <xsl:with-param name="size" select="'+2'"/>
+       </xsl:call-template>
+      
+      <!-- IN NuPrl non e' specificato il tipo -->
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:if test="m:bvar[m:mtype]">
+               <xsl:text>:</xsl:text>
+               <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
+       </xsl:if>
+       <xsl:text>.</xsl:text>
+      <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+</xsl:template>
+
+<!--*********************************************************************-->
+<!--                       NORMAL MODE                                   -->
+<!--*********************************************************************-->
+
+<xsl:template match="m:apply[m:csymbol]">
+    <xsl:param name="current_indent" select="0"/> 
+    <xsl:param name="width" select="$framewidth"/> 
+    <xsl:variable name="name">
+     <xsl:value-of select="m:csymbol"/>
+    </xsl:variable>
+    <xsl:variable name="charlength">
+     <xsl:apply-templates select="m:csymbol" mode="charcount"/>
+    </xsl:variable>
+    <xsl:variable name="uri">
+     <xsl:value-of select="*[1]/@definitionURL"/>
+    </xsl:variable>
+     
+     
+     <xsl:choose>
+     
+     <!-- FUNCTION-DIP (PROD) -->
+     <xsl:when test="$name='prod'">
+       <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <xsl:call-template name="mksymbol">
+                               <xsl:with-param name="symbol" select="$prod"/>
+                               <xsl:with-param name="color" select="'blue'"/>
+                               <xsl:with-param name="size" select="'+2'"/>
+                       </xsl:call-template>
+                       <xsl:apply-templates select="m:bvar/m:ci">
+                       <xsl:with-param name="current_indent" select="$current_indent"/>
+                       </xsl:apply-templates>
+                       <xsl:if test="m:bvar/m:ci=&quot;&quot;">
+                               <xsl:text>""</xsl:text>
+                       </xsl:if>
+                       <xsl:text>:</xsl:text>
+                       <!--<xsl:if test="m:bvar/m:type/*[*]">
+                               <xsl:text>( </xsl:text>
+                       </xsl:if>-->
+                       <xsl:apply-templates select="m:bvar/m:type">
+                               <xsl:with-param name="current_indent" 
+                               select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
+                       </xsl:apply-templates>
+                       <!--<xsl:if test="m:bvar/m:type/*[*]">
+                               <xsl:text>) </xsl:text>
+                       </xsl:if>-->
+                       <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 + 2"/>
+                       </xsl:apply-templates>
+               </xsl:when>
+                       <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+    
+    <!-- ARROW --> <!-- FUNCTION IND -->
+       <xsl:when test="$name='arrow'">
+                       <xsl:choose>
+                               <xsl:when test="$charlength > $framewidth">
+                       <xsl:text>arrow</xsl:text>
+                               <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:call-template name="mksymbol">
+                               <xsl:with-param name="symbol" select="$arrow"/>
+                               <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>
+
+     <!-- TYPE_OF --> 
+     <xsl:when test="$name='type_of'">
+               <xsl:value-of select="*[2]"/>
+         <xsl:text>:</xsl:text>
+       <xsl:if test="count(*[3]/*) > 1">
+               <xsl:text>(</xsl:text>
+       </xsl:if>
+       <xsl:apply-templates select="*[3]"/>
+       <xsl:if test="count(*[3]/*) > 1">
+               <xsl:text>)</xsl:text>
+       </xsl:if>
+      </xsl:when>      
+
+       <!-- AXIOM -->
+       <xsl:when test="$name='Ax'">
+               <FONT color="blue">
+               <xsl:text>Ax</xsl:text>
+               </FONT>
+       </xsl:when>
+       
+       <!-- VOID -->
+       <xsl:when test="$name='void'">
+               <FONT color="blue">
+               <xsl:text>Void</xsl:text>
+               </FONT>
+       </xsl:when>     
+       
+       <!-- ATOM -->
+       <xsl:when test="$name='atom'">
+               <FONT color="blue">
+               <xsl:text>Atom</xsl:text>
+               </FONT>
+       </xsl:when>     
+
+       
+       
+     <!-- FORALL -->
+     <xsl:when test="$name='forall'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <!-- &#x03a0; -->
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$forall"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+2'"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="m:bvar/m:ci">
+        <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+         <xsl:text>:</xsl:text>
+         <xsl:apply-templates select="m:bvar/m:type">
+          <xsl:with-param name="current_indent" 
+           select="$current_indent + 5 + 2*string-length(m:bvar/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="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+      <!-- PRODUCT -->
+      <xsl:when test="$name='product'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+         <xsl:call-template name="mksymbol">
+          <xsl:with-param name="symbol" select="$product"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+2'"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="m:bvar/m:ci">
+         <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+         <xsl:text>:</xsl:text>
+         <xsl:apply-templates select="m:bvar/m:type">
+          <xsl:with-param name="current_indent" 
+           select="$current_indent + 5 + 2*string-length(m:bvar/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="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      
+       <!-- PROD_IND -->
+      <xsl:when test="$name='product_ind'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <FONT color="blue">
+               <xsl:text>( </xsl:text>
+       </FONT>
+         <xsl:apply-templates select="m:type">
+          <xsl:with-param name="current_indent" 
+           select="$current_indent + 5 + 2*string-length(m:bvar/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>
+       <FONT color="blue" size="+1">
+         <xsl:text> x </xsl:text>
+        </FONT>
+         <xsl:apply-templates select="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+        <FONT color="blue">
+               <xsl:text> )</xsl:text>
+       </FONT>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+      <!-- PAIR -->
+       <xsl:when test="$name='pair'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <FONT color="blue" size="+1">
+                       <xsl:text>&lt;</xsl:text>
+                       </FONT>
+                       <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:apply-templates select="*[position()=3]">  
+                        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                               </xsl:apply-templates>
+                       <FONT color="blue" size="+1">
+                       <xsl:text>&gt;</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- UNION -->  
+               <xsl:when test="$name='union'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <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>
+                       <FONT color="blue" size="+1">
+                       <xsl:text>+</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[position()=3]">
+                        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                               </xsl:apply-templates>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+       
+     <!-- INL -->
+       <xsl:when test="$name='inl'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <FONT color="blue">
+                       <xsl:text>inl (</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[position()=2]">
+                        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                               </xsl:apply-templates>
+                       <FONT color="blue">
+                       <xsl:text> )</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- INR -->
+       <xsl:when test="$name='inr'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                       <FONT color="blue" size="+1">
+                       <xsl:text>inr (</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="*[position()=2]">
+                        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                               </xsl:apply-templates>
+                       <FONT color="blue" size="+1">
+                       <xsl:text> )</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:when>
+
+       <!-- PROP -->
+       <xsl:when test="$name='prop'">
+               <FONT color="blue">
+               <xsl:text>P</xsl:text>
+               </FONT>
+               <FONT color="blue" size="-2"> 
+               <xsl:apply-templates select="m:cn">
+                <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+               </FONT>
+       </xsl:when>
+
+       <!-- UNIVERSE -->
+       <xsl:when test="$name='universe'">
+               <FONT color="blue" size="+1">
+               <xsl:text>U</xsl:text>
+               </FONT>
+               <FONT color="blue" size="2"> 
+               <xsl:apply-templates select="m:cn"/>
+               </FONT>
+       </xsl:when>
+
+       <!-- EQUAL -->
+       <xsl:when test="$name='equal'">
+                       <xsl:choose>
+                               <xsl:when test="$charlength > $framewidth">
+                       <xsl:apply-templates select="*[position()=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="blue" size="+1">
+                        <xsl:text>= </xsl:text>
+                       </FONT>
+                               <xsl:apply-templates select="*[position()=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>
+                               <!-- member -->
+                               <xsl:call-template name="mksymbol">
+                       <xsl:with-param name="symbol" select="$member"/>
+                       <xsl:with-param name="color" select="'blue'"/>
+                       <xsl:with-param name="size" select="'+0'"/>
+                               </xsl:call-template>
+                               <xsl:apply-templates select="*[position()=2]">
+                       <xsl:with-param name="current_indent" select="$current_indent"/>
+                               </xsl:apply-templates>
+                       </xsl:when>
+                       <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+       <!-- TOKEN -->
+
+       <xsl:when test="$name='token'">
+               <FONT color="blue">
+               <xsl:text>"</xsl:text>
+               </FONT> 
+               <xsl:apply-templates select="m:ci"/>
+               <FONT color="blue">
+               <xsl:text>"</xsl:text>
+               </FONT> 
+       </xsl:when>
+
+       <!-- NIL -->
+
+       <xsl:when test="$name='nil'">
+               <FONT color="blue">
+               <xsl:text>[]</xsl:text>
+               </FONT> 
+       </xsl:when>
+
+       <!-- CONS -->
+       <xsl:when test="$name='cons'">
+               <xsl:apply-templates select="*[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>
+               <FONT color="blue">
+               <xsl:text>::</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]">
+                <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+       </xsl:when>
+       
+       
+       <!-- REC --> 
+
+       <xsl:when test="$name='rec'">
+               <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+               <FONT color="blue">
+               <xsl:text>rectype</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[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>
+               <FONT color="blue">
+               <xsl:text>=</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]">
+                <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+                       </xsl:choose>
+       </xsl:when>
+
+       <!-- SET -->
+
+       <xsl:when test="$name='t_set'">
+       <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+               <FONT color="blue">
+               <xsl:text>{</xsl:text>
+               </FONT>
+               <xsl:choose>
+               <xsl:when test="m:bvar/m:ci">
+                       <xsl:apply-templates select="m:bvar/m:ci"/>
+                       <FONT color="blue">
+                               <xsl:text>:</xsl:text>
+                       </FONT>
+                       <xsl:apply-templates select="m:bvar/m:type">
+                               <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:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates select="m:bvar/m:type">
+                               <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:otherwise>
+               </xsl:choose>
+               <FONT color="blue">
+                       <xsl:text>|</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]">
+                <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+
+               <FONT color="blue">
+                       <xsl:text>}</xsl:text>
+               </FONT>
+
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+                       </xsl:otherwise>
+                       </xsl:choose>
+       </xsl:when>
+
+       <!-- ISECT -->
+
+       <xsl:when test="$name='isect'">
+               <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$intersection"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+                       </xsl:call-template>
+               <xsl:apply-templates select="m:bvar/m:ci"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="m:bvar/m:type">
+               <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>
+               <FONT color="blue">
+               <xsl:text>.</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[3]">
+                <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+
+       </xsl:when>
+
+       <!-- QUOTIENT --> 
+
+       <xsl:when test="$name='quotient'">
+               <xsl:apply-templates select="m:bvar[1]"/>
+               <xsl:text>,</xsl:text>
+               <xsl:apply-templates select="m:bvar[2]"/>
+               <FONT color="blue">
+               <xsl:text>:</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[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>
+               <FONT color="blue">
+               <xsl:text>//</xsl:text>
+               </FONT>
+               <xsl:apply-templates select="*[5]">
+                <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                       </xsl:apply-templates>
+
+       </xsl:when>
+
+       <!-- IF_THEN_ELSE -->
+       <xsl:when test="$name='if_then_else'">
+               <xsl:choose>
+               <xsl:when test="m:where = 'atom_eq'">
+                       <FONT color="blue">
+                       <xsl:text>atom_eq (</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:when test="m:where = 'int_eq'">
+                       <FONT color="blue">
+                       <xsl:text>int_eq (</xsl:text>
+                       </FONT>
+               </xsl:when>
+               <xsl:when test="m:where = 'less'">
+                       <FONT color="blue">
+                       <xsl:text>less (</xsl:text>
+                       </FONT>
+               </xsl:when>
+               </xsl:choose>
+               <xsl:apply-templates select="*[3]"/>
+               <xsl:text>; </xsl:text>
+               <xsl:apply-templates select="*[4]"/>
+               <xsl:text>; </xsl:text>
+               <xsl:apply-templates select="*[5]"/>
+               <xsl:text>; </xsl:text> 
+               <xsl:apply-templates select="*[6]"/>
+               <FONT color="blue">
+               <xsl:text>)</xsl:text>
+               </FONT>
+       </xsl:when>
+
+
+       <!-- SO_LAMBDA -->
+       <xsl:when test="$name='so_lambda'">
+       <xsl:choose>
+               <xsl:when test="$charlength > $framewidth">
+                               <xsl:call-template name="mksymbol">
+                               <xsl:with-param name="symbol" select="$lambda"/>
+                               <xsl:with-param name="color" select="'red'"/>
+                               <xsl:with-param name="size" select="'+2'"/>
+                               </xsl:call-template>
+                               <xsl:apply-templates select="m:apply[1]/*[2]"/>
+                               <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="*[3]">
+                        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+                               </xsl:apply-templates>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates mode="inline" select="."/>
+               </xsl:otherwise>
+     </xsl:choose>
+     </xsl:when>
+
+
+       <!-- SO_APPLY -->
+
+       <xsl:when test="$name='so_apply'">
+       <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>
+      
+      <!-- APP -->
+      <xsl:when test="$name='app'">
+               <xsl:choose>
+               <xsl:when test="$charlength  > $framewidth">
+         <!-- NuPRL rendering -->
+         <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:if test="count(*) &gt; 2">
+          <xsl:text>(</xsl:text>
+          <xsl:for-each select="*[position() &gt; 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="." mode="inline"/>
+           <xsl:if test="not(position() = last())">
+            <xsl:text>,</xsl:text>
+           </xsl:if>
+          </xsl:for-each>
+          <xsl:text>)</xsl:text>
+         </xsl:if>
+                <!-- CIC rendering
+               <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>&lt;</xsl:text>
+         <xsl:apply-templates select="*[position()=2]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+         </xsl:apply-templates>
+         <xsl:text>&gt; </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>&#x00A0;&#x00A0;</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+             <xsl:text>| </xsl:text>
+            </xsl:otherwise>
+            </xsl:choose>
+          <xsl:apply-templates select="./*[2]"/>
+            <xsl:call-template name="mksymbol">
+             <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&#x00a0;</xsl:text>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>&#x00a0;:=&#x00a0;</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&#x00a0;</xsl:text>
+       <xsl:apply-templates select="*[4]">
+        <xsl:with-param name="current_indent" select="$current_indent+5"/>
+       </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>
+        &#x00a0;
+       </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&#x00a0;</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 proved</a>\
+            </span>\
+           ');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+           document.write('&#x00a0;');
+          } 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&#x00a0;</FONT>\
+           ');
+          }
+         </script>
+        </xsl:otherwise>
+       </xsl:choose>
+       <xsl:apply-templates select="*[position()=3]">
+        <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>
+        &#x00a0;
+       </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('&#x00a0;');
+          } 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&#x00a0;</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>&#x00a0;=</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:text>=&#x00a0;</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>&#x00a0;</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>&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[3]"/>
+       <xsl:text>&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[4]"/>
+       <xsl:text>&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates select="*[position()>2]"/>
+      </xsl:when>
+      <!-- by_induction -->
+      <xsl:when test="$name='by_induction'">
+       <FONT color="red">We prove&#x00a0;</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&#x00a0;</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&#x00a0;</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>)&#x00a0;</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>&#x00a0;</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&#x00a0;</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]"/>
+       )&#x00a0;
+       <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]"/>
+       )&#x00a0;
+       <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&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:text>(</xsl:text>
+       <xsl:value-of select="*[4]/m:bvar/m:ci"/>
+       <xsl:text>)&#x00a0;</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&#x00a0;</FONT>
+       <xsl:text>(</xsl:text>
+       <xsl:value-of select="*[5]/m:bvar/m:ci"/>
+       <xsl:text>)&#x00a0;</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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates select="*[3]"/>
+       <FONT color="red">&#x00a0;by cases:</FONT>
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:call-template>
+       Left:&#x00a0;
+       <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:&#x00a0;
+       <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&#x00a0;</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&#x00a0;</FONT>
+       <xsl:apply-templates mode="inline" select="*[3]"/>
+       :
+       <xsl:apply-templates mode="inline" select="*[4]"/>
+       <FONT color="red">&#x00a0;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>
+     </xsl:choose>
+</xsl:template>
+
+<!-- LAMBDA -->
+
+<xsl:template match="m:lambda">
+<xsl:param name="current_indent" select="0"/>
+    <xsl:variable name="charlength">
+     <xsl:apply-templates select="*[position()=1]" mode="charcount"/>
+     <!-- <xsl:apply-templates select="." mode="charcount"/> -->
+    </xsl:variable>
+    <!-- <xsl:value-of select="$charlength"/> -->
+    <!-- <xsl:value-of select="$current_indent"/> -->
+     <xsl:choose>
+     <xsl:when test="$charlength > $framewidth">
+       <!-- &#x03bb; -->
+       <xsl:call-template name="mksymbol">
+        <xsl:with-param name="symbol" select="$lambda"/>
+        <xsl:with-param name="color" select="'red'"/>
+        <xsl:with-param name="size" select="'+2'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>:</xsl:text>
+       <xsl:apply-templates select="m:bvar/m:type">
+        <xsl:with-param name="current_indent" 
+           select="$current_indent + 4 + 2*string-length(m:bvar/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="*[position()=2]">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:apply-templates mode="inline" select="."/>
+     </xsl:otherwise>
+     </xsl:choose>
+</xsl:template>
+
+<!-- href -->
+<xsl:template match="m:ci">
+ <xsl:choose>
+  <xsl:when test="boolean(@definitionURL)">
+   <a href="{@definitionURL}">
+   <xsl:apply-templates/>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="."/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- CHAR COUNTING -->
+
+<!-- enter this counting mode selecting the root -->
+<xsl:template match="*" mode="root_charcount">
+<xsl:param name="incurrent_length" select="0"/>
+ <xsl:choose>
+  <xsl:when test="count(*)=0">
+   <xsl:value-of select="0"/>
+  </xsl:when>
+  <xsl:when test="name()='m:ci'">
+   <xsl:value-of select="string-length()"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:apply-templates select="*[1]" mode="charcount">
+    <xsl:with-param name="incurrent_length" select="$incurrent_length"/>
+   </xsl:apply-templates>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+       <!-- CASI PARTICOLARI MODE=INLINE -->
+
+<xsl:template mode="inline" match="m:interval">
+       <FONT color="blue">
+       <xsl:text>[</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[1]"/>
+       <xsl:text>, </xsl:text>
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue">
+       <xsl:text>]</xsl:text>
+       </FONT>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:apply[m:in]">
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text> </xsl:text>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$member"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+       <xsl:text> </xsl:text>
+       <xsl:apply-templates select="*[3]"/>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:integers">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$integers"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:naturalnumbers">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$naturalnumbers"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:apply[m:implies]">
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[2]"/>
+       <xsl:text> </xsl:text>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$implies"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+       <xsl:text> </xsl:text>
+       <xsl:apply-templates select="*[3]"/>
+       <xsl:text>)</xsl:text>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:apply[m:exists]">
+               <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$exists"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>:</xsl:text>
+         <xsl:apply-templates select="m:condition/*"/>
+<!-- CSC: old wrong code
+       <xsl:if test="count(m:condition/m:apply/*[3]) > 1">
+               <xsl:text>(</xsl:text>
+       </xsl:if>
+       <xsl:apply-templates select="m:condition/m:apply/*[3]"/>
+       <xsl:if test="count(m:bvar/m:type/m:apply/*[3]) > 1">
+               <xsl:text>)</xsl:text>
+       </xsl:if>
+-->
+       <xsl:text>.</xsl:text>
+       <xsl:apply-templates select="*[position()=4]"/>
+
+
+</xsl:template>
+<!--
+<xsl:template mode="inline" match="m:apply/*[m:ci][position()=1]">
+       <xsl:apply-templates select="*[1]"/>
+       <xsl:text>(</xsl:text>
+       <xsl:for-each select="*[position()>1 and position()!=last()]">
+               <xsl:apply-templates/>
+               <xsl:text>, </xsl:text>
+       </xsl:for-each>
+       <xsl:apply-templates select="*[position()=last()]"/>
+       <xsl:text>)</xsl:text>
+</xsl:template>
+-->
+<!-- CASI PARTICOLARI NON IN LINE -->
+
+<xsl:template match="m:interval">
+       <FONT color="blue">
+       <xsl:text>[</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[1]"/>
+       <xsl:text>, </xsl:text>
+       <xsl:apply-templates select="*[2]"/>
+       <FONT color="blue">
+       <xsl:text>]</xsl:text>
+       </FONT>
+
+
+ <!--<xsl:param name="current_indent" select="0"/>
+        <xsl:variable name="charlength">
+        <xsl:apply-templates select="." mode="charcount"/>
+       </xsl:variable>
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <FONT color="blue">
+       <xsl:text>[</xsl:text>
+       </FONT>
+       <xsl:apply-templates select="*[1]">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:apply-templates>
+       <xsl:text>, </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="*[2]">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:apply-templates>
+       <FONT color="blue">
+       <xsl:text>]</xsl:text>
+       </FONT>
+       </xsl:when>
+       <xsl:otherwise>
+       </xsl:otherwise>
+       </xsl:choose>-->
+</xsl:template>
+
+<xsl:template match="m:apply[m:in]">
+ <xsl:param name="current_indent" select="0"/>
+       <xsl:variable name="charlength">
+        <xsl:apply-templates select="m:in" mode="charcount"/>
+       </xsl:variable>
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <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>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$member"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+       <xsl:text> </xsl:text>
+       <xsl:apply-templates select="*[3]">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+<xsl:template match="m:integers">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$integers"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="m:naturalnumbers">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$naturalnumbers"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="m:apply[m:implies]">
+    <xsl:param name="current_indent" select="0"/>
+       <xsl:variable name="charlength">
+        <xsl:apply-templates select="m:implies" mode="charcount"/>
+       </xsl:variable>
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+                       <xsl:text>implies</xsl:text>
+       <xsl:text>(</xsl:text>
+       <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>
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$implies"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+               </xsl:call-template>
+       <xsl:text> </xsl:text>
+       <xsl:apply-templates select="*[3]">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:apply-templates>
+       <xsl:text>)</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+<xsl:template  match="m:apply[m:exists]">
+  <xsl:param name="current_indent" select="0"/>
+       <xsl:variable name="charlength">
+        <xsl:apply-templates select="m:implies" mode="charcount"/>
+       </xsl:variable>
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <xsl:call-template name="mksymbol">
+               <xsl:with-param name="symbol" select="$exists"/>
+               <xsl:with-param name="color" select="'blue'"/>
+               <xsl:with-param name="size" select="'+0'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="m:bvar/m:ci"/>
+       <xsl:text>:</xsl:text>
+       <!--<xsl:if test="count(m:condition/m:apply/*[3]) > 1">
+               <xsl:text>(</xsl:text>
+       </xsl:if>-->
+       <xsl:apply-templates select="m:condition/m:apply/*[3]">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:apply-templates>
+       <!--<xsl:if test="count(m:bvar/m:type/m:apply/*[3]) > 1">
+               <xsl:text>)</xsl:text>
+       </xsl:if>-->
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+        </xsl:call-template>
+       <xsl:text>.</xsl:text>
+       <xsl:apply-templates select="*[position()=4]">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+<!--
+<xsl:template match="m:apply/m:ci">
+       <xsl:apply-templates/>
+       <xsl:text>(</xsl:text>
+       <xsl:for-each select="*[position()>1 and position()!=last()]">
+               <xsl:apply-templates/>
+               <xsl:text>, </xsl:text>
+       </xsl:for-each>
+       <xsl:apply-templates select="*[position()=last()]"/>
+       <xsl:text>)</xsl:text>
+</xsl:template>
+-->
+<!-- enter this mode selecting the first child --> 
+
+<xsl:template match="m:ci|m:csymbol|m:implies|m:exists|m:interval|m:in" mode="charcount">
+<xsl:param name="incurrent_length" select="0"/> 
+    <xsl:choose>
+    <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
+     <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/></xsl:apply-templates></xsl:variable>
+     <xsl:choose>
+     <xsl:when test="string($siblength) = &quot;&quot;">
+      <xsl:value-of select="$incurrent_length + string-length()"/>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($siblength)"/>
+     </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$incurrent_length + string-length()"/>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template> 
+
+<xsl:template match="*" mode="charcount">
+ <xsl:param name="incurrent_length" select="0"/>
+ <xsl:choose>
+  <xsl:when test="count(child::*) = 0">
+   <xsl:value-of select="$incurrent_length"/>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:variable name="childlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/></xsl:apply-templates></xsl:variable>
+    <xsl:choose>
+     <xsl:when test="$framewidth >= number($childlength)">
+      <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$childlength"/></xsl:apply-templates></xsl:variable>
+      <xsl:choose>
+       <xsl:when test="string($siblength) = &quot;&quot;">
+        <xsl:value-of select="number($childlength)"/>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:value-of select="number($siblength)"/>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($childlength)"/>
+     </xsl:otherwise>
+    </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<!--***********************************************************************-->
+<!-- OBJECTS                                                               -->
+<!--***********************************************************************-->
+
+<!-- Rule -->
+
+<xsl:template match="Rule">
+<xsl:param name="current_indent" select="0"/>
+    
+    <xsl:variable name="char">
+     <xsl:value-of select="m:apply"/>
+    </xsl:variable>
+    <xsl:variable name="length" select="string-length($char)"/>
+    
+<p>
+<xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:call-template>
+<FONT color="red">Rule: </FONT>
+<xsl:choose>
+       <xsl:when test="m:ci">
+               <FONT color="red">
+               <xsl:apply-templates>
+                 <xsl:with-param name="current_indent" select="$current_indent"/>
+               </xsl:apply-templates>
+               </FONT>
+       </xsl:when>
+       <xsl:otherwise>
+               <xsl:choose>
+               <xsl:when test="$length > $framewidth">
+               <br/>
+               <xsl:call-template name="make_indent">
+                <xsl:with-param name="current_indent" select="$current_indent"/> 
+                </xsl:call-template>
+               <xsl:variable name="char_rule">
+                <xsl:value-of select="m:apply/*[1]"/>
+               </xsl:variable>
+               <xsl:variable name="length_rule" select="string-length($char_rule)"/>
+               <FONT>
+                <xsl:apply-templates select="m:apply/*[1]">
+                 <xsl:with-param name="current_indent" select="$current_indent"/>
+                </xsl:apply-templates>
+                <xsl:if test="count(m:apply/*)>2">
+                <br/>
+                <xsl:call-template name="make_indent">
+                 <xsl:with-param name="current_indent" select="$current_indent + $length_rule"/> 
+                 </xsl:call-template>
+                </xsl:if>
+                <FONT color="red">
+                 <xsl:text> ( </xsl:text>
+                </FONT>
+               </FONT>
+               <xsl:for-each select="m:apply/*[position()!=1]">
+               <xsl:if test="position()!=1">
+               <xsl:call-template name="make_indent">
+                <xsl:with-param name="current_indent" select="$current_indent + $length_rule"/> 
+                </xsl:call-template>
+               </xsl:if>
+               <xsl:choose>
+                       <xsl:when test="*[1]='level-exp'">
+                               <xsl:text>level-exp(</xsl:text>
+                               <xsl:apply-templates select="*[2]">
+                                <xsl:with-param name="current_indent" select="$current_indent"/>
+                               </xsl:apply-templates>
+                               <xsl:text>)</xsl:text>
+                       </xsl:when>
+                       <xsl:when test="m:apply">
+                               <xsl:apply-templates select=".">
+                                <xsl:with-param name="current_indent" select="$current_indent"/>
+                               </xsl:apply-templates>
+                       </xsl:when>
+                       <xsl:otherwise>
+                        <xsl:apply-templates>
+                         <xsl:with-param name="current_indent" select="$current_indent"/>
+                        </xsl:apply-templates>
+                       </xsl:otherwise>
+               </xsl:choose>
+               <xsl:if test="position()!=last()">
+                       <xsl:text>, </xsl:text>
+                       <br/>
+               </xsl:if>
+               </xsl:for-each>
+               <FONT color="red">
+               <xsl:text> )</xsl:text>
+               </FONT>
+
+               </xsl:when>
+               <xsl:otherwise>
+               <FONT>
+               <xsl:apply-templates select="m:apply/*[1]">
+                <xsl:with-param name="current_indent" select="$current_indent"/>
+               </xsl:apply-templates>
+
+               <FONT color="red">
+               <xsl:text> ( </xsl:text>
+               </FONT>
+               </FONT>
+               <xsl:for-each select="m:apply/*[position()!=1]">
+               <xsl:choose>
+                       <xsl:when test="*[1]='level-exp'">
+                               <xsl:text>level-exp(</xsl:text>
+                               <xsl:apply-templates select="*[2]">
+                                <xsl:with-param name="current_indent" select="$current_indent"/>
+                               </xsl:apply-templates>
+                                <xsl:text>)</xsl:text>
+                       </xsl:when>
+                       <xsl:when test="m:apply">
+                               <xsl:apply-templates select=".">
+                                <xsl:with-param name="current_indent" select="$current_indent"/>
+                               </xsl:apply-templates>
+
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:apply-templates>
+                                <xsl:with-param name="current_indent" select="$current_indent"/>
+                               </xsl:apply-templates>
+                       </xsl:otherwise>
+               </xsl:choose>
+               <xsl:if test="position()!=last()">
+                       <xsl:text>, </xsl:text>
+               </xsl:if>
+               </xsl:for-each>
+               <FONT color="red">
+               <xsl:text> )</xsl:text>
+               </FONT>
+               </xsl:otherwise>
+               </xsl:choose>
+       </xsl:otherwise>
+</xsl:choose>
+</p>
+</xsl:template>
+
+<!-- Sequent -->
+
+<xsl:template match="Sequent">
+<xsl:param name="current_indent" select="0"/>
+<xsl:call-template name="make_indent">
+ <xsl:with-param name="current_indent" select="$current_indent"/> 
+</xsl:call-template>
+<FONT color="red">Sequent <xsl:value-of select="@id"/></FONT>
+<br/>
+<br/>
+<xsl:for-each select="Decl">
+       <xsl:variable name="num" select="position()"/>
+       <xsl:call-template name="make_indent">
+         <xsl:with-param name="current_indent" select="$current_indent"/> 
+        </xsl:call-template>
+       <xsl:value-of select="$num"/>
+       <xsl:text>) </xsl:text>
+               <xsl:if test="@name">
+                       <FONT color="green">
+                       <xsl:value-of select="@name"/>
+                       <xsl:text>:</xsl:text>
+                       </FONT>
+               </xsl:if>
+               
+               <xsl:apply-templates>
+                <xsl:with-param name="current_indent" select="$current_indent + 10"/>
+               </xsl:apply-templates>
+       <!--<xsl:choose>
+               <xsl:when test="m:apply">
+                       <xsl:apply-templates select=".">
+                        <xsl:with-param name="current_indent" select="$current_indent"/>
+                       </xsl:apply-templates>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates>
+                        <xsl:with-param name="current_indent" select="$current_indent"/>
+                       </xsl:apply-templates>
+               </xsl:otherwise>
+       </xsl:choose>-->
+<br/>
+ </xsl:for-each>
+ <xsl:call-template name="make_indent">
+  <xsl:with-param name="current_indent" select="$current_indent"/> 
+ </xsl:call-template>
+
+ <FONT color="red" size="+1">|- </FONT>
+ <br/>
+ <xsl:call-template name="make_indent">
+  <xsl:with-param name="current_indent" select="$current_indent"/> 
+ </xsl:call-template>
+ <xsl:apply-templates select="Goal/*">
+  <xsl:with-param name="current_indent" select="$current_indent"/>
+ </xsl:apply-templates>
+</xsl:template>
+
+<!-- NODE -->
+
+<xsl:template match="Node">
+ <xsl:param name="current_indent" select="0"/>
+
+       <xsl:variable name="nonce" select="generate-id()"/>
+       <xsl:variable name="freshid2" select="concat('b',$nonce)"/>
+       <xsl:variable name="freshid3" select="concat('c',$nonce)"/>
+       <xsl:variable name="freshid4" select="concat('d',$nonce)"/>
+       <xsl:variable name="freshid5" select="concat('e',$nonce)"/>
+       <br/>
+       <xsl:apply-templates select="Sequent">
+        <xsl:with-param name="current_indent" select="$current_indent"/>
+       </xsl:apply-templates>
+       <xsl:choose>
+        <xsl:when test="Rule">
+         <xsl:apply-templates select="Rule">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:when test="TacticInstance">
+         <br/>
+         <br/>
+        <span>
+         <xsl:call-template name="make_indent">
+           <xsl:with-param name="current_indent" select="$current_indent"/> 
+          </xsl:call-template>
+          <xsl:text>By </xsl:text>
+          <xsl:apply-templates select="TacticInstance/@name"/>
+          <!-- CSC: extra_info in HTML to be rendered here -->
+          <xsl:for-each select="TacticInstance/extra_info">
+           <xsl:copy-of select="*|text()"/>
+          </xsl:for-each>
+          <xsl:if test="$explode_tactics">
+          <span ID="{$freshid4}">
+            <a style="text-decoration:underline ; color:green" href="" onClick="Hide(document.getElementById('{$freshid4}'));Show(document.getElementById('{$freshid5}'));return (0==1);">Details</a>
+           </span>
+          </xsl:if>
+         </span>
+         <xsl:if test="$explode_tactics">
+          <div ID="{$freshid5}">
+          <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="Show(document.getElementById('{$freshid4}'));Hide(document.getElementById('{$freshid5}'));return (0==1);">Hide details</a>
+          <br/>
+          <xsl:apply-templates select="TacticProof">
+                <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+          </xsl:apply-templates>
+          </div>
+         </xsl:if>
+         <br/><br/>
+        </xsl:when>
+       </xsl:choose>
+        <xsl:if test="count(Node)!=0">
+            <xsl:choose> 
+           <xsl:when test="count(Node)=1">
+           <span ID="{$freshid2}">
+            <xsl:call-template name="make_indent">
+              <xsl:with-param name="current_indent" select="$current_indent"/> 
+             </xsl:call-template>
+             <a style="text-decoration:underline ; color:green" href="" onClick="Hide(document.getElementById('{$freshid2}'));Show(document.getElementById('{$freshid3}'));return (0==1);">Subgoal</a>
+            <br/>
+            </span>
+           </xsl:when>
+           <xsl:otherwise>
+           <span ID="{$freshid2}">
+            <xsl:call-template name="make_indent">
+              <xsl:with-param name="current_indent" select="$current_indent"/> 
+             </xsl:call-template>
+             <a style="text-decoration:underline ; color:green" href="" onClick="Hide(document.getElementById('{$freshid2}'));Show(document.getElementById('{$freshid3}'));return (0==1);">Subgoals</a>
+            <br/>
+            </span>
+           </xsl:otherwise>
+           </xsl:choose>
+            <div ID="{$freshid3}">
+            <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="Show(document.getElementById('{$freshid2}'));Hide(document.getElementById('{$freshid3}'));return (0==1);">Back</a>
+            <br/>
+            <xsl:apply-templates select="Node">
+               <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+            </xsl:apply-templates>
+            </div>
+         <script>
+           document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+         </script>
+         </xsl:if>
+</xsl:template>
+
+<!-- DEFINITION -->
+
+<xsl:template match="Definition">
+<xsl:param name="current_indent" select="0"/>
+<p>
+DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)<br/>
+TYPE =<br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+      </xsl:call-template>
+       <xsl:apply-templates select="type/*[1]">
+        <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates><br/>
+BODY =<br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+      </xsl:call-template>
+       <xsl:apply-templates select="body/Node">
+        <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</p>
+</xsl:template>
+
+<!-- AXIOM -->
+
+<xsl:template match="Axiom">
+<xsl:param name="current_indent" select="0"/>
+<p>
+AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)<br/>
+TYPE =<br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 7"/> 
+      </xsl:call-template> 
+<xsl:apply-templates select="type/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</p>
+</xsl:template>
+
+<!-- UNFINISHED PROOF -->
+
+<xsl:template match="CurrentProof">
+<xsl:param name="current_indent" select="0"/>
+<p>
+UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)<br/>
+THESIS:  <xsl:apply-templates select="type/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+         </xsl:apply-templates><br/>
+CONJECTURES: 
+      <xsl:for-each select="Conjecture">
+      <br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 8"/> 
+      </xsl:call-template>
+      <xsl:for-each select="Decl|Def|Hidden">
+       <xsl:choose>
+        <xsl:when test="name(.)='Decl'">
+         <xsl:choose>
+          <xsl:when test="@name">
+           <xsl:value-of select="@name"/>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>_</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> : </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:when test="name(.)='Def'">
+         <xsl:choose>
+          <xsl:when test="@name">
+           <xsl:value-of select="@name"/>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>_</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> := </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:text> _ :? _ </xsl:text>
+        </xsl:otherwise>
+       </xsl:choose>
+      </xsl:for-each>
+      |- <xsl:value-of select="./@no"/> : 
+      <xsl:apply-templates select="./Goal/*[1]">
+       <xsl:with-param name="current_indent" select="$current_indent + 11"/>
+      </xsl:apply-templates>
+      </xsl:for-each> 
+      <br/>
+PROOF:
+      <xsl:apply-templates select="body/*[1]">
+        <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+      </xsl:apply-templates>
+</p>
+</xsl:template>
+
+<!-- MUTUAL INDUCTIVE DEFINITION -->
+
+<xsl:template match="InductiveDefinition">
+<xsl:param name="current_indent" select="0"/>
+<p>
+     <xsl:for-each select="InductiveType">
+         <xsl:choose>
+         <xsl:when test="position() = 1">
+          <xsl:choose>
+          <xsl:when test="string(./@inductive) = &quot;true&quot;">
+          INDUCTIVE DEFINITION 
+          </xsl:when>
+          <xsl:otherwise>
+          COINDUCTIVE DEFINITION 
+          </xsl:otherwise>
+          </xsl:choose>  
+         </xsl:when>
+         <xsl:otherwise>
+          AND 
+         </xsl:otherwise>
+         </xsl:choose>
+         <xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != &quot;&quot;"><xsl:value-of select="../Params"/></xsl:if>)
+         [
+          <xsl:if test="string(../Param) != &quot;&quot;">         
+           <xsl:for-each select="../Param">
+            <xsl:value-of select="./@name"/>
+            :
+            <xsl:apply-templates select="*"/>
+           </xsl:for-each>
+          </xsl:if>
+         ] <br/>
+         OF ARITY 
+         <xsl:apply-templates select="./arity/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 9"/>
+         </xsl:apply-templates> <br/>
+         BUILT FROM:
+      <xsl:for-each select="./Constructor">
+      <br/>
+      <xsl:call-template name="make_indent">
+       <xsl:with-param name="current_indent" select="$current_indent + 3"/> 
+      </xsl:call-template>
+         <xsl:choose>
+         <xsl:when test="position() = 1">
+         <xsl:text>&#x00A0;&#x00A0;</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+         <xsl:text>| </xsl:text>
+         </xsl:otherwise>
+         </xsl:choose>
+         <xsl:value-of select="./@name"/>
+         <xsl:text>: </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
+         </xsl:apply-templates>
+      </xsl:for-each>
+     </xsl:for-each>
+</p>
+</xsl:template>
+
+<!-- VARIABLE -->
+
+<xsl:template match="Variable">
+<xsl:param name="current_indent" select="0"/>
+<p>
+VARIABLE <xsl:value-of select="@name"/><br/>
+TYPE = <xsl:apply-templates select="type/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+<xsl:if test="body">
+<br/>
+BODY = <xsl:apply-templates select="body/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</xsl:if>
+</p>
+</xsl:template>
+
+<!--***********************************************************************-->
+<!-- SECTIONS                                                              -->
+<!--***********************************************************************-->
+
+<!-- SECTION -->
+
+<xsl:template match="SECTION">
+<xsl:param name="current_indent" select="0"/>
+ <h1>BEGIN OF SECTION</h1>
+  <xsl:apply-templates/>
+ <h1>END OF SECTION</h1>
+</xsl:template>
+
+</xsl:stylesheet> 
diff --git a/helm/nuprl_stylesheets/nuprl_expand.xsl b/helm/nuprl_stylesheets/nuprl_expand.xsl
new file mode 100644 (file)
index 0000000..c31b479
--- /dev/null
@@ -0,0 +1,108 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<xsl:key name="sequent" use="m:mtr/m:mtd/m:mrow/m:mtext/text()" match="m:mtable[starts-with(m:mtr/m:mtd/m:mrow/m:mtext/text(),'Sequent (')]"/>
+
+<xsl:template match="/">
+    <xsl:apply-templates select="*"/>
+</xsl:template>
+
+<xsl:template match="m:mi">
+ <xsl:param name="sequentno" select="'/..'"/>
+    <xsl:choose>
+    <xsl:when test="contains(.,'%')">
+    <xsl:variable name="var" select="."/>
+     <m:maction actiontype="toggle">
+      <m:mi mathcolor="green"><xsl:value-of select="."/></m:mi>
+      <m:mrow>
+       <m:mi mathcolor="green"><xsl:value-of select="$var"/>: </m:mi>
+       <xsl:call-template name="look_for_decl">
+        <xsl:with-param name="csequent" select="$sequentno"/>
+        <xsl:with-param name="var" select="$var"/>
+       </xsl:call-template>
+      </m:mrow>
+     </m:maction>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+     </xsl:copy>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="m:mtable[starts-with(m:mtr/m:mtd/m:mrow/m:mtext/text(),'Sequent')]">
+ <xsl:copy>
+  <xsl:variable name="text" select="m:mtr/m:mtd/m:mrow/m:mtext/text()"/>
+  <xsl:variable name="tmp1" select="substring-after($text,'Sequent (')"/>
+  <xsl:variable name="tmp2" select="substring-before($tmp1,')')"/>
+  <xsl:apply-templates select="*|@*|text()">
+   <xsl:with-param name="sequentno" select="$tmp2"/>
+  </xsl:apply-templates>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="*|@*|text()">
+ <xsl:param name="sequentno" select="'/..'"/> 
+ <xsl:copy>
+  <xsl:apply-templates select="*|@*|text()">
+   <xsl:with-param name="sequentno" select="$sequentno"/>
+  </xsl:apply-templates>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template name="look_for_decl">
+   <xsl:param name="csequent" select="/.."/>
+   <xsl:param name="var" select="''"/>
+   <xsl:param name="result" select="0"/>
+   <xsl:choose>
+   <xsl:when test="$csequent=''">
+        <m:mi>
+        ERROR
+       </m:mi>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:variable name="sect_table" select="key('sequent',concat('Sequent (',$csequent,')'))"/>
+    <xsl:variable name="check_res" select="$sect_table/m:mtr/m:mtable/m:mtr/m:mtd/m:mrow/m:mo[text()=$var]/following-sibling::*[2]"/>
+     <xsl:choose>
+     <xsl:when test="not ($check_res)">
+      <xsl:variable name="new_sequent">
+       <xsl:call-template name="truncate">
+        <xsl:with-param name="tail" select="$csequent"/>
+       </xsl:call-template>
+      </xsl:variable>
+      <xsl:call-template name="look_for_decl">
+       <xsl:with-param name="csequent" select="$new_sequent"/>
+       <xsl:with-param name="var" select="$var"/>
+      </xsl:call-template>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:copy-of select="$check_res"/>
+     </xsl:otherwise>
+     </xsl:choose>
+   </xsl:otherwise>
+   </xsl:choose>
+</xsl:template>
+
+<xsl:template name="truncate">
+ <xsl:param name="tail" select="''"/>
+ <xsl:param name="head" select="''"/>
+ <xsl:choose>
+ <xsl:when test="substring-before($tail,' ')=''">
+  <xsl:value-of select="$head"/>
+ </xsl:when>
+ <xsl:otherwise>
+  <xsl:variable name="head1">
+   <xsl:if test="$head !=''">
+    <xsl:value-of select="concat($head,' ')"/>
+   </xsl:if>
+  </xsl:variable>
+  <xsl:call-template name="truncate">
+   <xsl:with-param name="tail" select="substring-after($tail,' ')"/>
+   <xsl:with-param name="head" select="concat($head1,substring-before($tail,' '))"/>
+  </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_html_arith.xsl b/helm/nuprl_stylesheets/nuprl_html_arith.xsl
new file mode 100644 (file)
index 0000000..995a23c
--- /dev/null
@@ -0,0 +1,650 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:i="http://www.cs.unibo.it/helm/InputNotationalElements" xmlns:o="http://www.cs.unibo.it/helm/OutputNotationalElements" version="1.0">
+<!-- HTML SYMBOLS  -->
+<!--leq-->
+  <xsl:variable name="leq">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xA3;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2264;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--lt-->
+  <xsl:variable name="lt">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&lt;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&lt; </xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--geq-->
+  <xsl:variable name="geq">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xB3;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2265;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--gt-->
+  <xsl:variable name="gt">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&gt;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&gt;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--plus-->
+  <xsl:variable name="plus">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">+</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">+</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--minus-->
+  <xsl:variable name="minus">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">-</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">-</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--times-->
+  <xsl:variable name="times">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">*</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2217;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--min-->
+  <xsl:variable name="min" select="'min'"/>
+<!--abs-->
+  <xsl:variable name="abs" select="'|'"/>
+<!-- LESS EQUAL -->
+  <xsl:template match="m:apply[m:leq[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:leq/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($leq)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$leq"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>leq</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- LESS EQUAL (INLINE MODE) -->
+  <xsl:template match="m:apply[m:leq[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:leq/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($leq)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$leq"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>leq</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- LESS EQUAL (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:leq[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- LESS THAN -->
+  <xsl:template match="m:apply[m:lt[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:lt/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($lt)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$lt"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>lt</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- LESS THAN (INLINE MODE) -->
+  <xsl:template match="m:apply[m:lt[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:lt/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($lt)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$lt"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>lt</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- LESS THAN (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:lt[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- GREATER EQUAL -->
+  <xsl:template match="m:apply[m:geq[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:geq/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($geq)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$geq"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>geq</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- GREATER EQUAL (INLINE MODE) -->
+  <xsl:template match="m:apply[m:geq[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:geq/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($geq)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$geq"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>geq</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- GREATER EQUAL (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:geq[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- GREATER THAN -->
+  <xsl:template match="m:apply[m:gt[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:gt/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($gt)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$gt"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>gt</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- GREATER THAN (INLINE MODE) -->
+  <xsl:template match="m:apply[m:gt[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:gt/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($gt)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$gt"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>gt</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- GREATER THAN (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:gt[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- PLUS -->
+  <xsl:template match="m:apply[m:plus[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:plus/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($plus)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$plus"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>plus</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- PLUS (INLINE MODE) -->
+  <xsl:template match="m:apply[m:plus[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:plus/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($plus)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$plus"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>plus</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- PLUS (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:plus[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- MINUS -->
+  <xsl:template match="m:apply[m:minus[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:minus/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($minus)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$minus"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>minus</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- MINUS (INLINE MODE) -->
+  <xsl:template match="m:apply[m:minus[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:minus/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($minus)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$minus"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>minus</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- MINUS (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:minus[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- TIMES -->
+  <xsl:template match="m:apply[m:times[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:times/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($times)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$times"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>times</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- TIMES (INLINE MODE) -->
+  <xsl:template match="m:apply[m:times[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:times/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($times)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$times"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>times</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- TIMES (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:times[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- MIN -->
+  <xsl:template match="m:apply[m:min[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <a href="{m:min/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($min)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$min"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>min</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:text>{</xsl:text>
+        <xsl:apply-templates select="*[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:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>}</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- MIN (INLINE MODE) -->
+  <xsl:template match="m:apply[m:min[count(*) = 0] and count(*) = 3]" mode="inline">
+    <a href="{m:min/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($min)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$min"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>min</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:text>{</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <xsl:text>,</xsl:text>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>}</xsl:text>
+  </xsl:template>
+<!-- MIN (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:min[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 4"/>
+  </xsl:template>
+<!-- MINUS -->
+  <xsl:template match="m:apply[m:minus[count(*) = 0] and count(*) = 2]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <a href="{m:minus/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($minus)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$minus"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>minus</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[2]">
+      <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+    </xsl:apply-templates>
+  </xsl:template>
+<!-- MINUS (INLINE MODE) -->
+  <xsl:template match="m:apply[m:minus[count(*) = 0] and count(*) = 2]" mode="inline">
+    <a href="{m:minus/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($minus)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$minus"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>minus</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+  </xsl:template>
+<!-- MINUS (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:minus[count(*) = 0] and count(*) = 2]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 1"/>
+  </xsl:template>
+<!-- ABSOLUTE VALUE -->
+  <xsl:template match="m:apply[m:abs[count(*) = 0] and count(*) = 2]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <a href="{m:abs/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($abs)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$abs"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>abs</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[2]">
+      <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+    </xsl:apply-templates>
+    <a href="{m:abs/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($abs)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$abs"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>abs</xsl:otherwise>
+      </xsl:choose>
+    </a>
+  </xsl:template>
+<!-- ABSOLUTE VALUE (INLINE MODE) -->
+  <xsl:template match="m:apply[m:abs[count(*) = 0] and count(*) = 2]" mode="inline">
+    <a href="{m:abs/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($abs)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$abs"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>abs</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:abs/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($abs)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$abs"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>abs</xsl:otherwise>
+      </xsl:choose>
+    </a>
+  </xsl:template>
+<!-- ABSOLUTE VALUE (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:abs[count(*) = 0] and count(*) = 2]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 2"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_html_basic.xsl b/helm/nuprl_stylesheets/nuprl_html_basic.xsl
new file mode 100644 (file)
index 0000000..dfe3a01
--- /dev/null
@@ -0,0 +1,532 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:i="http://www.cs.unibo.it/helm/InputNotationalElements" xmlns:o="http://www.cs.unibo.it/helm/OutputNotationalElements" version="1.0">
+<!-- HTML SYMBOLS  -->
+<!--and-->
+  <xsl:variable name="and">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xD9;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2227;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--or-->
+  <xsl:variable name="or">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xDA;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2228;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--iff-->
+  <xsl:variable name="iff">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xDB;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x21D4;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--not-->
+  <xsl:variable name="not">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xD8;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#xAC;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--eq-->
+  <xsl:variable name="eq">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">=</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">=</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--neq-->
+  <xsl:variable name="neq">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">&#xB9;</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2260;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!--exists-->
+  <xsl:variable name="exists">
+    <xsl:choose>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'symbol'">$</xsl:when>
+      <xsl:when test="$PIPPOUNICODEvsSYMBOL = 'unicode'">&#x2203;</xsl:when>
+      <xsl:otherwise>???</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+<!-- AND -->
+  <xsl:template match="m:apply[m:and[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:and/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($and)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$and"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>and</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- AND (INLINE MODE) -->
+  <xsl:template match="m:apply[m:and[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:and/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($and)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$and"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>and</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- AND (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:and[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- OR -->
+  <xsl:template match="m:apply[m:or[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:or/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($or)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$or"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>or</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- OR (INLINE MODE) -->
+  <xsl:template match="m:apply[m:or[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:or/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($or)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$or"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>or</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- OR (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:or[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- IFF -->
+  <xsl:template match="m:apply[m:csymbol[text() = 'iff' and count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:csymbol/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($iff)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$iff"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>iff</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- IFF (INLINE MODE) -->
+  <xsl:template match="m:apply[m:csymbol[text() = 'iff' and count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:csymbol/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($iff)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$iff"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>iff</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- IFF (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:csymbol[text() = 'iff' and count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- NOT -->
+  <xsl:template match="m:apply[m:not[count(*) = 0] and count(*) = 2]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <a href="{m:not/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($not)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$not"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>not</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[2]">
+      <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+    </xsl:apply-templates>
+  </xsl:template>
+<!-- NOT (INLINE MODE) -->
+  <xsl:template match="m:apply[m:not[count(*) = 0] and count(*) = 2]" mode="inline">
+    <a href="{m:not/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($not)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$not"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>not</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+  </xsl:template>
+<!-- NOT (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:not[count(*) = 0] and count(*) = 2]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 1"/>
+  </xsl:template>
+<!-- EQUALITY and TYPE EQUALITY -->
+  <xsl:template match="m:apply[m:eq[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:eq/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($eq)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$eq"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>eq</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- EQUALITY and TYPE EQUALITY (INLINE MODE) -->
+  <xsl:template match="m:apply[m:eq[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:eq/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($eq)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$eq"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>eq</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- EQUALITY and TYPE EQUALITY (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:eq[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- NOT-EQ and NOT-EQT -->
+  <xsl:template match="m:apply[m:neq[count(*) = 0] and count(*) = 3]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>(</xsl:text>
+        <xsl:apply-templates select="*[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>
+        <a href="{m:neq/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($neq)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$neq"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>neq</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:apply-templates select="*[3]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+        <xsl:text>)</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- NOT-EQ and NOT-EQT (INLINE MODE) -->
+  <xsl:template match="m:apply[m:neq[count(*) = 0] and count(*) = 3]" mode="inline">
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="*[2]" mode="inline"/>
+    <a href="{m:neq/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($neq)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$neq"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>neq</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:apply-templates select="*[3]" mode="inline"/>
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+<!-- NOT-EQ and NOT-EQT (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:neq[count(*) = 0] and count(*) = 3]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- EXIST -->
+  <xsl:template match="m:apply[m:exists[count(*) = 0] and m:bvar/m:ci[count(*) = 0] and m:condition[count(*) = 1] and count(*) = 4]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <a href="{m:exists/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($exists)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$exists"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>exists</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:value-of select="m:bvar/m:ci/text()"/>
+        <xsl:text>:</xsl:text>
+        <xsl:apply-templates select="m:condition/*[1]">
+          <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="*[4]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- EXIST (INLINE MODE) -->
+  <xsl:template match="m:apply[m:exists[count(*) = 0] and m:bvar/m:ci[count(*) = 0] and m:condition[count(*) = 1] and count(*) = 4]" mode="inline">
+    <a href="{m:exists/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($exists)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$exists"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>exists</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:value-of select="m:bvar/m:ci/text()"/>
+    <xsl:text>:</xsl:text>
+    <xsl:apply-templates select="m:condition/*[1]" mode="inline"/>
+    <xsl:text>.</xsl:text>
+    <xsl:apply-templates select="*[4]" mode="inline"/>
+  </xsl:template>
+<!-- EXIST (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:exists[count(*) = 0] and m:bvar/m:ci[count(*) = 0] and m:condition[count(*) = 1] and count(*) = 4]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+<!-- EXIST -->
+  <xsl:template match="m:apply[m:exists[count(*) = 0] and m:bvar/m:ci[count(*) = 0] and m:condition[count(*) = 1] and count(*) = 4]">
+    <xsl:param name="current_indent" select="0"/>
+    <xsl:param name="width" select="$framewidth"/>
+    <xsl:variable name="charlength">
+      <xsl:apply-templates select="." mode="root_charcount"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$width &gt;= $charlength">
+        <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <a href="{m:exists/@definitionURL}">
+          <xsl:choose>
+            <xsl:when test="boolean($exists)">
+              <xsl:call-template name="mksymbol">
+                <xsl:with-param name="symbol" select="$exists"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>exists</xsl:otherwise>
+          </xsl:choose>
+        </a>
+        <xsl:value-of select="m:bvar/m:ci/text()"/>
+        <xsl:text>:</xsl:text>
+        <xsl:apply-templates select="m:condition/*[1]">
+          <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="*[4]">
+          <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+<!-- EXIST (INLINE MODE) -->
+  <xsl:template match="m:apply[m:exists[count(*) = 0] and m:bvar/m:ci[count(*) = 0] and m:condition[count(*) = 1] and count(*) = 4]" mode="inline">
+    <a href="{m:exists/@definitionURL}">
+      <xsl:choose>
+        <xsl:when test="boolean($exists)">
+          <xsl:call-template name="mksymbol">
+            <xsl:with-param name="symbol" select="$exists"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>exists</xsl:otherwise>
+      </xsl:choose>
+    </a>
+    <xsl:value-of select="m:bvar/m:ci/text()"/>
+    <xsl:text>:</xsl:text>
+    <xsl:apply-templates select="m:condition/*[1]" mode="inline"/>
+    <xsl:text>.</xsl:text>
+    <xsl:apply-templates select="*[4]" mode="inline"/>
+  </xsl:template>
+<!-- EXIST (CHARCOUNT MODE) -->
+  <xsl:template match="m:apply[m:exists[count(*) = 0] and m:bvar/m:ci[count(*) = 0] and m:condition[count(*) = 1] and count(*) = 4]" mode="root_charcount">
+    <xsl:param name="incurrent_length" select="0"/>
+    <xsl:value-of select="$incurrent_length + 3"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_link.xsl b/helm/nuprl_stylesheets/nuprl_link.xsl
new file mode 100644 (file)
index 0000000..849e06c
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:helm="http://www.cs.unibo.it/helm"
+                              xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<!--***********************************************************************--> 
+<!-- From MathML presentation or HTML to themselves with links             -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
+<!-- First draft: March 16 2001, Irene Schena                              -->
+<!--***********************************************************************--> 
+
+<xsl:import href="nuprl_links_library.xsl"/>
+
+<xsl:key name="id" use="@id" match="m:*"/>
+
+<xsl:param name="URLs_or_URIs" select="'URLs'"/>
+
+<xsl:template match = "m:semantics">
+   <xsl:apply-templates select="*[1]" mode="semantics"/>
+</xsl:template>
+
+<!-- Discharging content markup mantaining the linking info (helm:xref and 
+xlink:href) -->
+<xsl:template match = "*" mode="semantics">
+  <xsl:copy>
+   <xsl:copy-of select="@*"/>
+   <xsl:if test="@xref">
+    <xsl:variable name="cnode" select="key('id',@xref)"/>
+    <xsl:if test="$cnode/@definitionURL"> 
+     <xsl:attribute name="xlink:href">
+      <xsl:choose>
+       <xsl:when test="$URLs_or_URIs = 'URLs'">
+        <xsl:call-template name="makeURL"><xsl:with-param name="uri" select="$cnode/@definitionURL"/></xsl:call-template>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:value-of select="$cnode/@definitionURL"/> 
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:attribute>
+    <!-- xlink:show='other' requires the exact modality to be -->
+    <!-- specified in non-xlink markup. The point is that the -->
+    <!-- element is already MathML ==> we can't add other     -->
+    <!-- markup without introducing another new namespace.    -->
+    <!-- So, for now no markup is used.                       -->
+     <xsl:attribute name="xlink:show">other</xsl:attribute>
+    </xsl:if>
+    <xsl:if test="$cnode/@helm:xref">
+     <xsl:attribute name="helm:xref">
+      <xsl:value-of select="$cnode/@helm:xref"/>
+     </xsl:attribute>
+    </xsl:if> 
+   </xsl:if>
+   <xsl:apply-templates mode="semantics"/>
+  </xsl:copy>
+</xsl:template>
+
+<!-- _top to refresh the whole frameset (avoids the matrioska effect ;-) -->
+<!-- a[@href] doesn't match with every anchor elements!!!                -->
+<xsl:template match="*[@href]">
+   <xsl:copy>
+    <xsl:copy-of select="@*"/> 
+    <xsl:choose>
+    <xsl:when test="starts-with(@href,&quot;nuprl:&quot;)">
+     <xsl:attribute name="href">
+      <xsl:call-template name="makeURL">
+       <xsl:with-param name="uri" select="@href"/>
+      </xsl:call-template>
+     </xsl:attribute>
+     <xsl:attribute name="target">cic</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="starts-with(@href,&quot;theory:&quot;)">
+     <xsl:attribute name="href">
+      <xsl:call-template name="makeTheoryURL">
+       <xsl:with-param name="uri" select="@href"/>
+      </xsl:call-template>
+     </xsl:attribute>
+     <xsl:attribute name="target">theory</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="starts-with(@href,&quot;#&quot;)">
+     <xsl:attribute name="href"><xsl:value-of  select="@href"/></xsl:attribute>
+     <xsl:if test="@target">
+      <xsl:attribute name="target"><xsl:value-of select="@target"/></xsl:attribute>
+     </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:attribute name="href"><xsl:value-of  select="@href"/></xsl:attribute>
+     <xsl:attribute name="target">_blank</xsl:attribute>
+    </xsl:otherwise>
+    </xsl:choose>
+    <xsl:apply-templates/>
+   </xsl:copy>
+</xsl:template>
+
+<xsl:template match = "/|*">
+  <xsl:copy>
+   <xsl:copy-of select="@*"/>
+   <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> 
diff --git a/helm/nuprl_stylesheets/nuprl_links_library.xsl b/helm/nuprl_stylesheets/nuprl_links_library.xsl
new file mode 100644 (file)
index 0000000..d023d77
--- /dev/null
@@ -0,0 +1,369 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+<!--***********************************************************************--> 
+<!-- auxiliary functions                                                   -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
+<!--***********************************************************************--> 
+
+<!--      * is used for objects                      -->
+<!--    th* is used for theories                     -->
+<!-- embed* is used for objects embedded in theories -->
+
+<xsl:param name="getterURL" select="'http://localhost:8081/'"/>
+<xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
+<xsl:param name="draw_graphURL" select="'http://localhost:8083/'"/>
+<xsl:param name="uri_set_queueURL" select="'http://localhost:8084/'"/>
+<xsl:param name="proofcheckerURL" select="'http://localhost:48084/'"/>
+<!-- URL to the frameset (control + output) -->
+<xsl:param name="topurl" select="''"/>
+<xsl:param name="interfaceURL" select="''"/>
+<xsl:param name="thinterfaceURL" select="''"/>
+
+<xsl:param name="keys" select="'C1,HC2,L'"/>
+<xsl:param name="embedkeys" select="'TC1,HC2,L'"/>
+<xsl:param name="thkeys" select="'T1,T2,L,E'"/>
+
+<xsl:param name="naturalLanguage" select="'yes'"/>
+<xsl:param name="annotations" select="'no'"/>
+<xsl:param name="UNICODEvsSYMBOL" select="'symbol'"/>
+
+<xsl:param name="media-type" select="'text/html'"/>
+<xsl:param name="thmedia-type" select="'text/html'"/>
+<xsl:param name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
+<xsl:param name="encoding" select="'iso-8859-1'"/>
+<xsl:param name="thencoding" select="'iso-8859-1'"/>
+
+
+<xsl:template name="quote">
+ <xsl:param name="s" select="''"/>
+ <xsl:param name="news" select="''"/>
+ <xsl:choose>
+  <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
+  <xsl:otherwise>
+   <xsl:variable name="char" select="substring($s,1,1)"/>
+   <xsl:choose>
+    <xsl:when test="$char = ' '">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%20')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '&amp;'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%26')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '?'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%3F')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '='">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%3D')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '%'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%25')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = ','">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%2C')"/>
+     </xsl:call-template>
+    </xsl:when>
+<!--CSC: This breaks all the rest ;-)
+    <xsl:when test="$char = ':'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%3A')"/>
+     </xsl:call-template>
+    </xsl:when>
+-->
+    <xsl:otherwise>
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,$char)"/>
+     </xsl:call-template>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:variable name="absPath">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-doctype-public">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$doctype-public"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-processorURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$processorURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-getterURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$getterURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-interfaceURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$interfaceURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-topurl">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$topurl"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-thinterfaceURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$thinterfaceURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedthkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$thkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedembedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$embedkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$keys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedquotedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$quotedkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedquotedthkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$quotedthkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedquotedembedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$quotedembedkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
+<xsl:variable name="thheader0"><xsl:value-of select="$thinterfaceURL"/>?url=</xsl:variable>
+<xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
+<xsl:variable name="bothheader2">&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.proofcheckerURL=<xsl:value-of select="$proofcheckerURL"/>&#x26;param.draw_graphURL=<xsl:value-of select="$draw_graphURL"/>&#x26;param.uri_set_queueURL=<xsl:value-of select="$uri_set_queueURL"/>&#x26;param.UNICODEvsSYMBOL=<xsl:value-of select="$UNICODEvsSYMBOL"/>&#x26;param.annotations=<xsl:value-of select="$annotations"/>&#x26;prop.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.encoding=<xsl:value-of select="$encoding"/>&#x26;param.media-type=<xsl:value-of select="$media-type"/>&#x26;param.keys=<xsl:value-of select="$quotedkeys"/>&#x26;param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$escaped-processorURL"/>&#x26;param.interfaceURL=<xsl:value-of select="$escaped-interfaceURL"/>&#x26;param.topurl=<xsl:value-of select="$escaped-topurl"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
+<xsl:variable name="header2">&#x26;prop.media-type=<xsl:value-of select="$media-type"/>&#x26;prop.encoding=<xsl:value-of select="$encoding"/></xsl:variable>
+<xsl:variable name="thheader2">&#x26;prop.media-type=<xsl:value-of select="$thmedia-type"/>&#x26;param.thmedia-type=<xsl:value-of select="$thmedia-type"/>&#x26;param.thkeys=<xsl:value-of select="$quotedthkeys"/>&#x26;param.embedkeys=<xsl:value-of select="$quotedembedkeys"/>&#x26;param.thinterfaceURL=<xsl:value-of select="$escaped-thinterfaceURL"/>&#x26;param.thencoding=<xsl:value-of select="$thencoding"/>&#x26;prop.encoding=<xsl:value-of select="$thencoding"/></xsl:variable>
+
+<xsl:variable name="quotedheader1">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$header1"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedbothheader2">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$bothheader2"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedheader2">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$header2"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedthheader2">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$thheader2"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<!-- makeURL() maps URIs into URLs               -->
+<!-- The target of the URL is the whole frameset -->
+
+<xsl:variable name="biquotedfixedheader">
+ <xsl:value-of select="$header0"/>
+ <xsl:value-of select="$quotedheader1"/>
+ <xsl:value-of select="$quotedquotedkeys"/>
+ <xsl:value-of select="$quotedheader2"/>
+ <xsl:value-of select="$quotedbothheader2"/>
+</xsl:variable>
+
+<xsl:variable name="biquotedthfixedheader">
+ <xsl:value-of select="$thheader0"/>
+ <xsl:value-of select="$quotedheader1"/>
+ <xsl:value-of select="$quotedquotedthkeys"/>
+ <xsl:value-of select="$quotedthheader2"/>
+ <xsl:value-of select="$quotedbothheader2"/>
+</xsl:variable>
+
+<!-- NOTE: embedkeys and thkeys are propagated, but we are sure that -->
+<!-- they won't never be used.                                       -->
+<!--CSC: fixare il punto sopra!!! -->
+<!-- type, instead, is not propagated                                -->
+<xsl:template name="makeURL">
+<xsl:param name="uri" select="''"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+  <!-- CIC CODE removed -->
+  <!-- NuPRL CODE -->
+     <xsl:text>http://mowgli.cs.unibo.it:58080/apply?keys=NT,NC2,NL&amp;prop.doctype-public=&amp;prop.media-type=text/html&amp;param.doctype-public=&amp;param.encoding=&amp;param.media-type=text/html&amp;param.CICURI=cic:/CICURI.con&amp;param.naturalLanguage=yes&amp;param.annotations=no&amp;param.topurl=http://helm.cs.unibo.it/helm&amp;param.UNICODEvsSYMBOL=SYMBOL&amp;xmluri=</xsl:text>
+     <xsl:call-template name="quote">
+      <!-- The hard-coded getterURL -->
+      <xsl:with-param name="s" select="'http://mowgli.cs.unibo.it:58081/getxml?uri='"/>
+     </xsl:call-template>
+     <xsl:value-of select="$cleanuri"/>
+     <xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+<xsl:template name="makeTheoryURL">
+<xsl:param name="uri" select="''"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+     <xsl:value-of select="$biquotedthfixedheader"/>
+     <xsl:value-of select="$cleanuri"/>%26param.CICURI%3D<xsl:value-of select="$cleanuri"/>
+     <xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+<!-- makeURL4embedding() maps URIs into URLs              -->
+<!-- The target of the URL is only the processed document -->
+
+<xsl:template name="makeURL4embedding">
+<xsl:param name="uri" select="''"/>
+<xsl:param name="type" select="'standalone'"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$header1"/>
+ <xsl:value-of select="$quotedembedkeys"/>
+ <xsl:value-of select="$header2"/>
+ <xsl:value-of select="$bothheader2"/>
+ <xsl:value-of select="$cleanuri"/>&#x26;param.CICURI=<xsl:value-of select="$cleanuri"/>&#x26;param.type=<xsl:value-of select="$type"/><xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+<!-- makeURL4InnerTypes() maps URIs into URLs              -->
+<!-- The target of the URL is only the processed document -->
+
+<xsl:template name="makeURL4InnerTypes">
+<xsl:param name="uri" select="''"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$header1"/>d_c&#x26;param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&#x26;param.CICURI=<xsl:value-of select="$cleanuri"/>&#x26;xmluri=<xsl:value-of select="$absPath"/><xsl:value-of select="$cleanuri"/>
+ <xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+</xsl:stylesheet> 
diff --git a/helm/nuprl_stylesheets/nuprl_mmlextension.xsl b/helm/nuprl_stylesheets/nuprl_mmlextension.xsl
new file mode 100644 (file)
index 0000000..0285792
--- /dev/null
@@ -0,0 +1,3034 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<!--***********************************************************************--> 
+<!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
+<!-- First draft: February 19 2000, Andrea Asperti, Irene Schena           -->
+<!-- Revised: March 3 2000, Irene Schena                                   -->
+<!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena          -->
+<!-- Revised: March 21 2000, Irene Schena                                  -->
+<!--***********************************************************************--> 
+
+<!-- NOTE: the namespace declaration has to be done in the stylesheets 
+which generates the toplevel element (see for instance xlink) -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:helm="http://www.cs.unibo.it/helm"
+                              xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<!-- OLD: <xsl:import href="mml2mmlv1_0.xsl"/> -->
+
+<xsl:import href="mmlnotation.xsl"/>
+
+<xsl:import href="mmltheoryextension.xsl"/>
+
+<xsl:key name="sequent_number" use="@id" match="Sequent"/>
+
+<xsl:param name="explodeall" select="false()"/>
+
+<!--***********************************************************************-->
+<!-- Parameter affecting line-breaking                                     -->
+<!--***********************************************************************-->
+
+<xsl:variable name="framewidth" select="35"/> 
+
+<!--***********************************************************************-->
+<!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
+<!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti  -->
+<!-- sono i termini: la presentation per un termine e' generata come primo -->
+<!-- figlio di un semantics e l'originario content viene inserito nel      -->
+<!-- nel secondo figlio di semantics, annotation-xml                       -->
+<!--***********************************************************************-->
+
+<!--**********************-->
+<!--        OBJECTS       -->
+<!--**********************-->
+
+
+<!--<xsl:key name="variable" use="@name" match="Decl"/> -->
+
+<xsl:param name="type" select="'standalone'"/>
+
+<xsl:template match="/">
+ <xsl:choose>
+  <xsl:when test="$type = 'standalone'">
+   <xsl:apply-templates select="*"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <to_be_embedded>
+    <xsl:apply-templates select="*"/>
+   </to_be_embedded>
+  </xsl:otherwise> 
+ </xsl:choose>
+</xsl:template>
+
+
+<!-- NODE -->
+
+ <xsl:template match="Node">
+     <xsl:choose>
+      <xsl:when test="count(Node)=0">    <!-- E' una foglia -->
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left" stretchy="false">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="red">Sequent <xsl:apply-templates select="Sequent/@id"/>
+          </m:mtext>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       <m:mtr>
+        <xsl:if test="*[Decl]">
+         <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+          <xsl:for-each select="Sequent/Decl">
+           <m:mtr columnalign="left">
+            <m:mtd columnalign="left">
+             <m:mrow>
+             <xsl:variable name="num" select="position()"/>
+             <m:mtext>
+              <xsl:value-of select="$num"/>)
+             </m:mtext>
+              <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+             <xsl:if test="@name">
+              <m:mo mathcolor="green"><xsl:value-of select="@name"/></m:mo>
+              <m:mo mathcolor="green" stretchy="false">:</m:mo>
+             </xsl:if>
+              <xsl:apply-templates select="."/>
+            </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </xsl:for-each>
+         </m:mtable>
+        </xsl:if>
+       </m:mtr>
+        <m:mtr>
+         <m:mrow>
+          <m:mtext mathcolor="red" mathvariant="bold">|-</m:mtext>
+         </m:mrow>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+         <xsl:apply-templates select="Sequent/Goal"/>
+         </m:mtd>
+        </m:mtr>
+       <m:mtr>
+        <m:mtd>
+         <m:mrow>
+          <m:mo mathcolor="red">Rule: </m:mo>
+          <xsl:choose>
+          <xsl:when test="Rule[m:apply]">
+           <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:apply/m:ci"/></m:mo>
+          </xsl:when>
+          <xsl:when test="count(Rule)=0">
+           <m:mi>NESSUNA REGOLA</m:mi>
+          </xsl:when>
+          <xsl:otherwise>
+           <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:ci"/></m:mo>
+          </xsl:otherwise>
+          </xsl:choose>
+         </m:mrow>
+        </m:mtd>
+        </m:mtr>
+       <m:mspace height="1ex"/>
+       </m:mtable>
+      </xsl:when>
+     
+     <xsl:otherwise>   <!--E' un nodo -->
+     <m:mtable equalrows="false" columnalign="left">
+      <m:mtr>
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left" stretchy="false">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="red">Sequent <xsl:apply-templates select="Sequent/@id"/>
+          </m:mtext>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       <m:mtr>
+        <xsl:if test="*[Decl]">
+         <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+          <xsl:for-each select="Sequent/Decl">
+           <m:mtr columnalign="left">
+            <m:mtd columnalign="left">
+             <m:mrow>
+             <xsl:variable name="num" select="position()"/>
+             <m:mtext>
+              <xsl:value-of select="$num"/>)
+             </m:mtext>
+              <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+             <xsl:if test="@name">
+              <m:mo mathcolor="green"><xsl:value-of select="@name"/></m:mo>
+              <m:mo mathcolor="green" stretchy="false">:</m:mo>
+             </xsl:if>
+              <xsl:apply-templates select="."/>
+            </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </xsl:for-each>
+         </m:mtable>
+        </xsl:if>
+       </m:mtr>
+        <m:mtr>
+         <m:mrow>
+          <m:mtext mathcolor="red" mathvariant="bold">|-</m:mtext>
+         </m:mrow>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+         <xsl:apply-templates select="Sequent/Goal"/>
+         </m:mtd>
+        </m:mtr>
+       <m:mtr>
+        <m:mtd>
+         <m:mrow>
+          <m:mo mathcolor="red">Rule: </m:mo>
+          <xsl:choose>
+          <xsl:when test="Rule[m:apply]">
+           <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:apply/m:ci"/></m:mo>
+          </xsl:when>
+          <xsl:when test="count(Rule)=0">
+           <m:mi>NESSUNA REGOLA</m:mi>
+          </xsl:when>
+          <xsl:otherwise>
+           <m:mo mathcolor="brown"><xsl:value-of select="Rule/m:ci"/></m:mo>
+          </xsl:otherwise>
+          </xsl:choose>
+         </m:mrow>
+        </m:mtd>
+        </m:mtr>
+       </m:mtable>
+      </m:mtr>
+      <m:mtr>
+       <m:maction>
+        <xsl:choose>
+       <xsl:when test="count(Node)=1">
+         <m:mi mathcolor="blue" mathvariant="script">Subgoal</m:mi>
+       </xsl:when>
+       <xsl:otherwise>
+         <m:mi mathcolor="blue" mathvariant="script">Subgoals</m:mi>
+       </xsl:otherwise>
+       </xsl:choose>
+        <m:mrow>
+        <m:mspace width="1em"/>
+         <m:mtable equalrows="false" columnalign="left">
+         <xsl:for-each select="Node">
+          <m:mtr>
+           <xsl:apply-templates select="."/>
+          </m:mtr>
+          <m:mspace height="1ex"/>
+         </xsl:for-each>
+        </m:mtable>
+       </m:mrow>
+       </m:maction>
+      </m:mtr>
+     </m:mtable>
+     </xsl:otherwise>
+     </xsl:choose>
+</xsl:template>
+
+
+<!-- DEFINITION -->
+
+<xsl:template match="Definition">
+    <m:math>
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="type/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>AS</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="body/Node"/>   <!-- body/*[1]"/>-->
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+     </m:mtable>
+    </m:math>
+</xsl:template>
+
+<!-- AXIOM -->
+
+<xsl:template match="Axiom">
+    <m:math>
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="type/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+     </m:mtable>
+    </m:math>
+</xsl:template>
+
+<!-- UNFINISHED PROOF -->
+
+<xsl:template match="CurrentProof">
+    <m:math>
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != &quot;&quot;"><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>THESIS:</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="type/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>CONJECTURES:</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <xsl:for-each select="Conjecture">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow helm:xref="{@helm:xref}">
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:for-each select="Decl|Def|Hidden">
+          <xsl:choose>
+           <xsl:when test="name(.)='Decl'">
+            <m:mrow helm:xref="{@helm:xref}">
+             <xsl:choose>
+              <xsl:when test="@name">
+               <m:mi><xsl:value-of select="@name"/></m:mi>
+              </xsl:when>
+              <xsl:otherwise>
+               <m:mi>_</m:mi>
+              </xsl:otherwise>
+             </xsl:choose>
+             <m:mo>:</m:mo>
+             <xsl:apply-templates select="./*[1]"/>
+            </m:mrow>
+           </xsl:when>
+           <xsl:when test="name(.)='Def'">
+            <m:mrow helm:xref="{@helm:xref}">
+             <xsl:choose>
+              <xsl:when test="@name">
+               <m:mi><xsl:value-of select="@name"/></m:mi>
+              </xsl:when>
+              <xsl:otherwise>
+               <m:mi>_</m:mi>
+              </xsl:otherwise>
+             </xsl:choose>
+             <m:mo>:=</m:mo>
+             <xsl:apply-templates select="./*[1]"/>
+            </m:mrow>
+           </xsl:when>
+           <xsl:otherwise>
+            <m:mrow helm:xref="{@helm:xref}">
+             <m:mi>_</m:mi>
+             <m:mo>:?</m:mo>
+             <m:mi>_</m:mi>
+            </m:mrow>
+           </xsl:otherwise>
+          </xsl:choose>
+          <xsl:if test="not (position() = last())">
+           <m:mo>;</m:mo>
+          </xsl:if>
+         </xsl:for-each>
+         <m:mo>|-</m:mo>
+         <m:msub><m:mi>?</m:mi><m:mn><xsl:value-of select="@no"/></m:mn></m:msub>
+         <m:mo>:</m:mo>
+         <xsl:apply-templates select="./Goal/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      </xsl:for-each>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>PROOF:</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="body/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+     </m:mtable>
+    </m:math>
+</xsl:template>
+
+<!-- MUTUAL INDUCTIVE DEFINITION -->
+
+<xsl:template match="InductiveDefinition">
+    <m:math>
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
+     <xsl:for-each select="InductiveType">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <xsl:choose>
+         <xsl:when test="position() = 1">
+          <xsl:choose>
+          <xsl:when test="string(./@inductive) = &quot;true&quot;">
+           <m:mtext>INDUCTIVE DEFINITION</m:mtext>
+          </xsl:when>
+          <xsl:otherwise>
+           <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
+          </xsl:otherwise>
+          </xsl:choose>  
+         </xsl:when>
+         <xsl:otherwise>
+          <m:mtext>AND</m:mtext>
+         </xsl:otherwise>
+         </xsl:choose>
+         <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+         <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != &quot;&quot;"><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow> 
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <m:mtext>[</m:mtext>
+         <xsl:choose>
+         <xsl:when test="string(../Param) != &quot;&quot;">         
+          <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+           <xsl:for-each select="../Param">
+            <m:mtr>
+             <m:mtd>
+              <m:mrow>   
+               <m:mi><xsl:value-of select="./@name"/></m:mi>
+               <m:mo>:</m:mo>
+               <xsl:apply-templates select="*"/>
+              </m:mrow>
+             </m:mtd>
+            </m:mtr>
+           </xsl:for-each>
+            <m:mtr>
+             <m:mtd>
+              <m:mrow>
+               <m:mtext>]</m:mtext>
+              </m:mrow>
+             </m:mtd>
+            </m:mtr>
+          </m:mtable>
+         </xsl:when>
+         <xsl:otherwise>
+          <m:mtext>]</m:mtext>
+         </xsl:otherwise>
+         </xsl:choose>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>OF ARITY</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="./arity/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>BUILT FROM</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <xsl:for-each select="./Constructor">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <xsl:choose>
+         <xsl:when test="position() = 1">
+          <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         </xsl:when>
+         <xsl:otherwise>
+          <m:mtext>|</m:mtext>
+          <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+         </xsl:otherwise>
+         </xsl:choose>
+         <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
+         <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+         <xsl:apply-templates select="./*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      </xsl:for-each>
+     </xsl:for-each>
+     </m:mtable>
+    </m:math>
+</xsl:template>
+
+<!-- VARIABLE -->
+
+<xsl:template match="Variable">
+    <m:math>
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+         <xsl:apply-templates select="type/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <xsl:if test="name(*[1])='body'">
+       <m:mtr>
+        <m:mtd>
+         <m:mrow>
+          <m:mtext>AS</m:mtext>
+         </m:mrow>
+        </m:mtd>
+       </m:mtr>
+       <m:mtr>
+        <m:mtd>
+         <m:mrow>
+          <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+          <xsl:apply-templates select="body/*[1]"/>
+         </m:mrow>
+        </m:mtd>
+       </m:mtr>
+      </xsl:if>
+     </m:mtable>
+    </m:math>
+</xsl:template>        
+               
+
+
+<!-- SEQUENT -->
+<!--
+<xsl:template match="Sequent">
+ <xsl:variable name="rowlines">
+  <xsl:for-each select="Decl|Def">
+   <xsl:if test="position() != last()">
+    <xsl:text>none </xsl:text>
+   </xsl:if>
+  </xsl:for-each>
+  <xsl:text>solid</xsl:text>
+ </xsl:variable>
+ <xsl:variable name="no" select="@no"/>
+    <m:math>
+     <m:mi><xsl:text>?</xsl:text><xsl:value-of select="$no"/></m:mi>
+     <m:mo>:</m:mo>
+     <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}" rowlines="{$rowlines}">
+      <xsl:for-each select="Decl|Def">
+       <m:mtr>
+        <m:mtd>
+         <m:mrow helm:xref="{@helm:xref}">
+          <m:mi><xsl:value-of select="@name"/></m:mi>
+          <xsl:choose>
+           <xsl:when test="name(.) = 'Decl'">
+            <m:mo>:</m:mo>
+           </xsl:when>
+           <xsl:otherwise>
+            <m:mo>:=</m:mo>
+           </xsl:otherwise>
+          </xsl:choose>
+          <xsl:apply-templates select="*[1]"/>
+         </m:mrow>
+        </m:mtd>
+       </m:mtr>
+      </xsl:for-each>
+      <xsl:if test="not(Decl|Def)">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      </xsl:if>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <xsl:apply-templates select="Goal/*[1]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+     </m:mtable>
+    </m:math>
+</xsl:template>-->
+
+<!--**********************-->
+<!--        TERMS         -->
+<!--**********************-->
+
+<xsl:template match="m:bvar">
+ <xsl:choose>
+  <xsl:when test="m:type">
+   <xsl:variable name="charlength">
+    <xsl:apply-templates select="m:ci" mode="charcount"/>
+   </xsl:variable>
+   <xsl:choose>
+    <xsl:when test="$charlength >= $framewidth">
+     <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <xsl:apply-templates select="m:ci"/>
+         <m:mo>:</m:mo>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <xsl:apply-templates select="m:type"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+     </m:mtable>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:mrow>
+      <xsl:apply-templates select="m:ci"/>
+      <m:mo>:</m:mo>
+      <xsl:apply-templates select="m:type"/>
+     </m:mrow>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:apply-templates select="m:ci"/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="m:apply[m:implies]">
+    <xsl:variable name="charlength"><xsl:apply-templates select="m:implies" mode="charcount"/></xsl:variable>
+      <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[2]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>&#8658;</m:mo>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo>&#8658;</m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+       </xsl:otherwise>
+      </xsl:choose> 
+</xsl:template>
+
+<!-- CSYMBOL -->
+
+<xsl:template match="m:apply[m:csymbol]">
+<xsl:param name="nopar" select="0"/>
+    <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
+    <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
+    <m:mrow>
+     <xsl:if test="@id">
+      <xsl:attribute name="xref"><xsl:value-of select="@id"/></xsl:attribute>
+     </xsl:if>
+     <xsl:variable name="id" select="m:csymbol/@id"/>
+     <xsl:choose>
+      <!-- META -->
+      <xsl:when test="$name='meta'">
+       <m:mrow>
+        <xsl:apply-templates select="*[position()=2]"/>
+        <m:mfenced open="[" close="]" separators=";">
+         <xsl:apply-templates select="*[position()>2]"/>
+        </m:mfenced>
+       </m:mrow>
+      </xsl:when>
+      <!-- FORALL *-->
+      <xsl:when test="$name='forall'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathcolor="Blue">&#8704;</m:mo>
+            <xsl:apply-templates select="m:bvar"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>.</m:mo>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo mathcolor="Blue">&#8704;</m:mo>
+        <xsl:apply-templates select="m:bvar/m:ci"/>
+        <m:mo>:</m:mo>
+        <xsl:apply-templates select="m:bvar/m:type"/>
+        <m:mo>.</m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+       </xsl:otherwise>
+       </xsl:choose> 
+      </xsl:when>
+      <!-- LET-IN -->
+      <xsl:when test="$name='let_in'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>LET</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="m:bvar"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>=</m:mo>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>IN</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[position()=4]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo>LET</m:mo>
+        <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        <xsl:apply-templates select="m:bvar/m:ci"/>
+        <m:mo>=</m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+        <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        <m:mtext>IN</m:mtext>
+        <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        <xsl:apply-templates select="*[position()=4]"/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when> 
+      <!-- PROD *-->
+      <xsl:when test="$name='prod'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathcolor="Blue">&#x03a0;</m:mo>
+            <xsl:apply-templates select="m:bvar"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>.</m:mo>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo mathcolor="Blue">&#x03a0;</m:mo>
+        <xsl:apply-templates select="m:bvar/m:ci"/>
+        <m:mo>:</m:mo>
+        <xsl:apply-templates select="m:bvar/m:type"/>
+        <m:mo>.</m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+       </xsl:otherwise>
+       </xsl:choose> 
+      </xsl:when>
+      <!-- ARROW *-->
+      <xsl:when test="$name='arrow'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:if test="$nopar=0">
+             <m:mo stretchy="false">(</m:mo>
+            </xsl:if>
+            <xsl:apply-templates select="*[position()=2]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathmathcolor="Blue">&#x2192;</m:mo>
+            <xsl:choose>
+            <xsl:when test="*[position()=3]/m:csymbol">
+             <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
+             <xsl:choose>
+             <xsl:when test="$nextp='arrow'">
+              <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
+             </xsl:when>
+             <xsl:otherwise>
+              <xsl:apply-templates select="*[position()=3]"/>
+             </xsl:otherwise>
+             </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+             <xsl:apply-templates select="*[position()=3]"/>
+            </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <xsl:if test="$nopar=0">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">)</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:if>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:if test="$nopar=0">
+         <m:mo stretchy="false">(</m:mo>
+        </xsl:if>
+        <xsl:apply-templates select="*[position()=2]"/>
+        <m:mo mathcolor="Blue">&#x2192;</m:mo>
+        <xsl:choose>
+        <xsl:when test="*[position()=3]/m:csymbol">
+         <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
+         <xsl:choose>
+         <xsl:when test="$nextp='arrow'">
+          <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:apply-templates select="*[position()=3]"/>
+         </xsl:otherwise>
+         </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:apply-templates select="*[position()=3]"/>
+        </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$nopar=0">
+         <m:mo stretchy="false">)</m:mo>
+        </xsl:if>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- TYPE_OF -->
+      <xsl:when test="$name='type_of'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+          <m:mrow>
+           <xsl:value-of select="*[2]"/>
+           <m:mo>:</m:mo>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <xsl:apply-templates select="*[3]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo>:</m:mo>
+        <xsl:apply-templates select="*[3]"/>
+       </m:mrow>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!--PRODUCT -->
+      <xsl:when test="$name='product'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+          <m:mrow>
+           <m:mo mathcolor="Blue">&#931;</m:mo>
+           <xsl:apply-templates select="m:bvar/m:ci"/>
+           <m:mo>:</m:mo>
+           <xsl:apply-templates select="m:bvar/m:type"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext>.</m:mtext>
+           <xsl:apply-templates select="*[position()=3]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow>
+        <m:mo mathcolor="Blue">&#931;</m:mo>
+        <xsl:apply-templates select="m:bvar/m:ci"/>
+         <m:mo>:</m:mo>
+        <xsl:apply-templates select="m:bvar/m:type"/>
+        <m:mtext>.</m:mtext>
+        <xsl:apply-templates select="*[position()=3]"/>
+       </m:mrow>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- PROD_IND -->
+      <xsl:when test="$name='product_ind'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mo stretchy="false">(</m:mo>
+           <xsl:apply-templates select="m:type"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mo mathcolor="Blue">x</m:mo>
+           <xsl:apply-templates select="*[position()=3]"/>
+           <m:mo stretchy="false">)</m:mo>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow>
+        <m:mo stretchy="false">(</m:mo>
+        <xsl:apply-templates select="m:type"/>
+        <m:mo mathcolor="Blue">x</m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+         <m:mo stretchy="false">)</m:mo>
+       </m:mrow>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- PAIR -->
+      <xsl:when test="$name='pair'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+           <m:mo mathcolor="Blue">&lt;</m:mo>
+           <xsl:apply-templates select="*[2]"/>
+           <m:mtext>, </m:mtext>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <xsl:apply-templates select="*[3]"/>
+           <m:mo mathcolor="Blue">&gt;</m:mo>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow>
+         <m:mo mathcolor="Blue">&lt;</m:mo>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mtext>, </m:mtext>
+        <xsl:apply-templates select="*[3]"/>
+        <m:mo mathcolor="Blue">&gt;</m:mo>
+       </m:mrow>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- UNION -->
+      <xsl:when test="$name='union'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+          <xsl:apply-templates select="*[2]"/>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+          <m:mtd>
+           <m:mrow>
+           <m:mo mathcolor="Blue">+</m:mo>
+            <xsl:apply-templates select="*[3]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo mathcolor="Blue">+</m:mo>
+        <xsl:apply-templates select="*[3]"/>
+       </m:mrow>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- INL -->
+      <xsl:when test="$name='inl'">
+       <m:mrow>
+        <m:mo stretchy="false" mathcolor="Blue">inl(</m:mo>
+       <xsl:apply-templates select="*[position()=2]"/>
+        <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
+       </m:mrow>
+      </xsl:when>
+      <!-- INR -->
+      <xsl:when test="$name='inr'">
+       <m:mrow>
+        <m:mo stretchy="false" mathcolor="Blue">inr(</m:mo>
+        <xsl:apply-templates select="*[position()=2]"/>
+        <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
+       </m:mrow>
+      </xsl:when>
+      <!-- AXIOM -->
+      <xsl:when test="$name='Ax'">
+       <m:mo mathcolor="Blue">Ax</m:mo>
+      </xsl:when>
+      <!-- VOID -->
+      <xsl:when test="$name='void'">
+       <m:mo mathcolor="Blue">Void</m:mo>
+      </xsl:when>
+      <!-- ATOM -->
+      <xsl:when test="$name='atom'">
+       <m:mo mathcolor="Blue">Atom</m:mo>
+      </xsl:when>
+      <!-- UNIVERSE -->
+      <xsl:when test="$name='universe'">
+       <m:msub>
+        <m:mo>U</m:mo>
+        <xsl:apply-templates select="m:cn"/>
+       </m:msub>
+      </xsl:when>
+      <!-- PROP -->
+      <xsl:when test="$name='prop'">
+       <m:msub>
+        <m:mo>P</m:mo>
+        <xsl:apply-templates select="m:cn"/>
+       </m:msub>
+      </xsl:when>
+      <!-- EQUAL -->
+      <xsl:when test="$name='equal'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+          <xsl:apply-templates select="*[position()=3]"/>
+         </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathcolor="Blue">=</m:mo>
+            <xsl:apply-templates select="*[position()=4]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathcolor="Blue">&#x02208;</m:mo>
+            <xsl:apply-templates select="*[position()=2]"/>
+           </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+      </xsl:when>
+      <xsl:otherwise>
+       <m:mrow>
+        <xsl:apply-templates select="*[position()=3]"/>
+        <m:mo mathcolor="Blue">=</m:mo>
+        <xsl:apply-templates select="*[position()=4]"/>
+        <m:mo mathcolor="Blue">&#x02208;</m:mo>
+        <xsl:apply-templates select="*[position()=2]"/>
+       </m:mrow>
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <!-- TOKEN  -->
+    <xsl:when test="$name='token'">
+     <m:mrow>
+      <m:mo mathcolor="Blue">"</m:mo>
+      <xsl:apply-templates select="m:ci"/>
+      <m:mo mathcolor="Blue">"</m:mo>
+     </m:mrow>
+    </xsl:when>
+    <!-- NIL  -->
+    <xsl:when test="$name='nil'">
+     <m:mo mathcolor="Blue">[]</m:mo>
+    </xsl:when>
+    <!-- CONS -->
+    <xsl:when test="$name='cons'">
+     <xsl:choose>
+     <xsl:when test="$charlength >= $framewidth">
+      <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+       <m:mtr>
+        <m:mtd>
+         <xsl:apply-templates select="*[2]"/>
+        </m:mtd>
+      </m:mtr>
+      <m:mtr>
+       <m:mtd>
+        <m:mrow>
+         <m:mo mathcolor="Blue">::</m:mo>
+         <xsl:apply-templates select="*[3]"/>
+        </m:mrow>
+       </m:mtd>
+      </m:mtr>
+     </m:mtable>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:mrow>
+      <xsl:apply-templates select="*[2]"/>
+      <m:mo mathcolor="Blue">::</m:mo>
+      <xsl:apply-templates select="*[3]"/>
+     </m:mrow>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:when>
+
+<!-- REC -->
+<xsl:when test="$name='rec'">
+<xsl:choose>
+<xsl:when test="$charlength >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo>rectype</m:mo>
+    <xsl:apply-templates select="*[2]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo>=</m:mo>
+    <xsl:apply-templates select="*[3]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:mrow>
+ <m:mo>rectype</m:mo>
+ <xsl:apply-templates select="*[2]"/>
+ <m:mo>=</m:mo>
+ <xsl:apply-templates select="*[3]"/>
+</m:mrow>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+
+<!-- SET  -->
+<xsl:when test="$name='t_set'">
+<xsl:choose>
+<xsl:when test="$charlength >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo mathcolor="Blue" stretchy="false">{</m:mo>
+    <xsl:choose>
+    <xsl:when test="m:bvar/m:ci">
+     <xsl:apply-templates select="m:bvar/m:ci"/>
+     <m:mo mathcolor="Blue">:</m:mo>
+     <xsl:apply-templates select="m:bvar/m:type"/>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="m:bvar/m:type"/>
+    </xsl:otherwise>
+    </xsl:choose>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:row>
+    <m:mo mathcolor="Blue" stretchy="false">|</m:mo>
+    <xsl:apply-templates select="*[3]"/>
+    <m:mo mathcolor="Blue" stretchy="false">}</m:mo>
+   </m:row>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:row>
+ <m:mo mathcolor="Blue" stretchy="false">{</m:mo>
+ <xsl:choose>
+ <xsl:when test="m:bvar/m:ci">
+  <xsl:apply-templates select="m:bvar/m:ci"/>
+  <m:mo mathcolor="Blue">:</m:mo>
+  <xsl:apply-templates select="m:bvar/m:type"/>
+ </xsl:when> 
+ <xsl:otherwise>
+  <xsl:apply-templates select="m:bvar/m:type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <m:mo mathcolor="Blue" stretchy="false">|</m:mo>
+ <xsl:apply-templates select="*[3]"/>
+ <m:mo mathcolor="Blue" stretchy="false">}</m:mo>
+</m:row>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+
+<!-- ISECT -->
+<xsl:when test="$name='isect'">
+<xsl:choose>
+<xsl:when test="$charlength >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo mathcolor="Blue">&#xc7;</m:mo>
+    <xsl:apply-templates select="m:bvar/m:ci"/>
+    <m:mo mathcolor="Blue">:</m:mo>
+    <xsl:apply-templates select="m:bvar/m:type"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo mathcolor="Blue">.</m:mo>
+    <xsl:apply-templates select="*[3]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:mrow>
+ <m:mo mathcolor="Blue">&#xc7;</m:mo>
+ <xsl:apply-templates select="m:bvar/m:ci"/>
+ <m:mo mathcolor="Blue">:</m:mo>
+ <xsl:apply-templates select="m:bvar/m:type"/>
+ <m:mo mathcolor="Blue">.</m:mo>
+ <xsl:apply-templates select="*[3]"/>
+</m:mrow>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+<!-- QUOTIENT -->
+<xsl:when test="$name='quotient'">
+<xsl:choose>
+<xsl:when test="$charlength >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <xsl:apply-templates select="m:bvar[1]"/>
+    <m:mo mathcolor="Blue">,</m:mo>
+    <xsl:apply-templates select="m:bvar[2]"/>
+    <m:mo mathcolor="Blue">:</m:mo>
+    <xsl:apply-templates select="*[2]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo mathcolor="Blue">//</m:mo>
+    <xsl:apply-templates select="*[5]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:mrow>
+ <xsl:apply-templates select="m:bvar[1]"/>
+ <m:mo mathcolor="Blue">,</m:mo>
+ <xsl:apply-templates select="m:bvar[2]"/>
+ <m:mo mathcolor="Blue">:</m:mo>
+ <xsl:apply-templates select="*[2]"/>
+ <m:mo mathcolor="Blue">//</m:mo>
+ <xsl:apply-templates select="*[5]"/>
+</m:mrow>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+<!-- IF_THEN_ELSE -->
+<xsl:when test="$name='if_then_else'">
+<xsl:choose>
+<xsl:when test="$charlength >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+  <m:mrow>
+   <xsl:choose>
+   <xsl:when test="m:where = 'atom_eq'">
+    <m:mo stretchy="false" mathcolor="Blue">atom_eq (</m:mo>
+   </xsl:when>
+   <xsl:when test="m:where = 'int_eq'">
+    <m:mo stretchy="false" mathcolor="Blue">int_eq (</m:mo>
+   </xsl:when>
+   <xsl:when test="m:where = 'less'">
+    <m:mo stretchy="false" mathcolor="Blue">less (</m:mo>
+   </xsl:when>
+   </xsl:choose>
+   <xsl:apply-templates select="*[3]"/>
+   <m:mo mathcolor="Blue">;</m:mo>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <xsl:apply-templates select="*[4]"/>
+    <m:mo mathcolor="Blue">;</m:mo>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <xsl:apply-templates select="*[5]"/>
+    <m:mo mathcolor="Blue">;</m:mo>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <xsl:apply-templates select="*[6]"/>
+    <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:mrow>
+ <xsl:choose>
+ <xsl:when test="m:where = 'atom_eq'">
+  <m:mo stretchy="false" mathcolor="Blue">atom_eq (</m:mo>
+ </xsl:when>
+ <xsl:when test="m:where = 'int_eq'">
+  <m:mo stretchy="false" mathcolor="Blue">int_eq (</m:mo>
+ </xsl:when>
+ <xsl:when test="m:where = 'less'">
+  <m:mo stretchy="false" mathcolor="Blue">less (</m:mo>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="*[3]"/>
+ <m:mo mathcolor="Blue">;</m:mo>
+ <xsl:apply-templates select="*[4]"/>
+ <m:mo mathcolor="Blue">;</m:mo>
+ <xsl:apply-templates select="*[5]"/>
+ <m:mo mathcolor="Blue">;</m:mo> 
+ <xsl:apply-templates select="*[6]"/>
+ <m:mo stretchy="false" mathcolor="Blue">)</m:mo>
+</m:mrow>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+<!-- SO_LAMBDA -->
+<xsl:when test="$name='so_lambda'">
+<xsl:choose>
+<xsl:when test="($charlength - 4) >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo mathcolor="red">&#x03bb;</m:mo>
+    <xsl:apply-templates select="m:apply[1]/*[2]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo>.</m:mo>
+    <xsl:apply-templates select="*[3]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:mrow>
+ <m:mo mathcolor="red">&#x03bb;</m:mo>
+ <xsl:apply-templates select="m:apply[1]/m:ci[2]"/>
+ <m:mo>.</m:mo>
+ <xsl:apply-templates select="*[3]"/>
+</m:mrow>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+<!-- SO_APPLY -->
+<xsl:when test="$name='so_apply'">
+<xsl:choose>
+<xsl:when test="($charlength - 4) >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo stretchy="false">(</m:mo>
+    <xsl:apply-templates select="*[position()=2]">
+     <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+    </xsl:apply-templates>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <xsl:for-each select="*[position()>2]">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mphantom stretchy="false"><m:mtext>(</m:mtext></m:mphantom>
+    <xsl:apply-templates select=".">
+     <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+    </xsl:apply-templates>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ </xsl:for-each>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo stretchy="false">)</m:mo>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+</m:mtable>
+</xsl:when>
+<xsl:otherwise>
+<m:mo stretchy="false">(</m:mo>
+<xsl:apply-templates select="*[position()=2]">
+ <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+</xsl:apply-templates>
+<xsl:for-each select="*[position()>2]">
+ <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+ <xsl:apply-templates select=".">
+  <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+ </xsl:apply-templates>
+</xsl:for-each>
+<m:mo stretchy="false">)</m:mo>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:when>
+<!-- CAST -->
+<xsl:when test="$name='cast'">
+<xsl:choose>
+<xsl:when test="$charlength >= $framewidth">
+<m:mtable align="baseline 1" equalrows="false" columnalign="left">
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+    <m:mo stretchy="false">(</m:mo>
+    <xsl:apply-templates select="*[position()=2]"/>
+   </m:mrow>
+  </m:mtd>
+ </m:mtr>
+ <m:mtr>
+  <m:mtd>
+   <m:mrow>
+            <m:mo mathcolor="Maroon">:></m:mo>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">)</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo stretchy="false">(</m:mo>
+        <xsl:apply-templates select="*[position()=2]"/>
+        <m:mo mathcolor="Maroon">:></m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+        <m:mo stretchy="false">)</m:mo>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- APP *-->
+      <xsl:when test="$name='app'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">(</m:mo>
+<!-- added precedence to app = FUNCTION_PREC (99) -->
+            <xsl:apply-templates select="*[position()=2]">
+             <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+            </xsl:apply-templates>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <xsl:for-each select="*[position()>2]">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
+<!-- added precedence to app = FUNCTION_PREC (99) -->
+            <xsl:apply-templates select=".">
+             <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+            </xsl:apply-templates>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:for-each>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">)</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo stretchy="false">(</m:mo>
+<!-- added precedence to app = FUNCTION_PREC (99) -->
+        <xsl:apply-templates select="*[position()=2]">
+         <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+        </xsl:apply-templates>
+        <xsl:for-each select="*[position()>2]">
+         <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+<!-- added precedence to app = FUNCTION_PREC (99) -->
+         <xsl:apply-templates select=".">
+          <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
+         </xsl:apply-templates>
+        </xsl:for-each>
+        <m:mo stretchy="false">)</m:mo>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- CAST -->
+      <xsl:when test="$name='cast'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">(</m:mo>
+            <xsl:apply-templates select="*[position()=2]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathcolor="Maroon">:></m:mo>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">)</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo stretchy="false">(</m:mo>
+        <xsl:apply-templates select="*[position()=2]"/>
+        <m:mo mathcolor="Maroon">:></m:mo>
+        <xsl:apply-templates select="*[position()=3]"/>
+        <m:mo stretchy="false">)</m:mo>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- PROP -->
+      <!--<xsl:when test="$name='Prop'">
+       <m:mo>Prop</m:mo>
+      </xsl:when>-->
+      <!-- SET -->
+      <!--<xsl:when test="$name='Set'">
+       <m:mo>Set</m:mo>
+      </xsl:when>-->
+      <!-- TYPE -->
+      <!--<xsl:when test="$name='Type'">
+       <m:mo>Type</m:mo>
+      </xsl:when>-->
+      <!-- MUTCASE -->
+      <xsl:when test="$name='mutcase'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>&lt;</m:mo>
+            <xsl:apply-templates select="*[position()=2]"/>
+            <xsl:if test="$framewidth > $charlength">
+             <m:mo>&gt;</m:mo>
+             <m:mo>CASES</m:mo>
+             <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+             <xsl:apply-templates select="*[position()=3]"/>
+            </xsl:if>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <xsl:if test="$charlength >= $framewidth">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>&gt;</m:mo>
+            <m:mo>CASES</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:if>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>OF</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <xsl:for-each select="m:piecewise/m:piece">
+         <xsl:variable name="charlength"><xsl:apply-templates select="./*[2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+            <xsl:when test="position() = 1">
+              <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
+            </xsl:when>
+            <xsl:otherwise>
+             <m:mo stretchy="false">|</m:mo>
+            </xsl:otherwise>
+            </xsl:choose>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="./*[2]"/>
+            <xsl:if test="$framewidth > $charlength">
+             <m:mo mathcolor="Green">&#x21d2;</m:mo>
+             <xsl:apply-templates select="./*[1]"/>
+            </xsl:if>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <xsl:if test="$charlength >= $framewidth">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>  
+            <m:mo mathcolor="Green">&#x21d2;</m:mo>
+            <xsl:apply-templates select="./*[1]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:if>
+        </xsl:for-each>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>END</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo>&lt;</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>&gt;</m:mo>
+        <m:mo>CASES</m:mo>
+        <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        <xsl:apply-templates select="*[position()=3]"/>
+        <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        <m:mo>OF</m:mo>
+        <xsl:for-each select="m:piecewise/m:piece">
+         <xsl:choose>
+         <xsl:when test="position() != 1">
+          <m:mo stretchy="false">|</m:mo>
+         </xsl:when> 
+         </xsl:choose>
+         <xsl:apply-templates select="./*[2]"/>
+         <m:mo mathcolor="Green">&#x21d2;</m:mo>
+         <xsl:apply-templates select="./*[1]"/>
+        </xsl:for-each>
+        <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+        <m:mo>END</m:mo>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- FIX -->
+      <xsl:when test="$name='fix'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>FIX</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mi><xsl:value-of select="m:ci"/></m:mi>
+            <m:mo stretchy="false">{</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+            <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+            <xsl:for-each select="m:bvar"> 
+             <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mi><xsl:value-of select="m:ci"/></m:mi>
+                <m:mo>:</m:mo>
+                <xsl:if test="$framewidth > $charlength">
+                 <xsl:apply-templates select="m:type"/>
+                </xsl:if>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr> 
+             <xsl:if test="$charlength >= $framewidth">
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
+                <xsl:apply-templates select="m:type"/>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+             </xsl:if>
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mo>:=</m:mo>
+                <xsl:apply-templates select="following-sibling::*[position()=1]"/>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr> 
+            </xsl:for-each>
+            </m:mtable>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">}</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo>FIX</m:mo>
+        <m:mi><xsl:value-of select="m:ci"/></m:mi>
+        <m:mo stretchy="false">{</m:mo>
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <xsl:for-each select="m:bvar"> 
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mi><xsl:value-of select="m:ci"/></m:mi>
+            <m:mo>:</m:mo>
+            <xsl:apply-templates select="m:type"/>
+            <m:mo>:=</m:mo>
+            <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
+            <xsl:if test="position()=last()">
+             <m:mo stretchy="false">}</m:mo>
+            </xsl:if>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:for-each>
+        </m:mtable>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- COFIX -->
+      <xsl:when test="$name='cofix'">
+       <xsl:choose>
+       <xsl:when test="$charlength >= $framewidth">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo>COFIX</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mi><xsl:value-of select="m:ci"/></m:mi>
+            <m:mo stretchy="false">{</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+            <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+            <xsl:for-each select="m:bvar">
+             <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable> 
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mi><xsl:value-of select="m:ci"/></m:mi>
+                <m:mo>:</m:mo>
+                <xsl:if test="$framewidth > $charlength">
+                 <xsl:apply-templates select="m:type"/>
+                </xsl:if>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr> 
+             <xsl:if test="$charlength >= $framewidth">
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
+                <xsl:apply-templates select="m:type"/>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+             </xsl:if>
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mo>:=</m:mo>
+                <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+            </xsl:for-each>
+            </m:mtable>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo stretchy="false">}</m:mo>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mo>COFIX</m:mo>
+        <m:mi><xsl:value-of select="m:ci"/></m:mi>
+        <m:mo stretchy="false">{</m:mo>
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">  
+        <xsl:for-each select="m:bvar"> 
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mi><xsl:value-of select="m:ci"/></m:mi>
+            <m:mo>:</m:mo>
+            <xsl:apply-templates select="m:type"/>
+            <m:mo>:=</m:mo>
+            <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
+            <xsl:if test="position()=last()">
+             <m:mo stretchy="false">}</m:mo>
+            </xsl:if>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:for-each>
+        </m:mtable>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- ***************************************** -->
+      <!-- *********** PROOF ELEMENTS ************** -->
+      <!-- ***************************************** -->
+      <!-- PROOF -->
+      <xsl:when test="$name='proof'">
+        <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
+        <xsl:variable name="test" select="(not($explodeall)) and
+          (not(preceding-sibling::*[1]/text()='letin1')) and
+          (not(preceding-sibling::*[1]/text()='rw_step')) and
+          (not(name(..)='m:lambda'))"/>
+        <xsl:variable name="hidden_details">
+         <xsl:if test="$test">
+          <!-- Details hided (default) -->
+          <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+           <m:mtr>
+            <m:mtd>
+             <m:mrow>
+              <m:mtext mathcolor="Red">We&#x00a0;can&#x00a0;prove</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <!-- the last child is either the expected type, if provided,-->
+              <!-- or the synthesized type.                                -->
+              <xsl:apply-templates select="*[position()=last()]"/>
+              <m:mrow>
+               <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+               <m:mtext mathcolor="Green">(explain)</m:mtext>
+              </m:mrow>
+             </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </m:mtable>
+         </xsl:if>
+        </xsl:variable>
+        <xsl:variable name="shown_details">
+         <!-- Show details -->
+         <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <xsl:apply-templates select="*[position()=2]"/>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <xsl:variable name="hidedetails">
+            <m:mrow>
+             <m:mphantom>
+              <m:mtext>_</m:mtext>
+             </m:mphantom>
+             <xsl:if test="$test">
+              <m:mtext mathcolor="Green">(hide&#x00a0;details)</m:mtext>
+             </xsl:if>
+            </m:mrow>
+          </xsl:variable>
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <m:mtext mathcolor="Red">we&#x00a0;proved</m:mtext>
+             <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+             <xsl:apply-templates select="*[position()=3]"/>
+             <xsl:if test="not(*[4])">
+              <xsl:copy-of select="$hidedetails"/>
+             </xsl:if>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <xsl:if test="*[4]">
+           <m:mtr>
+            <m:mtd>
+             <m:mrow>
+              <m:mtext mathcolor="Red">that&#x00a0;is&#x00a0;equivalent&#x00a0;to</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[position()=4]"/>
+              <xsl:copy-of select="$hidedetails"/>
+             </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </xsl:if>
+         </m:mtable>
+        </xsl:variable>
+        <xsl:choose>
+         <xsl:when test="$test">
+          <m:maction actiontype="toggle">
+           <xsl:copy-of select="$hidden_details"/>
+           <xsl:copy-of select="$shown_details"/>
+          </m:maction>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:copy-of select="$shown_details"/>
+         </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <!-- SIDE_PROOF -->
+      <xsl:when test="$name='side_proof'">
+        <xsl:variable name="test" select="(not($explodeall))"/>
+        <xsl:variable name="hidden_details">
+         <xsl:if test="$test">
+          <!-- Details hided (default) -->
+          <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+           <m:mtr>
+            <m:mtd>
+             <m:mrow>
+              <m:mtext mathcolor="Red">We&#x00a0;can&#x00a0;prove</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <!-- the last child is either the expected type, if provided,-->
+              <!-- or the synthesized type.                                -->
+              <xsl:apply-templates select="*[position()=last()]"/>
+              <m:mrow>
+               <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+               <m:mtext mathcolor="Green">(explain)</m:mtext>
+              </m:mrow>
+             </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </m:mtable>
+         </xsl:if>
+        </xsl:variable>
+        <xsl:variable name="shown_details">
+         <!-- Show details -->
+         <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <xsl:apply-templates select="*[position()=2]"/>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <xsl:variable name="hidedetails">
+            <m:mrow>
+             <m:mphantom>
+              <m:mtext>_</m:mtext>
+             </m:mphantom>
+             <xsl:if test="$test">
+              <m:mtext mathcolor="Green">(hide&#x00a0;details)</m:mtext>
+             </xsl:if>
+            </m:mrow>
+          </xsl:variable>
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <m:mtext mathcolor="Red">we&#x00a0;proved</m:mtext>
+             <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+             <xsl:apply-templates select="*[position()=3]"/>
+             <xsl:if test="not(*[4])">
+              <xsl:copy-of select="$hidedetails"/>
+             </xsl:if>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <xsl:if test="*[4]">
+           <m:mtr>
+            <m:mtd>
+             <m:mrow>
+              <m:mtext mathcolor="Red">that&#x00a0;is&#x00a0;equivalent&#x00a0;to</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[position()=4]"/>
+              <xsl:copy-of select="$hidedetails"/>
+             </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </xsl:if>
+         </m:mtable>
+        </xsl:variable>
+        <xsl:choose>
+         <xsl:when test="$test">
+          <m:maction actiontype="toggle">
+           <xsl:copy-of select="$hidden_details"/>
+           <xsl:copy-of select="$shown_details"/>
+          </m:maction>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:copy-of select="$shown_details"/>
+         </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <!-- LETIN1 -->
+      <xsl:when test="$name='letin1'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[position()=2]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[position()=3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <xsl:when test="$name='by_induction'">
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="Red">We&#x00a0;prove</m:mtext>
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <xsl:apply-templates select="../*[3]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="Red">by&#x00a0;induction&#x00a0;on</m:mtext>
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <xsl:apply-templates 
+            select="*[position()=last()]/*[position()=last()]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+            <xsl:for-each select="*[position()>3 and not(position()=last())]">
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <xsl:apply-templates select="."/>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+            </xsl:for-each>
+           </m:mtable>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+      </xsl:when>
+      <!-- inductive_case -->
+      <xsl:when test="$name='inductive_case'">
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="Red">Case</m:mtext>
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <xsl:apply-templates select="*[2]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+            <xsl:if test="*[3]/*[position()>1]">
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mtext mathcolor="Red">By&#x00a0;induction&#x00a0;hypothesis,&#x00a0;we&#x00a0;have:</m:mtext>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+                <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+                <xsl:for-each select="*[3]/*[position()>1]">
+                 <m:mo stretchy="false">(</m:mo>
+                 <xsl:apply-templates select="m:ci"/>
+                 <m:mo stretchy="false">) </m:mo>
+                 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+                 <xsl:apply-templates select="m:type"/>
+                </xsl:for-each>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+            </xsl:if>
+            <m:mtr>
+             <m:mtd>
+              <m:mrow>
+               <xsl:apply-templates select="*[4]"/>
+              </m:mrow>
+             </m:mtd>
+            </m:mtr>
+           </m:mtable>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+      </xsl:when>
+      <!-- case_lhs  -->
+      <xsl:when test="$name='case_lhs'">
+       <m:mrow>
+        <xsl:choose>
+         <xsl:when test="count(*)=2">
+          <xsl:apply-templates select="*[2]"/>
+         </xsl:when>
+         <xsl:otherwise>
+          <m:mo stretchy="false">(</m:mo>
+          <xsl:apply-templates select="*[2]"/>
+          <xsl:for-each select="m:bvar">
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <xsl:apply-templates select="*[1]"/>
+           <m:mtext>:</m:mtext>
+           <xsl:apply-templates select="m:type/*[1]"/>
+          </xsl:for-each>
+          <m:mo stretchy="false">)</m:mo>
+         </xsl:otherwise>
+        </xsl:choose>
+       </m:mrow>
+      </xsl:when>
+      <!-- false_ind  -->
+      <xsl:when test="$name='false_ind'">
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <xsl:apply-templates select="*[3]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="Red">Contradiction.</m:mtext>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+       </m:mtable>
+      </xsl:when>
+      <!-- LET-IN -->
+      <xsl:when test="$name='letin'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
+        <xsl:for-each select="*[(last() > position()) and (position()>1)]">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="."/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         </xsl:for-each>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[position()=last()]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <!-- LET -->
+      <xsl:when test="$name='let'">
+       <m:mtext>(</m:mtext>
+       <xsl:apply-templates select="m:ci"/>
+       <m:mtext>) </m:mtext>
+       <xsl:apply-templates select="*[3]"/>
+      </xsl:when>
+      <!-- RW_STEP -->
+      <xsl:when test="$name='rw_step'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+             <xsl:when test="name(*[2])='m:apply'">
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:when>
+             <xsl:otherwise>
+              <m:mtext>Consider</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Rewrite</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[3]"/>
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <m:mtext>with</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[4]"/>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mtext>by</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[5]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <!-- not existing any more
+      <xsl:when test="$name='thread'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+             <xsl:when test="name(*[last()])='m:apply'">
+              <xsl:apply-templates select="*[last()]"/>
+             </xsl:when>
+             <xsl:otherwise>
+              <m:mtext>Consider</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[last()]"/>
+             </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        <xsl:apply-templates mode="thread" select="*[(last()-2)]"/> 
+        </m:mtable>
+      </xsl:when>
+      --> 
+      <!-- REWRITE_AND_APPLY -->
+      <xsl:when test="$name='rewrite_and_apply'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[2]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Then&#x00a0;apply&#x00a0;it&#x00a0;to</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[position()>2]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+       </m:mtable>
+      </xsl:when>
+      <!-- AND_IND -->
+      <xsl:when test="$name='and_ind'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+             <xsl:when test="name(*[2])='m:apply'">
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:when>
+             <xsl:otherwise>
+              <m:mtext>Consider</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>In&#x00a0;particular,&#x00a0;we&#x00a0;have</m:mtext>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>(</m:mtext>
+            <xsl:apply-templates select="*[3]"/>
+            <m:mtext>)</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[4]"/>
+            </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>(</m:mtext>
+            <xsl:apply-templates select="*[5]"/>
+            <m:mtext>)</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[6]"/>
+            </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[7]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <!-- full_or_ind -->
+      <xsl:when test="$name='full_or_ind'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+             <xsl:when test="name(*[2])='m:apply'">
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:when>
+             <xsl:otherwise>
+              <m:mtext>Consider</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>We&#x00a0;proceed&#x00a0;by&#x00a0;cases&#x00a0;to&#x00a0;prove</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Left:&#x00a0;suppose</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mo stretchy="false">(</m:mo>
+            <xsl:apply-templates select="*[4]/m:bvar/m:ci"/>
+            <m:mo stretchy="false">)</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[4]/m:bvar/m:type/*[1]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[4]/*[3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Right:&#x00a0;suppose</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mo stretchy="false">(</m:mo>
+            <xsl:apply-templates select="*[5]/m:bvar/m:ci"/>
+            <m:mo stretchy="false">)</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[5]/m:bvar/m:type/*[1]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[5]/*[3]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <!-- OR_IND -->
+      <xsl:when test="$name='or_ind'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+             <xsl:when test="name(*[2])='m:apply'">
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:when>
+             <xsl:otherwise>
+              <m:mtext>Consider</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>We&#x00a0;prove</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[3]"/>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mtext>by&#x00a0;cases:</m:mtext>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Left</m:mtext>
+            <xsl:apply-templates select="*[4]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Right</m:mtext>
+            <xsl:apply-templates select="*[5]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <!-- EX_IND -->
+      <xsl:when test="$name='ex_ind'">
+        <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:choose>
+             <xsl:when test="name(*[2])='m:apply'">
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:when>
+             <xsl:otherwise>
+              <m:mtext>Consider</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[2]"/>
+             </xsl:otherwise>
+            </xsl:choose>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Let</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[3]"/>
+            <m:mtext>:</m:mtext>
+            <xsl:apply-templates select="*[4]"/>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mtext>such&#x00a0;that</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mtext>(</m:mtext>
+             <xsl:apply-templates select="*[5]"/>
+            <m:mtext>)</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="*[6]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="*[7]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+        </m:mtable>
+      </xsl:when>
+      <!-- EQ_CHAIN -->
+      <xsl:when test="$name='eq_chain'">
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="Red">We&#x00a0;have&#x00a0;the&#x00a0;following&#x00a0;equality&#x00a0;chain:</m:mtext>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <xsl:for-each select="*[position() mod 2 = 0]">
+        <xsl:variable name="pos" select="position()"/>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <xsl:choose>
+           <xsl:when test="$pos = 1">
+            <xsl:apply-templates select="."/>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mo>=</m:mo>
+           </xsl:when>
+           <xsl:otherwise>
+            <m:mo>=</m:mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="."/>
+           </xsl:otherwise>
+           </xsl:choose>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <xsl:if test="$pos != last()">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+           <xsl:apply-templates select="../*[position()=2*$pos +1]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        </xsl:if>
+        </xsl:for-each>
+       </m:mtable>
+      </xsl:when>
+      <!-- DISEQ_CHAIN -->
+      <xsl:when test="$name='diseq_chain'">
+       <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mtext mathcolor="Red">We&#x00a0;have&#x00a0;the&#x00a0;following&#x00a0;disequality&#x00a0;chain:</m:mtext>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <xsl:for-each select="*[position() mod 3 = 2]">
+        <xsl:variable name="pos" select="position()"/>
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <xsl:choose>
+           <xsl:when test="$pos = 1">
+            <xsl:apply-templates select="."/>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <mo><xsl:apply-templates select="../*[position()=3*$pos]"/></mo>
+           </xsl:when>
+           <xsl:otherwise>
+            <mo><xsl:apply-templates select="../*[position()=3*($pos - 1)]"/></mo>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="."/>
+           </xsl:otherwise>
+           </xsl:choose>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        <xsl:if test="$pos != last()">
+        <m:mtr>
+         <m:mtd>
+          <m:mrow>
+           <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
+           <xsl:apply-templates select="../*[position()=3*$pos +1]"/>
+          </m:mrow>
+         </m:mtd>
+        </m:mtr>
+        </xsl:if>
+        </xsl:for-each>
+       </m:mtable>
+      </xsl:when>
+      <!-- ***************************************** -->
+      <!-- *********** NOTATIONS ******************* -->
+      <!-- ***************************************** -->
+      <!-- subst -->
+      <xsl:when test="$name='subst'">
+        <xsl:apply-templates select="*[3]"/>
+<!-- no font for ApplyFunction: <m:mo>&#xe8a0;</m:mo> -->
+        <m:mo stretchy="false">[</m:mo>
+        <xsl:apply-templates select="*[4]"/>
+        <m:mo mathcolor="Green">
+         <xsl:if test="$id != ''">
+          <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+         </xsl:if>&#8592;</m:mo>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo stretchy="false">]</m:mo>
+      </xsl:when>
+      <!-- lift -->
+      <xsl:when test="$name='lift'">
+        <m:msup>
+         <m:mo mathcolor="Green">
+          <xsl:if test="$id != ''">
+           <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+          </xsl:if>&#8593;</m:mo>
+        <xsl:apply-templates select="*[2]"/>
+        </m:msup>
+       <m:mrow>
+        <m:mo stretchy="false">(</m:mo>
+         <xsl:apply-templates select="*[3]"/>
+        <m:mo stretchy="false">)</m:mo>
+        </m:mrow>
+      </xsl:when>
+      <!-- lift_with_base -->
+      <xsl:when test="$name='lift_with_base'">
+        <m:msubsup>
+         <m:mo mathcolor="Green">
+          <xsl:if test="$id != ''">
+           <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+          </xsl:if>&#8593;</m:mo>
+        <xsl:apply-templates select="*[3]"/>
+        <xsl:apply-templates select="*[4]"/>
+        </m:msubsup>
+       <m:mrow>
+        <m:mo stretchy="false">(</m:mo>
+         <xsl:apply-templates select="*[2]"/>
+        <m:mo stretchy="false">)</m:mo>
+        </m:mrow>      
+      </xsl:when>
+      <!-- beta_red1 -->
+      <xsl:when test="$name='beta_red1'">
+        <xsl:apply-templates select="*[2]"/>
+        <m:munder>
+         <m:mo mathcolor="Green">
+          <xsl:if test="$id != ''">
+           <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+          </xsl:if>&#8594;</m:mo>
+          <m:mi mathcolor="Green">&#946;</m:mi>
+        </m:munder>
+        <xsl:apply-templates select="*[3]"/>
+      </xsl:when>
+      <!-- beta_red -->
+      <xsl:when test="$name='beta_red'">
+        <xsl:apply-templates select="*[2]"/>
+        <m:munderover>
+         <m:mo mathcolor="Green">
+          <xsl:if test="$id != ''">
+           <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+          </xsl:if>&#8594;</m:mo>
+          <m:mi mathcolor="Green">&#946;</m:mi>
+          <m:mi mathcolor="Green">*</m:mi>
+        </m:munderover>
+        <xsl:apply-templates select="*[3]"/>
+      </xsl:when>
+      <!-- par_beta_red1 -->
+      <xsl:when test="$name='par_beta_red1'">
+        <xsl:apply-templates select="*[2]"/>
+        <m:munder>
+         <m:mo mathcolor="Green">
+          <xsl:if test="$id != ''">
+           <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+          </xsl:if>&#8658;</m:mo>
+          <m:mi mathcolor="Green">&#946;</m:mi>
+        </m:munder>
+        <xsl:apply-templates select="*[3]"/>
+      </xsl:when>
+      <!-- par_beta_red -->
+      <xsl:when test="$name='par_beta_red'">
+        <xsl:apply-templates select="*[2]"/>
+        <m:munderover>
+         <m:mo mathcolor="Green">
+          <xsl:if test="$id != ''">
+           <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+          </xsl:if>&#8658;</m:mo>
+          <m:mi mathcolor="Green">&#946;</m:mi>
+          <m:mi mathcolor="Green">*</m:mi>
+        </m:munderover>
+        <xsl:apply-templates select="*[3]"/>
+      </xsl:when>
+      <!-- forgetful -->
+      <xsl:when test="$name='forgetful'">
+       <m:mfenced open="|" close="|">
+        <xsl:if test="$id != ''">
+         <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="*[2]"/>
+       </m:mfenced>
+      </xsl:when>
+      <!-- isomorphic -->
+      <xsl:when test="$name='isomorphic'">
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo mathcolor="Green">
+         <xsl:if test="$id != ''">
+          <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+         </xsl:if>&#8773;</m:mo>
+        <xsl:apply-templates select="*[3]"/>
+      </xsl:when>
+      <!-- interp -->
+      <xsl:when test="$name='forgetful'">
+       <m:mfenced open="[" close="]">
+        <xsl:if test="$id != ''">
+         <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="*[2]"/>
+       </m:mfenced>
+      </xsl:when> 
+
+      <!-- ERROR -->
+      <xsl:otherwise>
+       <m:mi>ERROR</m:mi>
+      </xsl:otherwise>
+     </xsl:choose>
+    </m:mrow>
+</xsl:template>
+
+<!-- Il modo Thread non esiste piu' 
+<xsl:template match="*" mode="thread">
+ <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
+ <xsl:choose>
+  <xsl:when test="$name='rw_step'">
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext>Rewrite</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
+           <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+           <m:mtext>with</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <m:mtext>by</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext mathcolor="Red">we&#x00a0;get</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="."/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+   </xsl:when>
+   <xsl:otherwise>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <xsl:apply-templates select="following-sibling::*[position()=1]"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+         <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mtext mathcolor="Red">we&#x00a0;get</m:mtext>
+            <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+            <xsl:apply-templates select="."/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+    </xsl:otherwise>
+   </xsl:choose>
+         <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
+</xsl:template>
+-->
+
+<!-- LAMBDA -->
+
+<xsl:template match="m:lambda">
+    <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
+    <m:mrow>
+     <xsl:if test="@id">
+      <xsl:attribute name="xref">
+       <xsl:value-of select="@id"/>
+      </xsl:attribute>
+     </xsl:if>
+     <xsl:choose>
+     <xsl:when test="$charlength >= $framewidth">
+      <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+        <m:mtr>
+          <m:mtd>
+           <m:mrow>
+            <m:mo mathcolor="Red">&#x03bb;</m:mo>
+            <!--<xsl:apply-templates select="m:bvar"/>-->
+           <xsl:apply-templates select="m:bvar/m:ci"/>
+           </m:mrow>
+          </m:mtd>
+         </m:mtr>
+       <m:mtr>
+        <m:mtd>
+         <m:mrow>
+          <m:mo>.</m:mo>
+          <xsl:apply-templates select="*[position()=2]"/>
+         </m:mrow>
+        </m:mtd>
+       </m:mtr>
+      </m:mtable>
+     </xsl:when>
+     <xsl:otherwise>
+      <m:mo mathcolor="Red">&#x03bb;</m:mo>
+      <!--<xsl:apply-templates select="m:bvar/m:ci"/>
+      <m:mo>:</m:mo>
+      <xsl:apply-templates select="m:bvar/m:type"/>-->
+      <xsl:apply-templates select="m:bvar/m:ci"/>
+      <m:mo>.</m:mo>
+      <xsl:apply-templates select="*[position()=2]"/>
+     </xsl:otherwise>
+     </xsl:choose>
+    </m:mrow>
+</xsl:template>
+
+
+<!--**********************-->
+<!--       COUNTING       -->
+<!--**********************-->
+
+<xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
+ |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
+ |m:plus|m:minus|m:times" mode="charcount">
+<xsl:param name="incurrent_length" select="0"/> 
+    <xsl:choose>
+    <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
+     <xsl:variable name="siblength">
+      <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
+       <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
+      </xsl:apply-templates>
+     </xsl:variable>
+     <xsl:choose>
+     <xsl:when test="string($siblength) = &quot;&quot;">
+      <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($siblength)"/>
+     </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="m:ci|m:csymbol" mode="charcount">
+<xsl:param name="incurrent_length" select="0"/> 
+<xsl:param name="nosibling" select="0"/>
+    <xsl:choose>
+    <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
+     <xsl:variable name="siblength">
+      <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
+       <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
+      </xsl:apply-templates>
+     </xsl:variable>
+     <xsl:choose>
+     <xsl:when test="string($siblength) = &quot;&quot;">
+      <xsl:value-of select="$incurrent_length + string-length()"/>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($siblength)"/>
+     </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$incurrent_length + string-length()"/>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template> 
+
+<xsl:template match="*" mode="charcount">
+<xsl:param name="incurrent_length" select="0"/>
+<xsl:param name="nosibling" select="0"/>
+ <xsl:choose>
+  <xsl:when test="count(child::*) = 0">
+   <!-- CSC: tremendous bug fixed. An empty element can still have siblings!!! -->
+   <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/></xsl:apply-templates></xsl:variable>
+   <xsl:choose>
+    <xsl:when test="string($siblength) = &quot;&quot;">
+     <xsl:value-of select="$incurrent_length"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="number($siblength)"/>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:variable name="childlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/><xsl:with-param name="nosibling" select="0"/></xsl:apply-templates></xsl:variable>
+    <xsl:choose>
+    <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
+     <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$childlength"/></xsl:apply-templates></xsl:variable>
+     <xsl:choose>
+     <xsl:when test="string($siblength) = &quot;&quot;">
+      <xsl:value-of select="number($childlength)"/>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:value-of select="number($siblength)"/>
+     </xsl:otherwise>
+     </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="number($childlength)"/>
+    </xsl:otherwise>
+    </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet> 
+
diff --git a/helm/nuprl_stylesheets/nuprl_proof.xsl b/helm/nuprl_stylesheets/nuprl_proof.xsl
new file mode 100644 (file)
index 0000000..343cafd
--- /dev/null
@@ -0,0 +1,74 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:cn="http://www.......">
+
+
+<xsl:template match="NuPrlProof">
+  <Definition>
+    <Params />
+    <body>
+      <xsl:apply-templates/>
+    </body>
+    <type>
+      <xsl:apply-templates select="node/sequent/conclusion/*[1]"/>
+    </type>
+  </Definition>
+</xsl:template>
+
+<xsl:template match="node">
+  <xsl:element name="Node">
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="sequent">
+  <xsl:element name="Sequent">
+    <xsl:attribute name="id">
+      <xsl:value-of select="@number"/>
+    </xsl:attribute>
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="hypothesis">
+  <xsl:element name="Decl">
+    <xsl:if test="@var!=&quot;&quot;">
+      <xsl:attribute name="name">
+        <xsl:value-of select="@var"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="conclusion">
+  <xsl:element name="Goal">
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="ruleinstance">
+  <xsl:element name="Rule">
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="tacticinstance">
+  <TacticInstance name="{@name}">
+    <xsl:apply-templates select="extra_info"/>
+  </TacticInstance>
+</xsl:template>
+
+<xsl:template match="extra_info">
+ <extra_info>
+  <xsl:copy-of select="*|@*|text()"/>
+ </extra_info>
+</xsl:template>
+
+<xsl:template match="tacticproof">
+  <xsl:element name="TacticProof">
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_rules.xsl b/helm/nuprl_stylesheets/nuprl_rules.xsl
new file mode 100644 (file)
index 0000000..6926dde
--- /dev/null
@@ -0,0 +1,876 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:cn="http://www.......">
+
+<xsl:template match="level-expression">
+  <m:apply>
+    <m:ci>level-exp</m:ci>
+    <m:ci>
+      <xsl:value-of select="@level"/>
+    </m:ci>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="parameter-substitution-list">
+  <m:apply>
+    <m:ci>parameter-substitution-list</m:ci>
+    <m:ci>
+      <xsl:value-of select="@val"/>
+    </m:ci>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="tag">
+  <m:apply>
+    <m:ci>tag <xsl:value-of select="@step"/>:</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_functionFormation">
+  <m:apply>
+    <m:ci>dependent_functionFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_functionFormation">
+  <m:ci>independent_functionFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="functionEquality">
+  <m:apply>
+    <m:ci>functionEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_functionEquality">
+  <m:ci>independent_functionEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="lambdaEquality">
+  <m:apply>
+    <m:ci>lambdaEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="lambdaFormation">
+  <m:apply>
+    <m:ci>lambdaFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="applyEquality">
+  <m:apply>
+    <m:ci>applyEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_functionElimination">
+  <m:apply>
+    <m:ci>independent_functionElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_functionElimination">
+  <m:apply>
+    <m:ci>dependent_functionElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="applyReduce">
+  <m:ci>functionEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="functionExtensionality">
+  <m:apply>
+    <m:ci>functionExtensionality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_productFormation">
+  <m:apply>
+    <m:ci>dependent_productFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_productFormation">
+  <m:ci>independent_productFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="productEquality">
+  <m:apply>
+    <m:ci>productEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_productEquality">
+  <m:ci>independent_productEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="dependent_pairEquality">
+  <m:apply>
+    <m:ci>dependent_pairEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_pairFormation">
+  <m:apply>
+    <m:ci>dependent_pairFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_pairEquality">
+  <m:ci>independent_pairEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="independent_pairFormation">
+  <m:ci>independent_pairFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="spreadEquality">
+  <m:apply>
+    <m:ci>spreadEquality</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="productElimination">
+  <m:apply>
+    <m:ci>productElimination</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="spreadReduce">
+  <m:ci>spreadReduce</m:ci>
+</xsl:template>
+
+<xsl:template match="unionFormation">
+  <m:ci>unionFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="unionEquality"> 
+  <m:ci>unionEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="inlEquality">
+  <m:apply>
+    <m:ci>inlEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="inlFormation">
+  <m:apply>
+    <m:ci>inlFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="inrEquality">
+  <m:apply>
+    <m:ci>inrEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="inrFormation">
+  <m:apply>
+    <m:ci>inrFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="decideEquality">
+  <m:apply>
+    <m:ci>decideEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="unionElimination">
+  <m:apply>
+    <m:ci>unionElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="decideReduceLeft">
+  <m:ci>decideReduceLeft</m:ci>
+</xsl:template>
+
+<xsl:template match="decideReduceRight">
+  <m:ci>decideReduceRight</m:ci>
+</xsl:template>
+
+<xsl:template match="universeFormation">
+  <m:apply>
+    <m:ci>universeFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="universeEquality">
+  <m:ci>universeEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="cumulativity">
+  <m:apply>
+    <m:ci>cumulativity</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="equalityFormation">
+  <m:apply>
+    <m:ci>equalityFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="equalityEquality">
+  <m:ci>equalityEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="axiomEquality">
+  <m:ci>axiomEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="equalityElimination">
+  <m:apply>
+    <m:ci>equalityElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="hypothesisEquality">
+  <m:apply>
+    <m:ci>hypothesisEquality</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="substitution">
+  <m:apply>
+    <m:ci>substitution</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="equality">
+  <m:ci>equality</m:ci>
+</xsl:template>
+
+<xsl:template match="voidFormation">
+  <m:ci>voidFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="voidEquality">
+  <m:ci>voidEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="anyEquality">
+  <m:ci>anyEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="voidElimination">
+  <m:apply>
+    <m:ci>voidElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="atomFormation">
+  <m:ci>atomFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="atomEquality">
+  <m:ci>atomEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="tokenEquality">
+  <m:ci>tokenEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="tokenFormation">
+  <m:apply>
+    <m:ci>tokenFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="atom_eqEquality">
+  <m:apply>
+    <m:ci>atom_eqEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="atom_eqReduceTrue">
+  <m:apply>
+    <m:ci>atom_eqReduceTrue</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="atom_eqReduceFalse">
+  <m:ci>atom_eqReduceFalse</m:ci>
+</xsl:template>
+
+<xsl:template match="intFormation">
+  <m:ci>intFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="intEquality">
+  <m:ci>intEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="natural_numberEquality">
+  <m:ci>natural_numberEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="minusEquality">
+  <m:ci>minusEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="addEquality">
+  <m:ci>addEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="subtractEquality">
+  <m:ci>subtractEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="multiplyEquality">
+  <m:ci>multiplyEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="divideFormation">
+  <m:ci>divideFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="addEquality">
+  <m:ci>addEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="subtractEquality">
+  <m:ci>subtractEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="multiplyEquality">
+  <m:ci>multiplyEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="divideEquality">
+  <m:ci>divideEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="remainderBounds1">
+  <m:ci>remainderBounds1</m:ci>
+</xsl:template>
+
+<xsl:template match="remainderBounds2">
+  <m:ci>remainderBounds2</m:ci>
+</xsl:template>
+
+<xsl:template match="remainderBounds3">
+  <m:ci>remainderBounds3</m:ci>
+</xsl:template>
+
+<xsl:template match="remainderBounds4">
+  <m:ci>remainderBounds4</m:ci>
+</xsl:template>
+
+<xsl:template match="divideRemainderSum">
+  <m:ci>divideRemainderSum</m:ci>
+</xsl:template>
+
+<xsl:template match="arith">
+  <m:apply>
+    <m:ci>arith</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="indEquality">
+  <m:apply>
+    <m:ci>indEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="intElimination">
+  <m:apply>
+    <m:ci>intElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="indReduceDown">
+  <m:ci>indReduceDown</m:ci>
+</xsl:template>
+
+<xsl:template match="indReduceUp">
+  <m:ci>indReduceUp</m:ci>
+</xsl:template>
+
+<xsl:template match="indReduceBase">
+  <m:ci>indReduceBase</m:ci>
+</xsl:template>
+
+<xsl:template match="ind_eqEquality">
+  <m:ci>ind_eqEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="ind_eqReduceTrue">
+  <m:ci>ind_eqReduceTrue</m:ci>
+</xsl:template>
+
+<xsl:template match="ind_eqReduceFalse">
+  <m:ci>ind_eqReduceFalse</m:ci>
+</xsl:template>
+
+<xsl:template match="lessEquality">
+  <m:ci>lessEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="lessReduceTrue">
+  <m:ci>lessReduceTrue</m:ci>
+</xsl:template>
+
+<xsl:template match="lessReduceFalse">
+  <m:ci>lessReduceFalse</m:ci>
+</xsl:template>
+
+<xsl:template match="less_thanEquality">
+  <m:ci>less_thanEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="less_thanFormation">
+  <m:ci>less_thanFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="less_thanMember">
+  <m:ci>less_thanMember</m:ci>
+</xsl:template>
+
+<xsl:template match="listFormation">
+  <m:ci>listFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="listEquality">
+  <m:ci>listEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="nilEquality">
+  <m:apply>
+    <m:ci>nilEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="nilFormation">
+  <m:apply>
+    <m:ci>nilFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="consFormation">
+  <m:ci>consFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="consEquality">
+  <m:ci>consEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="list_indEquality">
+  <m:apply>
+    <m:ci>list_indEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="listElimination">
+  <m:apply>
+    <m:ci>listElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="list_indReduceUp">
+  <m:ci>list_indReduceUp</m:ci>
+</xsl:template>
+
+<xsl:template match="list_indReduceBase">
+  <m:ci>list_indReduceBase</m:ci>
+</xsl:template>
+
+<xsl:template match="recEquality">
+  <m:apply>
+    <m:ci>recEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="rec_memberEquality">
+  <m:apply>
+    <m:ci>rec_memberEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="rec_memberFormation">
+  <m:apply>
+    <m:ci>rec_memberFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="rec_indEquality">
+  <m:apply>
+    <m:ci>rec_indEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="recElimination">
+  <m:apply>
+    <m:ci>recElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="recUnrollElimination">
+  <m:apply>
+    <m:ci>recUnrollElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_setFormation">
+  <m:apply>
+    <m:ci>dependent_setFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_setFormation">
+  <m:ci>independent_setFormation</m:ci>
+</xsl:template>
+
+<xsl:template match="setEquality">
+  <m:apply>
+    <m:ci>setEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_set_memberEquality">
+  <m:apply>
+    <m:ci>dependent_set_memberEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="dependent_set_memberFormation">
+  <m:apply>
+    <m:ci>dependent_set_memberFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="independent_set_memberEquality">
+  <m:ci>independent_set_memberEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="independent_set_memberFormation">
+  <m:apply>
+    <m:ci>independent_set_memberFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="setElimination">
+  <m:apply>
+    <m:ci>setElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="isectFormation">
+  <m:apply>
+    <m:ci>isectFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="isectEquality">
+  <m:apply>
+    <m:ci>isectEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="isect_memberEquality">
+  <m:apply>
+    <m:ci>isect_memberEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="isect_memberFormation">
+  <m:apply>
+    <m:ci>isect_memberFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="isect_member_caseEquality">
+  <m:apply>
+    <m:ci>isect_member_caseEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="isectElimination">
+  <m:apply>
+    <m:ci>isectElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotientFormation">
+  <m:apply>
+    <m:ci>quotientFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotientWeakEquality">
+  <m:apply>
+    <m:ci>quotientWeakEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotientEquality">
+  <m:ci>quotientEquality</m:ci>
+</xsl:template>
+
+<xsl:template match="quotient_memberWeakEquality">
+  <m:apply>
+    <m:ci>quotient_memberWeakEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotient_memberFormation">
+  <m:apply>
+    <m:ci>quotient_memberFormation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotient_memberEquality">
+  <m:apply>
+    <m:ci>quotient_memberEquality</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotient_equalityElimination">
+  <m:apply>
+    <m:ci>quotient_equalityElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotientElimination">
+  <m:apply>
+    <m:ci>quotientElimination</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="quotientElimination_2">
+  <m:apply>
+    <m:ci>quotientElimination_2</m:ci>
+    <m:cn> 
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="direct_computation">
+  <m:apply>
+    <m:ci>direct_computation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="reverse_direct_computation">
+  <m:apply>
+    <m:ci>reverse_direct_computation</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="direct_computation_hypothesis">
+  <m:apply>
+    <m:ci>direct_computation_hypothesis</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="reverse_direct_computation_hypothesis">
+  <m:apply>
+    <m:ci>reverse_direct_computation_hypothesis</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="ruleinstance/hypothesis">
+  <m:apply>
+    <m:ci>hypothesis</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="thin">
+  <m:apply>
+    <m:ci>thin</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="cut">
+  <m:apply>
+    <m:ci>cut</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="hyp_replacement">
+  <m:apply>
+    <m:ci>hyp_replacement</m:ci>
+    <m:cn>
+      <xsl:value-of select="@number_hyp"/>
+    </m:cn>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="lemma">
+  <m:apply>
+    <m:ci>lemma</m:ci>
+    <m:ci>
+      <xsl:value-of select="@name"/>
+    </m:ci>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="extract">
+  <m:apply>
+    <m:ci>extract</m:ci>
+    <m:ci>
+      <xsl:value-of select="@name"/>
+    </m:ci>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="instantiate">
+  <m:apply>
+    <m:ci>instantiate</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="because">
+  <m:ci>because</m:ci>
+</xsl:template>
+
+<xsl:template match="rename">
+  <m:apply>
+    <m:ci>rename</m:ci>
+    <xsl:apply-templates/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="introduction">
+  <m:apply>
+    <m:ci>introducition</m:ci>
+    <xsl:apply-templates/> 
+  </m:apply>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_term.xsl b/helm/nuprl_stylesheets/nuprl_term.xsl
new file mode 100644 (file)
index 0000000..1bd02c9
--- /dev/null
@@ -0,0 +1,598 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+<xsl:include href="nuprl_proof.xsl"/>
+<xsl:include href="nuprl_abstract.xsl"/>
+<xsl:include href="nuprl_rules.xsl"/>
+
+<!-- NuPrl Term -->
+<xsl:template match="var">
+  <m:ci>
+    <xsl:value-of select="@val"/>
+  </m:ci>
+</xsl:template>
+
+
+<xsl:template match="function">
+  <xsl:choose>
+  <xsl:when test="type_of">
+    <xsl:choose>
+    <xsl:when test="type_of/@var=&quot;&quot;">
+    <m:apply>
+      <m:csymbol>arrow</m:csymbol>
+      <xsl:apply-templates select="type_of/*"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:when>
+  <xsl:otherwise>
+    <m:apply>
+      <m:csymbol>prod</m:csymbol>
+      <m:bvar>
+        <m:ci>
+         <xsl:value-of select="type_of/@var"/>
+       </m:ci>
+        <m:type>
+         <xsl:apply-templates select="type_of/*"/>
+       </m:type>
+      </m:bvar>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:otherwise>
+  </xsl:choose>
+  </xsl:when>
+  <xsl:otherwise>
+    <m:apply>
+      <m:csymbol>arrow</m:csymbol>
+      <xsl:apply-templates select="*[1]"/>
+      <xsl:apply-templates select="*[2]"/>
+    </m:apply>
+  </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="lambda">
+  <m:lambda>
+    <m:bvar>
+      <m:ci>
+        <xsl:value-of select="@binder"/>
+      </m:ci>
+    </m:bvar>
+    <xsl:apply-templates/>
+  </m:lambda>
+</xsl:template>
+
+
+<xsl:template match="apply">
+  <m:apply>
+    <m:csymbol>app</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="product">
+  <m:apply>
+    <xsl:choose>
+      <xsl:when test="type_of">
+        <xsl:choose>
+        <xsl:when test="type_of/@var=&quot;&quot;">
+          <m:csymbol>product_ind</m:csymbol>
+          <m:type>
+            <xsl:apply-templates select="type_of/*"/>
+          </m:type>
+        </xsl:when>
+        <xsl:otherwise>
+          <m:csymbol>product</m:csymbol>
+          <m:bvar>
+            <m:ci>
+             <xsl:value-of select="type_of/@var"/>
+           </m:ci>
+          <m:type>
+           <xsl:apply-templates select="type_of/*"/>
+         </m:type>
+          </m:bvar>
+        </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <m:csymbol>product_ind</m:csymbol>
+       <m:type>
+          <xsl:apply-templates select="*[1]"/>
+        </m:type>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="pair">
+  <m:apply>
+    <m:csymbol>pair</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="spread">
+  <m:apply>
+  <m:csymbol>mutcase</m:csymbol>
+  <m:csymbol>NONE</m:csymbol>
+  <xsl:apply-templates select="*[1]"/>
+  <m:piecewise>
+    <m:piece>
+      <xsl:apply-templates select="*[4]"/>
+      <m:apply>
+        <m:csymbol>pair</m:csymbol>
+        <xsl:apply-templates select="binder[1]"/>
+        <xsl:apply-templates select="binder[2]"/>
+      </m:apply>
+    </m:piece>
+  </m:piecewise>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="union">
+  <m:apply>
+    <m:csymbol>union</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="inl">
+  <m:apply>
+    <m:csymbol>inl</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="inr">
+  <m:apply>
+    <m:csymbol>inr</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="decide">
+  <m:apply>
+    <m:csymbol>mutcase</m:csymbol>
+    <m:csymbol>NONE</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <m:piecewise>
+    <m:piece>
+      <xsl:apply-templates select="*[3]"/>
+      <m:apply>
+        <m:csymbol>inl</m:csymbol>
+        <xsl:apply-templates select="binder[1]"/>
+      </m:apply>
+    </m:piece>
+    <m:piece>
+      <xsl:apply-templates select="*[5]"/>
+      <m:apply>
+        <m:csymbol>inr</m:csymbol>
+        <xsl:apply-templates select="binder[2]"/>
+      </m:apply>
+    </m:piece>
+    </m:piecewise>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="universe">
+  <m:apply>
+    <m:csymbol>universe</m:csymbol>
+    <m:cn>
+      <xsl:value-of select="@level"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="equal">
+  <m:apply>
+    <m:csymbol>equal</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+    <xsl:apply-templates select="*[3]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="axiom">
+  <m:apply>
+    <m:csymbol>Ax</m:csymbol>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="void">
+  <m:apply>
+    <m:csymbol>void</m:csymbol>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="any">
+  <m:apply>
+    <m:csymbol>mutcase</m:csymbol>
+    <m:csymbol>NONE</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="atom">
+  <m:apply>
+    <m:csymbol>atom</m:csymbol>  
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="token">
+  <m:apply>
+    <m:csymbol>token</m:csymbol>
+    <m:ci>
+      <xsl:value-of select="@val"/>
+    </m:ci>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="atom_eq">
+  <m:apply>
+    <m:csymbol>if_then_else</m:csymbol>
+    <m:where>atom_eq</m:where>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+    <xsl:apply-templates select="*[3]"/>
+    <xsl:apply-templates select="*[4]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="int">
+  <m:integers/>
+</xsl:template>
+
+
+<xsl:template match="natural_number">
+  <m:cn>
+    <xsl:value-of select="@val"/>
+  </m:cn>
+</xsl:template>
+
+
+<xsl:template match="minus">
+  <m:apply>
+    <m:minus/>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="add">
+  <m:apply>
+    <m:plus/>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="subtract">
+  <m:apply>
+    <m:minus/>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="multiply">
+  <m:apply>
+    <m:times/>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="divide">
+  <m:apply>
+    <m:divide/>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="remainder">
+  <m:apply>
+    <m:rem/>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="int_eq">
+  <m:apply>
+    <m:csymbol>if_then_else</m:csymbol>
+    <m:where>int_eq</m:where>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+    <xsl:apply-templates select="*[3]"/>
+    <xsl:apply-templates select="*[4]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="less">
+  <m:apply>
+    <m:csymbol>if_then_else</m:csymbol>
+    <m:where>less</m:where>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+    <xsl:apply-templates select="*[3]"/>
+    <xsl:apply-templates select="*[4]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="ind">
+  <m:apply>
+    <m:csymbol>by_induction</m:csymbol>
+    <m:ci>ind</m:ci>
+    <m:csymbol>NONE</m:csymbol>
+    <m:apply>   <!-- CASO BASE -->
+      <m:csymbol>inductive_case</m:csymbol>
+      <m:apply>
+        <m:csymbol>case_lhs</m:csymbol>
+       <m:ci>0</m:ci>
+      </m:apply>
+      <m:apply>
+        <m:csymbol>induction_hypothesis</m:csymbol>
+      </m:apply>
+      <xsl:apply-templates select="*[5]"/>
+    </m:apply>
+       
+    <m:apply> <!--CASO INDUTTIVO PER I NUMERI POSITIVI-->
+      <m:csymbol>inductive_case</m:csymbol>
+      <m:apply>
+        <m:csymbol>case_lhs</m:csymbol>
+       <m:ci>succ</m:ci>
+       <m:bvar>
+          <xsl:apply-templates select="*[6]"/> <!-- u -->
+         <m:type>int</m:type>
+       </m:bvar>
+      </m:apply>
+      <m:apply>
+        <m:csymbol>induction_hypothesis</m:csymbol>
+        <xsl:apply-templates select="*[7]"/> <!-- v  -->
+      </m:apply>
+      <xsl:apply-templates select="*[8]"/> <!-- t -->
+    </m:apply>
+
+    <m:apply> <!--CASO INDUTTIVO PER I NUMERI NEGATIVI-->
+      <m:csymbol>inductive_case</m:csymbol>
+      <m:apply>
+        <m:csymbol>case_lhs</m:csymbol>
+       <m:ci>pred</m:ci>
+       <m:bvar>
+          <xsl:apply-templates select="*[2]"/> <!-- x -->
+         <m:type>int</m:type>
+       </m:bvar>
+      </m:apply>
+      <m:apply>
+        <m:csymbol>induction_hypothesis</m:csymbol>
+       <xsl:apply-templates select="*[3]"/> <!-- y -->
+      </m:apply>
+      <xsl:apply-templates select="*[4]"/>
+    </m:apply>
+    <m:apply> 
+      <m:csymbol>extra_args</m:csymbol>
+      <xsl:apply-templates select="*[1]"/>  <!-- a -->
+    </m:apply> 
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="less_than">
+  <m:apply>
+    <m:lt/>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="list">
+  <m:ci>list</m:ci>
+</xsl:template>
+
+
+<xsl:template match="nil">
+  <m:apply>
+    <m:csymbol>nil</m:csymbol> 
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="cons">
+  <m:apply>
+    <m:csymbol>cons</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="list_ind">
+  <m:apply>
+    <m:csymbol>by_induction</m:csymbol>
+    <m:ci>list_ind</m:ci>
+    <m:csymbol>NONE</m:csymbol>
+    <m:apply>
+      <m:csymbol>inductive_case</m:csymbol>
+      <m:apply>
+        <m:csymbol>case_lhs</m:csymbol>
+       <m:ci>nil</m:ci>
+      </m:apply>
+      <m:apply>
+        <m:csymbol>induction_hypothesis</m:csymbol>
+      </m:apply>
+      <xsl:apply-templates select="*[2]"/> <!-- base -->
+    </m:apply>
+    <m:apply>
+      <m:csymbol>inductive_case</m:csymbol>
+      <m:apply>
+        <m:csymbol>case_lhs</m:csymbol>
+       <m:ci>cons</m:ci>
+       <m:bvar>
+         <xsl:apply-templates select="*[3]"/> <!-- x -->
+         <m:type>?</m:type>
+        </m:bvar>
+        <m:bvar>
+       <xsl:apply-templates select="*[4]"/> <!-- l -->
+          <m:type>?</m:type>
+       </m:bvar>
+      </m:apply>
+      <m:apply>
+        <m:csymbol>induction_hypothesis</m:csymbol>
+        <xsl:apply-templates select="*[5]"/> <!-- Fxl -->
+      </m:apply>
+      <xsl:apply-templates select="*[6]"/> <!-- t -->
+    </m:apply>
+    <m:apply>
+      <m:csymbol>extra_args</m:csymbol>
+      <xsl:apply-templates select="*[1]"/> <!-- s -->
+    </m:apply>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="rec">
+  <m:apply>
+    <m:csymbol>rec</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="rec_ind">
+  <m:apply>
+    <m:csymbol>app</m:csymbol>
+    <m:apply>
+      <m:csymbol>fix</m:csymbol>
+      <m:ci>
+        <xsl:apply-templates select="*[2]"/>
+      </m:ci>
+      <m:bvar>
+        <m:ci>
+          <xsl:apply-templates select="*[2]"/>
+        </m:ci>
+        <m:type>?</m:type>
+      </m:bvar>
+      <m:lambda>
+        <m:bvar>
+         <xsl:apply-templates select="*[3]"/>
+        </m:bvar>
+        <xsl:apply-templates select="*[4]"/>
+      </m:lambda>
+    </m:apply>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="set">
+  <m:apply>
+    <m:csymbol>t_set</m:csymbol>
+    <m:bvar>
+      <xsl:choose>
+      <xsl:when test="type_of">
+        <m:ci>
+          <xsl:value-of select="type_of/@var"/>
+        </m:ci>
+        <m:type>
+          <xsl:apply-templates select="type_of/*"/>
+        </m:type>
+      </xsl:when>
+      <xsl:otherwise>
+        <m:type>
+          <xsl:apply-templates select="*[1]"/>
+        </m:type>
+      </xsl:otherwise>
+      </xsl:choose>
+    </m:bvar>
+    <xsl:apply-templates select="*[2]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="isect">
+  <m:apply>
+    <m:csymbol>isect</m:csymbol>
+    <m:bvar>
+      <m:ci>
+        <xsl:value-of select="type_of/@var"/>
+      </m:ci>  
+      <m:type>
+        <xsl:apply-templates select="type_of/*"/>
+      </m:type>
+    </m:bvar>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="quotient">
+  <m:apply>
+    <m:csymbol>quotient</m:csymbol>
+    <xsl:apply-templates select="*[1]"/>
+    <m:bvar>
+      <xsl:value-of select="binder[1]/@var"/>
+    </m:bvar>
+    <m:bvar>
+      <xsl:value-of select="binder[2]/@var"/>
+    </m:bvar>
+    <xsl:apply-templates select="*[4]"/>
+  </m:apply>
+</xsl:template>
+
+
+<xsl:template match="type_of">
+  <m:apply>
+    <m:csymbol>type_of</m:csymbol>
+    <m:ci>
+      <xsl:value-of select="@var"/>
+    </m:ci>
+    <xsl:apply-templates select="*[1]"/>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="prop">
+  <m:apply>
+    <m:csymbol>prop</m:csymbol>
+    <m:cn>
+      <xsl:value-of select="@level"/>
+    </m:cn>
+  </m:apply>
+</xsl:template>
+
+<xsl:template match="binder">
+  <m:ci>
+    <xsl:value-of select="@var"/>
+  </m:ci>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/nuprl_tree.xsl b/helm/nuprl_stylesheets/nuprl_tree.xsl
new file mode 100644 (file)
index 0000000..03daa47
--- /dev/null
@@ -0,0 +1,25 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                             xmlns:xlink="http://www.w3.org/1999/xlink">
+
+
+
+<xsl:template match="/">
+    <xsl:apply-templates select="*"/>
+</xsl:template>
+
+<xsl:template match="*|@*|text()">
+  <xsl:copy>
+   <xsl:apply-templates select="*|@*|text()"/>
+  </xsl:copy>
+</xsl:template>
+
+         
+<xsl:template match="body">
+    <xsl:for-each select="Node">
+      <xsl:attribute name="child" select="1"/>
+      <xsl:attribute name="brother" select="2"/>
+    </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/helm/nuprl_stylesheets/xslt_index.txt b/helm/nuprl_stylesheets/xslt_index.txt
new file mode 100644 (file)
index 0000000..11e49a8
--- /dev/null
@@ -0,0 +1,14 @@
+nuprl_abstract.xsl
+nuprl_proof.xsl
+nuprl_rules.xsl
+nuprl_term.xsl
+nuprl_content_to_html.xsl
+nuprl_content_to_html2.xsl
+nuprl_annotatedpres.xsl
+nuprl_mmlextension.xsl
+nuprl_expand.xsl
+nuprl_tree.xsl
+nuprl_link.xsl
+nuprl_links_library.xsl
+nuprl_html_arith.xsl
+nuprl_html_basic.xsl