tpt-formal

Rust

Formal-verification and design-by-contract foundation for Rust — typestate, ghost state, proof ASTs, deterministic simulation, and fault-tolerance harnesses.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust100.0%
README

tpt-formal

Formal-verification & design-by-contract foundation for TPT Solutions.

Dual-licensed under MIT OR Apache-2.0.

License: MIT License: Apache-2.0

This repo consolidates TPT Solutions' formal-verification and design-by-contract primitives into one dedicated pillar. The authoritative design notes live in spec.txt; the per-task tracker is todo.md.

Pillar principles

  • Per-crate license = "MIT OR Apache-2.0".
  • no_std where the underlying technique is usable in the embedded / safety-critical verticals that motivate this pillar (marked below).
  • Many small crates plus a thin umbrella, not one broad crate.

Crate table

CratePhaseno_stdInternal depsPurpose
tpt-for-typestate1yesPhantom/ghost/newtype/bounded/safe-cast toolkit
tpt-for-assert-const1yesCompile-time assertions
tpt-for-contract2yesPre/post/invariant/loop-invariant (self-contained; tpt-math-numeric composition documented)
tpt-for-witness3yestpt-for-typestateWitness types
tpt-for-refinement3yestpt-for-contractRefinement types
tpt-for-verified-algorithms4notpt-for-contractVerified algorithm implementations (gcd/clamp/binary-search/insertion-sort)
tpt-for-verified-ode4notpt-for-contractVerified ODE solving — contract-guarded Euler/RK4 over OdeSystem; tpt-sci-ode is the designated high-performance backend to wrap later
tpt-for-smt-lite5noLightweight SMT bridge: term/problem builder + SMT-LIB2 + minimal evaluator (ADR 0007: rsmt2/z3 valid wrap targets)
tpt-for-proof-ast6noProof AST representation
tpt-for-det-proptest6noDeterministic property-based testing
tpt-for-deterministic-sim6noDeterministic simulation harness
tpt-for-redundancy6yesRedundancy/fault-tolerance primitives
tpt-for-trace-macros6yesTrace/instrumentation macros
tpt-for-model-check7noExplicit-state model checking (clean-room; stateright is a documented external backend)
tpt-for-sat7noFrom-scratch pure-Rust CDCL SAT solver (watched literals, 1UIP, restarts)
tpt-for-vcgen7notpt-for-smt-liteVerification-condition generation (WP calculus → SMT-LIB2)
tpt-for-abstract-interp7noGeneric abstract interpretation: AbstractDomain trait, fixpoint engine, Interval domain
tpt-for-symbolic-exec7notpt-for-smt-liteWhole-program symbolic execution (div-by-zero / broken-assertion detection)
tpt-for-runtime-verify7noRuntime verification: clean-room temporal-logic monitor over live traces

Status

All phases (0–7) are landed. The 13 original crates plus the six Phase 7 ecosystem-gap crates are implemented, documented, and tested. The no_std crates build for thumbv6m-none-eabi. tpt-for-verified-ode remains deferred for its high-performance backend — it is designed to compose with the cross-repo tpt-sci-ode (sibling tpt-science repo), which is not built yet. See todo.md for the per-phase tracker.

Phase 7 registry pre-check: the tpt-rust-map/registry.toml pre-check recommended by spec.txt could not be performed in this environment (the sibling tpt-rust-map repo is unavailable). The six crates were built clean-room per the repo's existing conventions; flip their registry entries to status = "git" once this repo is pushed to a remote.

Dependency graph

All crates are MIT OR Apache-2.0 and no_std where marked. Internal edges:

tpt-for-typestate ─────► tpt-for-witness
tpt-for-contract ──────► tpt-for-refinement
tpt-for-contract ──────► tpt-for-verified-algorithms
tpt-for-contract ──────► tpt-for-verified-ode
tpt-for-smt-lite ─────► tpt-for-vcgen
tpt-for-smt-lite ─────► tpt-for-symbolic-exec
tpt-for-assert-const ──► (compile-time only, no runtime deps)

tpt-for-verified-ode is designed to compose with the cross-repo tpt-sci-ode (sibling tpt-science repo) as a higher-order backend behind the same OdeSystem contract surface.

License

Licensed under either of

at your option.