Skip to content

Commit 8c93f55

Browse files
Add AD proof result import gate
1 parent 3a7312d commit 8c93f55

9 files changed

Lines changed: 749 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ edition = "2021"
55

66
[dependencies]
77
serde_json = "1"
8+
sha2 = "0.10"

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.PHONY: check fmt test validate eval gradient export-golden validate-proof-boundary doctor-proof-backend gate-proof-backend clean
1+
.PHONY: check fmt test validate eval gradient export-golden validate-proof-boundary doctor-proof-backend gate-proof-backend ad-proof-result validate-proof-result compare-proof-result gate-ad-proof-import clean
22

33
INPUTS=--input action_features=2.0 --input user_features=3.0 --const 1.0
44

5-
check: fmt test validate eval gradient export-golden validate-proof-boundary doctor-proof-backend gate-proof-backend
5+
check: fmt test validate eval gradient export-golden validate-proof-boundary doctor-proof-backend gate-proof-backend ad-proof-result validate-proof-result compare-proof-result gate-ad-proof-import
66

77
fmt:
88
cargo fmt --check
@@ -31,5 +31,17 @@ doctor-proof-backend:
3131
gate-proof-backend:
3232
! cargo run -- gate-proof-backend examples/proof-backend-boundary.valid.json target/gatl-ad-lab/proof-backend-environment.json --out target/gatl-ad-lab/proof-backend-activation-gate.json
3333

34+
ad-proof-result:
35+
cargo run --manifest-path ../gatl-ad-proof-backend/Cargo.toml -- check-fixture target/gatl-ad-lab/derivative-golden.json --proof-certificate ../gatl-ad-proof-backend/examples/proof-certificate.valid.json --out target/gatl-ad-lab/external-ad-proof-result.json --checked-at 2026-06-14T00:00:00Z
36+
37+
validate-proof-result:
38+
cargo run -- validate-proof-result target/gatl-ad-lab/external-ad-proof-result.json --out target/gatl-ad-lab/ad-proof-result-validation.json
39+
40+
compare-proof-result:
41+
cargo run -- compare-proof-result target/gatl-ad-lab/derivative-golden.json target/gatl-ad-lab/external-ad-proof-result.json --out target/gatl-ad-lab/ad-proof-result-comparison.json
42+
43+
gate-ad-proof-import:
44+
cargo run -- gate-ad-proof-import target/gatl-ad-lab/derivative-golden.json target/gatl-ad-lab/external-ad-proof-result.json --out target/gatl-ad-lab/ad-proof-import-gate.json
45+
3446
clean:
3547
rm -rf target

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ cargo run -- gate-proof-backend \
7272
examples/proof-backend-boundary.valid.json \
7373
target/gatl-ad-lab/proof-backend-environment.json \
7474
--out target/gatl-ad-lab/proof-backend-activation-gate.json
75+
cargo run -- validate-proof-result \
76+
target/gatl-ad-lab/external-ad-proof-result.json \
77+
--out target/gatl-ad-lab/ad-proof-result-validation.json
78+
cargo run -- compare-proof-result \
79+
target/gatl-ad-lab/derivative-golden.json \
80+
target/gatl-ad-lab/external-ad-proof-result.json \
81+
--out target/gatl-ad-lab/ad-proof-result-comparison.json
82+
cargo run -- gate-ad-proof-import \
83+
target/gatl-ad-lab/derivative-golden.json \
84+
target/gatl-ad-lab/external-ad-proof-result.json \
85+
--out target/gatl-ad-lab/ad-proof-import-gate.json
7586
```
7687

7788
Local example:
@@ -113,3 +124,10 @@ emits an external AD proof result. Without a local proof certificate it reports
113124
`gatl-ad-proof-backend/v0.1-proof-certificate` it can report `proved` under the
114125
backend's local certificate proof system. This still does not move proof
115126
assistant execution into `gatl-ad-lab`.
127+
128+
`validate-proof-result`, `compare-proof-result`, and `gate-ad-proof-import`
129+
consume an already-produced external AD proof result. The import gate opens
130+
only when the proof result is `proved`, `formalProof.proved = true`, the proof
131+
system is `gatl-local-ad-certificate/v0.1`, and the result's fixture content
132+
address matches the derivative golden fixture. These commands do not execute
133+
the proof backend.

docs/architecture.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ gatl-core risk-models.json
1717
-> optional derivative golden fixture for formal proof backends
1818
-> optional external proof backend boundary validation
1919
-> optional proof backend activation gate
20+
-> optional external AD proof result comparison
21+
-> optional AD proof import gate
2022
```
2123

2224
## Trusted Boundary
@@ -29,6 +31,7 @@ The v0.1 trusted boundary is:
2931
- local pullback rules for smooth scalar primitives;
3032
- central finite-difference comparison;
3133
- deterministic derivative golden fixture export.
34+
- deterministic external AD proof result import comparison.
3235

3336
The lab does not prove AD correctness. It provides an external executable
3437
sanity check and a report that future proof tooling can consume.
@@ -57,6 +60,12 @@ result artifact. A valid certificate can produce `formalProof.proved = true`
5760
inside that external backend's local proof system; `gatl-ad-lab` still does not
5861
run proof jobs or proof assistants.
5962

63+
`validate-proof-result`, `compare-proof-result`, and `gate-ad-proof-import`
64+
are the import side of the same boundary. They consume an already-produced
65+
`gatl-ad-lab/v0.1-external-ad-proof-result`, require `status = proved`,
66+
`formalProof.proved = true`, and bind the result to the derivative golden
67+
fixture by SHA-256 content address. They do not run the proof backend.
68+
6069
## Primitive Semantics
6170

6271
Supported scalar primitives:

docs/compatibility.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ risk-model artifacts.
88
| Input | Producer | Required format |
99
| --- | --- | --- |
1010
| Risk model analysis | `gatl-core risk-models` | `gatl-core/v0.1-risk-model-analysis` |
11+
| Derivative golden fixture | `gatl-ad-lab export-golden` | `gatl-ad-lab/v0.1-derivative-golden-fixture` |
12+
| External AD proof result | `gatl-ad-proof-backend` | `gatl-ad-lab/v0.1-external-ad-proof-result` |
1113

1214
## Produced Artifacts
1315

@@ -17,6 +19,9 @@ risk-model artifacts.
1719
| AD check report | `gatl-ad-lab/v0.1-ad-check-report` |
1820
| Derivative golden fixture | `gatl-ad-lab/v0.1-derivative-golden-fixture` |
1921
| External AD proof result placeholder | `gatl-ad-lab/v0.1-external-ad-proof-result` |
22+
| AD proof result validation | `gatl-ad-lab/v0.1-ad-proof-result-validation` |
23+
| AD proof result comparison | `gatl-ad-lab/v0.1-ad-proof-result-comparison` |
24+
| AD proof import gate | `gatl-ad-lab/v0.1-ad-proof-import-gate` |
2025
| Proof backend boundary validation | `gatl-ad-lab/v0.1-proof-backend-boundary-validation` |
2126
| Proof backend environment report | `gatl-ad-lab/v0.1-proof-backend-environment` |
2227
| Proof backend activation gate | `gatl-ad-lab/v0.1-proof-backend-activation-gate` |
@@ -28,8 +33,10 @@ evaluates the typed scalar expression, runs the exported reverse derivative
2833
instruction skeleton, compares the result with finite differences, and exports
2934
a derivative golden fixture for external formal proof backends. It also
3035
validates the proof backend boundary manifest, emits a local environment probe,
31-
and verifies that the activation gate remains closed when the external proof
32-
backend command is missing.
36+
verifies that the activation gate remains closed when the external proof
37+
backend command is missing, generates an external AD proof result through the
38+
separate `gatl-ad-proof-backend` repo, validates that result, compares it to
39+
the derivative golden fixture, and opens the AD proof import gate.
3340

3441
## Boundary
3542

@@ -41,3 +48,6 @@ The proof backend activation gate is only a readiness artifact for external
4148
deployment automation. It must be consumed by a separate production proof
4249
service before proof jobs run; `gatl-ad-lab` itself does not run the proof
4350
backend beyond an explicit `--version` probe.
51+
52+
The AD proof import gate is a result-consumption artifact. It only imports an
53+
already-produced proof result and requires a matching fixture content address.

docs/production-proof-backend-setup.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,31 @@ cargo run -- gate-proof-backend \
3030
examples/proof-backend-boundary.valid.json \
3131
target/production-probes/proof-backend-environment.after-backend.json \
3232
--out target/production-probes/proof-backend-activation-gate.after-backend.json
33+
cargo run --manifest-path ../gatl-ad-proof-backend/Cargo.toml -- check-fixture \
34+
target/production-probes/derivative-golden.actual.json \
35+
--proof-certificate ../gatl-ad-proof-backend/examples/proof-certificate.valid.json \
36+
--checked-at 2026-06-14T00:00:00Z \
37+
--out target/production-probes/external-ad-proof-result.after-certificate.json
38+
cargo run -- validate-proof-result \
39+
target/production-probes/external-ad-proof-result.after-certificate.json \
40+
--out target/production-probes/ad-proof-result-validation.after-certificate.json
41+
cargo run -- compare-proof-result \
42+
target/production-probes/derivative-golden.actual.json \
43+
target/production-probes/external-ad-proof-result.after-certificate.json \
44+
--out target/production-probes/ad-proof-result-comparison.after-certificate.json
45+
cargo run -- gate-ad-proof-import \
46+
target/production-probes/derivative-golden.actual.json \
47+
target/production-probes/external-ad-proof-result.after-certificate.json \
48+
--out target/production-probes/ad-proof-import-gate.after-certificate.json
3349
```
3450

3551
Expected result:
3652

3753
- boundary validation is valid;
3854
- backend environment is production-ready;
3955
- activation gate is open.
56+
- external AD proof result validation is valid;
57+
- AD proof import gate is open.
4058

4159
## Boundary
4260

@@ -47,3 +65,5 @@ without a certificate it remains `validated-not-proved`; with a valid
4765
`gatl-ad-proof-backend/v0.1-proof-certificate`, the external backend can emit a
4866
`proved` result under `gatl-local-ad-certificate/v0.1`. Production proof
4967
assistant execution remains outside `gatl-ad-lab`.
68+
The import commands consume the produced proof result, but do not execute the
69+
backend themselves.

0 commit comments

Comments
 (0)