Proof State Analysis Patterns
Guide for analyzing proof states and suggesting appropriate tactics.
Analysis Framework
When analyzing a proof state, examine:
- Goal structure: What logical form does the goal have?
- Available hypotheses: What facts are in the context?
- Variable types: What are we working with (nat, list, custom types)?
- Recursion opportunities: Can we apply induction or case analysis?
- Simplification potential: Can computation or rewriting help?
Pattern Matching by Goal Structure
Goal: Conjunction P ∧ Q (Isabelle) / P /\ Q (Coq)
Analysis: Need to prove both parts separately.
Isabelle suggestions:
apply (rule conjI)- Split into two subgoalsby auto- If both parts are trivialby simp- If simplification proves both
Coq suggestions:
split.- Split into two subgoalsauto.- If both parts are trivialintuition.- Propositional reasoning
Goal: Implication P ⟹ Q (Isabelle) / P -> Q (Coq)
Analysis: Assume P and prove Q.
Isabelle suggestions:
apply (rule impI)- Move P to assumptionsproof -thenassume "P"- Structured proofby auto- If Q follows from P automatically
Coq suggestions:
intro H.- Introduce hypothesis H: Pintros.- Introduce all implicationsauto.- If Q follows automatically
Goal: Universal Quantification ∀x. P x (Isabelle) / forall x, P x (Coq)
Analysis: Prove for arbitrary x.
Isabelle suggestions:
apply (rule allI)- Introduce arbitrary xproof -thenfix x- Structured proofby auto- If automation handles it
Coq suggestions:
intro x.- Introduce arbitrary xintros.- Introduce all quantifiersauto.- If automation handles it
Goal: Existential Quantification ∃x. P x (Isabelle) / exists x, P x (Coq)
Analysis: Need to provide a witness.
Isabelle suggestions:
apply (rule exI[where x="witness"])- Provide witnessby auto- If witness can be found automaticallyby force- Aggressive search for witness
Coq suggestions:
exists witness.- Provide witnesseauto.- Search for witness automaticallyfirstorder.- First-order reasoning
Goal: Disjunction P ∨ Q (Isabelle) / P \/ Q (Coq)
Analysis: Choose which side to prove.
Isabelle suggestions:
apply (rule disjI1)- Prove left side (P)apply (rule disjI2)- Prove right side (Q)by auto- If automation can choose
Coq suggestions:
left.- Prove left side (P)right.- Prove right side (Q)auto.- If automation can choose
Goal: Equality t1 = t2
Analysis: Can we compute, rewrite, or simplify?
Isabelle suggestions:
by simp- Simplificationby (simp add: defs)- Unfold definitionsapply (subst rule)- Rewrite with equationby auto- Automatic reasoning
Coq suggestions:
reflexivity.- If equal by computationsimpl. reflexivity.- Simplify then checkrewrite H. reflexivity.- Rewrite with hypothesisauto.- Automatic reasoning
Goal: Negation ¬P (Isabelle) / ~ P (Coq)
Analysis: Assume P and derive contradiction.
Isabelle suggestions:
apply (rule notI)- Introduce P, prove Falseby contradiction- Derive contradictionby auto- If contradiction is obvious
Coq suggestions:
intro H.- Introduce hypothesis H: Pcontradiction.- Derive contradictionauto.- If contradiction is obvious
Pattern Matching by Variable Types
Working with Lists
Indicators: Variables of type 'a list (Isabelle) or list A (Coq)
Isabelle suggestions:
proof (induction xs)- List inductionproof (cases xs)- Case analysis (empty vs cons)by (simp add: list_rules)- Simplify with list lemmas
Coq suggestions:
induction l as [|x l' IH].- List inductiondestruct l as [|x l'].- Case analysissimpl. auto.- Simplify and auto
Working with Natural Numbers
Indicators: Variables of type nat
Isabelle suggestions:
proof (induction n)- Natural number inductionproof (cases n)- Case analysis (0 vs Suc)by arith- Arithmetic decision procedure
Coq suggestions:
induction n as [|n' IH].- Natural number inductiondestruct n as [|n'].- Case analysislia.- Linear arithmetic solver
Working with Options
Indicators: Variables of type 'a option (Isabelle) or option A (Coq)
Isabelle suggestions:
proof (cases opt)- Case analysis (None vs Some)by (auto split: option.split)- Auto with case split
Coq suggestions:
destruct opt as [x|].- Case analysisdestruct opt eqn:E.- Case analysis with equation
Working with Custom Datatypes
Indicators: Variables of custom inductive types (trees, etc.)
Isabelle suggestions:
proof (induction t)- Structural inductionproof (cases t)- Case analysis on constructorsby (auto split: datatype.split)- Auto with splits
Coq suggestions:
induction t.- Structural inductiondestruct t.- Case analysis on constructorsauto.- Automatic reasoning
Pattern Matching by Hypotheses
Hypothesis: Conjunction H: P ∧ Q (Isabelle) / H: P /\ Q (Coq)
Analysis: Can extract both parts.
Isabelle suggestions:
from H have "P" and "Q" by simp_all- Extract bothusing H by simp- Use directly
Coq suggestions:
destruct H as [HP HQ].- Extract both partsapply H.- Use directly if applicable
Hypothesis: Disjunction H: P ∨ Q (Isabelle) / H: P \/ Q (Coq)
Analysis: Need case analysis.
Isabelle suggestions:
proof (cases rule: H)- Case analysis on Husing H by auto- Let automation handle
Coq suggestions:
destruct H as [HP|HQ].- Case analysisintuition.- Let automation handle
Hypothesis: Existential H: ∃x. P x (Isabelle) / H: exists x, P x (Coq)
Analysis: Extract witness.
Isabelle suggestions:
from H obtain x where "P x" by auto- Extract witnessusing H by auto- Use directly
Coq suggestions:
destruct H as [x HP].- Extract witnessapply H.- Use directly if applicable
Hypothesis: Equation H: t1 = t2
Analysis: Can rewrite with it.
Isabelle suggestions:
using H by simp- Simplify with equationapply (subst H)- Substitute in goalfrom H show ?thesis- Use directly
Coq suggestions:
rewrite H.- Rewrite in goalrewrite H in *.- Rewrite everywheresubst.- Substitute all equations
Hypothesis: Inductive Predicate
Analysis: Can invert to get structure.
Isabelle suggestions:
from H show ?thesis by (cases H)- Case analysisusing H by auto- Use directly
Coq suggestions:
inversion H.- Invert the predicateinversion H; subst.- Invert and substituteapply H.- Use directly if applicable
Situation-Based Suggestions
Situation: Stuck on Complex Goal
Indicators: Goal has many connectives, nested structure
Isabelle suggestions:
by auto- Try full automationby fastforce- Aggressive automationby (auto intro: rules)- Auto with hintssledgehammer- Invoke external provers
Coq suggestions:
auto.- Try automationintuition.- Propositional reasoningfirstorder.- First-order reasoningtauto.- Tautology solver
Situation: Need Intermediate Lemma
Indicators: Direct proof seems difficult, need stepping stone
Isabelle suggestions:
have "intermediate_fact" by method- Prove intermediatefrom assms have "fact" by method- Derive from assumptions
Coq suggestions:
assert (H: intermediate_fact).- State intermediatepose proof (lemma args) as H.- Use existing lemma
Situation: Induction Hypothesis Not Strong Enough
Indicators: IH doesn't apply, need generalization
Isabelle suggestions:
proof (induction xs arbitrary: ys)- Generalize variables- Restart with stronger statement
Coq suggestions:
generalize dependent y.- Generalize before inductionrevert y.- Move variable back to goal- Restart with stronger statement
Situation: Case Analysis Needed
Indicators: Goal or hypothesis has conditional, pattern match
Isabelle suggestions:
proof (cases "condition")- Case split on conditionby (auto split: if_split)- Auto with if-splitproof (cases var)- Case analysis on variable
Coq suggestions:
destruct (condition).- Case splitdestruct var.- Case analysis on variablecase_eq term.- Case analysis with equation
Situation: Arithmetic Goal
Indicators: Goal involves +, -, *, <, ≤, etc.
Isabelle suggestions:
by arith- Arithmetic decision procedureby linarith- Linear arithmeticby simp- Simplification may suffice
Coq suggestions:
lia.- Linear integer arithmeticnia.- Non-linear arithmeticring.- Ring solver
Situation: Equality with Constructors
Indicators: Hypothesis like Cons x xs = Cons y ys or S n = S m
Isabelle suggestions:
by simp- Simplification extracts equalitiesby auto- Automatic reasoning
Coq suggestions:
injection H.- Extract equalitiesinjection H as H1 H2.- Extract and nameinversion H; subst.- Invert and substitute
Situation: Impossible Equality
Indicators: Hypothesis like [] = x :: xs or 0 = S n
Isabelle suggestions:
by simp- Simplification derives contradictionby auto- Automatic reasoning
Coq suggestions:
discriminate.- Derive contradictiondiscriminate H.- Use specific hypothesisinversion H.- Invert (also finds contradiction)
Ranking Tactics by Likelihood
When multiple tactics apply, rank by:
- Structural match: Does the tactic directly match the goal form?
- Simplicity: Simpler tactics before complex ones
- Automation potential: Can automation solve it?
- Common patterns: Is this a standard proof pattern?
- Context fit: Do hypotheses support this approach?
Example ranking for goal P ∧ Q:
- Split tactic (direct structural match)
- Auto (if both parts are simple)
- Manual proof of each part (fallback)