feat(library/blast/forward/pattern): add minimal pattern validation

This commit is contained in:
Leonardo de Moura 2015-12-02 17:44:21 -07:00
parent 2090e9124c
commit ec7c38d847
3 changed files with 11 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Author: Leonardo de Moura
#include "kernel/abstract.h"
#include "kernel/instantiate.h"
#include "library/kernel_serializer.h"
#include "library/generic_exception.h"
#include "library/tmp_type_context.h"
#include "library/annotation.h"
#include "library/occurs.h"
@ -137,6 +138,8 @@ bool has_pattern_hints(expr const & e) {
expr mk_pattern_hint(expr const & e) {
if (has_pattern_hints(e))
throw exception("invalid pattern hint, nested patterns hints are not allowed");
if (!is_app(e))
throw_generic_exception("invalid pattern hint, pattern must be applications", e);
return mk_annotation(*g_pattern_hint, e);
}

View file

@ -0,0 +1,7 @@
constant P : nat → Prop
lemma tst₁ [forward] : ∀ x, (: P x :) := -- Fine
sorry
lemma tst₂ [forward] : ∀ x, P (: x :) := -- Error
sorry

View file

@ -0,0 +1 @@
bad_pattern.lean:6:33: error: invalid pattern hint, pattern must be applications