Logo vun Counterexample Debugger

Counterexample Debugger

Communautéit
ArabelaTso
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.

Iwwersiicht

EditeurArabelaTso
RepositorySkills-4-SE
Skill-Nummcounterexample-debugger
Stären
258
Forks
25
Matgeliwwert Fichieren
3
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum ArabelaTso op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Counterexample Debugger an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/counterexample-debugger
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git /tmp/Skills-4-SE
mkdir -p .claude/skills
cp -r /tmp/Skills-4-SE/skills/counterexample-debugger .claude/skills/counterexample-debugger
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Counterexample Debugger an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Counterexample Debugger automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Counterexample Debugger net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Counterexample-Guided Proof Debugger

Analyze counterexamples from Nitpick or QuickChick to explain proof failures and suggest corrections to specifications or proofs.

Workflow

1. Receive Counterexample Information

Identify what information is provided:

  • Counterexample output: From Nitpick or QuickChick
  • Failed theorem: The statement that couldn't be proven
  • Proof attempt: Any partial proof or tactics tried
  • Context: Definitions and lemmas involved

2. Choose Target System

Determine which proof assistant is being used:

  • Isabelle/HOL with Nitpick: Finite model finder
  • Coq with QuickChick: Property-based testing
  • Both: Provide analysis for both systems

3. Analyze the Counterexample

Examine the counterexample systematically:

Verify the counterexample:

  • Manually compute the result for the given values
  • Confirm it actually violates the theorem
  • Check if it's a genuine counterexample or tool limitation

Identify the violation:

  • Which part of the theorem fails?
  • What values cause the failure?
  • Is it an edge case or fundamental issue?

Determine the root cause:

  • Missing precondition?
  • Incorrect specification?
  • Wrong quantifier order?
  • Implementation bug?
  • Off-by-one error?
  • Type constraint issue?

4. Explain the Failure

Provide clear explanation:

What went wrong:

  • Describe why the counterexample violates the theorem
  • Show the computation step-by-step
  • Highlight the specific point of failure

Why it happened:

  • Explain the underlying cause
  • Identify the conceptual error
  • Note any common patterns (empty list, boundary values, etc.)

Impact assessment:

  • Is the theorem fundamentally wrong?
  • Does it need preconditions?
  • Is the specification incomplete?

5. Suggest Corrections

Provide actionable fixes based on the root cause:

For missing preconditions:

isabelle
(* Before *)
lemma "hd xs ∈ set xs"

(* After *)
lemma "xs ≠ [] ⟹ hd xs ∈ set xs"

For incorrect specifications:

coq
(* Before: uses < instead of <= *)
x < y && is_sorted (y :: ys)

(* After *)
x <= y && is_sorted (y :: ys)

For quantifier order:

isabelle
(* Before *)
"∃y. ∀x. P x y"

(* After *)
"∀x. ∃y. P x y"

For incomplete specifications:

coq
(* Before: only checks sortedness *)
is_sorted (sort l)

(* After: also checks permutation *)
is_sorted (sort l) && permutation l (sort l)

6. Recommend Next Steps

Guide the user on what to do:

Retest with fix:

  • Run Nitpick/QuickChick again
  • Verify no counterexample found
  • Check if fix is sufficient

Identify additional issues:

  • Are there other edge cases?
  • Do other lemmas need fixing?
  • Is the specification now complete?

Proceed with proof:

  • If no counterexample, attempt proof
  • Suggest proof strategy
  • Identify needed helper lemmas

Counterexample Analysis Patterns

Pattern 1: Empty Structures

Symptom: Counterexample is [], {}, or None

Common causes:

  • Missing non-empty precondition
  • Undefined behavior on empty input
  • Base case not handled

Fix: Add precondition or handle empty case explicitly

Pattern 2: Boundary Values

Symptom: Counterexample is 0, 1, or type limits

Common causes:

  • Off-by-one errors
  • Boundary condition not considered
  • Edge case in arithmetic

Fix: Adjust bounds or add special case handling

Pattern 3: Duplicate Elements

Symptom: Counterexample has repeated values like [0, 0]

Common causes:

  • Using < instead of ≤
  • Assuming distinctness
  • Set vs. multiset confusion

Fix: Use appropriate comparison or add distinctness assumption

Pattern 4: Small Counterexamples

Symptom: Very small counterexample (1-2 elements)

Common causes:

  • Fundamental specification error
  • Wrong base case
  • Incorrect inductive step

Fix: Review base definitions and inductive structure

Pattern 5: Type-Specific Values

Symptom: Counterexample at type boundaries

Common causes:

  • Type constraints not considered
  • Overflow/underflow issues
  • Finite vs. infinite types

Fix: Add type constraints or adjust specification

Tool-Specific Guidance

Nitpick (Isabelle/HOL)

For detailed Nitpick usage and interpretation:

Key points:

  • Searches for finite models
  • Configurable cardinality bounds
  • May miss counterexamples beyond bounds
  • "No counterexample" ≠ proof

QuickChick (Coq)

For detailed QuickChick usage and interpretation:

Key points:

  • Random testing with shrinking
  • Configurable test count
  • May miss rare counterexamples
  • "Success" ≠ proof

Common Root Causes

Specification Errors

Symptoms:

  • Counterexample shows spec doesn't match intent
  • Multiple unrelated counterexamples
  • Spec too weak or too strong

Fixes:

  • Strengthen postconditions
  • Add completeness requirements
  • Review specification against intent

Missing Preconditions

Symptoms:

  • Counterexample is edge case
  • Empty structures or boundary values
  • Undefined behavior

Fixes:

  • Add non-empty constraints
  • Add type bounds
  • Add well-formedness conditions

Quantifier Issues

Symptoms:

  • Counterexample shows wrong order
  • Existential/universal confusion
  • Skolem constant issues

Fixes:

  • Swap quantifier order
  • Review logical structure
  • Check variable dependencies

Implementation Bugs

Symptoms:

  • Counterexample shows function doesn't work
  • Output doesn't match specification
  • Logic error in definition

Fixes:

  • Fix the implementation
  • Review algorithm correctness
  • Test implementation separately

Debugging Checklist

When analyzing a counterexample:

  1. Verify manually: Compute the result for the counterexample values
  2. Identify violation: Which part of the theorem fails?
  3. Find root cause: Why does it fail? (precondition, spec, impl, quantifiers)
  4. Suggest fix: What needs to change?
  5. Check completeness: Are there other issues?
  6. Retest: Run tool again after fix
  7. Proceed: If no counterexample, attempt proof

Examples

For complete debugging examples including:

  • Incorrect sortedness definition
  • Missing preconditions
  • Wrong quantifier order
  • Off-by-one errors
  • Incomplete specifications

See examples.md

Tips

  • Trust the counterexample: If tool finds one, investigate thoroughly
  • Verify manually: Always check the counterexample by hand
  • Look for patterns: Empty, boundary, duplicates are common
  • Fix root cause: Don't just patch symptoms
  • Retest after fixing: Ensure fix is complete
  • Use tools early: Run Nitpick/QuickChick before proving
  • Iterate: May need multiple rounds of debugging
  • Document assumptions: Make preconditions explicit
  • Check completeness: Ensure specification is sufficient

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Counterexample Debugger op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Counterexample Debugger besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Counterexample Debugger an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/counterexample-debugger an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Counterexample Debugger benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Counterexample Debugger benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Counterexample Debugger domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Counterexample Debugger gratis?

Jo. De Skill gëtt vum ArabelaTso ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇