feat(betlang): wire-first toolchain pass + bet:Dist T on the unified runtime#65
Merged
Merged
Conversation
…runtime Brings the 2026-06-15 wiring work onto the reconciled origin/main (which carries the parallel session's TP-5 intro/elim core + checker occurs-check and let-polymorphism). Full rationale and the journey's encounters are in docs/decisions/2026-06-15-betlang-wiring-and-bet-dist-t.adoc. - bet : Dist T canonical in the checker (aligns with the Lean tBet rule); weighted/conditional bets are distributions too; sample : Dist 'a -> 'a. - Interpreter unified onto bet_rt::Value (one runtime): bet -> Value::Dist, sample draws; AST lambdas closure-converted to native bet_rt closures. bet-rt and bet-rand are no longer orphaned. - JS codegen emits distribution objects so sample works end-to-end. - Interpreter surfaces unimplemented forms as errors (no silent Unit). - Justfile parse fix + Rust recipes; workspace greened (bet-wasm/bet-viz/ bet-chapel) + 3 bet-rt runtime bug fixes; cbindgen SPDX header preserved. - CLI `bet compile`; LSP wired to the real parser + type checker. - examples/dice.bet (first working .bet fixture). TP-5 kept at origin's intro/elim core; the richer comonad-law surface is TP-5b (deferred). 317 workspace tests pass; lake build + proof-scan green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What this is
Brings the 2026-06-15 wire-first toolchain pass +
bet : Dist Twork onto the reconciledmain(which already carries the parallel session's TP-5 intro/elim core and the checker's occurs-check + let-polymorphism). The parallel reconciliation merge resolved the TP-5/checker collisions but dropped this session's wiring; this PR re-applies it surgically on top.Full rationale and the journey's design decisions:
docs/decisions/2026-06-15-betlang-wiring-and-bet-dist-t.adoc(8 ADRs).Highlights
bet : Dist T(option a) — checker + interpreter + codegen aligned with the Lean proofcheck_bet/check_weighted_bet/check_conditional_betreturnDist T;bet { 1,2,3 } + 1is now correctly rejected.echo(bet …) : Echo (Dist T).bet_rt::Value(one runtime):bet → Value::Dist,sampledraws; AST lambdas closure-converted into nativebet_rtclosures.bet-rtandbet-randare no longer orphaned.sampleworks end-to-end (verified under deno).Wire-first pass
//line 1) — fixed + Rust recipes (build-rust/test-rust/check/run/compile/repl-rust).bet-wasm(E0308),bet-viz(imdep +Histogram→Rectangle+ textplots lifetimes),bet-chapel(rand_pcg); 3 realbet-rtbugs fixed (queue order,printf %squoting, msgpackList→Bytes).cbindgenno longer strips the SPDX header from generatedbetlang.h(was an automated licence edit).bet compile … --target js|llvm|beam; LSP wired to the real parser + type checker (real parse/type diagnostics with spans; obsolete "LALR conflicts" deps re-enabled).Unit.examples/dice.bet— first working.betfixture.Reconciliation choices (honoring owner adjudication)
echoIntro/echoElimcore. The richer comonad-law surface (this session'sMultiStepshadow ofEchoGradedComonad.agda) is TP-5b (deferred, P3) — preserved in local964d106+ the ADR.docs/echo-types.adocleft at origin's baseline (owner-managed).Verification
lake buildgreen;tools/proof-scan.shclean (no banned escape hatches).bet check/run/compile examples/dice.betall work.Deferred / for follow-up (ADR-8)
Racket→Rust authority declaration (left as-is); eager-vs-lazy runtime operational model; TP-5b; SEM-1/STAT-1/STAT-2 (Mathlib decision); ABI-1..5 (Idris2 recipe + CI).
🤖 Generated with Claude Code