Repository navigation
Let engine G run on terms with free variables - #357
Merged
Merged
Conversation
Engine G is lazy, so a free variable that the computation does not read stays in its thunk, and a read of a free variable bails. So engine G can give the value of an open term such as the length of a list whose elements read a free variable.
The test gives a Nat argument that has a free variable that the computation does not read, and an argument where the computation reads the free variable.
The section gives the root cause of the cost of short-circuit-and-bad, the change to engine G, the measures and the tests where rulean is behind. It also corrects 19.31.7, and the changelog and the module doc of engine G follow the change.
tamnd
enabled auto-merge (squash)
December 2, 2026 14:34
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.
Part of #354.
Engine G (
ground.rs) now runs on terms with free variables. Before this change,ground_okrejected each term with a free variable, so theNatextension gave these terms to engine R.The machine of engine G is lazy. An argument goes into a thunk, and a step that reads a free variable stops the machine. So when engine G gives a result, the result does not depend on a free variable, and it is the result of the same steps of engine R.
In
short-circuit-and-bad,t[i]!needs the size of an array that 600Array.pushcalls build. The elements read the free variablespandq, but the size does not read them. Engine R forced the full list with about 938k rule steps, and each step made and interned new terms. Engine G now gives the size with no new terms.Measures (instructions, build without PGO, server4):
short-circuit-and-badinitstdNo other perf test changes by more than 0.05 G. The 238 Arena verdicts are correct, and
--confirm allgives 0 disagreements oninit,stdand the Arena tests. The sum of the perf tests is now less than the sum of each rival (kefir 85.59 G, gruszka 97.69 G, nano-lean 100.78 G).Changes:
ground_okno longer needs a term with no free variable.nat_argument_with_a_free_variableincrates/rulean-core/tests/tc.rs.