Deskree
Research

ResearchFormal verification

A model to prove against: toward formal verification of running systems

Formal verification has proven kernels, compilers and single layers of infrastructure, but it has never covered a whole running system. We believe the missing piece is the model: a description of the entire system, generated from the system itself and kept up to date, that a team can check its own rules against.

Dmytro Grechko, CEO at Deskree

The missing part

The obstacle to verifying a running system is the model.

A proof needs three things: a precise model of a system, a precise statement of what must hold, and a procedure that checks one against the other. The procedures exist as mature, open solvers. The statements exist informally, as rules in the heads of the people who run a system. A model of a whole production system, spanning its code, infrastructure, runtime and operations, exists nowhere.

  1. Model

    The system, stated precisely

    Missing

  2. Statement

    What must hold, stated precisely

    Known to the team, unwritten

  3. Procedure

    A solver that checks one against the other

    Exists

The procedure exists and the rules are known informally. The model is the part nobody has built.

We explored why that matters now, what has been proven so far, and where Metafour, the product we build, stands.

Why this matters now

AI agents now write a large share of new code, and they write it against systems they cannot fully see. An agent searches for files, reads fragments and infers the rest.

In one security study, about 40% of the programs a coding assistant generated were vulnerable [1]. Models recommend software packages that do not exist [2]. The same request produces different programs from one run to the next [3], and experienced developers have been measured as slower with AI tools in codebases they knew well [4].

These failures share a cause. A language model produces the most plausible continuation of its input. When the input lacks a fact, the model supplies a plausible one, and a plausible relationship between two services reads exactly like a real one. The engineer reviewing the output has nothing to tell them apart.

Review was the profession’s answer to plausible mistakes, but review does not keep up with the speed at which AI writes code. Software engineering has a stricter discipline for claims that must be true. It is called formal verification, and it is older than most of the tools the industry uses today.

What has been proven so far

Formal verification replaces testing by example with mathematical proof. A test shows that a program worked on the inputs someone thought to try. A proof covers the inputs nobody thought of.

  • seL4 2009, an operating system kernel

    Proves the code matches its specification

    Code

  • CompCert 2009, a C compiler

    Proves compiled code behaves as its source does

    Code

  • IronFleet 2015, two distributed systems

    Proves correctness down to the implementation

    Code

  • HACL* 2017, a cryptographic library

    Proves memory safety and functional correctness

    Code

  • Static Driver Verifier, Windows device drivers

    Proves a driver follows the rules of the kernel interface

    Code

  • Batfish 2015, network configurations

    Proves configuration properties such as reachability

    Infrastructure

  • Zelkova 2018, cloud access policies

    Proves who can reach what under a policy

    Infrastructure

  • Tiros 2019, networks built in one cloud

    Proves which resources can reach which

    Infrastructure

  • One model of all four layers

    None

Every landmark proof covers one layer of a running system, and no system fills the last row. The rows prove different kinds of property, named under each [5, 6, 7, 8, 9, 10, 11, 12].

The famous results are single components. seL4 is an operating system kernel whose proof took about 20 person-years [5]. When researchers threw randomly generated programs at eleven C compilers and found more than 325 bugs, the verified part of CompCert was the one place where no wrong-code errors turned up [13].

Large engineering organizations use the same methods day to day. Amazon checks the designs of services such as S3 and DynamoDB against formal specifications, and found a DynamoDB bug that needed 35 steps in sequence to appear [14]. Facebook runs a static analyzer that grew out of verification research on changes to its mobile apps [15].

Verification has also moved past application code, one layer at a time. A network can be modelled from its device configurations and checked before a change goes out [10]. An access policy can be turned into logic and checked for anyone it lets in who should be kept out [11].

What none of them covers

Each of these results verifies one artifact, chosen because it is small and stable enough to justify the cost of a proof. A production system is a different object. Its code sits in hundreds of repositories, and its behaviour depends on the clusters that code is deployed to, the pipelines that put it there, the configuration it reads at run time and the people who operate it.

The questions that decide whether a change is safe sit between those layers. Which version of this service is running in production? What does this change reach once it is deployed? Who owns the service that will page when it fails?

What already exists

Several kinds of tools already answer structural questions about software. Each is good at its part, and each stops at a boundary that the questions above cross.

Kind of toolWhat it doesWhere it stops
Code queriesTreat a codebase as a database and run exact queries over it [16, 17].The database is the code. It has no record of where that code is deployed or who operates it.
Code indexesRecord how code refers to code across languages and build systems [18].At the edge of the source tree.
Policy enginesCheck a team’s rules against a document they are handed, such as a manifest or a deployment plan [19].Someone else has to assemble the view of the whole system.
Cloud analyzersProve what can reach what, and who has access, inside one provider’s cloud [12, 11].One cloud and one layer.
Service catalogsList services, owners and dependencies as people declare them.They go out of date the way any hand-written document does.

What none of them provides is a single model that spans code, infrastructure, runtime and operations, is built from the system itself, and is kept current. Without it a team has nothing to check a system-wide rule against.

The rules we have in mind are about structure: what exists, what depends on what, what a change reaches and who owns it. A verified kernel proves something else, that the code computes what its specification says. Incidents and failed migrations turn on statements of the structural kind.

Who does what

Take the three parts in turn.

The procedure is a solver, and solvers are mature, open software [20].

The statement is a rule. A team that runs a system knows its rules informally: which data must stay private, which services must have an owner, which changes must stay away from a system in the middle of an incident. Knowing a rule and stating it precisely enough for a solver are different skills, and we come back to that below.

The model is the part teams lack. In the infrastructure projects above, building a faithful model was the hard work, and the checking was handed to an existing engine. Batfish’s contribution was a model of a network derived from its configurations [10]. Zelkova’s was a translation of access policies into logic [11].

We expect verification of production systems to split the same way. One party builds the model and keeps it current. The team that runs the system writes the rules and does the verifying, because nobody outside a team knows what its system must guarantee.

Where Metafour fits

Today Metafour produces a context graph of a software system: a record of what exists across code, infrastructure, runtime and operations, and how the parts relate. The graph is built deterministically, with no language model involved, and AI agents query it for the structure of the system they are working on [21].

Metafour does not perform formal verification. What it holds is the material for the first of the three parts.

One core property of the graph is that it keeps what a system shows apart from what something claims about it: a deployment in a cluster is shown, and a tag on a resource is a claim.

The next step: a system as variables

The context graph is built for agents to read. A solver needs something stricter: a set of variables that describe the whole system, with the relationships between them stated precisely. Our next step is to derive that form from the graph.

The graph holds relationships: this service calls that API, this service is deployed to that cluster. In the simplest encoding, each relationship that could hold becomes one variable that is true or false. calls(orders, tax-v1) is a variable, and deployed(orders, prod) is another. A rule is then a formula over all of them at once. Other encodings keep the relations whole and hand them to an engine that reasons over relations directly.

With that form in hand, a person states a rule once and the rule is applied to the entire system, the way a formula is applied to every value of its variables. The rule either holds everywhere or it is violated, and a violation comes with the case that breaks it.

A small modelCodeInfrastructureRuntimeOperationscallsinvoicesorderstax-v1deprecatedprodorders, runningpayments, on call
The same content as variables
  • calls(orders, tax-v1)
  • deprecated(tax-v1)
  • deployed(orders, prod)
  • deployed(invoices, prod)
  • running(orders, prod)
  • on_call(payments, orders)
A rule

“No deployed service calls a deprecated API.”

for every service s and API a: deployed(s) and deprecated(a) implies not calls(s, a)

Result

Violatedorders is deployed to prod and calls tax-v1

One rule, checked against every fact in a small model: removing a single call changes the result from violated to holds. Tick the box to remove the call. Illustrative: the system and its names are invented.

Example rules

  • “No public route reaches the payments database.”

    Holds
  • “Every production service has an owner and a rollback path.”

    Holds
  • “This change touches no service with an open incident.”

    path: this change → checkout service → open incident

    Violated
A rule has two possible answers, and a violation names the path that breaks it. Illustrative.

The aim is to give teams the model and the tools they need to perform formal verification.

What the model has to get right

A proof is a statement about a model, and its value depends on how closely the model follows the system. A structural proof about a production system is won or lost here. Four properties decide it.

Completeness

A rule such as “no public route reaches the payments database” is a claim about every route. It is proven only if the model contains every route. A route missing from the model makes the rule appear to hold. The model therefore has to report its own coverage, so that a result is read together with the part of the system it covers.

Standing

Only relationships the system itself shows can carry a proof. A rule checked against unconfirmed relationships yields a lead for an engineer to follow up.

Currency

A result can be exact about the model and wrong about the system for as long as the model lags a change.

Relationships as well as values

Rules are statements about how the parts of a system relate. The relationships have to be encoded with the same precision as the parts, or a rule has nothing to range over.

Five problems and how we approach them

Anyone who sets out to verify a running system meets the same five problems. Each has a workable answer, and these are ours.

Encoding

The form the variables take decides which class of solver can read them. A model stored in one solver’s input format ties every team that uses it to that solver.

Our approach is to keep the model in a neutral form, as typed facts and relations, and to translate into a solver’s input only at the moment a rule is checked. A rule about what can reach what goes to an engine that reasons over relations. A rule with counts or thresholds goes to an SMT solver [20]. The team picks the solver that suits the rule, and the model stays as it is.

Scale

A real system yields a very large number of variables, and a check is useful only if it answers in a time an engineer will wait for.

The variables are derived once, when the system is ingested. For a large system that first pass can take many hours. As the system grows and evolves, new variables are derived automatically and on-demand, depending on the specific system component that got updated. Regardless of the scale, Metafour maintains an up-to-date version of the system.

Knowing what is missing

A rule checked against a model with a hole in it can appear to hold. A model therefore has to know what it does not cover, which is the hardest of the five to do well.

We call the uncovered part dark matter. The relationships a model already holds point at things it does not hold yet: a call that goes to something the model has no record of, for example. The model infers these gaps from what it has, marks them, and asks the team to confirm whether something is missing there. A game map works the same way when it draws the regions a player has yet to unlock. The team sees the outline of what is unknown, and every result is read together with it.

Re-checking

A system changes many times a day. Checking every rule from the start after each change does not hold up.

Re-checking is automatic, and each part of a system has its own trigger. Code is refreshed when a pull request changes it. Some sources, telemetry among them, are read on demand. A change updates the part of the model it touches, and the rules that range over that part are checked again.

Writing rules

A rule language only specialists can use leaves the rules in people’s heads.

Most rules a team states come in a small number of shapes: nothing of one kind reaches something of another, everything of one kind has an owner, nothing deployed depends on something retired. Research on formal specifications found the same in general, with a handful of patterns covering the great majority of the properties engineers had written [22]. Our approach is to offer those shapes as templates. An engineer picks one and fills it in with names from the model, and the precise statement is generated and shown back before anything is checked. The person who knows the rule writes it, and a specialist is called in only for the rare rule that fits no template.

What this will not do

A structural model will not establish that a function computes the right result, that a service meets a latency target, or that a design is free of race conditions. Those properties need the methods that seL4, CompCert and the specification work at Amazon use.

Every result is relative to the model. A rule is checked only if someone wrote it, and the quality of a result depends on the rules a team states.

The difficult part comes if the rules teams most need turn out to be about behaviour. Expressing them through a structural model is a lot more difficult, even if the model is able to ingest behavioural data. We expect structural rules to cover a large share of what breaks in production.

We would like to hear from teams that can name the rules they most want checked against their own systems: hello@deskree.com.

Sources

  1. Pearce, Ahmad, Tan, Dolan-Gavitt, Karri. Asleep at the Keyboard? Assessing the Security of GitHub Copilot’s Code Contributions. IEEE Symposium on Security and Privacy, 2022.
  2. Spracklen, Wijewickrama, Sakib, Maiti, Viswanath, Jadliwala. We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs. USENIX Security Symposium, 2025.
  3. Ouyang, Zhang, Harman, Wang. An Empirical Study of the Non-determinism of ChatGPT in Code Generation. ACM Transactions on Software Engineering and Methodology, 2024.
  4. Becker, Rush, Barnes, Rein. Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity. METR, 2025.
  5. Klein et al. seL4: Formal Verification of an OS Kernel. ACM Symposium on Operating Systems Principles, 2009.
  6. Leroy. Formal Verification of a Realistic Compiler. Communications of the ACM, 2009.
  7. Hawblitzel et al. IronFleet: Proving Practical Distributed Systems Correct. ACM Symposium on Operating Systems Principles, 2015.
  8. Zinzindohoué, Bhargavan, Protzenko, Beurdouche. HACL*: A Verified Modern Cryptographic Library. ACM Conference on Computer and Communications Security, 2017.
  9. Ball, Levin, Rajamani. A Decade of Software Model Checking with SLAM. Communications of the ACM, 2011.
  10. Fogel et al. A General Approach to Network Configuration Analysis. USENIX Symposium on Networked Systems Design and Implementation, 2015.
  11. Backes et al. Semantic-based Automated Reasoning for AWS Access Policies using SMT. Formal Methods in Computer Aided Design, 2018.
  12. Backes et al. Reachability Analysis for AWS-Based Networks. Computer Aided Verification, 2019.
  13. Yang, Chen, Eide, Regehr. Finding and Understanding Bugs in C Compilers. PLDI, 2011.
  14. Newcombe, Rath, Zhang, Munteanu, Brooker, Deardeuff. How Amazon Web Services Uses Formal Methods. Communications of the ACM, 2015.
  15. Distefano, Fähndrich, Logozzo, O’Hearn. Scaling Static Analyses at Facebook. Communications of the ACM, 2019.
  16. Avgustinov, de Moor, Jones, Schäfer. QL: Object-oriented Queries on Relational Data. European Conference on Object-Oriented Programming, 2016.
  17. Yamaguchi, Golde, Arp, Rieck. Modeling and Discovering Vulnerabilities with Code Property Graphs. IEEE Symposium on Security and Privacy, 2014.
  18. Kythe. An Overview of Kythe. Project documentation.
  19. Open Policy Agent. Documentation. Cloud Native Computing Foundation.
  20. de Moura, Bjørner. Z3: An Efficient SMT Solver. Tools and Algorithms for the Construction and Analysis of Systems, 2008.
  21. Deskree. Compiling a system into facts: how Metafour builds its context graph.
  22. Dwyer, Avrunin, Corbett. Patterns in Property Specifications for Finite-State Verification. ICSE, 1999.