Skip to content

Discussion: Upgrading to Lean v4.29.1 / current Mathlib#3

Draft
ChihChengLiang wants to merge 10 commits intoTimeroot:mainfrom
ChihChengLiang:main
Draft

Discussion: Upgrading to Lean v4.29.1 / current Mathlib#3
ChihChengLiang wants to merge 10 commits intoTimeroot:mainfrom
ChihChengLiang:main

Conversation

@ChihChengLiang
Copy link
Copy Markdown

Discussion: Upgrading to Lean v4.29.1 / current Mathlib

Not for merging — opening this as a discussion to share findings and get feedback.

Background

Hi Timeroot, thanks for building this great project! I was learning Lean, encountered problem computing real numbers, and then found this project.

I tried upgrading ComputableReal from Lean v4.17.0-rc1 to v4.29.1 with a compatible Mathlib version. This PR captures my attempt and the problem I ran into.

The Core Problem

Real.instInv is noncomputable in Lean v4.29.1. Since ComputableReal's whole approach depends on being able to compute with real numbers, this creates a cascading issue — the noncomputability propagates to nearly every definition and instance that touches it, which largely defeats the purpose of the project.

What I tried

  • Pinned Lean to v4.29.1 and updated Mathlib to a compatible version.
  • Updated theorems that had changed or been renamed between versions, and got most of the project building successfully.
  • The remaining blocker is Real.instInv at safe_inv

Where I'm stuck

The noncomputability of Real.instInv seems fundamental rather than incidental. I'm not sure whether the right path is:

  • Defining a parallel computable inverse that doesn't rely on Real.instInv
  • Something else I'm missing

Questions for the maintainer

  • Is this a known issue? Has an upgrade path been considered?
  • Do you have a preferred direction for handling Real.instInv?
  • Would you welcome further work on this, or is the current Lean version intentional?

Happy to keep iterating on this if it's useful — just wanted to surface the findings first before going further.

ChihChengLiang and others added 10 commits April 17, 2026 16:31
- Update lean-toolchain to v4.30.0-rc1
- Run lake update to refresh all dependencies
- Fix removed/moved Mathlib modules:
  - Mathlib.Data.Sign → Mathlib.Data.Sign.Basic
  - Mathlib.Data.Real.GoldenRatio → Mathlib.NumberTheory.Real.GoldenRatio
  - Mathlib.Data.Real.Pi.Bounds → Mathlib.Analysis.Real.Pi.Bounds
  - Mathlib.Data.Complex.Exponential → Mathlib.Analysis.Complex.Exponential
- Fix removed typeclasses in aux_lemmas.lean:
  - LinearOrderedAddCommGroup → AddCommGroup + LinearOrder + IsOrderedAddMonoid
  - LinearOrderedField → Field + LinearOrder + IsStrictOrderedRing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
let signed := x.dropTilSigned hnz
let hnz' := val_dropTilSigned hnz ▸ hnz
-- x.val⁻¹ use `Real.instInv` here, which is noncomputable.
mk (x := x.val⁻¹)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

x.val⁻¹ here use the Real.instInv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant