Part IV · AI-Native Verification & Transfer Ch 14 · 30 min · ProveIt/Ch14.lean

Spec-First Agentic Co-Design

Structuring `Spec.lean` vs `Impl.lean` so untrusted coding agents synthesize fast code and proofs at 10x speed safely.

5-Line Workflow Architecture · Who Owns What in AI Vericoding?
-- File 1 (Human-Owned, SHA-256 Locked in CI): `Spec.lean`
--   Defines domain types, reference semantics `specFn`, and `ValidInput`.
-- File 2 (Agent-Editable, Untrusted): `Impl.lean`
--   Defines optimized `implFn` + proves `impl_refines_spec` + `validInput_nonvacuous`.
Socratic Gate · Commit to a Prediction Unanswered · Locks on commit

Why should `Spec.lean` require BOTH a soundness theorem (`impl r = some y → Valid r y`) AND a completeness/liveness theorem (` Satisfiable r → (impl r).isSome`)?

The Vericoding Division of Labor

Humans are terrible at typing 200 lines of repetitive case-analysis tactics; LLMs are fast at tactic search and optimization synthesis, yet unreliable when allowed to invent their own acceptance criteria. Splitting every verified subsystem into a read-only Spec.lean (domain types + tiny reference function + soundness/completeness signature) and an agent-writable Impl.lean gives you AI velocity with mathematical certainty.

Feeding Stuck Infoview States Back to Agents

When Lean's language server or lake build reports an exact unresolved Infoview goal (x : Nat, h : x > 0 ⊢ ...), pasting that structured goal + our Chapter 07 3-Way Triage prompt (see the Reference AI Playbook) lets an agent repair leaf lemmas in 2–3 turns instead of hallucinating blind rewrites.

⊢ ProveIt/Ch14.lean · Soundness + Completeness Spec Contract
Step 1 / 1
Lean Infoview Open Goal
Hands-On Exercise (ProveIt/Ch14.lean):

In `ProveIt/Ch14.lean`, complete an `Impl` module against a locked `Spec` contract including soundness, completeness, and non-vacuity.

Finished the Socratic gate, Infoview trace, and playground run?
Record completion in local browser storage to track your 20-unit progress.