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
|
# GAP minimal reproduction package
This repository provides a one-item end-to-end reference implementation of
GAP: four surface-renaming families and one verified kernel variant. The
default kernel path executes the manuscript's five conceptual operations as
five typed, separately saved model calls.
## One-click reproduction
Open `GAP_End_to_End.ipynb` and choose **Run All**. The notebook:
1. installs the package;
2. loads one canonical Putnam problem;
3. generates the four surface variants;
4. constructs a concrete proof DAG whose nodes are intermediate claims;
5. abstracts one content-free method label per DAG node;
6. records guarded old/new replacements and propagates them node by node;
7. renders the diffused terminal claim into a new question and solution;
8. runs five judges until the unchanged full-provenance bundle receives two consecutive
unanimous rounds;
9. exports and validates one machine-readable GAP record.
The default model is `o3`. Set `OPENAI_API_KEY`, place
`OPENAI_API_KEY=...` in the gitignored `.env` file, or enter it in the
notebook's hidden prompt. The key is never written to run artifacts.
For a no-API software check:
```bash
GAP_OFFLINE_SMOKE=1 jupyter notebook GAP_End_to_End.ipynb
```
Offline smoke mode uses fixed responses. It validates pipeline wiring,
verification control flow, and release assembly; it does not assess generated
mathematics.
## Prompt fidelity
The consolidated Prompt-A/Prompt-B, surface-renaming prompts, and
review/repair prompts from `PutnamVariants@c3bed737` remain byte
pinned in `src/gap_pipeline/prompts.py`, `PROMPT_SHA256SUMS`, and
`tests/test_prompts.py`.
The default executable path uses the expanded stage prompts in
`src/gap_pipeline/kernel_prompts.py` to execute the five operations specified
in Section 3.2 and Appendix D.2 as separately auditable calls. The five judges
use the byte-pinned Appendix F.3 system and user templates verbatim. The
consolidated and expanded interfaces are both retained in source; the expanded
five-stage path is the reproduction entry point.
The OpenAI adapter does not send `temperature`; this is compatible with `o3`,
whose supported value is its default. See `STAGE_MAP.md` for the exact
paper-to-code map.
`ProofDAG` supports branching dependencies and validates topological order,
known dependencies, acyclicity, and terminal connectivity. Replacement plans
record the exact old/new value, source node, guard condition, and guard
justification. Diffusion must preserve every node ID, dependency, and method
label. Judges must cover every proof-node ID before their verdict counts.
## Install and test
```bash
python -m pip install -e '.[api,test]'
pytest
```
Without installation:
```bash
PYTHONPATH=src pytest
PYTHONPATH=src python -m gap_pipeline.cli --help
```
PowerShell equivalents:
```powershell
$env:PYTHONPATH = "src"
python -m pytest
python -m gap_pipeline.cli --help
```
## Live one-item commands
Generate the kernel variant:
```bash
export OPENAI_API_KEY=...
PYTHONPATH=src python -m gap_pipeline.cli generate-kernel \
--dataset examples/sample_data \
--item-id 1998-B-1 \
--run-dir runs/kernel \
--proposer-model o3 \
--judge-model o3
```
In PowerShell, use `$env:OPENAI_API_KEY = "..."` and backticks for line
continuation, or use the gitignored `.env` file through the notebook.
Generate all surface variants:
```bash
PYTHONPATH=src python -m gap_pipeline.cli generate-surfaces \
--dataset examples/sample_data \
--item-id 1998-B-1 \
--run-dir runs/surface \
--proposer-model o3
```
Assemble the final record:
```bash
PYTHONPATH=src python -m gap_pipeline.cli export-release \
--source-dataset examples/sample_data \
--surface-run-dir runs/surface \
--kernel-run-dir runs/kernel \
--output-root release \
--item-id 1998-B-1
```
## Verification protocol
Kernel verification uses `J=5` judges, requires `K=2` consecutive unanimous
rounds for the same complete provenance bundle, and allows at most `T=15`
rounds. A rejected round resets the streak and applies the judge feedback to
the previous bundle, rerunning stages 3--5 with an explicit minimal-repair
instruction. Every call, stage output, iteration, and final record is saved
under the chosen run directory.
## Scope
This package demonstrates and tests the complete one-item software path. The
same CLI and runner can be applied over additional item IDs to generate a
larger release.
|