lean2/library/standard/tactic.lean
Leonardo de Moura cbac21ec7f feat(library/tactic): add trick for 'embedding' tactics inside Lean expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 19:05:22 -07:00

29 lines
1.3 KiB
Text

import logic
namespace tactic
-- This is just a trick to embed the 'tactic language' as a
-- Lean expression. We should view (tactic A) as automation
-- that when execute produces a term of type A.
-- tactic_value is just a "dummy" for creating the "fake"
inductive tactic (A : Type) : Type :=
| tactic_value {} : tactic A
-- Remark the following names are not arbitrary, the tactic module
-- uses them when converting Lean expressions into actual tactic objects.
-- The bultin 'by' construct triggers the process of converting a
-- a term of type (tactic A) into a tactic that sythesizes a term
-- of type A
definition then_tac {A : Type} (t1 t2 : tactic A) : tactic A := tactic_value
definition orelse_tac {A : Type} (t1 t2 : tactic A) : tactic A := tactic_value
definition repeat_tac {A : Type} (t : tactic A) : tactic A := tactic_value
definition now {A : Type} : tactic A := tactic_value
definition state {A : Type} : tactic A := tactic_value
definition fail {A : Type} : tactic A := tactic_value
definition id {A : Type} : tactic A := tactic_value
definition beta {A : Type} : tactic A := tactic_value
definition apply {A : Type} {B : Type} (b : B) : tactic A := tactic_value
infixl `;`:200 := then_tac
infixl `|`:100 := orelse_tac
notation `!`:max t:max := repeat_tac t
end