]> matita.cs.unibo.it Git - helm.git/blob - helm/style/lambda.xsl
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / style / lambda.xsl
1 <?xml version="1.0"?>
2 <!-- Copyright (C) 2000, HELM Team                                     -->
3 <!--                                                                   -->
4 <!-- This file is part of HELM, an Hypertextual, Electronic            -->
5 <!-- Library of Mathematics, developed at the Computer Science         -->
6 <!-- Department, University of Bologna, Italy.                         -->
7 <!--                                                                   -->
8 <!-- HELM is free software; you can redistribute it and/or             -->
9 <!-- modify it under the terms of the GNU General Public License       -->
10 <!-- as published by the Free Software Foundation; either version 2    -->
11 <!-- of the License, or (at your option) any later version.            -->
12 <!--                                                                   -->
13 <!-- HELM is distributed in the hope that it will be useful,           -->
14 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
15 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
16 <!-- GNU General Public License for more details.                      -->
17 <!--                                                                   -->
18 <!-- You should have received a copy of the GNU General Public License -->
19 <!-- along with HELM; if not, write to the Free Software               -->
20 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
21 <!-- MA  02111-1307, USA.                                              -->
22 <!--                                                                   -->
23 <!-- For details, see the HELM World-Wide-Web page,                    -->
24 <!-- http://cs.unibo.it/helm/.                                         -->
25
26 <!--******************************************************************--> 
27 <!-- Lambda Calculus                                                  -->
28 <!-- First draft: March 20 2001, Andrea Asperti                       -->
29 <!--******************************************************************-->
30
31 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
32                               xmlns:m="http://www.w3.org/1998/Math/MathML"
33                               xmlns:helm="http://www.cs.unibo.it/helm">
34
35 <!-- ************************** LAMBDA ****************************** -->
36
37 <!-- subst -->
38 <xsl:template match="APPLY[CONST[(attribute::uri='cic:/Rocq/LAMBDA/Terms/subst_rec.con' or attribute::uri='cic:/Rocq/LAMBDA/Substitution/subst_rec_r.con')] and count(child::*) = 4]" mode="pure">
39         <m:apply>
40          <m:csymbol definitionURL="{CONST/@uri}">subst</m:csymbol>
41          <xsl:apply-templates select="*[3]" mode="pure"/>
42          <xsl:apply-templates select="*[2]" mode="pure"/>
43          <xsl:apply-templates select="*[4]" mode="pure"/>
44         </m:apply>
45 </xsl:template>
46
47 <xsl:template match="APPLY[CONST[(attribute::uri='cic:/Rocq/LAMBDA/Terms/subst.con' or attribute::uri='cic:/Rocq/LAMBDA/Substitution/subst_r.con')] and count(child::*) = 3]" mode="pure">
48         <m:apply>
49          <m:csymbol definitionURL="{CONST/@uri}">subst</m:csymbol>
50          <xsl:apply-templates select="*[2]" mode="pure"/>
51          <xsl:apply-templates select="*[3]" mode="pure"/>
52          <m:ci>0</m:ci>
53         </m:apply>
54 </xsl:template>
55
56 <!-- lift -->
57 <xsl:template match="APPLY[CONST[(attribute::uri='cic:/Rocq/LAMBDA/Terms/lift_rec.con' or attribute::uri='cic:/Rocq/LAMBDA/Substitution/lift_rec_r.con')] and count(child::*) = 4]" mode="pure">
58         <m:apply>
59          <m:csymbol definitionURL="{CONST/@uri}">lift_with_base</m:csymbol>
60          <xsl:apply-templates select="*[2]" mode="pure"/>
61          <xsl:apply-templates select="*[3]" mode="pure"/>
62          <xsl:apply-templates select="*[4]" mode="pure"/>
63         </m:apply>
64 </xsl:template>
65
66 <xsl:template match="APPLY[CONST[(attribute::uri='cic:/Rocq/LAMBDA/Terms/lift.con' or attribute::uri='cic:/Rocq/LAMBDA/Substitution/lift_r.con')] and count(child::*) = 3]" mode="pure">
67         <m:apply>
68          <m:csymbol definitionURL="{CONST/@uri}">lift</m:csymbol>
69          <xsl:apply-templates select="*[2]" mode="pure"/>
70          <xsl:apply-templates select="*[3]" mode="pure"/>
71         </m:apply>
72 </xsl:template>
73
74 <!-- reduction -->
75 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Reduction/red1.ind')] and count(child::*) = 3]" mode="pure">
76         <m:apply>
77          <m:csymbol definitionURL="{MUTIND/@uri}">beta_red1</m:csymbol>
78          <xsl:apply-templates select="*[2]" mode="pure"/>
79          <xsl:apply-templates select="*[3]" mode="pure"/>
80         </m:apply>
81 </xsl:template>
82
83 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Reduction/red.ind')] and count(child::*) = 3]" mode="pure">
84         <m:apply>
85          <m:csymbol definitionURL="{MUTIND/@uri}">beta_red</m:csymbol>
86          <xsl:apply-templates select="*[2]" mode="pure"/>
87          <xsl:apply-templates select="*[3]" mode="pure"/>
88         </m:apply>
89 </xsl:template>
90
91 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Reduction/par_red1.ind')] and count(child::*) = 3]" mode="pure">
92         <m:apply>
93          <m:csymbol definitionURL="{MUTIND/@uri}">par_beta_red1</m:csymbol>
94          <xsl:apply-templates select="*[2]" mode="pure"/>
95          <xsl:apply-templates select="*[3]" mode="pure"/>
96         </m:apply>
97 </xsl:template>
98
99 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Reduction/par_red.ind')] and count(child::*) = 3]" mode="pure">
100         <m:apply>
101          <m:csymbol definitionURL="{MUTIND/@uri}">par_beta_red</m:csymbol>
102          <xsl:apply-templates select="*[2]" mode="pure"/>
103          <xsl:apply-templates select="*[3]" mode="pure"/>
104         </m:apply>
105 </xsl:template>
106
107 <!-- unmark -->
108
109 <xsl:template match="APPLY[CONST[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Marks/unmark.con')] and count(child::*) = 2]" mode="pure">
110         <m:apply>
111          <m:csymbol definitionURL="{CONST/@uri}">forgetful</m:csymbol>
112          <xsl:apply-templates select="*[2]" mode="pure"/>
113         </m:apply>
114 </xsl:template>
115
116 <!-- boolean algebra of redexes -->
117
118 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Redexes/sub.ind')] and count(child::*) = 3]" mode="pure">
119         <m:apply>
120          <m:subset definitionURL="{MUTIND/@uri}"/>
121          <xsl:apply-templates select="*[2]" mode="pure"/>
122          <xsl:apply-templates select="*[3]" mode="pure"/>
123         </m:apply>
124 </xsl:template>
125
126 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Redexes/union.ind')] and count(child::*) = 4]" mode="pure">
127         <m:apply>
128          <m:eq definitionURL="{MUTIND/@uri}"/>
129          <m:apply>
130           <m:union definitionURL="{MUTIND/@uri}"/>
131           <xsl:apply-templates select="*[2]" mode="pure"/>
132           <xsl:apply-templates select="*[3]" mode="pure"/>
133          </m:apply>
134          <xsl:apply-templates select="*[4]" mode="pure"/>
135         </m:apply>
136 </xsl:template>
137
138 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Redexes/comp.ind')] and count(child::*) = 3]" mode="pure">
139         <m:apply>
140          <m:csymbol definitionURL="{MUTIND/@uri}">isomorphic</m:csymbol>
141          <xsl:apply-templates select="*[2]" mode="pure"/>
142          <xsl:apply-templates select="*[3]" mode="pure"/>
143         </m:apply>
144 </xsl:template>
145
146 <xsl:template match="APPLY[MUTIND[(position()='1' and attribute::uri='cic:/Rocq/LAMBDA/Residuals/residuals.ind')] and count(child::*) = 4]" mode="pure">
147         <m:apply>
148          <m:eq definitionURL="{MUTIND/@uri}"/>
149          <m:apply>
150           <m:setdiff definitionURL="{MUTIND/@uri}"/>
151           <xsl:apply-templates select="*[2]" mode="pure"/>
152           <xsl:apply-templates select="*[3]" mode="pure"/>
153          </m:apply>
154          <xsl:apply-templates select="*[4]" mode="pure"/>
155         </m:apply>
156 </xsl:template>
157
158 </xsl:stylesheet>