2 <!-- ============ Tactics ====================== -->
3 <chapter id="sec_tactics">
6 <sect1 id="tactics_quickref">
7 <title>Quick reference card</title>
13 <sect1 id="tac_absurd">
15 <titleabbrev>absurd</titleabbrev>
16 <para><userinput>absurd P</userinput></para>
19 <varlistentry role="tactic.synopsis">
20 <term>Synopsis:</term>
22 <para><emphasis role="bold">absurd</emphasis> &sterm;</para>
26 <term>Pre-conditions:</term>
28 <para><command>P</command> must have type <command>Prop</command>.</para>
34 <para>It closes the current sequent by eliminating an
39 <term>New sequents to prove:</term>
41 <para>It opens two new sequents of conclusion <command>P</command>
42 and <command>¬P</command>.</para>
48 <sect1 id="tac_apply">
50 <titleabbrev>apply</titleabbrev>
51 <para><userinput>apply t</userinput></para>
54 <varlistentry role="tactic.synopsis">
55 <term>Synopsis:</term>
57 <para><emphasis role="bold">apply</emphasis> &sterm;</para>
61 <term>Pre-conditions:</term>
63 <para><command>t</command> must have type
64 <command>T<subscript>1</subscript> → ... →
65 T<subscript>n</subscript> → G</command>
66 where <command>G</command> can be unified with the conclusion
67 of the current sequent.</para>
73 <para>It closes the current sequent by applying <command>t</command> to <command>n</command> implicit arguments (that become new sequents).</para>
77 <term>New sequents to prove:</term>
79 <para>It opens a new sequent for each premise
80 <command>T<subscript>i</subscript></command> that is not
81 instantiated by unification. <command>T<subscript>i</subscript></command> is
82 the conclusion of the <command>i</command>-th new sequent to
89 <sect1 id="tac_applyS">
91 <titleabbrev>applyS</titleabbrev>
92 <para><userinput>applyS t auto_params</userinput></para>
95 <varlistentry role="tactic.synopsis">
96 <term>Synopsis:</term>
98 <para><emphasis role="bold">applyS</emphasis> &sterm; &autoparams;</para>
102 <term>Pre-conditions:</term>
104 <para><command>t</command> must have type
105 <command>T<subscript>1</subscript> → ... →
106 T<subscript>n</subscript> → G</command>.</para>
112 <para><command>applyS</command> is useful when
113 <command>apply</command> fails because the current goal
114 and the conclusion of the applied theorems are extensionally
115 equivalent up to instantiation of metavariables, but cannot
116 be unified. E.g. the goal is <command>P(n*O+m)</command> and
117 the theorem to be applied proves <command>∀m.P(m+O)</command>.
120 It tries to automatically rewrite the current goal using
121 <link linkend="tac_auto">auto paramodulation</link>
122 to make it unifiable with <command>G</command>.
123 Then it closes the current sequent by applying
124 <command>t</command> to <command>n</command>
125 implicit arguments (that become new sequents).
126 The <command>auto_params</command> parameters are passed
127 directly to <command>auto paramodulation</command>.
132 <term>New sequents to prove:</term>
134 <para>It opens a new sequent for each premise
135 <command>T<subscript>i</subscript></command> that is not
136 instantiated by unification. <command>T<subscript>i</subscript></command> is
137 the conclusion of the <command>i</command>-th new sequent to
144 <sect1 id="tac_assumption">
145 <title>assumption</title>
146 <titleabbrev>assumption</titleabbrev>
147 <para><userinput>assumption </userinput></para>
150 <varlistentry role="tactic.synopsis">
151 <term>Synopsis:</term>
153 <para><emphasis role="bold">assumption</emphasis></para>
157 <term>Pre-conditions:</term>
159 <para>There must exist an hypothesis whose type can be unified with
160 the conclusion of the current sequent.</para>
166 <para>It closes the current sequent exploiting an hypothesis.</para>
170 <term>New sequents to prove:</term>
178 <sect1 id="tac_auto">
180 <titleabbrev>auto</titleabbrev>
181 <para><userinput>auto params</userinput></para>
184 <varlistentry role="tactic.synopsis">
185 <term>Synopsis:</term>
187 <para><emphasis role="bold">auto</emphasis> &autoparams;. </para>
188 <para><emphasis role="bold">autobatch</emphasis> &autoparams;</para>
192 <term>Pre-conditions:</term>
194 <para>None, but the tactic may fail finding a proof if every
195 proof is in the search space that is pruned away. Pruning is
196 controlled by the optional <command>params</command>.
197 Moreover, only lemmas whose type signature is a subset of the
198 signature of the current sequent are considered. The signature of
199 a sequent is essentially the set of constats appearing in it.
206 <para>It closes the current sequent by repeated application of
207 rewriting steps (unless <command>paramodulation</command> is
208 omitted), hypothesis and lemmas in the library.</para>
212 <term>New sequents to prove:</term>
220 <sect1 id="tac_cases">
222 <titleabbrev>cases</titleabbrev>
228 <varlistentry role="tactic.synopsis">
229 <term>Synopsis:</term>
232 <emphasis role="bold">cases</emphasis>
233 &term; [<emphasis role="bold">(</emphasis>[&id;]…<emphasis role="bold">)</emphasis>]
238 <term>Pre-conditions:</term>
241 <command>t</command> must inhabit an inductive type
249 It proceed by cases on <command>t</command>. The new generated
250 hypothesis in each branch are named according to
251 <command>hyps</command>.
256 <term>New sequents to prove:</term>
258 <para>One new sequent for each constructor of the type of
259 <command>t</command>. Each sequent has a new hypothesis for
260 each argument of the constructor.</para>
266 <sect1 id="tac_clear">
268 <titleabbrev>clear</titleabbrev>
270 clear H<subscript>1</subscript> ... H<subscript>m</subscript>
274 <varlistentry role="tactic.synopsis">
275 <term>Synopsis:</term>
278 <emphasis role="bold">clear</emphasis>
284 <term>Pre-conditions:</term>
288 H<subscript>1</subscript> ... H<subscript>m</subscript>
289 </command> must be hypotheses of the
290 current sequent to prove.
298 It hides the hypotheses
300 H<subscript>1</subscript> ... H<subscript>m</subscript>
301 </command> from the current sequent.
306 <term>New sequents to prove:</term>
314 <sect1 id="tac_clearbody">
315 <title>clearbody</title>
316 <titleabbrev>clearbody</titleabbrev>
317 <para><userinput>clearbody H</userinput></para>
320 <varlistentry role="tactic.synopsis">
321 <term>Synopsis:</term>
323 <para><emphasis role="bold">clearbody</emphasis> &id;</para>
327 <term>Pre-conditions:</term>
329 <para><command>H</command> must be an hypothesis of the
330 current sequent to prove.</para>
336 <para>It hides the definiens of a definition in the current
337 sequent context. Thus the definition becomes an hypothesis.</para>
341 <term>New sequents to prove:</term>
349 <sect1 id="tac_compose">
350 <title>compose</title>
351 <titleabbrev>compose</titleabbrev>
352 <para><userinput>compose n t1 with t2 hyps</userinput></para>
355 <varlistentry role="tactic.synopsis">
356 <term>Synopsis:</term>
358 <para><emphasis role="bold">compose</emphasis> [&nat;] &sterm; [<emphasis role="bold">with</emphasis> &sterm;] [&intros-spec;]</para>
362 <term>Pre-conditions:</term>
370 <para>Composes t1 with t2 in every possible way
371 <command>n</command> times introducing generated terms
372 as if <command>intros hyps</command> was issued.</para>
373 <para>If <command>t1:∀x:A.B[x]</command> and
374 <command>t2:∀x,y:A.B[x]→B[y]→C[x,y]</command> it generates:
377 <para><command>λx,y:A.t2 x y (t1 x) : ∀x,y:A.B[y]→C[x,y]</command></para>
380 <para><command>λx,y:A.λH:B[x].t2 x y H (t1 y) : ∀x,y:A.B[x]→C[x,y]
385 <para>If <command>t2</command> is omitted it composes
386 <command>t1</command>
387 with every hypothesis that can be introduced.
388 <command>n</command> iterates the process.</para>
392 <term>New sequents to prove:</term>
394 <para>The same, but with more hypothesis eventually introduced
395 by the &intros-spec;.</para>
401 <sect1 id="tac_change">
402 <title>change</title>
403 <titleabbrev>change</titleabbrev>
404 <para><userinput>change patt with t</userinput></para>
407 <varlistentry role="tactic.synopsis">
408 <term>Synopsis:</term>
410 <para><emphasis role="bold">change</emphasis> &pattern; <emphasis role="bold">with</emphasis> &sterm;</para>
414 <term>Pre-conditions:</term>
416 <para>Each subterm matched by the pattern must be convertible
417 with the term <command>t</command> disambiguated in the context
418 of the matched subterm.</para>
424 <para>It replaces the subterms of the current sequent matched by
425 <command>patt</command> with the new term <command>t</command>.
426 For each subterm matched by the pattern, <command>t</command> is
427 disambiguated in the context of the subterm.</para>
431 <term>New sequents to prove:</term>
439 <sect1 id="tac_constructor">
440 <title>constructor</title>
441 <titleabbrev>constructor</titleabbrev>
442 <para><userinput>constructor n</userinput></para>
445 <varlistentry role="tactic.synopsis">
446 <term>Synopsis:</term>
448 <para><emphasis role="bold">constructor</emphasis> &nat;</para>
452 <term>Pre-conditions:</term>
454 <para>The conclusion of the current sequent must be
455 an inductive type or the application of an inductive type with
456 at least <command>n</command> constructors.</para>
462 <para>It applies the <command>n</command>-th constructor of the
463 inductive type of the conclusion of the current sequent.</para>
467 <term>New sequents to prove:</term>
469 <para>It opens a new sequent for each premise of the constructor
470 that can not be inferred by unification. For more details,
471 see the <command>apply</command> tactic.</para>
477 <sect1 id="tac_contradiction">
478 <title>contradiction</title>
479 <titleabbrev>contradiction</titleabbrev>
480 <para><userinput>contradiction </userinput></para>
483 <varlistentry role="tactic.synopsis">
484 <term>Synopsis:</term>
486 <para><emphasis role="bold">contradiction</emphasis></para>
490 <term>Pre-conditions:</term>
492 <para>There must be in the current context an hypothesis of type
493 <command>False</command>.</para>
499 <para>It closes the current sequent by applying an hypothesis of
500 type <command>False</command>.</para>
504 <term>New sequents to prove:</term>
514 <titleabbrev>cut</titleabbrev>
515 <para><userinput>cut P as H</userinput></para>
518 <varlistentry role="tactic.synopsis">
519 <term>Synopsis:</term>
521 <para><emphasis role="bold">cut</emphasis> &sterm; [<emphasis role="bold">as</emphasis> &id;]</para>
525 <term>Pre-conditions:</term>
527 <para><command>P</command> must have type <command>Prop</command>.</para>
533 <para>It closes the current sequent.</para>
537 <term>New sequents to prove:</term>
539 <para>It opens two new sequents. The first one has an extra
540 hypothesis <command>H:P</command>. If <command>H</command> is
541 omitted, the name of the hypothesis is automatically generated.
542 The second sequent has conclusion <command>P</command> and
543 hypotheses the hypotheses of the current sequent to prove.</para>
549 <sect1 id="tac_decompose">
550 <title>decompose</title>
551 <titleabbrev>decompose</titleabbrev>
553 decompose as H<subscript>1</subscript> ... H<subscript>m</subscript>
557 <varlistentry role="tactic.synopsis">
558 <term>Synopsis:</term>
561 <emphasis role="bold">decompose</emphasis>
562 [<emphasis role="bold">as</emphasis> &id;…]
567 <term>Pre-conditions:</term>
576 For each each premise <command>H</command> of type
577 <command>T</command> in the current context where
578 <command>T</command> is a non-recursive inductive type without
579 right parameters and of sort Prop or CProp, the tactic runs
581 elim H as H<subscript>1</subscript> ... H<subscript>m</subscript>
582 </command>, clears <command>H</command> and runs itself
583 recursively on each new premise introduced by
584 <command>elim</command> in the opened sequents.
589 <term>New sequents to prove:</term>
592 The ones generated by all the <command>elim</command> tactics run.
599 <sect1 id="tac_demodulate">
600 <title>demodulate</title>
601 <titleabbrev>demodulate</titleabbrev>
602 <para><userinput>demodulate auto_params</userinput></para>
605 <varlistentry role="tactic.synopsis">
606 <term>Synopsis:</term>
608 <para><emphasis role="bold">demodulate</emphasis> &autoparams;</para>
612 <term>Pre-conditions:</term>
624 <term>New sequents to prove:</term>
632 <sect1 id="tac_destruct">
633 <title>destruct</title>
634 <titleabbrev>destruct</titleabbrev>
635 <para><userinput>destruct p</userinput></para>
638 <varlistentry role="tactic.synopsis">
639 <term>Synopsis:</term>
641 <para><emphasis role="bold">destruct</emphasis> &sterm;</para>
645 <term>Pre-conditions:</term>
647 <para><command>p</command> must have type <command>E<subscript>1</subscript> = E<subscript>2</subscript></command> where the two sides of the equality are possibly applied constructors of an inductive type.</para>
653 <para>The tactic recursively compare the two sides of the equality
654 looking for different constructors in corresponding position.
655 If two of them are found, the tactic closes the current sequent
656 by proving the absurdity of <command>p</command>. Otherwise
657 it adds a new hypothesis for each leaf of the formula that
658 states the equality of the subformulae in the corresponding
659 positions on the two sides of the equality.
664 <term>New sequents to prove:</term>
672 <sect1 id="tac_elim">
674 <titleabbrev>elim</titleabbrev>
675 <para><userinput>elim t using th hyps</userinput></para>
678 <varlistentry role="tactic.synopsis">
679 <term>Synopsis:</term>
681 <para><emphasis role="bold">elim</emphasis> &sterm; [<emphasis role="bold">using</emphasis> &sterm;] &intros-spec;</para>
685 <term>Pre-conditions:</term>
687 <para><command>t</command> must inhabit an inductive type and
688 <command>th</command> must be an elimination principle for that
689 inductive type. If <command>th</command> is omitted the appropriate
690 standard elimination principle is chosen.</para>
696 <para>It proceeds by cases on the values of <command>t</command>,
697 according to the elimination principle <command>th</command>.
702 <term>New sequents to prove:</term>
704 <para>It opens one new sequent for each case. The names of
705 the new hypotheses are picked by <command>hyps</command>, if
706 provided. If hyps specifies also a number of hypotheses that
707 is less than the number of new hypotheses for a new sequent,
708 then the exceeding hypothesis will be kept as implications in
709 the conclusion of the sequent.</para>
715 <sect1 id="tac_elimType">
716 <title>elimType</title>
717 <titleabbrev>elimType</titleabbrev>
718 <para><userinput>elimType T using th hyps</userinput></para>
721 <varlistentry role="tactic.synopsis">
722 <term>Synopsis:</term>
724 <para><emphasis role="bold">elimType</emphasis> &sterm; [<emphasis role="bold">using</emphasis> &sterm;] &intros-spec;</para>
728 <term>Pre-conditions:</term>
730 <para><command>T</command> must be an inductive type.</para>
736 <para>TODO (severely bugged now).</para>
740 <term>New sequents to prove:</term>
748 <sect1 id="tac_exact">
750 <titleabbrev>exact</titleabbrev>
751 <para><userinput>exact p</userinput></para>
754 <varlistentry role="tactic.synopsis">
755 <term>Synopsis:</term>
757 <para><emphasis role="bold">exact</emphasis> &sterm;</para>
761 <term>Pre-conditions:</term>
763 <para>The type of <command>p</command> must be convertible
764 with the conclusion of the current sequent.</para>
770 <para>It closes the current sequent using <command>p</command>.</para>
774 <term>New sequents to prove:</term>
782 <sect1 id="tac_exists">
783 <title>exists</title>
784 <titleabbrev>exists</titleabbrev>
785 <para><userinput>exists </userinput></para>
788 <varlistentry role="tactic.synopsis">
789 <term>Synopsis:</term>
791 <para><emphasis role="bold">exists</emphasis></para>
795 <term>Pre-conditions:</term>
797 <para>The conclusion of the current sequent must be
798 an inductive type or the application of an inductive type
799 with at least one constructor.</para>
805 <para>Equivalent to <command>constructor 1</command>.</para>
809 <term>New sequents to prove:</term>
811 <para>It opens a new sequent for each premise of the first
812 constructor of the inductive type that is the conclusion of the
813 current sequent. For more details, see the <command>constructor</command> tactic.</para>
819 <sect1 id="tac_fail">
821 <titleabbrev>fail</titleabbrev>
822 <para><userinput>fail</userinput></para>
825 <varlistentry role="tactic.synopsis">
826 <term>Synopsis:</term>
828 <para><emphasis role="bold">fail</emphasis></para>
832 <term>Pre-conditions:</term>
840 <para>This tactic always fail.</para>
844 <term>New sequents to prove:</term>
852 <sect1 id="tac_fold">
854 <titleabbrev>fold</titleabbrev>
855 <para><userinput>fold red t patt</userinput></para>
858 <varlistentry role="tactic.synopsis">
859 <term>Synopsis:</term>
861 <para><emphasis role="bold">fold</emphasis> &reduction-kind; &sterm; &pattern;</para>
865 <term>Pre-conditions:</term>
867 <para>The pattern must not specify the wanted term.</para>
873 <para>First of all it locates all the subterms matched by
874 <command>patt</command>. In the context of each matched subterm
875 it disambiguates the term <command>t</command> and reduces it
876 to its <command>red</command> normal form; then it replaces with
877 <command>t</command> every occurrence of the normal form in the
878 matched subterm.</para>
882 <term>New sequents to prove:</term>
890 <sect1 id="tac_fourier">
891 <title>fourier</title>
892 <titleabbrev>fourier</titleabbrev>
893 <para><userinput>fourier </userinput></para>
896 <varlistentry role="tactic.synopsis">
897 <term>Synopsis:</term>
899 <para><emphasis role="bold">fourier</emphasis></para>
903 <term>Pre-conditions:</term>
905 <para>The conclusion of the current sequent must be a linear
906 inequation over real numbers taken from standard library of
907 Coq. Moreover the inequations in the hypotheses must imply the
908 inequation in the conclusion of the current sequent.</para>
914 <para>It closes the current sequent by applying the Fourier method.</para>
918 <term>New sequents to prove:</term>
928 <titleabbrev>fwd</titleabbrev>
929 <para><userinput>fwd H as H<subscript>0</subscript> ... H<subscript>n</subscript></userinput></para>
932 <varlistentry role="tactic.synopsis">
933 <term>Synopsis:</term>
935 <para><emphasis role="bold">fwd</emphasis> &id; [<emphasis role="bold">as</emphasis> &id; [&id;]…]</para>
939 <term>Pre-conditions:</term>
942 The type of <command>H</command> must be the premise of a
943 forward simplification theorem.
951 This tactic is under development.
952 It simplifies the current context by removing
953 <command>H</command> using the following methods:
954 forward application (by <command>lapply</command>) of a suitable
955 simplification theorem, chosen automatically, of which the type
956 of <command>H</command> is a premise,
957 decomposition (by <command>decompose</command>),
958 rewriting (by <command>rewrite</command>).
959 <command>H<subscript>0</subscript> ... H<subscript>n</subscript></command>
960 are passed to the tactics <command>fwd</command> invokes, as
961 names for the premise they introduce.
966 <term>New sequents to prove:</term>
969 The ones opened by the tactics <command>fwd</command> invokes.
976 <sect1 id="tac_generalize">
977 <title>generalize</title>
978 <titleabbrev>generalize</titleabbrev>
979 <para><userinput>generalize patt as H</userinput></para>
982 <varlistentry role="tactic.synopsis">
983 <term>Synopsis:</term>
985 <para><emphasis role="bold">generalize</emphasis> &pattern; [<emphasis role="bold">as</emphasis> &id;]</para>
989 <term>Pre-conditions:</term>
991 <para>All the terms matched by <command>patt</command> must be
992 convertible and close in the context of the current sequent.</para>
998 <para>It closes the current sequent by applying a stronger
999 lemma that is proved using the new generated sequent.</para>
1003 <term>New sequents to prove:</term>
1005 <para>It opens a new sequent where the current sequent conclusion
1006 <command>G</command> is generalized to
1007 <command>∀x.G{x/t}</command> where <command>{x/t}</command>
1008 is a notation for the replacement with <command>x</command> of all
1009 the occurrences of the term <command>t</command> matched by
1010 <command>patt</command>. If <command>patt</command> matches no
1011 subterm then <command>t</command> is defined as the
1012 <command>wanted</command> part of the pattern.</para>
1020 <titleabbrev>id</titleabbrev>
1021 <para><userinput>id </userinput></para>
1024 <varlistentry role="tactic.synopsis">
1025 <term>Synopsis:</term>
1027 <para><emphasis role="bold">id</emphasis></para>
1031 <term>Pre-conditions:</term>
1037 <term>Action:</term>
1039 <para>This identity tactic does nothing without failing.</para>
1043 <term>New sequents to prove:</term>
1051 <sect1 id="tac_intro">
1052 <title>intro</title>
1053 <titleabbrev>intro</titleabbrev>
1054 <para><userinput>intro H</userinput></para>
1057 <varlistentry role="tactic.synopsis">
1058 <term>Synopsis:</term>
1060 <para><emphasis role="bold">intro</emphasis> [&id;]</para>
1064 <term>Pre-conditions:</term>
1066 <para>The conclusion of the sequent to prove must be an implication
1067 or a universal quantification.</para>
1071 <term>Action:</term>
1073 <para>It applies the right introduction rule for implication,
1074 closing the current sequent.</para>
1078 <term>New sequents to prove:</term>
1080 <para>It opens a new sequent to prove adding to the hypothesis
1081 the antecedent of the implication and setting the conclusion
1082 to the consequent of the implicaiton. The name of the new
1083 hypothesis is <command>H</command> if provided; otherwise it
1084 is automatically generated.</para>
1090 <sect1 id="tac_intros">
1091 <title>intros</title>
1092 <titleabbrev>intros</titleabbrev>
1093 <para><userinput>intros hyps</userinput></para>
1096 <varlistentry role="tactic.synopsis">
1097 <term>Synopsis:</term>
1099 <para><emphasis role="bold">intros</emphasis> &intros-spec;</para>
1103 <term>Pre-conditions:</term>
1105 <para>If <command>hyps</command> specifies a number of hypotheses
1106 to introduce, then the conclusion of the current sequent must
1107 be formed by at least that number of imbricated implications
1108 or universal quantifications.</para>
1112 <term>Action:</term>
1114 <para>It applies several times the right introduction rule for
1115 implication, closing the current sequent.</para>
1119 <term>New sequents to prove:</term>
1121 <para>It opens a new sequent to prove adding a number of new
1122 hypotheses equal to the number of new hypotheses requested.
1123 If the user does not request a precise number of new hypotheses,
1124 it adds as many hypotheses as possible.
1125 The name of each new hypothesis is either popped from the
1126 user provided list of names, or it is automatically generated when
1127 the list is (or becomes) empty.</para>
1133 <sect1 id="tac_inversion">
1134 <title>inversion</title>
1135 <titleabbrev>inversion</titleabbrev>
1136 <para><userinput>inversion t</userinput></para>
1139 <varlistentry role="tactic.synopsis">
1140 <term>Synopsis:</term>
1142 <para><emphasis role="bold">inversion</emphasis> &sterm;</para>
1146 <term>Pre-conditions:</term>
1148 <para>The type of the term <command>t</command> must be an inductive
1149 type or the application of an inductive type.</para>
1153 <term>Action:</term>
1155 <para>It proceeds by cases on <command>t</command> paying attention
1156 to the constraints imposed by the actual "right arguments"
1157 of the inductive type.</para>
1161 <term>New sequents to prove:</term>
1163 <para>It opens one new sequent to prove for each case in the
1164 definition of the type of <command>t</command>. With respect to
1165 a simple elimination, each new sequent has additional hypotheses
1166 that states the equalities of the "right parameters"
1167 of the inductive type with terms originally present in the
1168 sequent to prove.</para>
1174 <sect1 id="tac_lapply">
1175 <title>lapply</title>
1176 <titleabbrev>lapply</titleabbrev>
1178 lapply linear depth=d t
1179 to t<subscript>1</subscript>, ..., t<subscript>n</subscript> as H
1183 <varlistentry role="tactic.synopsis">
1184 <term>Synopsis:</term>
1187 <emphasis role="bold">lapply</emphasis>
1188 [<emphasis role="bold">linear</emphasis>]
1189 [<emphasis role="bold">depth=</emphasis>&nat;]
1191 [<emphasis role="bold">to</emphasis>
1193 [<emphasis role="bold">,</emphasis>&sterm;…]
1195 [<emphasis role="bold">as</emphasis> &id;]
1200 <term>Pre-conditions:</term>
1203 <command>t</command> must have at least <command>d</command>
1204 independent premises and <command>n</command> must not be
1205 greater than <command>d</command>.
1210 <term>Action:</term>
1213 Invokes <command>letin H ≝ (t ? ... ?)</command>
1214 with enough <command>?</command>'s to reach the
1215 <command>d</command>-th independent premise of
1216 <command>t</command>
1217 (<command>d</command> is maximum if unspecified).
1218 Then istantiates (by <command>apply</command>) with
1219 t<subscript>1</subscript>, ..., t<subscript>n</subscript>
1220 the <command>?</command>'s corresponding to the first
1221 <command>n</command> independent premises of
1222 <command>t</command>.
1223 Usually the other <command>?</command>'s preceding the
1224 <command>n</command>-th independent premise of
1225 <command>t</command> are istantiated as a consequence.
1226 If the <command>linear</command> flag is specified and if
1227 <command>t, t<subscript>1</subscript>, ..., t<subscript>n</subscript></command>
1228 are (applications of) premises in the current context, they are
1229 <command>clear</command>ed.
1234 <term>New sequents to prove:</term>
1237 The ones opened by the tactics <command>lapply</command> invokes.
1244 <sect1 id="tac_left">
1246 <titleabbrev>left</titleabbrev>
1247 <para><userinput>left </userinput></para>
1250 <varlistentry role="tactic.synopsis">
1251 <term>Synopsis:</term>
1253 <para><emphasis role="bold">left</emphasis></para>
1257 <term>Pre-conditions:</term>
1259 <para>The conclusion of the current sequent must be
1260 an inductive type or the application of an inductive type
1261 with at least one constructor.</para>
1265 <term>Action:</term>
1267 <para>Equivalent to <command>constructor 1</command>.</para>
1271 <term>New sequents to prove:</term>
1273 <para>It opens a new sequent for each premise of the first
1274 constructor of the inductive type that is the conclusion of the
1275 current sequent. For more details, see the <command>constructor</command> tactic.</para>
1281 <sect1 id="tac_letin">
1282 <title>letin</title>
1283 <titleabbrev>letin</titleabbrev>
1284 <para><userinput>letin x ≝ t</userinput></para>
1287 <varlistentry role="tactic.synopsis">
1288 <term>Synopsis:</term>
1290 <para><emphasis role="bold">letin</emphasis> &id; <emphasis role="bold">≝</emphasis> &sterm;</para>
1294 <term>Pre-conditions:</term>
1300 <term>Action:</term>
1302 <para>It adds to the context of the current sequent to prove a new
1303 definition <command>x ≝ t</command>.</para>
1307 <term>New sequents to prove:</term>
1315 <sect1 id="tac_normalize">
1316 <title>normalize</title>
1317 <titleabbrev>normalize</titleabbrev>
1318 <para><userinput>normalize patt</userinput></para>
1321 <varlistentry role="tactic.synopsis">
1322 <term>Synopsis:</term>
1324 <para><emphasis role="bold">normalize</emphasis> &pattern;</para>
1328 <term>Pre-conditions:</term>
1334 <term>Action:</term>
1336 <para>It replaces all the terms matched by <command>patt</command>
1337 with their βδιζ-normal form.</para>
1341 <term>New sequents to prove:</term>
1349 <sect1 id="tac_reflexivity">
1350 <title>reflexivity</title>
1351 <titleabbrev>reflexivity</titleabbrev>
1352 <para><userinput>reflexivity </userinput></para>
1355 <varlistentry role="tactic.synopsis">
1356 <term>Synopsis:</term>
1358 <para><emphasis role="bold">reflexivity</emphasis></para>
1362 <term>Pre-conditions:</term>
1364 <para>The conclusion of the current sequent must be
1365 <command>t=t</command> for some term <command>t</command></para>
1369 <term>Action:</term>
1371 <para>It closes the current sequent by reflexivity
1376 <term>New sequents to prove:</term>
1384 <sect1 id="tac_replace">
1385 <title>replace</title>
1386 <titleabbrev>change</titleabbrev>
1387 <para><userinput>change patt with t</userinput></para>
1390 <varlistentry role="tactic.synopsis">
1391 <term>Synopsis:</term>
1393 <para><emphasis role="bold">replace</emphasis> &pattern; <emphasis role="bold">with</emphasis> &sterm;</para>
1397 <term>Pre-conditions:</term>
1403 <term>Action:</term>
1405 <para>It replaces the subterms of the current sequent matched by
1406 <command>patt</command> with the new term <command>t</command>.
1407 For each subterm matched by the pattern, <command>t</command> is
1408 disambiguated in the context of the subterm.</para>
1412 <term>New sequents to prove:</term>
1414 <para>For each matched term <command>t'</command> it opens
1415 a new sequent to prove whose conclusion is
1416 <command>t'=t</command>.</para>
1422 <sect1 id="tac_rewrite">
1423 <title>rewrite</title>
1424 <titleabbrev>rewrite</titleabbrev>
1425 <para><userinput>rewrite dir p patt</userinput></para>
1428 <varlistentry role="tactic.synopsis">
1429 <term>Synopsis:</term>
1431 <para><emphasis role="bold">rewrite</emphasis> [<emphasis role="bold"><</emphasis>|<emphasis role="bold">></emphasis>] &sterm; &pattern;</para>
1435 <term>Pre-conditions:</term>
1437 <para><command>p</command> must be the proof of an equality,
1438 possibly under some hypotheses.</para>
1442 <term>Action:</term>
1444 <para>It looks in every term matched by <command>patt</command>
1445 for all the occurrences of the
1446 left hand side of the equality that <command>p</command> proves
1447 (resp. the right hand side if <command>dir</command> is
1448 <command><</command>). Every occurence found is replaced with
1449 the opposite side of the equality.</para>
1453 <term>New sequents to prove:</term>
1455 <para>It opens one new sequent for each hypothesis of the
1456 equality proved by <command>p</command> that is not closed
1457 by unification.</para>
1463 <sect1 id="tac_right">
1464 <title>right</title>
1465 <titleabbrev>right</titleabbrev>
1466 <para><userinput>right </userinput></para>
1469 <varlistentry role="tactic.synopsis">
1470 <term>Synopsis:</term>
1472 <para><emphasis role="bold">right</emphasis></para>
1476 <term>Pre-conditions:</term>
1478 <para>The conclusion of the current sequent must be
1479 an inductive type or the application of an inductive type with
1480 at least two constructors.</para>
1484 <term>Action:</term>
1486 <para>Equivalent to <command>constructor 2</command>.</para>
1490 <term>New sequents to prove:</term>
1492 <para>It opens a new sequent for each premise of the second
1493 constructor of the inductive type that is the conclusion of the
1494 current sequent. For more details, see the <command>constructor</command> tactic.</para>
1500 <sect1 id="tac_ring">
1502 <titleabbrev>ring</titleabbrev>
1503 <para><userinput>ring </userinput></para>
1506 <varlistentry role="tactic.synopsis">
1507 <term>Synopsis:</term>
1509 <para><emphasis role="bold">ring</emphasis></para>
1513 <term>Pre-conditions:</term>
1515 <para>The conclusion of the current sequent must be an
1516 equality over Coq's real numbers that can be proved using
1517 the ring properties of the real numbers only.</para>
1521 <term>Action:</term>
1523 <para>It closes the current sequent veryfying the equality by
1524 means of computation (i.e. this is a reflexive tactic, implemented
1525 exploiting the "two level reasoning" technique).</para>
1529 <term>New sequents to prove:</term>
1537 <sect1 id="tac_simplify">
1538 <title>simplify</title>
1539 <titleabbrev>simplify</titleabbrev>
1540 <para><userinput>simplify patt</userinput></para>
1543 <varlistentry role="tactic.synopsis">
1544 <term>Synopsis:</term>
1546 <para><emphasis role="bold">simplify</emphasis> &pattern;</para>
1550 <term>Pre-conditions:</term>
1556 <term>Action:</term>
1558 <para>It replaces all the terms matched by <command>patt</command>
1559 with other convertible terms that are supposed to be simpler.</para>
1563 <term>New sequents to prove:</term>
1571 <sect1 id="tac_split">
1572 <title>split</title>
1573 <titleabbrev>split</titleabbrev>
1574 <para><userinput>split </userinput></para>
1577 <varlistentry role="tactic.synopsis">
1578 <term>Synopsis:</term>
1580 <para><emphasis role="bold">split</emphasis></para>
1584 <term>Pre-conditions:</term>
1586 <para>The conclusion of the current sequent must be
1587 an inductive type or the application of an inductive type with
1588 at least one constructor.</para>
1592 <term>Action:</term>
1594 <para>Equivalent to <command>constructor 1</command>.</para>
1598 <term>New sequents to prove:</term>
1600 <para>It opens a new sequent for each premise of the first
1601 constructor of the inductive type that is the conclusion of the
1602 current sequent. For more details, see the <command>constructor</command> tactic.</para>
1609 <sect1 id="tac_subst">
1610 <title>subst</title>
1611 <titleabbrev>subst</titleabbrev>
1612 <para><userinput>subst</userinput></para>
1615 <varlistentry role="tactic.synopsis">
1616 <term>Synopsis:</term>
1618 <para><emphasis role="bold">subst</emphasis></para>
1622 <term>Pre-conditions:</term>
1628 <term>Action:</term>
1630 For each premise of the form
1631 <command>H: x = t</command> or <command>H: t = x</command>
1632 where <command>x</command> is a local variable and
1633 <command>t</command> does not depend on <command>x</command>,
1634 the tactic rewrites <command>H</command> wherever
1635 <command>x</command> appears clearing <command>H</command> and
1636 <command>x</command> afterwards.
1640 <term>New sequents to prove:</term>
1642 The one opened by the applied tactics.
1648 <sect1 id="tac_symmetry">
1649 <title>symmetry</title>
1650 <titleabbrev>symmetry</titleabbrev>
1651 <para>The tactic <command>symmetry</command> </para>
1652 <para><userinput>symmetry </userinput></para>
1655 <varlistentry role="tactic.synopsis">
1656 <term>Synopsis:</term>
1658 <para><emphasis role="bold">symmetry</emphasis></para>
1662 <term>Pre-conditions:</term>
1664 <para>The conclusion of the current proof must be an equality.</para>
1668 <term>Action:</term>
1670 <para>It swaps the two sides of the equalityusing the symmetric
1675 <term>New sequents to prove:</term>
1683 <sect1 id="tac_transitivity">
1684 <title>transitivity</title>
1685 <titleabbrev>transitivity</titleabbrev>
1686 <para><userinput>transitivity t</userinput></para>
1689 <varlistentry role="tactic.synopsis">
1690 <term>Synopsis:</term>
1692 <para><emphasis role="bold">transitivity</emphasis> &sterm;</para>
1696 <term>Pre-conditions:</term>
1698 <para>The conclusion of the current proof must be an equality.</para>
1702 <term>Action:</term>
1704 <para>It closes the current sequent by transitivity of the equality.</para>
1708 <term>New sequents to prove:</term>
1710 <para>It opens two new sequents <command>l=t</command> and
1711 <command>t=r</command> where <command>l</command> and <command>r</command> are the left and right hand side of the equality in the conclusion of
1712 the current sequent to prove.</para>
1718 <sect1 id="tac_unfold">
1719 <title>unfold</title>
1720 <titleabbrev>unfold</titleabbrev>
1721 <para><userinput>unfold t patt</userinput></para>
1724 <varlistentry role="tactic.synopsis">
1725 <term>Synopsis:</term>
1727 <para><emphasis role="bold">unfold</emphasis> [&sterm;] &pattern;</para>
1731 <term>Pre-conditions:</term>
1737 <term>Action:</term>
1739 <para>It finds all the occurrences of <command>t</command>
1740 (possibly applied to arguments) in the subterms matched by
1741 <command>patt</command>. Then it δ-expands each occurrence,
1742 also performing β-reduction of the obtained term. If
1743 <command>t</command> is omitted it defaults to each
1744 subterm matched by <command>patt</command>.</para>
1748 <term>New sequents to prove:</term>
1756 <sect1 id="tac_whd">
1758 <titleabbrev>whd</titleabbrev>
1759 <para><userinput>whd patt</userinput></para>
1762 <varlistentry role="tactic.synopsis">
1763 <term>Synopsis:</term>
1765 <para><emphasis role="bold">whd</emphasis> &pattern;</para>
1769 <term>Pre-conditions:</term>
1775 <term>Action:</term>
1777 <para>It replaces all the terms matched by <command>patt</command>
1778 with their βδιζ-weak-head normal form.</para>
1782 <term>New sequents to prove:</term>