Zulip Chat Archive

Stream: Is there code for X?

Topic: Filenames to `Lean.Name`


Jireh Loreaux (Nov 15 2023 at 18:45):

Do we have anything to take the filename Mathlib/Algebra/Group/Defs.lean to the docs#Lean.Name Mathlib.Algebra.Group.Defs?

Jireh Loreaux (Nov 15 2023 at 18:45):

I know it shouldn't be hard to write, but I figure it must already exist.

Alex J. Best (Nov 15 2023 at 18:48):

docs#moduleNameOfFileName perhaps?

Jireh Loreaux (Nov 15 2023 at 18:50):

Thanks!

Anne Baanen (Nov 21 2023 at 09:55):

Is there also a way to go the other way, from Mathlib.Algebra.Group.Defs to Mathlib/Algebra/Group/Defs.lean?

Scott Morrison (Nov 21 2023 at 11:58):

Lean.findOLean is almost what you want.

Scott Morrison (Nov 21 2023 at 11:58):

I have a

-- TODO allow finding Lean 4 sources from the toolchain.
def findLean (mod : Name) : IO FilePath := do
  return FilePath.mk (( findOLean mod).toString.replace "build/lib/" "") |>.withExtension "lean"

in a project.


Last updated: Dec 20 2023 at 11:08 UTC