Skip to content

[Merged by Bors] - chore: add missing noncomputable - #41446

Closed
YaelDillies wants to merge 5 commits into
leanprover-community:masterfrom
YaelDillies:missing_noncomputable
Closed

YaelDillies wants to merge 5 commits into
leanprover-community:masterfrom
YaelDillies:missing_noncomputable

Conversation

@YaelDillies

@YaelDillies YaelDillies commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making Set a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that s : Set α is (equivalent to) a family of sorts.


Open in Gitpod

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

PR summary cd8966e558

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ instance : CommRing (D.subalgebra R)
- instance : CommRing (D.subalgebra R) := inferInstanceAs <| CommRing (Algebra.adjoin _ _)

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit cd8966e).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit cd8966e558
Reference commit 6c5a9081e9

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@kbuzzard

kbuzzard commented Jul 7, 2026

Copy link
Copy Markdown
Member

!radar

@leanprover-radar

leanprover-radar commented Jul 7, 2026 •

Copy link
Copy Markdown

Benchmark results for 53afaa7 against f063076 are in. No significant results found. @kbuzzard

  • 🟥 build//instructions: +41.6G (+0.03%)

No significant changes detected.

@JovanGerb

Copy link
Copy Markdown
Contributor

Should we use noncomputable section for some of these files that are about e.g. Reals, Euclidean geometry or measurable spaces?

@thorimur

Copy link
Copy Markdown
Contributor

Given the discussion on zulip, this PR should probably be closed, right?

@JovanGerb

Copy link
Copy Markdown
Contributor

Why should it be closed? I don't see how we would benefit from any of these declarations being computable.

All these definitions are already noncomputable, but somehow the computability checker doesn't spot this until I try making `Set` a one-field structure.
@YaelDillies
YaelDillies force-pushed the missing_noncomputable branch from f170a03 to 5b90164 Compare July 14, 2026 08:31
@YaelDillies

Copy link
Copy Markdown
Contributor Author

@thorimur, I have now tried to build #41506 without adding any noncomputable and I just can't figure out how. For example, selfEquivSigmaOrbits depends on Quotient.out in its type. I cannot hide its use behind Set or whatever it is that you suggested I do.

Please advise (or get this PR merged 😁)

@Vierkantor Vierkantor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, the problem is that the Set structure pattern moves the computability boundary "inside" a constructor. So the solution to avoid a noncomputable keyword would be to put Set.ofPred around everything in the refactor PR? I would say, as a workaround for computability issues, that costs a lot more effort and is less easy to understand or revert, than adding a noncomputable keyword. So I'm in favour of the keyword-based approach, not the approach of rewriting into an equivalent definition.

Since noncomputable section only applies noncomputable when that is in fact the case, maybe that is the right compromise here?

@thorimur

thorimur commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Oh, so sorry @YaelDillies, I didn't see this ping!

Apologies, I didn't mean to block here if the awkwardness of avoiding noncomputable exceeds the "misleading" nature of having noncomputable. (I think I implied this on zulip but not very strongly.) noncomputable is not so bad in these circumstances. Let's get this merged! :)

(Indeed, the only way I can think of is turning every s into Set.ofPred (s.Mem), which is awful. I tried wrapping that in something like Set.ofClassical (s : Set _), but that doesn't work. Maybe it's the lean compiler which is wrong... :) )

@thorimur

Copy link
Copy Markdown
Contributor

Note: a comment like

-- Note: `Set` has no computational content, but Lean still attempts to compile it.
-- See leanprover/lean4#14084.

near these noncomputables might make sense for the future :)

@Vierkantor Vierkantor added the t-data Data (lists, quotients, numbers, etc) label Jul 23, 2026

@Vierkantor Vierkantor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The diff looks fine to me, and a comment (with a slight change, turning the issue number into a URL) should be good:

-- Note: `Set` has no computational content, but Lean still attempts to compile it.
-- See https://github.com/leanprover/lean4/issues/14084.

Since I'm away for the next two weeks,

bors d=@thorimur

@mathlib-bors

mathlib-bors Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

✌️ thorimur can now approve this pull request until 2026-08-06 15:28 UTC (in 2 weeks). To approve and merge, reply with bors r+. More detailed instructions are available here.

⚠️ This delegation only covers changes within Archive/**, Counterexamples/**, docs/**, DownstreamTest/**, Mathlib/**, MathlibTest/**, widget/**, Archive.lean, Counterexamples.lean, docs.lean, Mathlib.lean; an author commit touching anything else will revoke it. Bors also revokes it if a later push changes too many files for it to check the full list — even if it stays within scope.

@mathlib-bors mathlib-bors Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Jul 23, 2026
@thorimur

Copy link
Copy Markdown
Contributor

(I've merged master to get rid of the CI error, see zulip)

@thorimur thorimur left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great, I've annotated the noncomputable sections in these suggestions, then that should be it!

Comment thread Mathlib/GroupTheory/Transfer.lean Resolved
Comment thread Mathlib/Topology/UrysohnsLemma.lean Resolved
Comment thread Mathlib/LinearAlgebra/Basis/Flag.lean Resolved
@YaelDillies
YaelDillies force-pushed the missing_noncomputable branch from 46ab6c6 to e9cf3ce Compare July 24, 2026 06:06
@YaelDillies

Copy link
Copy Markdown
Contributor Author

(I've merged master to get rid of the CI error, see zulip)

My git got very confused between my local changes and your merge, so I force-pushed yours away and made a new one.

@thorimur

Copy link
Copy Markdown
Contributor

bors r+

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Jul 24, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Jul 24, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Jul 24, 2026
@mathlib-bors

mathlib-bors Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title chore: add missing noncomputable [Merged by Bors] - chore: add missing noncomputable Jul 24, 2026
@mathlib-bors mathlib-bors Bot closed this Jul 24, 2026
@mathlib-bors mathlib-bors Bot removed the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Jul 24, 2026
@YaelDillies
YaelDillies deleted the missing_noncomputable branch July 24, 2026 08:05
YaelDillies added a commit to YaelDillies/mathlib4 that referenced this pull request Jul 28, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.

Follow-up to leanprover-community#41446.

Generated by Claude Opus, then reviewed and cherry-picked line-by-line by myself.

Assisted-by: Claude Opus 4.8
YaelDillies added a commit to YaelDillies/mathlib4 that referenced this pull request Jul 28, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.

Follow-up to leanprover-community#41446.

Generated by Claude Opus, then reviewed and cherry-picked line-by-line by myself.

Assisted-by: Claude Opus 4.8
mpacholski pushed a commit to mpacholski/mathlib4 that referenced this pull request Jul 30, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.
mathlib-bors Bot pushed a commit that referenced this pull request Aug 1, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.

Follow-up to #41446.

Generated by Claude Opus, then reviewed and cherry-picked line-by-line by myself.

Assisted-by: Claude Opus 4.8
mathlib-bors Bot pushed a commit that referenced this pull request Aug 1, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.

Follow-up to #41446.

Generated by Claude Opus, then reviewed and cherry-picked line-by-line by myself.

Assisted-by: Claude Opus 4.8
mathlib-bors Bot pushed a commit that referenced this pull request Aug 1, 2026
All these definitions are noncomputable (because they use choice/produce sets), but the computability checker doesn't spot this until I try making `Set` a one-field structure. This is because the computability checker doesn't even try to compute sorts, but it doesn't see that `s : Set α` is (equivalent to) a family of sorts.

Follow-up to #41446.

Generated by Claude Opus, then reviewed and cherry-picked line-by-line by myself.

Assisted-by: Claude Opus 4.8
edwardfalk added a commit to edwardfalk/mathlib4 that referenced this pull request Nov 9, 2026
…putable

`riemannZetaZeros` became `noncomputable` on master (leanprover-community#41446), and a definition
built from it must be marked the same way, or the file fails to compile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0199hgM8iFTn8ghTkFbufHeq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants