● M3 is complete — just ci fully green. Here's what landed: #1

Merged
navicore merged 1 commit from M3 into main 2026-06-04 19:59:45 +00:00
Owner

M3: Control, arithmetic, and indexing

Compiled control flow (codegen/lower.rs + body.rs): clause bodies now lower to a goal IR and compile to native
control —

  • ; → choice point retrying the right branch
  • (C -> T ; E) / once/1 → commit-height scratch slots in the body frame; the then-continuation truncates the CP
    stack
  • + G → a CP that continues the body (the driver's rewind undoes G's bindings for free); if G succeeds,
    cut-to-height and fail
  • ! → barrier captured at predicate entry, with correct ISO scoping: transparent through ;/->/,, local inside
    conditions, +, and once (a per-context cut-slot is threaded through compilation)

Builtins (background-agent port of v1's builtins.rs, 29 new runtime tests): full is/2 evaluable vocabulary,
comparisons, =/=/==/==/@-order/compare/3 — with error strings captured from the live v1 oracle and asserted
byte-for-byte (error(evaluation_error(zero_divisor), Division by zero (integer division)) etc.).

First-arg indexing: entry functions switch on the dereferenced first argument's tag/value to per-key clause
chains. Single-candidate dispatch pushes no choice point. The 5k-fact chain query went from ~10s (M2 linear
scan) to 3ms.

Query side: the runtime's minimal parser grew operator-precedence climbing + float literals, and a control
walker for runtime-built goals (walks goal terms only — never clauses; the v1 lesson holds). ./binary --query "X
is 2 + 3 * 4" works just like v1.

One finding worth your attention: the adversarial diff sweep exposed that v1 treats cut as opaque inside ; —
t(X) :- (m(X), X > 1, ! ; X = fallback) leaks fallback in v1, which violates ISO 7.8.4 (SWI/GNU give only X =
2). I chose ISO over bug-compatibility, documented it in ISO_COMPLIANCE.md under "Cut", and pinned both
behaviors' tests. Everything else in the sweep matches the oracle byte-for-byte, including linting.pl (which
needed +) end to end.

Verification: 71 runtime + 48 frontend + 14 M3-suite + 14 M2-suite + 11 golden-IR tests, cut-under-512KB-stack
recursion test, full just ci.

M3: Control, arithmetic, and indexing Compiled control flow (codegen/lower.rs + body.rs): clause bodies now lower to a goal IR and compile to native control — - ; → choice point retrying the right branch - (C -> T ; E) / once/1 → commit-height scratch slots in the body frame; the then-continuation truncates the CP stack - \+ G → a CP that continues the body (the driver's rewind undoes G's bindings for free); if G succeeds, cut-to-height and fail - ! → barrier captured at predicate entry, with correct ISO scoping: transparent through ;/->/,, local inside conditions, \+, and once (a per-context cut-slot is threaded through compilation) Builtins (background-agent port of v1's builtins.rs, 29 new runtime tests): full is/2 evaluable vocabulary, comparisons, =/\=/==/\==/@-order/compare/3 — with error strings captured from the live v1 oracle and asserted byte-for-byte (error(evaluation_error(zero_divisor), Division by zero (integer division)) etc.). First-arg indexing: entry functions switch on the dereferenced first argument's tag/value to per-key clause chains. Single-candidate dispatch pushes no choice point. The 5k-fact chain query went from ~10s (M2 linear scan) to 3ms. Query side: the runtime's minimal parser grew operator-precedence climbing + float literals, and a control walker for runtime-built goals (walks goal terms only — never clauses; the v1 lesson holds). ./binary --query "X is 2 + 3 * 4" works just like v1. One finding worth your attention: the adversarial diff sweep exposed that v1 treats cut as opaque inside ; — t(X) :- (m(X), X > 1, ! ; X = fallback) leaks fallback in v1, which violates ISO 7.8.4 (SWI/GNU give only X = 2). I chose ISO over bug-compatibility, documented it in ISO_COMPLIANCE.md under "Cut", and pinned both behaviors' tests. Everything else in the sweep matches the oracle byte-for-byte, including linting.pl (which needed \+) end to end. Verification: 71 runtime + 48 frontend + 14 M3-suite + 14 M2-suite + 11 golden-IR tests, cut-under-512KB-stack recursion test, full just ci.
● M3 is complete — just ci fully green. Here's what landed:
All checks were successful
CI - Linux / CI - Linux x86_64 (pull_request) Successful in 45s
d9a64ffa26
M3: Control, arithmetic, and indexing

  Compiled control flow (codegen/lower.rs + body.rs): clause bodies now lower to a goal IR and compile to native
  control —
  - ; → choice point retrying the right branch
  - (C -> T ; E) / once/1 → commit-height scratch slots in the body frame; the then-continuation truncates the CP
  stack
  - \+ G → a CP that continues the body (the driver's rewind undoes G's bindings for free); if G succeeds,
  cut-to-height and fail
  - ! → barrier captured at predicate entry, with correct ISO scoping: transparent through ;/->/,, local inside
  conditions, \+, and once (a per-context cut-slot is threaded through compilation)

  Builtins (background-agent port of v1's builtins.rs, 29 new runtime tests): full is/2 evaluable vocabulary,
  comparisons, =/\=/==/\==/@-order/compare/3 — with error strings captured from the live v1 oracle and asserted
  byte-for-byte (error(evaluation_error(zero_divisor), Division by zero (integer division)) etc.).

  First-arg indexing: entry functions switch on the dereferenced first argument's tag/value to per-key clause
  chains. Single-candidate dispatch pushes no choice point. The 5k-fact chain query went from ~10s (M2 linear
  scan) to 3ms.

  Query side: the runtime's minimal parser grew operator-precedence climbing + float literals, and a control
  walker for runtime-built goals (walks goal terms only — never clauses; the v1 lesson holds). ./binary --query "X
  is 2 + 3 * 4" works just like v1.

  One finding worth your attention: the adversarial diff sweep exposed that v1 treats cut as opaque inside ; —
  t(X) :- (m(X), X > 1, ! ; X = fallback) leaks fallback in v1, which violates ISO 7.8.4 (SWI/GNU give only X =
  2). I chose ISO over bug-compatibility, documented it in ISO_COMPLIANCE.md under "Cut", and pinned both
  behaviors' tests. Everything else in the sweep matches the oracle byte-for-byte, including linting.pl (which
  needed \+) end to end.

  Verification: 71 runtime + 48 frontend + 14 M3-suite + 14 M2-suite + 11 golden-IR tests, cut-under-512KB-stack
  recursion test, full just ci.
navicore referenced this pull request from a commit 2026-06-20 22:03:21 +00:00
navicore referenced this pull request from a commit 2026-07-03 13:59:38 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-prolog!1
No description provided.