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