From 813be2906b73a95574162981143fd26e1c45ba9f Mon Sep 17 00:00:00 2001 From: x Date: Thu, 3 Dec 2026 20:46:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(spatial):=20=E6=9C=89=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=B6=E6=94=B9=E7=94=A8=E5=8D=95=E8=B0=83?= =?UTF-8?q?=E8=A7=84=E5=88=99=E7=BB=99=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 旧规则只比较"全状态"和"观测自己的世界"这两个世界。于是"底座在零件后面,而在这 个具体场景里它本来也帮不上忙"被判成可判 false——这不是 agent 能知道的事实:另一个 同样符合观测的世界把底座挪到形心底下,答案就翻了。 隐藏内容只会增加证据(导通的边只会连上、接触只会支撑、配合只会锁轴),不会推翻 观测里已有的证明。所以:可见结构已经证明 → 可判 true;没证明 → unknown,不管手上 那一个全状态怎么裁。这一条同时把上一轮 area.sup2h 那 36 条假"可判"消掉。 --- spatial/checker.py | 59 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/spatial/checker.py b/spatial/checker.py index 3f5e38f..ca82af3 100644 --- a/spatial/checker.py +++ b/spatial/checker.py @@ -254,22 +254,51 @@ def validate_evidence(full: FullState, query: Query, evidence) -> bool: def label(obs: Observation, full: FullState, query: Query, alternatives: Iterable[FullState] = ()) -> Label: - """Full state decides; the observation decides whether we may say so.""" - worlds = [full] + list(alternatives) - answers = [evaluate(w.entities, w.edges, query) for w in worlds] - if any(a is None for a in answers) or len(set(answers)) != 1: - # the observation admits more than one truth: this is the real - # "insufficient evidence" case, not an occlusion tag + """Full state decides; the observation decides whether we may say so. + + When something is withheld the rule is *monotone*: a hidden conduct edge can + only connect, a hidden contact can only support, a hidden mate can only lock + an axis. None of them can undo a proof the observation already contains. So + + * the visible structure already proves the answer -> decidable "true"; + * it does not -> the withheld item could be exactly the missing piece, and + the answer is unknown, however the one full state we happen to hold + resolves it. + + The cheaper rule -- compare the full state against the observation's own + world -- marks "the pedestal is behind the part and in this particular scene + it would not have helped" as decidable false. That is not a fact the agent + can know: another equally consistent world puts the pedestal under the + centroid and the answer flips. Measured: area.sup2h came out 36 decidable / + 92 not, and the model swung between answering all of them and abstaining + from all of them, because the split is not in the observation. + """ + ans_full = evaluate(full.entities, full.edges, query) + alt = list(alternatives) + ans_vis = evaluate(alt[0].entities, alt[0].edges, query) if alt else ans_full + withheld = bool(obs.dangling) or bool((obs.hidden or {}).get("entity")) \ + or bool((obs.hidden or {}).get("edge")) + + if withheld: + if ans_vis is True: + # the observation proves it on its own; nothing withheld can break it + return Label(answer="true", change=_change(full, query, True), + evidence=evidence_for(alt[0], query) if alt else [], sufficient=True) return Label(answer="unknown", change="unknown", evidence=[], sufficient=False) - ans_after = answers[0] + if ans_full is None or ans_vis is None or ans_full != ans_vis: + return Label(answer="unknown", change="unknown", evidence=[], sufficient=False) + + return Label(answer="true" if ans_full else "false", + change=_change(full, query, ans_full), + evidence=evidence_for(full, query), sufficient=True) + + +def _change(full: FullState, query: Query, ans_after) -> str: + if query.edit is None: + return "same" before = Query(kind=query.kind, a=query.a, b=query.b, edit=None) ans_before = evaluate(full.entities, full.edges, before) - if query.edit is None: - change = "same" - elif ans_before is None: - change = "unknown" - else: - change = "changed" if ans_before != ans_after else "same" - return Label(answer="true" if ans_after else "false", change=change, - evidence=evidence_for(full, query), sufficient=True) + if ans_before is None: + return "unknown" + return "changed" if ans_before != ans_after else "same"