Code
Challenges
- Behavioral requirements are often scattered between code, tests, and prose.
- Regression suites sample behavior but cannot enumerate every execution path.
- Interfaces and assumptions drift as systems and dependencies change.
- Critical guarantees need evidence that remains connected to implementation.
Problems We Solve
- Specification Modeling Express interfaces, invariants, and assumptions explicitly.
- Property Checking Evaluate implementation behavior against stated properties.
- Counterexample Search Explore paths that violate a proposed guarantee.
- Regression Assurance Track which guarantees remain valid after a change.
- Proof Artifacts Keep machine-checkable evidence with the relevant code.
Domain portfolio
Application patterns
Compare two formal-assurance approaches, then explore the domain workflows as interactive state machines.
01 Authorization-policy specification for service APIs Explore pattern
System/use case
Operational setting
Decision/claim boundary
Candidate checked statements
Illustrative controlled-English propositions for a future setup include:
- “Every permitted resource mutation has an authenticated principal.”
- “A principal without cross-tenant delegation cannot read another tenant’s protected resource.”
- “Revoked capability state cannot produce a permit decision.”
- “Every privileged policy override produces an accountable audit event.”
These are candidate schemas, not implemented policies or already proved security properties.
Example architecture
Where verified readback fits
ff-readback renders a finite audited family while preserving binders and premise order; otherwise it fails visibly. The engineer compares successful readings with the intended policy, explicitly accepts one, or gives feedback. Confirmation records the specification’s meaning; it neither proves the proposition nor deploys a policy.Potential benefits
Limits/adoption considerations
02 Idempotent event-processing and retry assurance Explore pattern
System/use case
Operational setting
Decision/claim boundary
Candidate checked statements
Possible controlled-English propositions include:
- “Repeated delivery of one committed operation does not create a second modeled side effect.”
- “Acknowledgement occurs only after the associated outcome is durably recorded.”
- “Every exhausted retry transitions either to compensation or to manual intervention.”
- “A compensated operation cannot also be marked successfully completed.”
They illustrate potential formal statements rather than guarantees of a particular platform.
Example architecture
Where verified readback fits
Potential benefits
Limits/adoption considerations
03 Compiler intermediate-representation transformation review Explore pattern
System/use case
Operational setting
Decision/claim boundary
Candidate checked statements
Illustrative propositions include:
- “Every well-typed source program transformed by constant folding has an observationally equivalent target program.”
- “If a source step is simulated, the corresponding target execution preserves the declared observation.”
- “Every accepted lowering result is well typed in the target intermediate representation.”
- “A failed transformation cannot be classified as a successful compilation result.”
These are possible goal shapes, not proof-complete theorems or claims of current adapter coverage.
Example architecture
Where verified readback fits
ff-readback then either renders a supported checked type through audited candidates or fails visibly; it never invents a prose summary for unsupported structure. The engineer confirms whether a successful reading captures the goal. Only a separately supplied proof term, successful model analysis, or other accepted evidence can establish the proposition.Potential benefits
Limits/adoption considerations
04 Embedded-control firmware release invariants Explore pattern
System/use case
Operational setting
Decision/claim boundary
Candidate checked statements
Potential controlled-English propositions include:
- “Every transition to actuator-enabled mode requires completed initialization.”
- “An active critical fault inhibits every modeled actuator command.”
- “Every watchdog-expiry transition enters a declared degraded or safe state.”
- “A manual override remains represented in every autonomous control mode.”
They are illustrative statement forms, not certified requirements or verified firmware guarantees.
Example architecture
Where verified readback fits
ff-readback produces a finite audited family tied to the checked declaration; unsupported structure fails visibly. The engineer checks trigger, state, quantifier, and exception semantics and explicitly accepts or provides feedback. The accepted result is a reviewed specification artifact, not evidence that the firmware satisfies it.Potential benefits
Limits/adoption considerations
Applicability frame
MLTTDB is most plausible here as a governed catalog of proof-assistant terms. Row types and :T: table declarations remain in Agda, Lean, or Rocq source; the SQLite term store keeps ordered source-language rows, UUIDs, projection values, and metadata; and a proof assistant performs semantic checking. The store can orchestrate a validation process but does not itself establish program correctness. Repository, CI, identity and access management, runtime enforcement, source-system reconciliation, and release approval stay outside the MLTTDB boundary. Agda currently supports UUID-based finite-table lookup in stored bodies; Lean and Rocq preprocessors validate generated definitions but do not provide that lookup.
Current data mode checks fetched rows as separate definitions; it does not expose a table to application proofs as an enumerable, first-class collection. Whenever an example below claims whole-snapshot coverage, uniqueness, graph acyclicity, or aggregate compatibility, the architecture therefore assumes either a finite domain declared in proof source or an external snapshot compiler that emits a reconciled aggregate manifest/certificate term. The proof assistant checks that aggregate term, while external reconciliation establishes that it represents the table export supplied to CI.
01 Versioned API and protocol contract catalog Explore pattern
Operational context
Why MLTTDB fits
Example architecture
OpenAPI / AsyncAPI / IDL repositories
|
external contract compiler
v
candidate typed rows + provenance manifest
|
reviewed admin/API import
v
SQLite MLTTDB term store
|
CI data-mode validation
v
Agda / Lean / Rocq checker
|
signed CI result bundle
v
release policy and human approval
The external compiler normalizes source contracts and proposes proof-language rows; it also records repository commit, generator version, and source pointer in an ordinary provenance system. A contract-model repository owns the row types and compatibility predicates. The term store owns approved ordered terms and identifiers. CI selects the matching checker path and publishes generated source, diagnostics, and commit linkage. A separate release controller consumes the result under organization policy.
Representative typed artifacts
EndpointVersion, Transition, ConsumerAssumption, and CompatibilityCase old new. Tables might be declared as supportedVersions :T: EndpointVersion and requiredCases :T: CompatibilityCase. A reconciled ContractCatalogManifest aggregate term enumerates the versions, assumptions, breaking changes, and case UUIDs whose whole-snapshot coverage is checked. A row can encode that POST /payments in version 3 refines the documented outcomes of version 2 under a named assumption set. In Agda, a case may use finite lookup to refer to an earlier version by UUID; in Lean or Rocq, the preprocessing workflow must instead use ordinary generated identifiers or self-contained rows.Checks and evidence
Potential benefits
Deployment boundary
02 Authorization policy change assurance Explore pattern
Operational context
Why MLTTDB fits
Example architecture
IAM catalog + policy repository + ticketing
|
external reconciler and candidate builder
v
isolated review workspace
|
MLTTDB records with ticket/source metadata
|
store-owned verify endpoint or local CI
v
proof-assistant checker
|
security review packet and approval
v
external policy deployment pipeline
The reconciler joins identities, policy declarations, and exception tickets, then emits candidates; source reconciliation remains its responsibility. Reviewers edit or accept proof-language records in a restricted workspace. Store-owned verification may launch the configured Agda, Lean, or Rocq validation backend, but returned success is the subprocess result. The deployment pipeline independently verifies approvals, commits, and environment targeting.
Representative typed artifacts
PrincipalClass, ResourceScope, Action, Grant, Constraint, and ApprovedException. Tables such as baselineGrants :T: Grant and changeCases :T: AuthorizationChange can express tenant-preservation, non-escalation, and two-person administration obligations. A change artifact may carry a proposed grant together with a proof that its resource scope is a subset of the role’s approved scope. Another can model a time-bounded exception at the type level while leaving wall-clock evaluation to the surrounding workflow.Checks and evidence
Potential benefits
Deployment boundary
03 Safety-critical embedded configuration baseline Explore pattern
Operational context
Why MLTTDB fits
Example architecture
requirements + hardware definition + calibration tool
|
controlled external transformation and review
v
variant-specific MLTTDB database
|
locked release candidate snapshot
|
Agda data-mode validation
v
checked ordinary definitions / diagnostics
|
qualified generator and build pipeline
v
HIL tests, safety review, signed release
Requirements management and hardware tools remain authoritative for their respective facts. A controlled adapter proposes typed terms and a reconciliation report. The proof source owns units, ranges, compatibility relations, and variant indexes. The term store maintains the ordered candidate baseline. Agda is attractive when later rows must refer to earlier catalog entries through literal UUID finite lookup; if Lean or Rocq is selected, rows must use the supported generated-definition model without that lookup.
Representative typed artifacts
Channel variant sensorKind, Bounded unit low high, WatchdogBudget taskSet, and Interlock machineState actuator. Tables such as sensors :T: SensorBinding VariantA and parameters :T: CalibratedParameter VariantA hold concrete selections. A motor-current limit can be represented as a value carrying evidence that it lies within the variant’s electrical and thermal envelope. A watchdog row can carry a proof that the declared period dominates the modeled worst-case execution allowance.Checks and evidence
Potential benefits
Deployment boundary
04 Database migration compatibility dossier Explore pattern
Operational context
Why MLTTDB fits
StageIndex and predecessor/successor relations in a reconciled plan manifest carry sequence semantics; the store preserves deterministic presentation and generated-definition emission order, not a proof-visible ordinal.Example architecture
migration DSL + schema history + application contracts
|
external plan extractor and test generator
v
MLTTDB migration dossier (review branch)
|
project-owned CI validation
v
Lean / Rocq / Agda checker
|
proof result + generated source + DB tests
v
change advisory and deployment orchestrator
The extractor builds candidate terms from migration and application repositories; it does not gain authority over either source. The formal model defines abstract rows, transformations, mixed-version operations, and required obligations. MLTTDB stores reviewed plan instances. CI validates the terms and also runs database-native migration, rollback, and property tests. The deployment orchestrator controls locks, sequencing, observation windows, and abort criteria.
Representative typed artifacts
SchemaState, MigrationStep from to, BackwardRead old new, ForwardWrite old new, and RollbackWitness stage. Tables might be stages :T: MigrationStage and obligations :T: StageObligation. A column-split step can carry total abstract encode/decode functions and proofs for the modeled round trip. A backfill stage can state that old readers remain defined while dual-write is active. For Agda, finite UUID lookup can link an obligation to an earlier stored stage; Lean and Rocq workflows should encode those relationships through ordinary preprocessed definitions.Checks and evidence
Potential benefits
Deployment boundary
These read-only, pan-and-zoom models expose three abstraction levels for each workflow. They are explanatory examples, not live operational or decision systems.
Distributed transaction coordination
About this workflow
This example represents coordination of one logical transaction across services or resource managers that cannot rely on a single local database commit. It models the practical guarantees around reservations, durable prepare decisions, commit propagation, compensation, retries, and ambiguous outcomes. The workflow assumes messages may be delayed or repeated and that a participant may fail after completing work but before acknowledging it.
The transaction begins by recording the externally required atomic outcome, the participating systems, and the consistency assumptions. Resource reservation requests bounded holds and records participant versions and expiry times. A conflict routes to compensation, because any work already performed or reserved must be released in dependency order. Complete reservations move to the prepared state only after durable acknowledgements are verified and the coordinator’s decision context has been persisted.
Once a commit decision is durable, it is propagated with retry-safe identifiers. Confirmed acknowledgements lead to a completed transaction and an evidence record of the externally visible result. A timeout during prepare triggers compensation, but uncertainty after commit cannot safely be treated as failure: a participant may already have committed. That path enters outcome review, quarantines the ambiguous case, and resolves the authoritative result from durable coordinator and participant evidence. Review may confirm completion or authorize a safe retry. Failed compensation also enters review rather than silently beginning a second transaction.
These controls matter because an unqualified retry can duplicate a charge, shipment, booking, or ledger movement, while an unqualified rollback can contradict an already committed participant. Reservation versions and expiries protect against stale holds; durable decisions prevent the coordinator from changing its answer after recovery; idempotency identifiers make redelivery safe; and outcome review creates an explicit operational state for “unknown” instead of forcing it into success or failure. The result is a reproducible protocol trace that engineering and operations can use to reconcile customer-visible outcomes.
Layer 1 — Transaction guarantee lifecycle
Layer 2 — Participant coordination
Layer 3 — Protocol checks and actions
Rolling deployment assurance
About this workflow
This example represents a production release managed as a sequence of evidence-backed decisions rather than a single “deploy” operation. It connects the approved release intent and artifact identity to pre-deployment requirements, canary behavior, progressive fleet expansion, final verification, and rollback. The goal is to preserve stated service and compatibility guarantees while exposing a change gradually enough to contain regressions.
The workflow begins when a release is planned. The team records the behavior being changed, the guarantees that must remain true, and the exact artifacts and configuration covered by the deployment specification. Requirements validation checks interface and configuration preconditions and runs the admission suite—tests, property checks, or other regression evidence required for that service. A failed admission returns the release for rework rather than allowing operational confidence to substitute for a missing prerequisite.
An admitted release reaches a canary population. Its signals are compared with an explicit acceptance envelope, not merely watched for obvious crashes. Healthy observation permits fleet expansion in bounded batches, with health and compatibility reevaluated at every boundary. A canary regression or later batch regression freezes expansion and activates rollback. Rollback restores the last compatible artifact and configuration, verifies that restoration, and returns the work to release planning. Even after fleet-wide verification, a post-release regression can reopen rollback; the verified state is evidence, not an irreversible declaration of success.
These controls matter because distributed production systems can pass build-time tests yet fail under real traffic, data shape, dependency behavior, or gradual capacity changes. Binding artifacts to requirements prevents deploying something different from what was reviewed. Canary and batch gates limit blast radius, while an explicit rollback path avoids improvising under incident pressure. Retaining the release-to-evidence trace lets engineering, SRE, and change reviewers reproduce why each rollout boundary was crossed.
Layer 1 — Deployment assurance lifecycle
Layer 2 — Release orchestration
Layer 3 — Deployment checks and actions
Versioned API and data migration
About this workflow
This example represents a compatibility-led change to an API contract and its stored data. Instead of treating schema conversion, client adoption, and traffic cutover as separate projects, it keeps them in one controlled lifecycle: proposed invariants, compatibility review, shadow conversion, dual operation, cutover, legacy retirement, and remediation. This is suitable for changes where old and new readers or writers coexist for a meaningful period.
The workflow begins by stating interface and data invariants and inventorying every consumer, writer, and stored version affected. Compatibility review compares old and new assumptions and searches for representative counterexamples, such as an old client omitting a newly required field or a conversion losing domain meaning. A rejected review returns to design. An accepted design moves to shadow migration, where a replayable cohort is converted without becoming authoritative and source and target results are compared semantically rather than only byte-for-byte.
Converged shadow results permit dual operation: versioned reads and writes run in parallel while adoption and data convergence are measured. Drift opens remediation. Once consumers have adopted the new version, cutover moves traffic across a controlled boundary and verifies checkpoints before fallback routes are retired. Divergence, dual-run drift, or a failed cutover is classified and repaired; the repair may be replayed through shadow migration or the known fallback restored in dual operation. Legacy mutation paths are disabled only after cutover verification, and the compatibility evidence is retained with the retired version.
These controls matter because a superficially successful backfill can still change business meaning, while a correct new API can fail when an overlooked consumer continues using an older contract. Replayable cohorts make fixes testable, dual operation exposes live incompatibilities without an abrupt one-way switch, and checkpoints make recovery bounded. The retained proof and regression constraints help prevent the next version from reintroducing a previously solved incompatibility.