Repository navigation
Conversation
PIR Step 6, fifth slice. `x = a > 9 || b > 0 7` and `x = (a > 9 || b > 0) && 7` reach a plan (matrix rows 15, 19). A side of a last takes its kind from the side itself, as a side of a first does, so an || there is a first, and the two nest in each other to any depth. - A first or a last binds an outcome only where a mapping or a gate names it. A first that is a side of a last binds none, as a last in a first binds none, and a gate takes a first's own outcome. - A node no mapping takes from is only tested, whatever its kind: every node of a gate's condition, and every node of a side before the final one of a last. What it built is released once it ran. An eval can be one, as in `(arr[9] || b > 0) && 7`. - A last supplies its value from its final side, so where that side is a first each of the first's sides can supply it. pir.Suppliers lists them, and a mapping names a transfer for each. - A failed access goes to the nearest fallback that follows a side holding it, however deep, and skips the outcome where there is none. The release tag of a failed node follows the same walk, which now enters a last. The lowerer has two paths. lowerTested runs a node for its bit alone and releases what it built. lowerSelection runs a first or a last a mapping takes and stages each node that can supply the value; one inside a last also keeps the bit that says it ran, since the sides before it may have stopped the last. lowerFirst, lowerFirstSide and lowerLast are replaced by these. One merged validator rule is removed: a gate's last no longer has to end in a check. A last that is only tested may end in an eval, and a gate can hold one today (`x = b > 9 || arr[1] > 0 && k 5`). In its place a gate's condition must be able to fail. Over the fixtures as they stood, 19 more assignments plan, all in tests/cond. The __text of 88 of the 89 executables is unchanged; cond/value_cond_expr differs. With the router admitting no || as a tested node or as a last's final side, all 89 and every plan's text match 56278f3. Staying legacy: a gate that is a bare range or array-selection driver, a comparison with an || or an && for an operand, a side of several slots, and an || or an && under an operator, in a cell, in a call argument or in a print. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A side before the final one of a last is only tested, and the next after it runs where it yielded. Until the fifth slice every such side was a check, so Last.MayFail could answer true for every last. A first may sit there now, and the validator did not ask whether it can fail. A hand-built `(sarr[9] || t) && 7` passed, and so did a gate over `(sarr[9] || t) && u`, which can never reject, though the rule beside it says a gate's condition must be able to fail. validateLast now rejects a first before the final side that cannot fail, as validateFirstSide rejects a side a fallback follows that cannot. Every valid last can therefore fail again, which the gate rule and maySkip rely on. No source statement builds such a plan: the solver requires every operand of an && before the last one to be able to fail. The comments on Last.MayFail and maySkip said a last fails through its checks. A last may hold none, so they now name the side before its final one. Found in review of #180. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An || that ends an && runs its second side only where the first one failed, so that side has a bit and memory of its own. The FinalFirstSide row of TestPlanLastReleasesFinalSideWhereItRan checked only the first side's bit. With the second side's bit removed, the generated code released that side's memory where the && had stopped before the ||, when nothing was staged there, and every unit test and fixture still passed: the read is of undefined memory, so no run fails reliably. TestPlanLastReleasesEachSideOfFinalFirstWhereItRan reads the second side's bit and memory from the block the fallback admits, and checks that the bit is cleared before the sides part and that the load and the release of that memory sit only in the block a branch on that bit admits. The lowering itself is unchanged; it emitted both guards. Found in review of #180. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
planTestedEligible is documented as the rule for a node that is only tested, but planLastEligible also called it on a last's final side, which supplies the value. planSideEligible now mirrors buildSide: a side yields one slot and takes its kind from itself, an && as a last, an || as a first, a comparison as a check and any other expression as an eval. planFirstEligible and the final side of planLastEligible both ask it, and planTestedEligible is left to the sides before the final one and to a gate's conditions. Nothing plans differently. Over every fixture the plan text and the __text of all 89 executables are identical before and after. Found in review of #180. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Row 7b of the capability matrix still listed `fg` and `fl` among the statements that do not plan, and said an || as a statement's gate stays on legacy lowering. Both plan since the fifth slice, and the row now names `fh` and `fk` as what the router test keeps legacy. Plan §12 said a mapping takes a last's value by one transfer. That holds where the final side is an eval or a check. Where it is a first, each of its sides can supply the value, and the mapping names a transfer for each. Found in review of #180. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
buildCondition built a first for any single gate condition that was no comparison. The router admits only a comparison or an || there, so the default was never wrong, but it rested on that. Had a later slice admitted another condition without a case here, the builder would have made a first of one side, and the validator would have stopped it with "has 1 sides and needs a fallback", a message about the wrong thing. An || is now a case of its own, and any other condition is an internal compiler error that names the condition. Nothing plans differently. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
TestPlanLastReleasesEachSideOfFinalFirstWhereItRan compared the position of the store that clears the second side's bit with the position of the block where the sides part. strings.Index gives -1 for a store that is not there, and -1 is less than any position, so the test passed with that store removed. It now asserts that both positions exist first, as the test before it does. Found in review of #180. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… skip rule Plan §12 and the fifth slice's passage said a last whose final side is a first takes a transfer for each side of that first. A side may be a last that itself ends in a first, so a first of two sides can give three transfers. The count is one for each eval or check that can supply the value, and both places now say so, as does the format rule for a mapping's transfers. Matrix row 7b said a mapping carries a skip policy only where the side no fallback follows can fail. That holds where the first is the whole value of a statement without a gate. Under a gate or as a side of an && the mapping always carries one: `x = n > 0 && (n > 1 || 8)` keeps x where n > 0 fails, though 8 always yields. Found in review of #180. Co-Authored-By: Claude Fable 5.2 <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.
PIR Step 6, fifth slice: an
||plans as a statement's gate and as a side ofan
&&.x = a > 9 || b > 0 7andx = (a > 9 || b > 0) && 7reach a plan(matrix rows 15, 19). A side of a
lasttakes its kind from the side itself,as a side of a
firstdoes, so the two nest in each other to any depth.Plan text, as decided
A gate takes a
first's own outcome, as it takes alast's:Four decisions, each chosen from options shown with a statement and its plan
text:
firstthat is a side of alastbinds no outcome, as alastin afirstbinds none. A selection binds an outcome only where a mapping or agate names it. Transfers name the checks and evals that supply the value,
so nothing could reference a nested selection's name.
||,as a gate's
lastalready prints its final side's. For an||that is theone type its sides share. This leans on a solver rule: a gate's
||sidesmust match in type, though a gate takes no value.
fallbackat any depth, and skipsthe outcome where there is none. Above, no
fallbackfollows%t3insideits own
first, and the outer one resolves it. A release carries the sameword.
can be one, as in
y = (arr[9] || b > 0) && 7. What it built is releasedonce it ran, with no word after the
drop.What changed
compiler/pir.go):planTestedEligibleadmits agate's condition or a side before the final one of a
lastas a check or afirst. OnebuildSideserves both selections.lowerTestedruns a node for its bit alone and releases whatit built.
lowerSelection,lowerSupplyingandlowerStagedrun afirstor a
lasta mapping takes and stage each node that can supply the value.A node inside a
lastalso keeps the bit that says it ran.lowerFirst,lowerFirstSideandlowerLastare replaced by these.pir:Suppliers(exported, replacessupplier) lists every node thatcan supply a value.
tests()returns evals as well as checks.failure()walks the resolver the renderer uses, and now enters a
last. The rendererneeded no other change for nesting.
lastor afirst, and itmust be able to fail. A
firstthat is a side of alastis held to afirst's own rules, binds no outcome, and fits thelast's type where itis the final side.
One merged rule removed
A gate's
lastno longer has to end in a check, and its test caseConditionEndsInEvalis gone. The fourth slice's text assumed a gate'scondition holds only comparisons. It can hold values:
x = arr[9] || b > 0 5and
x = b > 9 || arr[1] > 0 && k 5both compile onmaster. Alastthatis only tested may therefore end in an eval, under decision 4.
Evidence
this slice, each as one plan, all in
tests/cond: 9 whose gate holds an||and 10 with an||as a side of an&&(6 incond/logical_ops, 13in
cond/value_cond_expr).__text.cond/value_cond_exprdiffers. The 6 statements that newly planin
cond/logical_opscompile to the same code as before.||as a tested nodeor as a
last's final side produces all 89__textsections and everyplan's text identical to
56278f3. Both sides were built under their ownPTCACHE.lowerer mutants survived the fixtures as they stood, which is why two
fixture cases and one unit-test row were added: a tested eval that never
yields (
TestedValueYields), alastside that yields only by its firstnode (
NestedFirstSecondYields), and a missing "ran" bit for afirstinside a
last(TestPlanLastReleasesFinalSideWhereItRan/FinalFirstSide).master's legacy lowering, 9 seeds: about 920newly planned nested statements, no output difference and no leak. It
generates one-slot integer and heap-string trees of
&&and||up tothree deep, with printing calls and out-of-bounds reads, and says nothing
about other shapes.
gofmt -l .empty,go vet ./...,go test -count=1 -race ./...and
python3 test.py --leak-check91/91 under its ownPTCACHE.Tests
compiler:TestPlanGoldenNestedSelections(eight goldens: a gate over an||, one with an&&side, an||before alast's final side as a valueand under a gate, tested releases in a gate, an
||as alast's finalside with both release tags, a
firstin alastin afirst, and atested eval);
fgandflnow plan inTestPlanRouterRejections, andfhandfkpin what stays legacy.pir:TestValidateNestedFirstRejects,TestRenderNestedFirst, fiveTestElaboratecases and oneTestValidateAcceptscase.cond/logical_ops:TestedValueYieldsandNestedFirstSecondYields.masterprints the same lines for both.Staying legacy
A gate that is a bare range or array-selection driver, alone or as a side of
an
||; a comparison with an||or an&&for an operand, as in(a > 9 || 4) > 3 && 7; a side of several slots; and an||or an&&underan operator, in a cell, in a call argument or in a print.
Docs
docs/Pluto IR Plan.mdgains "Fifth slice landed" and updates §4, §12 and thefirst and fourth slices' "Staying legacy" lists. Rows 15 and 19 of
docs/Pluto PIR Capability Matrix.mdno longer say an||gate stays legacy.Review round
Seven commits after
61b21f0: one per finding from two rounds of review, andone from the author's own reading.
5a7c598validator. Afirstbefore alast's final side must be ableto fail. A hand-built
(sarr[9] || t) && 7passedValidate, and so did agate over
(sarr[9] || t) && u, which can never reject.Last.MayFailanswers true for every
last, which was sound only while every side beforethe final one was a check. No source statement builds such a plan, since the
solver requires each such operand to be able to fail.
1536019release guard. The mutant claim above was too wide for onerule: the mutant I ran dropped the "ran" bit of both sides of a final
||,and
FinalFirstSidecaught it through the first side alone. A mutantdropping only the second side's bit survived every test and fixture.
TestPlanLastReleasesEachSideOfFinalFirstWhereItRannow checks that thesecond side's own bit guards the load and the release of its own memory.
The lowering was already correct and is unchanged.
2d456d1router.planSideEligiblemirrorsbuildSide, andplanTestedEligibleis left to tested positions, as its comment said. Theplan text and the
__textof all 89 executables are identical before andafter.
92d72a8docs. Matrix row 7b no longer listsfgandflor an||gate as legacy, and plan §12 says a
lastwhose final side is afirsttakes more than one transfer.
202938cbuilder. A gate's||is a case of its own inbuildCondition, and any other single condition is an internal compilererror that names it. The router admits only a comparison or an
||there,so nothing plans differently.
197f2a8test. The release-guard test compared twostrings.Indexpositions without asserting that either exists, so it passed with the
second side's
store falseremoved. It asserts both first now.301bc42docs. Alasttakes one transfer for eachevalorcheckthat can supply its value, which can be more than its final
firsthassides. Row 7b's skip-policy rule is scoped to a
firstthat is the wholevalue of a statement without a gate.
One suggestion was not taken: adding the three other new fixtures to
TestValidateAccepts.TestElaboratealready runsValidateon all fourunmutated.
Seven more mutants, one at a time, each caught: three release-guard mutants,
the new validator rule, and three of the simplified router. The full gate was
re-run after the first four review commits:
gofmt -l .empty,go vet ./...,go test -count=1 -race ./..., andpython3 test.py --leak-check91/91 under its ownPTCACHE. The last threecommits change one builder branch no statement reaches, a test and the docs;
for those,
gofmt,go vet ./...andgo test -count=1 -race ./...werere-run.
🤖 Generated with Claude Code