]> matita.cs.unibo.it Git - helm.git/commitdiff
Branch V7_3_new_exportation merged.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 19 Jan 2004 15:13:45 +0000 (15:13 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 19 Jan 2004 15:13:45 +0000 (15:13 +0000)
33 files changed:
helm/meta_style/.cvsignore
helm/meta_style/Makefile
helm/meta_style/algebra.xml
helm/meta_style/arith.xml
helm/meta_style/basic.xml
helm/meta_style/list.xml [new file with mode: 0644]
helm/meta_style/meta_cic2mathml.xsl
helm/meta_style/positive.xsl
helm/meta_style/set.xml
helm/meta_style/xslt_index.txt
helm/style/annotatedcont.xsl
helm/style/content.xsl
helm/style/content_to_html.xsl
helm/style/diseq.xsl [new file with mode: 0644]
helm/style/drop_coercions.xsl
helm/style/headercontent.xsl
helm/style/html_init.xsl
helm/style/inductive.xsl
helm/style/ite.xsl [new file with mode: 0644]
helm/style/link.xsl
helm/style/logic.xsl [new file with mode: 0644]
helm/style/mk_meta_and_dep_graph.xsl
helm/style/mk_meta_theory.xsl
helm/style/mmlctop.xsl
helm/style/mmlextension.xsl
helm/style/mmlnotation.xsl
helm/style/objcontent.xsl
helm/style/objtheorycontent.xsl
helm/style/params.xsl
helm/style/proofs.xsl
helm/style/rewrite.xsl [new file with mode: 0644]
helm/style/ring.xsl
helm/style/xslt_index.txt

index b88948804d28848817afc3dd935d27ab05fbb20c..b20cfb2817d1ffc6de11bd83cf39dbbea3ad3fda 100644 (file)
@@ -3,3 +3,4 @@ arith.xsl
 basic.xsl
 reals.xsl
 set.xsl
+list.xsl
index c0e5fc6456279d5bc5df3c81b173e8f85cbef79b..f51cc8094f58e1f1a4fe384203a5c1a28e0b0e71 100644 (file)
@@ -1,14 +1,14 @@
 XSLTPROC = xsltproc --timing
 FORMAT = xmllint --format
 SUBST = ./subst.pl
-METASTYLESHEET = meta_cic2mathml.xsl
-TMP1 = /tmp/.tmpfile1
-TMP2 = /tmp/.tmpfile2
+METASTYLESHEET = ./meta_cic2mathml.xsl
+TMP1 = .tmpfile1
+TMP2 = .tmpfile2
 
-all: algebra.xsl arith.xsl basic.xsl reals.xsl set.xsl
+all: algebra.xsl arith.xsl basic.xsl reals.xsl set.xsl list.xsl
 
 clean:
-       rm -f algebra.xsl arith.xsl basic.xsl reals.xsl set.xsl
+       rm -f algebra.xsl arith.xsl basic.xsl reals.xsl set.xsl list.xsl
 
 algebra.xsl: algebra.xml $(METASTYLESHEET)
        @echo "**** PROCESSING algebra.xml ****"
@@ -54,3 +54,12 @@ set.xsl: set.xml $(METASTYLESHEET)
        @rm $(TMP1)
        @$(SUBST) oxsl: xsl: set.xsl
        @$(SUBST) xmlns:oxsl xmlns:xsl set.xsl
+
+list.xsl: list.xml $(METASTYLESHEET)
+       @echo "**** PROCESSING list.xml ****"
+       @$(XSLTPROC) $(METASTYLESHEET) list.xml > $(TMP1)
+       @$(FORMAT) $(TMP1) > $(TMP2)
+       @mv $(TMP2) list.xsl
+       @rm $(TMP1)
+       @$(SUBST) oxsl: xsl: list.xsl
+       @$(SUBST) xmlns:oxsl xmlns:xsl list.xsl
index 119effa3da0aef63c21d8aa58bbb76700e55211e..696a19a1b1ff9946ff807753ba0e9800ae8c99db 100644 (file)
@@ -1,33 +1,34 @@
 <!DOCTYPE OpList SYSTEM "operator.dtd">
 
-<OpList xmlns:m="http://www.w3.org/1998/Math/MathML">
+<OpList xmlns:m="http://www.w3.org/1998/Math/MathML"
+        xmlns:helm="http://www.cs.unibo.it/helm">
 
 <!-- Unary Operations -->
 
 <Operator
  name  = "0"
- uri   = "cic:/Algebra/CSemiGroups/csg_unit.con"
+ uri   = "cic:/Algebra/algebra/CSemiGroups/csg_unit.con"
  arity = "1">
        <mop tag="ci" helm:xref="$APP-ID">0</mop>
 </Operator>
 
 <Operator
  name  = "1"
- uri   = "cic:/Algebra/CRings/cr_one.con"
+ uri   = "cic:/Algebra/algebra/CRings/cr_one.con"
  arity = "1">
        <mop tag="ci" helm:xref="$APP-ID">1</mop>
 </Operator>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CGroups/cg_inv.con"
+ uri   = "cic:/Algebra/algebra/CGroups/cg_inv.con"
  hide  = "1"
  arity = "1"
  m-tag = "minus"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CMetricFields/CMetric_Fields/cmf_abs.con"
+ uri   = "cic:/Algebra/reals/CMetricFields/cmf_abs.con"
  hide  = "1"
  arity = "2"
  m-tag = "abs"/>
 
 <Operator
  name  = "SETOID EQUALITY"
- uri   = "cic:/Algebra/CSetoids/cs_eq.con"
+ uri   = "cic:/Algebra/algebra/CSetoids/cs_eq.con"
  hide  = "1"
  arity = "2"
  m-tag = "eq"/>
 
 <Operator
  name  = "APART"
- uri   = "cic:/Algebra/CSetoids/cs_ap.con"
+ uri   = "cic:/Algebra/algebra/CSetoids/cs_ap.con"
  hide  = "1"
  arity = "2"
  m-tag = "neq"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/COrdFields/leEq.con"
+ uri   = "cic:/Algebra/algebra/COrdFields/leEq.con"
  hide  = "1"
  arity = "2"
  m-tag = "leq"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/COrdFields/cof_less.con"
+ uri   = "cic:/Algebra/algebra/COrdFields/cof_less.con"
  hide  = "1"
  arity = "2"
  m-tag = "lt"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CRings/cr_plus.con | cic:/Algebra/CSemiGroups/csg_op.con"
+ uri   = "cic:/Algebra/algebra/CRings/cr_plus.con | cic:/Algebra/algebra/CSemiGroups/csg_op.con"
  hide  = "1"
  arity = "2"
  m-tag = "plus"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CRings/cr_minus.con | cic:/Algebra/CGroups/cg_minus.con"
+ uri   = "cic:/Algebra/algebra/CRings/cr_minus.con | cic:/Algebra/algebra/CGroups/cg_minus.con"
  hide  = "1"
  arity = "2"
  m-tag = "minus"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CRings/cr_mult.con"
+ uri   = "cic:/Algebra/algebra/CRings/cr_mult.con"
  hide  = "1"
  arity = "2"
  m-tag = "times"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CFields/cf_div.con"
+ uri   = "cic:/Algebra/algebra/CFields/cf_div.con"
  hide  = "1"
  arity = "2"
  m-tag = "divide"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CRings/Ring_constructions/nzpro.con"
+ uri   = "cic:/Algebra/algebra/CRings/nzpro.con"
  cook  = "true"
  arity = "2">
        <param id="1"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CRings/exponentiation/nexp.con"
+ uri   = "cic:/Algebra/algebra/CRings/nexp.con"
  cook  = "true"
  arity = "2"
  m-tag = "power"/>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CRings/exponentiation/nexp_op.con | cic:/Algebra/Expon/Zexp_def/zexp.con"
+ uri   = "cic:/Algebra/algebra/CRings/nexp_op.con | cic:/Algebra/algebra/Expon/zexp.con"
  cook  = "true"
  arity = "2">
        <mapp>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/COrdFields/absSmall.con"
+ uri   = "cic:/Algebra/algebra/COrdFields/absSmall.con"
  hide  = "1"
  arity = "2">
        <mapp>
 
 <Operator
  name  = "*****"
- uri   = "cic:/Algebra/CPolynomials/CPoly_CRing_ctd/cpoly_apply_fun.con"
+ uri   = "cic:/Algebra/algebra/CPolynomials/cpoly_apply_fun.con"
  cook  = "true"
  arity = "2"> 
        <mapp>
 
 <Operator
  name  = "********"
- uri   = "cic:/Algebra/COrdFields/OrdField_Cauchy/seqLimit.con"
+ uri   = "cic:/Algebra/algebra/COrdFields/seqLimit.con"
  cook  = "true"
  arity = "2">
        <mapp>
 
 <Operator
  name  = "********"
- uri   = "cic:/Algebra/CSums/Sums/sum0.con"
+ uri   = "cic:/Algebra/algebra/CSums/sum0.con"
  cook  = "true"
  arity = "2">
        <m:apply helm:xref="$OP-ID">
 
 <Operator
  name  = "SUM"
- uri   = "cic:/Algebra/CSums/Sums/sum.con"
+ uri   = "cic:/Algebra/algebra/CSums/sum_.con"
  cook  = "true"
  arity = "3">
        <m:apply helm:xref="$OP-ID">
index 17fc523cdd3b1c40aa5836f2d10874a5a36685b4..a21a51306d855ad2d33ea898b1d66c9eefd1efad 100644 (file)
@@ -4,8 +4,6 @@
 
 <OpList xmlns:m="http://www.w3.org/1998/Math/MathML">
 
-<import href="positive.xsl"/>
-
 <Operator
  name  = "LESS EQUAL"
  uri   = "cic:/Coq/Init/Peano/le.ind | cic:/Coq/ZArith/zarith_aux/Zle.con"
@@ -32,7 +30,7 @@
 
 <Operator
  name  = "*****"
- uri   = "cic:/Coq/Init/Peano/plus.con | cic:/Coq/ZArith/fast_integer/fast_integers/Zplus.con"
+ uri   = "cic:/Coq/Init/Peano/plus.con | cic:/Coq/ZArith/fast_integer/Zplus.con"
  arity = "2"
  m-tag = "plus"/>
 
@@ -44,7 +42,7 @@
  
 <Operator
  name  = "*****"
- uri   = "cic:/Coq/Init/Peano/mult.con | cic:/Coq/ZArith/fast_integer/fast_integers/Zmult.con"
+ uri   = "cic:/Coq/Init/Peano/mult.con | cic:/Coq/ZArith/fast_integer/Zmult.con"
  arity = "2"
  m-tag = "times"/>
 
@@ -56,7 +54,7 @@
 
 <Operator
  name  = "*****"
- uri   = "cic:/Coq/ZArith/fast_integer/fast_integers/Zopp.con"
+ uri   = "cic:/Coq/ZArith/fast_integer/Zopp.con"
  arity = "1"
  m-tag = "minus"/>
 
index b0681468c95ba105ecc27d928648ef49434cb26e..e9da62a6281ceec8b6b24b8720f893dd09d93f78 100644 (file)
@@ -7,16 +7,27 @@
 
 <Operator
  name  = "AND"
- uri   = "cic:/Coq/Init/Logic/Conjunction/and.ind"
+ uri   = "cic:/Coq/Init/Logic/and.ind"
  arity = "2"
  m-tag = "and"/>
 
 <Operator
  name  = "OR"
- uri   = "cic:/Coq/Init/Logic/Disjunction/or.ind"
+ uri   = "cic:/Coq/Init/Logic/or.ind"
  arity = "2"
  m-tag = "or"/>
 
+<Operator
+ name  = "IFF"
+ uri   = "cic:/Coq/Init/Logic/iff.con"
+ arity = "2">
+       <mapp>
+               <m:csymbol>iff</m:csymbol>
+               <param id="1"/>
+               <param id="2"/>
+       </mapp>
+</Operator>
+
 <Operator
  name  = "NOT" 
  uri   = "cic:/Coq/Init/Logic/not.con"
 
 <Operator
  name  = "EQUALITY and TYPE EQUALITY"
- uri   = "cic:/Coq/Init/Logic/Equality/eq.ind | cic:/Coq/Init/Logic_Type/eqT.ind"
+ uri   = "cic:/Coq/Init/Logic/eq.ind | cic:/Coq/Init/Logic_Type/eqT.ind"
  hide  = "1"
  arity = "2"
  m-tag = "eq"/>
 
 <NotOperator
  name  = "NOT-EQ and NOT-EQT"
- uri   = "cic:/Coq/Init/Logic/Equality/eq.ind | cic:/Coq/Init/Logic_Type/eqT.ind"
+ uri   = "cic:/Coq/Init/Logic/eq.ind | cic:/Coq/Init/Logic_Type/eqT.ind"
  hide  = "1"
  arity = "2">
        <mapp>
@@ -47,7 +58,7 @@
 
 <Operator
  name  = "EXIST"
- uri   = "cic:/Coq/Init/Logic/First_order_quantifiers/ex.ind | cic:/Coq/Init/Logic_Type/exT.ind"
+ uri   = "cic:/Coq/Init/Logic/ex.ind | cic:/Coq/Init/Logic_Type/exT.ind"
  arity = "2">
        <mapp>
                <mop tag="exists"/>
@@ -61,7 +72,7 @@
 
 <Operator
  name  = "EXIST"
- uri   = "cic:/Coq/Init/Logic/First_order_quantifiers/ex2.ind | cic:/Coq/Init/Logic_Type/exT2.ind"
+ uri   = "cic:/Coq/Init/Logic/ex2.ind | cic:/Coq/Init/Logic_Type/exT2.ind"
  hide  = "1"
  arity = "2">
        <mapp>
diff --git a/helm/meta_style/list.xml b/helm/meta_style/list.xml
new file mode 100644 (file)
index 0000000..9ed07d6
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE OpList SYSTEM "operator.dtd">
+
+<!-- ************************** LISTS ****************************** -->
+
+<OpList xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+<!-- CSC: manca
+<Operator
+ name  = "CONS"
+ uri   = "cic:/Coq/Lists/PolyList/list.ind"
+ arity = "2"
+ m-tag = "???"/>
+
+<Operator
+ name  = "NIL"
+ uri   = "cic:/Coq/Lists/PolyList/list.ind"
+ arity = "0"
+ m-tag = "???"/> -->
+
+<Operator
+ name  = "APPEND"
+ uri   = "cic:/Coq/Lists/PolyList/app.con"
+ cook  = "true"
+ arity = "2">
+       <mapp>
+               <m:csymbol>append</m:csymbol>
+               <param id="1"/>
+               <param id="2"/>
+       </mapp>
+</Operator>
+
+<Operator
+ name  = "IN"
+ uri   = "cic:/Coq/Lists/PolyList/In.con | cic:/Coq/Lists/TheoryList/In_spec.ind | cic:/Coq/Lists/ListSet/set_In.con | cic:/Coq/Lists/ListSet/set_mem.con"
+ cook  = "true"
+ arity = "2"
+ m-tag = "in"/>
+
+<Operator
+ name  = "INCL"
+ uri   = "cic:/Coq/Lists/PolyList/incl.con"
+ cook  = "true"
+ arity = "2"
+ m-tag = "subset"/>
+
+<Operator
+ name  = "INTER"
+ uri   = "cic:/Coq/Lists/ListSet/set_inter.con"
+ cook  = "true"
+ arity = "2"
+ m-tag = "intersect"/>
+
+<Operator
+ name  = "LENGTH"
+ uri   = "cic:/Coq/Lists/PolyList/length.con"
+ cook  = "true"
+ arity = "1"
+ m-tag = "card"/>
+
+</OpList>
index f77890363dfbe41ad0d42acb8c562dda64987637..072774b5d50bcb7c4c7dfefb93e47e76f59d8acd 100644 (file)
@@ -47,6 +47,7 @@
        <oxsl:include href="{@href}"/>
 </xsl:template>
 
+
 <xsl:template match="Operator|NotOperator">
        <xsl:variable name="uri">
                <xsl:call-template name="remove_white_spaces">
@@ -79,7 +80,7 @@
                                        <xsl:with-param name="c-tag" select="'CONST'"/>
                                </xsl:call-template>
                        </xsl:variable>
-                       
+
                        <!-- All uris in uri2 list (if not empty) have MUTIND c-tag -->
                        <xsl:variable name="uri2">
                                <xsl:call-template name="select_uris">
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri1"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="arity" select="@arity"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'CONST'"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri1"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="arity" select="@arity"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'CONST'"/>
+                                       </xsl:call-template>
+                               </xsl:if>
                        </xsl:if>
 
                        <xsl:if test="$uri2 != ''">
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri2"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="arity" select="@arity"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'MUTIND'"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri2"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="arity" select="@arity"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'MUTIND'"/>
+                                       </xsl:call-template>    
+                               </xsl:if>
                        </xsl:if>
                </xsl:otherwise>
        </xsl:choose>
        </xsl:variable>
 
        <xsl:choose>
-               <xsl:when test="$const = 'false' and $not = 'true'">
+               <xsl:when test="$const = 'true' and $not = 'true'">
                        <xsl:call-template name="out_comment">
                                <xsl:with-param name="name" select="concat($uri,': &quot;not&quot; cannot  be applyed to a constant operator')"/>
                        </xsl:call-template>
                </xsl:when>
                <xsl:when test="$const = 'true'">
                        <xsl:call-template name="out_comment">
-                               <xsl:with-param name="name" select="concat($uri,':  cannot be specified a constant operator when using OpSet element')"/>
+                               <xsl:with-param name="name" select="concat($uri,': cannot be specified a constant operator when using OpSet element')"/>
                        </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri1"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'CONST'"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template_set">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri1"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'CONST'"/>
+                                       </xsl:call-template>
+                               </xsl:if>
                        </xsl:if>
 
                        <xsl:if test="$uri2 != ''">
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri2"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'MUTIND'"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template_set">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri2"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'MUTIND'"/>
+                                       </xsl:call-template>    
+                               </xsl:if>
                        </xsl:if>
                </xsl:otherwise>
        </xsl:choose>
        <xsl:param name="m-tag"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
-
-       <xsl:variable name="apply_not">
-               <xsl:if test="$not = 'true'">*[2]/</xsl:if>
-       </xsl:variable>
-
+       
        <xsl:variable name="match">
                <xsl:variable name="match_op">
                        <xsl:call-template name="out_match_op">
                                <xsl:with-param name="not"   select="$not"/>
                                <xsl:with-param name="uri"   select="$uri"/>
+                               <xsl:with-param name="cook"  select="$cook"/>
                                <xsl:with-param name="c-tag" select="$c-tag"/>
                        </xsl:call-template>
                </xsl:variable>
-
+               
                <xsl:variable name="match_child">
-                       <xsl:if test="$cook = 'false' or $not = 'true'">
+                       <xsl:if test="$const = 'false'">
                                <xsl:choose>
                                        <!-- if the operator has been concatenated with not, the root apply node must have only two child -->
-                                       <xsl:when test="$not = 'true' and $cook = 'true'"> and count(*) = 2</xsl:when>
-                                       <xsl:when test="$not = 'true' and $cook = 'false'">
+                                       <xsl:when test="$not = 'true'">
                                                <xsl:value-of select="concat(' and count(*) = 2 and count(*[2]/*) = ',$arity + $hide + 1)"/>
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:value-of select="concat('count(*) = ',$arity + $hide + 1)"/>
+                                               <xsl:value-of select="concat(' and count(*) = ',$arity + $hide + 1)"/>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </xsl:if>
                </xsl:choose>
        </xsl:variable>
 
-       <xsl:variable name="op_uri_attr">
-               <xsl:variable name="tmp_op_uri_attr">
-                       <xsl:call-template name="op_uri_attr">
-                               <xsl:with-param name="not"   select="$not"/>
-                               <xsl:with-param name="c-tag" select="$c-tag"/>
-                               <xsl:with-param name="const" select="$const"/>
-                       </xsl:call-template>
-               </xsl:variable>
-               <xsl:value-of select="substring-after(substring-before($tmp_op_uri_attr,'}'),'{')"/>
-       </xsl:variable>
-
        <!--                     TEMPLATE                     -->
        <xsl:call-template name="out_comment">
                <xsl:with-param name="name" select="$name"/>
        </xsl:call-template>
 
        <oxsl:template match="{$match}" mode="pure">
-               <xsl:choose>
-                       <xsl:when test="$cook = 'true'">
-                               <oxsl:variable name="no_params">
-                                       <oxsl:call-template name="get_no_params">
-                                               <oxsl:with-param name="first_uri"  select="$CICURI"/>
-                                               <oxsl:with-param name="second_uri" select="{$op_uri_attr}"/>
-                                       </oxsl:call-template>
-                               </oxsl:variable>
-                               <oxsl:choose>
-                                       <oxsl:when test="{concat('count(',$apply_not,'*) = $no_params + ',$arity + $hide + 1)}">
-                                               <xsl:call-template name="out_body">
-                                                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                                                       <xsl:with-param name="m-tag" select="$m-tag"/>
-                                                       <xsl:with-param name="cook"  select="$cook"/>
-                                                       <xsl:with-param name="hide"  select="$hide"/>
-                                                       <xsl:with-param name="arity" select="$arity"/>
-                                                       <xsl:with-param name="not"   select="$not"/>
-                                                       <xsl:with-param name="const" select="$const"/>
-                                               </xsl:call-template>
-                                        </oxsl:when>
-                                        <oxsl:otherwise>
-                                               <oxsl:apply-imports/>
-                                       </oxsl:otherwise>
-                               </oxsl:choose>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:call-template name="out_body">
-                                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                                       <xsl:with-param name="m-tag" select="$m-tag"/>
-                                       <xsl:with-param name="cook"  select="$cook"/>
-                                       <xsl:with-param name="hide"  select="$hide"/>
-                                       <xsl:with-param name="arity" select="$arity"/>
-                                       <xsl:with-param name="not"   select="$not"/>
-                                       <xsl:with-param name="const" select="$const"/>
-                               </xsl:call-template>
-                       </xsl:otherwise>
-               </xsl:choose>
+               <xsl:call-template name="out_body">
+                       <xsl:with-param name="c-tag" select="$c-tag"/>
+                       <xsl:with-param name="m-tag" select="$m-tag"/>
+                       <xsl:with-param name="cook"  select="$cook"/>
+                       <xsl:with-param name="hide"  select="$hide"/>
+                       <xsl:with-param name="arity" select="$arity"/>
+                       <xsl:with-param name="not"   select="$not"/>
+                       <xsl:with-param name="const" select="$const"/>
+               </xsl:call-template>
        </oxsl:template>
 </xsl:template>
 
        <xsl:param name="m-tag"/>
        <xsl:param name="c-tag"/>
 
-       <xsl:variable name="no_params_var">
-               <xsl:if test="$cook = 'true'">$no_params + </xsl:if>
-       </xsl:variable>
-
        <xsl:variable name="match">
                <xsl:variable name="match_op">
                        <xsl:call-template name="out_match_op">
-                               <xsl:with-param name="not"   select="$not"/> 
+                               <xsl:with-param name="not"   select="$not"/>
+                               <xsl:with-param name="cook"  select="$cook"/>
                                <xsl:with-param name="uri"   select="$uri"/> 
                                <xsl:with-param name="c-tag" select="$c-tag"/>
                        </xsl:call-template>
                </xsl:variable>
                
-                <xsl:variable name="match_child">
-                       <xsl:if test="$not = 'true'"> and count(*) = 2</xsl:if>
-                </xsl:variable>
+               <xsl:variable name="match_child">
+                       <xsl:if test="$not = 'true'"> and count(*) = 2</xsl:if>
+               </xsl:variable>
 
-                <xsl:value-of select="concat('APPLY[',$match_op,$match_child,']')"/>
+               <xsl:value-of select="concat('APPLY[',$match_op,$match_child,']')"/>
        </xsl:variable>
 
        <xsl:variable name="apply_not">
                <xsl:if test="$not = 'true'">*[2]/</xsl:if>
        </xsl:variable>
 
-       <xsl:variable name="op_uri_attr">
-               <xsl:variable name="tmp_op_uri_attr">
-                       <xsl:call-template name="op_uri_attr">
-                               <xsl:with-param name="not"   select="$not"/>
-                               <xsl:with-param name="c-tag" select="$c-tag"/>
-                       </xsl:call-template>
-               </xsl:variable>
-               <xsl:value-of select="substring-after(substring-before($tmp_op_uri_attr,'}'),'{')"/>
-       </xsl:variable>
-
 
        <!--                     TEMPLATE                     -->
        <xsl:call-template name="out_comment">
        </xsl:call-template>
        
        <oxsl:template match="{$match}" mode="pure">
-               <xsl:if test="$cook = 'true'">
-                       <oxsl:variable name="no_params">
-                               <oxsl:call-template name="get_no_params">
-                                       <oxsl:with-param name="first_uri"  select="$CICURI"/>
-                                       <oxsl:with-param name="second_uri" select="{$op_uri_attr}"/>
-                               </oxsl:call-template>
-                       </oxsl:variable>
-               </xsl:if>       
                <oxsl:choose>
                        <xsl:for-each select="Case">
-                               <oxsl:when test="{concat('count(',$apply_not,'*) = ',$no_params_var,@arity + $hide + 1)}">
+                               <oxsl:when test="{concat('count(',$apply_not,'*) = ',@arity + $hide + 1)}">
                                        <xsl:call-template name="out_body">
                                                <xsl:with-param name="c-tag" select="$c-tag"/>
                                                <xsl:with-param name="m-tag" select="$m-tag"/>
 <xsl:template name="out_match_op">
        <xsl:param name="not"  select="'false'"/>
        <xsl:param name="uri"/>
+       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="c-tag"/>
+
+       <xsl:variable name="instantiate">
+               <xsl:if test="$cook = 'true'">instantiate/</xsl:if>
+       </xsl:variable>
        
        <!-- application with not operator -->
        <xsl:variable name="app_not">
 
        <xsl:variable name="app_op">
                <xsl:if test="$not = 'true'">APPLY[</xsl:if>
-               <xsl:value-of select="concat($c-tag,'[',$uris,']')"/>
+               <xsl:value-of select="concat($instantiate,$c-tag,'[',$uris,']')"/>
                <xsl:if test="$not = 'true'">]</xsl:if>
        </xsl:variable>
 
 
 <xsl:template name="out_params">
        <xsl:param name="params" select="1"/>
-       <xsl:param name="cook"   select="'false'"/>
        <xsl:param name="hide"   select="0"/>
        <xsl:param name="not"    select="'false'"/>
        <xsl:param name="mode"   select="'noannot'"/>
                        <xsl:call-template name="param">
                                <xsl:with-param name="id"    select="$params"/>
                                <xsl:with-param name="not"   select="$not"/>
-                               <xsl:with-param name="cook"  select="$cook"/>
                                <xsl:with-param name="hide"  select="$hide"/>
                        </xsl:call-template>
                </xsl:variable>
                
                <xsl:call-template name="out_params">
                        <xsl:with-param name="params" select="$params + 1"/>
-                       <xsl:with-param name="cook"   select="$cook"/>
                        <xsl:with-param name="hide"   select="$hide"/>
                        <xsl:with-param name="not"    select="$not"/>
                        <xsl:with-param name="mode"   select="$mode"/>
        </xsl:if>
 </xsl:template>
 
-
 <xsl:template name="out_body">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
                <!--            SIMPLE TRANSFORMATIONS            -->
                <xsl:when test="count(*) = 0">
                        <xsl:variable name="xref">
-                                <xsl:if test="$const = 'false'">{@id}</xsl:if>
+                               <xsl:if test="$const = 'false'">{@id}</xsl:if>
                        </xsl:variable>
 
                        <xsl:variable name="definitionURL">
                                <xsl:call-template name="op_uri_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                         <xsl:variable name="helm:xref">
                                <xsl:call-template name="op_id_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                                </xsl:element>
                                <!--            PARAMS            -->
                                <xsl:call-template name="out_params">
-                                       <xsl:with-param name="cook"   select="$cook"/>
-                                       <xsl:with-param name="hide"   select="$hide"/>  
+                                       <xsl:with-param name="hide"   select="$hide"/>                                  
                                        <xsl:with-param name="not"    select="$not"/>
                                        <xsl:with-param name="arity"  select="$arity"/>
                                </xsl:call-template>
        </xsl:choose>
 </xsl:template>
 
+
 <xsl:template name="out_mvar">
        <xsl:param name="vname"/>
        
 <xsl:template name="out_choose_binder">
        <xsl:param name="binded_params" select="''"/>
        <xsl:param name="not"           select="'false'"/>
-       <xsl:param name="cook"          select="'false'"/>
        <xsl:param name="hide"          select="0"/>
        <xsl:param name="binder"/>
        
                                <xsl:call-template name="out_choose_binder">
                                        <xsl:with-param name="binded_params" select="substring-before($binded_params,'+')"/>
                                        <xsl:with-param name="not"           select="$not"/>
-                                       <xsl:with-param name="cook"          select="$cook"/>
                                        <xsl:with-param name="hide"          select="$hide"/>
                                        <xsl:with-param name="binder"        select="$binder"/>
                                </xsl:call-template>
                                <xsl:call-template name="out_choose_binder">
                                        <xsl:with-param name="binded_params" select="substring-after($binded_params,'+')"/>
                                        <xsl:with-param name="not"           select="$not"/>
-                                       <xsl:with-param name="cook"          select="$cook"/>
                                        <xsl:with-param name="hide"          select="$hide"/>
                                        <xsl:with-param name="binder"        select="$binder"/>
                                </xsl:call-template>
                                        <xsl:call-template name="param">
                                                <xsl:with-param name="id"    select="$binded_params"/>
                                                <xsl:with-param name="not"   select="$not"/>
-                                               <xsl:with-param name="cook"  select="$cook"/>
                                                <xsl:with-param name="hide"  select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
        </xsl:if>
 </xsl:template>
 
+
 <!-- *********************************************************************** -->
 <!--                     META LANGUAGE FOR MathML                            --> 
 <!-- *********************************************************************** -->
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="@xref"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
                                        <xsl:with-param name="not"   select="$not"/>
 
        <m:apply helm:xref="{$helm:xref}">
                <xsl:call-template name="copy_attributes">
+                       <xsl:with-param name="cook"   select="$cook"/>
                        <xsl:with-param name="c-tag"  select="$c-tag"/>
                        <xsl:with-param name="hide"   select="$hide"/>
                        <xsl:with-param name="arity"  select="$arity"/>
        </m:apply>
 </xsl:template>
 
-
 <xsl:template match="mop">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
                        <xsl:when test="@definitionURL">
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="@definitionURL"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
                        <xsl:otherwise>
                                <xsl:call-template name="op_uri_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                        <xsl:when test="@xref">
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="@xref"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
                        <xsl:otherwise>
                                <xsl:call-template name="op_id_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                </xsl:attribute>
                
                <xsl:call-template name="copy_attributes">
+                       <xsl:with-param name="cook"   select="$cook"/>
                        <xsl:with-param name="c-tag"  select="$c-tag"/>
                        <xsl:with-param name="hide"   select="$hide"/>
                        <xsl:with-param name="arity"  select="$arity"/>
        </xsl:element>
 </xsl:template>
 
+
 <xsl:template match="param">
-       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="hide" select="0"/>
        <xsl:param name="not"  select="'false'"/>
 
                <xsl:call-template name="param">
                        <xsl:with-param name="id"    select="@id"/>
                        <xsl:with-param name="not"   select="$not"/>
-                       <xsl:with-param name="cook"  select="$cook"/>
                        <xsl:with-param name="hide"  select="$hide"/>
                </xsl:call-template>
        </xsl:variable>
        </xsl:choose>
 </xsl:template>
 
+
 <xsl:template match="m:*">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
        
        <xsl:copy>
                <xsl:call-template name="copy_attributes">
+                       <xsl:with-param name="cook"  select="$cook"/>
                        <xsl:with-param name="c-tag" select="$c-tag"/>
                        <xsl:with-param name="hide"  select="$hide"/>
                        <xsl:with-param name="arity" select="$arity"/>
        </xsl:copy>
 </xsl:template>
 
+
 <xsl:template match="mbvar">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
                <xsl:call-template name="test_on_lambda">
                        <xsl:with-param name="binded_params" select="$binded_params"/>
                        <xsl:with-param name="not"           select="$not"/>
-                       <xsl:with-param name="cook"          select="$cook"/>
                        <xsl:with-param name="hide"          select="$hide"/>
                </xsl:call-template>
        </xsl:variable>
 
-       <xsl:variable name="binder">/target/@binder</xsl:variable>
+       <xsl:variable name="binder">/decl/@binder</xsl:variable>
 
        <xsl:choose>
                <xsl:when test="$binded_params != ''">
                                                                                        <xsl:with-param name="binded_params" select="$binded_params"/>
                                                                                        <xsl:with-param name="not"           select="$not"/>
                                                                                        <xsl:with-param name="hide"          select="$hide"/>
-                                                                                       <xsl:with-param name="cook"          select="$cook"/>
                                                                                        <xsl:with-param name="binder"        select="$binder"/>
                                                                                </xsl:call-template>
                                                                        </oxsl:choose>
-                                                               </oxsl:variable>
+                                                               </oxsl:variable>
                                                                <oxsl:call-template name="insert_subscript">
                                                                        <oxsl:with-param name="node_value" select="$binder"/>
                                                                </oxsl:call-template>
                                                                        <xsl:call-template name="param">
                                                                                <xsl:with-param name="id"    select="$binded_params"/>
                                                                                <xsl:with-param name="not"   select="$not"/>
-                                                                               <xsl:with-param name="cook"  select="$cook"/>
                                                                                <xsl:with-param name="hide"  select="$hide"/>
                                                                        </xsl:call-template>
-                                                               </xsl:variable>
-                                                       
+                                                               </xsl:variable>                                                         
+
                                                                <oxsl:call-template name="insert_subscript">
                                                                        <oxsl:with-param name="node_value" select="{concat($param,$binder)}"/>
                                                                </oxsl:call-template>
        </xsl:choose>
 </xsl:template>
 
+
+
 <xsl:template match="mvar">
        <xsl:call-template name="out_mvar">
                <xsl:with-param name="vname" select="@name"/>
 </xsl:template>
 
 
-
 <!-- *********************************************************************** -->
 <!--                          AUXILIARY FUNCTIONS                            -->
 <!-- *********************************************************************** -->
 <xsl:template name="test_on_lambda">
        <xsl:param name="binded_params" select="''"/>
        <xsl:param name="not"           select="'false'"/>
-       <xsl:param name="cook"          select="'false'"/>
        <xsl:param name="hide"          select="0"/>
        
        <xsl:if test="$binded_params != ''">
                                        <xsl:call-template name="test_on_lambda">
                                                <xsl:with-param name="binded_params" select="substring-before($binded_params,'+')"/>
                                                <xsl:with-param name="not"           select="$not"/>
-                                               <xsl:with-param name="cook"          select="$cook"/>
                                                <xsl:with-param name="hide"          select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                        <xsl:call-template name="test_on_lambda">
                                                <xsl:with-param name="binded_params" select="substring-after($binded_params,'+')"/>
                                                <xsl:with-param name="not"           select="$not"/>
-                                               <xsl:with-param name="cook"          select="$cook"/>
                                                <xsl:with-param name="hide"          select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                        <xsl:call-template name="param">
                                                <xsl:with-param name="id"    select="$binded_params"/>
                                                <xsl:with-param name="not"   select="$not"/>
-                                               <xsl:with-param name="cook"  select="$cook"/>
                                                <xsl:with-param name="hide"  select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
 <xsl:template name="param">
        <xsl:param name="id"/>
        <xsl:param name="not"   select="'false'"/>
-       <xsl:param name="cook"  select="'false'"/>
        <xsl:param name="hide"  select="0"/>
 
        <xsl:variable name="apply_not">
                <xsl:if test="$not = 'true'">*[2]/</xsl:if>
        </xsl:variable>
 
-       <xsl:variable name="no_params_var">
-               <xsl:if test="$cook = 'true'">$no_params+</xsl:if>
-       </xsl:variable>
-
-       <xsl:value-of select="concat($apply_not,'*[',$no_params_var,$id + $hide + 1,']')"/>
+       <xsl:value-of select="concat($apply_not,'*[',$id + $hide + 1,']')"/>
 </xsl:template>
 
 <!-- Returns a xpath string with the location of the operator uri attribute -->
 <xsl:template name="op_uri_attr">
        <xsl:param name="not"   select="'false'"/>
+       <xsl:param name="cook"  select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
 
        <xsl:call-template name="op_attr">
                <xsl:with-param name="attr_type" select="'@uri'"/>
                <xsl:with-param name="not"       select="$not"/>
+               <xsl:with-param name="cook"      select="$cook"/>
                <xsl:with-param name="c-tag"     select="$c-tag"/>
                <xsl:with-param name="const"     select="$const"/>
        </xsl:call-template>
 <!-- Returns a xpath string with the location of the operator id attribute -->
 <xsl:template name="op_id_attr">
        <xsl:param name="not"  select="'false'"/>
+       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
        
        <xsl:call-template name="op_attr">
                <xsl:with-param name="attr_type" select="'@id'"/>
                <xsl:with-param name="not"       select="$not"/>
+               <xsl:with-param name="cook"      select="$cook"/>
                <xsl:with-param name="c-tag"     select="$c-tag"/>
                <xsl:with-param name="const"     select="$const"/>
        </xsl:call-template>
 <xsl:template name="op_attr">
        <xsl:param name="attr_type"/>
        <xsl:param name="not"  select="'false'"/>
+       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
+       
+       <xsl:variable name="instantiate">
+               <xsl:if test="$cook = 'true'">instantiate/</xsl:if>
+       </xsl:variable>
 
        <xsl:variable name="apply">
                <xsl:if test="$not = 'true'">APPLY/</xsl:if>
                        <xsl:value-of select="concat('{',$attr_type,'}')"/>     
                </xsl:when>
                <xsl:otherwise>
-                       <xsl:value-of select="concat('{',$apply,$c-tag,'/',$attr_type,'}')"/>                   
+                       <xsl:value-of select="concat('{',$apply,$instantiate,$c-tag,'/',$attr_type,'}')"/>                      
                </xsl:otherwise>
        </xsl:choose>
 </xsl:template>
 
 <xsl:template name="copy_attributes">
+       <xsl:param name="cook"   select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="hide"   select="0"/>
        <xsl:param name="arity"  select="0"/>
                        <xsl:attribute name="{$name}">
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="."/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
 <xsl:template name="set_attribute">
        <xsl:param name="attr"/>
        <xsl:param name="c-tag"/>
+       <xsl:param name="cook"  select="'false'"/>
        <xsl:param name="hide"  select="0"/>
        <xsl:param name="arity" select="0"/>
        <xsl:param name="not"   select="'false'"/>
                                        <xsl:otherwise>@uri</xsl:otherwise>
                                </xsl:choose>
                        </xsl:variable>
-
+                       
                        <xsl:call-template name="op_attr">
                                <xsl:with-param name="attr_type" select="$attr_type"/>
                                <xsl:with-param name="not"       select="$not"/>
+                               <xsl:with-param name="cook"      select="$cook"/>
                                <xsl:with-param name="c-tag"     select="$c-tag"/>
                                <xsl:with-param name="const"     select="$const"/>
                        </xsl:call-template>
index f52b64702e89623bc081fc68697aa1e587df5961..e337b663ee0d80ac1ddb00fce12d1b64b7175456 100644 (file)
@@ -73,7 +73,7 @@ and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2']">
 
 
 
-<xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='2'] and count(*)=2]" mode="pure">
+<xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/Z.ind' and @noConstr='2'] and count(*)=2]" mode="pure">
    <xsl:apply-templates select="*[2]" mode="Zpositive">
     <xsl:with-param name="base" select="0"/>
     <xsl:with-param name="exp" select="1"/>
@@ -81,7 +81,7 @@ and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2']">
    </xsl:apply-templates>
 </xsl:template>
  
-<xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='3'] and count(*)=2]" mode="pure">
+<xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/Z.ind' and @noConstr='3'] and count(*)=2]" mode="pure">
    <m:apply helm:xref="{@id}">
     <m:minus definitionURL="{*[1]/@uri}" helm:xref="{*[1]/@id}"/>
     <xsl:apply-templates select="*[2]" mode="Zpositive">
@@ -92,13 +92,13 @@ and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2']">
    </m:apply>
 </xsl:template>
 
-<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/Z.ind' and @noConstr='1']" mode="pure">
+<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/Z.ind' and @noConstr='1']" mode="pure">
    <m:ci definitionURL="{@uri}" helm:xref="{@id}">0</m:ci>
 </xsl:template>
 
 <!-- prova di notazione per positive -->
 
-<xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind']]" mode="pure">
+<xsl:template match="APPLY[*[position()=1 and name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/positive.ind']]" mode="pure">
    <xsl:apply-templates select="." mode="Zpositive">
     <xsl:with-param name="base" select="0"/>
     <xsl:with-param name="exp" select="1"/>
@@ -106,7 +106,7 @@ and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2']">
    </xsl:apply-templates>
 </xsl:template>
 
-<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3']" mode="pure">
+<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ZArith/fast_integer/positive.ind' and @noConstr='3']" mode="pure">
  <m:ci definitionURL="{@uri}" helm:xref="{@id}">1</m:ci>
 </xsl:template> 
 
@@ -116,7 +116,7 @@ and @uri='cic:/Coq/Init/Datatypes/nat.ind' and @noConstr='2']">
  <xsl:param name="iden" select="''"/>
  <xsl:choose>
   <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT'
-and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='1']">
+and @uri='cic:/Coq/ZArith/fast_integer/positive.ind' and @noConstr='1']">
    <xsl:apply-templates select="*[2]" mode="Zpositive">
     <xsl:with-param name="base" select="$base + $exp"/>
     <xsl:with-param name="exp" select="2 * $exp"/>
@@ -124,14 +124,14 @@ and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr
    </xsl:apply-templates>
   </xsl:when>
   <xsl:when test="name()='APPLY' and *[position()=1 and name()='MUTCONSTRUCT' 
-and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='2']">
+and @uri='cic:/Coq/ZArith/fast_integer/positive.ind' and @noConstr='2']">
    <xsl:apply-templates select="*[2]" mode="Zpositive">
     <xsl:with-param name="base" select="$base"/>
     <xsl:with-param name="exp" select="2 * $exp"/>
     <xsl:with-param name="iden" select="$iden"/>
    </xsl:apply-templates>
   </xsl:when>
-  <xsl:when test="name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr='3'">
+  <xsl:when test="name()='MUTCONSTRUCT' and @uri='cic:/Coq/ZArith/fast_integer/positive.ind' and @noConstr='3'">
    <m:ci helm:xref="{$iden}"><xsl:value-of select="$base + $exp"/></m:ci>
   </xsl:when>
   <xsl:otherwise>
@@ -173,5 +173,46 @@ and @uri='cic:/Coq/ZArith/fast_integer/fast_integers/positive.ind' and @noConstr
  </xsl:choose>
 </xsl:template>
 
+<!-- **************************** Reals ******************************** -->
+
+<xsl:template match="APPLY[CONST[position() = 1 and @uri='cic:/Coq/Reals/Rdefinitions/Rplus.con'] and count(*) = 3]" mode="pure">
+  <xsl:variable name="result">
+   <xsl:apply-templates select="." mode="reals"/>
+  </xsl:variable>
+  <xsl:choose>
+   <xsl:when test="string($result) = ''">
+    <m:apply helm:xref="{@id}">
+      <m:plus xmlns:m="http://www.w3.org/1998/Math/MathML" definitionURL="{CONST[1]/@uri}" helm:xref="{CONST[1]/@id}"/>
+      <xsl:apply-templates select="*[2]" mode="noannot"/>
+      <xsl:apply-templates select="*[3]" mode="noannot"/>
+    </m:apply>
+   </xsl:when>
+   <xsl:otherwise>
+    <m:cn helm:xref="{CONST[1]/@id}"><xsl:value-of select="$result"/></m:cn>
+   </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="APPLY[*[position() = 1 and name()='CONST' and @uri='cic:/Coq/Reals/Rdefinitions/Rplus.con'] and *[position() = 2 and name()='CONST' and @uri='cic:/Coq/Reals/Rdefinitions/R1.con'] and count(*) = 3]" mode="reals">
+  <xsl:param name="real_counter" select="0"/>
+  <xsl:variable name="result">
+   <xsl:apply-templates select="*[3]" mode="reals">
+    <xsl:with-param name="real_counter" select="$real_counter + 1"/>
+   </xsl:apply-templates>
+  </xsl:variable>
+  <xsl:choose>
+   <xsl:when test="string($result) = ''"/>
+   <xsl:otherwise>
+    <xsl:value-of select="$result"/>
+   </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="CONST[@uri='cic:/Coq/Reals/Rdefinitions/R1.con']" mode="reals">
+  <xsl:param name="real_counter" select="0"/>
+  <xsl:value-of select="$real_counter + 1"/>
+</xsl:template>
+
+<xsl:template match="*" mode="reals"/>
 
 </xsl:stylesheet>
index f1e888d98d9c2c2308629cc1c52f70652f3b51a3..0dbcd37618a5555130b895fbf18e2355765d89b2 100644 (file)
@@ -1,12 +1,13 @@
 <!DOCTYPE OpList SYSTEM "operator.dtd">
 
-<OpList xmlns:m="http://www.w3.org/1998/Math/MathML">
+<OpList xmlns:m="http://www.w3.org/1998/Math/MathML"
+        xmlns:helm="http://www.cs.unibo.it/helm">
 
 <import href="modeset.xsl"/>
 
 <Operator
  name  = "IN"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/In.con"
+ uri   = "cic:/Coq/Sets/Ensembles/In.con"
  cook  = "true"
  arity = "2">
        <mapp>
@@ -18,7 +19,7 @@
 
 <NotOperator
  name  = "NOT IN"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/In.con"
+ uri   = "cic:/Coq/Sets/Ensembles/In.con"
  cook  = "true"
  arity = "2">
        <mapp>
        </mapp>
 </NotOperator>
 
-<OpSet
+<Operator
  name  = "EMPTY SET"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Empty_set.ind"
- cook  = "true">
-       
-       <Case arity="0">
-               <mop tag="set" helm:xref="$APP-ID"/>
-       </Case>
-
-       <Case arity="1">
+ uri   = "cic:/Coq/Sets/Ensembles/Empty_set.ind"
+ cook  = "true"
+ arity = "1">
                <mapp>
-                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/Ensembles/In.con"/>
+                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/In.con"/>
                        <param id="1"/>
                        <mop tag="set" helm:xref="$APP-ID"/>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
- name  = "SINGLETON"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Singleton.ind"
+<Operator
+ name  = "EMPTY SET"
+ uri   = "cic:/Coq/Sets/Ensembles/Empty_set.ind"
  cook  = "true">
+       <mop tag="set" helm:xref="$APP-ID"/>
+</Operator>
 
-       <Case arity="1">
+
+<Operator
+ name  = "SINGLETON"
+ uri   = "cic:/Coq/Sets/Ensembles/Singleton.ind"
+ cook  = "true"
+ arity = "1">
                <mop tag="set" helm:xref="$APP-ID">
                        <param id="1"/>
                </mop>
-       </Case>
+</Operator>
 
-       <Case arity="2">
+<Operator
+ name  = "SINGLETON"
+ uri   = "cic:/Coq/Sets/Ensembles/Singleton.ind"
+ cook  = "true"
+ arity = "2">
                <mapp>
-                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/Ensembles/In.con"/>
+                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/In.con"/>
                        <param id="2"/>
                        <m:set definitionURL="$OP-URI">
                                <param id="1"/>
                        </m:set>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
+<Operator
  name  = "COUPLE"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Couple.ind"
- cook  = "true">
-       
-       <Case arity="2">
+ uri   = "cic:/Coq/Sets/Ensembles/Couple.ind"
+ cook  = "true"
+ arity = "2">
                <mop tag="set" helm:xref="$APP-ID">
                        <param id="1"/>
                        <param id="2"/>
                </mop>
-       </Case>
+</Operator>
 
-       <Case arity="3">
+<Operator
+ name  = "COUPLE"
+ uri   = "cic:/Coq/Sets/Ensembles/Couple.ind"
+ cook  = "true"
+ arity = "3">
                <mapp>
-                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/Ensembles/In.con"/>
+                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/In.con"/>
                        <param id="3"/>
                        <m:set definitionURL="$OP-URI">
                                <param id="1"/>
                                <param id="2"/>
                        </m:set>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
+<Operator
  name  = "TRIPLE"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Triple.ind"
- cook  = "true">
-       <Case arity="3">
+ uri   = "cic:/Coq/Sets/Ensembles/Triple.ind"
+ cook  = "true"
+ arity = "3">
                <mop tag="set">
                        <param id="1"/>
                        <param id="2"/>
                        <param id="3"/>
                </mop>
-       </Case>
+</Operator>
  
-       <Case arity="4">
+<Operator
+ name  = "TRIPLE"
+ uri   = "cic:/Coq/Sets/Ensembles/Triple.ind"
+ cook  = "true"
+ arity = "4">
                <mapp>
-                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/Ensembles/In.con"/>
+                       <m:in definitionURL="cic:/Coq/Sets/Ensembles/In.con"/>
                        <param id="4"/>
                        <m:set definitionURL="$OP-URI">
                                <param id="1"/>
                                <param id="3"/>
                        </m:set>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
+<Operator
  name  = "INTERSECTION"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Intersection.ind"
- cook  = "true">
-
-       <Case arity="2">
+ uri   = "cic:/Coq/Sets/Ensembles/Intersection.ind"
+ cook  = "true"
+ arity = "2">
                <mapp>
                        <mop tag="intersect"/>
                        <param id="1" mode="set"/>
                        <param id="2" mode="set"/>
                </mapp>
-       </Case>
+</Operator>
 
-       <Case arity="3">
+<Operator
+ name  = "INTERSECTION"
+ uri   = "cic:/Coq/Sets/Ensembles/Intersection.ind"
+ cook  = "true"
+ arity = "3">
                <mapp>
                        <m:in/>
                        <param id="3"/>
                                <param id="2" mode="set"/>
                        </m:apply>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
+<Operator
  name  = "UNION"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Union.ind"
- cook  = "true">
-       
-       <Case arity="2">
+ uri   = "cic:/Coq/Sets/Ensembles/Union.ind"
+ cook  = "true"
+ arity = "2">
                <mapp>
                        <mop tag="union"/>
                        <param id="1" mode="set"/>
                        <param id="2" mode="set"/>              
                </mapp>
-       </Case>
+</Operator>
  
-       <Case arity="3">
+<Operator
+ name  = "UNION"
+ uri   = "cic:/Coq/Sets/Ensembles/Union.ind"
+ cook  = "true"
+ arity = "3">
                <mapp>
                        <m:in/>
                        <param id="3"/> 
                                <param id="2" mode="set"/>
                        </m:apply>      
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
 <Operator
  name  = "INCLUDED"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Included.con"
+ uri   = "cic:/Coq/Sets/Ensembles/Included.con"
  cook  = "true"
  arity = "2">
        <mapp>
 
 <Operator
  name  = "STRICTLY INCLUDED"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Strict_Included.con"
+ uri   = "cic:/Coq/Sets/Ensembles/Strict_Included.con"
  cook  = "true"
  arity = "2">
        <mapp>
        </mapp>
 </Operator>
 
-<OpSet
+<Operator
  name  = "SET-DIFF"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Setminus.con"
- cook  = "true">
-
-       <Case arity="2">
+ uri   = "cic:/Coq/Sets/Ensembles/Setminus.con"
+ cook  = "true"
+ arity = "2">
                <mapp>
                        <mop tag="setdiff"/>
                        <param id="1" mode="set"/>
                        <param id="2" mode="set"/>
                </mapp>
-       </Case>
+</Operator>
 
-       <Case arity="3">
+<Operator
+ name  = "SET-DIFF"
+ uri   = "cic:/Coq/Sets/Ensembles/Setminus.con"
+ cook  = "true"
+ arity = "3">
                <mapp>
                        <m:in/>
                        <param id="3"/> 
                                <param id="2" mode="set"/>
                        </m:apply>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
+<Operator
  name  = "ADD-ELEM"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Add.con"
- cook  = "true">
-
-       <Case arity="2">
+ uri   = "cic:/Coq/Sets/Ensembles/Add.con"
+ cook  = "true"
+ arity = "2">
                <mapp>
                        <mop tag="union"/>
                        <param id="1" mode="set"/>
                                <param id="2" mode="set"/>
                        </m:set>
                </mapp>
-       </Case>
+</Operator>
 
-       <Case arity="3">
+<Operator
+ name  = "ADD-ELEM"
+ uri   = "cic:/Coq/Sets/Ensembles/Add.con"
+ cook  = "true"
+ arity = "3">
                <mapp>
                        <m:in/>
                        <param id="3"/>
                                </m:set>
                        </m:apply>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
-<OpSet
+<Operator
  name  = "SUBTRACT-ELEM"
- uri   = "cic:/Coq/Sets/Ensembles/Ensembles/Subtract.con"
- cook  = "true">
-
-       <Case arity="2">
+ uri   = "cic:/Coq/Sets/Ensembles/Subtract.con"
+ cook  = "true"
+ arity = "2">
                <mapp>
                        <mop tag="setdiff"/>
                        <param id="1" mode="set"/>
                                <param id="2"/>
                        </m:set>
                </mapp>
-       </Case>
+</Operator>
 
-       <Case arity="3">
+<Operator
+ name  = "SUBTRACT-ELEM"
+ uri   = "cic:/Coq/Sets/Ensembles/Subtract.con"
+ cook  = "true"
+ arity = "3">
                <mapp>
                        <m:in/>
                        <param id="3"/>
                                </m:set>
                        </m:apply>
                </mapp>
-       </Case>
-</OpSet>
+</Operator>
 
 <Operator
  name  = "CARD"
- uri   = "cic:/Coq/Sets/Finite_sets/Ensembles_finis/cardinal.ind"
+ uri   = "cic:/Coq/Sets/Finite_sets/cardinal.ind"
  cook  = "true"
  arity = "2">
        <mapp>
 
 <Operator
  name  = "SIGMA"
- uri   = "cic:/Coq/Init/Specif/Subsets/sig.ind"
+ uri   = "cic:/Coq/Init/Specif/sig.ind"
  arity = "2">
        <m:set>
                <mbvar name="x">
index 889ce4c6c3d98bfbb9c4d953c4586f8844f82065..2f683f28dbe472985df7fe64910b415a2d8f4c9a 100644 (file)
@@ -3,5 +3,6 @@ arith.xsl
 basic.xsl
 reals.xsl
 set.xsl
+list.xsl
 positive.xsl
 modeset.xsl
index 97f259d673e521972975164affd40fcdd855be50..9cc298f09c461fb166ebda8a7565321ee30798d1 100644 (file)
@@ -35,9 +35,9 @@
 
 <xsl:import href="objcontent.xsl"/>
 
-<xsl:key name="id" use="@id" match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|Definition|Axiom|CurrentProof|InductiveDefinition|Variable"/>
+<xsl:key name="id" use="@id" match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|instantiate|ConstantType|ConstantBody|CurrentProof|InductiveDefinition|Variable"/>
 
-<xsl:template match="Definition|Axiom|CurrentProof|InductiveDefinition|Variable">
+<xsl:template match="ConstantType|ConstantBody|CurrentProof|InductiveDefinition|Variable">
     <xsl:variable name="id" select="@id"/>
     <xsl:choose>
     <xsl:when test="$annotations='yes' and $CICAnnotations/Annotations/Annotation[@of=$id]">
@@ -51,7 +51,7 @@
     </xsl:choose>
 </xsl:template>
 
-<xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX">
+<xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|instantiate">
     <xsl:variable name="id" select="@id"/>
     <xsl:choose>
     <xsl:when test="$annotations='yes' and $CICAnnotations/Annotations/Annotation[@of=$id]">
index e60a85051453d42bcc491199c66231210ffe0776..001ff876d20fa8fee77363664f04238501ce295f 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"/> -->
 
@@ -62,63 +63,98 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
 
 <!-- CIC TERMS -->
 
+
 <xsl:template match="LAMBDA" mode="pure">
-    <m:lambda helm:xref="{@id}">
-     <m:bvar>
-      <m:ci>
-       <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
-      </m:ci>
-      <m:type>
-       <xsl:apply-templates select="source/*[1]" mode="noannot"/>
-      </m:type>
-     </m:bvar>
-     <xsl:apply-templates select="target/*[1]" mode="noannot"/>
-    </m:lambda>
+       <xsl:apply-templates select="*[1]" mode="lambda"/>
+</xsl:template>
+
+<xsl:template match="decl" mode="lambda">
+       <m:lambda helm:xref="{@id}">
+        <m:bvar>
+         <m:ci>
+          <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+         </m:ci>
+         <m:type>
+          <xsl:apply-templates select="*[1]" mode="noannot"/>
+          </m:type>
+        </m:bvar>
+       <xsl:apply-templates select="following-sibling::*[1]" mode="lambda"/>
+       </m:lambda>
+</xsl:template>
+
+
+<xsl:template match="target" mode="lambda">
+       <xsl:apply-templates select="*[1]" mode="noannot"/>
 </xsl:template>
 
+
 <xsl:template match="LETIN" mode="pure">
+       <xsl:apply-templates select="*[1]" mode="letin_pure"/>
+</xsl:template>
+
+<!-- Andrea: mode letin already exists in proofs.xsl, with a 
+    different meaning -->
+
+<xsl:template match="def" mode="letin_pure">   
     <m:apply helm:xref="{@id}">
      <m:csymbol>let_in</m:csymbol>
      <m:bvar>
       <m:ci>
-       <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="letintarget/@binder"/></xsl:with-param></xsl:call-template>
+       <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
       </m:ci>
      </m:bvar>
      <xsl:apply-templates select="*[1]" mode="noannot"/>
-     <xsl:apply-templates select="letintarget/*[1]" mode="noannot"/>
+     <xsl:apply-templates select="following-sibling::*[1]" mode="letin_pure"/>
     </m:apply>
 </xsl:template>
 
+
+<xsl:template match="target" mode="letin_pure">
+       <xsl:apply-templates select="*[1]" mode="noannot"/>
+</xsl:template>
+
+
 <xsl:template match="PROD" mode="pure">
-    <m:apply helm:xref="{@id}">
-     <xsl:choose>
-     <xsl:when test="string(target/@binder)= &quot;&quot;">
-      <m:csymbol>arrow</m:csymbol>
-      <xsl:apply-templates select="source/*[1]" mode="noannot"/>
-     </xsl:when>
-     <xsl:otherwise>
+       <xsl:apply-templates select="*[1]" mode="prod"/>
+</xsl:template>
+
+
+<xsl:template match="decl" mode="prod">
+     <m:apply helm:xref="{@id}">
       <xsl:choose>
-       <xsl:when test="@type = 'Prop'">
-        <m:csymbol>forall</m:csymbol>
+       <xsl:when test="string(@binder)= &quot;&quot;">
+        <m:csymbol>arrow</m:csymbol>
+        <xsl:apply-templates select="*[1]" mode="noannot"/>
        </xsl:when>
        <xsl:otherwise>
-        <m:csymbol>prod</m:csymbol>
+        <xsl:choose>
+         <xsl:when test="../@type = 'Prop'">
+          <m:csymbol>forall</m:csymbol>
+         </xsl:when>
+         <xsl:otherwise>
+          <m:csymbol>prod</m:csymbol>
+         </xsl:otherwise>
+        </xsl:choose>
+        <m:bvar>
+         <m:ci>
+          <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+         </m:ci>
+         <m:type>
+          <xsl:apply-templates select="*[1]" mode="noannot"/>
+         </m:type>
+        </m:bvar>
        </xsl:otherwise>
       </xsl:choose>
-       <m:bvar>
-        <m:ci>
-         <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
-        </m:ci>
-        <m:type>
-         <xsl:apply-templates select="source/*[1]" mode="noannot"/>
-        </m:type>
-       </m:bvar>
-     </xsl:otherwise>
-     </xsl:choose>
-     <xsl:apply-templates select="target/*[1]" mode="noannot"/>
-    </m:apply>
+     <xsl:apply-templates select="following-sibling::*[1]" mode="prod"/> 
+     </m:apply>
+</xsl:template>
+
+        
+<xsl:template match="target" mode="prod">
+       <xsl:apply-templates select="*[1]" mode="noannot"/>
 </xsl:template>
 
+
 <xsl:template match="CAST" mode="pure">
     <m:apply helm:xref="{@id}">
      <m:csymbol>cast</m:csymbol>
@@ -126,12 +162,14 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:apply>
 </xsl:template>
 
+
 <xsl:template match="REL" mode="pure">
     <m:ci helm:xref="{@id}">
      <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
+
 <xsl:template match="SORT" mode="pure">
     <m:apply helm:xref="{@id}">
      <m:csymbol>
@@ -140,6 +178,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:apply>
 </xsl:template>
 
+
 <xsl:template match="APPLY" mode="pure">
       <m:apply helm:xref="{@id}">
        <m:csymbol>app</m:csymbol>
@@ -147,6 +186,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
       </m:apply>
 </xsl:template>
 
+
 <!-- Gestione senza pre-processing -->
 <!-- 
 <xsl:template match="APPLY" mode="pure">
@@ -163,10 +203,12 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
 
 <xsl:template match="VAR" mode="pure">
     <m:ci helm:xref="{@id}">
-     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="substring-after(@relUri,&quot;,&quot;)"/></xsl:with-param></xsl:call-template>
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri_bis">
+      <xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
+
 <xsl:template match="META" mode="pure">
    <m:apply helm:xref="{@id}">
     <m:csymbol>meta</m:csymbol>
@@ -191,6 +233,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
    </m:apply>
 </xsl:template>
 
+
 <xsl:template match="CONST" mode="pure">
    <m:ci definitionURL="{@uri}" helm:xref="{@id}">
       <xsl:call-template name="insert_subscript">
@@ -203,6 +246,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
    </m:ci>
 </xsl:template>
 
+
 <xsl:template match="MUTIND" mode="pure">
     <m:ci definitionURL="{@uri}" helm:xref="{@id}">
      <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
@@ -211,6 +255,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:ci>
 </xsl:template>
 
+
 <xsl:template match="MUTCONSTRUCT" mode="pure">
     <m:ci definitionURL="{@uri}" helm:xref="{@id}">
      <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
@@ -220,6 +265,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:ci>
 </xsl:template>
 
+
 <xsl:template match="MUTCASE" mode="pure">
     <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
     <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
@@ -258,6 +304,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:apply>
 </xsl:template>
 
+
 <xsl:template match="FIX" mode="pure">
     <m:apply helm:xref="{@id}">
      <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
@@ -267,6 +314,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:apply>
 </xsl:template>
 
+
 <xsl:template match="COFIX" mode="pure">
    <m:apply helm:xref="{@id}">
      <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
@@ -276,6 +324,37 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     </m:apply>
 </xsl:template>
 
+<xsl:template match="instantiate" mode="pure">
+       <m:apply>
+         <xsl:if test="@id">
+          <xsl:attribute name="helm:xref">
+          <xsl:value-of select="@id"/>
+          </xsl:attribute>
+         </xsl:if>
+        <m:csymbol>inst</m:csymbol>
+        <xsl:apply-templates mode="noannot" select="*[1]" />
+        <xsl:for-each select="arg">
+          <xsl:variable name="base_path">
+           <xsl:call-template name="path">
+            <xsl:with-param name="uri" select="../*[1]/@uri"/>
+           </xsl:call-template>
+          </xsl:variable>
+          <xsl:variable name="varUri" select="concat($base_path,@relUri)"/>
+         <m:ci definitionURL="{$varUri}">
+           <xsl:call-template name="insert_subscript">
+            <xsl:with-param name="node_value">
+             <xsl:call-template name="name_of_uri">
+              <xsl:with-param name="uri" select="$varUri"/>
+              <xsl:with-param name="extension" select="'.var'"/>
+             </xsl:call-template>
+            </xsl:with-param>
+           </xsl:call-template>
+          </m:ci>
+         <xsl:apply-templates mode ="noannot" select="*[1]" />
+        </xsl:for-each>
+       </m:apply>
+</xsl:template>
+
 <!-- ELEMENTS OF CIC TERMS -->
 
 <xsl:template match="FixFunction" mode="pure">
@@ -286,6 +365,7 @@ Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
     <xsl:apply-templates select="body/*[1]" mode="noannot"/>
 </xsl:template>
 
+
 <xsl:template match="CofixFunction" mode="pure">
     <m:bvar>
      <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
index 856fd69718a66103a38e43811ee1b836de23fc0c..56231b2bcd325b3a1f19b75bd630f114361d11e2 100644 (file)
@@ -39,6 +39,7 @@
 <xsl:include href="html_init.xsl"/>
 <xsl:include href="html_set.xsl"/>
 <xsl:include href="html_reals.xsl"/>
+<xsl:include href="html_ccorns.xsl"/>
 
 <xsl:variable name="showcast" select="0"/>
 
    <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
     <xsl:variable name="fontsymbol">
      <xsl:choose>
+      <xsl:when test="$symbol = 'append'">
+       <xsl:value-of select="'@'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'iff'">
+       <xsl:value-of select="'&#xAB;'"/>
+      </xsl:when>
       <xsl:when test="$symbol = 'forall'">
        <xsl:value-of select="'&#x22;'"/>
       </xsl:when>
    <xsl:otherwise>
     <xsl:variable name="unicodesymbol">
      <xsl:choose>
+      <xsl:when test="$symbol = 'append'">
+       <xsl:value-of select="'@'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'iff'">
+       <xsl:value-of select="'&#x2194;'"/>
+      </xsl:when>
       <xsl:when test="$symbol = 'forall'">
        <xsl:value-of select="'&#8704;'"/>
       </xsl:when>
 
 <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:apply-templates mode="inline" select="*[position()=3]"/>
      <xsl:text>)</xsl:text>
     </xsl:when>
+    <!-- IFF -->
+    <xsl:when test="$name='iff'">
+     <xsl:text>(</xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:call-template name="mksymbol-1">
+      <xsl:with-param name="symbol" select="$name"/>
+      <xsl:with-param name="color" select="'blue'"/>
+      <xsl:with-param name="size" select="'+0'"/>
+     </xsl:call-template>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <xsl:text>)</xsl:text>
+    </xsl:when>
+    <!-- APPEND -->
+    <xsl:when test="$name='append'">
+     <xsl:text>(</xsl:text>
+     <xsl:apply-templates mode="inline" select="*[position()=2]"/>
+     <xsl:call-template name="mksymbol-1">
+      <xsl:with-param name="symbol" select="$name"/>
+      <xsl:with-param name="color" select="'blue'"/>
+      <xsl:with-param name="size" select="'+0'"/>
+     </xsl:call-template>
+     <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+     <xsl:text>)</xsl:text>
+    </xsl:when>
     <!-- APP -->
     <xsl:when test="$name='app'">
      <xsl:text>(</xsl:text>
     <xsl:when test="$name='cast'">
      <xsl:text>(</xsl:text>
      <xsl:apply-templates mode="inline" select="*[position()=2]"/>
-     <xsl:text>:></xsl:text>
+     <xsl:text>:</xsl:text>
      <xsl:apply-templates mode="inline" select="*[position()=3]"/>
      <xsl:text>)</xsl:text>
     </xsl:when>
            select="./*[1]"/>
      </xsl:for-each>
     </xsl:when>
+    
+    <xsl:when test="$name='inst'">
+     <xsl:apply-templates select="*[2]" mode="inline"/>
+     <FONT color="blue">{</FONT>
+     <xsl:for-each select="*[(position()>2) and (position() mod 2 = 1)]">
+      <xsl:apply-templates select="following-sibling::*[position() = 1]" mode="inline"/>
+      <FONT color="blue">/</FONT> 
+      <xsl:if test="name()='m:ci'">
+       <a href="{@definitionURL}">
+        <xsl:apply-templates/>
+       </a>
+      </xsl:if>
+      <!-- <xsl:apply-templates select="." mode="inline"/> -->
+     </xsl:for-each>
+     <FONT color="blue">}</FONT>
+    </xsl:when>
+
     <!-- FIX -->
     <xsl:when test="$name='fix'">
      <FONT color="red">FIX</FONT>
       </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:value-of select="$charlength"/> -->
   <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
      <xsl:choose>
+     <!-- inst -->
+      <xsl:when test="$name='inst'">
+       <xsl:apply-templates select="." mode="inline"/>
+      </xsl:when>
      <!-- FORALL -->
       <xsl:when test="$name='forall'">
        <xsl:choose>
        </xsl:otherwise>
        </xsl:choose>
       </xsl:when>
+      <!-- IFF -->
+      <xsl:when test="$name='iff'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[position()=2]">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+       </xsl:apply-templates>
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
+       </xsl:call-template>
+       <!-- -> -->
+       <xsl:call-template name="mksymbol-1">
+        <xsl:with-param name="symbol" select="$name"/>
+        <xsl:with-param name="color" select="'blue'"/>
+        <xsl:with-param name="size" select="'+0'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="*[position()=3]">
+        <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+       </xsl:apply-templates>
+       <xsl:text>)</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+      <!-- APPEND -->
+      <xsl:when test="$name='append'">
+       <xsl:choose>
+       <xsl:when test="$charlength > $framewidth">
+       <xsl:text>(</xsl:text>
+       <xsl:apply-templates select="*[position()=2]">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
+       </xsl:apply-templates>
+       <br/>
+       <xsl:call-template name="make_indent">
+        <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
+       </xsl:call-template>
+       <!-- -> -->
+       <xsl:call-template name="mksymbol-1">
+        <xsl:with-param name="symbol" select="$name"/>
+        <xsl:with-param name="color" select="'blue'"/>
+        <xsl:with-param name="size" select="'+0'"/>
+       </xsl:call-template>
+       <xsl:apply-templates select="*[position()=3]">
+        <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+       </xsl:apply-templates>
+       <xsl:text>)</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:apply-templates mode="inline" select="."/>
+       </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
       <!-- APP -->
       <xsl:when test="$name='app'">
        <xsl:choose>
         <xsl: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 ************** -->
          <xsl:with-param name="current_indent" select="$current_indent"/>
         </xsl:apply-templates>
         &#x00a0;
+        <xsl:if test="*[4]">
+         <br/>
+         <xsl:call-template name="make_indent">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:call-template>
+         <FONT color="red">we proved&#x00a0;</FONT>
+         <xsl:apply-templates select="*[position()=3]">
+          <xsl:with-param name="current_indent" select="$current_indent+16"/>
+         </xsl:apply-templates>
+         <br/>
+         <xsl:call-template name="make_indent">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:call-template>
+         <FONT color="red">and by delta equivalence</FONT>
+         <xsl:apply-templates select="*[position()=5]">
+          <xsl:with-param name="current_indent" select="$current_indent+16"/>
+         </xsl:apply-templates>
+       </xsl:if>
        </span>
        <xsl:choose>
         <xsl:when test="(preceding-sibling::*[1]/text()='letin1') or
              <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>\
+             <a style="text-decoration:underline ; color:red" href="" onClick="Hide(document.getElementById(\'{$freshid1}\')); Show(document.getElementById(\'{$freshid2}\'));Hide(document.getElementById(\'{$freshid3}\'));return (0==1);">we obtain</a>\
             </span>\
            ');
            document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
          </script>
         </xsl:otherwise>
        </xsl:choose>
-       <xsl:apply-templates select="*[position()=3]">
+       <xsl:apply-templates select="*[position()=last()]">
         <xsl:with-param name="current_indent" select="$current_indent + 16"/>
        </xsl:apply-templates>
       </xsl:when>
diff --git a/helm/style/diseq.xsl b/helm/style/diseq.xsl
new file mode 100644 (file)
index 0000000..dd3650d
--- /dev/null
@@ -0,0 +1,336 @@
+<?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/.                                         -->
+
+<!--******************************************************************--> 
+<!-- Disequalities                                                    -->
+<!-- (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">
+
+<!-- ************************* LOGIC *********************************-->
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'eq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'eq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/Basic_Properties_of_leEq/leEq_transitive.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdl.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'eq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/Basic_Properties_of_leEq/leEq_less_trans.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/Basic_Properties_of_leEq/less_leEq_trans.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdr.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'eq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/COrdField_axioms/less_transitive_unfolded.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/COrdField_axioms/less_wdr.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'eq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Algebra/algebra/COrdFields/COrdField_axioms/less_wdl.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[5]"/>
+  <xsl:apply-templates mode="diseq" select="*[7]">
+   <xsl:with-param name="rel" select="'eq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Coq/Reals/Rbase/Rle_lt_trans.con'] and count(child::*) = 6]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[2]"/>
+  <xsl:apply-templates mode="diseq" select="*[5]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+ </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Coq/Reals/Rbase/Rlt_le_trans.con'] and count(child::*) = 6]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply>
+  <m:csymbol>diseq_chain</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[2]"/>
+  <xsl:apply-templates mode="diseq" select="*[5]">
+   <xsl:with-param name="rel" select="'lt'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+  <xsl:apply-templates mode="diseq" select="*[6]">
+   <xsl:with-param name="rel" select="'leq'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates mode="noannot" select="*[4]"/>
+ </m:apply>
+</xsl:template> 
+
+<xsl:template mode="diseq" match="*">
+ <xsl:param name="rel" select="'eq'"/>
+  <xsl:choose>
+   <xsl:when test="name()='APPLY'">
+    <xsl:variable name="id" select="@id"/>
+    <xsl:choose>
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_transitive.con'] and count(child::*) = 7">
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[4]"/>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+     </xsl:when> 
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdl.con'] and count(child::*) = 7">
+       <xsl:call-template name="generate_side_proof">
+        <xsl:with-param name="proof" select="*[7]"/>
+        <xsl:with-param name="show_statement" select="0"/>
+       </xsl:call-template>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'eq'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[3]"/>
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+     </xsl:when> 
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_less_trans.con'] and count(child::*) = 7">
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[4]"/>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/less_leEq_trans.con'] and count(child::*) = 7">
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[4]"/>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+     </xsl:when>  
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdr.con'] and count(child::*) = 7">
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[4]"/>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'eq'"/>
+       </xsl:apply-templates>
+     </xsl:when>  
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_transitive_unfolded.con'] and count(child::*) = 7">
+      <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[4]"/>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+     </xsl:when> 
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdr.con'] and count(child::*) = 7">
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[4]"/>
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'eq'"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdl.con'] and count(child::*) = 7">
+       <xsl:apply-templates mode="diseq" select="*[7]">
+        <xsl:with-param name="rel" select="'eq'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[3]"/>
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <!-- REALS -->
+     <xsl:when test="CONST[attribute::uri='cic:/Coq/Reals/Rbase/Rlt_le_trans.con'] and count(child::*) = 6">
+       <xsl:apply-templates mode="diseq" select="*[5]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[3]"/>
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <xsl:when test="CONST[attribute::uri='cic:/Coq/Reals/Rbase/Rle_lt_trans.con'] and count(child::*) = 6">
+       <xsl:apply-templates mode="diseq" select="*[5]">
+        <xsl:with-param name="rel" select="'leq'"/>
+       </xsl:apply-templates>
+       <xsl:apply-templates mode="noannot" select="*[3]"/>
+       <xsl:apply-templates mode="diseq" select="*[6]">
+        <xsl:with-param name="rel" select="'lt'"/>
+       </xsl:apply-templates>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:element name="{concat('m:',$rel)}"/>
+      <xsl:call-template name="generate_side_proof">
+       <xsl:with-param name="proof" select="."/>
+       <xsl:with-param name="show_statement" select="0"/>
+      </xsl:call-template> 
+     </xsl:otherwise>
+    </xsl:choose>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:element name="{concat('m:',$rel)}"/> 
+    <xsl:call-template name="generate_side_proof">
+     <xsl:with-param name="proof" select="."/>
+     <xsl:with-param name="show_statement" select="0"/>
+    </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
index b31160eab490d350a6b0d24f10604d17a33cc855..7b1316013c086a19e3192b25fed02e496fcc42fa 100644 (file)
 <!-- coercions -->
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-         (@uri='cic:/Algebra/CSemiGroups/csg_crr.con' or 
-          @uri='cic:/Algebra/CMonoids/cm_crr.con' or
-          @uri='cic:/Algebra/CGroups/cg_crr.con' or
-          @uri='cic:/Algebra/CRings/cr_crr.con' or
-          @uri='cic:/Algebra/CFields/cf_crr.con' or
-          @uri='cic:/Algebra/COrdFields/cof_crr.con' or
-          @uri='cic:/Algebra/CReals/crl_crr.con')]]">
+         (@uri='cic:/Algebra/algebra/CSemiGroups/csg_crr.con' or 
+          @uri='cic:/Algebra/algebra/CMonoids/cm_crr.con' or
+          @uri='cic:/Algebra/algebra/CGroups/cg_crr.con' or
+          @uri='cic:/Algebra/algebra/CRings/cr_crr.con' or
+          @uri='cic:/Algebra/algebra/CFields/cf_crr.con' or
+          @uri='cic:/Algebra/algebra/COrdFields/cof_crr.con' or
+          @uri='cic:/Algebra/reals/CReals/crl_crr.con')]]">
   <xsl:apply-templates select="*[position()=last()]"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-   @uri='cic:/Algebra/CSetoids/CSetoid_functions/csf_fun.con']]">
+   @uri='cic:/Algebra/algebra/CSetoids/CSetoid_functions/csf_fun.con']]">
      <xsl:variable name="no_params">
       <xsl:call-template name="get_no_params">
        <xsl:with-param name="first_uri" select="$CICURI"/>
@@ -84,7 +84,7 @@
 </xsl:template>
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-   @uri='cic:/Algebra/CSetoids/CSetoid_functions/csbf_fun.con']]">
+   @uri='cic:/Algebra/algebra/CSetoids/CSetoid_functions/csbf_fun.con']]">
      <xsl:variable name="no_params">
       <xsl:call-template name="get_no_params">
        <xsl:with-param name="first_uri" select="$CICURI"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-   @uri='cic:/Algebra/CSetoids/CSetoid_relations_and_predicates/csr_rel.con']]">
+   @uri='cic:/Algebra/algebra/CSetoids/CSetoid_relations_and_predicates/csr_rel.con']]">
      <xsl:variable name="no_params">
       <xsl:call-template name="get_no_params">
        <xsl:with-param name="first_uri" select="$CICURI"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-   @uri='cic:/Algebra/CRings/nat_injection/nring.con']]">
+   @uri='cic:/Algebra/algebra/CRings/nat_injection/nring.con']]">
      <xsl:variable name="no_params">
       <xsl:call-template name="get_no_params">
        <xsl:with-param name="first_uri" select="$CICURI"/>
index f60883079833af8b4b04ce54e95c7a77b659aee0..add3247b38f54625cf838f4a40e511792bb6ad3e 100644 (file)
 
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
-<xsl:include href="contentlib.xsl"/>   <!-- FG -->
+<!-- Warning: the first included stylesheet has the lowest precedence -->
+<xsl:include href="contentlib.xsl"/>
 <xsl:include href="basic.xsl"/>
-<xsl:include href="arith.xsl"/>        <!-- FG -->
+<xsl:include href="arith.xsl"/>
 <xsl:include href="set.xsl"/>
+<xsl:include href="list.xsl"/>
 <xsl:include href="reals.xsl"/>
-<xsl:include href="ring.xsl"/>        <!-- FG -->
+<xsl:include href="ring.xsl"/>
 <xsl:include href="algebra.xsl"/> 
 <xsl:include href="lambda.xsl"/>
+<xsl:include href="positive.xsl"/>
+<xsl:include href="ccorn.xsl"/>
 
 </xsl:stylesheet>
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 83569d751660cf0008629f29c8986d149b2f0441..1d6dc4dd7b76a815876ad72a69cc90c8f92717ed 100644 (file)
@@ -26,6 +26,7 @@
 
 <!--******************************************************************--> 
 <!-- XSLT version 0.1 of CIC inductive objects to MathML content:     -->
+<!-- Completely revisited: November 2002, Andrea asperti              -->
 <!-- First draft: March 2001, Andrea asperti                          -->
 <!--******************************************************************-->
 
                               xmlns:m="http://www.w3.org/1998/Math/MathML"
                               xmlns:helm="http://www.cs.unibo.it/helm">
 
+<!-- try_inductive essentially checks if the head constant is an
+     invocation of an induction principle. 
+     Si presuppone che il tipo induttivo non sia mutuamente 
+     induttivo. Bisognerebbe andare a vedere l'utlimo parametro
+     del presunto "principio di induzione", tirare fuori il tipo induttivo
+     e vedere se il suo nome coincide con il prefisso di _ind. 
+     Ad esempio nat_double_ind e' definito dall'utente. L'ultimo
+     parametro di nat_double_ind e' di tipo nat, e nat e' diverso
+     da nat_double. Per ora, verifico solo l'esistenza di nat_double,
+     ma questo, benche' non porti ad errore, non copre tutti i
+     casi per quelli mutuamente induttivi -->
+
+
+<xsl:template mode="try_inductive" match="APPLY">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="uri">
+  <xsl:choose>
+   <xsl:when test="name(*[1])='CONST'">
+    <xsl:value-of select="*[1]/@uri"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <!-- instantiate -->
+    <xsl:value-of select="*[1]/CONST[1]/@uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+  <xsl:when test="contains($uri,'_ind.con')">
+   <xsl:variable name="ind_uri" 
+        select="concat(substring-before($uri,'_ind.con'),'.ind')"/>
+   <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$ind_uri"/></xsl:call-template></xsl:variable>
+   <xsl:variable name="inductive_def" 
+        select="document($InductiveTypeUrl)/InductiveDefinition"/>
+   <xsl:choose>
+    <xsl:when test="$inductive_def">
+     <xsl:variable name="ind_name">
+      <xsl:call-template name="get_name">
+       <xsl:with-param name="uri" select="$uri"/>
+      </xsl:call-template>
+     </xsl:variable>
+     <xsl:apply-templates mode="inductive" select=".">
+      <xsl:with-param name="uri" select="$uri"/>
+      <xsl:with-param name="inductive_def_uri" 
+       select="$ind_uri"/>
+      <xsl:with-param name="inductive_def" select="$inductive_def"/>
+      <xsl:with-param name="inductive_def_index" select="1"/>
+      <xsl:with-param name="inductive_def_name" select="$ind_name"/>
+     </xsl:apply-templates>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="." mode="letin"/>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:apply-templates select="." mode="letin"/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
 
 <xsl:template mode="inductive" match="APPLY">
+ <xsl:param name="uri" select="''"/> 
  <xsl:param name="inductive_def_uri" select="''"/>
  <xsl:param name="inductive_def" select="/.."/>
  <xsl:param name="inductive_def_index" select="1"/>
  <xsl:param name="inductive_def_name" select="''"/>
- <xsl:param name="section_params" select="0"/>
+ <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$uri"/></xsl:call-template></xsl:variable>
  <!-- expected_args_type contains the types of the arguments expected by
       the induction principle -->
- <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="*[1]/@uri"/></xsl:call-template></xsl:variable>
  <xsl:variable name="expected_args_types" 
-       select="document($InductiveTypeUrl)/Definition/type//PROD[not(ancestor::source)]/source/*[1]"/>
+      select="document($InductiveTypeUrl)/ConstantType/PROD/decl/*[1]"/>
  <xsl:variable name="no_expected_args" select="count($expected_args_types)"/>
- <xsl:variable name="actual_arguments" select="*[position()>(1+$section_params)]"/>
+ <xsl:variable name="actual_arguments" select="*[position()>1]"/>
  <!-- First check that the induction principle is applied to the
       expected number of arguments -->
  <xsl:choose>
     <xsl:when test="string($argsOK) = 'true'">
      <!-- arguments are in the expected form: we create a
           "by_induction" content element -->
-     <!-- no_params is the number of paramters in square brackets -->
+     <!-- no_params is the number of parameters in square brackets -->
      <xsl:variable name="no_params" 
       select="$inductive_def/@noParams"/>
      <!-- the inductive property is the first argument following
            is the uri of the inductive definition -->
       <m:ci><xsl:value-of select="$inductive_def_uri"/></m:ci>
       <!-- next, we have the inductive property, currently not
-           used for rendering (it could be omitted??) -->
+           used for rendering (it could be omitted ??) -->
       <xsl:apply-templates mode="pure" select="$inductive_property"/>
       <!-- each case has its own "inductive_case" element -->
       <!-- the inductive case element is composed by:
          <m:csymbol>case_lhs</m:csymbol>
          <m:ci definitionURL="{$inductive_def_uri}">
           <xsl:value-of select="@name"/>
-         </m:ci>     
+         </m:ci> 
          <xsl:call-template name="get_constructor_args">
-          <xsl:with-param name="no_params" 
-               select="$no_params"/>
-          <xsl:with-param name="constructor_arity" 
-               select="*[1]"/>
-          <xsl:with-param name="actual_arg" 
-               select="$current_arg"/>
-          <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-          </xsl:call-template>
+          <xsl:with-param name="constructor_args" 
+               select="PROD/decl[position()> $no_params]"/>
+          <xsl:with-param name="actual_args" 
+               select="$current_arg/decl"/>
+          <xsl:with-param name="inductive_def_uri" 
+               select="$inductive_def_uri"/>
+          </xsl:call-template>  
         </m:apply>
         <m:apply>
          <m:csymbol>induction_hypothesis</m:csymbol>
          <xsl:call-template name="get_induction_hypothesis">
-          <xsl:with-param name="no_params" 
-               select="$no_params"/>
-          <xsl:with-param name="constructor_arity" 
-               select="*[1]"/>
-          <xsl:with-param name="actual_arg" 
-               select="$current_arg"/>
-          <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
+          <xsl:with-param name="constructor_args" 
+               select="PROD/decl[position()> $no_params]"/>
+          <xsl:with-param name="actual_args" 
+               select="$current_arg/decl"/>
+          <xsl:with-param name="inductive_def_uri" 
+               select="$inductive_def_uri"/>
          </xsl:call-template>
         </m:apply>
-        <xsl:call-template name="get_body">
-         <xsl:with-param name="no_params" 
-               select="$no_params"/>
-         <xsl:with-param name="constructor_arity" 
-               select="*[1]"/>
-         <xsl:with-param name="actual_arg" select="$current_arg"/>
-         <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-        </xsl:call-template>
+        <xsl:choose>
+         <xsl:when test="count(PROD/decl) > $no_params">
+          <!-- in this case the actual_arg must be a LAMBDA -->
+          <xsl:call-template name="get_body">
+           <xsl:with-param name="constructor_args" 
+               select="PROD/decl[position()>$no_params]"/>
+           <xsl:with-param name="actual_args" select="$current_arg/decl"/>
+           <xsl:with-param name="inductive_def_uri" 
+               select="$inductive_def_uri"/>
+           <xsl:with-param name="target" 
+               select="$current_arg/target/*[1]"/>
+          </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:apply-templates mode="noannot" select="$current_arg"/>
+         </xsl:otherwise>
+        </xsl:choose>
        </m:apply>
       </xsl:for-each>
       <!-- the inductive argument is the last argument of extra-args -->
      If this is not the case, not good rendering looks possible.
      Check_args returns a boolean. 
    -->
+
+
 <xsl:template name="check_args">
  <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">
-    <xsl:apply-templates mode="count_arity" select="$arg_types[1]">
-     <xsl:with-param name="what" select="'PROD'"/>
-    </xsl:apply-templates>
-   </xsl:variable>
-   <xsl:variable name="no_actual_abst_of_arg"> 
-    <xsl:apply-templates mode="count_arity" select="$actual_args[1]">
-     <xsl:with-param name="what" select="'LAMBDA'"/>
-    </xsl:apply-templates>
-   </xsl:variable>
-   <!-- REPLACE WITH EQUALITY ???? -->
+   <xsl:variable name="no_expected_arg_of_arg" 
+                 select="count($arg_types[1]/decl)"/>
+   <xsl:variable name="no_actual_abst_of_arg" 
+                 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]"/>
    </xsl:call-template> 
   </xsl:otherwise>
  </xsl:choose>
-</xsl:template>
+</xsl:template> 
 
-<!-- count_arity counts the number of head lambda (or prod) -->
-<xsl:template mode="count_arity" match="*">
- <xsl:param name="what" select="'LAMBDA'"/>
- <xsl:param name="num" select="0"/>
- <!-- MANCANO I CAST ??? -->
- <xsl:choose>
-  <xsl:when test="name(.) = $what">
-   <xsl:apply-templates mode="count_arity" select="target/*[1]">
-    <xsl:with-param name="what" select="$what"/>
-    <xsl:with-param name="num" select="$num+1"/>
-   </xsl:apply-templates>
-  </xsl:when>
-  <xsl:otherwise>
-   <xsl:value-of select="$num"/>
-  </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
 
 <!-- The following three functions are essentially identical
      in their recursive structure.
      single one without a conversion from document tree fragments
      to node-sets. 
 -->
+
 <xsl:template name="get_constructor_args">
- <xsl:param name="no_params" select="0"/>
- <xsl:param name="constructor_arity" select="/.."/>
- <xsl:param name="actual_arg" select="/.."/>
- <xsl:param name="inductive_def_name" select="''"/>
- <xsl:choose>
- <xsl:when test="$no_params = 0">
- <xsl:if test="name($constructor_arity)='PROD'">
+ <xsl:param name="constructor_args" select="/.."/>
+ <xsl:param name="actual_args" select="/.."/>
+ <xsl:param name="inductive_def_uri" select="''"/>
+ <xsl:if test="$constructor_args">
   <m:bvar>
-   <m:ci><xsl:value-of select="$actual_arg/target/@binder"/></m:ci>
+   <m:ci><xsl:value-of select="$actual_args[1]/@binder"/></m:ci>
    <m:type>
-    <xsl:apply-templates mode="pure" select="$actual_arg/source/*[1]"/>
+    <xsl:apply-templates mode="pure" select="$actual_args[1]/*"/>
    </m:type> 
   </m:bvar>
   <xsl:choose>
-   <xsl:when test="$constructor_arity/source//REL[@binder=$inductive_def_name]">
+   <xsl:when test="$constructor_args[1]//MUTIND[@uri=$inductive_def_uri]">
     <xsl:call-template name="get_constructor_args">
     <xsl:with-param name="constructor_arity" 
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg/target/LAMBDA/target/*[1]"/>
-    <xsl:with-param name="inductive_def_name
-               select="$inductive_def_name"/>
+        select="$constructor_args[position()>1]"/>
+    <xsl:with-param name="actual_args
+        select="$actual_args[position()>2]"/>
+    <xsl:with-param name="inductive_def_uri
+               select="$inductive_def_uri"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="get_constructor_args">
-    <xsl:with-param name="constructor_arity
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg/target/*[1]"/>
-    <xsl:with-param name="inductive_def_name
-               select="$inductive_def_name"/>
+    <xsl:with-param name="constructor_args
+        select="$constructor_args[position()>1]"/>
+    <xsl:with-param name="actual_args
+        select="$actual_args[position()>1]"/>
+    <xsl:with-param name="inductive_def_uri
+               select="$inductive_def_uri"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
- </xsl:when>
- <xsl:otherwise>
-  <xsl:call-template name="get_constructor_args">
-    <xsl:with-param name="no_params" select="$no_params - 1"/>
-    <xsl:with-param name="constructor_arity" 
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg"/>
-    <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-    </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
+</xsl:template> 
 
 <xsl:template name="get_induction_hypothesis">
- <xsl:param name="no_params" select="0"/>
- <xsl:param name="constructor_arity" select="/.."/>
- <xsl:param name="actual_arg" select="/.."/>
- <xsl:param name="inductive_def_name" select="''"/>
- <xsl:choose>
- <xsl:when test="$no_params = 0">
- <xsl:if test="name($constructor_arity)='PROD'">
+ <xsl:param name="constructor_args" select="/.."/>
+ <xsl:param name="actual_args" select="/.."/>
+ <xsl:param name="inductive_def_uri" select="''"/>
+ <xsl:if test="$constructor_args">
   <xsl:choose>
-   <xsl:when test="$constructor_arity/source//REL[@binder=$inductive_def_name]">
+   <xsl:when test="$constructor_args[1]//MUTIND[@uri=$inductive_def_uri]">
     <m:bvar>
      <m:ci>
-      <xsl:value-of select="$actual_arg/target/LAMBDA/target/@binder"/>
+      <xsl:value-of select="$actual_args[2]/@binder"/>
      </m:ci>
      <m:type>
       <xsl:apply-templates mode="pure" 
-           select="$actual_arg/target/LAMBDA/source"/>
+           select="$actual_args[2]/*"/>
      </m:type>
     </m:bvar>
     <xsl:call-template name="get_induction_hypothesis">
-    <xsl:with-param name="constructor_arity
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg/target/LAMBDA/target/*[1]"/>
-    <xsl:with-param name="inductive_def_name
-               select="$inductive_def_name"/>
+    <xsl:with-param name="constructor_args
+        select="$constructor_args[position()>1]"/>
+    <xsl:with-param name="actual_args
+        select="$actual_args[position()>2]"/>
+    <xsl:with-param name="inductive_def_uri
+               select="$inductive_def_uri"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="get_induction_hypothesis">
-    <xsl:with-param name="constructor_arity
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg/target/*[1]"/>
-    <xsl:with-param name="inductive_def_name
-               select="$inductive_def_name"/>
+    <xsl:with-param name="constructor_args
+        select="$constructor_args[position()>1]"/>
+    <xsl:with-param name="actual_args
+        select="$actual_args[position()>1]"/>
+    <xsl:with-param name="inductive_def_uri
+               select="$inductive_def_uri"/> 
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
- </xsl:when>
- <xsl:otherwise>
-  <xsl:call-template name="get_induction_hypothesis">
-    <xsl:with-param name="no_params" select="$no_params - 1"/>
-    <xsl:with-param name="constructor_arity" 
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg"/>
-    <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-    </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
 </xsl:template>
 
 <xsl:template name="get_body">
- <xsl:param name="no_params" select="0"/>
- <xsl:param name="constructor_arity" select="/.."/>
- <xsl:param name="actual_arg" select="/.."/>
- <xsl:param name="inductive_def_name" select="''"/>
- <xsl:choose>
- <xsl:when test="$no_params = 0">
+ <xsl:param name="constructor_args" select="/.."/>
+ <xsl:param name="actual_args" select="/.."/>
+ <xsl:param name="inductive_def_uri" select="''"/>
+ <xsl:param name="target" select="/.."/>
  <xsl:choose>
- <xsl:when test="name($constructor_arity)='PROD'">
-  <xsl:choose>
-   <xsl:when test="$constructor_arity/source//REL[@binder=$inductive_def_name]">
-    <xsl:call-template name="get_body">
-    <xsl:with-param name="constructor_arity" 
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg/target/LAMBDA/target/*[1]"/>
-    <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-    </xsl:call-template>
-   </xsl:when>
-   <xsl:otherwise>
-    <xsl:call-template name="get_body">
-    <xsl:with-param name="constructor_arity" 
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg/target/*[1]"/>
-    <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-    </xsl:call-template>
-   </xsl:otherwise>
-  </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
-  <xsl:apply-templates mode="noannot" select="$actual_arg"/>
- </xsl:otherwise> 
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
-  <xsl:call-template name="get_body">
-    <xsl:with-param name="no_params" select="$no_params - 1"/>
-    <xsl:with-param name="constructor_arity" 
-        select="$constructor_arity/target/*[1]"/>
-    <xsl:with-param name="actual_arg" 
-        select="$actual_arg"/>
-    <xsl:with-param name="inductive_def_name" 
-               select="$inductive_def_name"/>
-    </xsl:call-template>
- </xsl:otherwise>
+  <xsl:when test="$constructor_args">
+   <xsl:choose>
+    <xsl:when test="$constructor_args[1]//MUTIND[@uri=$inductive_def_uri]">
+     <xsl:call-template name="get_body">
+      <xsl:with-param name="constructor_args" 
+        select="$constructor_args[position()> 1]"/>
+      <xsl:with-param name="actual_args" 
+        select="$actual_args[position()> 2]"/>
+      <xsl:with-param name="inductive_def_uri" 
+               select="$inductive_def_uri"/>
+      <xsl:with-param name="target" 
+               select="$target"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:call-template name="get_body">
+      <xsl:with-param name="constructor_args" 
+        select="$constructor_args[position()> 1]"/>
+      <xsl:with-param name="actual_args" 
+        select="$actual_args[position()> 1]"/>
+      <xsl:with-param name="inductive_def_uri" 
+               select="$inductive_def_uri"/>
+      <xsl:with-param name="target" 
+               select="$target"/>
+     </xsl:call-template>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:choose>
+    <xsl:when test="$actual_args">
+      <xsl:apply-templates select="$actual_args[1]" mode="lambda_prop"/>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates mode="noannot" select="$target"/>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:otherwise> 
  </xsl:choose>
-</xsl:template>
+</xsl:template> 
 
 </xsl:stylesheet>
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 e3568a18ffb386ca03acc26471127570a4115197..e6d639a3bcf151aa92e47031597e26b5902232a3 100644 (file)
@@ -39,6 +39,8 @@
 
 <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>
@@ -52,7 +54,14 @@ xlink:href) -->
     <xsl:variable name="cnode" select="key('id',@xref)"/>
     <xsl:if test="$cnode/@definitionURL"> 
      <xsl:attribute name="xlink:href">
-      <xsl:call-template name="makeURL"><xsl:with-param name="uri" select="$cnode/@definitionURL"/></xsl:call-template>
+      <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 -->
diff --git a/helm/style/logic.xsl b/helm/style/logic.xsl
new file mode 100644 (file)
index 0000000..0a26126
--- /dev/null
@@ -0,0 +1,155 @@
+<?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/.                                         -->
+
+<!--******************************************************************--> 
+<!-- Basic Logic                                                      -->
+<!-- (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 mode="proof_transform" match="APPLY[CONST[attribute::uri='cic:/Coq/Init/Logic/False_ind.con'] and count(child::*) = 3]">
+ <xsl:variable name="id" select="@id"/>
+ <m:apply helm:xref="{@id}">
+  <m:csymbol>false_ind</m:csymbol>
+  <m:ci>cic:/Coq/Init/Logic/False_ind.con</m:ci>
+  <xsl:apply-templates mode="noannot" select="*[3]"/>
+ </m:apply>
+</xsl:template>
+
+
+<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]">
+  <xsl:variable name="id" select="@id"/>
+  <m:apply helm:xref="{@id}">
+   <m:csymbol>and_ind</m:csymbol>
+   <xsl:apply-templates mode="noannot" select="*[6]"/>
+   <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/*[1]/@binder"/></xsl:with-param></xsl:call-template></m:ci>
+   <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: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 mode="proof_transform" match="APPLY[CONST[
+ attribute::uri='cic:/Coq/Init/Logic/or_ind.con'] 
+ and count(child::*) = 7 and 
+ name(*[5])='LAMBDA' and count(*[5]/decl) = 1 and 
+ name(*[6])='LAMBDA' and count(*[6]/decl) = 1 ]">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="definition_url" 
+   select="'cic:/Coq/Init/Logic/Disjunction/or.ind'"/>
+ <m:apply helm:xref="{@id}">
+  <m:csymbol>full_or_ind</m:csymbol>
+  <xsl:apply-templates mode="noannot" select="*[7]"/>
+  <xsl:for-each select="$InnerTypes">
+   <xsl:apply-templates mode="pure" select="key('typeid',$id)/*[1]"/>
+  </xsl:for-each>
+  <m:apply>
+   <m:csymbol>left_case</m:csymbol>
+   <m:bvar>
+    <m:ci>
+     <xsl:value-of select="*[5]/*[1]/@binder"/>
+    </m:ci>
+    <m:type>
+     <xsl:apply-templates mode="pure" select="*[5]/*[1]/*"/>
+    </m:type>
+   </m:bvar>
+   <xsl:apply-templates mode="noannot" select="*[5]/target/*"/>
+  </m:apply>
+  <m:apply>
+   <m:csymbol>right_case</m:csymbol>
+   <m:bvar>
+    <m:ci>
+     <xsl:apply-templates mode="pure" select="*[6]/*[1]/@binder"/>
+    </m:ci>
+    <m:type>
+     <xsl:apply-templates mode="pure" select="*[6]/*[1]/*"/>
+    </m:type>
+   </m:bvar>
+   <xsl:apply-templates mode="noannot" select="*[6]/target"/>
+  </m:apply>
+ </m:apply>
+
+<!-- da tertminare 
+  </xsl:when>
+  <xsl:otherwise>
+   <m:apply helm:xref="{@id}">
+    <m:csymbol>or_ind</m:csymbol>
+    <xsl:apply-templates mode="noannot" select="*[7]"/>
+    <xsl:for-each select="$InnerTypes">
+     <xsl:apply-templates mode="pure" select="key('typeid',$id)/*[1]"/>
+    </xsl:for-each> 
+    <xsl:apply-templates mode="pure" select="*[5]"/>
+    <xsl:apply-templates mode="pure" select="*[6]"/>
+   </m:apply>
+  </xsl:otherwise>
+ </xsl:choose>
+-->
+</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 ]">
+  <xsl:variable name="id" select="@id"/>
+   <m:apply helm:xref="{@id}">
+    <m:csymbol>ex_ind</m:csymbol>
+    <xsl:apply-templates mode="noannot" select="*[6]"/>
+    <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/*[1]/@binder"/></xsl:with-param></xsl:call-template></m:ci>
+    <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: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 a9a9a954bbc5d90c61a36866512fd647c3fc0af2..c860e4b460662e2aea1db8760f9a57d27c360290 100644 (file)
 <!-- For details, see the HELM World-Wide-Web page,                    -->
 <!-- http://cs.unibo.it/helm/.                                         -->
 
-<!-- CSC: Sostituire l'andata a capo con la entity numerica opportuna -->
-<!DOCTYPE html [
- <!ENTITY CSCbr "
-">
-]>
-
 <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-  xmlns:h="http:/www.cs.unibo.it/helm/schemas/schema-h.rdf#">
+  xmlns:h="http://www.cs.unibo.it/helm/schemas/mattone.rdf#">
 
 <xsl:output method="text"/>
 
 
 <xsl:template match="/">
  <!--
- <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
+ <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&#x0A;</xsl:text>
  -->
- <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&CSCbr;</xsl:text>
+ <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&#x0A;</xsl:text>
  <xsl:variable name="quoted_CICURI">
   <xsl:call-template name="quote_url">
    <xsl:with-param name="s" select="$CICURI"/>
  <xsl:if test="name(document(concat($uri_set_queueURL,'is_overflowed?uri=',$quotedCurrentCICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))/*)='true'">
   <xsl:text>,color=red</xsl:text>
  </xsl:if>
- <xsl:text>];&CSCbr;</xsl:text>
+ <xsl:text>];&#x0A;</xsl:text>
 </xsl:template>
 
 <xsl:template match="*">
  <xsl:for-each select="*/*/*">
   <xsl:variable name="quotedURI">
    <xsl:call-template name="quote">
-    <xsl:with-param name="s" select="@rdf:value"/>
+    <xsl:with-param name="s" select="h:occurrence"/>
    </xsl:call-template>
   </xsl:variable>
   <xsl:variable name="quoted_uri">
    <xsl:call-template name="quote_url">
-    <xsl:with-param name="s" select="@rdf:value"/>
+    <xsl:with-param name="s" select="h:occurrence"/>
    </xsl:call-template>
   </xsl:variable>
   <!-- The nonce, quotedCurrentCICURI are used to force the document reload -->
    <xsl:text> -&gt; </xsl:text>
    <xsl:value-of select="$quotedURI"/>
    <xsl:value-of select="$link_direction"/>
-   <xsl:text>;&CSCbr;</xsl:text>
+   <xsl:text>;&#x0A;</xsl:text>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
index 3a07962a920fade8a8d414cd0d4e4dd265bac3f1..e433c4b26fe93825c6e3cc70c49ce79db9aac933 100644 (file)
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ht="http://www.cs.unibo.it/helm/namespaces/helm-theory"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:h="http:/www.cs.unibo.it/helm/schemas/schema-h.rdf#">
-
-<xsl:variable name="MainConclusion" select="'http://www.cs.unibo.it/helm/schemas/schema-h.rdf#MainConclusion'"/>
-<xsl:variable name="InConclusion" select="'http://www.cs.unibo.it/helm/schemas/schema-h.rdf#InConclusion'"/>
-<xsl:variable name="MainHypothesis" select="'http://www.cs.unibo.it/helm/schemas/schema-h.rdf#MainHypothesis'"/>
-<xsl:variable name="InHypothesis" select="'http://www.cs.unibo.it/helm/schemas/schema-h.rdf#InHypothesis'"/>
-<xsl:variable name="InBody" select="'http://www.cs.unibo.it/helm/schemas/schema-h.rdf#InBody'"/>
+   xmlns:h="http://www.cs.unibo.it/helm/schemas/mattone.rdf#">
 
 <xsl:template match="/">
                <html> 
                 <head>
-                 <title>Occurrences of <xsl:value-of select="*/*/@rdf:value"/></title>
+                 <title>Occurrences of <xsl:value-of select="*/*/@rdf:about"/></title>
                  <style>
                   a { text-decoration: none }
                   a.underline {text-decoration: underline }
                  </style>
                 </head>
                 <!-- CSC: method onLoad to be removed once the window -->
-                <!-- CSC: becomes a frame                              -->
+                <!-- CSC: becomes a frame                             -->
                 <body bgcolor="white" onLoad="window.focus()">
                 <xsl:apply-templates/>
                 </body>
 
 <xsl:template match="h:Object">
  <xsl:variable name="no_main"
-   select="count(*/h:Occurrence[@rdf:about=$MainConclusion])"/>
+   select="count(*/h:Occurrence/h:position[text()='MainConclusion'])"/>
  <xsl:variable name="no_concl"
-   select="count(*/h:Occurrence[@rdf:about=$InConclusion])"/>
+   select="count(*/h:Occurrence/h:position[text()='InConclusion'])"/>
  <xsl:variable name="no_main_hyp"
-   select="count(*/h:Occurrence[@rdf:about=$MainHypothesis])"/>
+   select="count(*/h:Occurrence/h:position[text()='MainHypothesis'])"/>
  <xsl:variable name="no_in_hyp"
-   select="count(*/h:Occurrence[@rdf:about=$InHypothesis])"/>
+   select="count(*/h:Occurrence/h:position[text()='InHypothesis'])"/>
  <xsl:variable name="no_body"
-   select="count(*/h:Occurrence[@rdf:about=$InBody])"/>
+   select="count(*/h:Occurrence/h:position[text()='InBody'])"/>
  <h1>Occurrences of <xsl:value-of select="@rdf:about"/></h1>
  
  <ul>
   <xsl:when test="$no_main = 0"/>
   <xsl:when test="15 > $no_main">
    <h2><a name="main">Head position inside conclusion:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$MainConclusion]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='MainConclusion']">
     <div style="margin: 0.25cm 0cm 0.25cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="typeonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="typeonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
   <xsl:when test="$no_main >= 15">
    <h2><a name="main">Head position inside conclusion:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$MainConclusion]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='MainConclusion']">
     <div style="margin: 0cm 0cm 0cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="linkonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="linkonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
   <xsl:when test="$no_concl = 0"/>
   <xsl:when test="15 > $no_concl">
    <h2><a name="concl">Inside conclusion:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$InConclusion]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='InConclusion']">
     <div style="margin: 0.25cm 0cm 0.25cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="typeonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="typeonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
   <xsl:when test="$no_concl >= 15">
    <h2><a name="concl">Inside conclusion:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$InConclusion]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='InConclusion']">
     <div style="margin: 0cm 0cm 0cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="linkonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="linkonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
   <xsl:when test="$no_main_hyp = 0"/>
   <xsl:when test="15 > $no_main_hyp">
    <h2><a name="main_hyp">Head position inside an hypothesis:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$MainHypothesis]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='MainHypothesis']">
     <div style="margin: 0.25cm 0cm 0.25cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="typeonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="typeonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
   <xsl:when test="$no_main_hyp >= 15">
    <h2><a name="main_hyp">Head position inside an hypothesis:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$MainHypothesis]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='MainHypothesis']">
     <div style="margin: 0cm 0cm 0cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="linkonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="linkonly"/>
     </div>
    </xsl:for-each>
   </xsl:when> 
   <xsl:when test="$no_in_hyp = 0"/>
   <xsl:when test="15 > $no_in_hyp">
    <h2><a name="hyp">Inside an hypothesis:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$InHypothesis]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='InHypothesis']">
     <div style="margin: 0.25cm 0cm 0.25cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="typeonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="typeonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
   <xsl:when test="$no_in_hyp >= 15">
    <h2><a name="hyp">Inside an hypothesis:</a></h2>
-   <xsl:for-each select="*/h:Occurrence[@rdf:about=$InHypothesis]">
+   <xsl:for-each select="*/h:Occurrence[h:position/text()='InHypothesis']">
     <div style="margin: 0cm 0cm 0cm 0.75cm">
-     <ht:OBJECT uri="{@rdf:value}" mode="linkonly"/>
+     <ht:OBJECT uri="{h:occurrence}" mode="linkonly"/>
     </div>
    </xsl:for-each>
   </xsl:when>
  </xsl:choose>
  <xsl:if test="$no_body > 0">
   <h2><a name="body">Inside the body:</a></h2>
-  <xsl:for-each select="*/h:Occurrence[@rdf:about=$InBody]">
+  <xsl:for-each select="*/h:Occurrence[h:position/text()='InBody']">
    <div style="margin: 0cm 0cm 0cm 0.75cm">
-    <ht:OBJECT uri="{@rdf:value}" mode="linkonly"/>
+    <ht:OBJECT uri="{h:occurrence}" mode="linkonly"/>
    </div>
   </xsl:for-each>
  </xsl:if>
index 554c3a87be33d72027f1d591ea536d82a7a0e336..b63ebee8aea5867ae3174ada0a284ff1ce390f11 100644 (file)
@@ -1293,18 +1293,38 @@ an mo. Mixed content: mrow which contains mo + presentation elements -->
   <xsl:choose>
     <xsl:when test="$IN_PREC &gt; $MINUS_PREC or $IN_PREC=$MINUS_PREC and
                                                         $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="minus">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
+      <!-- HELM: m:mrow is now used when the minus operator is unary.
+           Igor used m:mfenced instead. -->
+      <xsl:choose>
+       <xsl:when test="count(*)=2">
+        <m:mrow>
+          <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
+            <xsl:attribute name="xref">
+              <xsl:value-of select="@id"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:apply-templates select="." mode="minus">
+            <xsl:with-param name="PARAM" select="$PARAM"/>
+            <xsl:with-param name="PAREN" select="$PAR_YES"/>
+            <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
+          </xsl:apply-templates>
+        </m:mrow>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mfenced separators="">
+          <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
+            <xsl:attribute name="xref">
+              <xsl:value-of select="@id"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:apply-templates select="." mode="minus">
+            <xsl:with-param name="PARAM" select="$PARAM"/>
+            <xsl:with-param name="PAREN" select="$PAR_YES"/>
+            <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
+          </xsl:apply-templates>
+        </m:mfenced>
+       </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
                     and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
index 4a801a65402c244e03bbe273c6a4d7a7ba1709a3..fad3dce6b333edad5e4b32d06e5baa38c34cca9d 100644 (file)
@@ -1105,6 +1105,96 @@ which generates the toplevel element (see for instance xlink) -->
        </xsl:otherwise>
        </xsl:choose>
       </xsl:when>
+      <!-- INST -->
+      <xsl:when test="$name='inst'">
+       <m:mrow>
+        <xsl:if test="$id != ''">
+         <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="*[2]"/>
+        <m:mo stretchy="false">{</m:mo>
+        <xsl:for-each select="*[(position()>2) and (position() mod 2 = 1)]">
+         <xsl:apply-templates select="."/>
+         <m:mo stretchy="false">:=</m:mo>
+         <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
+        </xsl:for-each>
+        <m:mo stretchy="false">}</m:mo>
+       </m:mrow>
+      </xsl:when>
+      <!-- APPEND -->
+      <xsl:when test="$name='append'">
+       <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: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>
+      <!-- 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 ************** -->
       <!-- ***************************************** -->
@@ -1478,23 +1568,112 @@ which generates the toplevel element (see for instance xlink) -->
            </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>
+         <xsl:variable name="charlength1">
+          <xsl:apply-templates select="*[3]" mode="root_charcount"/>
+         </xsl:variable>
+         <xsl:variable name="charlength2">
+          <xsl:apply-templates select="*[4]" mode="root_charcount"/>
+         </xsl:variable>
+         <xsl:variable name="charlength3">
+          <xsl:apply-templates select="*[5]" mode="root_charcount"/>
+         </xsl:variable>
+         <xsl:variable name="split1"
+           select="($charlength1 + $charlength2) >= $framewidth"/>
+         <xsl:variable name="split2"
+           select="($charlength2 + $charlength3) >= $framewidth"/>
+         <xsl:choose>
+          <xsl:when test="$split1">
+           <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:mrow>
+            </m:mtd>
+           </m:mtr>
+           <xsl:choose>
+            <xsl:when test="$split2">
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+               <m:mtext>with</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>by</m:mtext>
+                <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+                <xsl:apply-templates select="*[5]"/>
+               </m:mrow>
+              </m:mtd>
+             </m:mtr>
+            </xsl:when>
+            <xsl:otherwise>
+             <m:mtr>
+              <m:mtd>
+               <m:mrow>
+               <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>
+            </xsl:otherwise>
+           </xsl:choose>
+          </xsl:when>
+          <xsl:when test="$split2">
+           <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:mrow>
+            </m:mtd>
+           </m:mtr>
+           <m:mtr>
+            <m:mtd>
+             <m:mrow>
+              <m:mtext>by</m:mtext>
+              <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+              <xsl:apply-templates select="*[5]"/>
+             </m:mrow>
+            </m:mtd>
+           </m:mtr>
+          </xsl:when>
+          <xsl:otherwise>
+           <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>
+          </xsl:otherwise>
+         </xsl:choose>
         </m:mtable>
       </xsl:when>
       <!-- not existing any more
@@ -1966,7 +2145,7 @@ which generates the toplevel element (see for instance xlink) -->
         <xsl:apply-templates select="*[3]"/>
       </xsl:when>
       <!-- interp -->
-      <xsl:when test="$name='forgetful'">
+      <xsl:when test="$name='interp'">
        <m:mfenced open="[" close="]">
         <xsl:if test="$id != ''">
          <xsl:attribute name="xref"><xsl:value-of select="$id"/></xsl:attribute>
@@ -1977,7 +2156,7 @@ which generates the toplevel element (see for instance xlink) -->
 
       <!-- ERROR -->
       <xsl:otherwise>
-       <m:mi>ERROR</m:mi>
+       <m:mi>ERROR(&quot;<xsl:value-of select="$name"/>&quot;)</m:mi>
       </xsl:otherwise>
      </xsl:choose>
     </m:mrow>
@@ -2086,6 +2265,24 @@ which generates the toplevel element (see for instance xlink) -->
 <!--       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>
+
 <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">
@@ -2113,14 +2310,24 @@ which generates the toplevel element (see for instance xlink) -->
 </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:param name="incurrent_length" select="0"/> 
+ <xsl:param name="nosibling" select="0"/>
+ <xsl:variable name="mylength">
+  <xsl:choose>
+   <!-- special notation -->
+   <xsl:when test="text()='append'">3</xsl:when>
+   <!-- no notation -->
+   <xsl:otherwise>
+    <xsl:value-of select="string-length()"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
     <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:when test="$framewidth > ($incurrent_length + $mylength) 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 + $mylength"/></xsl:apply-templates></xsl:variable>
      <xsl:choose>
      <xsl:when test="string($siblength) = &quot;&quot;">
-      <xsl:value-of select="$incurrent_length + string-length()"/>
+      <xsl:value-of select="$incurrent_length + $mylength"/>
      </xsl:when>
      <xsl:otherwise>
       <xsl:value-of select="number($siblength)"/>
@@ -2128,7 +2335,7 @@ which generates the toplevel element (see for instance xlink) -->
      </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
-     <xsl:value-of select="$incurrent_length + string-length()"/>
+     <xsl:value-of select="$incurrent_length + $mylength"/>
     </xsl:otherwise>
     </xsl:choose>
 </xsl:template> 
index 5cf944e72ec54c20b16c344de1b82859b8b4a691..7081ad83f19cb045b7d5025aca09f6816d52dd1b 100644 (file)
      <m:mtd>
       <m:mrow>
        <m:mo stretchy="false">(</m:mo>
-       <xsl:apply-templates select="*[position()=2]"/>
+       <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:mo>
+        <xsl:if test="*[1]/@id">
+         <xsl:attribute name="xref">
+          <xsl:value-of select="*[1]/@id"/>
+         </xsl:attribute>
+        </xsl:if><xsl:value-of select="$symbol"/></m:mo>
+       <xsl:apply-templates select="*[3]"/>
       </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>
-        <m:mo>
-         <xsl:if test="*[1]/@id">
-          <xsl:attribute name="xref">
-           <xsl:value-of select="*[1]/@id"/>
-          </xsl:attribute>
-         </xsl:if><xsl:value-of select="$symbol"/></m:mo>
-        <xsl:apply-templates select="."/>
-       </m:mrow>
-      </m:mtd>
-     </m:mtr>
-    </xsl:for-each>
     <m:mtr>
      <m:mtd>
       <m:mrow>
 </xsl:template>
 
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
index ceb7a22bacea1b6818a37540ac0ad87c09534d01..5b243e78362c30e52b1eb39c05a33f5fe87cbfc5 100644 (file)
     <xsl:apply-templates select="*[1]"/>
 </xsl:template>
 
+
+<!-- FUNZIONI AUSILIARIE -->
+
+<xsl:template name="name_of_uri_bis">
+ <xsl:param name="uri" select="&quot;&quot;"/>
+  <xsl:variable name="suffix" select="substring-after($uri, &quot;/&quot;)"/>
+  <xsl:choose>
+   <xsl:when test="$suffix = &quot;&quot;">
+    <xsl:value-of select="substring-before($uri,&quot;.var&quot;)"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:call-template name="name_of_uri_bis">
+     <xsl:with-param name="uri" select="$suffix"/>
+    </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="var_name">
+ <xsl:param name="uri"/>
+ <xsl:param name="string" select="&quot;&quot;"/>
+  <xsl:variable name="prefix0" select="substring-before($uri, &quot; &quot;)"/>
+  <xsl:variable name="suffix" select="substring-after($uri, &quot; &quot;)"/> 
+  <xsl:variable name="prefix">
+   <xsl:call-template name="name_of_uri_bis">
+    <xsl:with-param name="uri" select="$prefix0"/>
+   </xsl:call-template>
+  </xsl:variable> 
+  <!--xsl:if test="string($prefix) != &quot; &quot; "-->
+   <xsl:variable name="string1" select="concat($string,', ', $prefix)"/>
+  <!--/xsl:if-->
+  <xsl:choose>
+   <xsl:when test="$suffix = &quot;&quot;">
+   <xsl:value-of select="substring-after(concat($string1, ' '),',')"/>
+   </xsl:when>
+   <xsl:otherwise>
+   <xsl:call-template name="var_name">
+    <xsl:with-param name="uri" select="$suffix"/>
+    <xsl:with-param name="string" select="$string1"/>
+   </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+                                 
+                                 
 <!-- CIC OBJECTS -->
 
 <xsl:template match="Sequent">  <!-- For Sequents there are no annotations --> 
     </Sequent> 
 </xsl:template>
 
-<xsl:template match="Definition" mode="noannot">
+<xsl:template match="ConstantType" mode="noannot">
+    <xsl:variable name="ConstantBodyUrl" 
+                  select="concat($BaseCICURI,'.body')"/>
     <Definition name="{@name}" helm:xref="{@id}">  
      <xsl:if test="string(@params) != &quot;&quot;">
       <Params>
-       <xsl:value-of select="@params"/>
+      <xsl:call-template name="var_name">
+       <xsl:with-param name="uri" select="concat(@params, ' ')"/>
+      </xsl:call-template>
       </Params>
      </xsl:if>
 <!--     <xsl:choose>
       </xsl:otherwise>
      </xsl:choose> -->
      <body>
-      <xsl:apply-templates select="body/*[1]"/>
+      <m:ci definitionURL="{$ConstantBodyUrl}">click here</m:ci>
      </body>
      <type>
-       <xsl:apply-templates select="type/*[1]"/>
+       <xsl:apply-templates select="./*[1]"/>
      </type>
     </Definition> 
 </xsl:template>
 
-<xsl:template match="Axiom" mode="noannot"> 
-    <Axiom name="{@name}" helm:xref="{@id}">
+<xsl:template match="ConstantBody" mode= "noannot">
+    <Definition name="{@for}" helm:xref="{@id}">  
      <xsl:if test="string(@params) != &quot;&quot;">
       <Params>
-       <xsl:value-of select="@params"/>
+       <xsl:call-template name="var_name">
+       <xsl:with-param name="uri" select="concat(@params, ' ')"/>
+       </xsl:call-template>
       </Params>
      </xsl:if>
+     <body>
+      <xsl:apply-templates select="./*[1]"/>
+     </body>
      <type>
-       <xsl:apply-templates select="type/*[1]"/>
+       <xsl:apply-templates select="document($ConstantTypeUrl)/*[1]/*[1]"/>
      </type>
-    </Axiom> 
+    </Definition>
 </xsl:template>
 
+
 <xsl:template match="CurrentProof" mode="noannot">
-    <CurrentProof name="{@name}" helm:xref="{@id}">
+    <CurrentProof name="{@of}" helm:xref="{@id}">
      <xsl:for-each select="Conjecture">
       <Conjecture no="{@no}" helm:xref="{@id}">
         <xsl:for-each select="*">
        <xsl:apply-templates select="body/*[1]"/>
      </body>
      <type>
-       <xsl:apply-templates select="type/*[1]"/>
+       <xsl:apply-templates select="document($ConstantTypeUrl)/*[1]/*[1]"/>
      </type>
     </CurrentProof> 
 </xsl:template>
index 7d890d61144fb193247170a1f9ba02aad9f2c8ca..5bad7e108109156abaa78a05e02ae0268902249e 100644 (file)
 
 <!-- CIC DEFINITION -->
 
-<xsl:template match="Definition">
-    <xsl:choose>
+<xsl:template match="ConstantType">
+  <xsl:choose>
    <xsl:when test="$type='typeonly'">
     <type>
-     <xsl:apply-templates select="type/*[1]"/>
+     <xsl:apply-templates select="./*[1]" mode="noannot"/>
     </type>
    </xsl:when>
    <xsl:otherwise>
     <Definition name="{@name}" helm:xref="{@id}">  
      <xsl:if test="string(@params) != &quot;&quot;">
       <Params>
-       <xsl:value-of select="@params"/>
+       <xsl:call-template name="var_name">
+        <xsl:with-param name="uri" select="concat(@params, ' ')"/>
+       </xsl:call-template>
       </Params>
      </xsl:if>
-     <body>
-       <xsl:apply-templates select="body/*[1]"/>
-     </body>
+     <body/>
      <type>
-       <xsl:apply-templates select="type/*[1]"/>
+       <xsl:apply-templates select="./*[1]" mode="noannot"/>
      </type>
     </Definition>
    </xsl:otherwise>
-   </xsl:choose>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="Axiom|CurrentProof|InductiveDefinition|Variable">
     <xsl:apply-templates select="." mode="noannot"/>
 </xsl:template>
 
-<xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX">
+<xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|instantiate">
     <m:math>
      <xsl:apply-templates select="." mode="noannot"/>
     </m:math>
 </xsl:template>
 
-<xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX" mode="noannot">
+<xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|instantiate" mode="noannot">
     <xsl:apply-templates select="." mode="pure"/>
 </xsl:template>
 
index d703bfe069c13a396e093acbbb106247a3179348..1b5f4167064ad29292eba15569bda9ebbbfdd021 100644 (file)
 <!-- CSC: PROBLEMA: URI CHE NON CONTENGONO / ED INIZIANO CON cic: -->
 <xsl:template name="name_of_uri">
  <xsl:param name="uri" select="&quot;&quot;"/>
+ <xsl:param name="extension" select="'.con'"/>
  <xsl:variable name="suffix" select="substring-after($uri, &quot;/&quot;)"/>
  <xsl:choose>
   <xsl:when test="$suffix = &quot;&quot;">
    <!-- CSC: PROBLEMA: .con PUO' APPARIRE ALL'INTERNO DELLE URI ===>
      SCRIVERE UNA FUNZIONE RICORSIVA CHE RISOLVA -->
-   <xsl:value-of select="substring-before($uri,&quot;.con&quot;)"/>
+   <xsl:value-of select="substring-before($uri,$extension)"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="name_of_uri">
     <xsl:with-param name="uri" select="$suffix"/>
+    <xsl:with-param name="extension" select="$extension"/> 
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  </xsl:choose>   
 </xsl:template>
 
+<!-- path gives the path of a uri, up to the final name -->
+<xsl:template name="path">
+ <xsl:param name="uri" select="&quot;&quot;"/>
+ <xsl:param name="current_path" select="&quot;&quot;"/>
+ <xsl:choose>
+  <xsl:when test="(substring-after($uri,&quot;/&quot;) != &quot;&quot;)">
+   <xsl:call-template name="path">
+    <xsl:with-param 
+        name="uri" select="substring-after($uri,&quot;/&quot;)"/>
+    <xsl:with-param
+        name="current_path" select="concat($current_path,substring-before($uri,&quot;/&quot;),'/')"/> 
+   </xsl:call-template>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="$current_path"/>
+  </xsl:otherwise>
+ </xsl:choose>   
+</xsl:template>
+
 <xsl:template name="blank_counting">
  <xsl:param name="string" select="&quot;&quot;"/>
  <xsl:param name="counter" select="0"/>
       </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
-         <xsl:when test="$offset > 0">
-          <xsl:variable name="params"> 
-        <xsl:variable name="second_url">
-                       <xsl:call-template name="URLofURI4getter">
-                               <xsl:with-param name="uri" select="$second_uri"/>
-                       </xsl:call-template>
-               </xsl:variable>
-        <xsl:value-of select="document($second_url)/*/@params"/>
+      <xsl:when test="$offset > 0">
+       <xsl:variable name="params"> 
+        <xsl:variable name="second_url"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$second_uri"/></xsl:call-template></xsl:variable>
+        <xsl:value-of 
+            select="document($second_url)/*/@params"/>
        </xsl:variable>
        <xsl:variable name="minimum">
         <xsl:call-template name="min">
         </xsl:call-template>
        </xsl:variable>
        <xsl:choose>
-        <xsl:when test="0 > $minimum">0</xsl:when>
+        <xsl:when test="0 > $minimum">
+         0
+        </xsl:when>
         <xsl:otherwise>
          <xsl:variable name="relevant_params">
           <!-- the blank after : in the next line is essential -->
            <xsl:with-param name="counter" select="0"/>
           </xsl:call-template>
          </xsl:variable>
-         <xsl:value-of select="number($tokens - $separators)"/>
+         <xsl:value-of select="$tokens - $separators"/>
         </xsl:otherwise>
        </xsl:choose>
       </xsl:when>
-      <xsl:otherwise>0</xsl:otherwise>
+      <xsl:otherwise>
+      0
+      </xsl:otherwise>
      </xsl:choose>
 </xsl:template>
 
     <xsl:when test="($noparams != 0) and ((name(.)=string($binder)) or (name(.)=&quot;CAST&quot;))">
      <xsl:choose>
      <xsl:when test="name(.) = string($binder)">
-      <xsl:if test="$target = 0">
-       <xsl:choose>
-       <xsl:when test="string($binder) = &quot;LAMBDA&quot;">
-        <m:ci>
-         <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
-        </m:ci>
+      <xsl:choose>
+       <xsl:when test="$noparams >= count(decl)">
+        <xsl:for-each select="decl">
+         <xsl:if test="$target = 0">
+          <xsl:choose>
+          <xsl:when test="string($binder) = &quot;LAMBDA&quot;">
+           <m:ci>
+            <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+           </m:ci>
+          </xsl:when>
+          <xsl:otherwise> 
+           <Param name="{@binder}">
+            <xsl:apply-templates select="*[1]"/>
+           </Param>
+          </xsl:otherwise>
+          </xsl:choose>
+         </xsl:if> 
+       </xsl:for-each>
+        <xsl:apply-templates select="target/*[1]" mode="abstparams">
+         <xsl:with-param name="noparams" select="$noparams - count(decl)"/>
+         <xsl:with-param name="target" select="$target"/>
+         <xsl:with-param name="binder" select="$binder"/>
+        </xsl:apply-templates>
        </xsl:when>
-       <xsl:otherwise> 
-        <Param name="{target/@binder}">
-         <xsl:apply-templates select="source"/>
-        </Param>
+       <xsl:otherwise>
+        <xsl:for-each select="decl[$noparams >= position()]">
+         <xsl:if test="$target = 0">
+          <xsl:choose>
+          <xsl:when test="string($binder) = &quot;LAMBDA&quot;">
+           <m:ci>
+            <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+           </m:ci>
+          </xsl:when>
+          <xsl:otherwise> 
+           <Param name="{@binder}">
+            <xsl:apply-templates select="*[1]"/>
+           </Param>
+          </xsl:otherwise>
+          </xsl:choose>
+         </xsl:if> 
+       </xsl:for-each>
+        <xsl:if test="$target = 1">
+         <xsl:choose>
+         <xsl:when test="name(.)=&quot;PROD&quot;">
+          <xsl:apply-templates select="decl[position()=$noparams+1]" mode="prod"/>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:apply-templates select="decl[position()=$noparams+1]" mode="lambda_prop"/>
+         </xsl:otherwise>
+        </xsl:choose>
+        </xsl:if>
        </xsl:otherwise>
-       </xsl:choose>
-      </xsl:if>
-      <xsl:apply-templates select="target/*[1]" mode="abstparams">
-       <xsl:with-param name="noparams" select="$noparams - 1"/>
-       <xsl:with-param name="target" select="$target"/>
-       <xsl:with-param name="binder" select="$binder"/>
-      </xsl:apply-templates>
+      </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
       <xsl:apply-templates select="term/*[1]" mode="abstparams">
  <xsl:when test="name(.) = &quot;PROD&quot;">
   <xsl:apply-templates select="target/*[1]" mode="counting">
    <xsl:with-param name="noparams" select="$noparams"/>
-   <xsl:with-param name="count" select="$count + 1"/>
+   <xsl:with-param name="count" select="$count + count(decl)"/> 
   </xsl:apply-templates>
  </xsl:when>
  <xsl:when test="name(.) = &quot;CAST&quot;">
index f61cbe6d90d1ea9fece3bf22847b6a25ab8a357f..dbcfabaa31ae67ac9ba1a47771de7a024e000ec6 100644 (file)
                               xmlns:m="http://www.w3.org/1998/Math/MathML"
                               xmlns:helm="http://www.cs.unibo.it/helm">
 
+<xsl:include href="logic.xsl"/>
+<xsl:include href="inductive.xsl"/>
+<xsl:include href="rewrite.xsl"/>
+<xsl:include href="diseq.xsl"/>
+
 <!-- ************************* LOGIC *********************************-->
 
 <!-- Proof objects -->
 
-<!-- <xsl:key name="typeid" use="@of" match="TYPE"/> -->
 <xsl:key name="typeid" use="@of" match="TYPE"/>
 
-<!-- ALL this elements does not have inner type -->
-<xsl:template match="PROD|SORT|MUTIND" mode="noannot">
+<!-- These elements do not have inner type -->
+<xsl:template match="PROD|SORT|MUTIND|instantiate" mode="noannot">
  <xsl:apply-templates select="." mode="pure"/>
 </xsl:template>
 
  </xsl:variable>
  <xsl:choose>
   <xsl:when test="$naturalLanguage='yes' and @sort='Prop' and $innertype_available='yes'">
+   <!--xsl:when test="@sort='Prop'"-->
    <m:apply helm:xref="{@id}">
     <m:csymbol>proof</m:csymbol>
     <xsl:apply-templates mode="proof_transform" select="."/>
-    <!-- <xsl:apply-templates mode="try_inductive" select="."/> -->
     <xsl:for-each select="$InnerTypes">
      <xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
     </xsl:for-each>
 
 <!-- ALL ELEMENTS WITH A TYPE ARE TRANSLATED AS A PROOF-ELEMENT -->
 
-<!-- LAMBDA has inner type only if it is not nested inside another lambda -->
 <xsl:template match="LAMBDA" mode="noannot">
+ <xsl:choose>
+  <xsl:when test="@sort='Prop'">
+   <xsl:apply-templates select="*[1]" mode="lambda_prop"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <!-- mode lambda is defined in content.xsl -->
+   <xsl:apply-templates select="*[1]" mode="lambda"/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="decl" mode="lambda_prop">
  <xsl:variable name="id" select="@id"/>
  <xsl:variable name="innertype_available">
   <xsl:for-each select="$InnerTypes">
   </xsl:for-each>
  </xsl:variable>
  <xsl:choose>
-  <xsl:when test="$naturalLanguage='yes' and @sort='Prop' and $innertype_available='yes'">
+  <xsl:when test="$naturalLanguage='yes' and $innertype_available='yes'">
    <m:apply helm:xref="{@id}">
     <m:csymbol>proof</m:csymbol>
-    <xsl:apply-templates mode="proof_transform" select="."/>
+    <m:lambda helm:xref="{@id}">
+     <m:bvar>
+      <m:ci>
+       <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+      </m:ci>
+      <m:type>
+       <xsl:apply-templates select="*[1]" mode="noannot"/>
+      </m:type>
+     </m:bvar>
+     <xsl:apply-templates select="following-sibling::*[1]" mode="lambda_prop"/>
+    </m:lambda>
     <xsl:for-each select="$InnerTypes">
      <xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
     </xsl:for-each>
    </m:apply>
   </xsl:when>
   <xsl:otherwise>
-   <xsl:apply-templates select="." mode="pure"/>
+   <m:lambda helm:xref="{@id}">
+    <m:bvar>
+     <m:ci>
+      <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template> 
+     </m:ci>
+     <m:type>
+      <xsl:apply-templates select="*[1]" mode="noannot"/>
+     </m:type>
+    </m:bvar>
+    <xsl:apply-templates select="following-sibling::*[1]" mode="lambda_prop"/>
+   </m:lambda>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="target" mode="lambda_prop">
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+</xsl:template>
+
+<!-- LETIN -->
+
+<xsl:template match="LETIN" mode="noannot">
+ <xsl:choose>
+  <xsl:when test="@sort='Prop'">
+   <xsl:apply-templates select="*[1]" mode="letin_prop"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <!-- mode letin is defined in content.xsl -->
+   <xsl:apply-templates select="*[1]" mode="letin_pure"/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="def" mode="letin_prop">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="innertype_available">
+  <xsl:for-each select="$InnerTypes">
+   <xsl:if test="key('typeid',$id)/*">
+    <xsl:text>yes</xsl:text>
+   </xsl:if>
+  </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+  <xsl:when test="$naturalLanguage='yes' and $innertype_available='yes'">
+   <m:apply helm:xref="{@id}">
+    <m:csymbol>proof</m:csymbol>
+    <m:apply helm:xref="{@id}">
+     <m:csymbol>let_in</m:csymbol>
+     <m:bvar>
+      <m:ci>
+       <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
+      </m:ci>
+     </m:bvar>
+     <xsl:apply-templates select="*[1]" mode="noannot"/>
+     <xsl:apply-templates select="following-sibling::*[1]" mode="letin_prop"/>
+    </m:apply>
+    <xsl:for-each select="$InnerTypes">
+     <xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
+    </xsl:for-each>
+   </m:apply>
+  </xsl:when>
+  <xsl:otherwise>
+   <m:apply helm:xref="{@id}">
+    <m:csymbol>let_in</m:csymbol>
+    <m:bvar>
+     <m:ci>
+      <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template> 
+     </m:ci>
+    </m:bvar>
+    <xsl:apply-templates select="*[1]" mode="noannot"/>
+    <xsl:apply-templates select="following-sibling::*[1]" mode="letin_prop"/>
+   </m:apply>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 
+<xsl:template match="target" mode="letin_prop">
+ <xsl:apply-templates select="*[1]" mode="noannot"/>
+</xsl:template>
+
 <!-- ALL these elements have inner type -->
-<xsl:template match="LETIN|CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
+<xsl:template match="CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
  <xsl:variable name="id" select="@id"/>
  <xsl:choose>
   <xsl:when test="$naturalLanguage='yes' and @sort='Prop'">
    <m:apply helm:xref="{@id}">
     <m:csymbol>proof</m:csymbol>
     <xsl:apply-templates mode="proof_transform" select="."/>
-    <!-- <xsl:apply-templates mode="try_inductive" select="."/> -->
     <xsl:for-each select="$InnerTypes">
      <xsl:apply-templates mode="pure" select="key('typeid',$id)/*"/>
     </xsl:for-each>
  </xsl:choose>
 </xsl:template>
 
-<!-- si presuppone che il tipo induttivo non sia mutuamente 
-     induttivo. Bisognerebbe andare a vedere l'ultimo parametro
-     del presunto "principio di induzione", tirare fuori il tipo induttivo
-     e vedere se il suo nome coincide con il prefisso di _ind. 
-     Ad esempio nat_double_ind e' definito dall'utente. L'ultimo
-     parametro di nat_double_ind e' di tipo nat, e nat e' diverso
-     da nat_double. Per ora, verifico solo l'esistenza di nat_double,
-     ma questo, benche' non porti ad errore, non copre tutti i
-     casi per quelli mutuamente induttivi -->
-
-<xsl:template mode="try_inductive" match="APPLY">
-   <xsl:variable name="id" select="@id"/>
-   <xsl:choose>
-    <xsl:when test="CONST[1]">
-     <xsl:variable name="uri" select="CONST[1]/@uri"/>
-     <xsl:choose>
-      <xsl:when test="contains($uri,'_ind.con')">
-       <xsl:variable name="ind_uri" 
-         select="concat(substring-before($uri,'_ind.con'),'.ind')"/>
-       <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$ind_uri"/></xsl:call-template></xsl:variable>
-       <xsl:variable name="inductive_def" 
-     select="document($InductiveTypeUrl)/InductiveDefinition"/>
-       <!-- check if the corresponding inductive definition actually
-            exists -->
-       <xsl:choose>
-        <xsl:when test="$inductive_def">
-         <xsl:variable name="ind_name">
-          <xsl:call-template name="get_name">
-           <xsl:with-param name="uri" select="$uri"/>
-          </xsl:call-template>
-         </xsl:variable>
-         <xsl:variable name="no_params">
-          <xsl:call-template name="get_no_params">
-           <xsl:with-param name="first_uri" select="$CICURI"/>
-           <xsl:with-param name="second_uri" select="$uri"/>
-          </xsl:call-template>
-         </xsl:variable>
-         <xsl:apply-templates mode="inductive" select=".">
-          <xsl:with-param name="inductive_def_uri" 
-           select="$ind_uri"/>
-          <xsl:with-param name="inductive_def" 
-           select="$inductive_def"/>
-          <xsl:with-param name="section_params" select="$no_params"/>
-          <xsl:with-param name="inductive_def_index" select="1"/>
-          <xsl:with-param name="inductive_def_name" select="$ind_name"/>
-         </xsl:apply-templates>
-        </xsl:when>
-        <xsl:otherwise>
-         <xsl:apply-templates mode="letin" select="."/>
-        </xsl:otherwise>
-       </xsl:choose>
-      </xsl:when>
-      <xsl:otherwise>
-       <xsl:apply-templates mode="letin" select="."/>
-      </xsl:otherwise>
-     </xsl:choose>
-    </xsl:when>
-    <xsl:otherwise>
-     <xsl:apply-templates mode="letin" select="."/>
-    </xsl:otherwise>
-   </xsl:choose>
-</xsl:template>
-
-<xsl:template mode="eq_transitive" match="*">
- <!-- <m:ci>eccomi-1: <xsl:value-of select="name()"/></m:ci> -->
- <xsl:choose>
-  <xsl:when test="name()='APPLY'">
-   <!-- <m:ci>eccomi-2: <xsl:value-of select="CONST[1]/@uri"/></m:ci> -->
-   <xsl:variable name="id" select="@id"/>
-   <xsl:choose>
-    <!-- ricordarsi di trattare il parametro -->
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7">
-     <!-- <m:ci>eccomi-3</m:ci> -->
-     <xsl:apply-templates mode="eq_transitive" select="*[6]"/>
-     <xsl:apply-templates mode="noannot" select="*[4]"/>
-     <xsl:apply-templates mode="eq_transitive" select="*[7]"/>
-    </xsl:when>
-    <xsl:otherwise>
-     <xsl:call-template name="generate_side_proof">
-      <xsl:with-param name="proof" select="."/>
-      <xsl:with-param name="show_statement" select="0"/>
-     </xsl:call-template> 
-    </xsl:otherwise>
-   </xsl:choose>
-  </xsl:when>
-  <xsl:otherwise>
-   <xsl:call-template name="generate_side_proof">
-    <xsl:with-param name="proof" select="."/>
-    <xsl:with-param name="show_statement" select="0"/>
-   </xsl:call-template>
-  </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template mode="diseq" match="*">
-  <xsl:param name="rel" select="'eq'"/>
-  <xsl:choose>
-  <xsl:when test="name()='APPLY'">
-      <xsl:variable name="id" select="@id"/>
-   <xsl:choose>
-    <!-- ricordarsi di trattare il parametro -->
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_transitive.con'] and count(child::*) = 7">
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-    </xsl:when> 
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdl.con'] and count(child::*) = 7">
-       <m:eq/>
-       <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
-       <xsl:call-template name="generate_side_proof">
-        <xsl:with-param name="proof" select="*[7]"/>
-        <xsl:with-param name="show_statement" select="0"/>
-       </xsl:call-template>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-    </xsl:when> 
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_less_trans.con'] and count(child::*) = 7">
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-    </xsl:when>
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/less_leEq_trans.con'] and count(child::*) = 7">
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-    </xsl:when>  
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdr.con'] and count(child::*) = 7">
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'eq'"/>
-       </xsl:apply-templates>
-    </xsl:when>  
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_transitive_unfolded.con'] and count(child::*) = 7">
-      <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-     </xsl:when> 
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdr.con'] and count(child::*) = 7">
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'eq'"/>
-       </xsl:apply-templates>
-     </xsl:when>
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdl.con'] and count(child::*) = 7">
-       <m:eq/>
-       <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
-       <xsl:call-template name="generate_side_proof">
-        <xsl:with-param name="proof" select="*[7]"/>
-        <xsl:with-param name="show_statement" select="0"/>
-       </xsl:call-template>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-    </xsl:when> 
-    <!-- 
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7">
-     <xsl:apply-templates mode="diseq" select="*[6]"/>
-     <m:eq/>
-     <xsl:apply-templates mode="noannot" select="*[4]"/>
-     <m:eq/>
-     <xsl:apply-templates mode="diseq" select="*[7]"/>
-    </xsl:when> 
-    -->
-    <xsl:otherwise>
-     <xsl:element name="{concat('m:',$rel)}"/>
-     <!-- <m:ci><xsl:value-of select="$rel"/></m:ci> -->  
-     <xsl:call-template name="generate_side_proof">
-      <xsl:with-param name="proof" select="."/>
-      <xsl:with-param name="show_statement" select="0"/>
-     </xsl:call-template> 
-    </xsl:otherwise>
-   </xsl:choose>
-  </xsl:when>
-  <xsl:otherwise>
-   <xsl:element name="{concat('m:',$rel)}"/> 
-   <!-- <m:ci><xsl:value-of select="$rel"/></m:ci> --> 
-   <xsl:call-template name="generate_side_proof">
-    <xsl:with-param name="proof" select="."/>
-    <xsl:with-param name="show_statement" select="0"/>
-   </xsl:call-template>
-  </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
 <xsl:template mode="proof_transform" match="*">
  <xsl:choose>
   <xsl:when test="name()='APPLY'">
    <xsl:variable name="id" select="@id"/>
    <xsl:choose>
-    <!-- Algebra equality (eq_transitive_unfolded) -->
-    <!-- It requires a special mode "eq_transitive"-->
-    <!-- togliere il parametro -->
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/CSetoids/CSetoid_basics/eq_transitive_unfolded.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>eq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="eq_transitive" select="*[6]"/>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="eq_transitive" select="*[7]"/>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when>
-    <!-- Algebra disequalities -->
-    <!-- It requires a special mode "diseq"-->
-    <!-- togliere il parametro -->
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_transitive.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when> 
-     <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdl.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-       <m:eq/>
-       <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
-       <xsl:call-template name="generate_side_proof">
-        <xsl:with-param name="proof" select="*[7]"/>
-        <xsl:with-param name="show_statement" select="0"/>
-       </xsl:call-template>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-     </m:apply>
-    </xsl:when>
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_less_trans.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when> 
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/less_leEq_trans.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when>  
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/Basic_Properties_of_leEq/leEq_wdr.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'leq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'eq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when>  
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_transitive_unfolded.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when>  
-    <!-- togliere il parametro -->
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdr.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-       <xsl:apply-templates mode="diseq" select="*[7]">
-        <xsl:with-param name="rel" select="'eq'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-     </m:apply>
-    </xsl:when>
-    <!-- togliere il parametro -->
-    <xsl:when test="CONST[attribute::uri='cic:/Algebra/COrdFields/COrdField_axioms/less_wdl.con'] and count(child::*) = 7">
-     <m:apply>
-       <m:csymbol>diseq_chain</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-       <m:eq/>
-       <!-- <m:ci><xsl:value-of select="'eq'"/></m:ci> -->
-       <xsl:call-template name="generate_side_proof">
-        <xsl:with-param name="proof" select="*[7]"/>
-        <xsl:with-param name="show_statement" select="0"/>
-       </xsl:call-template>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-       <xsl:apply-templates mode="diseq" select="*[6]">
-        <xsl:with-param name="rel" select="'lt'"/>
-       </xsl:apply-templates>
-       <xsl:apply-templates mode="noannot" select="*[4]"/>
-     </m:apply>
-    </xsl:when> 
-    <!-- EQUALITY -->
-    <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Equality/eq_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic/Logic_lemmas/eq_ind_r.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
- attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7">
-      <m:apply>
-       <m:csymbol>rw_step</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[5]"/>
-       <xsl:apply-templates mode="pure" select="*[3]"/>
-       <xsl:apply-templates mode="pure" select="*[6]"/>
-       <xsl:call-template name="generate_side_proof">
-        <xsl:with-param name="proof" select="*[7]"/>
-       </xsl:call-template>
-       <!-- <xsl:apply-templates mode="proof_transform" select="*[7]"/> -->
-      </m:apply>
-    </xsl:when>
-    <!-- EQUALITY with extra-parameters -->
-    <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Equality/eq_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic/Logic_lemmas/eq_ind_r.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
- attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
- attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) > 7">
-      <xsl:variable name="no_extraproofs" select="count(*[position()>7 and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>      
-      <xsl:choose>
-       <xsl:when test="$no_extraproofs=0"> 
-        <m:apply>
-         <m:csymbol>rewrite_and_apply</m:csymbol>
-         <m:apply>
-          <m:csymbol>rw_step</m:csymbol>
-          <xsl:apply-templates mode="noannot" select="*[5]"/>
-          <xsl:apply-templates mode="pure" select="*[3]"/>
-          <xsl:apply-templates mode="pure" select="*[6]"/>
-          <xsl:call-template name="generate_side_proof">
-           <xsl:with-param name="proof" select="*[7]"/>
-           </xsl:call-template>
-          <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
-         </m:apply>
-         <xsl:apply-templates mode="noannot" select="*[position()>7]"/>
-        </m:apply>
-       </xsl:when>
-       <xsl:otherwise>
-        <xsl:choose>
-         <xsl:when test="*[5]/@sort='Prop'">
-          <m:apply helm:xref="{@id}">
-           <m:csymbol>letin</m:csymbol>
-           <m:apply>
-            <m:csymbol>let</m:csymbol>
-            <m:ci>
-             <xsl:call-template name="insert_subscript">
-              <xsl:with-param name="node_value" select="'h1'"/>
-             </xsl:call-template>
-            </m:ci>
-            <xsl:apply-templates mode="noannot" select="*[5]"/>
-           </m:apply>
-           <xsl:call-template name="gen_let">
-            <xsl:with-param name="init_pos" select="1"/>
-            <xsl:with-param name="from" select="7"/>
-           </xsl:call-template>
-           <m:apply>
-            <m:csymbol>rewrite_and_apply</m:csymbol>
-            <m:apply>
-             <m:csymbol>rw_step</m:csymbol>
-             <m:ci>
-              <xsl:call-template name="insert_subscript">
-               <xsl:with-param name="node_value" select="'h1'"/>
-              </xsl:call-template>
-             </m:ci>
-             <xsl:apply-templates mode="pure" select="*[3]"/>
-             <xsl:apply-templates mode="pure" select="*[6]"/>
-             <xsl:call-template name="generate_side_proof">
-              <xsl:with-param name="proof" select="*[7]"/>
-             </xsl:call-template>
-             <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
-            </m:apply>
-            <xsl:apply-templates mode="flat" select="*[8]">
-             <xsl:with-param name="n">
-              <xsl:value-of select="2"/>
-             </xsl:with-param>
-            </xsl:apply-templates>
-           </m:apply>
-          </m:apply>
-         </xsl:when>
-         <xsl:otherwise>
-          <m:apply helm:xref="{@id}">
-           <m:csymbol>letin</m:csymbol>
-           <xsl:call-template name="gen_let">
-            <xsl:with-param name="init_pos" select="0"/>
-            <xsl:with-param name="form" select="7"/>
-           </xsl:call-template>
-           <m:apply>
-            <m:csymbol>rewrite_and_apply</m:csymbol>
-            <m:apply>
-             <m:csymbol>rw_step</m:csymbol>
-             <xsl:apply-templates mode="pure" select="*[5]"/>
-             <xsl:apply-templates mode="pure" select="*[3]"/>
-             <xsl:apply-templates mode="pure" select="*[6]"/>             
-             <xsl:call-template name="generate_side_proof">
-              <xsl:with-param name="proof" select="*[7]"/>
-             </xsl:call-template>
-             <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
-            </m:apply>
-            <xsl:apply-templates mode="flat" select="*[8]">
-             <xsl:with-param name="n">
-              <xsl:value-of select="1"/>
-             </xsl:with-param>
-            </xsl:apply-templates>
-           </m:apply>
-          </m:apply>
-         </xsl:otherwise>
-        </xsl:choose>
-       </xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-    <!-- False_ind -->
-    <xsl:when test="CONST[
-     attribute::uri='cic:/Coq/Init/Logic/False_ind.con'] and 
-     count(child::*) = 3">
-     <m:apply helm:xref="{@id}">
-       <m:csymbol>false_ind</m:csymbol>
-       <m:ci>cic:/Coq/Init/Logic/False_ind.con</m:ci>
-       <xsl:apply-templates mode="noannot" select="*[3]"/>
-     </m:apply>
-    </xsl:when>
-    <!-- gestire meglio il caso di and_ind quando la prova 
-         non e' della forma \x.\y.M -->
-    <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con'] 
- and count(child::*) = 6 
- and name(*[5])='LAMBDA' 
- and name(*[5]/target/*[1])='LAMBDA'"> 
-      <m:apply helm:xref="{@id}">
-       <m:csymbol>and_ind</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[6]"/>
-       <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
-       <xsl:apply-templates mode="pure" select="*[5]/source/*"/>
-       <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
-       <xsl:apply-templates mode="pure" select="*[5]/target/LAMBDA/source/*"/>
-       <xsl:apply-templates mode="proof_transform" select="*[5]/target/LAMBDA/target/*"/> 
-      </m:apply>
-    </xsl:when>
-    <xsl:when test="CONST[
- attribute::uri='cic:/Coq/Init/Logic/Disjunction/or_ind.con'] 
- and count(child::*) = 7">
-      <xsl:choose>
-       <xsl:when test="name(*[5])='LAMBDA' 
-                 and name(*[6])='LAMBDA'">
-        <xsl:variable name="definition_url" 
-            select="'cic:/Coq/Init/Logic/Disjunction/or.ind'"/>
-        <m:apply helm:xref="{@id}">
-         <m:csymbol>full_or_ind</m:csymbol>
-         <xsl:apply-templates mode="noannot" select="*[7]"/>
-         <xsl:for-each select="$InnerTypes">
-          <xsl:apply-templates mode="pure" select="key('typeid',$id)/*[1]"/>
-         </xsl:for-each>
-         <m:apply>
-          <m:csymbol>left_case</m:csymbol>
-          <m:bvar>
-           <m:ci>
-            <xsl:value-of select="*[5]/target/@binder"/>
-           </m:ci>
-           <m:type>
-            <xsl:apply-templates mode="pure" select="*[5]/source/*[1]"/>
-           </m:type>
-          </m:bvar>
-          <xsl:apply-templates mode="noannot" select="*[5]/target/*[1]"/>
-         </m:apply>
-         <m:apply>
-          <m:csymbol>right_case</m:csymbol>
-          <m:bvar>
-           <m:ci>
-            <xsl:apply-templates mode="pure" select="*[6]/target/@binder"/>
-           </m:ci>
-           <m:type>
-            <xsl:apply-templates mode="pure" select="*[6]/source/*[1]"/>
-           </m:type>
-          </m:bvar>
-          <xsl:apply-templates mode="noannot" select="*[6]/target/*[1]"/>
-         </m:apply>
-        </m:apply>
-       </xsl:when>
-       <xsl:otherwise>
-        <m:apply helm:xref="{@id}">
-         <m:csymbol>or_ind</m:csymbol>
-         <xsl:apply-templates mode="noannot" select="*[7]"/>
-         <xsl:for-each select="$InnerTypes">
-          <xsl:apply-templates mode="pure" select="key('typeid',$id)/*[1]"/>
-         </xsl:for-each>
-         <xsl:apply-templates mode="pure" select="*[5]"/>
-         <xsl:apply-templates mode="pure" select="*[6]"/>
-        </m:apply>
-       </xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-    <!-- ex_ind, exT_ind -->
-      <xsl:when test="(CONST[attribute::uri='cic:/Coq/Init/Logic_Type/exT_ind.con'] or
-      CONST[attribute::uri='cic:/Coq/Init/Logic/First_order_quantifiers/ex_ind.con'])  
- and count(child::*) = 6 
- and name(*[5])='LAMBDA' 
- and name(*[5]/target/*[1])='LAMBDA'"> 
-      <m:apply helm:xref="{@id}">
-       <m:csymbol>ex_ind</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="*[6]"/>
-       <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
-       <xsl:apply-templates mode="pure" select="*[5]/source/*"/>
-       <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
-       <xsl:apply-templates mode="pure" select="*[5]/target/LAMBDA/source/*"/>
-       <xsl:apply-templates mode="proof_transform" select="*[5]/target/LAMBDA/target/*"/>
-      </m:apply>
-    </xsl:when>
-    <xsl:when test="name(*[1])='CONST'">
+    <xsl:when test="name(*[1])='CONST' or 
+      (name(*[1])='instantiate' and name(*[1]/*[1])='CONST')">
      <xsl:apply-templates mode="try_inductive" select="."/>
     </xsl:when>
     <!-- patch temporanea per la gestione di redex -->
-    <xsl:when test="name(*[1])='LAMBDA' and count(child::*)=2
-         and *[2]/@sort='Prop'">
+    <xsl:when test="name(*[1])='LAMBDA' and count(child::*)=2">
+    <!-- old
+         and *[2]/@sort='Prop'"> -->
      <m:apply helm:xref="{@id}">
-      <m:csymbol>letin</m:csymbol>
-      <m:apply>
-       <m:csymbol>let</m:csymbol>
+      <m:csymbol>let_in</m:csymbol>
+      <m:bvar>
        <m:ci>
         <xsl:call-template name="insert_subscript">
          <xsl:with-param name="node_value">
-          <xsl:value-of select="*[1]/target/@binder"/>
+          <xsl:value-of select="*[1]/*[1]/@binder"/>
          </xsl:with-param>
         </xsl:call-template>
        </m:ci>
-       <xsl:apply-templates mode="noannot" select="*[2]"/>
-      </m:apply>
-      <xsl:apply-templates mode="proof_transform" select="*[1]/target/*[1]"/>
+      </m:bvar>
+      <xsl:apply-templates mode="noannot" select="*[2]"/>
+      <xsl:apply-templates mode="lambda_prop" select="*[1]/*[2]"/>
      </m:apply>
     </xsl:when>
     <xsl:otherwise>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
-  <xsl:when test="name()='LAMBDA'">
-   <xsl:choose>
-     <xsl:when test="(name(target/*[1])='APPLY'  and
-      name(target/*[1]/*[1])='CONST' and
-      (target/*[1]/*[1]/@uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
-       target/*[1]/*[1]/@uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
-       target/*[1]/*[1]/@uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con')
-      and count(target/*[1]/*) = 8 
-      and name(target/*[1]/*[8])='REL'
-      and target/@binder = target/*[1]/*[8]/@binder )"> 
-      <m:apply>
-       <m:csymbol>rw_step</m:csymbol>
-       <xsl:apply-templates mode="noannot" select="target/*[1]/*[5]"/>
-       <xsl:apply-templates mode="pure" select="target/*[1]/*[3]"/>
-       <xsl:apply-templates mode="pure" select="target/*[1]/*[6]"/>
-       <xsl:call-template name="generate_side_proof">
-        <xsl:with-param name="proof" select="target/*[1]/*[7]"/>
-       </xsl:call-template>
-       <!-- <xsl:apply-templates mode="proof_transform" select="target/*[1]/*[7]"/> -->
-      </m:apply>
-     </xsl:when>
-     <xsl:otherwise>
-      <xsl:apply-templates mode="pure" select="."/>
-     </xsl:otherwise>
-    </xsl:choose>
-   </xsl:when>
   <xsl:otherwise>
    <xsl:apply-templates select="." mode="pure"/>
   </xsl:otherwise>
    </xsl:choose>
 </xsl:template>
 
+<xsl:template name="gen_let">
+ <xsl:param name="init_pos" select="1"/>
+ <xsl:param name="from" select="0"/>
+  <xsl:apply-templates mode="gen_let_aux" select="*[position() = ($from+1)]">
+   <xsl:with-param name="init_pos" select="$init_pos"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template mode="gen_let_aux" match="*">
+ <xsl:param name="init_pos" select="1"/>
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="innertype_available">
+  <xsl:for-each select="$InnerTypes">
+   <xsl:if test="key('typeid',$id)/*">
+    <xsl:text>yes</xsl:text>
+   </xsl:if>
+  </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+  <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>
+    <xsl:apply-templates mode="noannot" select="."/>
+   </m:apply>
+   <xsl:if test="following-sibling::*[1]">
+    <xsl:apply-templates mode="gen_let_aux" select="following-sibling::*[1]">
+     <xsl:with-param name="init_pos" select="$init_pos+1"/>
+    </xsl:apply-templates>
+   </xsl:if>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:if test="following-sibling::*[1]">
+    <xsl:apply-templates mode="gen_let_aux" select="following-sibling::*[1]">
+     <xsl:with-param name="init_pos" select="$init_pos"/>
+    </xsl:apply-templates>
+   </xsl:if>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- questa vecchia versione (di Claudio??) sembra bacata come un melone.
+
 <xsl:template name="gen_let">
  <xsl:param name="init_pos" select="0"/>
  <xsl:param name="from" select="0"/>
         </m:apply>
        </xsl:if>
       </xsl:for-each>
-</xsl:template>
+</xsl:template> -->
 
 <xsl:template match="*" mode="erase">
   <xsl:choose>
-   <xsl:when test="@sort='Prop' or $naturalLanguage='no'">
+   <xsl:when test="@sort='Prop' 
+                   or name()='instantiate' or $naturalLanguage='no'">
     <xsl:apply-templates mode="pure" select="."/>
    </xsl:when>
    <xsl:otherwise>
   <xsl:otherwise>
    <!-- forse bisognerebbe trattare solo l'elemento di testa -->
    <xsl:choose>
-   <xsl:when test="@sort='Prop' or $naturalLanguage='no'">
+   <xsl:when test="@sort='Prop' 
+                   or name()='instantiate' or $naturalLanguage='no'">
     <xsl:apply-templates mode="pure" select="."/>
    </xsl:when>
    <xsl:otherwise>
   </xsl:when>
   <xsl:otherwise>
    <xsl:choose>
-    <xsl:when test="name()='REL' or @sort='Prop' or $naturalLanguage='no'">
+    <xsl:when test="name()='REL' or name()='instantiate' or @sort='Prop' or $naturalLanguage='no'">
      <xsl:apply-templates mode="pure" select="."/>
     </xsl:when>
     <xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 
-<!-- <xsl:template match="APPLY[CONST[
- attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']]" mode="appflat">
-    <xsl:choose>
-     <xsl:when test="count(child::*) > 4">
-      <m:apply helm:xref="{@id}">
-       <m:csymbol>app</m:csymbol>
-       <xsl:apply-templates mode="pure" select="*[1]"/>
-       <m:ci>*</m:ci>
-       <m:ci>*</m:ci>
-       <m:ci>*</m:ci>
-       <xsl:apply-templates mode="flat" select="*[5]"/>
-      </m:apply>
-     </xsl:when>
-     <xsl:otherwise>
-      <m:apply helm:xref="{@id}">
-       <m:csymbol>app</m:csymbol>
-       <xsl:apply-templates mode="flat" select="*[1]"/>
-      </m:apply>
-     </xsl:otherwise>
-    </xsl:choose>
-</xsl:template>  -->
-
 
 </xsl:stylesheet>
diff --git a/helm/style/rewrite.xsl b/helm/style/rewrite.xsl
new file mode 100644 (file)
index 0000000..e361944
--- /dev/null
@@ -0,0 +1,135 @@
+<!-- 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/.                                         -->
+
+<!--******************************************************************--> 
+<!-- Basic Logic                                                      -->
+<!-- (completely) Revisited: february 2001, 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 mode="proof_transform" match="APPLY[CONST[
+ attribute::uri='cic:/Coq/Init/Logic/eq_ind.con' or
+ attribute::uri='cic:/Coq/Init/Logic/eq_ind_r.con' or
+ attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
+ attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
+ attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7]">
+ <xsl:variable name="id" select="@id"/>
+  <m:apply>
+   <m:csymbol>rw_step</m:csymbol>
+   <xsl:apply-templates mode="noannot" select="*[5]"/>
+   <xsl:apply-templates mode="pure" select="*[3]"/>
+   <xsl:apply-templates mode="pure" select="*[6]"/>
+   <xsl:call-template name="generate_side_proof">
+    <xsl:with-param name="proof" select="*[7]"/>
+   </xsl:call-template>
+  </m:apply>
+</xsl:template>
+
+<xsl:template mode="proof_transform" match="APPLY[CONST[
+ attribute::uri='cic:/Coq/Init/Logic/eq_ind.con' or
+ attribute::uri='cic:/Coq/Init/Logic/eq_ind_r.con' or
+ attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
+ attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind_r.con' or
+ attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) > 7]">
+ <xsl:variable name="no_extraproofs" select="count(*[position()>7 and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>      
+ <xsl:choose>
+  <xsl:when test="$no_extraproofs=0"> 
+   <m:apply>
+    <m:csymbol>rewrite_and_apply</m:csymbol>
+    <m:apply>
+     <m:csymbol>rw_step</m:csymbol>
+     <xsl:apply-templates mode="noannot" select="*[5]"/>
+     <xsl:apply-templates mode="pure" select="*[3]"/>
+     <xsl:apply-templates mode="pure" select="*[6]"/>
+     <xsl:call-template name="generate_side_proof">
+      <xsl:with-param name="proof" select="*[7]"/>
+     </xsl:call-template>
+    </m:apply>
+    <xsl:apply-templates mode="noannot" select="*[position()>7]"/>
+   </m:apply>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:choose>
+    <xsl:when test="*[5]/@sort='Prop'">
+     <m:apply helm:xref="{@id}">
+      <m:csymbol>letin</m:csymbol>
+      <m:apply>
+       <m:csymbol>let</m:csymbol>
+       <m:ci>
+        <xsl:call-template name="insert_subscript">
+         <xsl:with-param name="node_value" select="'h1'"/>
+        </xsl:call-template>
+       </m:ci>
+       <xsl:apply-templates mode="noannot" select="*[5]"/>
+      </m:apply>
+      <xsl:call-template name="gen_let">
+       <xsl:with-param name="init_pos" select="1"/>
+       <xsl:with-param name="from" select="7"/>
+      </xsl:call-template>
+      <m:apply>
+       <m:csymbol>rewrite_and_apply</m:csymbol>
+       <m:apply>
+        <m:csymbol>rw_step</m:csymbol>
+        <m:ci>
+         <xsl:call-template name="insert_subscript">
+          <xsl:with-param name="node_value" select="'h1'"/>
+         </xsl:call-template>
+        </m:ci>
+        <xsl:apply-templates mode="pure" select="*[3]"/>
+        <xsl:apply-templates mode="pure" select="*[6]"/>
+        <xsl:call-template name="generate_side_proof">
+         <xsl:with-param name="proof" select="*[7]"/>
+        </xsl:call-template>
+       </m:apply>
+       <xsl:apply-templates mode="flat" select="*[8]">
+        <xsl:with-param name="n">
+         <xsl:value-of select="2"/>
+        </xsl:with-param>
+       </xsl:apply-templates>
+      </m:apply>
+     </m:apply>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:apply helm:xref="{@id}">
+      <m:csymbol>letin</m:csymbol>
+      <xsl:call-template name="gen_let">
+       <xsl:with-param name="init_pos" select="0"/>
+       <xsl:with-param name="form" select="7"/>
+      </xsl:call-template>
+      <m:apply>
+       <m:csymbol>rewrite_and_apply</m:csymbol>
+       <m:apply>
+        <m:csymbol>rw_step</m:csymbol>
+        <xsl:apply-templates mode="pure" select="*[5]"/>
+        <xsl:apply-templates mode="pure" select="*[3]"/>
+        <xsl:apply-templates mode="pure" select="*[6]"/>             
+        <xsl:call-template name="generate_side_proof">
+         <xsl:with-param name="proof" select="*[7]"/>
+        </xsl:call-template>
+       </m:apply>
+       <xsl:apply-templates mode="flat" select="*[8]">
+        <xsl:with-param name="n">
+         <xsl:value-of select="1"/>
+        </xsl:with-param>
+       </xsl:apply-templates>
+      </m:apply>
+     </m:apply>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
index d57723ea8bb6e08326f2e3988e83be6d689040b5..5136e77d5c02d3d7b0657a567a9975a46ef371c8 100644 (file)
@@ -4,12 +4,12 @@
                               xmlns:m="http://www.w3.org/1998/Math/MathML"
                               xmlns:helm="http://www.cs.unibo.it/helm">
                              
-<xsl:template match="APPLY[CONST/@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial_normalize_ok.con']" mode="pure">
+<xsl:template match="APPLY[CONST[@uri='cic:/Coq/ring/Ring_abstract/apolynomial_normalize_ok.con']] | APPLY[instantiate/CONST[@uri='cic:/Coq/ring/Ring_abstract/apolynomial_normalize_ok.con']]" mode="proof_transform">
    <xsl:choose>
-      <xsl:when test="count(child::*) > 1">
+      <xsl:when test="count(child::*) = 2">
          <m:apply helm:xref="{@id}">
             <m:csymbol>app</m:csymbol>
-            <xsl:apply-templates mode="noannot" select="*[1]"/>
+            <xsl:apply-templates mode="noannot" select="*[1]/*[1]"/>
             <m:ci>...</m:ci>
          </m:apply>
       </xsl:when>
    </xsl:choose>
 </xsl:template>
 
-<xsl:template match="APPLY[CONST/@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/interp_ap.con']" mode="pure">
+<xsl:template match="APPLY[instantiate/CONST[@uri='cic:/Coq/ring/Ring_abstract/interp_ap.con']] | APPLY[CONST/@uri='cic:/Coq/ring/Ring_abstract/interp_ap.con']" mode="pure">
    <xsl:choose>
-      <xsl:when test="count(child::*) = 9">
+      <xsl:when test="count(child::*) = 2">
          <xsl:call-template name="start-interp">
-           <xsl:with-param name="rtree" select="*[9]"/>
-            <xsl:with-param name="atree" select="*[8]"/>
+           <xsl:with-param name="rtree" select="*[2]"/>
+            <xsl:with-param name="atree" select="instantiate/*[position() = last()]"/>
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
    </xsl:choose>
 </xsl:template>
 
-<xsl:template match="APPLY[CONST/@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/interp_sacs.con']" mode="pure">
+<xsl:template match="APPLY[instantiate/CONST/@uri='cic:/Coq/ring/Ring_abstract/interp_sacs.con'] | APPLY[CONST/@uri='cic:/Coq/ring/Ring_abstract/interp_sacs.con']" mode="pure">
    <xsl:choose>
-      <xsl:when test="count(child::*) = 9 and *[APPLY and position()=9]
-                      [CONST/@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial_normalize.con']">
+      <xsl:when test="count(child::*) = 2 and *[APPLY and position()=2][CONST/@uri='cic:/Coq/ring/Ring_abstract/apolynomial_normalize.con']">
          <m:apply helm:xref="{@id}">
             <m:csymbol>app</m:csymbol>
-            <xsl:apply-templates mode="noannot" select="*[9]/*[1]"/>
+            <xsl:apply-templates mode="noannot" select="*[2]/*[1]"/>
             <xsl:call-template name="start-interp">
-              <xsl:with-param name="rtree" select="*[9]/*[2]"/>
-               <xsl:with-param name="atree" select="*[8]"/>
+              <xsl:with-param name="rtree" select="*[2]/*[2]"/>
+            <xsl:with-param name="atree" select="instantiate/*[position() = last()]"/>
            </xsl:call-template>
          </m:apply>
       </xsl:when>
 
 <!-- **************************  abstract polinomials rendering ************************ -->
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind' 
-                                    and @noConstr='1']]" mode="interp">
+<xsl:template match="*" mode="interp">
+ <m:apply>
+  <m:ci>ERROR INTERP:</m:ci>
+  <xsl:apply-templates select="." mode="noannot"/>
+ </m:apply>
+</xsl:template>
+
+<!-- APVar -->
+<!-- CSC: ??????????? -->
+<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/apolynomial.ind' and @noConstr='1']]" mode="interp">
    <xsl:param name="atree"/>
    <xsl:apply-templates select="*[2]" mode="interp">
       <xsl:with-param name="atree" select="$atree"/>
    </xsl:apply-templates>
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind' 
-                                    and @noConstr='2']]" mode="interp">
-   <xsl:param name="atree"/>
-   <xsl:apply-templates mode="noannot" select="."/>
+<!-- AP0 -->
+<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/apolynomial.ind' and @noConstr='2']" mode="interp">
+ <m:cn definitionURL="{@uri}" helm:xref="{@id}">0</m:cn>
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind' 
-                                    and @noConstr='3']]" mode="interp">
-   <xsl:param name="atree"/>
-   <xsl:apply-templates mode="noannot" select="."/>
+<!-- AP1 -->
+<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/apolynomial.ind' and @noConstr='3']" mode="interp">
+ <m:cn definitionURL="{@uri}" helm:xref="{@id}">1</m:cn>
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind' 
-                                    and @noConstr='4']]" mode="interp">
+<!-- APplus -->
+<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/apolynomial.ind' and @noConstr='4']]" mode="interp">
    <xsl:param name="atree"/>
    <xsl:call-template name="mk-mml-op-interp">
       <xsl:with-param name="arity" select="2"/>
@@ -85,8 +90,8 @@
    </xsl:call-template>
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind' 
-                                    and @noConstr='5']]" mode="interp">
+<!-- APmult -->
+<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/apolynomial.ind' and @noConstr='5']]" mode="interp">
    <xsl:param name="atree"/>
    <xsl:call-template name="mk-mml-op-interp">
       <xsl:with-param name="arity" select="2"/>
    </xsl:call-template>
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/abstract_rings/apolynomial.ind' 
-                                    and @noConstr='6']]" mode="interp">
+<!-- APopp -->
+<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Ring_abstract/apolynomial.ind' and @noConstr='6']]" mode="interp">
    <xsl:param name="atree"/>
    <xsl:call-template name="mk-mml-op-interp">
       <xsl:with-param name="arity" select="1"/>
    </xsl:call-template> 
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Quote/variables_map/index.ind' 
-                                    and @noConstr='1']]" mode="interp">
+<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Quote/index.ind' and @noConstr='1']]" mode="interp">
    <xsl:param name="atree"/>
    <xsl:apply-templates select="*[2]" mode="interp">
       <xsl:with-param name="atree" select="$atree/*[4]"/>
    </xsl:apply-templates>
 </xsl:template>
 
-<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Quote/variables_map/index.ind' 
-                                    and @noConstr='2']]" mode="interp">
+<xsl:template match="APPLY[MUTCONSTRUCT[@uri='cic:/Coq/ring/Quote/index.ind' and @noConstr='2']]" mode="interp">
    <xsl:param name="atree"/>
    <xsl:apply-templates select="*[2]" mode="interp"> 
       <xsl:with-param name="atree" select="$atree/*[5]"/>
    </xsl:apply-templates>
 </xsl:template>
 
-<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ring/Quote/variables_map/index.ind' 
-                              and @noConstr='3']" mode="interp">
+<xsl:template match="MUTCONSTRUCT[@uri='cic:/Coq/ring/Quote/index.ind' and @noConstr='3']" mode="interp">
    <xsl:param name="atree"/>
    <xsl:apply-templates select="$atree/*[3]" mode="noannot"/>
 </xsl:template>
index 2f31b969a3f808e61892381944d1361aac8baa68..84cd46836415e92effcaf99248b3c8a84feba752 100644 (file)
@@ -3,6 +3,7 @@ annotatedpres.xsl
 content.xsl
 content_to_html.xsl
 contentlib.xsl
+diseq.xsl
 drop_coercions.xsl
 expandobj.xsl
 genmmlid.xsl
@@ -12,9 +13,11 @@ html_init.xsl
 html_reals.xsl
 html_set.xsl
 inductive.xsl
+ite.xsl
 lambda.xsl
 link.xsl
 links_library.xsl
+logic.xsl
 mk_dep_graph.xsl
 mk_meta_and_dep_graph.xsl
 mk_meta_graph.xsl
@@ -27,6 +30,7 @@ objcontent.xsl
 objtheorycontent.xsl
 params.xsl
 proofs.xsl
+rewrite.xsl
 ricerca.xsl
 ring.xsl
 rootcontent.xsl