Skip to content

Keep branch result bindings inside their selected alternatives - #326

Open
godelclaw wants to merge 1 commit into
trueagi-io:mainfrom
godelclaw:fix/branch-output-isolation-main-20261116
Open

godelclaw wants to merge 1 commit into
trueagi-io:mainfrom
godelclaw:fix/branch-output-isolation-main-20261116

Conversation

@godelclaw

Copy link
Copy Markdown

Translating an inactive branch can bind a shared result variable before the
branch runs. For example, (if False (let $x 4 $x) (let $x 1 3)) produces no
answer, and the same expression inside superpose loses the selected answer.

Generate the result equality inside each selected alternative. Preserve
main's candidate-type joins through a fresh carrier instead of aliasing the
source value to the shared output during translation. The existing handling
of edge-scoped source variables is retained.

This ports the branch-output correction from stable PR #319 to main. It adds
13 MeTTa assertions and three tests for source-variable independence, joined
candidate types and the ordering required by a prebound output. The native
arithmetic matrix now accepts renamed generated temporaries while still
requiring a direct variable-plus-variable arithmetic operation.

Validation against upstream main ee5cacb:

  • test.sh passes: 333 positive examples, 167 expected failures, all matrices.
    Its optional tilepuzzle oracle comparison reaches its existing timeout.
  • All 13 added assertions pass normally and under --strict on SWI-Prolog
    10.1.9 and 10.1.20. The three new Prolog tests fail on unchanged main and
    pass with the fix.
  • Repeated if/case/superpose measurements retain the baseline inference
    counts. A 100,000-deep tail-recursive probe retains constant stack usage.
  • Python tests: 19 passed; test_second_load_replays_the_snapshot still fails
    locally as it does on unchanged main. No cache changes are included.

Port branch isolation to main without losing its type-candidate joins. Generate result equality inside the selected branch instead of aliasing a source value to the shared output during translation; retain the existing edge-scoped branch handling.

Add the thirteen branch examples and three checks for independent source values, candidate unions and prebound-result ordering. Make the native-arithmetic matrix tolerate renamed generated temporaries.
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