If I understand it correctly (mainly from existence of the applyTactic
function), it is possible to write custom tactics for the theorem prover in Idris. What (or where) are some examples I could use for learning how to do that?
There are two mechanisms for writing custom tactics in Idris: high-level and low-level reflection.
Using high-level reflection, you write a function that runs on syntax rather than on evaluated data - it won't reduce its argument. These functions return a new tactic, defined using the pre-existing tactics in Idris. If you want to return a proof term directly, you can always just use Exact
. An example of this kind of reflection can be found in the effects library. High-level reflection tactics are invoked using byReflection
in proof mode.
In low-level reflection, you work directly with quoted terms from Idris's core type theory. A tactic is then a function in TT -> List (TTName, TT) -> Tactic
where the first argument is the goal type, the second is the local proof context, and the return result is the same as in high-level reflection. This is what laughadelic linked to above. These are invoked using applyTactic
in proof mode.