GithubHelp home page GithubHelp logo

zigmmverify's Introduction

Note that this branch is built using nightly 'master' zig. The more actively developed branch is zig-0.9.x. Changes are periodically merged from there to this branch.

Build with zig master

A Metamath proof verifier in Zig

At least, the beginnings of one.

This is partly to learn Zig, partly to have a fast verifier that I can hack (Python is way too slow, Rust is too weird for me still, Nim seems less clean, C is out), so that I can perhaps one day try to do experiments around parsing (where parse tree of X... is proof of |- TOPLEVEL X... ), abbreviations, and modules.

How to build and run

Build using Zig master, then just run the resulting binary, passing a single .mm file on the command line.

For example, use set.mm, which you can get from metamath.org, or download the most recent version directly from GitHub: https://github.com/metamath/set.mm/raw/develop/set.mm.

The version of the Metamath specification that was implemented, is the one from the 2nd edition Metamath book. (Norman D. Megill, David A. Wheeler, "Metamath: A Computer Language for Mathematical Proofs". Lulu Press, 2019. http://us.metamath.org/downloads/metamath.pdf .)

Next tasks

Verifier completeness:

  • Verify that 'normal' tokens don't start with $, label tokens use only allowed characters, etc.

  • Support ? in proofs.

Clean up:

  • Clean-up / refactor RuleIterator + ScopeDiff: Add methods, move functionality between these structs. Also encapsulate some parts. Also try to avoid duplication in statement handling.

  • Work towards a library that can also be used for $a/$p/$e parse trees.

Functionality:

  • Generate a parse tree for every $a/$p/$e statement. If possible/feasible, check that it is the only possible parse tree. Try to also support 'conditional syntax rules, so e.g. ${ $e -. B = 0 $. $a class ( A / B ) $. $} which expresses that A / B is only a syntactically valid expression if B is not zero.

Verifier performance:

  • Optimize performance by reducing memory use: A token is currently represented by a Zig slice (= pointer and a length), and this could be replaced by a single small(ish) integer by 'interning' all tokens.

  • Optimize performance by parallelizing using Zig async.

  • Optimize performance by reducing memory use: I suspect ArrayList is not the right data structure for some of the lists.

Verifier tests:

  • Run the test suite from https://github.com/david-a-wheeler/metamath-test probably by checking it out as a Git submodule and using the zig-mm-verify binary as the approved-or-not judge.

  • (Separate project.) Extend that test suite, to capture as many as possible deviations from the specification as possible.

Verifier usability:

  • Identify the location (line/column) of at least the first error.

  • Don't use 'error union' for Metamath verification errors.

Language dialects:

  • Optional modes where $c/$v is allowed to be duplicated (useful to create set-parsed.mm which declares stuff before $[ set.mm $]); where $f implicitly does $c/$v; and perhaps more.

zigmmverify's People

Contributors

marnix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.