Skip to content

Commit 5ec6593

Browse files
committed
docs: clarify Layer 1 vs contract spec proofs
1 parent 34a6b2b commit 5ec6593

13 files changed

Lines changed: 31 additions & 25 deletions

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ See [AXIOMS.md](AXIOMS.md) for current axioms and detailed guidelines.
283283

284284
## Key Files
285285

286-
- `Verity/` - EDSL, specs, Layer 1 proofs
286+
- `Verity/` - EDSL, user-facing specs, and contract-specific specification proofs
287287
- `Compiler/` - IR, Yul, codegen
288288
- `Compiler/Proofs/` - Layer 2 & 3 proofs
289289
- `docs/ROADMAP.md` - Progress tracking

Compiler/Proofs/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ See `TRUST_ASSUMPTIONS.md` for the full trust boundary.
77

88
## Verification Layers
99

10-
- **Layer 1: EDSL ≡ CompilationModel**. Contract-specific proofs live in
11-
`Contracts/<Name>/Proofs/`, with generic typed-IR compilation correctness in
12-
`Compiler/TypedIRCompilerCorrectness.lean`.
10+
- **Layer 1: EDSL ≡ CompilationModel**. This is the frontend semantic bridge.
11+
Contract-specific specification proofs live separately in
12+
`Contracts/<Name>/Proofs/`, while generic typed-IR compilation correctness
13+
lives in `Compiler/TypedIRCompilerCorrectness.lean`.
1314
- **Layer 2: CompilationModel -> IR**. The current proof surface is split:
1415
a generic supported-statement-fragment theorem lives in
1516
`Compiler/TypedIRCompilerCorrectness.lean` and

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ EVM Bytecode
9595
| 2 | Supported-statement CompilationModel → IR fragment is generic; full-contract bridges remain contract-specific | [SupportedFragment.lean](Compiler/Proofs/IRGeneration/SupportedFragment.lean) |
9696
| 3 | IR → Yul codegen preserves behavior | [Preservation.lean](Compiler/Proofs/YulGeneration/Preservation.lean) |
9797

98-
Layer 3 is generically verified with 1 documented axiom (the selector axiom). Layer 2 currently combines a generic supported-statement theorem with contract-specific full-contract bridges. See [docs/VERIFICATION_STATUS.md](docs/VERIFICATION_STATUS.md) and [AXIOMS.md](AXIOMS.md).
98+
Layer 1 is the frontend EDSL-to-`CompilationModel` bridge. The per-contract files in `Contracts/<Name>/Proofs/` prove human-readable contract specifications; they are not what “Layer 1” means in the compiler stack. Layer 3 is generically verified with 1 documented axiom (the selector axiom). Layer 2 currently combines a generic supported-statement theorem with contract-specific full-contract bridges. See [docs/VERIFICATION_STATUS.md](docs/VERIFICATION_STATUS.md) and [AXIOMS.md](AXIOMS.md).
9999

100100
### 5. Test the compiled output (belt and suspenders)
101101

TRUST_ASSUMPTIONS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Layer 1 and Layer 3 have generic proof surfaces in Lean. Layer 2 currently combi
2020

2121
## What's Verified
2222

23-
- **Layer 1**: EDSL behavior matches its CompilationModel. For supported contracts, a generic typed-IR compilation-correctness theorem eliminates per-contract manual proofs.
24-
- **Layer 2**: a supported statement-list CompilationModel → IR theorem exists, but whole-contract Layer 2 preservation still relies on contract-specific bridge theorems.
23+
- **Layer 1**: EDSL behavior matches its `CompilationModel`. This names the frontend semantic bridge only; it does not refer to the contract-specific specification theorems in `Contracts/<Name>/Proofs/`. For supported contracts, macro-generated bridge theorems and the typed-IR correctness path discharge this boundary.
24+
- **Layer 2**: a supported statement-list `CompilationModel → IR` theorem exists, but whole-contract Layer 2 preservation still relies on contract-specific bridge theorems.
2525
- **Layer 3**: IR → Yul preserves behavior, with 1 documented axiom (keccak256 selector).
2626
- **Cross-layer**: `Contracts/Proofs/SemanticBridge.lean` provides the active contract-specific Layer 2 bridge surface; `Compiler/Proofs/EndToEnd.lean` composes that current Layer 2 boundary with Layer 3.
2727

docs-site/content/add-contract.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This creates 7 scaffold files (EDSL, Spec, Invariants, Proofs re-export shim, Ba
4444
- Implement contract logic in `Verity/Examples/<Name>.lean`
4545
- Reuse helper lemmas for storage updates and mapping reads
4646

47-
3. **Layer 1 Proofs**
47+
3. **Contract Specification Proofs**
4848
- Prove correctness in `Verity/Proofs/<Name>/Basic.lean` and `Correctness.lean`
4949
- Each theorem states observable behavior (return values + storage deltas)
5050

@@ -74,7 +74,7 @@ Verity/Specs/<Name>/
7474
7575
Verity/Examples/<Name>.lean # EDSL implementation
7676
Verity/Proofs/<Name>/
77-
├── Basic.lean # Basic correctness proofs (Layer 1)
77+
├── Basic.lean # Basic contract-spec correctness proofs
7878
└── Correctness.lean # Advanced correctness proofs
7979
Compiler/TypedIRCompilerCorrectness.lean # Generic compilation correctness (shared)
8080
test/Differential<Name>.t.sol # Differential tests

docs-site/content/compiler.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ Important: Verity has two different "spec" concepts.
2929
## Trust Model
3030

3131
### What's Verified (Zero Trust Required)
32-
- **Layer 1 per contract**: EDSL behavior is proven equivalent to its `CompilationModel`.
32+
- **Layer 1 frontend bridge**: EDSL behavior is proven equivalent to its `CompilationModel`.
3333
- **Layer 2 boundary today**: a supported-statement `CompilationModel -> IR` theorem exists, but full-contract Layer 2 preservation still relies on contract-specific bridge theorems.
3434
- **Layer 3 framework proof**: `IR -> Yul` preserves semantics.
3535
- **Machine-checked proofs**: see [VERIFICATION_STATUS.md](https://github.com/Th0rgal/verity/blob/main/docs/VERIFICATION_STATUS.md) for the current proof-status snapshot and [AXIOMS.md](https://github.com/Th0rgal/verity/blob/main/AXIOMS.md) for documented axioms.
3636
- **Interpreter semantics**: Spec, IR, and Yul semantics defined and linked in Lean
3737

38+
The per-contract files in `Contracts/<Name>/Proofs/` are separate contract-specification proofs. They show that a given contract satisfies its human-readable spec; they are not the definition of Layer 1 in the compiler stack.
39+
3840
### What's Tested (High Confidence)
3941
- **Compilation correctness**: Foundry unit and differential tests cover compiled contracts
4042
- **Output validation**: Generated Yul is exercised against expected runtime behavior

docs-site/content/guides/first-contract.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ If successful, the `#eval` block evaluates and prints `some 100`.
250250

251251
This is where formal verification happens. We prove that our implementation matches our specification.
252252

253-
### 4.1 Write Layer 1 Proofs
253+
### 4.1 Write Contract Specification Proofs
254254

255255
Open `Verity/Proofs/TipJar/Basic.lean`:
256256

docs-site/content/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The Lean compiler verifies every proof. If a proof is wrong, compilation fails.
8080

8181
- **User-facing specs**: `Verity/Specs/<Name>/Spec.lean` (+ `Invariants.lean`)
8282
- **Implementations (EDSL)**: `Verity/Examples/<Name>.lean`
83-
- **Layer 1 proofs (EDSL correctness)**: `Verity/Proofs/<Name>/Basic.lean` + `Correctness.lean`
83+
- **Contract-specific specification proofs**: `Verity/Proofs/<Name>/Basic.lean` + `Correctness.lean`
8484
- **Compilation correctness**: `Compiler/TypedIRCompilerCorrectness.lean` (generic typed-IR theorem) + `Contracts/Proofs/SemanticBridge.lean` (current contract bridge layer)
8585
- **Reusable proof infrastructure**: `Verity/Proofs/Stdlib/` (spec interpreter + automation)
8686
- **Compiler specs (for codegen)**: `Compiler/Specs.lean` (separate from user specs)
@@ -99,6 +99,8 @@ Use `python3 scripts/generate_contract.py <Name>` to scaffold all boilerplate fi
9999

100100
See [Add a Contract](/add-contract) for the full guide.
101101

102+
In this repo, “Layer 1” refers specifically to the EDSL-to-`CompilationModel` semantic bridge in the compiler pipeline. The files under `Verity/Proofs/<Name>/` are contract-level specification proofs.
103+
102104
## Example Contracts
103105

104106
Eight contracts are formally verified (plus one unverified linker demo):

docs-site/content/research.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The project evolved in two phases:
1919

2020
This is the single source of truth for progress, roadmap, and milestone updates.
2121

22-
- **Layer 1 (Spec Correctness)**: Complete for all 8 verified contracts (7 compiler-spec contracts + ReentrancyExample).
22+
- **Contract-specific specification proofs**: Complete for all 8 verified contracts (7 compiler-spec contracts + ReentrancyExample).
2323
- **Layer 2 (CompilationModel → IR)**: Partial generic coverage only. A supported-statement theorem exists, while whole-contract preservation still relies on contract-specific bridges and the generic `CompilationModel.compile` theorem is tracked in [#1510](https://github.com/Th0rgal/verity/issues/1510).
2424
- **Layer 3 (IR → Yul)**: Complete — all 8 statement equivalence proofs + universal dispatcher proven (PR #42).
2525

@@ -102,8 +102,8 @@ Each contract has:
102102
- `Verity/Examples/X.lean` — Implementation (EDSL)
103103
- `Verity/Specs/X/Spec.lean` — Pre/postconditions for each operation
104104
- `Verity/Specs/X/Invariants.lean` — State properties that should hold
105-
- `Verity/Proofs/X/Basic.lean`Layer 1: Spec conformance, basic properties
106-
- `Verity/Proofs/X/Correctness.lean`Layer 1: Revert proofs, composition, end-to-end
105+
- `Verity/Proofs/X/Basic.lean`Contract-specific spec conformance and basic properties
106+
- `Verity/Proofs/X/Correctness.lean`Contract-specific revert proofs, composition, and end-to-end properties
107107
- `Compiler/TypedIRCompilerCorrectness.lean` — Compilation correctness (generic theorem, 36 supported fragments)
108108

109109
Some contracts have additional proof files:

docs-site/content/verification.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ Verity/
4545
├── Specs/{Contract}/
4646
│ ├── Spec.lean # What each operation should do
4747
│ └── Invariants.lean # Properties that should always hold
48-
│ └── Proofs.lean # User-facing proofs (spec → impl)
48+
│ └── Proofs.lean # User-facing spec statements and re-exports
4949
├── Proofs/Stdlib/ # Reusable proof infrastructure
5050
└── Proofs/{Contract}/ # Deeper contract proof suites
51-
├── Basic.lean # Core properties and lemmas
52-
├── Correctness.lean # Composition and revert behavior
51+
├── Basic.lean # Contract-specific spec conformance and lemmas
52+
├── Correctness.lean # Contract-specific composition and revert behavior
5353
├── Conservation.lean # Sum conservation laws (Ledger)
5454
├── Supply.lean # Supply conservation (SimpleToken)
5555
└── Isolation.lean # Storage isolation (SimpleToken)

0 commit comments

Comments
 (0)