Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lazy ite branch internalization in grind #6737

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

leodemoura
Copy link
Member

This PR ensures that the branches of an if-then-else term are internalized only after establishing the truth value of the condition. This change makes its behavior consistent with the match-expression and dependent if-then-else behavior in grind.
This feature is particularly important for recursive functions defined by well-founded recursion and if-then-else. Without lazy if-then-else branch internalization, the equation theorem for the recursive function would unfold until reaching the generation depth threshold, and before performing any case analysis. See new tests for an example.

This PR ensures that the branches of an `if-then-else` term are
internalized only after establishing the truth value of the condition.
This change makes its behavior consistent with the `match`-expression
and dependent `if-then-else` behavior in `grind`.
This feature is particularly important for recursive functions defined by well-founded recursion and
`if-then-else`. Without lazy `if-then-else` branch internalization, the equation theorem for the recursive
function would unfold until reaching the generation depth threshold,
and before performing any case analysis. See new tests for an example.
@leodemoura leodemoura added the changelog-language Language features, tactics, and metaprograms label Jan 22, 2025
@leodemoura leodemoura enabled auto-merge January 22, 2025 05:00
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 22, 2025 05:06 Inactive
@leodemoura leodemoura added this pull request to the merge queue Jan 22, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jan 22, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 533af01dab41fbdd36a854edd9571e6756a3dc72 --onto f9e904af5022a57adb6105cda65d1569449346c2. (2025-01-22 05:26:24)

Merged via the queue into master with commit 9b74c07 Jan 22, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-language Language features, tactics, and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants