]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/content_to_html.xsl
BUG LAMBDA fixed.
[helm.git] / helm / style / content_to_html.xsl
index cd17b6d4cd45f7c74b243de257ffac390b81cee8..5a48cc1ea49933cc3b3d492a119822d5c07f8353 100644 (file)
 
 <!--***********************************************************************--> 
 <!-- From MathML content to HTML                                           -->
-<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena, Guidi               -->
 <!--***********************************************************************--> 
 
-<xsl:param name="getterURL" select="'http://localhost:8081/'"/>
-<xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
-<xsl:param name="keys" select="'C1,HC2'"/>
-
-<xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getciconly?uri=</xsl:variable>
-
-<xsl:variable name="header"><xsl:value-of select="$processorURL"/>/apply?keys=<xsl:value-of select="$keys"/>&#x26;param.keys=<xsl:value-of select="$keys"/>&#x26;param.getterURL=<xsl:value-of select="$getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$processorURL"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
+<xsl:param name="CICURI" select="''"/>
+<xsl:param name="type" select="'standalone'"/>
 
 <xsl:include href="html_init.xsl"/>
 <xsl:include href="html_set.xsl"/>
 
 <xsl:variable name="showcast" select="0"/>
 
-
 <!--***********************************************************************-->
 <!-- HTML Head and Body                                                    -->
 <!--***********************************************************************-->
 
-<!-- <xsl:output method="html"/> -->
-<xsl:output method="html" encoding="iso-8859-1"/>
+<!-- <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="36"/>
+<xsl:variable name="framewidth" select="45"/>
 
 <xsl:template match="/">
  <xsl:param name="current_indent" select="0"/>
-               <html> 
-                <head>
-                 <style>
-                 A { text-decoration: none }
-                 </style>
-                </head>
-                <body bgcolor="white">
-                <xsl:apply-templates>
-                 <xsl:with-param name="current_indent" select="0"/>
-                </xsl:apply-templates>
-                </body>
-               </html>
+ <xsl:choose>
+  <xsl:when test="$type = 'standalone'">
+   <html> 
+      <head>
+        <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
+         <style> A { text-decoration: none } </style>
+      </head>
+      <body bgcolor="white">
+         <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>
 
 <!--***********************************************************************-->
 <xsl:template mode="inline" match="m:ci">
  <xsl:choose>
   <xsl:when test="boolean(@definitionURL)">
-   <a>
-   <xsl:attribute name="href">
-    <xsl:value-of select="concat(string($header),string(@definitionURL))"/>
-   </xsl:attribute>
+   <a href="{@definitionURL}">
    <xsl:apply-templates/>
    </a>
   </xsl:when>
     <xsl:when test="$name='arrow'">
      <xsl:text>(</xsl:text>
      <xsl:apply-templates mode="inline" select="*[position()=2]"/>
-     <FONT color="blue" FACE="symbol">
+     <FONT color="blue" SIZE="+0" FACE="symbol">
       <xsl:text>&#x00ae;</xsl:text>
      </FONT>
      <xsl:apply-templates mode="inline" select="*[position()=3]"/>
        </xsl:when> 
       </xsl:choose>
       <xsl:apply-templates mode="inline" select="."/>
-      <FONT FACE="Symbol" SIZE="+2" mathcolor="green">&#222;</FONT>
+      <FONT FACE="Symbol" SIZE="+0" mathcolor="green">&#222;</FONT>
       <xsl:apply-templates mode="inline"
            select="following-sibling::*[position()= 1]"/>
      </xsl:for-each>
        <FONT color="red">&#x00a0;proves&#x00a0;</FONT>
        <xsl:apply-templates mode="inline" select="*[position()=3]"/>
     </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>
-     <m:mtext>(</m:mtext>
+     (
      <xsl:apply-templates select="*[3]"/>
-     <m:mtext>)&#x00a0;</m:mtext>
+     )&#x00a0;
      <xsl:apply-templates mode="inline" select="*[4]"/>
      <FONT color="red">&#x00a0;and&#x00a0;</FONT>
-     <m:mtext>(</m:mtext>
+     (
      <xsl:apply-templates select="*[5]"/>
-     <m:mtext>)&#x00a0;</m:mtext>
+     )&#x00a0;
      <xsl:apply-templates mode="inline" select="*[6]"/>
-     <m:mtext>;</m:mtext>
+     ;
      <FONT color="red">&#x00a0;hence&#x00a0;</FONT>
      <xsl:apply-templates mode="inline" select="*[7]"/>
     </xsl:when>
+
+       <xsl:when test="$name='subst'">
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+       <xsl:text>[</xsl:text>
+       <xsl:apply-templates select="*[4]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ac;</xsl:text>
+       </FONT>
+       </a>
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <xsl:text>]</xsl:text>
+      </xsl:when>
+
+      <xsl:when test="$name='lift_with_base'">
+       <SUB>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+       </SUB>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ad;</xsl:text>
+       </FONT>
+       </a>
+       <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'">
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ad;</xsl:text>
+       </FONT>
+       </a>
+       <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"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ae;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='beta_red'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ae;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;*</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='par_beta_red1'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00de;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='par_beta_red'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00de;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;*</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <!-- forgetful -->
+      <xsl:when test="$name='forgetful'">
+       <a href="{*[1]/@definitionURL}">|</a>
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">|</a>
+      </xsl:when>
+      <!-- boolean algebra of redexes -->
+
+      <!-- isomorphic -->
+      <xsl:when test="$name='isomorphic'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+        <FONT color="green" FACE="symbol">
+        <xsl:text>&#x0040;</xsl:text>
+       </FONT>
+       </a>
+       <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>
 
          <xsl:text>:</xsl:text>
          <xsl:apply-templates select="m:bvar/m:type">
           <xsl:with-param name="current_indent" 
-           select="$current_indent + 2 + string-length(m:bvar/m:ci)"/>
+           select="$current_indent + 5 + 2*string-length(m:bvar/m:ci)"/>
          </xsl:apply-templates>
          <br/>
          <xsl:call-template name="make_indent">
          <xsl:text>:</xsl:text>
          <xsl:apply-templates select="m:bvar/m:type">
           <xsl:with-param name="current_indent" 
-           select="$current_indent + 2 + string-length(m:bvar/m:ci)"/>
+           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:with-param name="current_indent" select="$current_indent + 2"/> 
        </xsl:call-template>
        <!-- -> -->
-       <FONT color="blue" FACE="symbol">
+       <FONT color="blue" SIZE="+0" FACE="symbol">
         <xsl:text>&#x00ae;</xsl:text>
        </FONT>
        <xsl:apply-templates select="*[position()=3]">
           <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: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:with-param name="current_indent" select="$current_indent + 2"/> 
          </xsl:call-template> 
             <xsl:choose>
             <xsl:when test="position() = 1">
             </xsl:otherwise>
             </xsl:choose>
             <xsl:apply-templates select="."/>
-            <FONT FACE="Symbol" SIZE="+2" mathcolor="green">&#222;</FONT>
-            <xsl:apply-templates select="following-sibling::*[position()= 1]">
-             <xsl:with-param name="current_indent" select="$current_indent + 4 + string-length()"/>
-            </xsl:apply-templates>
+            <FONT FACE="Symbol" SIZE="+0" mathcolor="green">&#222;</FONT>
+            <xsl:variable name="body_size">
+             <xsl:apply-templates 
+              select="following-sibling::*[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="following-sibling::*[position()= 1]">
+              <xsl:with-param name="current_indent" 
+                   select="$current_indent + 8"/>      
+             </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+             <xsl:apply-templates select="following-sibling::*[position()= 1]"
+                   mode="inline" />
+            </xsl:otherwise>
+           </xsl:choose>
          </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
        </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 ************** -->
       <!-- ***************************************** -->
       </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:with-param name="current_indent" select="$current_indent + 7"/>
        </xsl:apply-templates>
          <xsl:apply-templates select="*[2]"/>
         </xsl:otherwise>
        </xsl:choose>
+       <xsl:variable name="charlength_first">
+        <xsl:apply-templates select="*[3]/*[1]" mode="charcount"/>
+       </xsl:variable>
+       <xsl:variable name="charlength_second">
+        <xsl:apply-templates select="*[4]/*[1]" mode="charcount"/>
+       </xsl:variable>
+       <xsl:variable name="charlength_side_proof">
+        <xsl:apply-templates select="*[5]/*[1]" mode="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="$charlength"/> -->
        <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 select="*[3]"/>
-       <FONT color="red">&#x00a0;with&#x00a0;</FONT>
-       <xsl:apply-templates select="*[4]"/>
-       <FONT color="red">&#x00a0;by&#x00a0;</FONT>
-       <xsl:apply-templates select="*[5]"/>
+       <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'">
        <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>
+      <!-- nat_ind -->
+      <xsl:when test="$name='nat_ind_complete'">
+       <FONT color="red">By induction on&#x00a0;</FONT>
+       <xsl:apply-templates select="*[2]"/>:
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:call-template>
+       <xsl:text>0&#x00a0;</xsl:text>
+       <FONT FACE="Symbol" mathcolor="green">&#222;</FONT>
+       <xsl:apply-templates select="*[3]">
+        <xsl:with-param name="current_indent" select="$current_indent + 8"/>
+       </xsl:apply-templates>
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent"/> 
+       </xsl:call-template>
+       <xsl:text>S(</xsl:text>
+       <xsl:apply-templates select="*[4]"/>
+       <xsl:text>)&#x00a0;</xsl:text>
+       <FONT FACE="Symbol" mathcolor="green">&#222;</FONT>
+       <FONT color="red">Assume by induction</FONT>
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent +10"/> 
+       </xsl:call-template>
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[5]"/>
+       <xsl:text>)</xsl:text>
+       <xsl:apply-templates select="*[6]">
+        <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 +10"/> 
+       </xsl:call-template>
+       <xsl:apply-templates select="*[7]">
+        <xsl:with-param name="current_indent" select="$current_indent + 10"/>
+       </xsl:apply-templates>
+      </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:call-template name="make_indent">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:call-template>
-       <m:mtext>(</m:mtext>
+       (
        <xsl:apply-templates select="*[3]"/>
-       <m:mtext>)&#x00a0;</m:mtext>
+       )&#x00a0;
        <xsl:apply-templates select="*[4]">
         <xsl:with-param name="current_indent" select="$current_indent + 9"/> 
        </xsl:apply-templates>
        <xsl:call-template name="make_indent">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:call-template>
-       <m:mtext>(</m:mtext>
+       (
        <xsl:apply-templates select="*[5]"/>
-       <m:mtext>)&#x00a0;</m:mtext>
+       )&#x00a0;
        <xsl:apply-templates select="*[6]">
         <xsl:with-param name="current_indent" select="$current_indent + 9"/> 
        </xsl:apply-templates>
         <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:call-template name="make_indent">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:call-template>
-       <m:mtext>*</m:mtext>
+       *
        <xsl:apply-templates select="*[4]">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:apply-templates>
        <xsl:call-template name="make_indent">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:call-template>
-       <m:mtext>*</m:mtext>
+       *
        <xsl:apply-templates select="*[5]">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:apply-templates>
        </xsl:call-template>
        <FONT color="red">Let&#x00a0;</FONT>
        <xsl:apply-templates mode="inline" select="*[3]"/>
-       <m:mtext>:</m:mtext>
+       :
        <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>
-       <m:mtext>(</m:mtext>
+       (
        <xsl:apply-templates mode="inline" select="*[5]"/>
-       <m:mtext>)</m:mtext>
+       )
        <xsl:apply-templates select="*[6]">
         <xsl:with-param name="current_indent" select="$current_indent +7"/>
        </xsl:apply-templates>
         <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]"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="blue" SIZE="+0" FACE="symbol">
+        <xsl:text>&#x00ac;</xsl:text>
+       </FONT>
+       </a>
+       <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>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ad;</xsl:text>
+       </FONT>
+       </a>
+       <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'">
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ad;</xsl:text>
+       </FONT>
+       </a>
+       <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"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ae;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+      <xsl:when test="$name='beta_red'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00ae;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;*</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='par_beta_red1'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00de;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <xsl:when test="$name='par_beta_red'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+       <FONT color="green" FACE="symbol">
+        <xsl:text>&#x00de;</xsl:text>
+       </FONT>
+       <SUB>
+        <FONT color="green" FACE="symbol">
+         <xsl:text>&#x0062;*</xsl:text>
+        </FONT>
+       </SUB>
+       </a>
+       <xsl:apply-templates select="*[3]" mode="inline"/>
+      </xsl:when>
+
+      <!-- forgetful -->
+      <xsl:when test="$name='forgetful'">
+       <a href="{*[1]/@definitionURL}">|</a>
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">|</a>
+      </xsl:when>
+      <!-- boolean algebra of redexes -->
+
+      <!-- isomorphic -->
+      <xsl:when test="$name='isomorphic'">
+       <xsl:apply-templates select="*[2]" mode="inline"/>
+       <a href="{*[1]/@definitionURL}">
+        <FONT color="green" FACE="symbol">
+        <xsl:text>&#x0040;</xsl:text>
+       </FONT>
+       </a>
+       <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>
 
        <xsl:text>:</xsl:text>
        <xsl:apply-templates select="m:bvar/m:type">
         <xsl:with-param name="current_indent" 
-           select="$current_indent + 2 + string-length(m:bvar/m:ci)"/>
+           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:template match="m:ci">
  <xsl:choose>
   <xsl:when test="boolean(@definitionURL)">
-   <a>
-   <xsl:attribute name="href">
-    <xsl:value-of select="concat(string($header),string(@definitionURL))"/>
-   </xsl:attribute>
+   <a href="{@definitionURL}">
    <xsl:apply-templates/>
    </a>
   </xsl:when>
@@ -1003,10 +1560,10 @@ PROOF:
          <xsl:text>| </xsl:text>
          </xsl:otherwise>
          </xsl:choose>
-         <xsl:value-of select="./@name"/> 
+         <xsl:value-of select="./@name"/>
          <xsl:text>: </xsl:text>
          <xsl:apply-templates select="./*[1]">
-          <xsl:with-param name="current_indent" select="$current_indent + string-length(./@name) + 4"/>
+          <xsl:with-param name="current_indent" select="$current_indent + 2*string-length(./@name) + 5"/>
          </xsl:apply-templates>
       </xsl:for-each>
      </xsl:for-each>