搜索

PythonReactSEOPDF
GitHub Skill

confluence-guide

Guide for proving confluence of a rewriting system. Use when asked to prove Church-Rosser or confluence properties.

Arthur742Ramos☆ 1 仓库 Stars1 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Proving Confluence

This skill provides guidance for proving confluence of rewriting systems in the Metatheory project.

Choose Your Approach

Option 1: Diamond Property (for systems like Lambda, CL)

Best when: The reduction relation has an obvious "parallel" version.

  1. 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'])
    
  2. Define complete development that contracts ALL redexes:

    def complete : Term → Term
    
  3. Prove the key lemma: any parallel reduction reaches complete development:

    theorem parRed_complete : M ⇒ N → N ⇒ complete M
    
  4. Diamond property follows from the triangle:

    theorem parRed_diamond : Rewriting.Diamond ParRed
    
  5. Apply generic theorem:

    theorem confluent : Confluent BetaRed :=
      confluent_of_diamond parRed_diamond
    
Option 2: Newman's Lemma (for terminating systems like TRS)

Best when: You can prove termination via a well-founded measure.

  1. 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
    
  2. 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 <;> ...
    
  3. Apply Newman's lemma:

    theorem confluent : Confluent Step :=
      confluent_of_terminating_localConfluent step_terminating local_confluent
    
Option 3: Hindley-Rosen (for unions of relations)

Best when: You have two confluent relations that commute.

theorem confluent_union : Confluent r → Confluent s → Commute r s → Confluent (Union r s)

Key Imports

import Metatheory.Rewriting.Basic
import Metatheory.Rewriting.Diamond
import Metatheory.Rewriting.Newman
import Metatheory.Rewriting.HindleyRosen

Examples in This Repo

  • Lambda/Confluence.lean - Diamond property approach
  • CL/Confluence.lean - Diamond property approach
  • TRS/Confluence.lean - Newman's lemma approach
  • StringRewriting/Confluence.lean - Newman's lemma approach

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-30
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!