feat(library/blast/forward/pattern): improve pattern inference heuristic
This commit is contained in:
parent
c07345d47f
commit
10273bf176
2 changed files with 24 additions and 2 deletions
|
@ -40,7 +40,7 @@ patterns used by heuristic instantiation.
|
|||
a_i is NOT trackable.
|
||||
Reason: we can infer a_i from a_j using type inference.
|
||||
|
||||
b) a_i is a proposition -> a_i is NOT trackable.
|
||||
b) a_i is a non dependent proposition -> a_i is NOT trackable.
|
||||
Reason: we can leave a_i as hypothesis whenever we instantiate H.
|
||||
|
||||
c) a_i is instance implicit -> a_i is NOT trackable.
|
||||
|
@ -214,9 +214,10 @@ expr extract_trackable(tmp_type_context & ctx, expr const & type,
|
|||
bool is_inst_implicit = binding_info(it).is_inst_implicit();
|
||||
inst_implicit_flags.push_back(is_inst_implicit);
|
||||
bool is_prop = ctx.is_prop(binding_domain(it));
|
||||
bool dep = !closed(binding_body(it));
|
||||
if (!is_inst_implicit) {
|
||||
unsigned midx = to_meta_idx(new_mvar);
|
||||
if (is_prop)
|
||||
if (is_prop && !dep)
|
||||
residue.insert(midx);
|
||||
else
|
||||
trackable.insert(midx);
|
||||
|
|
21
tests/lean/run/blast_flat.lean
Normal file
21
tests/lean/run/blast_flat.lean
Normal file
|
@ -0,0 +1,21 @@
|
|||
open nat subtype
|
||||
|
||||
definition f (x : nat) (y : {n : nat | n > x}) : nat :=
|
||||
x + elt_of y
|
||||
|
||||
definition f_flat (x : nat) (y : nat) (H : y > x) : nat :=
|
||||
f x (tag y H)
|
||||
|
||||
lemma f_flat_simp [forward] (x : nat) (y : nat) (H : y > x) : f x (tag y H) = f_flat x y H :=
|
||||
rfl
|
||||
|
||||
set_option trace.simplifier true
|
||||
set_option trace.blast true
|
||||
set_option blast.strategy "ematch"
|
||||
|
||||
example (a b c d : nat) (Ha : c > a) (Hb : d > b) : a = b → c = d → f a (tag c Ha) = f b (tag d Hb) :=
|
||||
by blast
|
||||
|
||||
example (h : nat → nat) (a b c d : nat) (Ha : h c > h a) (Hb : h d > h b)
|
||||
: h a = h b → c = d → f (h a) (tag (h c) Ha) = f (h b) (tag (h d) Hb) :=
|
||||
by blast
|
Loading…
Reference in a new issue