Skip to content

kernel: vendor upstream ShenOSKernel 43.1 at ec16a9f; keep the native typechecker on it - #99

Merged
pyrex41 merged 2 commits into
mainfrom
kernel-ec16a9f
Oct 23, 2026
Merged

pyrex41 merged 2 commits into
mainfrom
kernel-ec16a9f

Conversation

@pyrex41

@pyrex41 pyrex41 commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Vendors upstream Shen-Language/shen-sources ec16a9f. That is the 43.1 release plus shen-sources#117: shen.by-hypothesis and shen.search-user-datatypes dereference the checked term once per call through new -h predicates, and fail at once on an empty list. The PR then makes the native typechecker follow that kernel without falling back. (version) is still "43.1".

Commits

  1. kernel: the 23 klambda/*.kl files, byte-identical to ShenOSKernel-43.1-ec16a9f.tar.gz (https://github.com/pyrex41/shen-sources/releases/tag/upstream-ec16a9f, sha256 060066a8f84d9a2f7d41cb3b37b986a8d4653279752b739b5063cd648d9baacd). The commit also updates klambda/PROVENANCE.md, klambda/README.md and the CHANGELOG. tests/ is unchanged and identical to the archive.
  2. typecheck: follow the ec16a9f kernel natively. On the vendored kernel alone, the conformance spec fails 5 checks, and the native path falls back to the KL typechecker for two reasons:
    • Fingerprint: shen.search-user-datatypes has a new fingerprint (483d69ab4d98d601). typecheck_native.lua now accepts it. The only change from the deref-hoist shape it already accepted is the empty-list guard. The hand port already fails on an empty list before any clause, counts no inference there (the -h clauses never match []), and never copies on deref. shen.search-user-datatypes-h has the same fingerprint as the hoist shape.
    • Translator: the translated shen.by-hypothesis now starts with (if (= (shen.lazyderef Hyp B) ()) false ...). The translator refused it ("goal call with <4 args: shen.lazyderef"). prolog_compile.lua now treats a (shen.lazyderef X B) of a term variable as an engine term in =, so the guard compiles to an arena comparison: LZD(x) == NIL. Plain shen.deref is deliberately not accepted there, because it is the identity in term position.
    • Spec: kernel_conformance_spec now expects the vendored kernel's hoisted shape. The driver closure adds shen.by-hypothesis-h, and eqterm still fires in shen.by-hypothesis-h.

Gates (local, LuaJIT 2.1.1785763465)

  • make test: 1797 pass, 0 fail across 29 specs. kernel_conformance_spec is 23/0.
  • make certify: 154 / 0, with inference counts identical to main. Also 154 / 0 under SHEN_TYPECHECK_NATIVE=require.
  • capcov shenbench, 8 workloads: 8/8 payloads byte-identical to the go-1f587de reference. The run also passes 8/8 under SHEN_TYPECHECK_NATIVE=require. No stderr contains a fallback notice.

Speed (b-typed, /usr/bin/time -l, one pair)

CPU instructions
main c6c3a22 12.0 s 140.6 G
this branch 11.2 s 142.8 G (+1.6%, noise)

As expected, this is flat. shen-lua's native engine never copies on deref, and #96 eqterm already removed the by-hypothesis materialisation. The kernel change matters here only for staying native on the upstream kernel.

🤖 Generated with Claude Code

pyrex41 and others added 2 commits October 22, 2026 17:16
… checker)

Replace the 23 klambda/*.kl files with the kernel built from unmodified
Shen-Language/shen-sources ec16a9f, the merge of shen-sources#117.
shen.by-hypothesis and shen.search-user-datatypes now dereference the
checked term once per call through new -h predicates, and fail at once
on an empty list. (version) is still "43.1".

The archive is ShenOSKernel-43.1-ec16a9f.tar.gz from pyrex41/shen-sources
release upstream-ec16a9f, sha256
060066a8f84d9a2f7d41cb3b37b986a8d4653279752b739b5063cd648d9baacd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- typecheck_native.lua: accept ec16a9f's shen.search-user-datatypes
  fingerprint (483d69ab4d98d601). Its only change from the deref-hoisted
  shape is an empty-list guard that returns false without dereferencing.
  The hand port already fails on an empty list before any clause, counts
  no inference there, and never copies on deref.
- prolog_compile.lua: compile (= (shen.lazyderef X B) T) as an arena
  comparison. ec16a9f's translated shen.by-hypothesis tests
  (= (shen.lazyderef Hyp B) ()) before calling shen.by-hypothesis-h, and
  this was refused before ("goal call with <4 args: shen.lazyderef"),
  which sent every typecheck to the KL typechecker.
- kernel_conformance_spec: the vendored kernel now has the hoisted shape.
  Its driver closure adds shen.by-hypothesis-h, and eqterm fires there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pyrex41
pyrex41 merged commit dd24cbb into main Oct 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant