Repository navigation
A let the kernel reads at quantity 2 goes out with bend2's type, since the kernel checks the type it infers against *2 before any β-reduction - #1159
Closed
aldeni wants to merge 1 commit into
Conversation
…e the kernel checks the type it infers against *2 before any β-reduction
For a let at quantity 2 (a + let, or one let_term promotes when the
kernel counts more than one use), the kernel infers the value and
checks the type it inferred against *2. That type is plain
substitution, with no β-reduction, so a + let of
Equal.cong(A, B, f, x, mk(n), h) gives {((λx => f x) x) == ((λx => f x)
(mk n)) : B}: the left side passes by the elim rule for a Var argument,
the right side sends the kernel to infer the λ, and it refuses "an
annotated term" for a file bend2 accepts (bendlang#1133; the analysis on bendlang#1136
by Nicolas Abril). bend2's instantiation β-reduces as it builds and
never meets that term.
let_term now annotates a let whose emitted quantity is 2, the promoted
case included, with the type bend2 knows for its value, unless it
already carries one; the type's elaboration is a thunk from the let's
own scope, so nothing is built for the lets that need none. inferable
stays the mirror of Term.infer; the self-call re-binding and the "no
known type" refusal are as before.
tests/proof/cong_plus_let.bend holds both shapes reported: the pair
domain with a def as the function, and the Nat case with a λ at the
source. On main bend says ALL PROOFS CHECK and --verdict SOME PROOFS
FAIL; here both say ALL PROOFS CHECK, and so does the kernel binary on
the emitted .bendtt. Over tests/proof, tests/check and tests/spec (338
files) --verdict answers the same on main and here, file by file; the
test prints True on the interpreted, JS and C lanes; gates/repo.ts
passes 49 / 49.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Collaborator
|
Thanks for this! #1133 is now fixed in the kernel by #1158: |
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.
Fixes #1133, the way @nicolas-abril's analysis on #1136 lays out; thank you for it, it was the explanation I was missing.
inferablestays as it is, the mirror ofTerm.infer.What happens
For a let at quantity 2 (a
+let, or onelet_termpromotes when the kernel counts more than one use), the kernel infers the value and checks the type it inferred against*2. That type comes from plain substitution, with no β-reduction, so a+let ofEqual.cong(A, B, f, x, mk(n), h)gives{((λx => f x) x) == ((λx => f x) (mk n)) : B}: the left side passes by theelimrule for aVarargument, the right side sends the kernel to infer the λ, and it refusesexpected: an annotated term. bend2's instantiation β-reduces as it builds, so it never meets that term.The change
let_termannotates a let whose emitted quantity is 2, the promoted case included, with the type bend2 knows for its value, unless the value already carries one. The type's elaboration is kept as a thunk from the let's own scope, so nothing is built for the lets that don't need it. Nothing else moves:inferable, the self-call re-binding and the "no known type" refusal are as on main.Checks (Linux x86-64, kernel binary 7f6ef51c)
tests/proof/cong_plus_let.bendholds both shapes reported: --verdict: the kernel rejects a +-bound Equal.cong over a pair whose endpoint is a call (an unannotated eta-expansion), and the verdict does not say why #1133's pair domain with a def as the function, and @nathanneuro'sNatcase with a λ at the source. On main,bend f.bendsaysALL PROOFS CHECKand--verdictsaysSOME PROOFS FAIL; here both sayALL PROOFS CHECK, and so does the kernel binary on the emitted.bendtt.tests/proof,tests/checkandtests/spec(338 files),--verdictanswers the same on main and here, file by file.Trueon the interpreted, JS and C lanes;gates/repo.tspasses 49 / 49;safe.tsis at 19776 of its 24000 ttok.Not run:
gates/safe.tson a cluster, and macOS.