feat(frontends/lean): allow 'match-with' to be used in tactics without prefixing it with 'exact'

This commit is contained in:
Leonardo de Moura 2015-03-06 15:48:48 -08:00
parent 4edd7b9099
commit bd8c4315f1
4 changed files with 25 additions and 1 deletions

View file

@ -213,7 +213,7 @@ static expr parse_begin_end_core(parser & p, pos_info const & pos, name const &
} else {
throw parser_error("invalid 'have' tactic, 'by', 'begin', 'proof', or 'from' expected", p.pos());
}
} else if (p.curr_is_token(get_show_tk()) ||
} else if (p.curr_is_token(get_show_tk()) || p.curr_is_token(get_match_tk()) ||
p.curr_is_token(get_assume_tk()) || p.curr_is_token(get_take_tk()) ||
p.curr_is_token(get_fun_tk())) {
auto pos = p.pos();

View file

@ -53,6 +53,7 @@ static name * g_assert = nullptr;
static name * g_assume = nullptr;
static name * g_take = nullptr;
static name * g_fun = nullptr;
static name * g_match = nullptr;
static name * g_ellipsis = nullptr;
static name * g_raw = nullptr;
static name * g_true = nullptr;
@ -176,6 +177,7 @@ void initialize_tokens() {
g_assume = new name("assume");
g_take = new name("take");
g_fun = new name("fun");
g_match = new name("match");
g_ellipsis = new name("...");
g_raw = new name("raw");
g_true = new name("true");
@ -329,6 +331,7 @@ void finalize_tokens() {
delete g_wf;
delete g_all_transparent;
delete g_ellipsis;
delete g_match;
delete g_fun;
delete g_take;
delete g_assume;
@ -424,6 +427,7 @@ name const & get_assert_tk() { return *g_assert; }
name const & get_assume_tk() { return *g_assume; }
name const & get_take_tk() { return *g_take; }
name const & get_fun_tk() { return *g_fun; }
name const & get_match_tk() { return *g_match; }
name const & get_ellipsis_tk() { return *g_ellipsis; }
name const & get_raw_tk() { return *g_raw; }
name const & get_true_tk() { return *g_true; }

View file

@ -55,6 +55,7 @@ name const & get_assert_tk();
name const & get_assume_tk();
name const & get_take_tk();
name const & get_fun_tk();
name const & get_match_tk();
name const & get_ellipsis_tk();
name const & get_raw_tk();
name const & get_true_tk();

View file

@ -0,0 +1,19 @@
import data.nat
example (a b c : Prop) : a ∧ b ↔ b ∧ a :=
begin
apply iff.intro,
{intro H,
match H with
| and.intro H₁ H₂ := and.intro H₂ H₁
end},
{intro H,
match H with
| and.intro H₁ H₂ := and.intro H₂ H₁
end},
end
open nat
example : ∀ (a b : nat), a = b → b = a
| a a rfl := rfl