Repository navigation
A datatype with no constructors goes to BendTT with D.efq : D -> <>, so the kernel checks that bend2's empty is BendTT's empty (#1183) - #1221
Merged
Conversation
…so the kernel checks that bend2's empty is BendTT's empty (bendlang#1183) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #1183.
Context
Claim.consistentinbend2/bendtt.leansays no checked def has a type that converts to<>.safe.tsdoesn't emit bend2'sEmptyas<>, though. Like every datatype, it goes out asΣt:<> -> Empty.arms t. So the kernel's claim coversEmptyonly through the meta-level step "anEmptygives a<>". #1183 proposes adding encoding-specific theorems tobendtt.leanto close that gap. This PR keeps the kernel self-contained, still stated only for<>, and moves the step into the elaborator, where the encoding lives.Change
adt_emitnow emits, for a datatype with no constructors, one more def that the kernel checks like any other:Its body is always
λ{(,): λ{}}, the same termsafe.tsalready emits for an empty match. If the datatype encoding ever changes,D.efqhas to keep checking, so the link to<>can't silently break. A datatype with a live field of an empty type is empty through that field, so it gets noefqof its own.The spine that applies a def to the datatype's parameters is now a small helper,
at(k), shared byD.armsandD.efq. The header doc ofsafe.tsmentionsD.efq. The change adds 128 ttok tosafe.ts.Checks
tests/proof/empty_efq.bend(new) covers a plain and a parameterized empty type, plus a type with anEmpfield that must get noefq. It passes plainly and under--verdict.Emp.efqwhen its argument type is edited by hand to<()>(expected: a Σ type).--verdicton every test (1525 files) gives identical results on main and on this branch.bun gates/repo.tspasses. The cluster gates (gates/test.ts,gates/safe.ts) weren't run.🤖 Generated with Claude Code