Git Product home page Git Product logo

metamath.js's Introduction

This is not an officially supported Google product

Metamath.js is an independent metamath verifier written in JS so that it can run in browsers.

It comes with a parser, a verifier and a renderer.

https://google.github.io/metamath.js

It also comes with a few experimental extensions to the language around modularization.

API

Parser

The Parser API takes as input a metamath source and calls a handler as it produces the AST:

> const {parse} = require("./src/descent.js");
> parse("$c a $. $v b $.", {feed(statement) { console.log(statement); }})
[ '$c', [ 'a' ] ]
[ '$v', [ 'b' ] ]

Verifer

The Verifier API takes as input a metamath source and verifies the statements. It uses the Parser internally:

> const {Verifier} = require("./src/descent.js");
> new Verifier().verify("$c a $. $v b $.");
0

Compression

The Compression API manages decompressing (and compressing) proofs using the metamath compressed proof format:

> const {Decompressor} = require("./src/metamath.js")
> const compressed = "AAABZBZFAACAFABBGFBAFCAFADEE";
> const integers = new Decompressor().decode(compressed)
[
  1, 1, 1, 2, -1, 2, -1, 6,
  1, 1, 3, 1,  6, 1,  2, 2,
  7, 6, 2, 1,  6, 3,  1, 6,
  1, 4, 5, 5
]
> const local = ["wph"];
> const external = "wi ax-1 ax-2 ax-mp".split(" ");
> const steps = new Decompressor().decompress(local, external, compressed)
> steps
[
  'wph', 'wph',  'wph',   'wi',
  -1,    'wi',   -1,      0,
  'wph', 'wph',  'ax-1',  'wph',
  0,     'wph',  'wi',    'wi',
  1,     0,      'wi',    'wph',
  0,     'ax-1', 'wph',   0,
  'wph', 'ax-2', 'ax-mp', 'ax-mp'
]
> new Compressor(local, steps).compress();
'AAABZBZFAACAFABBGFBAFCAFADEE'

Development

git clone https://github.com/google/metamath.js
git cd metamath.js
npm install
npm test

Examples

metamath.js's People

Contributors

samuelgoto avatar

Watchers

 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.