Skip to main content

Audit protocol — running the gates

ATS-V's compile-time machinery emits diagnostics; the audit protocol is the runtime workflow that converts those diagnostics into archival reports suitable for sign-off. The protocol revolves around a single CLI surface (verum audit ...) with a small set of gates that compose into a top-level bundle aggregator.

This page documents:

  1. The catalog of audit gates and what each one verifies.
  2. The bundle aggregator and the scope of its evidence.
  3. How to read the JSON outputs, archive them, and integrate them into CI.
  4. The dual verdict surface (developer-facing summary + auditor- facing detail).

0. Termination through declared Purpose​

A naïve audit has no built-in termination criterion: every inspection might reveal a refinement, and the protocol drifts into infinite polishing. Per CVE — audit termination via declared Purpose, the audit closes relative to the declared purpose of each artefact: the role for which it is built, with explicit thresholds on the K/V/E axes.

The Verum-side Shape.declarations.purpose: Maybe<Purpose> carries this declaration:

@arch_module(
lifecycle: Lifecycle.Theorem("v1.0"),
declarations: ShapeDeclarations {
purpose: Some(Purpose {
role: "payment.checkout fan-out router",
k_min: CveThresholdK.FullWitness,
v_min: CveThresholdV.TypecheckPlusTests,
e_min: CveThresholdE.StructurallyReady,
}),
substrate: Some(CognitiveSubstrate.AnalyticDecompositional),
anchoring: Some(FormalAnchoring.CurryHowardLawvere),
e_sense: Some(ExecutabilitySense.StructuralReadiness),
},
)
module my_app.payment.checkout;

The audit is complete when every artefact's configuration meets its declared thresholds. Strict-mode invocation against a Shape with no declared Purpose is the canonical AP-037 BoundlessAudit register collision: the audit has no termination criterion and degenerates into perennial critique.

Four functions of every audit round (per CVE — audit termination via declared Purpose):

  1. Differentiating — determines on which axis the artefact is closed and on which it is not.
  2. Goal-directing — compares observed configuration against declared thresholds.
  3. Translating — converts observed defects into one of the three actions: replenish (Action A), downgrade (Action B), delete (Action C).
  4. Terminating — issues "audit complete" or "another round needed" verdict.

The fourth function is what distinguishes audit from perennial critique. Without an explicit terminating function, the first three run idle.

1. The catalog of audit gates — verum audit​

verum audit exposes the gates as flags. Each flag runs exactly one gate; combinations are explicit. As of the current revision the catalog has ~45 gates organised into eight bands:

1.1 Kernel-soundness band​

FlagVerifiesOutput
--kernel-rulesThe trusted-base inference rule list (one row per rule with citation)kernel-rules.json
--kernel-recheckRe-checks every theorem in the project against the trusted basekernel-recheck.json
--kernel-soundnessPer-rule discharge inventory + parallel Coq / Lean / Isabelle exportkernel-soundness/ (multi-file)
--kernel-v0-rosterThe kernel_v0 Verum-self-hosted manifest vs filesystemkernel-v0-roster.json
--kernel-intrinsicsKernel intrinsic registry — every kernel_* dispatch entrykernel-intrinsics.json
--kernel-discharged-axiomsIntrinsic evidence inventory; structural status and zero proof dischargeskernel-discharged-axioms.json
--differential-kernelTwo-kernel agreement (trusted base vs NbE)differential-kernel.json
--differential-kernel-fuzzMutation property fuzzer over the kernel registrydifferential-kernel-fuzz.json
--reflection-towerDeclared footprints and finite reflection diagnostics, without theorem replayreflection-tower.json
--codegen-attestationPer-pass codegen kernel-discharge status (6 codegen passes)codegen-attestation.json

1.2 ATS-V (architectural-types) band​

FlagVerifiesOutput
--arch-dischargesThe 40-pattern anti-pattern catalogarch-discharges.json
--arch-coverageAnnotation density + missing-Shape reportarch-coverage.json
--arch-corpusPer-Lifecycle inventory of annotated cogsarch-corpus.json
--counterfactualNon-destructive scenario battery over Shapescounterfactual.json
--adjunctionsArchitectural adjunction detection (4 canonical pairs)adjunctions.json
--yonedaYoneda-equivalence checker per spec §20.7yoneda.json

1.3 Framework-axiom + citation band​

FlagVerifiesOutput
--framework-axiomsCitation roster — every @framework(name, "...") markerframework-axioms.json
--framework-conflictsDetect citation pairs whose proofs are mutually inconsistentframework-conflicts.json
--framework-soundnessCorpus-side citation metadata classifier; references do not certify proofsframework-soundness.json
--foundation-profilesFoundation-by-cog inventory (ZFC / HoTT / Cubical / Cic / MLTT / Eff / Custom)foundation-profiles.json
--accessibility@accessibility(λ) Diakrisis Axi-4 marker enumerationaccessibility.json
--soundness-iouOutstanding "admitted" lemmas + IOU manifestsoundness-iou.json
--dependent-theorems <axiom>Apply-graph walker for downstream theorem impactdependent-theorems-<axiom>.json
--apply-graphDependency resolution, separately reported unverified theorem obligationsapply-graph.json
--bridge-dischargeDiakrisis-bridge @effect(...) marker dischargebridge-discharge.json
--bridge-admitsBridge-marker admits + their citation IOUsbridge-admits.json

1.4 Hygiene + coherence band​

FlagVerifiesOutput
--hygieneArticulation-hygiene check: every self-X factorises as (Φ, κ, t)hygiene.json
--hygiene-strictStrict-mode hygiene; warnings promoted to errorshygiene-strict.json
--coordMSFS coord enumeration per cog (Foundation × Stratum)coord.json
--coord-consistencyCross-cog MSFS-coord consistency (M4.B; supremum-of-cited-coords gate)coord-consistency.json
--no-coordCogs missing MSFS-coord declarationsno-coord.json
--coherentOperational coherence (M4.E): α/ε bidirectional certificate verdictscoherent.json
--epsilonε-side enactment audit (Diakrisis 108.T duality)epsilon.json
--proof-honestySyntactic proof-body classification; no proof replayproof-honesty.json

1.5 Cross-format + export band​

FlagVerifiesOutput
--round-tripLean / Coq / Dedukti / Metamath / Isabelle proof-export round-tripround-trip.json
--cross-formatCross-format coverage matrix (which proofs export to which prover)cross-format.json
--owl2-classifyOWL 2 FS ontology classification graph for the corpusowl2-classify.json

1.6 Roadmap / coverage band​

FlagVerifiesOutput
--htt-roadmapLurie HTT mechanisation roadmap statushtt-roadmap.json
--ar-roadmapArnold-Stability mechanisation roadmap statusar-roadmap.json
--manifest-coverageManifest-vs-filesystem coverage per kernel-component manifestmanifest-coverage.json
--mls-coverageMSFS-corpus coverage classificationmls-coverage.json
--verify-ladderPer-cog verification-strategy ladder enumerationverify-ladder.json
--ladder-monotonicityThe ν-ordinal monotonicity check on the verify ladderladder-monotonicity.json

1.7 Tooling-side band​

FlagVerifiesOutput
--proof-term-libraryInventory of canonical proof-term examplesproof-term-library.json
--signaturesCross-format-roundtrip signatures auditsignatures.json
--dockerContainer-image reproducibility checkdocker.json

1.8 Aggregator​

FlagVerifiesOutput
--bundleCurrent gate execution diagnostics with run and executable identity; no aggregate proof claimbundle.json

Run-bound receipts have distinct invocation identities even when inputs are unchanged. Deterministic semantic outcomes do not make two executions the same run.

2. The bundle aggregator​

verum audit --bundle orchestrates configured audit gates and records their execution outcomes under a fresh run ID and executable hash. It does not import legacy report files, whose inputs and invocation are unbound. checks_passed reports configured gate execution; l4_load_bearing is false. The bundle is not proof evidence or an implicit replay of every theorem in a repository. See native replay for exact-run proof receipts.

The meaning of success is specific to each gate. Dependency resolution, metadata consistency, finite diagnostic samples, and certificate replay answer different questions. A positive result in one does not discharge an unverified obligation in another. VerificationVerdict::StructuralOnly keeps that distinction during verdict aggregation.

For a proof-admission workflow, archive the exact source statement, its explicit assumptions, the elaboration receipt and the native certificate result. A green architectural audit or successful external compilation of a generated scaffold cannot replace those artifacts.

3. Gate-by-gate semantics​

3.1 --arch-discharges — the catalog gate​

Runs every entry in the 40-pattern catalog against every annotated cog. Verdict per pattern:

  • ok — no occurrences in the project.
  • violations — at least one occurrence; the JSON lists each.
  • suppressed — pattern was suppressed via @suppress(...) with a documented rationale.

Severity respects per-project overrides in verum.toml. An error-severity violation fails the gate; warning and hint do not (but are reported).

3.2 --counterfactual — non-destructive scenario battery​

The counterfactual gate runs a synthetic battery covering every canonical ArchProposition cross-product with the 11-metric baseline ArchMetric set. Each battery entry asks:

Given this Shape, if we change one primitive, does the invariant still hold?

The gate verdict is stable when every battery entry returns HoldsBoth (the invariant holds in both base and counterfactual). A HoldsBaseOnly entry indicates a fragile invariant — it holds today but would break under the counterfactual change. A HoldsNeither entry indicates the invariant is fundamentally unstable — the gate fails.

The output JSON carries each battery entry's InvariantStatus (four arms: HoldsBoth / HoldsBaseOnly / HoldsVarOnly / HoldsNeither) so auditors can spot fragile invariants without re-running the gate.

3.3 --differential-kernel — two-kernel agreement​

Runs the canonical certificate battery through distinct checking implementations. The substitution and normalization paths are:

  1. The trusted-base kernel (verum_kernel::proof_checker), the LCF-style implementation Verum considers authoritative.
  2. The NbE kernel (verum_kernel::proof_checker_nbe), an independent normalisation-by-evaluation implementation written to a different algorithmic specification.

Per rule, the gate reports:

  • BothAccept — both kernels admit the certificate. ✓
  • BothReject — both kernels reject. ✓ (intentional negative)
  • Disagreement — kernels disagree. ✗ — fails the gate; indicates a kernel-implementation bug.
  • NotYetSelfHosting — observability only; one kernel has no certificate to check (transitional).

Agreement concerns the supplied certificates. It does not mean that every source theorem was elaborated and checked, and does not constitute a proof of the checkers' own soundness. A disagreement fails the audit.

3.4 --differential-kernel-fuzz — mutation property fuzzing​

Layered atop --differential-kernel. Takes the canonical- certificate roster, applies an 11-variant mutation grammar (universe lifts, subterm swaps, binder rewrites, application injections, ...), and runs every mutant through every kernel. The property invariant: every mutant produces unanimous agreement between kernels. Any disagreement is a kernel bug.

The campaign is bounded (default 500 iterations, deterministic xorshift64* seed) so disagreements are reproducible across runs.

3.5 --reflection-tower — structural diagnostics​

Inspects the model's four named stages: Base, StableUnderUniverseAscent, BoundedByOneInaccessible and AbsoluteBoundaryEmpty. Their data consists of declared rule footprints, finite witness samples and citations.

The report carries proof_status: "structural_only" and load_bearing: false. Positive stage and sample counts remain available as diagnostics; both proof-discharge counts are zero. The command returns nonzero because no proof of the named mathematical obligations was replayed.

Comparing declared cardinal indices does not establish a consistency bound. Checking finitely many universe indices does not establish universal stabilisation. See Reflection tower for the full field contract.

3.6 --codegen-attestation — per-pass discharge status​

Verum's codegen pipeline is a chain of passes (VBC lowering, SSA construction, register allocation, linear-scan reg-alloc, LLVM emission, machine-code emission). Each pass has a published soundness invariant (e.g., "register allocation preserves program semantics"). The codegen-attestation gate reports per pass:

  • Discharged — the invariant has a published proof internal to Verum.
  • AdmittedWithIou — the invariant is admitted with a citation to a published external proof (CompCert, Vellvm, CompCertELF, ...).
  • NotYetAttested — the invariant is "trusted by code review only" — no published or admitted proof yet.

Verum's V0 baseline is AdmittedWithIou for every pass; the discharge work is a multi-year project that flips entries individually.

3.7 --framework-axioms — citation roster​

Walks every @framework(name, "citation") marker on axioms, theorems, and lemmas; groups by framework; emits the structured inventory. This is the project's external trust boundary.

Auditors reading the inventory should be able to enumerate, by citation, exactly which external corpora the project's proof soundness depends on. There is no implicit framework axiom — a proof that uses an uncited classical axiom (e.g., AC, LEM) triggers AP-014 UndisclosedDependency.

3.8 --kernel-soundness — external rule models​

Emits rule-model files under target/audit-reports/kernel-soundness/. These models and their assumptions must be reviewed separately. An external assistant accepting a generated definition or axiomatization does not prove that it faithfully represents Verum's implementation or a source theorem. This audit is distinct from the public verum export command, which rejects unsupported foreign theorem exports. See Proof export.

4. JSON schema​

Schema versions belong to individual report types. Consumers must dispatch on the report kind and its supported version, not assume that all audit commands share one schema.

ReportVersionProof-authority fields
--proof-honesty1Syntactic classification only; no proof replay result.
--kernel-discharged-axioms3proof_status, citation_count, discharge_count, evidence_breakdown.
--reflection-tower4proof_status, load_bearing, structurally_consistent, positive diagnostic counts and separate zero discharge counts.

The apply-graph report exposes dependencies_resolved for each theorem separately from proof_status and the unverified_theorems total. Unknown schemas require an explicit adapter; do not silently interpret missing proof status as successful certification.

For intrinsic reports, computed, cited and needs_structural_args describe evidence origin. For reflection reports, diagnostic_holds describes an observation and discharges: false states its proof limit. Preserve these distinctions in dashboards and archives.

5. CI integration​

A typical CI pipeline runs verum audit --bundle on every PR and on the main branch's tip:

# .github/workflows/ats-v-audit.yml
name: ATS-V audit

on: [push, pull_request]

jobs:
bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install verum-cli
- run: verum audit --bundle
- uses: actions/upload-artifact@v4
with:
name: audit-reports
path: target/audit-reports/

Two patterns worth establishing:

  1. Archive every bundle.json on main. The bundle.json files form the project's audit chronicle — a chronologically-ordered record of every revision's verdict. Auditors review the chronicle, not just the latest snapshot.
  2. Diff per-gate verdicts across PRs. A PR that flips arch-discharges from ok to violations is more informative than the absolute count of violations. The CI should surface deltas.

6. The dual verdict surface​

Plain output gives a concise developer summary; JSON preserves detailed observations for review and archival. Both must retain the scope of the result. A user interface must not turn structural_only into a verified badge merely because all diagnostic flags are positive.

7. What "load-bearing" means​

Interpret load_bearing under the contract of the report that produced it. An architectural consistency check is not a proof of every theorem in the project. A successful native replay establishes a particular formal judgment under its declared assumptions; source correspondence is a separate part of source-level certification.

The intrinsic, reflection and apply-graph audits do not carry the proof terms needed for their named mathematical obligations. Their structural observations remain useful, but cannot acquire proof authority through a bundle summary, a citation, or a successful check of a different statement.

8. Liveness pins — the audit's audit​

A natural question: "how do I know the audit gates are not silently passing?" Verum's answer is liveness pins — synthetic inputs designed to fail the gate. Every gate ships with at least one liveness pin:

  • The differential-kernel gate has a synthetic always-accept kernel registered alongside the real ones. The gate's invariant is that the synthetic kernel will disagree with the real ones on rejected certificates; if the gate ever reports "no disagreements" with the synthetic in the registry, the gate itself has a bug.

These negative controls detect silent acceptance and broken diagnostics in the exercised cases. They strengthen the test evidence but do not constitute a proof of checker soundness or certify untested corpus declarations.

9. Adversarial diagnostic intrinsics​

The intrinsic registry includes checks addressing attack patterns on the ATS-V declarative surface. Their results are structural diagnostics, not proofs of the annotated axiom declarations. See adversarial threat modelling for the attack catalog:

IntrinsicPatternDiagnostic purpose
kernel_arch_capability_ontology_checkAT-1Every Capability.CustomCapability(tag) must have its tag registered before passing the ATS-V phase. Blocks injection of fake high-privilege capabilities.
kernel_arch_theorem_cve_requiredAT-2Lifecycle.Theorem(...) requires full CVE-closure regardless of the strict flag — Theorem-status semantically implies CVE+.
kernel_arch_yoneda_canonical_roster_completeAT-3A Yoneda equivalence verdict is binding only when the agreements list spans the full canonical 5-roster. Blocks single-observer fabrication.
kernel_arch_consumes_format_checkAT-5consumes field entries must match <resource>/<positive_int> <unit>. Format violations surface as AP-025 DeclarationDrift.

AT-4 (composition path traversal in composes_with resolution) is delegated to the module-loader; documented for completeness in adversarial threat modelling.

These names have Verum declarations and corresponding dispatch_intrinsic arms. Cross-side alignment checks, including crates/verum_kernel/tests/k_arch_v_alignment.rs, can detect drift between those registries. Alignment does not supply a proof of an annotated theorem: its statement, premises and proof term still require actual verification.

10. The transitive peer-resolution layer​

Most ATS-V checks are local — they inspect a single cog's declared shape against its own body. Two checks operate at the cross-cog level: AP-019 FoundationDowngrade and AP-024 TransitiveLifecycleRegression. Both walk the composes_with graph, but the walks behave differently from the local checks in two ways:

  1. The graph is built incrementally. Each cog's parsed @arch_module(...) shape is registered as it is compiled, building a session-scoped peer registry. A peer not yet registered when the resolver runs is silently skipped (no false positive). The single-pass architecture is preserved.
  2. The walk is depth-aware. Direct one-hop drift is already caught by the standard peer-resolution check. The transitive layer walks deeper — depth ≥ 2 only — so it produces a strictly different diagnostic class.

10.1 The transitive walker​

A depth-first walker iterates the peer graph from a starting cog, visiting every reachable cog with cycle prevention and a depth fuse of 32 hops (sufficient for every observed real-world graph). Each visit carries the path traversed, the visited cog's shape, and the current depth; callers filter by depth ≥ 2 to isolate the transitive class.

Two policy adapters use the walker:

  • resolve_transitive_lifecycle_regressions — reports any reachable peer whose Lifecycle.rank() exceeds the starting cog's, surfacing the (intermediate, terminal, regressed_lifecycle) tuple.
  • resolve_transitive_foundation_downgrades — reports any reachable peer whose foundation is not subsumed by the starting cog's foundation, surfacing the (peer, peer_foundation, self_foundation) tuple.

Both adapters are pure functions over the peer registry snapshot — re-runnable, deterministic, idempotent.

10.2 Wiring into the audit pipeline​

Each cog's ATS-V phase calls the two adapters against the session peer registry, populating two new diagnostic-context fields. The regular AP-019 and AP-024 emitters then consume these alongside the direct-edge findings, so a single cog's audit report contains both immediate and transitive violations.

The per-attribute fast path (used when no peer registry is available) leaves these fields empty: cross-cog claims are only supported in the registry-aware entry point that snapshots the peer graph before resolving.

10.3 Verifying the layer​

The cross-side pin band has four entries dedicated to this layer (raising the alignment count from 39 → 43); see Cross-side pin tests §7 for the full contract.

The bundle gate --arch-discharges walks every reported violation. Transitive entries surface in the JSON with an explicit via chain so auditors can read the path:

{
"ap": "AP-024",
"kind": "TransitiveLifecycleRegression",
"module": "core.prove.zfc.choice",
"via": ["core.prove.zfc.lemma_a", "core.prove.zfc.hypothesis_b"],
"regressed_to": "Hypothesis { confidence: Low }",
"depth": 2
}

This makes the multi-hop reasoning machine-readable: a CI diff can flag a PR that introduces a new transitive regression chain even when no individual edge regresses.

10.4 Reusing the walker​

Future cross-cog anti-patterns that need depth-aware traversal share the same walker, so that cycle prevention and depth bounds stay consistent across the audit catalog:

  • AP-018 CompositionPathDeception — currently surfaces only on direct edges; the transitive variant ("a cog launders a capability through two intermediate cogs neither of which individually advertises the handoff") will share the transitive infrastructure.
  • AP-022 CapabilityLaundering — already a multi-hop check on the privilege chain; a future consolidation onto the shared walker eliminates duplicated cycle-prevention logic.

Adapters that only need the first violation can short-circuit the traversal — a useful optimisation for high-fanout peer graphs.

11. Cross-references​