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