feat(spatial): 诱饵隐藏家族 area.sup2d / dof.c6d,与新的 unknown 语义对齐
单调规则之后,隐藏家族变成"永远 unknown",于是"看到隐藏就弃权"成了完美答案, 反而不区分任何能力。新增两个族:诱饵块 H 自己藏在视野外、悬挂在地面上而从不悬挂 在目标上,可见结构仍能证明目标成立 —— 同族内因此既有可判也有不可判。 同时把 check_insufficient 改到新语义:unknown 不再意味着"手上那个全状态给出相反 答案",而是"观测没有裁决它且确有内容被隐藏"。
This commit is contained in:
1 parent
813be2906b
commit
c3748c36c7
2 files changed
+46
-11
No files matched your search
+16
-7
@@ -83,23 +83,32 @@ def check_labels() -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def check_insufficient() -> bool:
|
def check_insufficient() -> bool:
|
||||||
"""The point of the unknown label: identical observation, opposite truth."""
|
"""The point of the unknown label: the observation does not settle it.
|
||||||
|
|
||||||
|
Under the monotone rule an unknown label no longer implies that *the one full
|
||||||
|
state we hold* answers differently from the observation's own world -- it
|
||||||
|
implies that the withheld content could be the missing piece. So the check is
|
||||||
|
that something is withheld and the visible structure does not already prove
|
||||||
|
the answer, which is exactly the condition the label promises.
|
||||||
|
"""
|
||||||
found = 0
|
found = 0
|
||||||
for fam in ("cond.p1h", "area.sup2h", "dof.c6h"):
|
for fam in generator.FAMILIES:
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
sc = generator.make(fam, seed=5, index=i)
|
sc = generator.make(fam, seed=5, index=i)
|
||||||
if sc.label.answer != "unknown":
|
if sc.label.answer != "unknown":
|
||||||
continue
|
continue
|
||||||
restricted = FullState(entities=list(sc.obs.entities), edges=list(sc.obs.edges))
|
restricted = FullState(entities=list(sc.obs.entities), edges=list(sc.obs.edges))
|
||||||
a_full = checker.evaluate(sc.full.entities, sc.full.edges, sc.query)
|
a_vis = checker.evaluate(restricted.entities, restricted.edges, sc.query)
|
||||||
a_obs = checker.evaluate(restricted.entities, restricted.edges, sc.query)
|
withheld = bool(sc.obs.dangling) or bool((sc.obs.hidden or {}).get("entity")) \
|
||||||
if a_full != a_obs:
|
or bool((sc.obs.hidden or {}).get("edge"))
|
||||||
|
if withheld and a_vis is not True:
|
||||||
found += 1
|
found += 1
|
||||||
else:
|
else:
|
||||||
return _fail(f"{fam}[{i}] unknown but both worlds agree; label is not justified")
|
return _fail(f"{fam}[{i}] unknown without withheld content or with a "
|
||||||
|
f"visible proof; label is not justified")
|
||||||
if found == 0:
|
if found == 0:
|
||||||
return _fail("no insufficient-evidence sample was produced")
|
return _fail("no insufficient-evidence sample was produced")
|
||||||
print(f"ok {found} unknown samples have same observation, different truth")
|
print(f"ok {found} unknown samples are undecided by the observation")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+30
-4
@@ -31,12 +31,14 @@ FAMILIES = {
|
|||||||
"area.sup2h": {"domain": "stability", "n_blocks": 2, "hidden": 1},
|
"area.sup2h": {"domain": "stability", "n_blocks": 2, "hidden": 1},
|
||||||
"area.free": {"domain": "stability", "n_blocks": 2, "hidden": 0, "free": 1},
|
"area.free": {"domain": "stability", "n_blocks": 2, "hidden": 0, "free": 1},
|
||||||
"area.sup3h": {"domain": "stability", "n_blocks": 3, "hidden": 1},
|
"area.sup3h": {"domain": "stability", "n_blocks": 3, "hidden": 1},
|
||||||
|
"area.sup2d": {"domain": "stability", "n_blocks": 2, "hidden": 0, "notch": 1},
|
||||||
"dof.c6": {"domain": "freedom", "n_cons": 6, "hidden": 0},
|
"dof.c6": {"domain": "freedom", "n_cons": 6, "hidden": 0},
|
||||||
"dof.c6r": {"domain": "freedom", "n_cons": 7, "hidden": 0},
|
"dof.c6r": {"domain": "freedom", "n_cons": 7, "hidden": 0},
|
||||||
"dof.c6h": {"domain": "freedom", "n_cons": 6, "hidden": 1},
|
"dof.c6h": {"domain": "freedom", "n_cons": 6, "hidden": 1},
|
||||||
# the pure sub-skill: no intervention at all, so the answer is exactly "are
|
# the pure sub-skill: no intervention at all, so the answer is exactly "are
|
||||||
# all six axes covered". If this family cannot be learned, the edit families
|
# all six axes covered". If this family cannot be learned, the edit families
|
||||||
# are not the problem -- the set readout is.
|
# are not the problem -- the set readout is.
|
||||||
|
"dof.c6d": {"domain": "freedom", "n_cons": 6, "hidden": 0, "notch": 1},
|
||||||
"dof.set": {"domain": "freedom", "n_cons": 6, "hidden": 0, "no_edit": 1},
|
"dof.set": {"domain": "freedom", "n_cons": 6, "hidden": 0, "no_edit": 1},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +129,7 @@ def _build_connection(rng, n_paths: int, hidden: int):
|
|||||||
# stability: stacked blocks, optional hidden pedestal
|
# stability: stacked blocks, optional hidden pedestal
|
||||||
|
|
||||||
|
|
||||||
def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0):
|
def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0, notch: int = 0):
|
||||||
if free:
|
if free:
|
||||||
# the minimal pair against area.sup2h: here T has exactly one contact and
|
# the minimal pair against area.sup2h: here T has exactly one contact and
|
||||||
# that contact leads to a block which itself hangs in the air. Nothing
|
# that contact leads to a block which itself hangs in the air. Nothing
|
||||||
@@ -178,6 +180,17 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0):
|
|||||||
vis_edges.discard(e.eid)
|
vis_edges.discard(e.eid)
|
||||||
vis_ents.discard("P")
|
vis_ents.discard("P")
|
||||||
|
|
||||||
|
if notch:
|
||||||
|
# a decoy that is *itself* withheld, hanging off the ground and never off
|
||||||
|
# the target: the visible structure still proves the target stands. This
|
||||||
|
# is the case that makes "something is hidden" and "I cannot tell" two
|
||||||
|
# different facts inside one family. Without it every hidden family is
|
||||||
|
# all-unknown and keying on the hidden flag is a perfect answer.
|
||||||
|
ents.append(Entity("H", "block", attrs={"box": [80, 70, -16, 100, 90, 0]}))
|
||||||
|
edges.append(Edge("kHG", "contact", "H", "G"))
|
||||||
|
vis_edges.discard("kHG")
|
||||||
|
vis_ents.discard("H")
|
||||||
|
|
||||||
# the target is T on purpose: it survives every legal edit except the one
|
# the target is T on purpose: it survives every legal edit except the one
|
||||||
# that removes P, so "removed something" no longer implies "answer false"
|
# that removes P, so "removed something" no longer implies "answer false"
|
||||||
query = Query(kind="stability", a="T")
|
query = Query(kind="stability", a="T")
|
||||||
@@ -188,6 +201,11 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0):
|
|||||||
query.edit = {"op": "remove_entity", "entity": "P"} # collapses
|
query.edit = {"op": "remove_entity", "entity": "P"} # collapses
|
||||||
elif r < 0.75:
|
elif r < 0.75:
|
||||||
query.edit = {"op": "remove_entity", "entity": harmless} # no effect
|
query.edit = {"op": "remove_entity", "entity": harmless} # no effect
|
||||||
|
elif notch:
|
||||||
|
# removing P takes the only visible proof away; the hidden decoy cannot
|
||||||
|
# stand in for it, so the verdict becomes unknown rather than false
|
||||||
|
if r < 0.5:
|
||||||
|
query.edit = {"op": "remove_entity", "entity": "P"}
|
||||||
return ents, edges, query, vis_edges, vis_ents, layers, ["front", "iso"], {"length": "mm", "per_unit": 1}
|
return ents, edges, query, vis_edges, vis_ents, layers, ["front", "iso"], {"length": "mm", "per_unit": 1}
|
||||||
|
|
||||||
|
|
||||||
@@ -195,7 +213,7 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0):
|
|||||||
# freedom: constraint sets, optionally redundant on one axis
|
# freedom: constraint sets, optionally redundant on one axis
|
||||||
|
|
||||||
|
|
||||||
def _build_freedom(rng, n_cons: int, hidden: int, no_edit: int = 0):
|
def _build_freedom(rng, n_cons: int, hidden: int, no_edit: int = 0, notch: int = 0):
|
||||||
# the axes are drawn, so a family spans both verdicts with the same entity
|
# the axes are drawn, so a family spans both verdicts with the same entity
|
||||||
# count: six mates that cover every axis lock the part, six that cover five
|
# count: six mates that cover every axis lock the part, six that cover five
|
||||||
# do not, and the difference is invisible from the shape of the scene
|
# do not, and the difference is invisible from the shape of the scene
|
||||||
@@ -223,6 +241,14 @@ def _build_freedom(rng, n_cons: int, hidden: int, no_edit: int = 0):
|
|||||||
if hidden:
|
if hidden:
|
||||||
visible.discard("k5") # one mate lives in the part definition
|
visible.discard("k5") # one mate lives in the part definition
|
||||||
vis_ents.discard("F5")
|
vis_ents.discard("F5")
|
||||||
|
if notch:
|
||||||
|
# a redundant mate kept outside the view: it dangles on the part, but the
|
||||||
|
# visible mates already cover every axis, so the proof stands
|
||||||
|
ents.append(Entity(f"F{n_cons}", "ground", attrs={"x": 0, "y": 0, "z": 0}))
|
||||||
|
edges.append(Edge(f"k{n_cons}", "constraint", "P", f"F{n_cons}",
|
||||||
|
attrs={"axis": rng.choice(list(DOF_AXES))}))
|
||||||
|
visible.discard(f"k{n_cons}")
|
||||||
|
vis_ents.discard(f"F{n_cons}")
|
||||||
|
|
||||||
query = Query(kind="freedom", a="P")
|
query = Query(kind="freedom", a="P")
|
||||||
if no_edit:
|
if no_edit:
|
||||||
@@ -238,9 +264,9 @@ def _build_freedom(rng, n_cons: int, hidden: int, no_edit: int = 0):
|
|||||||
_BUILDERS = {
|
_BUILDERS = {
|
||||||
"connection": lambda rng, spec: _build_connection(rng, spec["n_paths"], spec["hidden"]),
|
"connection": lambda rng, spec: _build_connection(rng, spec["n_paths"], spec["hidden"]),
|
||||||
"stability": lambda rng, spec: _build_stability(rng, spec["n_blocks"], spec["hidden"],
|
"stability": lambda rng, spec: _build_stability(rng, spec["n_blocks"], spec["hidden"],
|
||||||
spec.get("free", 0)),
|
spec.get("free", 0), spec.get("notch", 0)),
|
||||||
"freedom": lambda rng, spec: _build_freedom(rng, spec["n_cons"], spec["hidden"],
|
"freedom": lambda rng, spec: _build_freedom(rng, spec["n_cons"], spec["hidden"],
|
||||||
spec.get("no_edit", 0)),
|
spec.get("no_edit", 0), spec.get("notch", 0)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user