Skills-4-SE tactic-suggestion-assistant
Analyze proof states in Isabelle or Coq and suggest applicable tactics to make progress. Use when users need help with: (1) Choosing the next tactic in an interactive proof, (2) Understanding what tactics apply to their current goal, (3) Getting unstuck in a proof, (4) Learning which tactics work for specific goal structures (conjunctions, implications, induction, etc.). Provides 3-5 ranked tactic suggestions with explanations for intermediate-level proofs in both Isabelle/Isar and Coq.
git clone https://github.com/ArabelaTso/Skills-4-SE
T=$(mktemp -d) && git clone --depth=1 https://github.com/ArabelaTso/Skills-4-SE "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/tactic-suggestion-assistant" ~/.claude/skills/arabelatso-skills-4-se-tactic-suggestion-assistant && rm -rf "$T"
skills/tactic-suggestion-assistant/SKILL.mdTactic Suggestion Assistant
Analyze proof states and suggest applicable tactics to make progress in Isabelle or Coq.
Overview
This skill helps you navigate interactive proofs by analyzing the current proof state and suggesting 3-5 ranked tactics that can make progress. It works with both Isabelle/Isar and Coq, providing system-specific suggestions with explanations.
How to Use
Provide the current proof state including:
- System: Isabelle or Coq
- Goal: The current goal to prove
- Context: Available hypotheses/assumptions (if any)
- Variables: Types of variables involved (optional but helpful)
The assistant will analyze the state and suggest tactics ranked by likelihood of success.
Analysis Process
Step 1: Identify the Proof System
Determine whether you're working in Isabelle or Coq based on syntax:
- Isabelle: Uses
,⟹
,∧
,∨
,∀
,∃
, etc.'a list - Coq: Uses
,->
,/\
,\/
,forall
,exists
, etc.list A
Step 2: Analyze Goal Structure
Examine the goal's logical form:
- Conjunction:
/P ∧ Q
→ Split tacticsP /\ Q - Implication:
/P ⟹ Q
→ Introduction tacticsP -> Q - Quantification:
/∀x. P
→ Variable introductionforall x, P - Equality:
→ Simplification or rewritingt1 = t2 - Inductive types: Lists, nat, trees → Induction or case analysis
Step 3: Examine Context
Look at available hypotheses:
- Equations: Can be used for rewriting
- Inductive predicates: Can be inverted or used directly
- Conjunctions: Can be decomposed
- Disjunctions: Require case analysis
Step 4: Consider Variable Types
Type information guides tactic choice:
- Lists: Suggest induction or case analysis (empty vs cons)
- Natural numbers: Suggest induction or case analysis (0 vs successor)
- Options: Suggest case analysis (None vs Some)
- Custom types: Suggest structural induction
Step 5: Rank Suggestions
Provide 3-5 tactics ranked by:
- Structural match with goal
- Simplicity and directness
- Automation potential
- Common proof patterns
- Context support
Suggestion Format
For each suggested tactic, provide:
- Tactic: The exact tactic syntax
- Rationale: Why this tactic applies
- Effect: What happens after applying it
- Likelihood: High/Medium/Low
Example: Isabelle Proof State
Proof state:
goal (1 subgoal): 1. ⋀xs ys. length xs = length ys ⟹ length (xs @ ys) = 2 * length xs
Analysis:
- Goal: Implication with equality
- Hypothesis:
length xs = length ys - Variables: Lists
andxsys
Suggestions:
-
(High likelihood)by simp- Rationale: Goal is an arithmetic equality that simplification can handle
- Effect: Simplifies
tolength (xs @ ys)
, then uses hypothesislength xs + length ys - Try this first for simple arithmetic goals
-
(Medium likelihood)apply (subst length_append)- Rationale: Explicitly unfold the append length property
- Effect: Rewrites
tolength (xs @ ys)length xs + length ys - More explicit than simp, useful if simp fails
-
(Medium likelihood)using assms by auto- Rationale: Use assumptions with automation
- Effect: Combines hypothesis with automatic reasoning
- Good fallback if simp doesn't work
Example: Coq Proof State
Proof state:
1 subgoal n : nat IHn : even n -> even (n + 2) ============================ even n -> even (S (S n))
Analysis:
- Goal: Implication
- Hypothesis: Induction hypothesis
IHn - Variables: Natural number
n - Context: In an induction proof
Suggestions:
-
(High likelihood)intro H.- Rationale: Goal is an implication, introduce the hypothesis
- Effect: Adds
to context, goal becomesH: even neven (S (S n)) - Standard first step for implications
-
(High likelihood)intros. simpl. apply IHn. assumption.- Rationale: Complete proof chain using IH
- Effect: Introduces hypothesis, simplifies, applies IH, solves with assumption
- Direct solution if
simplifies toS (S n)n + 2
-
(Medium likelihood)intro H. rewrite <- plus_n_Sm. rewrite <- plus_n_O. apply IHn. exact H.- Rationale: Rewrite to match IH form
- Effect: Converts
toS (S n)
form to use IHn + 2 - Needed if simplification doesn't automatically match
-
(Low likelihood)auto.- Rationale: Try automation
- Effect: May solve if proof is straightforward
- Worth trying but may not have enough hints
Common Situations
Situation: Conjunction Goal
Isabelle:
⊢ P ∧ Q
- Split into two goalsapply (rule conjI)
- If both parts are trivialby auto
- If simplification proves bothby simp
Coq:
P /\ Q
- Split into two goalssplit.
- If both parts are trivialauto.
- Propositional reasoningintuition.
Situation: Need Induction
Indicators: Goal about all elements of a list/nat, recursive structure
Isabelle:
- List inductionproof (induction xs)
- Nat inductionproof (induction n)
- Custom type inductionproof (induction t)
Coq:
- List inductioninduction l as [|x l' IH].
- Nat inductioninduction n as [|n' IH].
- Custom type inductioninduction t.
Situation: Case Analysis Needed
Indicators: Goal or hypothesis with conditional, pattern match
Isabelle:
- Case analysis on variableproof (cases xs)
- Case split on booleanproof (cases "condition")
- Auto with case splitby (auto split: if_split)
Coq:
- Case analysis on variabledestruct l as [|x l'].
- Case split on booleandestruct (condition).
- Case analysis with equationcase_eq term.
Situation: Arithmetic Goal
Indicators: Goal with +, -, *, <, ≤
Isabelle:
- Arithmetic decision procedureby arith
- Linear arithmeticby linarith
- Simplificationby simp
Coq:
- Linear integer arithmeticlia.
- Non-linear arithmeticnia.
- Ring solverring.
Situation: Stuck on Complex Goal
Indicators: Many connectives, nested structure
Isabelle:
- Full automationby auto
- Aggressive automationby fastforce
- External proverssledgehammer
Coq:
- Automationauto.
- Propositional reasoningintuition.
- First-order reasoningfirstorder.
- Tautology solvertauto.
References
Detailed tactic references and patterns:
- isabelle_tactics.md: Complete Isabelle/Isar tactic reference
- coq_tactics.md: Complete Coq tactic reference
- proof_patterns.md: Detailed proof state analysis patterns
Load these references when you need:
- Complete tactic syntax and options
- Advanced tactic usage
- Detailed pattern matching rules
- Tactic combinators and composition
Tips for Effective Suggestions
- Start simple: Suggest automation (
,auto
) before manual tacticssimp - Match structure: Prioritize tactics that directly match the goal form
- Consider context: Use available hypotheses in suggestions
- Explain effects: Clearly state what happens after applying the tactic
- Provide alternatives: Offer 3-5 options ranked by likelihood
- Be specific: Give exact syntax, not just tactic names
- Learn from failures: If a suggested tactic fails, analyze why and suggest alternatives