2014-08-01 00:48:51 +00:00
|
|
|
----------------------------------------------------------------------------------------------------
|
2014-07-02 14:08:20 +00:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Leonardo de Moura
|
2014-08-01 00:48:51 +00:00
|
|
|
----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
import data.string data.num
|
2014-07-02 17:52:45 +00:00
|
|
|
using string
|
2014-07-03 15:06:28 +00:00
|
|
|
using num
|
2014-07-02 02:05:22 +00:00
|
|
|
|
2014-07-02 17:35:43 +00:00
|
|
|
namespace tactic
|
2014-07-02 02:05:22 +00:00
|
|
|
-- This is just a trick to embed the 'tactic language' as a
|
2014-07-02 14:08:20 +00:00
|
|
|
-- Lean expression. We should view 'tactic' as automation
|
|
|
|
-- that when execute produces a term.
|
2014-07-03 15:06:28 +00:00
|
|
|
-- builtin_tactic is just a "dummy" for creating the
|
|
|
|
-- definitions that are actually implemented in C++
|
2014-07-02 14:08:20 +00:00
|
|
|
inductive tactic : Type :=
|
2014-07-03 15:06:28 +00:00
|
|
|
| builtin_tactic : tactic
|
2014-07-02 02:05:22 +00:00
|
|
|
-- 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
|
2014-07-02 14:08:20 +00:00
|
|
|
-- a term of type 'tactic' into a tactic that sythesizes a term
|
2014-07-03 19:59:48 +00:00
|
|
|
definition and_then (t1 t2 : tactic) : tactic := builtin_tactic
|
|
|
|
definition or_else (t1 t2 : tactic) : tactic := builtin_tactic
|
|
|
|
definition append (t1 t2 : tactic) : tactic := builtin_tactic
|
|
|
|
definition interleave (t1 t2 : tactic) : tactic := builtin_tactic
|
|
|
|
definition par (t1 t2 : tactic) : tactic := builtin_tactic
|
2014-07-04 08:30:28 +00:00
|
|
|
definition fixpoint (f : tactic → tactic) : tactic := builtin_tactic
|
2014-07-03 19:59:48 +00:00
|
|
|
definition repeat (t : tactic) : tactic := builtin_tactic
|
|
|
|
definition at_most (t : tactic) (k : num) : tactic := builtin_tactic
|
|
|
|
definition discard (t : tactic) (k : num) : tactic := builtin_tactic
|
|
|
|
definition focus_at (t : tactic) (i : num) : tactic := builtin_tactic
|
|
|
|
definition try_for (t : tactic) (ms : num) : tactic := builtin_tactic
|
|
|
|
definition now : tactic := builtin_tactic
|
|
|
|
definition assumption : tactic := builtin_tactic
|
|
|
|
definition eassumption : tactic := builtin_tactic
|
|
|
|
definition state : tactic := builtin_tactic
|
|
|
|
definition fail : tactic := builtin_tactic
|
|
|
|
definition id : tactic := builtin_tactic
|
|
|
|
definition beta : tactic := builtin_tactic
|
|
|
|
definition apply {B : Type} (b : B) : tactic := builtin_tactic
|
|
|
|
definition unfold {B : Type} (b : B) : tactic := builtin_tactic
|
|
|
|
definition exact {B : Type} (b : B) : tactic := builtin_tactic
|
|
|
|
definition trace (s : string) : tactic := builtin_tactic
|
2014-07-04 17:10:05 +00:00
|
|
|
precedence `;`:200
|
|
|
|
infixl ; := and_then
|
2014-07-03 15:06:28 +00:00
|
|
|
notation `!` t:max := repeat t
|
2014-07-04 17:10:05 +00:00
|
|
|
-- [ t_1 | ... | t_n ] notation
|
|
|
|
notation `[` h:100 `|` r:(foldl 100 `|` (e r, or_else r e) h) `]` := r
|
2014-07-08 21:28:33 +00:00
|
|
|
-- [ t_1 || ... || t_n ] notation
|
|
|
|
notation `[` h:100 `||` r:(foldl 100 `||` (e r, par r e) h) `]` := r
|
2014-07-04 17:10:05 +00:00
|
|
|
definition try (t : tactic) : tactic := [ t | id ]
|
2014-07-03 15:06:28 +00:00
|
|
|
notation `?` t:max := try t
|
2014-07-03 19:59:48 +00:00
|
|
|
definition repeat1 (t : tactic) : tactic := t ; !t
|
|
|
|
definition focus (t : tactic) : tactic := focus_at t 0
|
|
|
|
definition determ (t : tactic) : tactic := at_most t 1
|
2014-07-02 17:35:43 +00:00
|
|
|
end
|