Giter VIP home page Giter VIP logo

lean-client-python's Introduction

Lean client for Python

This experimental package aims to help talking to the Lean theorem prover from Python.

You can install it by cloning this repository and running pip install path_to_your_clone.

Core interface

The core piece is the lean_client.commands module which bridges from JSON messages produced and consumed by lean --server to python objects. This core does not help at all with handling interactivity, in particular the fact that Lean processes things in parallel and answer somewhat impredictably (depending on the presence of errors, or simply on elaboration and proof checking time). Interactivity can be handled only in an asynchronous environment. We provide (very partial) support for two such environments with very different patterns.

Qt interface

The module lean_client.qt_server defines a QtLeanServer class which allows communication with Lean from a Qt event loop. Qt handles asynchronicity using signals and slots, hence this example can be adapted to any framework based on call-backs. It requires PyQt5 (and its C++ dependencies) that you can install using pip install path_to_your_clone[qt]. See the example program qt_interface in the examples folder of this repository. This example opens a Qt windows which asks for a sequence of instruction proving a simple lemma (you can go back using Ctrl-Z and quit using Ctrl-Q). The following animated Gif shows it in action.

Image of qt_interface

Trio/asyncio interface

The module lean_client.trio_server defines a TrioLeanServer class which allows communication with Lean from a Trio nursery. This framework is built on top of python's asyncio, hence can be adapted to any framework based on async/await. It requires trio which you can install using pip install path_to_your_clone[trio]. See the example program trio_example in the examples folder of this repository. This example displays the tactic state for every line of examples/test.lean that has a non-empty tactic state.

You can install all optional dependencies at once using pip install path_to_your_clone[all].

lean-client-python's People

Contributors

patrickmassot avatar

Watchers

James Cloos 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.