-
Notifications
You must be signed in to change notification settings - Fork 2
Derive normalization rules from phino as checked data #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yegor256
wants to merge
13
commits into
master
Choose a base branch
from
rules-as-checked-data
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cd8a83f
feat(rules): derive structured rule data from phino (fidelity lock)
yegor256 46ade3d
ci: add ruff workflow to lint Python scripts
yegor256 74b06a1
Potential fix for pull request finding
yegor256 edb5aa1
Potential fix for pull request finding
yegor256 9fe9659
Potential fix for pull request finding
yegor256 9e775bd
Potential fix for pull request finding
yegor256 dd7688f
Potential fix for pull request finding
yegor256 ea8c98f
build(phino): pin to 0.0.0.74 via .phino-version
yegor256 d1b1939
fix(phino): clone 3-part git tag, pass --pin before subcommand
yegor256 76d9ac9
docs: remove the rules-as-data design note
yegor256 b6d4074
feat: add phino-generated RuleData.lean with in-sync CI check
yegor256 82fe64d
ci: regenerate RuleData.lean from phino in the build, drop in-sync job
yegor256 6058493
ci: regenerate Rules.lean too in the build, drop rules-in-sync
yegor256 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 Objectionary.com | ||
| # SPDX-License-Identifier: MIT | ||
| --- | ||
| name: ruff | ||
| 'on': | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| jobs: | ||
| ruff: | ||
| timeout-minutes: 15 | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/ruff-action@v3 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 0.0.0.74 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| -- SPDX-FileCopyrightText: Copyright (c) 2026 Objectionary.com | ||
| -- SPDX-License-Identifier: MIT | ||
|
|
||
| -- AUTO-GENERATED by scripts/gen-rule-data.py from objectionary/phino resources/*.yaml. | ||
| -- DO NOT EDIT BY HAND. Regenerate after phino's rules change. | ||
|
|
||
| import PhiConfluence.RuleSchema | ||
|
|
||
| /-! | ||
| # Normalization rules as structured data, generated from phino | ||
|
|
||
| The eleven rules as `RuleEntry` tags (types in PhiConfluence/RuleSchema.lean), emitted | ||
| by the fidelity-lock deriver `scripts/gen-rule-data.py`. The CI build regenerates this | ||
| file from pinned phino and compiles it, so the proof builds against phino's rules. | ||
| -/ | ||
|
|
||
| namespace PhiConfluence | ||
|
|
||
| /-- The φ-calculus normalization rules as structured, interpretable data. -/ | ||
| def normalizationRuleData : List RuleEntry := | ||
| [ { name := "alpha", shape := .appForm, conds := [.alphaVoidOrdinal], rhs := .alphaRename } | ||
| , { name := "copy", shape := .appForm, conds := [.slotVoid, .argXiFree, .argNf], rhs := .copyFill } | ||
| , { name := "dc", shape := .appBot, conds := [], rhs := .bot } | ||
| , { name := "dd", shape := .dispatchBot, conds := [], rhs := .bot } | ||
| , { name := "dot", shape := .dispatchForm, conds := [.slotAttached, .valNf], rhs := .dotFeedback } | ||
| , { name := "miss", shape := .appForm, conds := [.slotAbsent, .attrNotAlpha], rhs := .bot } | ||
| , { name := "null", shape := .dispatchForm, conds := [.slotVoid], rhs := .bot } | ||
| , { name := "over", shape := .appForm, conds := [.slotAttached, .attrNeRho], rhs := .bot } | ||
| , { name := "phi", shape := .dispatchForm, conds := [.phiPresent, .slotAbsent], rhs := .phiExpand } | ||
| , { name := "stay", shape := .appForm, conds := [.attrIsRho, .slotAttached], rhs := .formSame } | ||
| , { name := "stop", shape := .dispatchForm, conds := [.slotAbsent, .phiAbsent, .noLambda], rhs := .bot } ] | ||
|
|
||
| end PhiConfluence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| -- SPDX-FileCopyrightText: Copyright (c) 2026 Objectionary.com | ||
| -- SPDX-License-Identifier: MIT | ||
|
|
||
| /-! | ||
| # Schema for the generated rule data | ||
|
|
||
| The typed vocabulary that `PhiConfluence/RuleData.lean` (generated from phino by | ||
| `scripts/gen-rule-data.py`) is written in: each normalization rule is a `RuleEntry` of | ||
| tags — the redex it fires on, its side-conditions, and its contractum. These are *data* | ||
| describing the eleven `phino` rules; the proof relation `Step` (`Step.lean`) is the | ||
| authoritative hand-written object, and `RuleData.lean` is kept identical to phino by the | ||
| `rule-data-in-sync` CI job. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. References the |
||
| -/ | ||
|
|
||
| namespace PhiConfluence | ||
|
|
||
| /-- Which redex a rule fires on: `⊥.a`, `⊥(a↦arg)`, `⟦bs⟧.a`, or `⟦bs⟧(a↦arg)`. -/ | ||
| inductive RedexShape where | ||
| | dispatchBot | appBot | dispatchForm | appForm | ||
| deriving Repr, DecidableEq | ||
|
|
||
| /-- A side condition on the redex's formation, attribute, and argument. -/ | ||
| inductive Cond where | ||
| | slotVoid | slotAttached | slotAbsent | ||
| | attrNeRho | attrIsRho | attrNotAlpha | ||
| | phiAbsent | phiPresent | noLambda | ||
| | valNf | argXiFree | argNf | alphaVoidOrdinal | ||
| deriving Repr, DecidableEq | ||
|
|
||
| /-- The contractum a rule rewrites its redex to. -/ | ||
| inductive Contractum where | ||
| | bot | formSame | phiExpand | dotFeedback | copyFill | alphaRename | ||
| deriving Repr, DecidableEq | ||
|
|
||
| /-- One normalization rule as structured data. (Named `RuleEntry`, not `RuleSpec`, | ||
| to avoid colliding with `Render.lean`'s display-string `RuleSpec`.) -/ | ||
| structure RuleEntry where | ||
| name : String | ||
| shape : RedexShape | ||
| conds : List Cond | ||
| rhs : Contractum | ||
|
|
||
| end PhiConfluence | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ version = 1 | |
| [[annotations]] | ||
| path = [ | ||
| ".gitignore", | ||
| ".phino-version", | ||
| ".yamllint", | ||
| "**.json", | ||
| "**.md", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rules-in-synchadgit diff --exit-code; this regen-and-overwrite never compares against the committed files. CommittedRules.lean/RuleData.leancan now drift silently from what CI builds, and a locallake builduses different sources than CI. Add a diff check after regen, or stop committing the generated files.