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:
- An LLM-style
CodeAgentproduces a candidate implementation (a body ofmutate state/ assignment statements) from a function’s intent (requires/ensuresand@boundaryrouting). - The formal verifier checks the candidate against the mathematical contract.
- On failure, the solver extracts a concrete counter-example (a variable assignment where the contract is violated).
- 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.
- Func
Outcome - The full outcome of transpiling one function through the agentic loop.
- Func
Spec - An owned view of a single function’s verification intent, detached from the surrounding module so agents can be reasoned about in isolation.
- Loop
Step - One iteration of the agentic loop, for transparent reporting.
Traits§
- Code
Agent - A code-generation agent. Implementations may be deterministic (offline) or
backed by an external LLM; both speak the same structured
Stmtlanguage so the output is guaranteed to lower into compilable Rust/Go.
Functions§
- render_
candidate - Convenience helper used by codegen: render a
Candidatebody 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.