2 <!-- ============ Commands ====================== -->
3 <chapter id="sec_commands">
4 <title>Other commands</title>
5 <sect1 id="command_alias">
7 <para><userinput>alias id "s" = "def"</userinput></para>
8 <para><userinput>alias symbol "s" (instance n) = "def"</userinput></para>
9 <para><userinput>alias num (instance n) = "def"</userinput></para>
13 <term>Synopsis:</term>
15 <para><emphasis role="bold">alias</emphasis>
16 [<emphasis role="bold">id</emphasis> &qstring; <emphasis role="bold">=</emphasis> &qstring;
17 | <emphasis role="bold">symbol</emphasis> &qstring; [<emphasis role="bold">(instance</emphasis> &nat;<emphasis role="bold">)</emphasis>] <emphasis role="bold">=</emphasis> &qstring;
18 | <emphasis role="bold">num</emphasis> [<emphasis role="bold">(instance</emphasis> &nat;<emphasis role="bold">)</emphasis>] <emphasis role="bold">=</emphasis> &qstring;
26 <para>Used to give an hint to the disambiguating parser.
27 When the parser is faced to the identifier (or symbol)
28 <command>s</command> or to any number, it will prefer
29 interpretations that "map <command>s</command> (or the
30 number) to <command>def</command>". For identifiers,
31 "def" is the URI of the interpretation.
32 E.g.: <command>cic:/matita/nat/nat.ind#xpointer(1/1/1)</command>
33 for the first constructor of the first inductive type defined
34 in the block of inductive type(s)
35 <command>cic:/matita/nat/nat.ind</command>.
36 For symbols and numbers, "def" is the label used to
38 <link linkend="interpretation">interpretation</link>.
40 <para>When a symbol or a number occurs several times in the
41 term to be parsed, it is possible to give an hint only for the
42 instance <command>n</command>. When the instance is omitted,
43 the hint is valid for every occurrence.
46 Hints are automatically inserted in the script by Matita every
47 time the user is interactively asked a question to disambiguate
48 a term. This way the user won't be posed the same question twice
49 when the script will be executed again.</para>
55 <sect1 id="command_check">
57 <para><userinput>check t</userinput></para>
61 <term>Synopsis:</term>
63 <para><emphasis role="bold">check</emphasis> &sterm;</para>
69 <para>Opens a CIC browser window that shows <command>t</command>
70 together with its type. The command is immediately removed from
78 <sect1 id="command_eval">
80 <para><userinput>eval red on t</userinput></para>
84 <term>Synopsis:</term>
86 <para><emphasis role="bold">eval</emphasis>
88 <emphasis role="bold">on</emphasis>
95 <para>Opens a CIC browser window that shows
98 together with its type.</para>
106 <sect1 id="command_prefer_coercion">
107 <title>prefer coercion</title>
108 <para><userinput>prefer coercion u</userinput></para>
112 <term>Synopsis:</term>
115 <emphasis role="bold">prefer coercion</emphasis>
123 <para>The already declared coercion <command>u</command>
124 is preferred to other coercions with the same source and target.
132 <sect1 id="command_coercion">
133 <title>coercion</title>
134 <para><userinput>coercion nocomposites c : ty ≝ u on s : S to T</userinput></para>
138 <term>Synopsis:</term>
141 <emphasis role="bold">coercion</emphasis>
142 [ <emphasis role="bold">nocomposites</emphasis> ] &id;
143 [ : &term; <emphasis role="bold">≝</emphasis> &term;
144 <emphasis role="bold">on</emphasis>
146 <emphasis role="bold">to</emphasis> &term; ]
153 <para>Declares <command>c</command> as an implicit coercion.
154 If only <command>c</command> is given, <command>u</command>
155 is the constant named by <command>c</command>,
156 <command>ty</command> its declared type,
157 <command>s</command> the name of the last variable abstracted in
158 in <command>ty</command>, <command>S</command> the type of
159 this last variable and <command>T</command> the target of
160 <command>ty</command>. The user can specify all these component to
161 have full control on how the coercion is indexed.
162 The type of the body of the coercion <command>u</command> must be
163 convertible to the declared one <command>ty</command>. Let it be
164 <command>∀x1:T1. … ∀x(n-1):T(n-1).Tn</command>.
165 Then <command>s</command> must be one of <command>x1</command> …
166 <command>xn</command> (possibly prefixed by <command>_</command>
167 if the product is non dependent). Let <command>s</command>
168 be <command>xi</command> in the following.
169 Then <command>S</command> must be <command>Ti</command>
170 where all bound variables are replaced by <command>?</command>,
171 and <command>T</command> must be <command>Tn</command>
172 where all bound variable are replaced by <command>?</command>.
173 For example the following command
174 declares a coercions from vectors of any length to lists of
175 natural numbers.</para>
177 <para><userinput>coercion nocomposites v2l : ∀n:nat.∀v:Vect nat n.
178 List nat ≝ l_of_v on _v : Vect nat ? to List nat</userinput></para>
181 <para>Every time a term <command>x</command>
182 of a type that matches <command>S</command>
183 (<command>Vect nat ?</command> here)
184 is used with an expected
185 type that matches <command>T</command>
186 (<command>List nat</command> here), Matita
187 automatically replaces <command>x</command> with
188 <command>(u ? … ? x ? … ?)</command> to avoid a typing error.
189 Note that the position of <command>x</command> is determined by
190 <command>s</command>.</para>
192 <para>Implicit coercions are not displayed to the user:
193 <command>(u ? … ? x)</command> is rendered simply
194 as <command>x</command>.</para>
196 <para>When a coercion <command>u</command> is declared
197 from source <command>s</command> to target <command>t</command>
198 and there is already a coercion <command>u'</command> of
199 target <command>s</command> or source <command>t</command>,
200 a composite implicit coercion is automatically computed
201 by Matita unless <emphasis role="bold">nocomposites</emphasis>
204 <para>Note that <command>Vect nat ?</command> can be replaced with
205 <command>Vect ? ?</command> to index the coercion is a loose way.</para>
212 <sect1 id="command_default">
213 <title>default</title>
214 <para><userinput>default "s" u<subscript>1</subscript> … u<subscript>n</subscript></userinput></para>
218 <term>Synopsis:</term>
220 <para><emphasis role="bold">default</emphasis>
221 &qstring; &uri; [&uri;]…
228 <para>It registers a cluster of related definitions and
229 theorems to be used by tactics and the rendering engine.
230 Some functionalities of Matita are not available when some
231 clusters have not been registered. Overloading a cluster
232 registration is possible: the last registration will be the
233 default one, but the previous ones are still in effect.</para>
235 <command>s</command> is an identifier of the cluster and
236 <command>u<subscript>1</subscript> … u<subscript>n</subscript></command>
237 are the URIs of the definitions and theorems of the cluster.
238 The number <command>n</command> of required URIs depends on the
239 cluster. The following clusters are supported.
242 <title>clusters</title>
247 <entry>expected object for 1st URI</entry>
248 <entry>expected object for 2nd URI</entry>
249 <entry>expected object for 3rd URI</entry>
250 <entry>expected object for 4th URI</entry>
251 <entry>expected object for 5th URI</entry>
252 <entry>expected object for 6th URI</entry>
253 <entry>expected object for 7th URI</entry>
254 <entry>expected object for 8th URI</entry>
255 <entry>expected object for 9th URI</entry>
256 <entry>expected object for 10th URI</entry>
257 <entry>expected object for 11th URI</entry>
262 <entry>equality</entry>
263 <entry>an inductive type (say, of type <command>eq</command>) of type ∀A:Type.A <emphasis role="bold">→</emphasis> <emphasis role="bold">Prop</emphasis> with one family parameter and one constructor of type ∀x:A.eq A x</entry>
264 <entry>a theorem of type <emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>x,y:A.eq A x y <emphasis role="bold">→</emphasis> eq A y x</entry>
265 <entry>a theorem of type <emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>x,y,z:A.eq A x y <emphasis role="bold">→</emphasis> eq A y z <emphasis role="bold">→</emphasis> eq A x z</entry>
266 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Prop</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A x y <emphasis role="bold">→</emphasis> P y</entry>
267 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Prop</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A y x <emphasis role="bold">→</emphasis> P y</entry>
268 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Set</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A x y <emphasis role="bold">→</emphasis> P y</entry>
269 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Set</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A y x <emphasis role="bold">→</emphasis> P y</entry>
270 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Type</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A x y <emphasis role="bold">→</emphasis> P y</entry>
271 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Type</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A y x <emphasis role="bold">→</emphasis> P y</entry>
272 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>B.<emphasis role="bold">∀</emphasis> f:A <emphasis role="bold">→</emphasis> B.<emphasis role="bold">∀</emphasis>x,y:A.eq A x y <emphasis role="bold">→</emphasis> eq B (f x) (f y)</entry>
273 <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>B.<emphasis role="bold">∀</emphasis> f:A <emphasis role="bold">→</emphasis> B.<emphasis role="bold">∀</emphasis>x,y:A.eq A x y <emphasis role="bold">→</emphasis> eq B (f y) (f x)</entry>
277 <entry>an inductive type of type <emphasis role="bold">Prop</emphasis> with only one constructor that has no arguments</entry>
285 <entry>an inductive type of type <emphasis role="bold">Prop</emphasis> without constructors</entry>
292 <entry>absurd</entry>
293 <entry>a theorem of type <emphasis role="bold">∀</emphasis>A:Prop.<emphasis role="bold">∀</emphasis>B:Prop.A <emphasis role="bold">→</emphasis> Not A <emphasis role="bold">→</emphasis> B</entry>
309 <sect1 id="command_hint">
311 <para><userinput>hint</userinput></para>
315 <term>Synopsis:</term>
317 <para><emphasis role="bold">hint</emphasis>
324 <para>Displays a list of theorems that can be successfully
325 applied to the current selected sequent. The command is
326 removed from the script, but the window that displays the
327 theorems allow to add to the script the application of the
336 <sect1 id="command_include">
337 <title>include</title>
338 <para><userinput>include "s"</userinput></para>
342 <term>Synopsis:</term>
344 <para><emphasis role="bold">include</emphasis> &qstring;</para>
350 <para>Every <link linkend="command_coercion">coercion</link>,
351 <link linkend="notation">notation</link> and
352 <link linkend="interpretation">interpretation</link> that was active
353 when the file <command>s</command> was compiled last time
354 is made active. The same happens for declarations of
355 <link linkend="command_default">default definitions and
356 theorems</link> and disambiguation
357 hints (<link linkend="command_alias">aliases</link>).
358 On the contrary, theorem and definitions declared in a file can be
359 immediately used without including it.</para>
360 <para>The file <command>s</command> is automatically compiled
361 if it is not compiled yet.
364 If the file <command>s</command> was already included, either
365 directly or recursively, the commands does nothing.
372 <sect1 id="command_include_alias">
373 <title>include alias</title>
374 <para><userinput>include alias "s"</userinput></para>
378 <term>Synopsis:</term>
380 <para><emphasis role="bold">include</emphasis> <emphasis role="bold">alias</emphasis> &qstring;</para>
387 <link linkend="interpretation">interpretation</link>
388 declared in the file <command>s</command> is re-declared
389 so to make it the preferred choice for disambiguation.
397 <sect1 id="command_include_first">
398 <title>include' "s"</title>
399 <para><userinput></userinput></para>
403 <term>Synopsis:</term>
405 <para><emphasis role="bold">include'</emphasis> &qstring;</para>
411 <para>Not documented (&TODO;), do not use it.</para>
419 <sect1 id="command_whelp">
421 <para><userinput>whelp locate "s"</userinput></para>
422 <para><userinput>whelp hint t</userinput></para>
423 <para><userinput>whelp elim t</userinput></para>
424 <para><userinput>whelp match t</userinput></para>
425 <para><userinput>whelp instance t</userinput></para>
429 <term>Synopsis:</term>
431 <para><emphasis role="bold">whelp</emphasis>
432 [<emphasis role="bold">locate</emphasis> &qstring;
433 | <emphasis role="bold">hint</emphasis> &term;
434 | <emphasis role="bold">elim</emphasis> &term;
435 | <emphasis role="bold">match</emphasis> &term;
436 | <emphasis role="bold">instance</emphasis> &term;
444 <para>Performs the corresponding <link linkend="whelp">query</link>,
445 showing the result in the CIC browser. The command is removed
454 <sect1 id="command_qed">
456 <para><userinput>qed</userinput></para>
460 <term>Synopsis:</term>
462 <para><emphasis role="bold">qed</emphasis>
469 <para>Saves and indexes the current interactive theorem or
471 In order to do this, the set of sequents still to be proved
472 must be empty.</para>
478 <sect1 id="command_qed_minus">
480 <para><userinput>qed-</userinput></para>
484 <term>Synopsis:</term>
486 <para><emphasis role="bold">qed-</emphasis>
493 <para>Saves the current interactive theorem or
494 definition without indexing. Therefore automation will ignore
496 In order to do this, the set of sequents still to be proved
497 must be empty.</para>
503 <sect1 id="command_unification_hint">
504 <title>unification hint</title>
505 <para><userinput>unification hint n ≔ v1 : T1,… vi : Ti; h1 ≟ t1, … hn ≟ tn ⊢ tl ≡ tr.</userinput></para>
509 <term>Synopsis:</term>
512 <emphasis role="bold">unification hint</emphasis>
514 <emphasis role="bold">≔</emphasis>
515 [ &id; [ <emphasis role="bold">:</emphasis> &term; ] ,.. ]
516 <emphasis role="bold">;</emphasis>
517 [ &id; <emphasis role="bold">≟</emphasis> &term; ,.. ]
518 <emphasis role="bold">⊢</emphasis>
519 &term; <emphasis role="bold">≡</emphasis> &term;
526 <para>Declares the hint at precedence <command>n</command></para>
527 <para>The file <command>hints_declaration.ma</command> must be
528 included to declare hints with that syntax.</para>
529 <para>Unification hints are described in the paper
530 "Hints in unification" by
531 Asperti, Ricciotti, Sacerdoti and Tassi.
539 <sect1 id="command_universe_constraints">
540 <title>universe constraint</title>
543 <para><userinput>coercion u with ariety saturation nocomposites</userinput></para>
547 <term>Synopsis:</term>
550 <emphasis role="bold">coercion</emphasis>
551 (&uri; | &term; <emphasis role="bold">with</emphasis>)
553 [ <emphasis role="bold">nocomposites</emphasis> ]
560 <para>Declares <command>u</command> as an implicit coercion.
561 If the type of <command>u</command> is
562 <command>∀x1:T1. … ∀x(n-1):T(n-1).Tn</command> the coercion target is
563 <command>T(n - ariety)</command> while its source is
564 <command>T(n - ariety - saturation - 1)</command>.
565 Every time a term <command>x</command>
566 of type source is used with expected type target, Matita
567 automatically replaces <command>x</command> with
568 <command>(u ? … ? x ? … ?)</command> to avoid a typing error.</para>
569 Note that the number of <command>?</command> added after
570 <command>x</command> is saturation.
571 <para>Implicit coercions are not displayed to the user:
572 <command>(u ? … ? x)</command> is rendered simply
573 as <command>x</command>.</para>
574 <para>When a coercion <command>u</command> is declared
575 from source <command>s</command> to target <command>t</command>
576 and there is already a coercion <command>u'</command> of
577 target <command>s</command> or source <command>t</command>,
578 a composite implicit coercion is automatically computed
579 by Matita unless <emphasis role="bold">nocomposites</emphasis>
589 <sect1 id="command_inline">
590 <title>inline</title>
591 <para><userinput>inline "s" params</userinput></para>
595 <term>Synopsis:</term>
598 <emphasis role="bold">inline</emphasis> &qstring; &inlineparams;
605 <para>Inlines a representation of the item <command>s</command>,
606 which can be the URI of a HELM object. If an entire HELM directory (i.e. a base
607 URI) or the path of a *.ma source file is provided, all the contained objects
608 are represented in a row.
609 If the inlined object has a proof, this proof is represented in several ways
610 depending on the provided parameters.</para>
616 <sect2 id="inline-params">
617 <title>inline-params</title>
618 <table frame="topbot" rowsep="0" colsep="0" role="grammar">
619 <title>inline-params</title>
623 <entry id="grammar.inlineparams">&inlineparams;</entry>
625 <entry>[&inlineparam; [&inlineparam;] … ]</entry>
630 <table frame="topbot" rowsep="0" colsep="0" role="grammar">
631 <title>inline-param</title>
636 <entry id="grammar.inlineparam">&inlineparam;</entry>
638 <entry><emphasis role="bold">axiom</emphasis></entry>
639 <entry>Try to give an <link linkend="axiom">axiom</link> flavour
640 (bodies are omitted even if present)
647 <entry><emphasis role="bold"> definition</emphasis></entry>
648 <entry>Try give a <link linkend="definition">definition</link> flavour
655 <entry><emphasis role="bold">theorem</emphasis></entry>
656 <entry>Try give a <link linkend="theorem">theorem</link> flavour
663 <entry><emphasis role="bold">lemma</emphasis></entry>
664 <entry>Try give a <link linkend="lemma">lemma</link> flavour
671 <entry><emphasis role="bold">remark</emphasis></entry>
672 <entry>Try give a <link linkend="remark">remark</link> flavour
679 <entry><emphasis role="bold">fact</emphasis></entry>
680 <entry>Try give a <link linkend="fact">fact</link> flavour
687 <entry><emphasis role="bold">variant</emphasis></entry>
688 <entry>Try give a <link linkend="variant">variant</link> flavour
689 (implies <emphasis role="bold">plain</emphasis>)
696 <entry><emphasis role="bold">declarative</emphasis></entry>
697 <entry>Represent proofs using
698 <link linkend="sec_declarative_tactics">declarative tactics</link>
699 (this is the dafault and can be omitted)
706 <entry><emphasis role="bold">procedural</emphasis></entry>
707 <entry>Represent proofs using
708 <link linkend="sec_tactics">procedural tactics</link>
715 <entry><emphasis role="bold">plain</emphasis></entry>
716 <entry>Represent proofs using plain
717 <link linkend="tbl_terms">proof terms</link>
724 <entry><emphasis role="bold">nodefaults</emphasis></entry>
726 Do not use the tactics depending on the
727 <link linkend="command_default">default</link> command
728 (<link linkend="tac_rewrite">rewrite</link>
729 in the <emphasis role="bold">procedural</emphasis> mode)
736 <entry><emphasis role="bold">level=&nat;</emphasis></entry>
738 Set the level of the procedural proof representation
739 (the default is the highest level)
742 Tactics used at level 1:
743 <link linkend="tac_exact">exact</link>
746 Additional tactics used at level 2:
747 <link linkend="tac_letin">letin</link>,
748 <link linkend="tac_cut">cut</link>,
749 <link linkend="tac_change">change</link>,
750 <link linkend="tac_intros">intros</link>,
751 <link linkend="tac_apply">apply</link>,
752 <link linkend="tac_elim">elim</link>,
753 <link linkend="tac_cases">cases</link>,
754 <link linkend="tac_rewrite">rewrite</link>
763 <entry><emphasis role="bold">depth=&nat;</emphasis></entry>
764 <entry>&TODO;</entry>