Zulip Chat Archive

Stream: Is there code for X?

Topic: Is there a definition of a general real interval in Mathlib?


Michael Novak (Nov 22 2025 at 05:13):

I saw that there are closed, open, bounded, unbounded, etc... definitions for intervals in Mathlib, but I couldn't find a definition of a general real interval - a subset I of the real numbers that such that for every two points of I every point in between them is also in I. If there isn't such a definition, then I would love to write one for mathlib and maybe a few theorems like that the other more specific sorts of interval are also intervals by the general definition.

Aaron Liu (Nov 22 2025 at 05:14):

docs#Set.OrdConnected

Aaron Liu (Nov 22 2025 at 05:15):

works not just for the real numbers

Aaron Liu (Nov 22 2025 at 05:16):

if two points are on your set then so is the entire interval between them

Michael Novak (Nov 22 2025 at 05:17):

Aaron Liu said:

docs#Set.OrdConnected

when I click on this link I get error 404

Aaron Liu (Nov 22 2025 at 05:18):

sorry I guessed the name wrong twice but it should be correct now (edited original message)

Michael Novak (Nov 22 2025 at 05:20):

Thank you very much!

Michael Novak (Nov 22 2025 at 05:25):

btw, sorry for the newbie question: if I want to use this in my lean file, should I write at the beginning of the file:

import Mathlib.Set

even though I already have the line

import Mathlib

or maybe I should even write this

import Mathlib.Set.OrdConnected

?

Weiyi Wang (Nov 22 2025 at 05:27):

if you already have import Mathlib then you don't need to add any other import of sub files

Weiyi Wang (Nov 22 2025 at 05:29):

This particular definition is in Mathlib.Order.Interval.Set.Defs if you want to do minimal import, but I don't recommend that for initial exploration because you can miss useful lemmas

Michael Novak (Nov 22 2025 at 05:31):

If I would like this file eventually to be used in Mathlib, what's the appropriate import line? Is there a convention?

Kim Morrison (Nov 22 2025 at 05:43):

Once you've finished preparing your file, write #min_imports at the bottom of the file, and replace import Mathlib with what that says.

Michael Novak (Nov 22 2025 at 05:45):

Kim Morrison said:

Once you've finished preparing your file, write #min_imports at the bottom of the file, and replace import Mathlib with what that says.

Thank you very much!

Yaël Dillies (Nov 22 2025 at 06:26):

Does #min_imports understand the module system yet?

Kim Morrison (Nov 23 2025 at 02:23):

No.


Last updated: Dec 20 2025 at 21:32 UTC