Giter Site home page Giter Site logo

pwintz / mathlib4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leanprover-community/mathlib4

0.0 0.0 0.0 33.55 MB

Work in progress mathlib port for lean 4

Home Page: https://leanprover-community.github.io/mathlib4_docs

License: Apache License 2.0

Shell 0.02% Python 0.08% Makefile 0.01% Lean 99.89% Dockerfile 0.01%

mathlib4's Introduction

mathlib4

Bors enabled project chat

This is the work in progress port of mathlib to Lean 4.

Contributing

A guide on how to port a file from mathlib3 to mathlib4 can be found in the wiki. The porting effort is coordinated through zulip, if you want to contribute to the port please come to the mathlib4 stream.

Build instructions

  • Make sure Lean is not running, and close all instances of VSCode running Lean processes.
  • Get the newest version of elan. If you already have installed a version of Lean, you can run
    elan self update
    
    If the above command fails, or if you need to install elan, run
    curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh
    
    If this also fails, follow the instructions under Regular install here.
  • To build mathlib4 run lake build. To build and run all tests, run make.
  • You can use lake build +Mathlib.Import.Path to build a particular file, e.g. lake build +Mathlib.Algebra.Group.Defs.
  • If you added a new file, run the following command to update Mathlib.lean
    find Mathlib -name "*.lean" | env LC_ALL=C sort | sed 's/\.lean//;s,/,.,g;s/^/import /' > Mathlib.lean
    

Downloading cached build files

Run lake exe cache get to download cached build files that are computed by mathlib4's automated workflow. If tar terminates with an error, it means that you might have ended up with corrupted files. In this case, run lake exe cache get! to overwrite them (get won't try to download the same file again).

Call lake exe cache to see its help menu.

Building HTML documentation

Building HTML documentation locally is straightforward:

lake -Kdoc=on build Mathlib:docs

The HTML files can then be found in build/doc.

Dependencies

If you want to update dependencies, use lake update -Kdoc=on. This will update the lake-manifest.json file correctly. You will need to make a PR after committing the changes to this file.

Using mathlib4 as a dependency

In a new project

To start a new project that uses mathlib4 as a dependency, run elan run leanprover/lean4:nightly-2023-02-04 lake new <your_project_name> math. This uses the Lake version with the most recent new math implementation independent of your default elan toolchain. You now have a folder named your_project_name that contains a new Lake project. The lakefile.lean file is configured with the mathlib4 dependency. lean-toolchain points to the same version of Lean 4 as used by mathlib4. Continue with "Getting started" below.

In an existing project

If you already have a project and you want to use mathlib4, add these lines to your lakefile.lean:

require mathlib from git
  "https://github.com/leanprover-community/mathlib4"

Then run

curl -L https://raw.githubusercontent.com/leanprover-community/mathlib4/master/lean-toolchain -o lean-toolchain

in order to set your project's Lean 4 version to the one used by mathlib4.

Getting started

In order to save time compiling all of mathlib and its dependencies, run lake exe cache get. This should output a line like

Decompressing 2342 file(s)

with a similar or larger number. Now try adding import Mathlib or a more specific import to a project file. This should take insignificant time and not rebuild any mathlib files.

Updating mathlib4

Run these commands in sequence:

lake update
curl -L https://raw.githubusercontent.com/leanprover-community/mathlib4/master/lean-toolchain -o lean-toolchain
lake exe cache get

More on lake exe cache

Lake projects inherit executables declared with lean_exe from their dependencies. It means that you can call lake exe cache on your project if you're using mathlib4 as a dependency. However, make sure to follow these guidelines:

  • Call lake exe cache get (or other cache commands) from the root directory of your project
  • If your project depends on std4 or quote4, let mathlib4 pull them transitively. That is, don't require them on your lakefile.lean
  • Make sure that your project uses the same Lean 4 toolchain as the one used in mathlib4

mathlib4's People

Contributors

urkud avatar parcly-taxel avatar semorrison avatar ruben-vandevelde avatar gebner avatar digama0 avatar chrishughes24 avatar int-y1 avatar joelriou avatar mo271 avatar eric-wieser avatar komyyy avatar mcdoll avatar mattrobball avatar j-loreaux avatar fpvandoorn avatar arienmalec avatar dwrensha avatar yaeldillies avatar jcommelin avatar xroblot avatar casavaca avatar lukasmias avatar kbuzzard avatar joneugster avatar hrmacbeth avatar riccardobrasca avatar kmill avatar adamtopaz avatar arthurpaulino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.