Found: rewrite facts through ghost equalities g(x) == g(x@k) so they are stated about x
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start by reading VCFunctionSubstitution and the state error display pipeline, especially the shared ghostFunctionsOf lookup described in the issue. Then inspect the ErrorStateHintMultipleSets message test and add focused unit tests for chains, branch scope, declined equalities, and the listed guards. Done means the display rewrite follows the specified equivalence and scoping rules without changing the solver VC; the issue estimates the tests as lean but does not name file paths.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
A state error's Found keeps every call's frame equality, g(x) == g(x@k), next to the facts about the older instance x@k. The reader has to chain them in their head to see what x is now:
found closed(d@26) && locked(d) && doorState(d) == doorState(d@26) but expected closed(d) && unlocked(d)
says "d is closed" in two steps. Written directly about d, the clash with Expected is plain:
found closed(d) && locked(d) but expected closed(d) && unlocked(d)
VCFunctionSubstitution already propagates f(...) == e, but only into later rows and only for an exact syntactic match. A state is written closed(d@26), not doorState(d@26) == 0, so it never matches and the equality stays.
Proposal: a general display step, rewrite through ghost equalities
Source equality. g(x) == g(y) where g is a ghost function (a state set, named or stateN, or any @Ghost such as size or r) with the same argument tuple shape, and either:
- the equality is a top-level conjunct of Found, in which case it rewrites across all of Found; or
- it sits inside a branch of
c ? … : …, in which case it rewrites only within that branch, and the guard stays. The equality is dropped only ifg(y)occurs nowhere outside that branch. Otherwise it stays: rewriting under an equality that holds is still exact, but eliminatingg(y)is not.
An equality under ||, !, or on the left of --> is never used.
Conditions on the eliminated term g(y):
-
Expected does not mention
g(y). -
Let the fresh variables be the argument variables of
g(y)that do not occur anywhere in the arguments ofg(x). Occurrence is by variable identity across the whole tuple, so a variable moved to another position is not fresh. There must be at least one fresh variable (sog(a,b) == g(b,a)is never eliminated). Every fresh variable has a class type, which Z3 encodes as an uninterpreted sort, and is never constrained as a value in Found or in Expected. No other application of the same SMT-resolved ghost in Found or Expected uses a fresh variable:g(y,b)next tog(x,a) == g(y,a)blocks it, becausea == bwould make the two the same application. The conditions are checked again before each step of a chain. That means noy == z, noyas an argument of an alias or of a non-ghost function, and noyin a ghost application whose arguments are not plain variables. This is the same guard as #495. Ghosts overboolean, enums,intor other interpreted or finite sorts are never eliminated. Facts about other ghosts ofy(h(y) == 1) may stay. -
Under 1 and 2, replacing every
g(y)(that exact application) byg(x)and dropping the equality is exact:Found' ⇒ Expectedis valid iffFound ⇒ Expectedis valid.- From a model of
Found' ∧ ¬Expected, build a model ofFound ∧ ¬Expected. Map each fresh variable to a fresh element of its sort. Give every ghost application involving those elements the value its original version had, and giveg(y)the value ofg(x). This is consistent because the tuple ofg(y)now contains a fresh element, so it differs from every other tuple ofg,g(x)'s included. That holds because no other application ofguses a fresh variable. Every fact keeps its truth value, because by condition 2 the fresh variables occur only as ghost arguments. The equality now holds, and Expected is unchanged. - The converse direction is substitution under the equality.
- A fresh element always exists for an uninterpreted sort. For a finite sort it may not: with
x == false,h(x) == 0 && h(y) == 1forcesy == truewithout ever comparingy. That is why condition 2 restricts the type.
When either condition fails, the equality and the facts stay as they are.
- From a model of
Rewrite. Replace every occurrence of the exact application g(y) (same qualified ghost, same full argument tuple) by g(x), including inside other equalities. So g(x) == g(y) && g(z) == g(y) && g(z) == 0 becomes g(z) == g(x) && g(z) == 0, and then g(x) == 0.
A state counts as an occurrence only if its refinement is exactly g(v) == k for this g, which is the form @StateSet gives (TypeChecker builds it). So closed(d@26) becomes closed(d). A state or alias with any other refinement is an argument of a non-ghost function, which condition 2 already excludes.
Direction. The kept term is the endpoint Expected mentions. Normally that is the newest instance, which keeps the target variable visible (#374). If Expected mentions both endpoints, the equality joins two terms it sees, so it stays. If Expected mentions neither, keep the newer instance (x over x@k; a variable over a generated #…_result).
Rows. The display chain scopes variables by row. Each rewritten fact goes in the latest of its original row and the rows binding each of its variables, so x and any other variable it mentions are in scope. A fact whose row already binds all of them stays where it is.
Interaction with VCFunctionSubstitution. That pass consumes g(x) == g(y) in the opposite direction: it rewrites later rows from g(x) to g(y) and drops the equality. Running this pass first is not enough, because an equality this pass declines (for example g(x) == g(y) && y != z) would still be consumed there. Main can then already print y != z && g(y) == 1 for an Expected g(x) == 1, which no longer shows the link. So for state errors, VCFunctionSubstitution skips every equality between two ghost applications, and this pass is the only one that rewrites through them. Guards are checked against the ghost application that actually resolves in SMT (resolveFunctionDecl falls back to the simple name).
Termination. Each step removes the term g(y) from Found, so the steps stop.
Like the other steps, this only affects what is displayed: the solver's VC is unchanged and the original Found stays as the previous step. State errors only, until it is checked against the counterexamples of refinement errors.
A side effect: a frame equality whose g(y) has no other fact, and whose y meets condition 2, disappears outright. In ErrorTrafficLightRGB, r(tl) == r(tl@48) && g(tl) == g(tl@48) && b(tl) == b(tl@48) only says "the colour values were kept" and goes away.
Where it shows
ErrorStateHintMultipleSets: as above.- Study A1_56 (undo manager):
undo(undoManager@70) == undo(#getUndoManager_result),limit(...) == limit(...),phase(...) == phase(...)chains through every call. E_A3_07scanner,ErrorArgumentPicksTheStateEarlier:state1(param) == state1(param@25)next totilingOff(param@25).
Relation to other work
- #297 / #495 (Relevant to Expected): the two are complementary. Run this rewrite first, then the relevance step on its result.
- #435 / #498 (named sets): makes the equalities readable, and this step removes most of them.
- The state-to-set lookup is the one #495 adds (
ghostFunctionsOf), so it can be shared.
Tests (lean), each failing without its rule:
- a message test on
ErrorStateHintMultipleSets; - unit tests for a two-step chain; a declined equality that
VCFunctionSubstitutionmust keep; an equality inside one branch that must not rewrite outside it;y == zblocking the elimination; and a ghost over abooleanargument that is not eliminated; a permuted tupleg(a,b) == g(b,a)that is kept; andg(x,a) == g(y,a) && a == b && g(y,b) == 1that is kept.
- Ngôn ngữ chính
- Java
- Star
- 73
- Fork
- 38
- Merge trung bình
- 12 giờ 32 phút
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của liquid-java/liquidjava
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
liquid-java/liquidjava#562 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Có thể đã có người làm @MohammedZaid1740 đã nhận 7 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
liquid-java/liquidjava#443 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug real-world-finding
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
liquid-java/liquidjava#395 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatibleCó thể đã có người làm @CatarinaGamboa đã nhận 4 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
liquid-java/liquidjava#558 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
new T[a][b] gets length b instead of a (unsound)Có thể đã có người làm @CatarinaGamboa đã nhận 4 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
liquid-java/liquidjava#557 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của liquid-java/liquidjava
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
quelea-projection/Quelea#749 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
erkamyaman/rust-anything#963 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
api-diagnostics bug jdbc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ClickHouse/clickhouse-java#3464 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 76/100
-
Deferred
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Sanne/incus-spawn#2768 ·
Maintainer thường phản hồi trong vòng 1 ngày