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.
Install with Tessl CLI
npx tessl i github:ArabelaTso/Skills-4-SE --skill proof-failure-explainer94
Does it follow best practices?
Validation for skill structure
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:
Proof state:
Error message:
Proof attempt:
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:
State the problem:
Show the mismatch:
Explain why it fails:
Offer concrete fixes:
Immediate fixes:
Alternative approaches:
Code examples:
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 simpError:
Failed to apply initial proof methodExplanation: The proof fails because:
x + y > y requires x > 0simp alone is insufficientSolution:
lemma "x > (0::int) ⟹ x + y > y"
by arithOr 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 methodExplanation: 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 simpUser'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:
Type-related:
Unification-related:
Assumption-related:
Goal-related:
Tactic-related:
Induction-related:
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 notation0f00a4f
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.