一键导入
confluence-guide
Guide for proving confluence of a rewriting system. Use when asked to prove Church-Rosser or confluence properties.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for proving confluence of a rewriting system. Use when asked to prove Church-Rosser or confluence properties.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | confluence-guide |
| description | Guide for proving confluence of a rewriting system. Use when asked to prove Church-Rosser or confluence properties. |
This skill provides guidance for proving confluence of rewriting systems in the Metatheory project.
Best when: The reduction relation has an obvious "parallel" version.
Define parallel reduction that contracts multiple redexes simultaneously:
inductive ParRed : Term → Term → Prop where
| var : ParRed (var n) (var n)
| app : ParRed M M' → ParRed N N' → ParRed (app M N) (app M' N')
| lam : ParRed M M' → ParRed (lam M) (lam M')
| beta : ParRed M M' → ParRed N N' → ParRed (app (lam M) N) (M'[N'])
Define complete development that contracts ALL redexes:
def complete : Term → Term
Prove the key lemma: any parallel reduction reaches complete development:
theorem parRed_complete : M ⇒ N → N ⇒ complete M
Diamond property follows from the triangle:
theorem parRed_diamond : Rewriting.Diamond ParRed
Apply generic theorem:
theorem confluent : Confluent BetaRed :=
confluent_of_diamond parRed_diamond
Best when: You can prove termination via a well-founded measure.
Prove termination via a decreasing measure:
theorem step_terminating : Rewriting.Terminating Step := by
apply terminating_of_measure size
intro a b h
exact step_decreases_size h
Prove local confluence by critical pair analysis:
theorem local_confluent : LocalConfluent Step := by
intro a b c hab hac
-- Analyze all critical pairs
cases hab <;> cases hac <;> ...
Apply Newman's lemma:
theorem confluent : Confluent Step :=
confluent_of_terminating_localConfluent step_terminating local_confluent
Best when: You have two confluent relations that commute.
theorem confluent_union : Confluent r → Confluent s → Commute r s → Confluent (Union r s)
import Metatheory.Rewriting.Basic
import Metatheory.Rewriting.Diamond
import Metatheory.Rewriting.Newman
import Metatheory.Rewriting.HindleyRosen
Lambda/Confluence.lean - Diamond property approachCL/Confluence.lean - Diamond property approachTRS/Confluence.lean - Newman's lemma approachStringRewriting/Confluence.lean - Newman's lemma approachRun Aristotle automated theorem prover on Lean files to fill sorry placeholders. Use when you have a file with sorries that needs automated proof search. Handles API setup and result verification.
Check that no sorry placeholders exist in the codebase. Use after making changes or when asked to verify proof completeness.