feat(library/blast/forward/pattern): consider patterns with nested lambdas in the pattern inference procedure
This commit is contained in:
parent
752f027705
commit
54c0921bbb
2 changed files with 38 additions and 1 deletions
|
@ -353,8 +353,13 @@ struct mk_hi_lemma_fn {
|
|||
lean_unreachable();
|
||||
case expr_kind::Sort: case expr_kind::Constant:
|
||||
case expr_kind::Meta: case expr_kind::Local:
|
||||
case expr_kind::Lambda: case expr_kind::Pi:
|
||||
case expr_kind::Pi:
|
||||
return candidate_set();
|
||||
case expr_kind::Lambda:
|
||||
if (has_idx_metavar(a))
|
||||
return candidate_set(candidate(a));
|
||||
else
|
||||
return candidate_set();
|
||||
case expr_kind::Macro:
|
||||
for (unsigned i = 0; i < macro_num_args(a); i++) {
|
||||
candidate_set s = collect_core(macro_arg(a, i));
|
||||
|
|
32
tests/lean/run/blast_ematch_sum.lean
Normal file
32
tests/lean/run/blast_ematch_sum.lean
Normal file
|
@ -0,0 +1,32 @@
|
|||
import data.nat
|
||||
open nat
|
||||
|
||||
definition Sum : nat → (nat → nat) → nat :=
|
||||
sorry
|
||||
|
||||
notation `Σ` binders ` < ` n `, ` r:(scoped f, Sum n f) := r
|
||||
|
||||
lemma Sum_const [forward] (n : nat) (c : nat) : (Σ x < n, c) = n * c :=
|
||||
sorry
|
||||
|
||||
lemma Sum_add [forward] (f g : nat → nat) (n : nat) : (Σ x < n, f x + g x) = (Σ x < n, f x) + (Σ x < n, g x) :=
|
||||
sorry
|
||||
|
||||
attribute add.assoc add.comm add.left_comm mul_zero zero_mul mul_one add_zero zero_add one_mul mul.comm mul.assoc mul.left_comm [forward]
|
||||
|
||||
set_option blast.strategy "ematch"
|
||||
|
||||
example (f : nat → nat) (n : nat) : (Σ x < n, f x + 1) = (Σ x < n, f x) + n :=
|
||||
by blast
|
||||
|
||||
example (f g h : nat → nat) (n : nat) : (Σ x < n, f x + g x + h x) = (Σ x < n, h x) + (Σ x < n, f x) + (Σ x < n, g x) :=
|
||||
by blast
|
||||
|
||||
example (f g h : nat → nat) (n : nat) : (Σ x < n, f x + g x + h x) = Sum n h + (Σ x < n, f x) + (Σ x < n, g x) :=
|
||||
by blast
|
||||
|
||||
example (f g h : nat → nat) (n : nat) : (Σ x < n, f x + g x + 0) = (Σ x < n, f x) + (Σ x < n, g x) :=
|
||||
by blast
|
||||
|
||||
example (f g h : nat → nat) (n : nat) : (Σ x < n, f x + g x + h x + 2) = 0 + Sum n h + (Σ x < n, f x) + (Σ x < n, g x) + 2 * n :=
|
||||
by blast
|
Loading…
Reference in a new issue