Repository navigation
Do not link Found facts through an enum constant they only compare with - #534
CatarinaGamboa wants to merge 1 commit into
Conversation
An enum constant read in code is a variable named Type.CONST, so the relevance pass linked every fact that compared a value with the same constant. A constant is a fixed value, so such facts share no unknown; it now links facts only when a function or alias takes it or a value one takes is compared with it, where equal objects have equal ghost values. A1_09 no longer shows newMode == BORDERLESS once the ternary no longer depends on newMode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex design reviewSent the comparison of #529 and #531, the cause, the change and its soundness argument, and asked Codex to break it. Round 1: DISAGREE(The first draft dropped every enum constant from the symbols. Codex read the file while a temporary The intended change has a blocking counterexample. Let The premises establish As checked out, the diff does not implement the removal: VCRelevantFacts.java still has For the other cases: a resolved-literal I would keep ErrorMessage’s DISAGREE — removing enum constants from all relevance symbols can hide the ghost-function fact that explains a state error. Fixed: a constant stays a symbol when a function or alias takes it, or when a value one takes is compared with it. Its counterexample is now the test Round 2: AGREENo new blocking objection to the revised change. I reviewed the uncommitted diff without editing the checkout or running Maven. The cases you named behave as intended under the revised rule:
There is a pre-existing limitation worth recording. For a two-value enum A Found that is a single ternary reading AGREE |
Clean-code reviewI audited this PR's diff against the clean-code principles (SOLID, DRY, KISS, YAGNI, naming). Fixed
Declined
|
Codex review, round 1
Nothing to fix, so no further rounds. |
Stacked on #531 (base
feat/found-fold-decided-ternary). Part of #523: the last step of folding A1_09's Found.What
After #531 folds A1_09's ternary under
newMode == BORDERLESS, the ternary no longer mentionsnewMode, yet Found still showsnewMode == BORDERLESS. The cause is in Relevant to Expected (VCRelevantFacts.addSymbols,VCRelevantFacts.java:125on #531): everyVaris a symbol, and an enum constant read in code is aVarnamedDisplayMode.BORDERLESS. SonewMode == BORDERLESSand the folded ternary stay linked through the constant. (An enum constant written in a refinement is anEnumnode, which already linked nothing.)A constant is a fixed value: two facts that only compare values with the same constant share no unknown. The relevance pass now ignores enum constants as symbols, except when a function or alias takes the constant, or a value one takes is compared with it. There, equality through the constant does relate facts (
x == A && state(A) == showngivesstate(x) == shown). This exception comes from Codex's round-1 counterexample.VCRelevantFactstakes the enum constants of the chain.VCKnownEnumValues.enumConstantsexposes the set Fold ternaries that a fact of Found decides on an enum value #531 already builds.ErrorMessage's fact selection.Soundness
Display only; the verdict is unchanged. The relevance pass drops only facts D whose unknowns are disjoint from Expected's and from the kept facts S. Enum constants are distinct
EnumSortvalues. When no function takes a value equal to a shared constant, a model of S and a model of D combine. So the premises imply S, and S fails Expected exactly when the premises do.static finalconstants are not in the set.A1_09 (the only study task that changes)
The other seven study tasks have the same output as on #531, byte for byte, with one error each on
reportedLine. All 287testSuitefixtures have the same headlines as on #531.The formatter writes a Found that is a single ternary without parentheses, as in #531's FULLSCREEN case. That is outside this PR.
Tests
VCSimplificationTest#relevantStepDoesNotLinkFactsThroughAConstant(fails without the change).VCSimplificationTest#relevantStepLinksFactsThroughAConstantAnObjectEquals(Codex's counterexample; fails with the naive "drop every constant" version).mvn test: 735 tests, 0 failures.🤖 Generated with Claude Code