formal-verification

Model distributed protocol safety and liveness properties with TLA+ and TLC.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/s3nex-com/sdlc-skills-library --skill formal-verification-s3nex-com
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: formal-verification
Source: https://github.com/s3nex-com/sdlc-skills-library/tree/main/skills/phase4/formal-verification
Command: npx skills add https://github.com/s3nex-com/sdlc-skills-library --skill formal-verification-s3nex-com

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides formal verification guidance for distributed protocols to ensure correctness properties like safety and liveness before implementation using TLA+ and TLC.

Core Features & Use Cases

  • TLA+ specification and model checking: define states, invariants, and safety/liveness properties, then exhaustively explore interleavings with TLC.
  • Structured protocol design guidance: provides Init/Next/Spec conventions, invariants, and counterexample analysis to guide debugging.
  • Use cases: for consensus, leader election, two-phase commit, and any protocol where correctness depends on interleaving.

Quick Start

Provide a complete TLA+ module for your protocol and run TLC to verify safety and liveness.

Frequently Asked Questions about formal-verification

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify distributed protocol correctness using TLA+?

You verify distributed protocol correctness by defining a TLA+ module with Init, Next, Spec, and invariants, then using TLC to exhaustively explore reachable states across interleavings and validate safety and liveness properties.

What safety and liveness properties should I specify for a distributed protocol?

Safety and liveness properties in distributed protocols specify invariants like consistency guarantees and progress conditions. You model them as Invariant definitions in a TLA+ module and check them against all reachable states.

How do I debug a TLA+ specification when TLC finds a counterexample?

When TLC finds a counterexample, you debug by analyzing the returned state trace to identify the interleaving that violates your safety or liveness invariant, then revise the protocol's Next or Init definition.

Can I use TLC to model check two-phase commit and leader election protocols?

Yes, TLC can model check two-phase commit, leader election, and consensus protocols by exploring all interleavings of their state transitions to validate that safety and progress invariants hold.

What is the required TLA+ module structure for formal verification?

The required TLA+ module structure for formal verification includes EXTENDS, CONSTANTS, VARIABLES, Init, Next, Invariant, and Spec definitions to properly frame the state space for TLC exploration.