[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"B4gIWXIPpJ":3},"\u003C!--\nSPDX-FileCopyrightText: Copyright (c) 2026 Objectionary.com\nSPDX-License-Identifier: MIT\n-->\n\n# Confluence of φ-Calculus Normalization (Lean 4)\n\n[![build](https://github.com/objectionary/proof/actions/workflows/build.yml/badge.svg)](https://github.com/objectionary/proof/actions/workflows/build.yml)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/proof/blob/master/LICENSE.txt)\n\nA complete, machine-checked proof — in [Lean 4](https://leanprover.github.io) — that the\nnormalization (reduction) rules of the φ-calculus are **confluent (Church–Rosser)**: the order in\nwhich the rules fire never changes the result. It is about the calculus as implemented by the\nreference manipulator [`phino`][phino] — the same eleven rules the [paper][paper]'s Fig. 4 is\ngenerated from — and supersedes the earlier minimal/extended development kept in this repository's\nhistory (which finished only the minimal calculus).\n\n**`#print axioms PhiConfluence.confluence` = `[propext, Quot.sound]`** — no `sorry`, no\n`Classical.choice`.\n\n## The theorem\n\n`⟶` is the compatible (congruence) closure of the eleven `phino` rules\n(`dd, dc, null, over, stop, miss, stay, phi, alpha, dot, copy`) over `Term`. `PhiConfluence.confluence`:\n\n> For all **well-formed** `e`, if `e ⟶* e₁` and `e ⟶* e₂`, then there exists `e₃` with `e₁ ⟶* e₃`\n> and `e₂ ⟶* e₃`.\n\nIt is proved via **parallel reduction** and the **Takahashi diamond** (mathlib's\n`Relation.church_rosser`); the system is non-terminating (`⟦x↦y,y↦x⟧.x` diverges), so Newman's lemma\ndoes not apply.\n\n**Scope.** The `WF e` hypothesis re-imposes the paper's own grammar (unique keys; `αᵢ` is not a\nformation key) that the deliberately-looser `Binding` encoding drops — it is *necessary*, since\nwithout it `alpha` and `over` form a non-joinable critical pair. The implicit parent attribute `ρ`\nthat the paper and phino give every formation is modelled (`canon`), so the result governs phino's\nactual term space. `λ`/`Δ` atoms are not part of `⟶` — their evaluation is the paper's *separate*,\nstateful Morphing/Dataization functions, not term rewriting. The frozen contract is in\n[`docs/M0-spec.md`](docs/M0-spec.md); the design and provenance in [`docs/DESIGN.md`](docs/DESIGN.md).\n\n## Verify it yourself\n\n```bash\ncurl -sSf https://elan.lean-lang.org/elan-init.sh | sh   # one-time: Lean's toolchain manager\nlake exe cache get          # download mathlib's prebuilt artifacts\nlake build                  # green ⇒ every theorem is kernel-checked (CI also gates #print axioms)\nlake exe demo               # the eleven rules + example reductions, by the project's own reducer\nbash scripts/difftest.sh    # our reducer vs `phino rewrite --normalize` (needs phino on PATH)\n```\n\nThe displayed rule table (`Rules.lean`) is generated from phino's `resources/*.yaml` — the same\nsource the paper's Fig. 4 renders from — so it cannot drift from phino. `reduce_sound` certifies\nthat every step the runnable reducer takes is a genuine `Step`, and `difftest` confirms our\nreducer's normal forms match phino's. Run `#print axioms \u003Cname>` on any result to inspect its axiom\nfootprint.\n\n## How it fits together\n\n```\nMain.lean / Difftest.lean         demo + phino differential test\nPhiConfluence/\n  Syntax · Attributes · WellFormed  Term/Binding/Attr; lookup/fill/voidAtOrdinal; the WF predicate\n  Step                              the relation ⟶ — eleven rules + congruence closure\n  Nf · Normal                       structural normal form (the counterpart of phino's isNF)\n  Context · Canonical               contextualization C(e⊳ctx); the implicit-ρ canonicalisation\n  Parallel                          Par/ParB, complete development `devel`, the Takahashi triangle\n  Preservation · Diamond            WF preserved under reduction; the WF-relativized diamond\n  Confluence                        the headline `confluence`\n  Equivalence                       `≡` (convertibility) as an Equivalence on well-formed terms\n  Reduce · Render · Rules           executable reducer + reduce_sound; pretty-printer; rule table\n  Abstract/Rewriting                Diamond / Confluent vocabulary + the church_rosser bridge\ndocs/      M0-spec.md (frozen contract) · DESIGN.md (design + provenance)\nscripts/   gen-rules.py · regen-rules.sh · difftest.sh · confluence-probe.sh\n```\n\n## Stack\n\nLean 4 (`leanprover/lean4:v4.30.0`) and mathlib4 (pinned in `lakefile.toml`), built with Lake.\nAbstract rewriting is built on mathlib's `Prop`-valued `Relation` API. CI runs `lake build` with a\n`#print axioms` gate, the phino differential test, a rule-table-in-sync check, and the standard\nobjectionary hygiene checks.\n\n[paper]: https://github.com/objectionary/calculus-paper\n[phino]: https://github.com/objectionary/phino\n",1780846770536]