IxVM: context-suffix memo keys for closed terms + drop dead KValNode#433
Open
arthurpaulino wants to merge 1 commit into
Open
IxVM: context-suffix memo keys for closed terms + drop dead KValNode#433arthurpaulino wants to merge 1 commit into
arthurpaulino wants to merge 1 commit into
Conversation
Two changes to the Aiur kernel core, both behavior-preserving. Closed-term context normalization in whnf / k_infer / k_is_def_eq: a closed term (`expr_lbr(e) == 0`) reads nothing from the local binder-type context `types` — its only reader, `types_lookup`, is reached via a `BVar` lookup, which a closed term has none of. So the result is independent of `types`; collapse it to `Nil`. The same closed subterm appearing under different binder depths then shares one memo key `(e, Nil, top, addrs)` instead of missing on a per-depth `types`, so Aiur's content-memoization reuses it. Open terms keep their real context. Sound: a closed term reduces and infers only over closed subterms. Remove the dead `KValNode`/`KVal`/`KValEnv` NbE value domain: defined but referenced nowhere (the live kernel runs on de-Bruijn `KExpr`); vestigial from an abandoned NbE direction. Measured with `ix check --ixe arena.ixe --claim <CheckEnv-digest>` over the TutorialDefs arena (694 consts): 7,159,028,984 -> 7,151,454,776 FFT (-0.11%). `lake test -- --ignored ixvm`: 297 pass, 0 fail. (The closed-term win is larger on a faster ingress base, where the kernel core is a bigger share of total.)
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.
Two changes to the Aiur kernel core, both behavior-preserving.
Closed-term context normalization in whnf / k_infer / k_is_def_eq: a closed term (
expr_lbr(e) == 0) reads nothing from the local binder-type contexttypes— its only reader,types_lookup, is reached via aBVarlookup, which a closed term has none of. So the result is independent oftypes; collapse it toNil. The same closed subterm appearing under different binder depths then shares one memo key(e, Nil, top, addrs)instead of missing on a per-depthtypes, so Aiur's content-memoization reuses it. Open terms keep their real context. Sound: a closed term reduces and infers only over closed subterms.Remove the dead
KValNode/KVal/KValEnvNbE value domain: defined but referenced nowhere (the live kernel runs on de-BruijnKExpr); vestigial from an abandoned NbE direction.Measured with
ix check --ixe arena.ixe --claim <CheckEnv-digest>over the TutorialDefs arena (694 consts): 7,159,028,984 -> 7,151,454,776 FFT (-0.11%).lake test -- --ignored ixvm: 297 pass, 0 fail. (The closed-term win is larger on a faster ingress base, where the kernel core is a bigger share of total.)