fun_induction: could not find suitable call of 'foo' in the goal
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
The fun_induction ident and fun_cases ident shorthands try to find a suitable call in the goal to instantiate the induction principle. @kim-em pointed out that when that fails, there is very little information; the error message should probably list all calls that were looked at, and explain why they were not considered.
In fact, in the following example it should maybe succeed:
- in the first two, it should accept non-trivial expressions when they are Props
- the last one I still need to debug;
fooandbarhave the same type and the same functional cases principle.
def foo (n : Nat) (h : n > 42) := if n = 100 then foo 99 (by omega) else n + 1
example : foo n h > 20 := by fun_cases foo <;> sorry
example : foo n h > 20 := by fun_induction foo <;> sorry
/-- error: could not find suitable call of 'foo' in the goal -/
#guard_msgs in
example (h : n > 50) : foo n (by omega) > 20 := by fun_cases foo
/-- error: could not find suitable call of 'foo' in the goal -/
#guard_msgs in
example (h : n > 50) : foo n (by omega) > 20 := by fun_induction foo
def bar (n : Nat) (h : n > 42) := if n = 100 then n else n + 1
/-- error: could not find suitable call of 'bar' in the goal -/
#guard_msgs in
example : bar n h > 20 := by fun_cases bar <;> sorry
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 by tracing the fun_induction and fun_cases shorthand logic that searches the goal for a suitable call. Reproduce the included foo and bar cases with #guard_msgs, then make the diagnostics explain which calls were considered and why they were rejected, while checking whether the non-trivial Props cases and the final bar case can succeed.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100