feat: make try? find induction proofs for forall-quantified goals#12316
Draft
feat: make try? find induction proofs for forall-quantified goals#12316
try? find induction proofs for forall-quantified goals#12316Conversation
This test demonstrates the current behavior where `try?` fails to find induction-based proofs for goals with leading foralls. The tests show: - Baseline: `(n : Nat) : n ≤ fib n + 1` works (try? finds fun_induction) - Bug: `∀ n, n ≤ fib n + 1` fails (try? doesn't collect candidates under forall) After the fix, these tests should pass with try? finding suggestions like `intro n; fun_induction fib <;> grind`. Also adds guidance to .claude/CLAUDE.md about writing tests that demonstrate bugs rather than working around them. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ec0ca3c to
8bfbee0
Compare
This PR enables `try?` to find induction-based proofs for goals with leading foralls (e.g., `∀ n, n ≤ fib n + 1`) by collecting candidates after temporarily stripping the foralls and generating tactics prefixed with `intro`. Previously, `try?` could find `fun_induction fib` for `(n : Nat) : n ≤ fib n + 1` but not for `∀ n, n ≤ fib n + 1` because the candidate collector skipped expressions with loose bound variables. Rather than modifying the collector, this change uses `forallTelescope` during tactic generation to collect under the foralls and wraps the resulting tactics with `intro <names>;`. For regular induction (not function induction), the code generates tactic syntax using the intro names directly rather than FVarIds, since the FVarIds from the temporary forallTelescope context are invalid outside that scope. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
8bfbee0 to
5e15ae9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables
try?to find induction-based proofs for goals with leading foralls (e.g.,∀ n, n ≤ fib n + 1) by collecting candidates after temporarily stripping the foralls and generating tactics prefixed withintro.Previously,
try?could findfun_induction fibfor(n : Nat) : n ≤ fib n + 1but not for∀ n, n ≤ fib n + 1because the candidate collector skipped expressions with loose bound variables. Rather than modifying the collector, this change usesforallTelescopeduring tactic generation to collect under the foralls and wraps the resulting tactics withintro <names>;.Example:
🤖 Prepared with Claude Code and OpenAI Codex