Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính14k · #11155

reason

Skill này làm gì

Skill áp dụng lý luận logic lên các sự kiện trong đồ thị tri thức Semantica để đưa ra kết luận hoặc đề xuất giải thích. Skill dành cho người muốn đồ thị tự suy ra kết luận từ các quy tắc họ định nghĩa.

Khi nào nên dùng

  • ✓Khi bạn có các sự kiện và quy tắc và muốn đồ thị tìm ra kết luận.
  • ✓Khi bạn có một quan sát và muốn các giải thích khả dĩ cho nó.
  • ✓Khi bạn muốn kiểm tra xem một khẳng định có được suy ra từ các sự kiện đã biết không.

Liên kết skill

https://github.com/semantica-agi/semantica/blob/main/plugins/skills/reason/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/semantica-agi/semantica/blob/main/plugins/skills/reason/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Dựa trên các sự kiện này về nhà cung cấp của chúng tôi và quy tắc này, bạn có thể tìm ra nhà cung cấp nào không được phép đấu thầu không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent thêm các sự kiện và quy tắc của bạn vào một động cơ lý luận, áp dụng chúng để đạt kết luận, và báo cáo từng kết luận cùng quy tắc đã tạo ra nó. Nó cũng có thể thử chứng minh một mệnh đề và sinh giả thuyết giải thích quan sát.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

/semantica:reason

Apply reasoning over the knowledge graph. Usage: /semantica:reason <mode> [args]

$ARGUMENTS = reasoning mode + rules/observations/query.


deductive [--facts '<json-list>'] [--rules '<rule1>|<rule2>']

Apply deductive rules to known facts to derive new conclusions.

from semantica.reasoning.deductive_reasoner import DeductiveReasoner, Premise

reasoner = DeductiveReasoner()

# Add base facts to working memory
# Facts can be strings like "Person(John)" or structured dicts
import json
facts = json.loads(facts_json) if facts_json else []
reasoner.add_facts(facts)

# Apply logic with explicit premises
# Premise objects have: statement, confidence, source
premises = [
    Premise(statement=fact, confidence=1.0)
    for fact in facts
]

conclusions = reasoner.apply_logic(premises=premises)

Return: | Conclusion | Triggering Premises | Confidence | Rule Applied |

If zero rules given, run reasoner.prove_theorem() on any provided theorem:

proof = reasoner.prove_theorem(theorem=theorem_text)

Output: Proof: <proof.steps> | Valid: YES / NO


prove <theorem> [--facts '<json-list>']

Prove or disprove a theorem against known facts.

from semantica.reasoning.deductive_reasoner import DeductiveReasoner

reasoner = DeductiveReasoner()
import json
reasoner.add_facts(json.loads(facts_json) if facts_json else [])

proof = reasoner.prove_theorem(theorem=theorem)

Output:

Theorem: "<theorem>"
Result:  PROVED ✓  |  DISPROVED ✗  |  UNDECIDABLE ⚠

Proof steps:
  1. <premise> — <justification>
  2. ...
  → QED: <theorem>

Confidence: <proof.confidence>

abductive <observation> [--knowledge '<json-list>'] [--top N]

Generate and rank hypotheses that explain an observation.

from semantica.reasoning.abductive_reasoner import (
    AbductiveReasoner, Observation
)

reasoner = AbductiveReasoner()

import json
if knowledge_json:
    reasoner.add_knowledge(json.loads(knowledge_json))

obs = Observation(description=observation)

# Generate all hypotheses then rank them
hypotheses = reasoner.generate_hypotheses(observations=[obs])
ranked = reasoner.rank_hypotheses(hypotheses)
best = reasoner.get_best_explanation(obs)

# Also get full explanations with evidence
explanations = reasoner.find_explanations(observations=[obs])

Output:

Abductive Reasoning for: "<observation>"

Best explanation:
  <best.description>  (confidence: 0.87)

All hypotheses (ranked):
  | Rank | Hypothesis | Confidence | Supporting Evidence |
  |  1   | <hyp>      | 0.87       | <evidence>         |
  |  2   | ...

Full explanations:
  Explanation 1: <explanation.summary>
    Evidence: <evidence items>

datalog <program>

Evaluate a Datalog program over graph facts.

from semantica.reasoning.datalog_reasoner import DatalogReasoner
from semantica.context import ContextGraph

graph = ContextGraph()
reasoner = DatalogReasoner()

# program is a string of Datalog rules and queries
results = reasoner.evaluate(program=program, graph=graph)

Return derived tuples as a relation table. Show rule derivation counts.


sparql <query>

Run a SPARQL query over the knowledge graph and return results.

from semantica.reasoning.sparql_reasoner import SPARQLReasoner
from semantica.context import ContextGraph

graph = ContextGraph()
reasoner = SPARQLReasoner()

results = reasoner.query(sparql_query=query, graph=graph)

Return as a Markdown table with bound variable columns matching the SELECT clause.


rete [--rules '<rule1>|<rule2>'] [--facts '<json-list>']

Incremental rule evaluation using the Rete network with working memory.

from semantica.reasoning.rete_engine import ReteEngine
import json

engine = ReteEngine()

rules = rules_str.split("|") if rules_str else []
facts = json.loads(facts_json) if facts_json else []

engine.load_rules(rules)
engine.process_facts(facts)
activations = engine.get_activations()

Return: | Rule Fired | Variable Bindings | Working Memory Delta | Activation Order |


hypotheses "<scenario>" [--knowledge '<json-list>'] [--top N]

Generate the top-N most probable explanations for a complex scenario.

from semantica.reasoning.abductive_reasoner import AbductiveReasoner, Observation
import json

reasoner = AbductiveReasoner()
if knowledge_json:
    reasoner.add_knowledge(json.loads(knowledge_json))

obs = Observation(description=scenario)
hypotheses 
Câu hỏi thường gặp

Suy luận ngược là gì?

Là lý luận từ một quan sát ngược lại để tìm các giải thích có khả năng nhất.

Nó có chứng minh được một khẳng định không?

Có. Nó có thể kiểm tra một định lý với các sự kiện đã biết và báo cáo liệu chứng minh có đứng vững không.

Nó hỗ trợ những kiểu quy tắc nào?

Nhiều kiểu, gồm chương trình Datalog, truy vấn SPARQL và đánh giá mạng Rete.

Chi tiết

Mô tả gốc của tác giả

Run reasoning over the Semantica knowledge graph — deductive logic, abductive hypothesis generation, Datalog programs, SPARQL queries, Rete network evaluation. Uses DeductiveReasoner, AbductiveReasoner, DatalogReasoner, SPARQLReasoner, ReteEngine. Sub-commands: deductive, abductive, datalog, sparql, rete, prove, hypotheses.

repo: semantica-agi/semantica

Độ phổ biến

Sao GitHub
14k
Vị trí xếp hạng
#11155
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự