The "before/left" reading-rule lever. The microscope showed only the question-time
reading is cleanly achievable: "for N money = spend" is cue-precision-blocked (the
`for` cue is overloaded across train_sample -- `for $2`, `for 14 days`, `for 10 reps`
-- so a spend rule risks regressing train-0021/0003 and is the overfitting trap),
and the disguised-polarity cases already refuse via pooling. "left" is already handled
by loss verbs.
What ships: a question-scope guard. A question asking for a state *before* a stated
change ("How much did Lisa have before lunch?", gold 50) asks for a temporal point
the forward composers do not compute -- they derive the final/net state (50-20=30).
Until a question-time reader exists that is a refusal, never a guess at the wrong
point. target.asks_prior_state detects before/initially/originally/at first/to begin
with/to start with/at the start in the QUESTION CLAUSE only (the last `?`-sentence),
so body narrative does not trip it -- verified safe against train-0003 ("sells before
school starts"), 0010 ("had 20 initially, then lost 12"), 0028. `used to` is excluded
(the purpose infinitive "beads used to make a bracelet" is a false positive).
resolve_pooled refuses when asks_prior_state holds.
Result (sealed lane; chat/ does not import these -> serving 3/47/0 frozen):
- confuser wrong 2 -> 1 (only 0016 distractor-anchor-skip remains). temporal-scope
category cleared (0 wrong / 2 refused). pair-tells 1 -> 0: 0020 ("before lunch")
refuses while its minimal-pair twin 0021 ("left", gold 30) still solves the net --
the discrimination the corpus is built to measure.
- genuine positives still 7 solved, 0 wrong.
- train_sample 3/47/0 and practice 3/47/0 byte-identical.
- 205 derivation/target/pool tests + 40 architectural invariants green.
Tests:
- test_adr_0182_pool.py TestPriorStateQuestionGuard: detector true/false edges
(before-in-question vs before-in-body vs `used to make` false positive vs the
`left` twin) + resolve_pooled refuses the before-question while the left-twin
resolves forward to 30.
- test_adr_0163_f2_confusers.py: baseline wrong 2->1, pair_tells 1->0; new
test_temporal_scope_does_not_misfire + test_before_left_minimal_pair_discriminated.
Stacked on #476 (pooling); merge #476 first. 0016 anchor-skip is the next lever.
Pairs with ADR-0163-F2 graduation amendment (#478).
70 lines
2 KiB
Python
70 lines
2 KiB
Python
"""ADR-0175 Phase 3 — grounded derivation search + self-verification gate.
|
|
|
|
Phase 3a (this surface): the self-verification gate — grounded operands ∧
|
|
grounded operation cues ∧ unit consistency ∧ uniqueness. The wrong=0-critical
|
|
guard that keeps the (Phase 3b) bounded search honest.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from generate.derivation.clauses import (
|
|
ClauseResult,
|
|
clause_local_results,
|
|
segment_clauses,
|
|
)
|
|
from generate.derivation.accumulate import accumulation_candidates, compose_accumulation
|
|
from generate.derivation.compose import compose_sequential
|
|
from generate.derivation.comparatives import (
|
|
ComparativeScalar,
|
|
comparative_step,
|
|
extract_comparative_scalars,
|
|
)
|
|
from generate.derivation.extract import extract_quantities
|
|
from generate.derivation.model import GroundedDerivation, Quantity, Step, VALID_OPS
|
|
from generate.derivation.multistep import candidate_chains, search_chain
|
|
from generate.derivation.pool import pooled_candidates, resolve_pooled
|
|
from generate.derivation.search import (
|
|
MULTIPLICATIVE_CUES,
|
|
multiplicative_candidates,
|
|
search_multiplicative,
|
|
)
|
|
from generate.derivation.target import Target, asks_prior_state, extract_target
|
|
from generate.derivation.verify import (
|
|
Resolution,
|
|
SelfVerification,
|
|
classify_derivation,
|
|
select_self_verified,
|
|
self_verifies,
|
|
)
|
|
|
|
__all__ = [
|
|
"ClauseResult",
|
|
"ComparativeScalar",
|
|
"GroundedDerivation",
|
|
"MULTIPLICATIVE_CUES",
|
|
"Quantity",
|
|
"Resolution",
|
|
"SelfVerification",
|
|
"Step",
|
|
"Target",
|
|
"VALID_OPS",
|
|
"accumulation_candidates",
|
|
"asks_prior_state",
|
|
"candidate_chains",
|
|
"classify_derivation",
|
|
"clause_local_results",
|
|
"compose_accumulation",
|
|
"compose_sequential",
|
|
"comparative_step",
|
|
"extract_comparative_scalars",
|
|
"extract_quantities",
|
|
"extract_target",
|
|
"multiplicative_candidates",
|
|
"pooled_candidates",
|
|
"resolve_pooled",
|
|
"search_chain",
|
|
"search_multiplicative",
|
|
"segment_clauses",
|
|
"select_self_verified",
|
|
"self_verifies",
|
|
]
|