Analyze and explain why Isabelle or Coq proofs fail, identifying the root cause such as type mismatches, missing assumptions, incorrect goals, unification failures, or inapplicable tactics. Use when the user encounters proof failures, error messages in formal verification, stuck proof states, or asks why their Isabelle/Coq proof doesn't work.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill proof-failure-explainer
Diagnose and explain proof failures in Isabelle and Coq by analyzing proof states, error messages, and goal structures. This skill helps identify root causes and suggests fixes for common proof problems.
Collect information about the failure:
Classify the type of failure:
Type Errors:
Unification Failures:
Missing Assumptions:
Incorrect Goals:
Tactic Failures:
Scope Issues:
Examine the specific failure:
For Type Errors:
Check each term's type:
- What type does the term have?
- What type is expected?
- Where does the mismatch occur?
For Unification Failures:
Compare terms that should unify:
- Are they syntactically equal?
- What substitution would make them equal?
- Is that substitution possible?
For Missing Assumptions:
Identify what's needed:
- What fact would make the goal provable?
- Is it missing from hypotheses?
- Should it be a precondition?
For Incorrect Goals:
Verify goal correctness:
- Is the statement actually true?
- Can you find a counterexample?
- Is it too strong/weak?
Provide clear explanation:
Offer concrete fixes:
For detailed patterns and examples, see failure_patterns.md.
| Symptom | Likely Cause | Quick Check |
|---------|--------------|-------------|
| "Type unification failed" | Type mismatch | Check types with Check (Coq) or term (Isabelle) |
| "Unable to unify X with Y" | Terms don't match | Compare X and Y - are they equal? |
| "Tactic failure" | Wrong tactic | Check goal structure - does tactic apply? |
| "Not found in environment" | Scope issue | Is variable quantified? |
| Proof gets stuck | Missing hypothesis | What fact would help? |
| Goal unprovable | Incorrect statement | Is the goal actually true? |
User's Failing Proof (Coq):
Definition double (n : nat) : nat := n + n.
Lemma test : double true = 2.
Error:
The term "true" has type "bool" while it is expected to have type "nat".
Explanation:
The proof fails because of a type mismatch:
double expects an argument of type nattrue, which has type boolnat to a bool argumentSolution:
Lemma test : double 1 = 2.
Proof.
unfold double. reflexivity.
Qed.
User's Failing Proof (Coq):
Lemma comm_fail : forall x y z : nat, x + y = y + z.
Proof.
intros. reflexivity.
Qed.
Error:
Unable to unify "x + y" with "y + z".
Explanation:
The proof fails because:
reflexivity requires both sides to be syntactically equalx + y and y + z are not equal without knowing x = zSolution:
Either fix the goal or add the necessary assumption:
(* Option 1: Fix the goal to something true *)
Lemma comm_correct : forall x y : nat, x + y = y + x.
Proof.
intros. lia.
Qed.
(* Option 2: Add assumption *)
Lemma comm_with_assumption : forall x y z : nat, x = z -> x + y = y + z.
Proof.
intros. rewrite H. reflexivity.
Qed.
User's Failing Proof (Isabelle):
lemma "x > 0 ⟹ x + y > y"
by simp
Error:
Failed to apply initial proof method
Explanation:
The proof fails because:
x + y > y requires x > 0simp alone is insufficientSolution:
lemma "x > (0::int) ⟹ x + y > y"
by arith
Or in Coq:
Lemma add_positive : forall x y : nat, x > 0 -> x + y > y.
Proof.
intros. lia.
Qed.
User's Failing Proof (Coq):
Lemma or_intro : forall P Q : Prop, P -> P \/ Q.
Proof.
intros. split.
Qed.
Error:
Unable to unify "?P /\ ?Q" with "P \/ Q".
Explanation:
The proof fails because:
split is for conjunction (/\), not disjunction (\/)P \/ Q (disjunction)left or right for disjunctionSolution:
Lemma or_intro : forall P Q : Prop, P -> P \/ Q.
Proof.
intros. left. assumption.
Qed.
User's Failing Proof (Isabelle):
lemma list_comm: "xs @ ys = ys @ xs"
Error:
Failed to apply initial proof method
Explanation:
The proof fails because:
@) is NOT commutative[1] @ [2] = [1,2] but [2] @ [1] = [2,1]Solution:
Fix the goal to something true:
(* Append is associative, not commutative *)
lemma list_assoc: "(xs @ ys) @ zs = xs @ (ys @ zs)"
by simp
User's Failing Proof (Coq):
Lemma app_length : forall (A : Type) (l1 l2 : list A),
length (l1 ++ l2) = length l1 + length l2.
Proof.
intros. induction l2.
- reflexivity.
- simpl. (* Gets stuck *)
Explanation:
The proof fails because:
l2 (second list)++ (append) is defined recursively on the first argumentl1 insteadSolution:
Lemma app_length : forall (A : Type) (l1 l2 : list A),
length (l1 ++ l2) = length l1 + length l2.
Proof.
intros. induction l1.
- reflexivity.
- simpl. rewrite IHl1. reflexivity.
Qed.
When analyzing a failure, ask:
term "expr" - Check type of expressionthm theorem_name - Display theoremfind_theorems pattern - Search for relevant theoremssledgehammer - Automated proof searchtry - Try multiple tacticsCheck term - Display typePrint name - Show definitionSearch pattern - Find lemmasShow Proof - Display proof termSet Printing All - Show implicit argumentsLocate symbol - Find definition of notationIntegration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.
Build and distribute Expo development clients locally or via TestFlight
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.
Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.
Take arabelatso/proof-failure-explainer from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.