Skip to content

feat: mark predefinitions that failed to compile as noncomputable#2610

Closed
alexjbest wants to merge 1 commit intoleanprover:masterfrom
alexjbest:alex/noncomputabletagsection
Closed

feat: mark predefinitions that failed to compile as noncomputable#2610
alexjbest wants to merge 1 commit intoleanprover:masterfrom
alexjbest:alex/noncomputabletagsection

Conversation

@alexjbest
Copy link
Copy Markdown
Contributor

Currently definitions inside a noncomputable section that fail to compile are not explicitly tagged as noncomputable.
A noncomputable section simply attempts to compile all definitions but returns false instead of erroring when a compilation error is encountered, however this information is discarded in addNonRecAux.
It seems more useful for downstream tactics / users for the fact that compilation failed to be recorded by tagging the definition with noncomputable.
For example the to_additive tactic in mathlib will always try to compile declarations generated from not noncomputable multiplicative versions, which means that currently to_additive breaks inside noncomputable sections see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/noncomputable.20and.20to_additive/near/394068118, this particular issue could be dealt with downstream, but adding the noncomputable tag seems to be the cleanest implementation to me.

@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 Oct 1, 2023
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Oct 1, 2023
@alexjbest
Copy link
Copy Markdown
Contributor Author

awaiting-review

@github-actions github-actions bot added the awaiting-review Waiting for someone to review the PR label Oct 1, 2023
@ghost ghost added the builds-mathlib CI has verified that Mathlib builds against this PR label Oct 1, 2023
@ghost
Copy link
Copy Markdown

ghost commented Oct 1, 2023

Comment on lines +125 to 126
if preDef.modifiers.isNoncomputable || !didCompile then
modifyEnv fun env => addNoncomputable env preDef.declName
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that all theorems will now be marked as noncomputable, whereas before they were not so marked. While it's unclear how much that matters, I think it would be good to not change things unnecessarily (and moreover, it would be great if we could have sufficiently thorough tests here that such changes are trivial to notice!)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is not ideal. I will rewrite it and add more tests, as always I failed to anticipate this potential issue.

I think this is yet another instance where a "library diff" tool would have been very revealing!

@kim-em kim-em added awaiting-author Waiting for PR author to address issues missing tests This PR requires the addition of tests before it can be merged. and removed awaiting-review Waiting for someone to review the PR labels Oct 2, 2023
@Kha Kha requested review from Kha and leodemoura as code owners November 20, 2023 08:15
@github-actions github-actions bot added the stale label Dec 21, 2023
@github-actions github-actions bot removed the stale label Feb 10, 2024
@github-actions github-actions bot added the stale label May 5, 2024
@github-actions github-actions bot removed the stale label May 30, 2024
@github-actions github-actions bot added stale and removed stale labels Jun 29, 2024
@github-actions github-actions bot added the stale label Aug 20, 2024
@github-actions github-actions bot removed the stale label Sep 6, 2024
@github-actions github-actions bot added the stale label Oct 31, 2024
@github-actions github-actions bot removed the stale label Jun 7, 2025
@zwarich
Copy link
Copy Markdown
Contributor

zwarich commented Jun 27, 2025

I'm going to close this old PR in favor of #9021.

@zwarich zwarich closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Waiting for PR author to address issues builds-mathlib CI has verified that Mathlib builds against this PR missing tests This PR requires the addition of tests before it can be merged. 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.

3 participants