lean4-htt/tests/lean/run/implDetailBinder.lean
Wojciech Nawrocki 1c60173b69
fix: mark __x patterns as impl details in match and intro (#9702)
This PR fixes an issue in the `match` elaborator where pattern variables
like `__x` would not have the kind `implDetail` in the local context.
Now `kindOfBinderName` is `LocalDeclKind.ofBinderName`.

Zulip discussion
[here](https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Bad.20interaction.20of.20Qq.20with.20grind).

---------

Co-authored-by: Kyle Miller <kmill31415@gmail.com>
2025-08-04 22:54:39 +00:00

62 lines
1.5 KiB
Text

/-!
# Tests of names prefixed with `__` in binders
Variable binding constructs and tactics
should introduce hypotheses whose names start with `__` as `implDetail`s.
-/
-- `__`-prefixed binders on top-level definitions are _not_ `implDetail`s.
-- (This may change in the future if a usecase appears.)
example {p : Prop} (__x : p) : p := by
assumption
-- `intro` does not mark `__`-prefixed binders as `implDetail`.
-- (This may change in the future if a usecase appears.)
example {p : Prop} : p → p := by
intro __x
assumption
-- Test `have`
example {p : Prop} : p → p := by
have __x : p → p := id
fail_if_success assumption
have := __x; assumption
-- Test `let`
example {p : Prop} : p → p := by
let __x : p → p := id
fail_if_success assumption
have := __x; assumption
-- Test `fun`
example {p : Prop} : p → p :=
fun (__x : p) => by
fail_if_success assumption
have := __x; assumption
-- Test a single-branch, single-discriminant `match`
example {p : Prop} : True := by
have (__x : p) : p :=
match __x with
| __y => by
fail_if_success assumption
have := __y; assumption
trivial
-- Test a multi-discriminant `match`
example {p : Prop} : True := by
have (__x : p) : p :=
match __x, __x with
| __y, __z => by
fail_if_success assumption
have := __y; assumption
trivial
-- Test a destructuring `match`
example {p q : Prop} : True := by
have (__x : p ∧ q) : p :=
match __x with
| ⟨__y, __z⟩ => by
fail_if_success assumption
have := __y; assumption
trivial