]> matita.cs.unibo.it Git - helm.git/commitdiff
Notation for if then else.
authorAndrea Asperti <andrea.asperti@unibo.it>
Thu, 5 Dec 2002 14:43:30 +0000 (14:43 +0000)
committerAndrea Asperti <andrea.asperti@unibo.it>
Thu, 5 Dec 2002 14:43:30 +0000 (14:43 +0000)
Other bug fixes.

helm/style/content.xsl
helm/style/content_to_html.xsl
helm/style/html_init.xsl
helm/style/inductive.xsl
helm/style/ite.xsl [new file with mode: 0644]
helm/style/logic.xsl
helm/style/mmlextension.xsl
helm/style/proofs.xsl
helm/style/xslt_index.txt

index f2f7b713a5e1bef33f48793fcdc74cdbfbe81a59..1be668bb0502ecfd3f1a61ccf81adfeb2a6f381b 100644 (file)
@@ -37,6 +37,7 @@
                               xmlns:helm="http://www.cs.unibo.it/helm">
 
 <xsl:include href="params.xsl"/>
+<xsl:include href="ite.xsl"/>
 <!-- adesso sono preprocessate -->
 <!-- <xsl:include href="coercions.xsl"/> -->
 
index 21b663942dfd10528de197b42ef9dfca984a688b..1a66b86dd489cf8280e0d4a870afcf4abdec3717 100644 (file)
 
 <xsl:template name="make_indent">
  <xsl:param name="current_indent" select="0"/>
+ <!-- non funziona bene con netscape !!! 
+ <span>
+  <xsl:attribute name="style">
+   <xsl:value-of select="concat('margin-left:',string($current_indent div 3), 'em')"/>
+  </xsl:attribute>
+ </span> -->
   <xsl:if test="$current_indent > 0">
    <xsl:text>&#x00a0;</xsl:text>
    <xsl:call-template name="make_indent">
       </xsl:choose>
      </xsl:for-each>
     </xsl:when>
+    <!-- if then else -->
+    <xsl:when test="$name='ite'">
+     <xsl:text>if </xsl:text> 
+     <xsl:apply-templates select="*[2]"/>
+     <xsl:text> then </xsl:text>
+     <xsl:apply-templates select="*[3]"/>
+     <xsl:text> else </xsl:text>
+     <xsl:apply-templates select="*[4]"/>
+    </xsl:when>
     <!-- proof and side_proof -->
     <xsl:when test="$name='proof' or $name='side_proof'">
        <xsl:apply-templates mode="inline" select="*[position()=2]"/>
         <xsl:with-param name="current_indent" select="$current_indent+5"/>
        </xsl:apply-templates>
       </xsl:when>
+      <!-- it then else -->
+      <xsl:when test="$name='ite'">
+       <xsl:text>if </xsl:text> 
+       <xsl:apply-templates select="*[2]">
+        <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+       </xsl:apply-templates> 
+       <BR/> 
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
+       </xsl:call-template>
+       <xsl:text> then </xsl:text>
+       <xsl:apply-templates select="*[3]">
+        <xsl:with-param name="current_indent" select="$current_indent + 12"/>
+       </xsl:apply-templates>
+       <BR/> 
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
+       </xsl:call-template>
+       <xsl:text> else </xsl:text>
+       <xsl:apply-templates select="*[4]">
+        <xsl:with-param name="current_indent" select="$current_indent + 12"/> 
+       </xsl:apply-templates>
+      </xsl:when>
 
       <!-- ***************************************** -->
       <!-- *********** PROOF ELEMENTS ************** -->
index 46fc61b249fa71842a62649809165a69ed6896c4..91d978f5c5202d177d4ff20e494892fb54a455c0 100644 (file)
  </xsl:template>
 
 
-
-
 <!-- COUNTING -->
 
 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:neq
index 4066d4be3e289a76395cbd556adb8d4bb76b853a..21f16d7a4dbad930062197543237fc44b81070fe 100644 (file)
  <xsl:param name="arg_types" select="/.."/>
  <xsl:param name="actual_args" select="/.."/>
  <xsl:param name="bool_var" select="true()"/>
+ <!-- <xsl:value-of select="false()"/> -->
  <xsl:choose>
   <xsl:when test="count($arg_types) = 0">
     <xsl:value-of select="$bool_var"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:variable name="no_expected_arg_of_arg" 
-                 select="count($arg_types[1]/PROD/decl)"/>
+                 select="count($arg_types[1]/decl)"/>
    <xsl:variable name="no_actual_abst_of_arg" 
-                 select="count($actual_args[1]/LAMBDA/decl)"/> 
+                 select="count($actual_args[1]/decl)"/> 
    <xsl:variable name="test_arg" 
-    select="$no_actual_abst_of_arg >= $no_expected_arg_of_arg"/> 
+    select="($no_actual_abst_of_arg >= $no_expected_arg_of_arg)"/> 
    <xsl:call-template name="check_args">
     <xsl:with-param name="arg_types" select="$arg_types[position()>1]"/>
     <xsl:with-param name="actual_args" select="$actual_args[position()>1]"/>
diff --git a/helm/style/ite.xsl b/helm/style/ite.xsl
new file mode 100644 (file)
index 0000000..1b0e14a
--- /dev/null
@@ -0,0 +1,48 @@
+<?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/.                                         -->
+
+<!--******************************************************************--> 
+<!-- If the else                                                      -->
+<!-- (completely) Revisited: november 2002, Andrea Asperti            -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, 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:template match="MUTCASE[@uriType='cic:/Coq/Init/Datatypes/bool.ind']" mode="pure">
+    <m:apply helm:xref="{@id}">
+     <m:csymbol>ite</m:csymbol>
+     <xsl:apply-templates select="inductiveTerm/*[1]" mode="pure"/>
+     <xsl:apply-templates select="pattern/*[1]" mode="noannot"/>
+     <xsl:apply-templates select="pattern/*[2]" mode="noannot"/>
+    </m:apply>
+</xsl:template>
+
+</xsl:stylesheet>
+
+
index 0685f47b0da8f521378c7e260c558c27cceb8d59..0a261260a23154adcc6e268121f27d7abc7bde3f 100644 (file)
@@ -47,7 +47,7 @@
 <xsl:template mode="proof_transform" match="APPLY[CONST[
  attribute::uri='cic:/Coq/Init/Logic/and_ind.con'] and 
  count(child::*) = 6 and name(*[5])='LAMBDA' and 
- count(*[5]/decl) = 2]">
+ count(*[5]/decl) >= 2]">
   <xsl:variable name="id" select="@id"/>
   <m:apply helm:xref="{@id}">
    <m:csymbol>and_ind</m:csymbol>
    <xsl:apply-templates mode="pure" select="*[5]/*[1]/*"/>
    <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/*[2]/@binder"/></xsl:with-param></xsl:call-template></m:ci>
    <xsl:apply-templates mode="pure" select="*[5]/*[2]/*"/>
-   <xsl:apply-templates mode="noannot" select="*[5]/target/*"/> 
+   <xsl:choose>
+    <xsl:when test="count(*[5]/decl) = 2">
+     <xsl:apply-templates mode="noannot" select="*[5]/target/*"/>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="*[5]/*[3]" mode="lambda_prop"/>
+    </xsl:otherwise>
+   </xsl:choose> 
   </m:apply>
 </xsl:template>
 
 -->
 </xsl:template> 
 
+
 <xsl:template mode="proof_transform" match="APPLY[CONST[
  attribute::uri='cic:/Coq/Init/Logic_Type/exT_ind.con' or
  attribute::uri='cic:/Coq/Init/Logic/First_order_quantifiers/ex_ind.con'] and
  count(child::*) = 6 and
- name(*[5])='LAMBDA' and count(*[5]/decl) = 2 ]">
+ name(*[5])='LAMBDA' and count(*[5]/decl) >= 2 ]">
   <xsl:variable name="id" select="@id"/>
    <m:apply helm:xref="{@id}">
     <m:csymbol>ex_ind</m:csymbol>
     <xsl:apply-templates mode="pure" select="*[5]/*[1]/*"/>
     <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/*[2]/@binder"/></xsl:with-param></xsl:call-template></m:ci>
     <xsl:apply-templates mode="pure" select="*[5]/*[2]/*"/>
-    <xsl:apply-templates mode="proof_transform" select="*[5]/target/*"/>
+    <xsl:choose>
+     <xsl:when test="count(*[5]/decl) > 2">
+      <xsl:apply-templates mode="lambda_prop" select="*[5]/decl[3]"/>
+     </xsl:when>
+     <xsl:otherwise>     
+      <xsl:apply-templates mode="proof_transform" select="*[5]/target/*"/>
+     </xsl:otherwise>
+    </xsl:choose>
    </m:apply>
 </xsl:template>
 
+
 </xsl:stylesheet>
 
+
index 31b8c766a42684d864835381075492cab4271ef0..8757d0023788c2233bad2756a498201c79c34513 100644 (file)
@@ -1121,6 +1121,49 @@ which generates the toplevel element (see for instance xlink) -->
         <m:mo stretchy="false">}</m:mo>
        </m:mrow>
       </xsl:when>
+      <!-- ITE -->
+      <xsl:when test="$name='ite'">
+       <xsl:choose>
+        <xsl:when test="$charlength >= $framewidth">
+         <m:mtable align="baseline 1" equalrows="false" columnalign="left">
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <m:mo>if</m:mo>
+             <xsl:apply-templates select="*[2]"/>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <m:mo>then</m:mo>
+             <xsl:apply-templates select="*[3]"/>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+          <m:mtr>
+           <m:mtd>
+            <m:mrow>
+             <m:mo>else</m:mo>
+             <xsl:apply-templates select="*[4]"/>
+            </m:mrow>
+           </m:mtd>
+          </m:mtr>
+         </m:mtable>
+        </xsl:when>
+        <xsl:otherwise>
+         <m:mrow>
+          <m:mo>if</m:mo>
+          <xsl:apply-templates select="*[2]"/>
+          <m:mo>then</m:mo>
+          <xsl:apply-templates select="*[3]"/>
+          <m:mo>else</m:mo>
+          <xsl:apply-templates select="*[4]"/>
+         </m:mrow>
+        </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
       <!-- ***************************************** -->
       <!-- *********** PROOF ELEMENTS ************** -->
       <!-- ***************************************** -->
index 78efb9cb18ecd64775f9bb6ba16e8f73374f9f20..65de766d1bb65d787267518f7509cd57a92fcdfc 100644 (file)
   </xsl:for-each>
  </xsl:variable>
  <xsl:choose>
-  <xsl:when test="name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX' or ((name(.)='REL' or name(.)='VAR' or name(.)='META' or name(.)='CONST' or name(.)='MUTCONSTRUCT') and $innertype_available='yes')">
+  <xsl:when test="@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX' or ((name(.)='REL' or name(.)='VAR' or name(.)='META' or name(.)='CONST' or name(.)='MUTCONSTRUCT') and $innertype_available='yes'))">
    <m:apply>
     <m:csymbol>let</m:csymbol>
     <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',$init_pos)"/></xsl:with-param></xsl:call-template></m:ci>
index 9b3260cbfdb885b480a57a21adbb7e450f1493a8..84cd46836415e92effcaf99248b3c8a84feba752 100644 (file)
@@ -13,6 +13,7 @@ html_init.xsl
 html_reals.xsl
 html_set.xsl
 inductive.xsl
+ite.xsl
 lambda.xsl
 link.xsl
 links_library.xsl