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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# lean-llm-starter
|
| 2 |
+
|
| 3 |
+
A deterministic Lean 4 verification harness that treats the LLM as an untrusted proposal engine and Lean 4 as the trusted kernel.
|
| 4 |
+
|
| 5 |
+
## Architecture
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
operator intent
|
| 9 |
+
-> Prolog gate
|
| 10 |
+
-> Granite 4.1 / Llemma inference
|
| 11 |
+
-> schema validation
|
| 12 |
+
-> Lean 4 parse / verify
|
| 13 |
+
-> WORM-ready audit artifacts
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
Trust split:
|
| 17 |
+
|
| 18 |
+
- `inference/` proposes proof artifacts
|
| 19 |
+
- `logic/` blocks unauthorized or malformed runs
|
| 20 |
+
- `lean4/` type-checks and verifies
|
| 21 |
+
- `infra/verification-loop/` pins deterministic execution
|
| 22 |
+
- `eval/` runs reproducible local benchmarks
|
| 23 |
+
|
| 24 |
+
## Repo Layout
|
| 25 |
+
|
| 26 |
+
```text
|
| 27 |
+
lean-llm-starter/
|
| 28 |
+
├── .github/workflows/ci.yml
|
| 29 |
+
├── .gitattributes
|
| 30 |
+
├── .gitignore
|
| 31 |
+
├── LICENSE
|
| 32 |
+
├── Makefile
|
| 33 |
+
├── README.md
|
| 34 |
+
├── docker-compose.yml
|
| 35 |
+
├── docs/
|
| 36 |
+
│ ├── HUGGINGFACE_PUBLISHING.md
|
| 37 |
+
│ └── REPO_MAP.md
|
| 38 |
+
├── eval/
|
| 39 |
+
│ ├── requirements.txt
|
| 40 |
+
│ └── run_minif2f.py
|
| 41 |
+
├── fixtures/
|
| 42 |
+
│ └── sample_input.jsonl
|
| 43 |
+
├── inference/
|
| 44 |
+
│ ├── Dockerfile
|
| 45 |
+
│ ├── requirements.txt
|
| 46 |
+
│ ├── prompt.txt
|
| 47 |
+
│ └── server.py
|
| 48 |
+
├── infra/
|
| 49 |
+
│ └── verification-loop/
|
| 50 |
+
│ ├── .env.example
|
| 51 |
+
│ └── docker-compose.yml
|
| 52 |
+
├── lean4/
|
| 53 |
+
│ ├── lakefile.toml
|
| 54 |
+
│ ├── lean-toolchain
|
| 55 |
+
│ ├── MiniF2F.lean
|
| 56 |
+
│ ├── VerifyMain.lean
|
| 57 |
+
│ └── src/
|
| 58 |
+
│ └── SovereignCorpus/
|
| 59 |
+
│ ├── Bridge/
|
| 60 |
+
│ │ ├── Granite4Parser.lean
|
| 61 |
+
│ │ └── Granite4Schema.lean
|
| 62 |
+
│ ├── Core.lean
|
| 63 |
+
│ └── Tactics/
|
| 64 |
+
│ └── PlasmaGate.lean
|
| 65 |
+
├── logic/
|
| 66 |
+
│ ├── sovereign_verification.pl
|
| 67 |
+
│ └── verification_loop.pl
|
| 68 |
+
└── hf/
|
| 69 |
+
└── README.md
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## What This Starter Includes
|
| 73 |
+
|
| 74 |
+
- Lean 4 harness skeleton
|
| 75 |
+
- Granite 4.1 JSON interchange schema
|
| 76 |
+
- Lean-side parser scaffold
|
| 77 |
+
- Prolog gate and retry loop scaffold
|
| 78 |
+
- vLLM / docker compose verification loop
|
| 79 |
+
- MiniF2F-style eval harness
|
| 80 |
+
- GitHub Actions CI scaffold
|
| 81 |
+
- Hugging Face publishing docs and model card template
|
| 82 |
+
- sample JSONL parse fixture
|
| 83 |
+
|
| 84 |
+
## What It Does Not Pretend Yet
|
| 85 |
+
|
| 86 |
+
- not fully air-gapped out of the box
|
| 87 |
+
- not fully air-gapped out of the box
|
| 88 |
+
- not a finished proof search system
|
| 89 |
+
- not yet shipping weights
|
| 90 |
+
|
| 91 |
+
Current verified state:
|
| 92 |
+
|
| 93 |
+
- Lean 4 project builds successfully on this machine with `C:\Users\jessi\.elan\bin\lake.exe`
|
| 94 |
+
- Python eval and inference files compile
|
| 95 |
+
- parse-mode fixture is present
|
| 96 |
+
|
| 97 |
+
This is a scaffold you can harden into:
|
| 98 |
+
|
| 99 |
+
- a GitHub repo
|
| 100 |
+
- a Hugging Face model or Space companion repo
|
| 101 |
+
- a deterministic local verification loop
|
| 102 |
+
|
| 103 |
+
## Quick Start
|
| 104 |
+
|
| 105 |
+
If `lake` is not on your PATH on Windows, use:
|
| 106 |
+
|
| 107 |
+
```powershell
|
| 108 |
+
C:\Users\jessi\.elan\bin\lake.exe
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### 1. Lean side
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
cd lean4
|
| 115 |
+
C:\Users\jessi\.elan\bin\lake.exe update
|
| 116 |
+
C:\Users\jessi\.elan\bin\lake.exe build
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
### 2. Inference side
|
| 120 |
+
|
| 121 |
+
```bash
|
| 122 |
+
cd inference
|
| 123 |
+
docker build -t lean-llm-inference .
|
| 124 |
+
docker run -d -p 8080:8080 --name lean-llm-inference lean-llm-inference
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
### 3. Eval side
|
| 128 |
+
|
| 129 |
+
```bash
|
| 130 |
+
cd eval
|
| 131 |
+
pip install -r requirements.txt
|
| 132 |
+
python run_minif2f.py
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
### 4. Full verification loop
|
| 136 |
+
|
| 137 |
+
```bash
|
| 138 |
+
docker compose --env-file infra/verification-loop/.env.example up -d granite-verifier
|
| 139 |
+
swipl -g "verify_with_retries('theorem demo : True := by trivial', 'ED25519_SIG', 3, Result), writeln(Result), halt" logic/verification_loop.pl
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### 5. Shortcut targets
|
| 143 |
+
|
| 144 |
+
```bash
|
| 145 |
+
make lean-build
|
| 146 |
+
make infra-up
|
| 147 |
+
make eval
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
### 6. Parse smoke test
|
| 151 |
+
|
| 152 |
+
```bash
|
| 153 |
+
cd lean4
|
| 154 |
+
C:\Users\jessi\.elan\bin\lake.exe exe verify -- --parse ../fixtures/sample_input.jsonl
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
## Hugging Face Readiness
|
| 158 |
+
|
| 159 |
+
This repo is prepared for later Hugging Face publication with:
|
| 160 |
+
|
| 161 |
+
- `.gitattributes` for LFS-managed weight files
|
| 162 |
+
- `hf/README.md` model card template
|
| 163 |
+
- `docs/HUGGINGFACE_PUBLISHING.md` publish checklist
|
| 164 |
+
|
| 165 |
+
Recommended publish modes:
|
| 166 |
+
|
| 167 |
+
1. code-only harness repo
|
| 168 |
+
2. model repo for GGUF / safetensors
|
| 169 |
+
3. Space repo for interactive verify loop UI
|