Zulip Chat Archive

Stream: mathlib4

Topic: Cleaning up `Data`


Michael Rothgang (Aug 26 2025 at 10:36):

Question of the day: where should Data/Matrix/DoublyStochastic live? Opinions welcome! This may be related to the purpose of the Data directory, which is rather broad at the moment.

Kevin Buzzard (Aug 26 2025 at 10:42):

What decides whether work goes into Data/Matrix or LinearAlgebra/Matrix?

Michael Rothgang (Aug 26 2025 at 10:44):

I don't know! "If it imports something from LinearAlgebra, it goes there"?

Eric Wieser (Aug 26 2025 at 10:44):

For mostly leaf files does it matter that much?

Yaël Dillies (Aug 26 2025 at 11:47):

I would argue that anything under Data should be about... data structures. Probably most of Data.Matrix should move

Yaël Dillies (Aug 26 2025 at 11:59):

Data.Matrix.DoublyStochastic should IMO live in Analysis.Convex.Matrix or alike

Michael Rothgang (Aug 26 2025 at 12:23):

Any objections to moving Data/Complex/FiniteDimensional to Analysis? Most of it is linear algebra, but docs#Complex.rank_rat_complex uses the cardinality of the complex numbers (which uses the cardinality of the real numbers, which uses a convergent series, i.e. analysis).

Kim Morrison (Aug 26 2025 at 12:26):

I agree here: the Mathlib Matrix should not live in Data at all. :-) If there was a Matrix living in Data it should be Vector (Vector α m) n, or some structure for efficiently representing sparse matrices.

Michael Rothgang (Aug 26 2025 at 12:33):

Great! I have a PR which makes Data not import Analysis: once #28948 and #28955 are merged, it will be ready for review.

Michael Rothgang (Aug 26 2025 at 16:28):

That PR (#28953) is now unblocked

Michael Rothgang (Aug 26 2025 at 16:29):

Where should Data.Real.Irrationalmove? It imports RingTheory.Algebraic.Basis (to say that transcendental numbers are irrational); that doesn't feel like Data territory to me. Or should the file be split?

Michael Rothgang (Aug 26 2025 at 16:32):

Similar question about Data.Real.GoldenRatio: the material itself is quite elementary; it depends on Real.Irrational, though.

Kevin Buzzard (Aug 26 2025 at 17:21):

GoldenRatio really is data! But so is pi -- where is that defined? As for Data/Real/Irrational, maybe it should go in RingTheory/Real ?

Michael Rothgang (Aug 26 2025 at 17:26):

Real.pi is defined in Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic.

Ruben Van de Velde (Aug 26 2025 at 17:29):

It may be data, but it's not a data structure

Jireh Loreaux (Aug 26 2025 at 18:44):

Arguably Irrational could be split into Irrational and Transcendental, but I'm not sure how worthwhile such a split is at the moment.

Yaël Dillies (Aug 26 2025 at 19:42):

Irrational and Transcendental feel like they belong in NumberTheory

Yaël Dillies (Aug 26 2025 at 19:43):

I assume we'll eventually have NumberTheory.DiophApprox

Michael Stoll (Aug 26 2025 at 20:05):

There is Mathlib.NumberTheory.DiophantineApproximation.{Basic|ContinuedFractions}.

Bhavik Mehta (Aug 26 2025 at 20:09):

Transcendental feels more like algebra than number theory to me

Bhavik Mehta (Aug 26 2025 at 20:11):

Ah, it's in RingTheory already, that makes sense too

Michael Rothgang (Aug 26 2025 at 20:50):

#29002 proposes moving it to RingTheory/Real: I'm still on the fence if this is the best location.

Michael Rothgang (Aug 27 2025 at 08:41):

#28966 is next in the list, and moves most fo Data/Matrix

Michael Rothgang (Sep 28 2025 at 09:35):

Michael Rothgang said:

#29002 proposes moving it to RingTheory/Real: I'm still on the fence if this is the best location.

Four-week review ping

Riccardo Brasca (Sep 28 2025 at 09:41):

Does it make sense to also move Mathlib.Data.Real.GoldenRatio?

Kim Morrison (Oct 13 2025 at 01:39):

RingTheory/Real seems an improvement.

Michael Rothgang (Oct 15 2025 at 10:54):

#30498 moves GoldenRatio to Mathlib/NumberTheory

Ruben Van de Velde (Oct 15 2025 at 16:30):

Michael Rothgang said:

#30498 moves GoldenRatio to Mathlib/NumberTheory

Doesn't build

Michael Rothgang (Oct 15 2025 at 16:54):

Thanks; fixed now!

Michael Rothgang (Oct 27 2025 at 15:43):

Looking over open t-data PRs, I wonder: should Data.Real.Sqrt be in this directory, or elsewhere?

Michael Rothgang (Oct 27 2025 at 15:43):

Same question for Data.Nat.Factorisation: one could argue this is elementary number theory.

Ruben Van de Velde (Oct 27 2025 at 16:39):

How about Data.Nat.Prime? :innocent:

Kim Morrison (Oct 28 2025 at 00:12):

None of these three should be in Data: there are not about data types.


Last updated: Dec 20 2025 at 21:32 UTC