counterexample-explainer

Solid

Explain why counterexamples violate specifications by analyzing formal specifications (temporal logic, invariants, pre/postconditions, code contracts), informal requirements (user stories, acceptance criteria), test specifications (assertions, property-based tests), and providing step-by-step traces showing state changes, comparing expected vs actual behavior, identifying root causes, and assessing violation impact. Use when debugging test failures, understanding model checker output, explaining runtime assertion violations, analyzing static analysis warnings, or teaching specification concepts. Produces structured markdown explanations with traces, comparisons, state diagrams, and cause chains. Triggers when users ask why something failed, explain a violation, understand a counterexample, debug a specification, or analyze why a test fails.

AI & Automation 160 stars 17 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Counterexample Explainer ## Overview Analyze counterexamples that violate specifications and produce clear, structured explanations showing step-by-step how and why the violation occurs, with root cause analysis and impact assessment. ## Workflow ### 1. Understand the Specification Identify what property is being checked. **Questions to ask:** - What is the specification or requirement? - Is it formal (invariant, temporal logic) or informal (requirement doc)? - What should happen vs what actually happened? - Is this from a test failure, model checker, or runtime error? See [specification-types.md](references/specification-types.md) for comprehensive specification catalog. **Common specification types:** **Formal specifications:** - Invariants: `balance >= 0` - Temporal logic: `G(request → F grant)` - Pre/postconditions: `@requires(x > 0)`, `@ensures(result >= 0)` - State machines: Valid state transitions - Concurrency: Atomicity, deadlock freedom **Informal requirements:** - User stories with acceptance criteria - Functional requirements - API contracts - Expected behavior descriptions **Test specifications:** - Assertions: `assert result == expected` - Property-based tests - Integration test expectations ### 2. Collect Counterexample Information Gather all relevant data about the violation. **From test failures:** ```bash # Run test to get failure details pytest test_file.py::test_name -v # Get stack trace pytest test_file.py::test_name -v --tb=long # Get v...

Details

Author
ArabelaTso
Repository
ArabelaTso/Skills-4-SE
Created
6 months ago
Last Updated
today
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Solid

counterexample-generator

Generate concrete counterexamples when formal verification, assertions, or specifications fail. Use this skill when debugging failed proofs, understanding why verification fails, creating minimal reproducing examples, analyzing assertion violations, investigating invariant breaks, or diagnosing specification mismatches. Produces concrete input values, execution traces, and state information that demonstrate the failure.

160 Updated today
ArabelaTso
Code & Development Solid

counterexample-debugger

Debug proof failures using counterexamples from Nitpick (Isabelle) or QuickChick (Coq) to identify specification errors, missing preconditions, and proof strategy issues. Use when: (1) A proof attempt fails and you need to understand why, (2) Counterexamples are generated by Nitpick or QuickChick, (3) Specifications may be incorrect or incomplete, (4) Theorems need validation before proving, (5) Missing preconditions or lemmas need identification, or (6) Proof failures need explanation and correction suggestions. Supports both Isabelle/HOL and Coq equally.

160 Updated today
ArabelaTso
Testing & QA Solid

counterexample-to-test-generator

Automatically generates executable test cases from model checking counterexample traces. Translates abstract counterexample states and transitions into concrete test inputs, execution steps, and assertions that reproduce property violations. Use when working with model checker outputs (SPIN, CBMC, NuSMV, TLA+, Java PathFinder, etc.) and needing to create regression tests, validate bug fixes, or reproduce verification failures in executable test suites.

160 Updated today
ArabelaTso