]> matita.cs.unibo.it Git - helm.git/blob - helm/style/basic.xsl
Aliases definition removed from the
[helm.git] / helm / style / basic.xsl
1 <?xml version="1.0"?>
2
3 <!-- Copyright (C) 2000, HELM Team                                     -->
4 <!--                                                                   -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic            -->
6 <!-- Library of Mathematics, developed at the Computer Science         -->
7 <!-- Department, University of Bologna, Italy.                         -->
8 <!--                                                                   -->
9 <!-- HELM is free software; you can redistribute it and/or             -->
10 <!-- modify it under the terms of the GNU General Public License       -->
11 <!-- as published by the Free Software Foundation; either version 2    -->
12 <!-- of the License, or (at your option) any later version.            -->
13 <!--                                                                   -->
14 <!-- HELM is distributed in the hope that it will be useful,           -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
17 <!-- GNU General Public License for more details.                      -->
18 <!--                                                                   -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software               -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
22 <!-- MA  02111-1307, USA.                                              -->
23 <!--                                                                   -->
24 <!-- For details, see the HELM World-Wide-Web page,                    -->
25 <!-- http://cs.unibo.it/helm/.                                         -->
26
27 <!--******************************************************************--> 
28 <!-- Basic Logic                                                      -->
29 <!-- First draft: April 3 2000                                        -->
30 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena, Guidi          -->
31 <!--******************************************************************-->
32
33 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34                               xmlns:m="http://www.w3.org/1998/Math/MathML"
35                               xmlns:helm="http://www.cs.unibo.it/helm">
36
37
38 <!-- ************************* LOGIC *********************************-->
39
40 <!-- AND -->
41
42 <xsl:template match="APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic/and.ind'] and (count(child::*) = 3)]" mode="pure">
43     <m:apply helm:xref="{@id}">
44      <m:and definitionURL="{MUTIND/@uri}" helm:xref="{MUTIND/@id}"/>
45      <xsl:apply-templates select="*[2]" mode="noannot"/>
46      <xsl:apply-templates select="*[3]" mode="noannot"/>
47     </m:apply>
48 </xsl:template>
49
50 <!-- OR -->
51
52 <xsl:template match="APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic/or.ind'] and (count(child::*) = 3)]" mode="pure">
53     <m:apply helm:xref="{@id}">
54     <m:or definitionURL="{MUTIND/@uri}" helm:xref="{MUTIND/@id}"/>
55      <xsl:apply-templates select="*[2]" mode="noannot"/>
56      <xsl:apply-templates select="*[3]" mode="noannot"/>
57     </m:apply>
58 </xsl:template>
59
60 <!-- NOT -->
61
62 <xsl:template match="APPLY[CONST[attribute::uri='cic:/Coq/Init/Logic/not.con'] and (count(child::*) = 2)]" mode="pure">
63     <m:apply helm:xref="{@id}">
64     <m:not definitionURL="{CONST/@uri}" helm:xref="{MUTIND/@id}"/>
65      <xsl:apply-templates select="*[2]" mode="noannot"/>
66     </m:apply>
67 </xsl:template>
68
69 <!-- IFF -->
70 <!-- 
71 <xsl:template match="APPLY[CONST[attribute::uri='cic:/Coq/Init/Logic/Equivalence/iff.ind'] and (count(child::*) = 3)]" mode="pure">
72     <m:apply helm:xref="{@id}">
73     <m:iff definitionURL="{CONST/@uri}" helm:xref="{CONST/@id}"/>
74      <xsl:apply-templates select="*[2]" mode="noannot"/>
75      <xsl:apply-templates select="*[3]" mode="noannot"/>
76     </m:apply>
77 </xsl:template>
78 -->
79
80 <!-- EXISTS -->
81
82
83 <xsl:template match="APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic/ex.ind' or attribute::uri='cic:/Coq/Init/Logic_Type/exT.ind'] and (count(child::*) = 3)]" mode="pure">
84     <m:apply helm:xref="{@id}">
85      <m:exists definitionURL="{MUTIND/@uri}" helm:xref="{MUTIND/@id}"/>
86      <xsl:choose>
87       <xsl:when test="name(*[3]) = 'LAMBDA'">
88        <m:bvar>
89         <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[3]/*[1]/@binder"/></xsl:with-param></xsl:call-template></m:ci>
90        </m:bvar>
91        <m:condition>
92         <xsl:apply-templates select="*[2]" mode="pure"/>
93        </m:condition>
94        <xsl:apply-templates select="LAMBDA/target" mode="noannot"/>
95       </xsl:when>
96       <xsl:otherwise>
97        <m:bvar>
98         <m:ci>$x</m:ci>
99        </m:bvar>
100        <m:condition>
101         <xsl:apply-templates select="*[2]" mode="pure"/>
102        </m:condition>
103        <m:apply>
104         <m:csymbol>app</m:csymbol>
105         <xsl:apply-templates select="*[3]" mode="noannot"/>
106         <m:ci>$x</m:ci>
107        </m:apply>
108       </xsl:otherwise>
109      </xsl:choose>
110     </m:apply>
111 </xsl:template>
112
113 <xsl:template match="APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic/ex2.ind' or attribute::uri='cic:/Coq/Init/Logic_Type/exT2.ind'] and (count(child::*) = 4)]" mode="pure">
114     <m:apply helm:xref="{@id}">
115     <m:exists definitionURL="{MUTIND/@uri}" helm:xref="{MUTIND/@id}"/>
116      <xsl:choose>
117       <xsl:when test="name(*[3]) = 'LAMBDA'">
118        <xsl:variable name="bvarname" select="*[3]/*[1]/@binder"/>
119        <m:bvar>
120         <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
121        </m:bvar>
122        <m:condition>
123         <xsl:apply-templates select="LAMBDA[1]/target" mode="noannot"/>
124        </m:condition>
125        <xsl:choose>
126         <xsl:when test="(name(*[4]) = 'LAMBDA') and 
127            ($bvarname = *[4]/*[1]/@binder)">
128          <xsl:apply-templates select="LAMBDA[2]/target" mode="noannot"/>
129         </xsl:when>
130         <xsl:otherwise>
131          <m:apply>
132           <m:csymbol>app</m:csymbol>
133           <xsl:apply-templates select="*[4]" mode="noannot"/>
134           <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
135          </m:apply>
136         </xsl:otherwise>
137        </xsl:choose>
138       </xsl:when>
139       <xsl:otherwise>
140        <xsl:choose>
141         <xsl:when test="name(*[4]) = 'LAMBDA'">
142          <xsl:variable name="bvarname" select="*[4]/*[1]/@binder"/>
143          <m:bvar>
144           <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
145          </m:bvar>
146          <m:condition>
147           <m:apply>
148            <m:csymbol>app</m:csymbol>
149            <xsl:apply-templates select="*[3]" mode="noannot"/>
150            <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
151           </m:apply>
152          </m:condition>
153          <xsl:apply-templates select="*[4]/target" mode="noannot"/>
154         </xsl:when>
155         <xsl:otherwise>
156          <m:bvar>
157           <m:ci>x</m:ci>
158          </m:bvar>
159          <m:condition>
160           <m:apply>
161            <m:csymbol>app</m:csymbol>
162            <xsl:apply-templates select="*[3]" mode="noannot"/>
163            <m:ci>x</m:ci>
164           </m:apply>
165          </m:condition>
166          <m:apply>
167           <m:csymbol>app</m:csymbol>
168           <xsl:apply-templates select="*[4]" mode="noannot"/>
169           <m:ci>x</m:ci>
170          </m:apply>
171         </xsl:otherwise>
172        </xsl:choose>
173       </xsl:otherwise>
174      </xsl:choose>
175     </m:apply>
176 </xsl:template>
177
178
179 <!-- EQUALITY and TYPE EQUALITY -->
180
181 <xsl:template match="APPLY[MUTIND/@uri='cic:/Coq/Init/Logic/eq.ind']" mode="pure">
182    <xsl:call-template name="mk-mml-op-noannot">
183       <xsl:with-param name="hide" select="1"/>
184       <xsl:with-param name="c-tag" select="MUTIND"/>
185       <xsl:with-param name="m-tag" select="'eq'"/>
186    </xsl:call-template>
187 </xsl:template>
188
189 <xsl:template match="APPLY[MUTIND/@uri='cic:/Coq/Init/Logic_Type/eqT.ind']" mode="pure">
190    <xsl:call-template name="mk-mml-op-noannot">
191       <xsl:with-param name="hide" select="1"/>
192       <xsl:with-param name="c-tag" select="MUTIND"/>
193       <xsl:with-param name="m-tag" select="'eq'"/>
194    </xsl:call-template>
195 </xsl:template>
196
197 <!-- NOT-EQ -->
198 <!-- NOT and EQ have no parameters -->
199 <xsl:template match="APPLY[CONST[attribute::uri='cic:/Coq/Init/Logic/not.con']
200 and (count(child::*) = 2) and APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic/eq.ind']]]" mode="pure">
201     <xsl:choose>
202      <xsl:when test="count(APPLY/child::*) = 4">
203       <m:apply helm:xref="{@id}">
204        <m:neq/>
205        <xsl:apply-templates select="*[2]/*[3]" mode="noannot"/>
206        <xsl:apply-templates select="*[2]/*[4]" mode="set"/>  
207       </m:apply>
208      </xsl:when>
209      <xsl:otherwise>
210       <xsl:apply-imports/>
211      </xsl:otherwise>
212     </xsl:choose>
213 </xsl:template>
214
215 <!-- NOT-EQT -->
216 <xsl:template match="APPLY[CONST[attribute::uri='cic:/Coq/Init/Logic/not.con']
217 and (count(child::*) = 2) and APPLY[MUTIND[attribute::uri='cic:/Coq/Init/Logic_Type/eqT.ind']]]" mode="pure">
218     <xsl:choose>
219      <xsl:when test="count(APPLY/child::*) = 4">
220       <m:apply helm:xref="{@id}">
221        <m:neq/>
222        <xsl:apply-templates select="*[2]/*[3]" mode="noannot"/>
223        <xsl:apply-templates select="*[2]/*[4]" mode="set"/>  
224       </m:apply>
225      </xsl:when>
226      <xsl:otherwise>
227       <xsl:apply-imports/>
228      </xsl:otherwise>
229     </xsl:choose>
230 </xsl:template>
231
232 <!-- ************************ DATATYPES ******************************* -->
233
234 <!-- no datatypes in MathML content -->
235
236 <!-- ************************** PEANO ********************************* -->
237
238 <!-- see arith.xsl --> <!-- FG -->
239
240 </xsl:stylesheet>