`exact?` suggests term that does not work
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
In this code:
inductive Odd : Nat → Prop
| one : Odd 1
| add_two : Odd n → Odd (n + 2)
theorem odd_iff {n : Nat} : Odd n ↔ n % 2 = 1 := by
refine ⟨fun h => by induction h <;> omega, ?_⟩
match n with
| 0 => simp
| 1 => exact fun _ => Odd.one
| n + 2 => exact fun _ => Odd.add_two (odd_iff.mpr (by omega))
example {n : Nat} : n % 2 = 1 → Odd n := by exact?
the suggestion we get from exact? is Try this: exact fun a => (fun {n} => odd_iff.mpr) a, but this does not work. Accepting the suggestion leads to the two errors
failed to infer binder type
and
don't know how to synthesize implicit argument 'n'
(@fun {n_1} => odd_iff.mpr) (?m.2120 a) a
context:
n : Nat
a : n % 2 = 1
⊢ ?m.2119 a
Expected behavior: exact? suggests some invocation of odd_iff that works
Actual behavior: Suggestion leads to error above
Versions
4.12.0-nightly-2024-09-19 on live.lean-lang.org
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the self-contained Odd/odd_iff reproducer and the exact? invocation described in the issue; reproduce it on the Lean nightly release using live.lean-lang.org. Trace the suggestion generation path for this case, then verify that the suggested invocation compiles and matches the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100