3 <!--******************************************************************-->
5 <!-- First draft: April 3 2000 -->
6 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena -->
7 <!--******************************************************************-->
9 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:m="http://www.w3.org/1998/Math/MathML"
11 xmlns:helm="http://www.cs.unibo.it/helm">
13 <!--******************************************************************-->
14 <!-- Variable containing the absolute path of the CIC file -->
15 <!--******************************************************************-->
17 <xsl:variable name="absPath">http://localhost:8081/getciconly?uri=</xsl:variable>
19 <!-- ************************* LOGIC *********************************-->
21 <!-- Proof objects -->
23 <!-- <xsl:key name="typeid" use="@of" match="TYPE"/> -->
25 <xsl:template match="PROD|REL|SORT|VAR|META|CONST|MUTIND|MUTCONSTRUCT" mode="noannot">
26 <xsl:apply-templates select="." mode="pure"/>
29 <xsl:template match="LAMBDA|CAST|APPLY|MUTCASE|FIX|COFIX" mode="noannot">
30 <xsl:variable name="id" select="@id"/>
32 <!-- <xsl:when test="//InnerTypes and key('typeid',@id)"> -->
33 <!-- <xsl:when test="//InnerTypes/TYPE[@of=$id]"> -->
34 <xsl:when test="@sort='Prop'">
36 <xsl:when test="name()= 'APPLY' and CONST[
37 attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
38 attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7">
39 <m:apply helm:xref="{@id}">
40 <m:csymbol>thread</m:csymbol>
41 <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
43 <m:csymbol>rw_step</m:csymbol>
44 <xsl:apply-templates mode="pure" select="*[3]"/>
45 <xsl:apply-templates mode="pure" select="*[6]"/>
46 <xsl:apply-templates mode="pure" select="*[7]"/>
48 <xsl:apply-templates mode="thread" select="*[5]"/>
51 <!-- aggiungere la verifica dell'esistenza dei lambda per and_ind -->
52 <xsl:when test="name()= 'APPLY' and CONST[
53 attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']
54 and count(child::*) = 6">
55 <m:apply helm:xref="{@id}">
56 <m:csymbol>and_ind</m:csymbol>
57 <xsl:apply-templates mode="noannot" select="*[6]"/>
58 <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>
59 <xsl:apply-templates mode="pure" select="*[5]/source/*"/>
60 <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>
61 <xsl:apply-templates mode="pure" select="*[5]/target/LAMBDA/source/*"/>
62 <xsl:apply-templates mode="noannot" select="*[5]/target/LAMBDA/target/*"/>
65 <xsl:when test="name()= 'APPLY' and CONST[
66 attribute::uri='cic:/Coq/Init/Logic/Disjunction/or_ind.con']
67 and count(child::*) = 7">
68 <m:apply helm:xref="{@id}">
69 <m:csymbol>or_ind</m:csymbol>
70 <xsl:apply-templates mode="noannot" select="*[7]"/>
71 <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
72 <xsl:apply-templates mode="pure" select="*[5]"/>
73 <xsl:apply-templates mode="pure" select="*[6]"/>
76 <xsl:when test="count(*[@id = //InnerTypes/TYPE/@of]) = 1">
77 <m:apply helm:xref="{@id}">
78 <m:csymbol>thread</m:csymbol>
79 <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
81 <m:csymbol>app</m:csymbol>
82 <xsl:apply-templates mode="copy-of-no-prop" select="*[1]"/>
84 <xsl:apply-templates mode="thread" select="*[@id = //InnerTypes/TYPE/@of]"/>
88 <m:apply helm:xref="{@id}">
89 <m:csymbol>proof</m:csymbol>
90 <xsl:apply-templates select="." mode="pure"/>
91 <!-- <xsl:apply-templates select="key('typeid',@id)" mode="pure"/> -->
92 <xsl:apply-templates select="//InnerTypes/TYPE[@of=$id]" mode="pure"/>
98 <xsl:apply-templates select="." mode="pure"/>
103 <xsl:template match="*" mode="copy-of-no-prop">
105 <xsl:when test="@id = //InnerTypes/TYPE/@of">
106 <m:ci>previous</m:ci>
109 <xsl:apply-templates select="." mode="pure"/>
112 <xsl:apply-templates mode="copy-of-no-prop" select="following-sibling::*[1]"/>
115 <xsl:template match="*" mode="thread">
117 <xsl:when test="name()= 'APPLY' and CONST[
118 attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
119 attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con'] and count(child::*) = 7">
120 <xsl:variable name="id" select="@id"/>
121 <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
123 <m:csymbol>rw_step</m:csymbol>
124 <xsl:apply-templates mode="pure" select="*[3]"/>
125 <xsl:apply-templates mode="pure" select="*[6]"/>
126 <xsl:apply-templates mode="pure" select="*[7]"/>
128 <xsl:apply-templates mode="thread" select="*[5]"/>
130 <!--**** Patch temporanea, per il problema dei threads ***-->
131 <xsl:when test="(name()= 'APPLY' and CONST[
132 attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']
133 and count(child::*) = 6) or
134 (name()= 'APPLY' and CONST[
135 attribute::uri='cic:/Coq/Init/Logic/Disjunction/or_ind.con']
136 and count(child::*) = 7)">
137 <xsl:apply-templates mode="noannot" select="."/>
139 <!--**** Fine Patch temporanea, per il problema dei threads ***-->
140 <xsl:when test="count(*[@id = //InnerTypes/TYPE/@of]) = 1">
141 <xsl:variable name="id" select="@id"/>
142 <m:apply helm:xref="{@id}">
143 <m:csymbol>thread</m:csymbol>
144 <xsl:apply-templates mode="pure" select="//InnerTypes/TYPE[@of=$id]"/>
146 <m:csymbol>app</m:csymbol>
147 <xsl:apply-templates mode="copy-of-no-prop" select="*[1]"/>
149 <xsl:apply-templates mode="thread" select="*[@id = //InnerTypes/TYPE/@of]"/>
153 <xsl:apply-templates mode="noannot" select="."/>
159 <!-- Basic proof operators -->
161 <!-- non del tutto soddisfacente, ma .... -->
162 <xsl:template match="APPLY[CONST[
163 attribute::uri='cic:/Coq/Init/Logic_Type/eqT_ind.con' or
164 attribute::uri='cic:/Coq/Zarith/auxiliary/eqT_ind_r.con']]" mode="appflat">
166 <xsl:when test="count(child::*) > 7">
167 <xsl:variable name="id" select="@id"/>
168 <xsl:variable name="ideqp" select="*[7]/@id"/>
169 <xsl:variable name="idsubp" select="*[5]/@id"/>
170 <xsl:variable name="leteqp" select="boolean(//InnerTypes/TYPE[@of=$ideqp])"/>
171 <xsl:variable name="letsubp" select="boolean(//InnerTypes/TYPE[@of=$idsubp])"/>
172 <m:apply helm:xref="{@id}">
173 <m:csymbol>rewrite_and_apply</m:csymbol>
175 <m:csymbol>rw_step</m:csymbol>
176 <xsl:apply-templates mode="pure" select="*[3]"/>
177 <xsl:apply-templates mode="pure" select="*[6]"/>
179 <xsl:when test="$leteqp">
181 <xsl:when test="$letsubp">
183 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="'h2'"/></xsl:with-param></xsl:call-template>
188 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="'h1'"/></xsl:with-param></xsl:call-template>
194 <xsl:apply-templates mode="pure" select="*[7]"/>
199 <xsl:when test="$letsubp">
201 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="'h1'"/></xsl:with-param></xsl:call-template>
205 <xsl:apply-templates mode="pure" select="*[5]"/>
208 <xsl:apply-templates mode="flat" select="*[8]">
209 <xsl:with-param name="n">
210 <xsl:value-of select="1+$letsubp+$leteqp"/>
212 </xsl:apply-templates>
216 <m:apply helm:xref="{@id}">
217 <m:csymbol>app</m:csymbol>
218 <xsl:apply-templates mode="flat" select="*[1]"/>
224 <xsl:template match="APPLY[CONST[
225 attribute::uri='cic:/Coq/Init/Logic/Conjunction/and_ind.con']]" mode="appflat">
227 <xsl:when test="count(child::*) > 4">
228 <m:apply helm:xref="{@id}">
229 <m:csymbol>app</m:csymbol>
230 <xsl:apply-templates mode="pure" select="*[1]"/>
234 <xsl:apply-templates mode="flat" select="*[5]"/>
238 <m:apply helm:xref="{@id}">
239 <m:csymbol>app</m:csymbol>
240 <xsl:apply-templates mode="flat" select="*[1]"/>