1****************************************
2DEPRECATED: Tactics and Theorem Proving
3****************************************
6 The interactive theorem-proving interface documented here has been
7 deprecated in favor of :ref:`elaborator-reflection`.
9Idris supports interactive theorem proving, and the analyse of context
10through holes. To list all unproven holes, use the command ``:m``.
11This will display their qualified names and the expected types. To
12interactively prove a holes, use the command ``:p name`` where ``name``
13is the hole. Once the proof is complete, the command ``:a`` will append
14it to the current module.
16Once in the interactive prover, the following commands are available:
21- ``:q`` - Quits the prover (gives up on proving current lemma).
22- ``:abandon`` - Same as :q
23- ``:state`` - Displays the current state of the proof.
24- ``:term`` - Displays the current proof term complete with its
25 yet-to-be-filled holes (is only really useful for debugging).
26- ``:undo`` - Undoes the last tactic.
27- ``:qed`` - Once the interactive theorem prover tells you "No more
28 goals," you get to type this in celebration! (Completes the proof and
37- ``compute`` - Normalises all terms in the goal (note: does not
38 normalise assumptions)
42 ---------- Goal: ----------
43 (Vect (S (S Z + (S Z) + (S n))) Nat) -> Vect (S (S (S (S n)))) Nat
45 ---------- Goal: ----------
46 (Vect (S (S (S (S n)))) Nat) -> Vect (S (S (S (S n)))) Nat
52- ``exact`` - Provide a term of the goal type directly.
56 ---------- Goal: ----------
65- ``refine`` - Use a name to refine the goal. If the name needs
66 arguments, introduce them as new goals.
71- ``trivial`` - Satisfies the goal using an assumption that matches its
76 ---------- Assumptions: ----------
78 ---------- Goal: ----------
87- ``intro`` - If your goal is an arrow, turns the left term into an
92 ---------- Goal: ----------
95 ---------- Assumptions: ----------
97 ---------- Goal: ----------
101You can also supply your own name for the assumption:
105 ---------- Goal: ----------
108 ---------- Assumptions: ----------
110 ---------- Goal: ----------
117- ``intros`` - Exactly like intro, but it operates on all left terms at
122 ---------- Goal: ----------
125 ---------- Assumptions: ----------
128 ---------- Goal: ----------
135- ``let`` - Introduces a new assumption; you may use current
136 assumptions to define the new one.
140 ---------- Assumptions: ----------
142 ---------- Goal: ----------
144 -lemma> let x = toIntegerNat n
145 ---------- Assumptions: ----------
147 x = toIntegerNat n: BigInt
148 ---------- Goal: ----------
155- ``rewrite`` - Takes an expression with an equality type (x = y), and
156 replaces all instances of x in the goal with y. Is often useful in
157 combination with 'sym'.
161 ---------- Assumptions: ----------
165 ---------- Goal: ----------
167 -lemma> rewrite sym (multZeroRightZero n)
168 ---------- Assumptions: ----------
172 ---------- Goal: ----------
179- ``induction`` - (``Note that this is still experimental`` and you may
180 get strange results and error messages. We are aware of these and
181 will finish the implementation eventually!) Prove the goal by
182 induction. Each constructor of the datatype becomes a goal.
183 Constructors with recursive arguments become induction steps, while
184 simple constructors become base cases. Note that this only works for
185 datatypes that have eliminators: a datatype definition must have the
192- ``sourceLocation`` - Solve the current goal with information about
193 the location in the source code where the tactic was invoked. This is
194 mostly for embedded DSLs and programmer tools like assertions that
195 need to know where they are called. See
196 ``Language.Reflection.SourceLocation`` for more information.
198Less commonly-used tactics
199==========================
201- ``applyTactic`` - Apply a user-defined tactic. This should be a
202 function of type ``List (TTName, Binder TT) -> TT -> Tactic``, where
203 the first argument represents the proof context and the second
204 represents the goal. If your tactic will produce a proof term
205 directly, use the ``Exact`` constructor from ``Tactic``.
207- ``equiv`` - Replaces the goal with a new one that is convertible with
211- ``mrefine`` - Refining by matching against a type
213- ``solve`` - Takes a guess with the correct type and fills a hole with
214 it, closing a proof obligation. This happens automatically in the
215 interactive prover, so ``solve`` is really only relevant in tactic
216 scripts used for helping implicit argument resolution.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list