fix(init/meta/expr.lean): is_app_of can return true for constants as well
This commit is contained in:
parent
079a442404
commit
f952dbc78e
4 changed files with 8 additions and 2 deletions
|
|
@ -51,7 +51,7 @@ do t ← target,
|
|||
exact pr)
|
||||
<|>
|
||||
(do type ← whnf type,
|
||||
guard (is_app_of type `fin),
|
||||
guard (is_napp_of type `fin 1),
|
||||
(a, b) ← returnopt (is_ne t),
|
||||
pr ← returnopt (mk_fin_val_ne_proof a b),
|
||||
exact pr)
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ meta def is_constant_of : expr → name → bool
|
|||
| e n := ff
|
||||
|
||||
meta def is_app_of (e : expr) (n : name) : bool :=
|
||||
is_app e && is_constant_of (get_app_fn e) n
|
||||
is_constant_of (get_app_fn e) n
|
||||
|
||||
meta def is_napp_of (e : expr) (c : name) (n : nat) : bool :=
|
||||
to_bool (is_app_of e c ∧ get_app_num_args e = n)
|
||||
|
|
|
|||
2
tests/lean/dunfold_constant.lean
Normal file
2
tests/lean/dunfold_constant.lean
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def foo : list ℕ := [2]
|
||||
lemma bar : foo = foo := by dunfold foo
|
||||
4
tests/lean/dunfold_constant.lean.expected.out
Normal file
4
tests/lean/dunfold_constant.lean.expected.out
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
dunfold_constant.lean:2:28: error: tactic failed, there are unsolved goals
|
||||
state:
|
||||
⊢ [2] = [2]
|
||||
dunfold_constant.lean:2:0: error: unknown declaration 'sorry'
|
||||
Loading…
Add table
Reference in a new issue