Skip to main content

Crate tpt_telos_agent

Crate tpt_telos_agent 

Source
Expand description

The agentic transpiler core for tpt-telos (Phase 2).

This crate implements the Generate -> Verify -> Counter-example -> Rewrite loop described in the design document:

  1. An LLM-style CodeAgent produces a candidate implementation (a body of mutate state / assignment statements) from a function’s intent (requires / ensures and @boundary routing).
  2. The formal verifier checks the candidate against the mathematical contract.
  3. On failure, the solver extracts a concrete counter-example (a variable assignment where the contract is violated).
  4. The agent rewrites the candidate using that counter-example, and the loop repeats until the contract is provably satisfied.

The default StaticAgent is a fully offline, deterministic synthesizer: it translates the developer’s stated body when present, and otherwise derives an implementation directly from the ensures clauses. Real LLM backends can be plugged in behind the CodeAgent trait (see [llm_agent] behind the llm feature).

Re-exports§

pub use static_agent::synthesize_from_ensures;
pub use static_agent::StaticAgent;

Modules§

static_agent
A deterministic, fully offline CodeAgent.

Structs§

Candidate
A candidate implementation produced by an agent: the statements that form the function body.
FuncOutcome
The full outcome of transpiling one function through the agentic loop.
FuncSpec
An owned view of a single function’s verification intent, detached from the surrounding module so agents can be reasoned about in isolation.
LoopStep
One iteration of the agentic loop, for transparent reporting.

Traits§

CodeAgent
A code-generation agent. Implementations may be deterministic (offline) or backed by an external LLM; both speak the same structured Stmt language so the output is guaranteed to lower into compilable Rust/Go.

Functions§

render_candidate
Convenience helper used by codegen: render a Candidate body back into source text via the parser’s pretty-printer.
transpile_func
Run the agentic transpilation loop for a single function.
transpile_module
Convenience: transpile every function in a module and collect outcomes.