]> matita.cs.unibo.it Git - helm.git/blob - matita/help/C/sec_terms.xml
New: on-line help for declarative tactics (first version).
[helm.git] / matita / help / C / sec_terms.xml
1
2 <!-- =========== Terms, declarations and definitions ============ -->
3
4 <chapter id="sec_terms">
5   <title>Syntax</title>
6   <para>To describe syntax in this manual we use the following conventions:</para>
7   <orderedlist>
8     <listitem><para>Non terminal symbols are emphasized and have a link to their
9         definition. E.g.: &term;</para></listitem>
10     <listitem><para>Terminal symbols are in bold. E.g.:
11         <emphasis role="bold">theorem</emphasis></para></listitem>
12     <listitem><para>Optional sequences of elements are put in square brackets.
13         E.g.: [<emphasis role="bold">in</emphasis> &term;]</para></listitem>
14     <listitem><para>Alternatives are put in square brakets and they are
15         separated by vertical bars. E.g.: [<emphasis role="bold">&lt;</emphasis>|<emphasis role="bold">&gt;</emphasis>]</para></listitem>
16     <listitem><para>Repetitions of a sequence of elements are given by putting the
17     sequence in square brackets, that are followed by three dots. The empty
18     sequence is a valid repetition.
19     E.g.: [<emphasis role="bold">and</emphasis> &term;]…</para></listitem>
20     <listitem><para>Characters belonging to a set of characters are given
21      by listing the set elements in square brackets. Hyphens are used to
22      specify ranges of characters in the set.
23      E.g.: [<emphasis role="bold">a</emphasis>-<emphasis role="bold">zA</emphasis>-<emphasis role="bold">Z0</emphasis>-<emphasis role="bold">9_-</emphasis>]</para></listitem>
24   </orderedlist>
25   <sect1 id="terms_and_co">
26   <title>Terms &amp; co.</title>
27   <sect2 id="lexical">
28   <title>Lexical conventions</title>
29     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
30       <title>qstring</title>
31       <tgroup cols="4">
32       <tbody>
33        <row>
34         <entry id="grammar.qstring">&qstring;</entry>
35         <entry>::=</entry>
36         <entry><emphasis role="bold">&quot;</emphasis><emphasis>〈〈any sequence of characters excluded &quot;〉〉</emphasis><emphasis role="bold">&quot;</emphasis></entry>
37        </row>
38       </tbody>
39      </tgroup>
40     </table>
41     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
42       <title>id</title>
43       <tgroup cols="4">
44       <tbody>
45        <row>
46         <entry id="grammar.id">&id;</entry>
47         <entry>::=</entry>
48         <entry><emphasis>〈〈any sequence of letters, underscores or valid <ulink type="http" url="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-Digit">XML digits</ulink> prefixed by a latin letter ([a-zA-Z]) and post-fixed by a possible empty sequence of decorators ([?'`])〉〉</emphasis></entry>
49        </row>
50       </tbody>
51      </tgroup>
52     </table>
53     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
54       <title>nat</title>
55       <tgroup cols="4">
56       <tbody>
57        <row>
58         <entry id="grammar.nat">&nat;</entry>
59         <entry>::=</entry>
60         <entry><emphasis>〈〈any sequence of valid <ulink type="http" url="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-Digit">XML digits</ulink>〉〉</emphasis></entry>
61        </row>
62       </tbody>
63      </tgroup>
64     </table>
65     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
66       <title>char</title>
67       <tgroup cols="4">
68       <tbody>
69        <row>
70         <entry id="grammar.char">&char;</entry>
71         <entry>::=</entry>
72         <entry>[<emphasis role="bold">a</emphasis>-<emphasis role="bold">zA</emphasis>-<emphasis role="bold">Z0</emphasis>-<emphasis role="bold">9_-</emphasis>]</entry>
73        </row>
74       </tbody>
75      </tgroup>
76     </table>
77     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
78       <title>uri-step</title>
79       <tgroup cols="4">
80       <tbody>
81        <row>
82         <entry id="grammar.uri-step">&uri-step;</entry>
83         <entry>::=</entry>
84         <entry>&char;[&char;]…</entry>
85        </row>
86       </tbody>
87      </tgroup>
88     </table>
89     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
90       <title>uri</title>
91       <tgroup cols="4">
92       <tbody>
93        <row>
94         <entry id="grammar.uri">&uri;</entry>
95         <entry>::=</entry>
96         <entry>[<emphasis role="bold">cic:/</emphasis>|<emphasis role="bold">theory:/</emphasis>]&uri-step;[<emphasis role="bold">/</emphasis>&uri-step;]…<emphasis role="bold">.</emphasis>&id;[<emphasis role="bold">.</emphasis>&id;]…[<emphasis role="bold">#xpointer(</emphasis>&nat;<emphasis role="bold">/</emphasis>&nat;[<emphasis role="bold">/</emphasis>&nat;]…<emphasis role="bold">)</emphasis>]</entry>
97        </row>
98       </tbody>
99      </tgroup>
100     </table>
101   </sect2>
102   <sect2 id="terms">
103   <title>Terms</title>
104
105   <!-- ZACK: Sample EBNF snippet, see:
106   http://www.docbook.org/tdg/en/html/productionset.html -->
107   <!--
108   <productionset>
109     <title>Terms</title>
110     <production id="grammar.term">
111       <lhs>&term;</lhs>
112       <rhs>&sterm;</rhs>
113       <lineannotation></lineannotation>
114     </production>
115   </productionset>
116   -->
117
118   <para>
119   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
120     <title>Terms</title>
121     <tgroup cols="4">
122     <tbody>
123      <row>
124       <entry id="grammar.term">&term;</entry>
125       <entry>::=</entry>
126       <entry>&sterm;</entry>
127       <entry>simple or delimited term</entry>
128      </row>
129      <row>
130       <entry/>
131       <entry>|</entry>
132       <entry>&term; &term;</entry>
133       <entry>application</entry>
134      </row>
135      <row>
136       <entry/>
137       <entry>|</entry>
138       <entry><emphasis role="bold">λ</emphasis>&args;<emphasis role="bold">.</emphasis>&term;</entry>
139       <entry>λ-abstraction</entry>
140      </row>
141      <row>
142       <entry/>
143       <entry>|</entry>
144       <entry><emphasis role="bold">Π</emphasis>&args;<emphasis role="bold">.</emphasis>&term;</entry>
145       <entry>dependent product meant to define a datatype</entry>
146      </row>
147      <row>
148       <entry/>
149       <entry>|</entry>
150       <entry><emphasis role="bold">∀</emphasis>&args;<emphasis role="bold">.</emphasis>&term;</entry>
151       <entry>dependent product meant to define a proposition</entry>
152      </row>
153      <row>
154       <entry/>
155       <entry>|</entry>
156       <entry>&term; <emphasis role="bold">→</emphasis> &term;</entry>
157       <entry>non-dependent product (logical implication or function space)</entry>
158      </row>
159      <row>
160       <entry/>
161       <entry>|</entry>
162       <entry><emphasis role="bold">let</emphasis> [&id;|(&id;<emphasis role="bold">:</emphasis> &term;)] <emphasis role="bold">≝</emphasis> &term; <emphasis role="bold">in</emphasis> &term;</entry>
163       <entry>local definition</entry>
164      </row>
165      <row>
166       <entry/>
167       <entry>|</entry>
168       <entry>
169         <emphasis role="bold">let</emphasis>
170         [<emphasis role="bold">co</emphasis>]<emphasis role="bold">rec</emphasis>
171         &rec_def;
172       </entry>
173       <entry>(co)recursive definitions</entry>
174      </row>
175      <row>
176       <entry/>
177       <entry/>
178       <entry>
179       [<emphasis role="bold">and</emphasis> &rec_def;]…
180       </entry>
181       <entry/>
182      </row>
183      <row>
184       <entry/>
185       <entry/>
186       <entry>
187       <emphasis role="bold">in</emphasis> &term;
188       </entry>
189       <entry/>
190      </row>
191      <row>
192       <entry/>
193       <entry>|</entry>
194       <entry>…</entry>
195       <entry>user provided notation</entry>
196      </row>
197       <row>
198         <entry id="grammar.rec_def">&rec_def;</entry>
199         <entry>::=</entry>
200         <entry>
201           &id; [&id;|<emphasis role="bold">_</emphasis>|<emphasis role="bold">(</emphasis>&id;[<emphasis role="bold">,</emphasis>&id;]… <emphasis role="bold">:</emphasis>&term;<emphasis role="bold">)</emphasis>]…
202         </entry>
203         <entry />
204       </row>
205       <row>
206         <entry />
207         <entry />
208         <entry>
209           [<emphasis role="bold">on</emphasis> &id;]
210           [<emphasis role="bold">:</emphasis> &term;]
211           <emphasis role="bold">≝</emphasis> &term;]
212         </entry>
213         <entry />
214       </row>
215     </tbody>
216    </tgroup>
217   </table>
218
219   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
220     <title>Simple terms</title>
221     <tgroup cols="4">
222     <tbody>
223      <row>
224       <entry id="grammar.sterm">&sterm;</entry>
225       <entry>::=</entry>
226       <entry><emphasis role="bold">(</emphasis>&term;<emphasis role="bold">)</emphasis></entry>
227       <entry/>
228      </row>
229      <row>
230       <entry/>
231       <entry>|</entry>
232       <entry>&id;[<emphasis role="bold">\subst[</emphasis>
233        &id;<emphasis role="bold">≔</emphasis>&term;
234        [<emphasis role="bold">;</emphasis>&id;<emphasis role="bold">≔</emphasis>&term;]…
235        <emphasis role="bold">]</emphasis>]
236       </entry>
237       <entry>identifier with optional explicit named substitution</entry>
238      </row>
239      <row>
240       <entry/>
241       <entry>|</entry>
242       <entry>&uri;</entry>
243       <entry>a qualified reference</entry>
244      </row>
245      <row>
246       <entry/>
247       <entry>|</entry>
248       <entry><emphasis role="bold">Prop</emphasis></entry>
249       <entry>the impredicative sort of propositions</entry>
250      </row>
251      <row>
252       <entry/>
253       <entry>|</entry>
254       <entry><emphasis role="bold">Set</emphasis></entry>
255       <entry>the impredicate sort of datatypes</entry>
256      </row>
257      <row>
258       <entry/>
259       <entry>|</entry>
260       <entry><emphasis role="bold">CProp</emphasis></entry>
261       <entry>one fixed predicative sort of constructive propositions</entry>
262      </row>
263      <row>
264       <entry/>
265       <entry>|</entry>
266       <entry><emphasis role="bold">Type</emphasis></entry>
267       <entry>one predicative sort of datatypes</entry>
268      </row>
269      <row>
270       <entry/>
271       <entry>|</entry>
272       <entry><emphasis role="bold">?</emphasis></entry>
273       <entry>implicit argument</entry>
274      </row>
275      <row>
276       <entry/>
277       <entry>|</entry>
278       <entry><emphasis role="bold">?n</emphasis>
279       [<emphasis role="bold">[</emphasis>
280       [<emphasis role="bold">_</emphasis>|&term;]…
281       <emphasis role="bold">]</emphasis>]</entry>
282       <entry>metavariable</entry>
283      </row>
284      <row>
285       <entry/>
286       <entry>|</entry>
287         <entry><emphasis role="bold">match</emphasis> &term; 
288         [ <emphasis role="bold">in</emphasis> &term; ]
289         [ <emphasis role="bold">return</emphasis> &term; ]
290         <emphasis role="bold">with</emphasis>
291       </entry>
292       <entry>case analysis</entry>
293      </row>
294      <row>
295       <entry/>
296       <entry/>
297       <entry>
298        <emphasis role="bold">[</emphasis> 
299        &match_branch;[<emphasis role="bold">|</emphasis>&match_branch;]…
300        <emphasis role="bold">]</emphasis> 
301       </entry>
302       <entry/>
303      </row>
304      <row>
305       <entry/>
306       <entry>|</entry>
307       <entry><emphasis role="bold">(</emphasis>&term;<emphasis role="bold">:</emphasis>&term;<emphasis role="bold">)</emphasis></entry>
308       <entry>cast</entry>
309      </row>
310      <row>
311       <entry/>
312       <entry>|</entry>
313       <entry>…</entry>
314       <entry>user provided notation at precedence 90</entry>
315      </row>
316     </tbody>
317    </tgroup>
318   </table>
319
320   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
321     <title>Arguments</title>
322     <tgroup cols="4">
323     <tbody>
324      <row>
325       <entry id="grammar.args">&args;</entry>
326       <entry>::=</entry>
327       <entry>
328        <emphasis role="bold">_</emphasis>[<emphasis role="bold">:</emphasis> &term;]
329       </entry>
330       <entry>ignored argument</entry>
331      </row>
332      <row>
333       <entry/>
334       <entry>|</entry>
335       <entry>
336        <emphasis role="bold">(</emphasis><emphasis role="bold">_</emphasis>[<emphasis role="bold">:</emphasis> &term;]<emphasis role="bold">)</emphasis>
337       </entry>
338       <entry>ignored argument</entry>
339      </row>
340      <row>
341       <entry/>
342       <entry>|</entry>
343       <entry>&id;[<emphasis role="bold">,</emphasis>&id;]…[<emphasis role="bold">:</emphasis> &term;]</entry>
344       <entry></entry>
345      </row>
346      <row>
347       <entry/>
348       <entry>|</entry>
349       <entry><emphasis role="bold">(</emphasis>&id;[<emphasis role="bold">,</emphasis>&id;]…[<emphasis role="bold">:</emphasis> &term;]<emphasis role="bold">)</emphasis></entry>
350       <entry/>
351      </row>
352      <row>
353       <entry id="grammar.args2">&args2;</entry>
354       <entry>::=</entry>
355       <entry>&id;</entry>
356       <entry/>
357      </row>
358      <row>
359       <entry/>
360       <entry>|</entry>
361       <entry><emphasis role="bold">(</emphasis>&id;[<emphasis role="bold">,</emphasis>&id;]…<emphasis role="bold">:</emphasis> &term;<emphasis role="bold">)</emphasis></entry>
362       <entry/>
363      </row>
364     </tbody>
365    </tgroup>
366   </table>
367
368   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
369     <title>Pattern matching</title>
370     <tgroup cols="4">
371     <tbody>
372       <row>
373         <entry id="grammar.match_branch">&match_branch;</entry>
374         <entry>::=</entry>
375         <entry>&match_pattern; <emphasis role="bold">⇒</emphasis> &term;</entry>
376         <entry />
377       </row>
378      <row>
379       <entry id="grammar.match_pattern">&match_pattern;</entry>
380       <entry>::=</entry>
381       <entry>&id;</entry>
382       <entry>0-ary constructor</entry>
383      </row>
384      <row>
385       <entry/>
386       <entry>|</entry>
387       <entry><emphasis role="bold">(</emphasis>&id; &id; [&id;]…<emphasis role="bold">)</emphasis></entry>
388       <entry>n-ary constructor (binds the n arguments)</entry>
389      </row>
390      <row>
391       <entry/>
392       <entry>|</entry>
393       <entry>&id; &id; [&id;]…</entry>
394       <entry>n-ary constructor (binds the n arguments)</entry>
395      </row>
396     </tbody>
397    </tgroup>
398   </table>
399   </para>
400
401   </sect2>
402   </sect1>
403
404   <sect1 id="axiom_definition_declaration">
405    <title>Definitions and declarations</title>
406    <sect2 id="axiom">
407     <title><emphasis role="bold">axiom</emphasis> &id;<emphasis role="bold">:</emphasis> &term;</title>
408     <titleabbrev>axiom</titleabbrev>
409     <para><userinput>axiom H: P</userinput></para>
410     <para><command>H</command> is declared as an axiom that states <command>P</command></para>
411   </sect2>
412   <sect2 id="definition">
413     <title><emphasis role="bold">definition</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
414     <titleabbrev>definition</titleabbrev>
415     <para><userinput>definition f: T ≝ t</userinput></para>
416     <para><command>f</command> is defined as <command>t</command>;
417      <command>T</command> is its type. An error is raised if the type of
418      <command>t</command> is not convertible to <command>T</command>.</para>
419     <para><command>T</command> is inferred from <command>t</command> if
420       omitted.</para>
421     <para><command>t</command> can be omitted only if <command>T</command> is
422      given. In this case Matita enters in interactive mode and
423      <command>f</command> must be defined by means of tactics.</para>
424     <para>Notice that the command is equivalent to <command>theorem f: T ≝ t</command>.</para>
425   </sect2>
426   <sect2 id="letrec">
427     <title><emphasis role="bold">letrec</emphasis> &TODO;</title>
428     <titleabbrev>&TODO;</titleabbrev>
429     <para>&TODO</para>
430   </sect2>
431   <sect2 id="inductive">
432     <title>[<emphasis role="bold">inductive</emphasis>|<emphasis role="bold">coinductive</emphasis>] &id; [&args2;]… <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> [<emphasis role="bold">|</emphasis>] [&id;<emphasis role="bold">:</emphasis>&term;] [<emphasis role="bold">|</emphasis> &id;<emphasis role="bold">:</emphasis>&term;]…
433 [<emphasis role="bold">with</emphasis> &id; <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> [<emphasis role="bold">|</emphasis>] [&id;<emphasis role="bold">:</emphasis>&term;] [<emphasis role="bold">|</emphasis> &id;<emphasis role="bold">:</emphasis>&term;]…]…
434 </title>
435     <titleabbrev>(co)inductive types declaration</titleabbrev>
436     <para><userinput>inductive i x y z: S ≝ k1:T1 | … | kn:Tn with i' : S' ≝ k1':T1' | … | km':Tm'</userinput></para>
437     <para>Declares a family of two mutually inductive types
438      <command>i</command> and <command>i'</command> whose types are
439      <command>S</command> and <command>S'</command>, which must be convertible
440      to sorts.</para>
441     <para>The constructors <command>ki</command> of type <command>Ti</command>
442      and <command>ki'</command> of type <command>Ti'</command> are also
443      simultaneously declared. The declared types <command>i</command> and
444      <command>i'</command> may occur in the types of the constructors, but
445      only in strongly positive positions according to the rules of the
446      calculus.</para>
447     <para>The whole family is parameterized over the arguments <command>x,y,z</command>.</para>
448     <para>If the keyword <command>coinductive</command> is used, the declared
449      types are considered mutually coinductive.</para>
450     <para>Elimination principles for the record are automatically generated
451      by Matita, if allowed by the typing rules of the calculus according to
452      the sort <command>S</command>. If generated,
453      they are named <command>i_ind</command>, <command>i_rec</command> and
454      <command>i_rect</command> according to the sort of their induction
455      predicate.</para> 
456   </sect2>
457   <sect2 id="record">
458     <title><emphasis role="bold">record</emphasis> &id; [&args2;]… <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis><emphasis role="bold">{</emphasis>[&id; [<emphasis role="bold">:</emphasis>|<emphasis role="bold">:&gt;</emphasis>] &term;] [<emphasis role="bold">;</emphasis>&id; [<emphasis role="bold">:</emphasis>|<emphasis role="bold">:&gt;</emphasis>] &term;]…<emphasis role="bold">}</emphasis></title>
459     <titleabbrev>record</titleabbrev>
460     <para><userinput>record id x y z: S ≝ { f1: T1; …; fn:Tn }</userinput></para>
461     <para>Declares a new record family <command>id</command> parameterized over
462      <command>x,y,z</command>.</para>
463     <para><command>S</command> is the type of the record
464      and it must be convertible to a sort.</para>
465     <para>Each field <command>fi</command> is declared by giving its type
466      <command>Ti</command>. A record without any field is admitted.</para>
467     <para>Elimination principles for the record are automatically generated
468      by Matita, if allowed by the typing rules of the calculus according to
469      the sort <command>S</command>. If generated,
470      they are named <command>i_ind</command>, <command>i_rec</command> and
471      <command>i_rect</command> according to the sort of their induction
472      predicate.</para> 
473     <para>For each field <command>fi</command> a record projection
474      <command>fi</command> is also automatically generated if projection
475      is allowed by the typing rules of the calculus according to the
476      sort <command>S</command>, the type <command>T1</command> and
477      the definability of depending record projections.</para>
478     <para>If the type of a field is declared with <command>:&gt;</command>,
479      the corresponding record projection becomes an implicit coercion.
480      This is just syntactic sugar and it has the same effect of declaring the
481      record projection as a coercion later on.</para>
482   </sect2>
483   </sect1>
484
485   <sect1 id="proofs">
486    <title>Proofs</title>
487    <sect2 id="theorem">
488     <title><emphasis role="bold">theorem</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
489     <titleabbrev>theorem</titleabbrev>
490     <para><userinput>theorem f: P ≝ p</userinput></para>
491     <para>Proves a new theorem <command>f</command> whose thesis is
492      <command>P</command>.</para>
493     <para>If <command>p</command> is provided, it must be a proof term for
494      <command>P</command>. Otherwise an interactive proof is started.</para>
495     <para><command>P</command> can be omitted only if the proof is not
496      interactive.</para>
497     <para>Proving a theorem already proved in the library is an error.
498      To provide an alternative name and proof for the same theorem, use
499      <command>variant f: P ≝ p</command>.</para>
500     <para>A warning is raised if the name of the theorem cannot be obtained
501       by mangling the name of the constants in its thesis.</para>
502     <para>Notice that the command is equivalent to <command>definition f: T ≝ t</command>.</para>
503    </sect2>
504    <sect2 id="variant">
505     <title><emphasis role="bold">variant</emphasis> &id;<emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> &term;</title>
506     <titleabbrev>variant</titleabbrev>
507     <para><userinput>variant f: T ≝ t</userinput></para>
508     <para>Same as <command>theorem f: T ≝ t</command>, but it does not
509      complain if the theorem has already been proved. To be used to give
510      an alternative name or proof to a theorem.</para>
511    </sect2>
512    <sect2 id="lemma">
513     <title><emphasis role="bold">lemma</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
514     <titleabbrev>lemma</titleabbrev>
515     <para><userinput>lemma f: T ≝ t</userinput></para>
516     <para>Same as <command>theorem f: T ≝ t</command></para>
517    </sect2>
518    <sect2 id="fact">
519     <title><emphasis role="bold">fact</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
520     <titleabbrev>fact</titleabbrev>
521     <para><userinput>fact f: T ≝ t</userinput></para>
522     <para>Same as <command>theorem f: T ≝ t</command></para>
523    </sect2>
524    <sect2 id="remark">
525     <title><emphasis role="bold">remark</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
526     <titleabbrev>remark</titleabbrev>
527     <para><userinput>remark f: T ≝ t</userinput></para>
528     <para>Same as <command>theorem f: T ≝ t</command></para>
529    </sect2>
530   </sect1>
531
532   <sect1 id="tacticargs">
533    <title>Tactic arguments</title>
534    <para>This section documents the syntax of some recurring arguments for
535     tactics.</para>
536
537     <sect2 id="introsspec">
538     <title>intros-spec</title>
539     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
540       <title>intros-spec</title>
541       <tgroup cols="4">
542       <tbody>
543        <row>
544         <entry id="grammar.intros-spec">&intros-spec;</entry>
545         <entry>::=</entry>
546         <entry>[&nat;] [<emphasis role="bold">(</emphasis>[&id;]…<emphasis role="bold">)</emphasis>]</entry>
547        </row>
548       </tbody>
549      </tgroup>
550     </table>
551         <para>The natural number is the number of new hypotheses to be introduced. The list of identifiers gives the name for the first hypotheses.</para>
552     </sect2>
553
554     <sect2 id="pattern">
555     <title>pattern</title>
556     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
557       <title>pattern</title>
558       <tgroup cols="4">
559       <tbody>
560        <row>
561         <entry id="grammar.pattern">&pattern;</entry>
562         <entry>::=</entry>
563         <entry><emphasis role="bold">in</emphasis>
564           [&id;[<emphasis role="bold">:</emphasis> &path;]]…
565           [<emphasis role="bold">⊢</emphasis> &path;]]</entry>
566         <entry>simple pattern</entry>
567        </row>
568        <row>
569         <entry/>
570         <entry>|</entry>
571         <entry><emphasis role="bold">in match</emphasis> &term;
572           [<emphasis role="bold">in</emphasis>
573           [&id;[<emphasis role="bold">:</emphasis> &path;]]…
574           [<emphasis role="bold">⊢</emphasis> &path;]]</entry>
575         <entry>full pattern</entry>
576        </row>
577       </tbody>
578      </tgroup>
579     </table>
580     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
581       <title>path</title>
582       <tgroup cols="4">
583       <tbody>
584        <row>
585         <entry id="grammar.path">&path;</entry>
586         <entry>::=</entry>
587         <entry><emphasis>〈〈any &sterm; whithout occurrences of <emphasis role="bold">Set</emphasis>, <emphasis role="bold">Prop</emphasis>, <emphasis role="bold">CProp</emphasis>, <emphasis role="bold">Type</emphasis>, &id;, &uri; and user provided notation; however, <emphasis role="bold">%</emphasis> is now an additional production for &sterm;〉〉</emphasis></entry>
588        </row>
589       </tbody>
590      </tgroup>
591     </table>
592     <para>A <emphasis>path</emphasis> locates zero or more subterms of a given term by mimicking the term structure up to:</para>
593     <orderedlist>
594       <listitem><para>Occurrences of the subterms to locate that are
595        represented by <emphasis role="bold">%</emphasis>.</para></listitem>
596       <listitem><para>Subterms without any occurrence of subterms to locate
597        that can be represented by <emphasis role="bold">?</emphasis>.
598        </para></listitem>
599     </orderedlist>
600     <para>For instance, the path
601       <userinput>∀_,_:?.(? ? % ?)→(? ? ? %)</userinput>
602        locates at once the subterms
603       <userinput>x+y</userinput> and <userinput>x*y</userinput> in the
604       term <userinput>∀x,y:nat.x+y=1→0=x*y</userinput>
605       (where the notation <userinput>A=B</userinput> hides the term
606       <userinput>(eq T A B)</userinput> for some type <userinput>T</userinput>).
607     </para>
608     <para>A <emphasis>simple pattern</emphasis> extends paths to locate
609      subterms in a whole sequent. In particular, the pattern
610      <userinput>in H: p  K: q ⊢ r</userinput> locates at once all the subterms
611      located by the pattern <userinput>r</userinput> in the conclusion of the
612      sequent and by the patterns <userinput>p</userinput> and
613      <userinput>q</userinput> in the hypotheses <userinput>H</userinput>
614      and <userinput>K</userinput> of the sequent.
615     </para>
616     <para>If no list of hypotheses is provided in a simple pattern, no subterm
617      is selected in the hypothesis. If the <userinput>⊢ p</userinput>
618      part of the pattern is not provided, no subterm will be matched in the
619      conclusion if at least one hypothesis is provided; otherwise the whole
620      conclusion is selected.
621     </para>
622     <para>Finally, a <emphasis>full pattern</emphasis> is interpreted in three
623      steps. In the first step the <userinput>match T in</userinput>
624      part is ignored and a set <emphasis>S</emphasis> of subterms is
625      located as for the case of
626      simple patterns. In the second step the term <userinput>T</userinput>
627      is parsed and interpreted in the context of each subterm
628      <emphasis>s ∈ S</emphasis>. In the last term for each
629      <emphasis>s ∈ S</emphasis> the interpreted term <userinput>T</userinput>
630      computed in the previous step is looked for. The final set of subterms
631      located by the full pattern is the set of occurrences of
632      the interpreted <userinput>T</userinput> in the subterms <emphasis>s</emphasis>.
633     </para>
634     <para>A full pattern can always be replaced by a simple pattern,
635       often at the cost of increased verbosity or decreased readability.</para>
636     <para>Example: the pattern
637       <userinput>⊢ in match x+y in ∀_,_:?.(? ? % ?)</userinput>
638       locates only the first occurrence of <userinput>x+y</userinput>
639       in the sequent <userinput>x,y: nat ⊢ ∀z,w:nat. (x+y) * (z+w) =
640       z * (x+y) + w * (x+y)</userinput>. The corresponding simple pattern
641       is <userinput>⊢ ∀_,_:?.(? ? (? % ?) ?)</userinput>.
642     </para>
643     <para>Every tactic that acts on subterms of the selected sequents have
644      a pattern argument for uniformity. To automatically generate a simple
645      pattern:</para>
646     <orderedlist>
647      <listitem><para>Select in the current goal the subterms to pass to the
648       tactic by using the mouse. In order to perform a multiple selection of
649       subterms, hold the Ctrl key while selecting every subterm after the
650       first one.</para></listitem>
651      <listitem><para>From the contextual menu select &quot;Copy&quot;.</para></listitem>
652      <listitem><para>From the &quot;Edit&quot; or the contextual menu select
653       &quot;Paste as pattern&quot;</para></listitem>
654     </orderedlist>
655     </sect2>
656
657     <sect2 id="reduction-kind">
658     <title>reduction-kind</title>
659     <para>Reduction kinds are normalization functions that transform a term
660      to a convertible but simpler one. Each reduction kind can be used both
661      as a tactic argument and as a stand-alone tactic.</para>
662     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
663       <title>reduction-kind</title>
664       <tgroup cols="4">
665       <tbody>
666        <row>
667         <entry id="grammar.reduction-kind">&reduction-kind;</entry>
668         <entry>::=</entry>
669         <entry><emphasis role="bold">normalize</emphasis></entry>
670         <entry>Computes the βδιζ-normal form</entry>
671        </row>
672        <row>
673         <entry/>
674         <entry>|</entry>
675         <entry><emphasis role="bold">reduce</emphasis></entry>
676         <entry>Computes the βδιζ-normal form</entry>
677        </row>
678        <row>
679         <entry/>
680         <entry>|</entry>
681         <entry><emphasis role="bold">simplify</emphasis></entry>
682         <entry>Computes a form supposed to be simpler</entry>
683        </row>
684        <row>
685         <entry/>
686         <entry>|</entry>
687         <entry><emphasis role="bold">unfold</emphasis> [&sterm;]</entry>
688         <entry>δ-reduces the constant or variable if specified, or that
689          in head position</entry>
690        </row>
691        <row>
692         <entry/>
693         <entry>|</entry>
694         <entry><emphasis role="bold">whd</emphasis></entry>
695         <entry>Computes the βδιζ-weak-head normal form</entry>
696        </row>
697       </tbody>
698      </tgroup>
699     </table>
700     </sect2>
701
702     <sect2 id="auto-params">
703     <title>auto-params</title>
704     <para>&TODO;</para>
705     <table frame="topbot" rowsep="0" colsep="0" role="grammar">
706       <title>reduction-kind</title>
707       <tgroup cols="4">
708       <tbody>
709        <row>
710         <entry id="grammar.autoparams">&autoparams;</entry>
711         <entry>::=</entry>
712         <entry><emphasis role="bold">depth=&nat;</emphasis></entry>
713         <entry>&TODO;</entry>
714        </row>
715        <row>
716         <entry/>
717         <entry>|</entry>
718         <entry><emphasis role="bold">width=&nat;</emphasis></entry>
719         <entry>&TODO;</entry>
720        </row>
721        <row>
722         <entry/>
723         <entry>|</entry>
724         <entry><emphasis role="bold">&TODO;</emphasis></entry>
725         <entry>&TODO;</entry>
726        </row>
727       </tbody>
728      </tgroup>
729     </table>
730     </sect2>
731   </sect1>
732
733 </chapter>
734