Logo Lemma Discovery Assistant

Lemma Discovery Assistant

Cộng đồng
ArabelaTso
lemma-discovery-assistant

Analyze failed or stuck proofs and propose auxiliary lemmas to help complete the proof in Isabelle/HOL or Coq. Use when encountering proof failures, stuck proof states, unprovable subgoals, or when needing to strengthen induction hypotheses. Identifies missing lemmas, suggests proof strategies, and generates helper lemmas with appropriate statements and proof sketches. Supports inductive proofs, case analysis, rewriting, and complex proof obligations.

Tổng quan

Nhà phát hànhArabelaTso
Kho mãSkills-4-SE
Tên kỹ nănglemma-discovery-assistant
Sao
258
Bản fork
25
Tệp đi kèm
3
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được ArabelaTso công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Lemma Discovery Assistant trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/lemma-discovery-assistant
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git /tmp/Skills-4-SE
mkdir -p .claude/skills
cp -r /tmp/Skills-4-SE/skills/lemma-discovery-assistant .claude/skills/lemma-discovery-assistant
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Lemma Discovery Assistant trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Lemma Discovery Assistant ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Lemma Discovery Assistant với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Lemma Discovery Assistant

Analyze stuck or failed proofs and propose auxiliary lemmas that can help complete the proof.

Overview

When proofs fail or get stuck, the issue is often a missing auxiliary lemma. This skill helps identify what lemmas are needed by:

  1. Analyzing the current proof state and goal
  2. Identifying gaps in reasoning
  3. Proposing auxiliary lemmas with precise statements
  4. Suggesting proof strategies for the lemmas
  5. Explaining how the lemmas help the main proof

When Proofs Get Stuck

Common Symptoms

Unprovable subgoal:

  • Tactics fail to make progress
  • Goal seems "obviously true" but won't prove
  • Missing connection between hypotheses and goal

Weak induction hypothesis:

  • Induction step fails
  • Need stronger property to prove
  • Generalization required

Missing intermediate steps:

  • Large gap between current state and goal
  • Need stepping stones
  • Complex reasoning required

Insufficient rewrite rules:

  • Simplification doesn't go far enough
  • Need additional equations
  • Definitions need unfolding lemmas

Lemma Discovery Process

Step 1: Analyze Proof State

Examine the current proof context:

What to look for:

  • Current goal statement
  • Available hypotheses/assumptions
  • Failed tactic and error message
  • Proof structure (induction, case analysis, etc.)
  • Type information and constraints

Questions to ask:

  • What is the proof trying to show?
  • What information is available?
  • What is missing?
  • Why did the tactic fail?

Step 2: Identify the Gap

Determine what's preventing progress:

Gap types:

  • Property gap: Need to establish intermediate property
  • Generalization gap: Current statement too specific
  • Rewrite gap: Need equation to simplify
  • Structural gap: Need lemma about data structure
  • Induction gap: Induction hypothesis too weak

Step 3: Propose Lemma Statement

Formulate precise lemma statement:

Lemma characteristics:

  • Precise: Exact types and conditions
  • General: Not overly specific to one case
  • Provable: Can be proven independently
  • Useful: Actually helps the main proof

Example patterns:

(* Isabelle *)
lemma helper_name: "⟦ assumptions ⟧ ⟹ conclusion"

(* Coq *)
Lemma helper_name : assumptions → conclusion.

Step 4: Suggest Proof Strategy

Provide guidance on proving the lemma:

Strategy types:

  • Induction (structural, well-founded, strong)
  • Case analysis
  • Rewriting and simplification
  • Unfolding definitions
  • Using existing lemmas

Step 5: Explain Usage

Show how the lemma helps the main proof:

  • Where to apply it
  • What tactic to use
  • How it closes the gap

Lemma Patterns by Proof Type

Inductive Proofs

Problem: Induction hypothesis too weak.

Solution: Strengthen the induction hypothesis.

Example (Isabelle):

Stuck proof:

isabelle
lemma "length (reverse xs) = length xs"
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons x xs)
  (* Stuck: reverse (x # xs) = reverse xs @ [x]
     but we don't have a lemma about length of append *)
  then show ?case sorry
qed

Proposed lemma:

isabelle
lemma length_append: "length (xs @ ys) = length xs + length ys"
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons x xs)
  then show ?case by simp
qed

Usage: Apply length_append in the induction step.

Generalization Lemmas

Problem: Statement too specific to prove by induction.

Solution: Generalize with accumulator or additional parameter.

Example (Coq):

Stuck proof:

coq
Fixpoint reverse {A} (l : list A) : list A :=
  match l with
  | [] => []
  | x :: xs => reverse xs ++ [x]
  end.

Lemma reverse_involutive : forall A (l : list A),
  reverse (reverse l) = l.
Proof.
  induction l.
  - reflexivity.
  - simpl. (* Stuck: need reverse (reverse l ++ [a]) = a :: l *)
Abort.

Proposed lemma:

coq
Lemma reverse_append : forall A (l1 l2 : list A),
  reverse (l1 ++ l2) = reverse l2 ++ reverse l1.
Proof.
  induction l1; intros; simpl.
  - rewrite app_nil_r. reflexivity.
  - rewrite IHl1. rewrite app_assoc. reflexivity.
Qed.

Usage: Use reverse_append to handle the append in the goal.

Rewrite Lemmas

Problem: Simplification doesn't reach desired form.

Solution: Add rewrite rules for specific patterns.

Example (Isabelle):

Stuck proof:

isabelle
lemma "map f (map g xs) = map (f ∘ g) xs"
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons x xs)
  (* Need: (f ∘ g) x = f (g x) *)
  then show ?case sorry
qed

Proposed lemma:

isabelle
lemma comp_apply: "(f ∘ g) x = f (g x)"
  by (simp add: comp_def)

Usage: Add to simplification set or apply explicitly.

Structural Lemmas

Problem: Need properties about data structure operations.

Solution: Prove fundamental properties of the structure.

Example (Coq):

Stuck proof:

coq
Fixpoint insert (x : nat) (t : tree) : tree := (* ... *)

Lemma insert_member : forall x t,
  member x (insert x t) = true.
Proof.
  induction t.
  - (* Stuck: need properties of member and insert *)
Abort.

Proposed lemmas:

coq
Lemma member_insert_eq : forall x y t,
  x = y → member x (insert y t) = true.

Lemma member_insert_neq : forall x y t,
  x ≠ y → member x (insert y t) = member x t.

Lemma member_insert : forall x y t,
  member x (insert y t) = (x =? y) || member x t.

Usage: Case split on x = y and apply appropriate lemma.

Framework-Specific Guidance

Isabelle/HOL Lemma Discovery

For Isabelle-specific lemma patterns, tactics, and the sledgehammer tool, see references/isabelle_lemmas.md.

Key features:

  • Sledgehammer for automatic lemma discovery
  • try and try0 for tactic exploration
  • Simplification set management
  • Induction and case analysis patterns

Coq Lemma Discovery

For Coq-specific lemma patterns, tactics, and proof search, see references/coq_lemmas.md.

Key features:

  • Search and SearchAbout for finding lemmas
  • auto, eauto for proof search
  • Proof automation with Ltac
  • Inversion and case analysis

Common Lemma Categories

For detailed lemma patterns organized by category, see references/proof_patterns.md.

Categories include:

  • List lemmas (append, reverse, map, filter)
  • Arithmetic lemmas (associativity, commutativity, distributivity)
  • Set/Map lemmas (membership, union, intersection)
  • Induction strengthening patterns
  • Generalization patterns

Example: Complete Lemma Discovery

Scenario: Proving correctness of insertion sort.

Main theorem (Isabelle):

isabelle
lemma insertion_sort_correct:
  "sorted (insertion_sort xs) ∧ mset (insertion_sort xs) = mset xs"

Stuck proof:

isabelle
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons x xs)
  (* Need to show:
     sorted (insert x (insertion_sort xs))
     mset (insert x (insertion_sort xs)) = mset (x # xs) *)
  then show ?case sorry
qed

Analysis:

  1. Need properties of insert function
  2. Need to show insert preserves sorting
  3. Need to show insert preserves multiset

Proposed lemmas:

isabelle
(* Lemma 1: insert preserves sorting *)
lemma insert_sorted:
  "sorted xs ⟹ sorted (insert x xs)"
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons y ys)
  then show ?case
    by (auto simp: sorted_Cons)
qed

(* Lemma 2: insert preserves multiset *)
lemma mset_insert:
  "mset (insert x xs) = {#x#} + mset xs"
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons y ys)
  then show ?case by (auto simp: ac_simps)
qed

(* Lemma 3: sorted definition for cons *)
lemma sorted_Cons:
  "sorted (x # xs) = (sorted xs ∧ (∀y ∈ set xs. x ≤ y))"
  by (auto simp: sorted_append)

Revised main proof:

isabelle
lemma insertion_sort_correct:
  "sorted (insertion_sort xs) ∧ mset (insertion_sort xs) = mset xs"
proof (induction xs)
  case Nil
  then show ?case by simp
next
  case (Cons x xs)
  have "sorted (insertion_sort xs)" using Cons by simp
  then have "sorted (insert x (insertion_sort xs))"
    by (rule insert_sorted)
  moreover have "mset (insert x (insertion_sort xs)) = {#x#} + mset (insertion_sort xs)"
    by (rule mset_insert)
  moreover have "mset (insertion_sort xs) = mset xs"
    using Cons by simp
  ultimately show ?case by (auto simp: ac_simps)
qed

Lemma Discovery Strategies

Bottom-Up Discovery

  1. Start with failed proof
  2. Identify immediate obstacle
  3. Propose lemma for that obstacle
  4. Recursively discover lemmas for the proposed lemma
  5. Build up from base cases

Top-Down Discovery

  1. Analyze overall proof structure
  2. Identify major proof steps
  3. Propose high-level lemmas
  4. Refine each lemma
  5. Fill in details

Pattern Matching

  1. Recognize common proof patterns
  2. Apply standard lemmas for that pattern
  3. Adapt to specific context
  4. Verify applicability

Best Practices

  1. Start Simple: Propose simplest lemma that could help
  2. Be Specific: Precise types and conditions
  3. Check Provability: Ensure lemma is actually provable
  4. Verify Usefulness: Confirm lemma helps main proof
  5. Avoid Circularity: Lemma shouldn't depend on main theorem
  6. Generalize Appropriately: Not too specific, not too general
  7. Name Clearly: Descriptive names aid understanding

Troubleshooting

Lemma Still Doesn't Help

Possible issues:

  • Lemma statement incorrect
  • Need additional lemmas
  • Wrong proof strategy
  • Main theorem statement flawed

Solutions:

  • Revisit proof state analysis
  • Try different generalization
  • Consider alternative approach
  • Check theorem statement

Lemma Itself Won't Prove

Possible issues:

  • Lemma too strong
  • Missing preconditions
  • Need intermediate lemmas
  • Requires different proof technique

Solutions:

  • Weaken conclusion
  • Add necessary assumptions
  • Discover sub-lemmas
  • Try different proof method

Additional Resources

For detailed guidance on specific aspects:

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Lemma Discovery Assistant làm được gì?

Analyze failed or stuck proofs and propose auxiliary lemmas to help complete the proof in Isabelle/HOL or Coq. Use when encountering proof failures, stuck proof states, unprovable subgoals, or when needing to strengthen induction hypotheses. Identifies missing lemmas, suggests proof strategies, and generates helper lemmas with appropriate statements and proof sketches. Supports inductive proofs, case analysis, rewriting, and complex proof obligations.

Vì sao nên dùng Lemma Discovery Assistant trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Lemma Discovery Assistant là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Lemma Discovery Assistant trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/lemma-discovery-assistant. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Lemma Discovery Assistant?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Lemma Discovery Assistant với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Lemma Discovery Assistant với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Lemma Discovery Assistant có miễn phí không?

Có. Kỹ năng này được ArabelaTso phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇