Skip to content

Commit 4948426

Browse files
authored
Merge pull request #31 from lenianiva/doc/main
doc: Documentation with jupyter-book
2 parents 143f2ed + 18872dc commit 4948426

File tree

14 files changed

+1118
-2
lines changed

14 files changed

+1118
-2
lines changed

.github/workflows/docs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: deploy-docs
2+
3+
# Run this when the master or main branch changes
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- docs/main
9+
10+
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
11+
jobs:
12+
deploy-book:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pages: write
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
# Install dependencies
21+
- name: Set up Python 3.11
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: 3.11
25+
26+
# Build the book
27+
- name: Build the book
28+
run: |
29+
jupyter-book build docs
30+
31+
# Upload the book's HTML as an artifact
32+
- name: Upload artifact
33+
uses: actions/upload-pages-artifact@v2
34+
with:
35+
path: "docs/_build/html"
36+
37+
# Deploy the book's HTML to GitHub Pages
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.*
22
!.gitignore
3+
!.github
34

45
# Python
56
*.py[cod]

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ poetry build
1616
poetry install
1717
```
1818

19+
## Documentation
20+
21+
Build the documentations by
22+
```sh
23+
jupyter-book build docs
24+
```
25+
Then serve
26+
```sh
27+
cd docs/_build/html
28+
python3 -m http.server -d .
29+
```
30+
1931
## Examples
2032

2133
For API interaction examples, see `examples/README.md`. The examples directory

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/_build

docs/_config.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Book settings
2+
# Learn more at https://jupyterbook.org/customize/config.html
3+
# Comprehensive example: https://github.com/executablebooks/jupyter-book/blob/master/docs/_config.yml
4+
5+
title: PyPantograph
6+
author: Leni Aniva
7+
#logo: logo.png
8+
9+
# Force re-execution of notebooks on each build.
10+
# See https://jupyterbook.org/content/execute.html
11+
execute:
12+
execute_notebooks: force
13+
14+
# Define the name of the latex output file for PDF builds
15+
latex:
16+
latex_documents:
17+
targetname: book.tex
18+
19+
# Add a bibtex file so that we can create citations
20+
#bibtex_bibfiles:
21+
# - references.bib
22+
23+
# Information about where the book exists on the web
24+
repository:
25+
url: https://github.com/lenianiva/PyPantograph # Online location of your book
26+
path_to_book: docs # Optional path to your book, relative to the repository root
27+
branch: main # Which branch of the repository should be used when creating links (optional)
28+
29+
# Add GitHub buttons to your book
30+
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
31+
html:
32+
use_issues_button: true
33+
use_repository_button: true
34+
35+
sphinx:
36+
config:
37+
intersphinx_mapping:
38+
ebp:
39+
- "https://executablebooks.org/en/latest/"
40+
- null
41+
myst-parser:
42+
- "https://myst-parser.readthedocs.io/en/latest/"
43+
- null
44+
myst-nb:
45+
- "https://myst-nb.readthedocs.io/en/latest/"
46+
- null
47+
sphinx:
48+
- "https://www.sphinx-doc.org/en/master"
49+
- null
50+
nbformat:
51+
- "https://nbformat.readthedocs.io/en/latest"
52+
- null
53+
sd:
54+
- "https://sphinx-design.readthedocs.io/en/latest"
55+
- null
56+
sphinxproof:
57+
- "https://sphinx-proof.readthedocs.io/en/latest/"
58+
- null
59+
hoverxref_intersphinx:
60+
- "sphinxproof"
61+
mathjax3_config:
62+
tex:
63+
macros:
64+
"N": "\\mathbb{N}"
65+
"floor": ["\\lfloor#1\\rfloor", 1]
66+
"bmat": ["\\left[\\begin{array}"]
67+
"emat": ["\\end{array}\\right]"]
68+
69+
extra_extensions:
70+
- sphinx.ext.intersphinx
71+
- sphinx.ext.autodoc

docs/_toc.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
format: jb-book
2+
root: intro
3+
parts:
4+
- caption: Features
5+
chapters:
6+
- file: goal
7+
- file: proof_search
8+
- caption: API Documentation
9+
chapters:
10+
- file: api-server
11+
- file: api-search

docs/api-search.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Search
2+
=============
3+
4+
.. automodule:: pantograph.search
5+
:members:

docs/api-server.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Server
2+
=============
3+
4+
.. automodule:: pantograph.server
5+
:members:

docs/goal.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Goals and Tactics
2+
3+
Executing tactics in Pantograph is very simple.
4+
5+
```python
6+
from pantograph import Server
7+
8+
server = Server()
9+
state0 = server.goal_start("forall (p q: Prop), Or p q -> Or q p")
10+
state1 = server.goal_tactic(state0, goal_id=0, tactic="intro a")
11+
```
12+

docs/intro.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Intro
2+
3+
This is PyPantograph, an machine-to-machine interaction interface for Lean 4.
4+
Its main purpose is to train and evaluate theorem proving agents. The main
5+
features are:
6+
1. Interfacing via the Python library, REPL, or C Library
7+
2. A mixture of expression-based and tactic-based proofs
8+
3. Pantograph has been designed with facilitating search in mind. A theorem
9+
proving agent can simultaneously explore multiple branches of the proof.
10+
4. Handling of metavariable coupling
11+
5. Reading/Adding symbols from the environment
12+
6. Extraction of tactic training data
13+
7. Support for drafting
14+
15+
## Design Rationale
16+
17+
The Lean 4 interface is not conducive to search. Readers familiar with Coq may
18+
know that the Coq Serapi was superseded by CoqLSP. In the opinion of the
19+
authors, this is a mistake. An interface conducive for human operators to write
20+
proofs is often not an interface conductive to search.
21+
22+
LeanDojo has architectural limitations that prevent it from gaining new features
23+
such as drafting without refactoring. Almost all of Pantograph's business logic
24+
is written in Lean, and Pantograph achieves tighter coupling between the data
25+
extraction and proof search components.

0 commit comments

Comments
 (0)