Skip to content

Commit

Permalink
doc: Stub on setup and drafting
Browse files Browse the repository at this point in the history
  • Loading branch information
lenianiva committed Oct 18, 2024
1 parent 9fe5a55 commit 39b9e07
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ root: intro
parts:
- caption: Features
chapters:
- file: setup
- file: goal
- file: proof_search
- file: drafting
- caption: API Documentation
chapters:
- file: api-server
Expand Down
9 changes: 9 additions & 0 deletions docs/drafting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Drafting

Pantograph supports drafting from
[Draft-Sketch-Prove](https://github.com/wellecks/ntptutorial/tree/main/partII_dsp).
Pantograph's drafting feature is more powerful. At any place in the proof, you
can replace an expression with `sorry`, and the `sorry` will become a goal.

For an in-depth example, see `experiments/dsp`.

16 changes: 15 additions & 1 deletion docs/goal.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Goals and Tactics

Executing tactics in Pantograph is very simple.
Executing tactics in Pantograph is very simple. To start a proof, call the
`Server.goal_start` function and supply an expression.

```python
from pantograph import Server

server = Server()
state0 = server.goal_start("forall (p q: Prop), Or p q -> Or q p")
```

This creates a *goal state*, which consists of a finite number of goals. In this
case since it is the beginning of a state, it has only one goal. `print(state0)` gives

```
GoalState(state_id=0, goals=[Goal(variables=[], target='forall (p : Prop), p -> p', name=None, is_conversion=False)], _sentinel=[])
```

To execute a tactic on a goal state, use `Server.goal_tactic`. This function
takes a goal id and a tactic. Most Lean tactics are strings.

```python
state1 = server.goal_tactic(state0, goal_id=0, tactic="intro a")
```

2 changes: 1 addition & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Intro

This is PyPantograph, an machine-to-machine interaction interface for Lean 4.
This is Pantograph, an machine-to-machine interaction interface for Lean 4.
Its main purpose is to train and evaluate theorem proving agents. The main
features are:
1. Interfacing via the Python library, REPL, or C Library
Expand Down
12 changes: 11 additions & 1 deletion docs/proof_search.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Proof Search

About search ...
Inherit from the `pantograph.search.Agent` class to create your own search agent.
```python
from pantograph.search import Agent

class UnnamedAgent(Agent):

def next_tactic(self, state, goal_id):
pass
def guidance(self, state):
pass
```

28 changes: 28 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Setup

Install `poetry`. Then, run
```sh
poetry build
```
This builds a wheel of Pantograph which can then be installed.

To run the examples and experiments, setup a poetry shell:
```sh
poetry install
poetry shell
```
This drops the current shell into an environment where the development packages are available.

All interactions with Lean pass through the `Server` class. Create an instance
with
```python
from pantograph import Server
server = Server()
```

## Lean Dependencies

To use external Lean dependencies such as
[Mathlib4](https://github.com/leanprover-community/mathlib4), Pantograph relies
on an existing Lean repository. Instructions for creating this repository can be
found [here](https://docs.lean-lang.org/lean4/doc/setup.html#lake).

0 comments on commit 39b9e07

Please sign in to comment.