跳到正文
cccskills
免费在 GitHub 公开

library-advisor

Recommend relevant Isabelle/HOL or Coq standard library theories, lemmas, and tactics based on proof goals. Use when: (1) Users need library lemmas for their proof, (2) Proof goals match standard library patterns, (3) Users ask what libraries to import, (4) Specific lemmas are needed for list/set/arithmetic operations, (5) Users are stuck and need to know what library support exists, or (6) Guidance on find_theorems/Search commands is needed. Supports both Isabelle/HOL and Coq standard libraries.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(4)

  • SKILL.md7.1 KB
  • references/coq_library.md7.4 KB
  • references/examples.md7.9 KB
  • references/isabelle_library.md6.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Library Usage Advisor

Recommend relevant libraries, lemmas, and theories from Isabelle/HOL or Coq standard libraries based on proof goals.

Workflow

1. Analyze the Proof Goal

Examine the goal to identify:

  • Domain: Lists, sets, arithmetic, logic, etc.
  • Operations: Specific functions or operators involved
  • Pattern: Commutativity, associativity, distributivity, etc.
  • Complexity: Simple property vs. complex relationship

2. Determine Target System

Identify which proof assistant:

  • Isabelle/HOL: Use Main library and extensions
  • Coq: Use standard library (List, Arith, etc.)
  • Both: Provide recommendations for both systems

3. Identify Relevant Libraries

Based on the domain, recommend appropriate libraries:

For list operations:

  • Isabelle: Main (List theory included)
  • Coq: Require Import List. Import ListNotations.

For arithmetic:

  • Isabelle: Main (Nat theory included)
  • Coq: Require Import Arith Lia.

For sets:

  • Isabelle: Main (Set theory included)
  • Coq: Require Import MSets.

For logic:

  • Isabelle: HOL (automatically available)
  • Coq: Require Import Logic.

4. Search for Specific Lemmas

Look for lemmas that directly match the goal:

Exact matches: Lemmas that prove the goal directly Component lemmas: Lemmas for parts of the goal Related lemmas: Similar properties that might help

Use the library reference files:

5. Recommend Usage

Provide concrete recommendations:

Direct application:

lemma "goal"
  by (simp add: relevant_lemma)

With additional steps:

Lemma goal : statement.
Proof.
  apply relevant_lemma.
  (* additional steps *)
Qed.

Manual proof with lemmas: Show how to use lemmas in a structured proof

6. Suggest Search Commands

Teach users how to find lemmas themselves:

Isabelle:

find_theorems "pattern"
find_theorems name: "keyword"
sledgehammer

Coq:

Search pattern.
Search "keyword".
Locate "notation".

Domain-Specific Recommendations

Lists

Common goals:

  • Length properties: length_append, length_rev, length_map
  • Reverse properties: rev_rev_ident, rev_append
  • Append properties: append_assoc, append_Nil
  • Map properties: map_append, map_map
  • Membership: in_set_member, set_append

Libraries:

  • Isabelle: Main (automatic)
  • Coq: List library

Arithmetic

Common goals:

  • Commutativity: add_commute, mult_commute
  • Associativity: add_assoc, mult_assoc
  • Distributivity: add_mult_distrib
  • Inequalities: Use arith/lia tactics

Libraries:

  • Isabelle: Main (Nat theory)
  • Coq: Arith, Lia, Nia

Sets

Common goals:

  • Union/intersection: Un_commute, Int_commute
  • Subset: subset_refl, subset_trans
  • Membership: Un_iff, Int_iff

Libraries:

  • Isabelle: Main (Set theory)
  • Coq: MSets or custom definitions

Logic

Common goals:

  • Conjunction: conjI, conjE
  • Disjunction: disjI1, disjI2
  • Implication: impI, mp
  • Quantifiers: allI, exI

Libraries:

  • Isabelle: HOL (automatic)
  • Coq: Logic (mostly automatic)

Recommendation Patterns

Pattern 1: Exact Lemma Match

When goal exactly matches a known lemma:

Isabelle:

lemma "rev (rev xs) = xs"
  by (simp add: rev_rev_ident)

Coq:

Lemma example : forall l, rev (rev l) = l.
Proof.
  apply rev_involutive.
Qed.

Pattern 2: Combination of Lemmas

When goal needs multiple lemmas:

Isabelle:

lemma "length (rev (xs @ ys)) = length xs + length ys"
  by (simp add: length_rev length_append)

Coq:

Lemma example : forall l1 l2,
  length (rev (l1 ++ l2)) = length l1 + length l2.
Proof.
  intros.
  rewrite rev_length.
  rewrite app_length.
  reflexivity.
Qed.

Pattern 3: Automation

When goal is provable by automation:

Isabelle:

lemma "n + m = m + n"
  by simp
(* Or: by auto, by arith *)

Coq:

Lemma example : forall n m, n + m = m + n.
Proof.
  intros. lia.
Qed.

Pattern 4: Induction with Lemmas

When manual proof needed but lemmas help:

Isabelle:

lemma "property xs"
proof (induction xs)
  case Nil
  show ?case by simp
next
  case (Cons x xs)
  show ?case using Cons.IH by (simp add: helper_lemma)
qed

Coq:

Lemma example : forall l, property l.
Proof.
  induction l as [| x xs IHxs].
  - simpl. reflexivity.
  - simpl. rewrite IHxs. apply helper_lemma.
Qed.

Search Strategies

Strategy 1: Pattern-Based Search

Isabelle:

find_theorems "rev (rev _) = _"
find_theorems "length (_ @ _)"
find_theorems "_ + _ = _ + _"

Coq:

Search rev.
Search (_ ++ _).
Search (?x + ?y = ?y + ?x).

Strategy 2: Name-Based Search

Isabelle:

find_theorems name: "append"
find_theorems name: "comm"

Coq:

Search "append".
Search "comm" (_ + _).

Strategy 3: Type-Based Search

Coq:

Search (list _ -> nat).
Search (_ -> _ -> _ + _).

Strategy 4: Sledgehammer/Auto

Isabelle:

lemma "goal"
  sledgehammer
  (* Suggests relevant lemmas and tactics *)

Coq:

Lemma goal : statement.
Proof.
  auto.  (* Try automatic tactics *)
Qed.

Common Recommendations by Goal Type

"rev (rev xs) = xs"

  • Isabelle: rev_rev_ident or by simp
  • Coq: rev_involutive

"length (xs @ ys) = length xs + length ys"

  • Isabelle: length_append or by simp
  • Coq: app_length

"n + m = m + n"

  • Isabelle: add_commute or by simp
  • Coq: plus_comm or lia

"x ∈ set (xs @ ys) ⟷ x ∈ set xs ∨ x ∈ set ys"

  • Isabelle: set_append
  • Coq: in_app_iff

"map f (xs @ ys) = map f xs @ map f ys"

  • Isabelle: map_append
  • Coq: map_app

Examples

For complete examples with specific proof goals and library recommendations, see examples.md.

Tips

  • Search first: Use find_theorems/Search before proving manually
  • Check automation: Try simp/auto/lia before complex proofs
  • Use sledgehammer: In Isabelle, sledgehammer finds relevant lemmas
  • Import early: Import all needed libraries at the start
  • Learn patterns: Common properties (commutativity, etc.) have standard names
  • Read library docs: Browse standard library documentation
  • Build intuition: Learn which libraries contain which lemmas
  • Combine lemmas: Complex goals often need multiple lemmas
  • Simplify first: Use simp/simpl to reduce goals before searching

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

CLI-based browser automation with persistent page state using ref-based element interaction. Use when users ask to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

查看 ArabelaTso 的全部技能

报告此技能的问题