Repository navigation
feat(smt,solve): read the lowered graphs by id and expression record - #2257
Merged
Merged
Conversation
The satisfiability and solving engines name action nodes by graph and node id, translate expressions from the expression tables, and no longer import the syntax tree; tests/hygiene forbids both edges. The lowering answers the remaining questions about a node or expression by id, and a body expression's record now carries its parameters, result and local count. The browser REPL gzip budget moves from 16,250,000 to 16,300,000 bytes (16,240,594 before, 16,257,913 after). Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
A quoted alias holding `::` is one name; splitting the recorded text on `::` made it several and refused the quantifier. The invocation's record now carries the segments of a qualified name, and the translation reads them. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
There was a problem hiding this comment.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Empty quoted names rejected by solving — Confirmed with a failing test: Segments and Invoked answered false for a name written ''. spelling now treats only a reference with no written span as naming nothing. The fix commit is local and will be pushed with the develop merge once released.
Segments answered an invocation's name, so the chain `make().flag` read as the declaration path make.flag and the solver grounded it instead of refusing. The name is now answered by Invoked, which only the quantifier translation asks. Co-Authored-By: jason.han <hanhuijun@gmail.com>
The encoder numbered a node once per declaration, so the second of two steps typed by one action definition had no nodes of its own and its flow was reported as malformed. A node is its graph and id, and the first such step is refused as a nested flow like any other. Co-Authored-By: jason.han <hanhuijun@gmail.com>
… nodes A node is numbered by its graph and id, and a graph gives an id only to its own nodes, so a flow with an initial id always numbers that node in its own frame. Co-Authored-By: jason.han <hanhuijun@gmail.com>
5 of 6 tasks
…smt-solve-off-tree Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # tests/wasm/browser_repl_test.go
…smt-solve-off-tree
A reference or an invocation written with the empty unrestricted name has one segment, the empty string; ExprEntry.Segments and Invoked answered that it named nothing, so the solver refused an expression it used to resolve. Only a reference with no written span names nothing. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…smt-solve-off-tree Co-Authored-By: jason.han <hanhuijun@gmail.com>
ExprEntry.Reads promised to stop where visit answers false, but only kept from descending the node it had just visited: a sibling reference, or one under a bracket index, was still visited. Stop the whole walk. Co-Authored-By: jason.han <hanhuijun@gmail.com>
3 of 6 tasks
Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # tests/wasm/browser_repl_test.go
5 of 6 tasks
The bound-subrequirement refusal develop added names its expression by id, as every other refusal on this branch does. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration
Bot
removed this pull request from the merge queue due to a manual request
Nov 17, 2026
This was referenced Nov 17, 2026
devin-ai-integration Bot
added a commit
that referenced
this pull request
Nov 17, 2026
…f-base develop is over the browser REPL gzip budget since #2257 landed, so this PR's own WebAssembly gate cannot pass without the raise it is queued behind.
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 and why
Step 7b of the execution-owned IR (
docs/internals/execution-ir-design.md, "Migration as a stack of pull requests"): the satisfiability engine (internal/exec/smt) and the solving engine (internal/exec/solve) stop reading the syntax tree out of the lowered graphs. Neither package importsinternal/syntax/astany more, andtests/hygieneforbids both edges.#2249, #2252 and #2253 have merged; the base is
develop.exec/smt. A node issmt.Node{Graph, ID}(node.go): the lowered graph and itsprogram.NodeID.Flow's tables (Index,FrameOf,Incoming,Outgoing,Repeats,Crosses) are keyed by it,Flow.Endsnames each edge's ends, andsupport.go,encode.go,state.go,witness.go,input.goandproperty.gowalk the graphs through the id-indexed accessors of feat(lower): name the nodes and vertices of the lowered graphs by id #2253.exec/solve.translate.go,expression.go,reference.go,quantify.go,pin.go,variant_value.go,replay.go,query.go,objective.goandnested.gotranslate a*lower.ExprEntrybyprogram.ExprKindandprogram.Operator;Var.Refis an entry, and conditions, objectives and defaults are read by theirExprID.ir/lower, shared with the later sub-steps.graph_questions.goanswers what a consumer asked the tree about a node or record, by id (FormOf,FormName,Invokes,CaseNode,ExpressionOf,TraceLabel,ScopeOf, and methods onLoop,Assign,Send,Accept,ObjectFlow,ActionEdge).expr_questions.gogainsWritten,Reference,Segments,Invoked,ReadsandDeclared.ir/program. AnExprBodyrecord carriesParams,ResultandLocals, andlower.ExprEntry.Answeris the entry behindResult; quantifier translation reads these. The fields are additive and the runtime does not read them. AnExprInvokewritten with a qualified name records its segments inPath, as anExprRefdoes, so a quoted name holding::stays one name;TestQuantifierNamedInSegmentsIsTheLibraryQuantifierpins it.exec/runtime.expr_entry.goevaluates and labels by entry and by node id (ExprEntry,EvalEntry,EvalEntryOn,ReadEntryInSatisfaction,EntryText,TokenLabelOf,BranchLabelOf,DecisionPlaceOf).semantic.Resolver.ResolveSegments,semantics.DeclaresSubject/DeclaresFeatureandResultExpressionConflict.Written, so the two engines ask by name and span.What still reads the tree, inside
lower. The questions ingraph_questions.goandReads/Reference/Writtenare answered from the tree the graphs still hold: a walk overprogram.Expralone would miss the local members of a body expression, which the record only counts. Step 8 deletes the tree side and rewrites these over the records; the consumers do not change again. The design document records this.Error behaviour. One satisfiability refusal changes, by design; no other solver or satisfiability error moves. Two steps typed by one definition, each stating a flow of its own (
action one : Leg { … },action two : Leg { … }inside one action), lower to two subflow graphs over the same declarations.smt: malformed action flow: node a: the initial node is not among the flow's nodes(*smt.FlowError).smt: not encoded: node one: nested flow: a node stating a flow of its own is encoded by a later stage(*smt.UnsupportedError), the refusal every other nested flow gets.Flowkeyed nodes by tree pointer and skipped one it had already numbered, so the second step's frame was left without the definition's nodes. That was an artifact of the key, not a property of the model. A node is now keyed by graph and id only, each frame numbers its own nodes, and the model reaches the nested-flow refusal.TestAnalyzeRefusesTwoFlowsOfOneDefinitionpins it and a changelog fragment records the text change.initial node is not among the flow's nodescheck is removed: a graph gives ids only to its own nodes, so a flow's initial node is always numbered in its own frame, and a flow with no initial node is still reported asthe flow has no initial node.make().flag(a feature of an invocation's result) is refused as before the migration:Segmentsanswers references and feature chains only, and the quantifier translation asks the invoked name throughInvoked; aTestRefusalscase andTestExprEntryInvokedpin it.Left for step 8. Refusal texts that name a node or expression kind still print the tree's Go type names (
%T,expression *ast.X), answered bylowerso they stay byte-identical; they move to IR kind names when the tree side is deleted.How it was verified
expr_questions_test.goandgraph_questions_test.goininternal/ir/lower,TestAnalyzeRefusesTwoFlowsOfOneDefinitionininternal/exec/smt,TestExprEntryInvoked, the quantifier-alias test and themake().flagrefusal case ininternal/exec/solve,TestResolveSegments,TestDeclaresSubjectAndFeatureand the span assertions of the result-expression tests.go build ./...,go vet ./...,gofmt -l .(empty),make lint,go test ./...with the training, pilot and specification-example corpora required (140 packages),go test ./tests/hygiene,go test -C tools ./...,make docs-counts,make spec-compliance-check,make changelog-check,make wasm-check.agree 229 · kind-only 1 · order-only 0 · disagree 38 · differs-by-design 5 · pilot-unevaluated 167 · pilot-silent 24 · pilot-error 7 · ours-error 10 · ours-undetermined 17 · both-error 16 · nondeterministic 0, equal to the committed record.pilot-xpect -checkpasses (432 files, 1299 agree, 30 disagree).REPLEvalExprGRPCEvaluateConnectEvaluateHTTPAllocations per operation: 123 → 124, 144 → 145, 224 → 224. The benchmarks evaluate
Perf::Calc1(2.0, 3.0), a qualified invocation, and the one allocation is its segments. Bytes per operation:GRPCEvaluate+2.28% (11.65 Ki → 11.91 Ki, p=0.000), the others unchanged.What moved. No ratchet:
replGzipBudgetintests/wasm/browser_repl_test.gois the 16,400,000 bytesdevelopsets, andtests/wasmis identical todevelop; the browser REPL build measures 16,312,572 gzipped at this head (core 7,482,077, engine 11,096,626, syntax 1,665,013). No conformance expectation, golden trace, view golden, corpus baseline, wire format or snapshot format moves.Known on
develop.go run -C tools ./cmd/pilot-diff -checkfails identically on develop 0abb3aa; re-recorded by #2323. This branch does not touchdocs/project/pilot-differential-baseline.json.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.md— for the changed refusal textmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/f0e5153d16b3428e96fddec893eb225e
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/f0e5153d16b3428e96fddec893eb225e?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work