Giter VIP home page Giter VIP logo

compfiles's Introduction

Compfiles: Catalog Of Math Problems Formalized In Lean, Emphasizing Solutions

A collection of olympiad-style math problems and their solutions, formalized in Lean 4.

external sources

Some problems were imported from external sources:

dashboard

A list of all the problems and their status is available as a dashboard that gets automatically updated on every push to the main branch of this repo.

building

Make sure you have elan installed. Then do:

$ lake exe cache get
$ lake build

extracting problems

In this repo, each solution (proof) is recorded inline, in the same file that its problem is declared. In some situations, however, solution data is undesired. For example, we might want a website to display only the problem statement, or we might want to invoke an IMO Grand Challenge solver without providing spoilers.

To that end, this repo defines some special commands to support problem extraction.

  • A problem_file command marks a file that should participate in problem extraction.
  • A problem declaration is the main theorem to be proved. The body of the declaration (everything to the right of :=) is replaced by sorry in the extracted problem.
  • A determine declaration indicates data the must be provided as part of the solution. Like with problem, the body of the declaration is replaced by sorry in the extracted problem.
  • A snip begin ... snip end sequence indicates commands that should be omitted in the extracted problem.

To generate problem statements with all solution information stripped, do:

$ lake exe extractProblems

and then look in the _extracted/problems directory.

extracting solutions

Sometimes it's useful to have a version of a solution that does not depend on the ProblemExtraction library (but still contains all proof information). For example, you might want to share a fully worked solution on https://live.lean-lang.org/.

To that end, the extractProblems tool described above additionally extracts dependency-stripped solution files into the _extracted/solutions directory.

checking solutions

The checkSolution executable takes as input a problem ID and a path to a lean source code file. For example:

$ lake exe checkSolution Imo2022P2 _extracted/solutions/Imo2022P2.lean

This will check that the extracted solution file _extracted/solutions/Imo2022P2.lean does indeed pass verification for problem Imo2022P2. It will print the terms for any determine declarations in the solution, so that they can be judged by a human. In this example, that will look like:

determine Imo2022P2.solution_set := {fun x => 1 / x}

The intention is that this solution checker could be used as a grader for the IMO Grand Challenge.

contributing

Contributions are welcome! You may take credit for you work by adding yourself to the "authors" field in the copyright header.

videos

IMO 1964 Problem 4
IMO 1964 Problem 1b

compfiles's People

Contributors

dwrensha avatar casavaca avatar seasawher avatar spinylobster avatar mo271 avatar ondanaoto avatar boltonbailey avatar jcreedcmu avatar 0art0 avatar ganjinzero avatar yinghy18 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.