Skip to content

About

Autonomous research harness for the pequalnp.com Lean 4 proof desk

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

dense-dragonslayer

Autonomous research harness for the P vs NP proof desk at pequalnp.com.

The desk hands out steps: one Lean 4 statement each, held on a lease. The worker takes a step, runs research rounds with local Ollama models (plan an experiment, write a Python trial, a Lean helper or a candidate proof, check it), checks every result with Lean on your machine, and has a candidate that Lean accepts read by a critical verifier before it tells you. You push the one-file branch to your fork, open the pull request, and mark the step submitted. The canvas shows the step, every round, the models and their numbers, the metrics and the log, and carries every control.

The overview: twelve plates on one zoomable canvas

local models (Ollama)              verifiers: a local model, an API, a web chat
plan, write, iterate               read a candidate Lean accepted
     |                                    |
     v                                    v
[PLAN] -> [EXECUTE] -> [CHECK] -> [VERIFY] -> [PUBLISH]
                       Lean on    the project's   you: push, open the
                       your host  checker and     pull request, mark
                                  the verifiers   submitted

Nothing here claims a theorem is proved. A candidate is "checked" when the project's pinned Lean toolchain accepted it with only the three standard axioms and the independent checks agreed; the project's own checker on the pull request has the last word.

  • A Python trial or a shell command from a model runs with no network, a read-only home and write access only to its scratch directory (user, network, mount and PID namespaces, Landlock, resource limits). No container engine is needed. docs/CONFINE.md has the details.

  • The worker does not push (unless you turn on "push a checked proof"), never opens a pull request, and never tells the desk a step is submitted. Every step's work is kept as a zip.

Requirements

  • Linux (tested on x86-64) with unprivileged user namespaces and Landlock (kernel 5.13 or newer; most current distributions qualify; on Ubuntu 24.04 and later see User namespaces).
  • Python 3.10 or newer (the worker uses only the standard library), git, curl, tmux, and the GitHub CLI signed in to your account.
  • elan for Lean, and disk for the Mathlib cache (about 6 GB).
  • Ollama and a GPU. The default models, qwen3.8:27b and qwen2.5-coder:14b, are sized for an 8 GB card; any models you pull can take their place.
  • For the canvas: a C11 compiler, pkg-config, SDL3 (3.2 or newer), FreeType, and an OpenGL 3.3 or OpenGL ES 3.0 driver.
  • Optional: Node.js 20 or newer (runs the project's own checker before a proof counts), notify-send (desktop alerts), Chromium and Xephyr (for browser-driven web chat verifiers), libdense's libdense_sched.so (a Python scheduler with the same behavior is used without it).

Quick start

Clone this repository (or unpack a release zip), then from its top directory:

bash scripts/install-host.sh      # checks the host; --apply installs what it can (Debian family)
make && make test                 # the canvas, and the tests (no desk, model or Lean needed)
gh auth login && gh auth setup-git
ollama pull qwen3.8:27b && ollama pull qwen2.5-coder:14b
bash scripts/start-worker.sh      # the worker, in tmux (Ctrl+b then d detaches)
bash scripts/start-canvas.sh      # the canvas, in a second terminal

The canvas opens on the Setup plate on the first run.

Setup

The Setup plate on a new installation

The left half holds the settings a new installation needs, grouped and explained (hover a setting for what it does). The right half checks the host and says, for each item, what is wrong and how to fix it:

  1. Fill from the GitHub CLI sets your handle (your GitHub login: the desk credits steps to it) and your noreply commit email, which keeps your address private on the public commit.
  2. Create the fork makes your fork of open-goat/pequalnp-proofs on GitHub. Proof branches are pushed there.
  3. Clone the project clones the project into the project clone folder (~/pequalnp-proofs by default) and fetches the Mathlib cache.
  4. Lean, Node.js, Ollama, the models and the sandbox are checked too.

Press Save after changing settings; they are written to config/dragonslayer.json. When the banner says READY, press Run. Press S at any time to come back to Setup.

Using it

Run (top bar, or Space) takes a step from the desk and keeps running rounds. Take step and Hard take one without running; Pause stops after the running action; Stop ends it now.

The step plate: the statement, the lease, the draft

The step plate shows the leased statement exactly as it must be proved, the lease clock, the desk's context, sketch and dead ends, and the current draft. The pipeline shows who serves each stage and how far the step has come; the rounds plate lists every round and what it established.

The pipeline

The rounds

When a candidate passes Lean, the project's checker and the verifiers, the alert band lights up (with a chime and a desktop notification). Open Controls, press Push to fork, run the gh pr create command it shows (Copy PR command puts it on the clipboard), then press Mark submitted. The verdict arrives as a comment on the pull request.

Controls: release, push, the pull request command

Models

The Agents plate holds the model registry: each model's roles (P planner, E executor, V verifier, F finalizer), priority, and numbers (calls, errors, latency percentiles, tokens, cost). Add a model by provider (Ollama, any OpenAI-compatible endpoint, Anthropic), or ask Ollama what it has.

The agents and their numbers

Local models pulls a GGUF model from Hugging Face into Ollama: paste a repository, list its quantizations (each says whether it fits your GPU), set the roles and context, and pull.

Pulling a model from Hugging Face

Web chats: a verifier can also be a chat site you are signed in to (claude.ai, chatgpt.com, venice.ai), driven in a browser on its own display. These entries are off by default. Driving a consumer chat page from a program may be against a service's terms: read them before you enable one, and prefer the service's API where it offers one. docs/WEB-CHAT.md explains the browser, the APIs and the by-hand relay.

The log

Every event of every session, searchable (plain, fuzzy or regular expression, with a case toggle), filtered by level; click a line to see all of it.

The log

Moving around

Key Plate
S Setup
1 The step
2 The pipeline
3 The rounds
4 The artifact (the selected round's file and evidence, the candidate, the notes)
5 The agents (models, web chats, local models)
6 Controls
7 The relay (a verifier you answer by hand)
8 The metrics (latency percentiles, the GPU, Ollama, the scheduler, totals)
9 The log
0 The overview

Drag to pan, wheel to zoom, click a plate to open it. Tab goes to the next plate, Space runs or pauses, Esc leaves a plate, F11 toggles fullscreen, Q quits the canvas (the worker keeps running).

Without the canvas

The worker runs without the canvas, and every control is a command:

cd python
python3 -m dragonslayer status --config ../config/dragonslayer.json
python3 -m dragonslayer cmd run --config ../config/dragonslayer.json
python3 -m dragonslayer cmd take_step hard=1 --config ../config/dragonslayer.json
python3 -m dragonslayer cmd release reason=missing_lemma --config ../config/dragonslayer.json
python3 -m dragonslayer cmd push --config ../config/dragonslayer.json
python3 -m dragonslayer cmd mark_submitted --config ../config/dragonslayer.json

Stop the worker with bash scripts/start-worker.sh --stop.

Limitations

  • One step at a time: the worker holds one step and runs one round at a time.
  • Reductions and search shards are not supported; a shard assignment is worked as an ordinary step.
  • Linux only: the sandbox needs Linux namespaces and Landlock.

User namespaces (Ubuntu 24.04 and later)

Ubuntu 24.04 restricts unprivileged user namespaces through AppArmor, so the sandbox cannot start (install-host.sh says "unshare -r -n refused", and Setup shows the sandbox in yellow). The worker still runs, but the commands models run would have your network and a writable home. Two ways to lift the restriction, both decisions for the machine's administrator:

  • for unshare only, with an AppArmor profile (note that this lets any user of the machine create user namespaces through unshare):

    printf 'abi <abi/4.0>,\ninclude <tunables/global>\nprofile unshare /usr/bin/unshare flags=(unconfined) {\n  userns,\n}\n' | sudo tee /etc/apparmor.d/unshare-userns
    sudo apparmor_parser -r /etc/apparmor.d/unshare-userns
  • or system-wide: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 (add it to a file in /etc/sysctl.d/ to keep it after a reboot).

Files

Where What
config/dragonslayer.json your settings (written from config/dragonslayer.example.json on the first start; Setup edits them)
config/models.json your model registry (from config/models.example.json; the Agents plate edits it)
~/.local/state/dense-dragonslayer/ the worker's state: snapshot.json, events.jsonl, commands/, jobs/, archive/<step>.zip (docs/PROTOCOL.md)
~/.config/dense-dragonslayer/camera.txt where the canvas camera was

Your two config files are not tracked by git, so git pull leaves them alone.

Project layout

Piece Language What it does
python/dragonslayer/ Python 3.10+, standard library only the worker: desk protocol, job directories, rounds, model providers, sandbox, Lean checks, publication, Setup, the state directory
src/app/, src/view/ C11, SDL3, FreeType, OpenGL the canvas: twelve plates on one zoomable world, reading the snapshot and writing commands
config/ JSON the example settings, the example model registry, the web chat site adapters
scripts/ shell, Python the host check, the tmux start scripts, the demo state and the screenshots, the release zip
tests/ Python, C the worker against a fake desk, fake models and a fake Lean (with the real sandbox and real git); the browser driver against a fake DevTools server; the canvas's command and snapshot code
skills/ Markdown instructions for an agent helping on a step by hand

Documentation

License

MIT, see LICENSE. Bundled third-party components (cJSON, the Liberation fonts) keep their own licenses: see THIRD_PARTY_NOTICES.md. The pequalnp-proofs project, Lean, Mathlib and the models you run have their own terms. dense-dragonslayer is an independent tool, not an official part of the pequalnp.com project.

About

Autonomous research harness for the pequalnp.com Lean 4 proof desk

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages