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-typestate1yes—Phantom/ghost/newtype/bounded/safe-cast toolkit
tpt-for-assert-const1yes—Compile-time assertions
tpt-for-contract2yes—Pre/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; optional backend-sci-ode feature wraps tpt-sci-ode (sibling tpt-science) behind the same OdeSystem surface
tpt-for-smt-lite5no—Lightweight SMT bridge: term/problem builder + SMT-LIB2 + minimal evaluator (ADR 0007: rsmt2/z3 valid wrap targets)
tpt-for-proof-ast6no—Proof AST representation
tpt-for-det-proptest6no—Deterministic property-based testing
tpt-for-deterministic-sim6no—Deterministic simulation harness
tpt-for-redundancy6yes—Redundancy/fault-tolerance primitives
tpt-for-trace-macros6yes—Trace/instrumentation macros
tpt-for-model-check7no—Explicit-state model checking (clean-room; stateright is a documented external backend)
tpt-for-sat7no—From-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-interp7no—Generic 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-verify7no—Runtime verification: clean-room temporal-logic monitor over live traces
tpt-for-cfd-invariants8notpt-for-contractCFD invariants as contracts — D2Q9 LBM mass conservation (bounded f64 drift) and CFL < 1 upwind energy stability

Status

All phases (0–8) are landed. The 13 original crates plus the six Phase 7 ecosystem-gap crates and the Phase 8 tpt-for-cfd-invariants crate are implemented, documented, and tested. The no_std crates build for thumbv6m-none-eabi. tpt-for-verified-ode now composes with the cross-repo tpt-sci-ode (sibling tpt-science repo) through its optional backend-sci-ode feature, wrapping its adaptive solvers behind the same OdeSystem contract surface. 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-contract ──────► tpt-for-cfd-invariants
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 composes with the cross-repo tpt-sci-ode (sibling tpt-science repo) as a higher-order backend behind the same OdeSystem contract surface, via the optional backend-sci-ode feature (sci_ode::solve).

License

Licensed under either of

at your option.