Combining Mechanical and Agentic Specification Inference for Move

Wolfgang Grieskamp 1 and Teng Zhang and Vineeth Kashyap · 2026

Read Combining Mechanical and Agentic Specification Inference for Move by Wolfgang Grieskamp 1 and Teng Zhang and Vineeth Kashyap (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-10005.txt.

Introduction

Grieskamp, Zhang and Kashyap report first steps toward a tool that infers specifications for the Move Prover, which checks smart contracts written in Move. Writing specifications by hand is tedious: proving one global invariant needs pre- and post-conditions for every supporting function. Their tool joins two engines, a weakest-precondition analysis over Move bytecode and an agentic coding assistant reached through a Model Context Protocol service.

The mechanical analysis gives a sound baseline, while the agent handles exactly where it is weakest: loop invariants and high-level idiomatic properties like monotonicity, conservation and structural invariants. The prover itself judges whether generated specifications hold, and the agent refines them with proof hints until verification succeeds. Trials on canonical Move code cover higher-order functions, dynamic dispatch, global state, references and varied loops.

Catalog record

CREATORWolfgang Grieskamp 1 and Teng Zhang and Vineeth Kashyap
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE27 KB
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.10005

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Combining Mechanical and Agentic Specification Inference for Move Wolfgang Grieskamp 1 and Teng Zhang and Vineeth Kashyap Abstract In this paper, we describe early work on a specification inference tool for the Move Prover that combines a weakest-precondition (WP) analysis over Move bytecode with an agentic coding CLI such as Claude Code. Specification inference reduces the boilerplate of writing specifications in Move: in order to verify a high-level property such as a global state invariant, pre- and post-conditions for the supporting functions typically have to be written by hand, which is tedious. In our setting, a Model Context Protocol (MCP) service exposes the WP analysis and the prover itself to the coding agent. The WP analysis provides a sound, mechanical baseline for inference; the AI is used precisely where WP is weakest — for loop invariants and high-level idiomatic specifications such as monotonicity, conservation, and structural invariants. The Move Prover serves as the oracle that decides whether the generated specs are valid, and the agent is equipped to generate proof hints and to refine the inferred specification until verification succeeds. The tool has been applied to a corpus of canonical Move code, including code that uses higher-order functions, dynamic dispatch, global state, references, and various forms of loops. I Introduction The Move Prover ( MVP ) [ 1 ] is a formal verification tool for Move smart contracts [ 2 , 3 ] , designed for routine use during code development, with running times comparable to type checkers and linters. MVP is deployed at Aptos [ 4 , 5 ] for formal verification of core protocol logic such as staking, metering, code deployment, and auxiliary data structures that underpin the framework. A practical bottleneck in program verification is the cost of writing the specifications that drive verification. The properties developers want to establish are typically high-level: that a call chain aborts only under stated preconditions, that a global storage invariant is preserved, that funds are conserved across a transfer. While MVP can verify unspecified callees by inlining their bodies, this does not scale: modular verification requires explicit per-function pre- and postcondition specifications. This detail is mechanical and tedious to write, dominates the cost of using a verifier, and is a significant barrier to wider adoption. Specification inference is a promising approach. Inference has a long history [ 6 ] and has gained steam again with LLMs [ 7 , 8 ] . Coding agents like Claude Code [ 9 ] open further avenues: they expose tools to the AI (e.g. via the Model Context Protocol, MCP) and provide a workflow in which AI and developers collaborate on code changes. And models are significantly more powerful than three years ago. We present early work on a novel combination of (a) mechanical spec inference via weakest-precondition analysis (WP) [ 10 , 11 ] and (b) agentic inference guided by a set of skills (English instructions), integrated as a plugin into Claude Code [ 12 ] . Our goal is a methodology in which AI, mechanical deduction, and users collaborate on writing and verifying Move specifications. This paper defines some of the building blocks toward that goal, focusing on spec inference. By reusing MVP ’s reference-elimination pass [ 1 ] (also adopted by Aeneas [ 13 ] ), WP propagates over a reference-free intermediate form on which classical Dijkstra-style reasoning applies directly, and recovers abort conditions, modifies clauses, and consequence-style postconditions from the bytecode. However, the principal bottleneck of WP-based inference is loop invariants : backward propagation through a loop requires an inductive invariant that is in general not derivable from the loop body alone, and without it the rest of the inferred specification becomes vacuous. LLMs help here: they are good at the pattern recognition loop invariants demand — spotting that a counter is monotone, that a sum is preserved, that an element stays in a sorted prefix — and at proposing specifications in the idiom a human would use. Both signals are validated against the code by the prover; counter-examples feed back into the agent for refinement, and the user can intervene at any point. Contributions. While primarily a tools paper with preliminary results, this work presents several novel ideas. As far as we know, previous work on LLM-based inference did not combine this approach with a mechanical component like WP. Earlier inference work is also not integrated with an interactive coding agent that lets the user contribute. Moreover, our WP algorithm benefits from reference elimination, as does our verification engine; this combination has not been described before, and the same approach extends to comparable verification engines for safe Rust (e.g. [ 13 ] ). Outline. Sec. II starts with a step-by-step example illustrating how the tool operates for the end user. Sec. III outlines WP analysis for Move code in the presence of Rust-style references and their elimination by the Move prover via bytecode rewriting. In Sec. IV we discuss the system of skills and prompts we have set up for inference and verification. Sec. V concludes with a discussion of related and future work. II Step-by-Step Example We illustrate the workflow through a number of examples; both they and the tool are publicly available [ 14 , 15 ] . II-A Higher-Order Vector Search We start with a simple function that finds an element in a vector matching a predicate: ⬇ fun find < T >( v : & vector < T >, pred : |& T | bool has copy + drop ): u64 { let i = 0; let n = v . length (); while ( i < n ) { if ( pred (& v [ i ])) return i ; i = i + 1; } n } We ask Claude Code ( CC ) to infer specs for this function; this loads a skill that creates a list of tasks: ⬇ > infer specs for the functions in this package \bullet Skill ( move - flow : move - inf ) \llcorner Successfully loaded skill \ast Zigzagging … \llcorner \square Synthesize loop invariants \square Infer weakest preconditions \square Simplify inferred specs \square Full - scope verification run \square Fix logical errors \square Resolve timeouts The tasks are listed in the suggested execution order but operate on independent snapshots of the package; CC may interleave them with edits that the user can monitor or override. Synthesizing Loop Invariants. For this task, CC infers loop invariants for loops that do not yet have any. The skill defines Move-specific guidelines for this. For find , the resulting code is: ⬇ public fun find < T >(..) .. while ( i < n ) { if ( pred ( vector :: borrow ( v , i ))) return i ; i = i + 1; } spec { invariant i \leq n ; invariant n = len ( v ); invariant \mathop{\mathstrut{\mathchar 568}}\nolimits j in 0.. i : ! result_of < pred >( v [ j ]); invariant \mathop{\mathstrut{\mathchar 568}}\nolimits j in 0.. i : ! aborts_of < pred >( v [ j ]); }; n } Notice the behavioral predicates result_of and aborts_of accessing the specification of another function — here the runtime value pred 1

Read the complete text