omnibias.core.proof.condition
Coefficient recurrences, activation contracts, jet algebra, and verified arithmetic shared by the numerical backends.
import omnibias.core.proof.conditionModule contract & mathematical conventions
Hypothesis language whose points are conditions, not colourings or maps.
A ConditionHypothesis is a typed expression in a finite
GrammarSpec. Proposers emit hypotheses. Typed constructors grow the
grammar. The accept gate is an exact Q / finite checker in the owning
package — this module never imports holonomic / symbolic / combinatorics / pinn.
An incomplete grammar miss is search_incomplete. It is never “no condition
exists” and never a parent theorem. GrammarSpec.complete defaults False.
Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.
ALL_CONDITION_SORTS
omnibias.core.proof.ALL_CONDITION_SORTSSource ↗ALL_CONDITION_SORTS: tuple[ConditionSort, ...] = ('conservation', 'dfinite', 'edge_colouring', 'extremal_template', 'forbidden_minor', 'fractional_order', 'jet_monomial', 'ore', 'pde_operator', 'piecewise_hybrid', 'residual_sign', 'sos_onset', 'sos_template')This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
ALL_CONDITION_SORTS: tuple[ConditionSort, ...] = (
"conservation",
"dfinite",
"edge_colouring",
"extremal_template",
"forbidden_minor",
"fractional_order",
"jet_monomial",
"ore",
"pde_operator",
"piecewise_hybrid",
"residual_sign",
"sos_onset",
"sos_template",
)Other public import paths
omnibias.core.proof.ALL_CONDITION_SORTSomnibias.core.proof.condition.ALL_CONDITION_SORTS
ConditionHypothesis
omnibias.core.proof.ConditionHypothesisSource ↗class ConditionHypothesisDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
A proposed condition. Hashable ~omnibias.core.proof.discovery.Candidate.
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortdataclass field | ConditionSortRequired | See the operation contract and implementation below. |
tokensdataclass field | tuple[ConditionToken, ...]Required | See the operation contract and implementation below. |
constructorsdataclass field | tuple[str, ...]Default: () | See the operation contract and implementation below. |
coefficientsdataclass field | tuple[str, ...]Default: () | See the operation contract and implementation below. |
grammar_iddataclass field | strDefault: 'v1' | See the operation contract and implementation below. |
Executed regression · hypothesis hash and dict
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hypothesis_hash_and_dict() -> None:
left = _jet("y", "yp")
right = _jet("y", "yp")
assert left == right
assert hash(left) == hash(right)
payload = left.as_dict()
assert payload["sort"] == "jet_monomial"
assert payload["pretty"] == "jet_monomial[y, yp]"python -m pytest "packages/omnibias-core/tests/test_condition.py::test_hypothesis_hash_and_dict" -qFields & methods
sortfield
sort: ConditionSortDeclared ConditionSort field on ConditionHypothesis. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗tokensfield
tokens: tuple[ConditionToken, ...]Declared tuple[ConditionToken, ...] field on ConditionHypothesis. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗constructorsfield
constructors: tuple[str, ...] = ()Declared tuple[str, ...] field on ConditionHypothesis. Default expression: ().
coefficientsfield
coefficients: tuple[str, ...] = ()Declared tuple[str, ...] field on ConditionHypothesis. Default expression: ().
grammar_idfield
grammar_id: str = 'v1'Declared str field on ConditionHypothesis. Default expression: 'v1'.
prettymethod
pretty(self) -> strSee the class contract above and the exact method implementation below.
Returns: str
Executed regression · hypothesis hash and dict
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hypothesis_hash_and_dict() -> None:
left = _jet("y", "yp")
right = _jet("y", "yp")
assert left == right
assert hash(left) == hash(right)
payload = left.as_dict()
assert payload["sort"] == "jet_monomial"
assert payload["pretty"] == "jet_monomial[y, yp]"python -m pytest "packages/omnibias-core/tests/test_condition.py::test_hypothesis_hash_and_dict" -qMethod implementation
def pretty(self) -> str:
names = ", ".join(token.name for token in self.tokens)
return f"{self.sort}[{names}]"as_dictmethod
as_dict(self) -> dict[str, Any]See the class contract above and the exact method implementation below.
Returns: dict[str, Any]
Executed regression · hypothesis hash and dict
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hypothesis_hash_and_dict() -> None:
left = _jet("y", "yp")
right = _jet("y", "yp")
assert left == right
assert hash(left) == hash(right)
payload = left.as_dict()
assert payload["sort"] == "jet_monomial"
assert payload["pretty"] == "jet_monomial[y, yp]"python -m pytest "packages/omnibias-core/tests/test_condition.py::test_hypothesis_hash_and_dict" -qMethod implementation
def as_dict(self) -> dict[str, Any]:
return {
"sort": self.sort,
"tokens": [token.as_dict() for token in self.tokens],
"constructors": list(self.constructors),
"coefficients": list(self.coefficients),
"grammar_id": self.grammar_id,
"pretty": self.pretty(),
}token_namesmethod
token_names(self) -> tuple[str, ...]See the class contract above and the exact method implementation below.
Returns: tuple[str, ...]
Executed regression · constructor depth cap
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_constructor_depth_cap() -> None:
grammar = GrammarSpec(
sorts=("jet_monomial",),
tokens_by_sort={"jet_monomial": ("y", "yp")},
constructors=("compose_jets",),
max_growth_depth=1,
)
seed = _jet("y", "yp")
grown = apply_constructor(seed, "compose_jets", grammar, left="y", right="yp")
assert grown is not None
assert "y*yp" in grown.token_names()
assert apply_constructor(grown, "compose_jets", grammar, left="y", right="y") is Nonepython -m pytest "packages/omnibias-core/tests/test_condition.py::test_constructor_depth_cap" -qMethod implementation
def token_names(self) -> tuple[str, ...]:
return tuple(token.name for token in self.tokens)Read the implementation
class ConditionHypothesis:
"""A proposed condition. Hashable :class:`~omnibias.core.proof.discovery.Candidate`."""
sort: ConditionSort
tokens: tuple[ConditionToken, ...]
constructors: tuple[str, ...] = ()
coefficients: tuple[str, ...] = ()
grammar_id: str = "v1"
def pretty(self) -> str:
names = ", ".join(token.name for token in self.tokens)
return f"{self.sort}[{names}]"
def as_dict(self) -> dict[str, Any]:
return {
"sort": self.sort,
"tokens": [token.as_dict() for token in self.tokens],
"constructors": list(self.constructors),
"coefficients": list(self.coefficients),
"grammar_id": self.grammar_id,
"pretty": self.pretty(),
}
def token_names(self) -> tuple[str, ...]:
return tuple(token.name for token in self.tokens)Other public import paths
omnibias.core.proof.ConditionHypothesisomnibias.core.proof.condition.ConditionHypothesis
ConditionSort
omnibias.core.proof.ConditionSortSource ↗ConditionSort = Literal['conservation', 'dfinite', 'edge_colouring', 'extremal_template', 'forbidden_minor', 'fractional_order', 'jet_monomial', 'ore', 'pde_operator', 'piecewise_hybrid', 'residual_sign', 'sos_onset', 'sos_template']This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
ConditionSort = Literal[
"conservation",
"dfinite",
"edge_colouring",
"extremal_template",
"forbidden_minor",
"fractional_order",
"jet_monomial",
"ore",
"pde_operator",
"piecewise_hybrid",
"residual_sign",
"sos_onset",
"sos_template",
]Other public import paths
omnibias.core.proof.ConditionSortomnibias.core.proof.condition.ConditionSort
ConditionSortFactory
omnibias.core.proof.condition.ConditionSortFactorySource ↗ConditionSortFactory = Callable[..., FiniteFamily | None]This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
ConditionSortFactory = Callable[..., FiniteFamily | None]ConditionToken
omnibias.core.proof.ConditionTokenSource ↗class ConditionTokenDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
One typed atom of a condition (a jet monomial, Ore generator, …).
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortdataclass field | ConditionSortRequired | See the operation contract and implementation below. |
namedataclass field | strRequired | See the operation contract and implementation below. |
Executed regression · hypothesis hash and dict
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hypothesis_hash_and_dict() -> None:
left = _jet("y", "yp")
right = _jet("y", "yp")
assert left == right
assert hash(left) == hash(right)
payload = left.as_dict()
assert payload["sort"] == "jet_monomial"
assert payload["pretty"] == "jet_monomial[y, yp]"python -m pytest "packages/omnibias-core/tests/test_condition.py::test_hypothesis_hash_and_dict" -qFields & methods
sortfield
sort: ConditionSortDeclared ConditionSort field on ConditionToken. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗namefield
name: strDeclared str field on ConditionToken. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗as_dictmethod
as_dict(self) -> dict[str, str]See the class contract above and the exact method implementation below.
Returns: dict[str, str]
Executed regression · hypothesis hash and dict
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hypothesis_hash_and_dict() -> None:
left = _jet("y", "yp")
right = _jet("y", "yp")
assert left == right
assert hash(left) == hash(right)
payload = left.as_dict()
assert payload["sort"] == "jet_monomial"
assert payload["pretty"] == "jet_monomial[y, yp]"python -m pytest "packages/omnibias-core/tests/test_condition.py::test_hypothesis_hash_and_dict" -qMethod implementation
def as_dict(self) -> dict[str, str]:
return {"sort": self.sort, "name": self.name}Read the implementation
class ConditionToken:
"""One typed atom of a condition (a jet monomial, Ore generator, …)."""
sort: ConditionSort
name: str
def as_dict(self) -> dict[str, str]:
return {"sort": self.sort, "name": self.name}Other public import paths
omnibias.core.proof.ConditionTokenomnibias.core.proof.condition.ConditionToken
GrammarGrowthFamily
omnibias.core.proof.GrammarGrowthFamilySource ↗class GrammarGrowthFamilyDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
Walk constructor-grown hypotheses. checker is the exact accept gate.
Parameters
| Name | Type & default | Contract |
|---|---|---|
grammardataclass field | GrammarSpecRequired | See the operation contract and implementation below. |
seeddataclass field | ConditionHypothesisRequired | See the operation contract and implementation below. |
checkerdataclass field | Callable[[ConditionHypothesis], ExactCheck | None]Required | See the operation contract and implementation below. |
namedataclass field | strDefault: 'condition_grammar_growth' | See the operation contract and implementation below. |
empty_miss_detaildataclass field | strDefault: 'no witness in enumerated grammar' | See the operation contract and implementation below. |
statementdataclass field | StatementDefault: field(default_factory=lambda: Statement(name='condition_grammar_growth', obligation='a grown hypothesis in this grammar has an exact witness', parent='condition language', parent_status='open')) | See the operation contract and implementation below. |
Fields & methods
grammarfield
grammar: GrammarSpecDeclared GrammarSpec field on GrammarGrowthFamily. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗seedfield
seed: ConditionHypothesisDeclared ConditionHypothesis field on GrammarGrowthFamily. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗checkerfield
checker: Callable[[ConditionHypothesis], ExactCheck | None]Declared Callable[[ConditionHypothesis], ExactCheck | None] field on GrammarGrowthFamily. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗namefield
name: str = 'condition_grammar_growth'Declared str field on GrammarGrowthFamily. Default expression: 'condition_grammar_growth'.
empty_miss_detailfield
empty_miss_detail: str = 'no witness in enumerated grammar'Declared str field on GrammarGrowthFamily. Default expression: 'no witness in enumerated grammar'.
statementfield
statement: Statement = field(default_factory=lambda: Statement(name='condition_grammar_growth', obligation='a grown hypothesis in this grammar has an exact witness', parent='condition language', parent_status='open'))Declared Statement field on GrammarGrowthFamily. Default expression: field(default_factory=lambda: Statement(name='condition_grammar_growth', obligation='a grown hypothesis in this grammar has an exact witness', parent='condition language', parent_status='open')).
completeproperty
complete(self) -> boolSee the class contract above and the exact method implementation below.
Returns: bool
Method implementation
def complete(self) -> bool:
return self.grammar.completecardinalitymethod
cardinality(self) -> int | NoneSee the class contract above and the exact method implementation below.
Returns: int | None
Method implementation
def cardinality(self) -> int | None:
return Noneoriginmethod
origin(self) -> ConditionHypothesisSee the class contract above and the exact method implementation below.
Returns: ConditionHypothesis
Method implementation
def origin(self) -> ConditionHypothesis:
return self.seedneighborsmethod
neighbors(self, candidate: Candidate) -> Sequence[ConditionHypothesis]See the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
candidatepositional-or-keyword | CandidateRequired | See the operation contract and implementation below. |
Returns: Sequence[ConditionHypothesis]
Method implementation
def neighbors(self, candidate: Candidate) -> Sequence[ConditionHypothesis]:
if not isinstance(candidate, ConditionHypothesis):
return ()
return grow_neighbors(candidate, self.grammar)scoremethod
score(self, candidate: Candidate) -> intSee the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
candidatepositional-or-keyword | CandidateRequired | See the operation contract and implementation below. |
Returns: int
Method implementation
def score(self, candidate: Candidate) -> int:
if not isinstance(candidate, ConditionHypothesis):
return 0
return -len(candidate.tokens)checkmethod
check(self, candidate: Candidate) -> ExactCheck | NoneSee the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
candidatepositional-or-keyword | CandidateRequired | See the operation contract and implementation below. |
Returns: ExactCheck | None
Method implementation
def check(self, candidate: Candidate) -> ExactCheck | None:
if not isinstance(candidate, ConditionHypothesis):
return None
return self.checker(candidate)Read the implementation
class GrammarGrowthFamily:
"""Walk constructor-grown hypotheses. ``checker`` is the exact accept gate."""
grammar: GrammarSpec
seed: ConditionHypothesis
checker: Callable[[ConditionHypothesis], ExactCheck | None]
name: str = "condition_grammar_growth"
empty_miss_detail: str = "no witness in enumerated grammar"
statement: Statement = field(
default_factory=lambda: Statement(
name="condition_grammar_growth",
obligation="a grown hypothesis in this grammar has an exact witness",
parent="condition language",
parent_status="open",
)
)
@property
def complete(self) -> bool:
return self.grammar.complete
def cardinality(self) -> int | None:
return None
def origin(self) -> ConditionHypothesis:
return self.seed
def neighbors(self, candidate: Candidate) -> Sequence[ConditionHypothesis]:
if not isinstance(candidate, ConditionHypothesis):
return ()
return grow_neighbors(candidate, self.grammar)
def score(self, candidate: Candidate) -> int:
if not isinstance(candidate, ConditionHypothesis):
return 0
return -len(candidate.tokens)
def check(self, candidate: Candidate) -> ExactCheck | None:
if not isinstance(candidate, ConditionHypothesis):
return None
return self.checker(candidate)Other public import paths
omnibias.core.proof.GrammarGrowthFamilyomnibias.core.proof.condition.GrammarGrowthFamily
GrammarSpec
omnibias.core.proof.GrammarSpecSource ↗class GrammarSpecDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
Finite hypothesis class. complete defaults False (incomplete grammar).
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortsdataclass field | tuple[ConditionSort, ...]Required | See the operation contract and implementation below. |
tokens_by_sortdataclass field | Mapping[ConditionSort, tuple[str, ...]]Required | See the operation contract and implementation below. |
constructorsdataclass field | tuple[str, ...]Default: () | See the operation contract and implementation below. |
max_growth_depthdataclass field | intDefault: 1 | See the operation contract and implementation below. |
completedataclass field | boolDefault: False | See the operation contract and implementation below. |
grammar_iddataclass field | strDefault: 'v1' | See the operation contract and implementation below. |
Regression example · untyped constructor rejected
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_untyped_constructor_rejected() -> None:
grammar = GrammarSpec(
sorts=("jet_monomial",),
tokens_by_sort={"jet_monomial": ("y",)},
constructors=("compose_jets",),
)
assert apply_constructor(_jet("y"), "llm_emit_checker", grammar) is Nonepython -m pytest packages/omnibias-core/tests/test_condition.py -k test_untyped_constructor_rejected -qRegression example · constructor depth cap
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_constructor_depth_cap() -> None:
grammar = GrammarSpec(
sorts=("jet_monomial",),
tokens_by_sort={"jet_monomial": ("y", "yp")},
constructors=("compose_jets",),
max_growth_depth=1,
)
seed = _jet("y", "yp")
grown = apply_constructor(seed, "compose_jets", grammar, left="y", right="yp")
assert grown is not None
assert "y*yp" in grown.token_names()
assert apply_constructor(grown, "compose_jets", grammar, left="y", right="y") is Nonepython -m pytest packages/omnibias-core/tests/test_condition.py -k test_constructor_depth_cap -qFields & methods
sortsfield
sorts: tuple[ConditionSort, ...]Declared tuple[ConditionSort, ...] field on GrammarSpec. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗tokens_by_sortfield
tokens_by_sort: Mapping[ConditionSort, tuple[str, ...]]Declared Mapping[ConditionSort, tuple[str, ...]] field on GrammarSpec. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗constructorsfield
constructors: tuple[str, ...] = ()Declared tuple[str, ...] field on GrammarSpec. Default expression: ().
max_growth_depthfield
max_growth_depth: int = 1Declared int field on GrammarSpec. Default expression: 1.
completefield
complete: bool = FalseDeclared bool field on GrammarSpec. Default expression: False.
grammar_idfield
grammar_id: str = 'v1'Declared str field on GrammarSpec. Default expression: 'v1'.
tokens_formethod
tokens_for(self, sort: ConditionSort) -> tuple[str, ...]See the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortpositional-or-keyword | ConditionSortRequired | See the operation contract and implementation below. |
Returns: tuple[str, ...]
Method implementation
def tokens_for(self, sort: ConditionSort) -> tuple[str, ...]:
return tuple(self.tokens_by_sort.get(sort, ()))Read the implementation
class GrammarSpec:
"""Finite hypothesis class. ``complete`` defaults False (incomplete grammar)."""
sorts: tuple[ConditionSort, ...]
tokens_by_sort: Mapping[ConditionSort, tuple[str, ...]]
constructors: tuple[str, ...] = ()
max_growth_depth: int = 1
complete: bool = False
grammar_id: str = "v1"
def tokens_for(self, sort: ConditionSort) -> tuple[str, ...]:
return tuple(self.tokens_by_sort.get(sort, ()))Other public import paths
omnibias.core.proof.GrammarSpecomnibias.core.proof.condition.GrammarSpec
KindMetaFamily
omnibias.core.proof.KindMetaFamilySource ↗class KindMetaFamilyDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
Candidates are ConditionSort tags. Missing sorts force incomplete grammar.
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortsdataclass field | tuple[ConditionSort, ...]Required | See the operation contract and implementation below. |
familiesdataclass field | Mapping[ConditionSort, FiniteFamily] | NoneDefault: None | See the operation contract and implementation below. |
observationdataclass field | Observation | NoneDefault: None | See the operation contract and implementation below. |
sort_scoresdataclass field | Mapping[str, int] | NoneDefault: None | See the operation contract and implementation below. |
grammar_completedataclass field | boolDefault: False | See the operation contract and implementation below. |
budgetdataclass field | intDefault: 8 | See the operation contract and implementation below. |
namedataclass field | strDefault: 'condition_kind_meta' | See the operation contract and implementation below. |
empty_miss_detaildataclass field | strDefault: 'no witness in enumerated grammar' | See the operation contract and implementation below. |
statementdataclass field | StatementDefault: field(default_factory=lambda: Statement(name='condition_kind_meta', obligation='some registered condition sort has an exact witness in its box', parent='condition language', parent_status='open')) | See the operation contract and implementation below. |
Executed regression · zero budget meta is search incomplete
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_zero_budget_meta_is_search_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial",),
families={"jet_monomial": _AlwaysHit()},
grammar_complete=True,
)
result = run_discovery(meta.statement, meta, "score_guided", budget=0)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.evaluated == 0
finally:
_restore_sorts(saved)python -m pytest "packages/omnibias-core/tests/test_condition.py::test_zero_budget_meta_is_search_incomplete" -qRegression example · kind meta does not prefer jet score
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_kind_meta_does_not_prefer_jet_score() -> None:
saved = _isolated()
try:
meta = KindMetaFamily(
sorts=("sos_template", "jet_monomial"),
families={"sos_template": _AlwaysHit(), "jet_monomial": _AlwaysHit()},
grammar_complete=True,
budget=2,
)
assert meta.score("jet_monomial") == 0
assert meta.score("sos_template") == 0
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.candidate == "sos_template"
finally:
_restore(saved)python -m pytest packages/omnibias-core/tests/test_observe.py -k test_kind_meta_does_not_prefer_jet_score -qFields & methods
sortsfield
sorts: tuple[ConditionSort, ...]Declared tuple[ConditionSort, ...] field on KindMetaFamily. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗familiesfield
families: Mapping[ConditionSort, FiniteFamily] | None = NoneDeclared Mapping[ConditionSort, FiniteFamily] | None field on KindMetaFamily. Default expression: None.
observationfield
observation: Observation | None = NoneDeclared Observation | None field on KindMetaFamily. Default expression: None.
sort_scoresfield
sort_scores: Mapping[str, int] | None = NoneDeclared Mapping[str, int] | None field on KindMetaFamily. Default expression: None.
grammar_completefield
grammar_complete: bool = FalseDeclared bool field on KindMetaFamily. Default expression: False.
Regression example · meta missing sort forces incomplete
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_meta_missing_sort_forces_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial", "ore"),
families={"jet_monomial": _AlwaysMiss()},
grammar_complete=True,
)
assert meta.complete is False
assert meta.grammar_complete is False
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.detail == "search_incomplete"
finally:
_restore_sorts(saved)python -m pytest packages/omnibias-core/tests/test_condition.py -k test_meta_missing_sort_forces_incomplete -qnamefield
name: str = 'condition_kind_meta'Declared str field on KindMetaFamily. Default expression: 'condition_kind_meta'.
empty_miss_detailfield
empty_miss_detail: str = 'no witness in enumerated grammar'Declared str field on KindMetaFamily. Default expression: 'no witness in enumerated grammar'.
statementfield
statement: Statement = field(default_factory=lambda: Statement(name='condition_kind_meta', obligation='some registered condition sort has an exact witness in its box', parent='condition language', parent_status='open'))Declared Statement field on KindMetaFamily. Default expression: field(default_factory=lambda: Statement(name='condition_kind_meta', obligation='some registered condition sort has an exact witness in its box', parent='condition language', parent_status='open')).
Regression example · zero budget meta is search incomplete
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_zero_budget_meta_is_search_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial",),
families={"jet_monomial": _AlwaysHit()},
grammar_complete=True,
)
result = run_discovery(meta.statement, meta, "score_guided", budget=0)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.evaluated == 0
finally:
_restore_sorts(saved)python -m pytest packages/omnibias-core/tests/test_condition.py -k test_zero_budget_meta_is_search_incomplete -qcompletefield
complete: bool = field(init=False)Declared bool field on KindMetaFamily. Default expression: field(init=False).
Regression example · meta missing sort forces incomplete
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_meta_missing_sort_forces_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial", "ore"),
families={"jet_monomial": _AlwaysMiss()},
grammar_complete=True,
)
assert meta.complete is False
assert meta.grammar_complete is False
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.detail == "search_incomplete"
finally:
_restore_sorts(saved)python -m pytest packages/omnibias-core/tests/test_condition.py -k test_meta_missing_sort_forces_incomplete -q__post_init__method
__post_init__(self) -> NoneSee the class contract above and the exact method implementation below.
Returns: None
Executed regression · zero budget meta is search incomplete
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_zero_budget_meta_is_search_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial",),
families={"jet_monomial": _AlwaysHit()},
grammar_complete=True,
)
result = run_discovery(meta.statement, meta, "score_guided", budget=0)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.evaluated == 0
finally:
_restore_sorts(saved)python -m pytest "packages/omnibias-core/tests/test_condition.py::test_zero_budget_meta_is_search_incomplete" -qMethod implementation
def __post_init__(self) -> None:
resolved: dict[ConditionSort, FiniteFamily] = {}
if self.families is not None:
for sort, family in self.families.items():
resolved[sort] = family
else:
resolved.update(bind_sorts(self.observation, self.sorts))
missing = tuple(sort for sort in self.sorts if sort not in resolved)
grammar_complete = bool(self.grammar_complete) and not missing and bool(self.sorts)
object.__setattr__(self, "grammar_complete", grammar_complete)
object.__setattr__(self, "complete", grammar_complete)
object.__setattr__(self, "_resolved", resolved)cardinalitymethod
cardinality(self) -> intSee the class contract above and the exact method implementation below.
Returns: int
Executed regression · zero budget meta is search incomplete
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_zero_budget_meta_is_search_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial",),
families={"jet_monomial": _AlwaysHit()},
grammar_complete=True,
)
result = run_discovery(meta.statement, meta, "score_guided", budget=0)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.evaluated == 0
finally:
_restore_sorts(saved)python -m pytest "packages/omnibias-core/tests/test_condition.py::test_zero_budget_meta_is_search_incomplete" -qMethod implementation
def cardinality(self) -> int:
return len(self.sorts)originmethod
origin(self) -> ConditionSortSee the class contract above and the exact method implementation below.
Returns: ConditionSort
Validation & failure cases
- When
not self.sorts, raisesValueError('KindMetaFamily needs at least one sort').
Executed regression · kind meta does not prefer jet score
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_kind_meta_does_not_prefer_jet_score() -> None:
saved = _isolated()
try:
meta = KindMetaFamily(
sorts=("sos_template", "jet_monomial"),
families={"sos_template": _AlwaysHit(), "jet_monomial": _AlwaysHit()},
grammar_complete=True,
budget=2,
)
assert meta.score("jet_monomial") == 0
assert meta.score("sos_template") == 0
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.candidate == "sos_template"
finally:
_restore(saved)python -m pytest "packages/omnibias-core/tests/test_observe.py::test_kind_meta_does_not_prefer_jet_score" -qMethod implementation
def origin(self) -> ConditionSort:
if not self.sorts:
raise ValueError("KindMetaFamily needs at least one sort")
return self.sorts[0]neighborsmethod
neighbors(self, candidate: Candidate) -> Sequence[ConditionSort]See the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
candidatepositional-or-keyword | CandidateRequired | See the operation contract and implementation below. |
Returns: Sequence[ConditionSort]
Executed regression · meta missing sort forces incomplete
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_meta_missing_sort_forces_incomplete() -> None:
saved = _isolated_sorts()
try:
meta = KindMetaFamily(
sorts=("jet_monomial", "ore"),
families={"jet_monomial": _AlwaysMiss()},
grammar_complete=True,
)
assert meta.complete is False
assert meta.grammar_complete is False
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
assert result.detail == "search_incomplete"
finally:
_restore_sorts(saved)python -m pytest "packages/omnibias-core/tests/test_condition.py::test_meta_missing_sort_forces_incomplete" -qMethod implementation
def neighbors(self, candidate: Candidate) -> Sequence[ConditionSort]:
if not isinstance(candidate, str) or candidate not in self.sorts:
return ()
index = self.sorts.index(candidate)
out: list[ConditionSort] = []
if index > 0:
out.append(self.sorts[index - 1])
if index + 1 < len(self.sorts):
out.append(self.sorts[index + 1])
return outscoremethod
score(self, candidate: Candidate) -> intSee the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
candidatepositional-or-keyword | CandidateRequired | See the operation contract and implementation below. |
Returns: int
Executed regression · kind meta does not prefer jet score
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_kind_meta_does_not_prefer_jet_score() -> None:
saved = _isolated()
try:
meta = KindMetaFamily(
sorts=("sos_template", "jet_monomial"),
families={"sos_template": _AlwaysHit(), "jet_monomial": _AlwaysHit()},
grammar_complete=True,
budget=2,
)
assert meta.score("jet_monomial") == 0
assert meta.score("sos_template") == 0
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.candidate == "sos_template"
finally:
_restore(saved)python -m pytest "packages/omnibias-core/tests/test_observe.py::test_kind_meta_does_not_prefer_jet_score" -qMethod implementation
def score(self, candidate: Candidate) -> int:
if self.sort_scores is None:
return 0
return int(self.sort_scores.get(str(candidate), 0))checkmethod
check(self, candidate: Candidate) -> ExactCheck | NoneSee the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
candidatepositional-or-keyword | CandidateRequired | See the operation contract and implementation below. |
Returns: ExactCheck | None
Executed regression · kind meta does not prefer jet score
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_kind_meta_does_not_prefer_jet_score() -> None:
saved = _isolated()
try:
meta = KindMetaFamily(
sorts=("sos_template", "jet_monomial"),
families={"sos_template": _AlwaysHit(), "jet_monomial": _AlwaysHit()},
grammar_complete=True,
budget=2,
)
assert meta.score("jet_monomial") == 0
assert meta.score("sos_template") == 0
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.candidate == "sos_template"
finally:
_restore(saved)python -m pytest "packages/omnibias-core/tests/test_observe.py::test_kind_meta_does_not_prefer_jet_score" -qMethod implementation
def check(self, candidate: Candidate) -> ExactCheck | None:
if not isinstance(candidate, str) or candidate not in self.sorts:
return None
sort = candidate
family = self._resolved.get(sort)
if family is None:
return ExactCheck(
ok=False,
payload={
"sort": candidate,
"missing": True,
"honesty": condition_honesty(discovered=False),
"grammar_complete": self.grammar_complete,
},
)
result = run_discovery(
family.statement,
family,
"score_guided",
budget=self.budget,
)
ok = result.status == "PROVED"
return ExactCheck(
ok=ok,
payload={
"sort": candidate,
"sub": result.as_dict(),
"grammar_complete": self.grammar_complete,
"honesty": condition_honesty(discovered=ok),
"no_condition_exists_claim": False,
},
)Read the implementation
class KindMetaFamily:
"""Candidates are :data:`ConditionSort` tags. Missing sorts force incomplete grammar."""
sorts: tuple[ConditionSort, ...]
families: Mapping[ConditionSort, FiniteFamily] | None = None
observation: Observation | None = None
sort_scores: Mapping[str, int] | None = None
grammar_complete: bool = False
budget: int = 8
name: str = "condition_kind_meta"
empty_miss_detail: str = "no witness in enumerated grammar"
statement: Statement = field(
default_factory=lambda: Statement(
name="condition_kind_meta",
obligation="some registered condition sort has an exact witness in its box",
parent="condition language",
parent_status="open",
)
)
complete: bool = field(init=False)
_resolved: dict[ConditionSort, FiniteFamily] = field(init=False, repr=False)
def __post_init__(self) -> None:
resolved: dict[ConditionSort, FiniteFamily] = {}
if self.families is not None:
for sort, family in self.families.items():
resolved[sort] = family
else:
resolved.update(bind_sorts(self.observation, self.sorts))
missing = tuple(sort for sort in self.sorts if sort not in resolved)
grammar_complete = bool(self.grammar_complete) and not missing and bool(self.sorts)
object.__setattr__(self, "grammar_complete", grammar_complete)
object.__setattr__(self, "complete", grammar_complete)
object.__setattr__(self, "_resolved", resolved)
def cardinality(self) -> int:
return len(self.sorts)
def origin(self) -> ConditionSort:
if not self.sorts:
raise ValueError("KindMetaFamily needs at least one sort")
return self.sorts[0]
def neighbors(self, candidate: Candidate) -> Sequence[ConditionSort]:
if not isinstance(candidate, str) or candidate not in self.sorts:
return ()
index = self.sorts.index(candidate)
out: list[ConditionSort] = []
if index > 0:
out.append(self.sorts[index - 1])
if index + 1 < len(self.sorts):
out.append(self.sorts[index + 1])
return out
def score(self, candidate: Candidate) -> int:
if self.sort_scores is None:
return 0
return int(self.sort_scores.get(str(candidate), 0))
def check(self, candidate: Candidate) -> ExactCheck | None:
if not isinstance(candidate, str) or candidate not in self.sorts:
return None
sort = candidate
family = self._resolved.get(sort)
if family is None:
return ExactCheck(
ok=False,
payload={
"sort": candidate,
"missing": True,
"honesty": condition_honesty(discovered=False),
"grammar_complete": self.grammar_complete,
},
)
result = run_discovery(
family.statement,
family,
"score_guided",
budget=self.budget,
)
ok = result.status == "PROVED"
return ExactCheck(
ok=ok,
payload={
"sort": candidate,
"sub": result.as_dict(),
"grammar_complete": self.grammar_complete,
"honesty": condition_honesty(discovered=ok),
"no_condition_exists_claim": False,
},
)Other public import paths
omnibias.core.proof.KindMetaFamilyomnibias.core.proof.condition.KindMetaFamily
TYPED_CONSTRUCTORS
omnibias.core.proof.condition.TYPED_CONSTRUCTORSSource ↗TYPED_CONSTRUCTORS: frozenset[str] = frozenset({'add_minor_edge', 'compose_jets', 'multiply_columns', 'raise_ore_degree', 'split_partition'})This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
TYPED_CONSTRUCTORS: frozenset[str] = frozenset(
{
"add_minor_edge",
"compose_jets",
"multiply_columns",
"raise_ore_degree",
"split_partition",
}
)apply_constructor
omnibias.core.proof.apply_constructorSource ↗apply_constructor(hypothesis: ConditionHypothesis, constructor: str, grammar: GrammarSpec, *, left: str | None=None, right: str | None=None) -> ConditionHypothesis | NoneRewrite hypothesis. Returns None if the constructor is illegal.
Parameters
| Name | Type & default | Contract |
|---|---|---|
hypothesispositional-or-keyword | ConditionHypothesisRequired | See the operation contract and implementation below. |
constructorpositional-or-keyword | strRequired | See the operation contract and implementation below. |
grammarpositional-or-keyword | GrammarSpecRequired | See the operation contract and implementation below. |
leftkeyword-only | str | NoneDefault: None | See the operation contract and implementation below. |
rightkeyword-only | str | NoneDefault: None | See the operation contract and implementation below. |
ConditionHypothesis | NoneExecuted regression · untyped constructor rejected
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_untyped_constructor_rejected() -> None:
grammar = GrammarSpec(
sorts=("jet_monomial",),
tokens_by_sort={"jet_monomial": ("y",)},
constructors=("compose_jets",),
)
assert apply_constructor(_jet("y"), "llm_emit_checker", grammar) is Nonepython -m pytest "packages/omnibias-core/tests/test_condition.py::test_untyped_constructor_rejected" -qRegression example · constructor depth cap
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_constructor_depth_cap() -> None:
grammar = GrammarSpec(
sorts=("jet_monomial",),
tokens_by_sort={"jet_monomial": ("y", "yp")},
constructors=("compose_jets",),
max_growth_depth=1,
)
seed = _jet("y", "yp")
grown = apply_constructor(seed, "compose_jets", grammar, left="y", right="yp")
assert grown is not None
assert "y*yp" in grown.token_names()
assert apply_constructor(grown, "compose_jets", grammar, left="y", right="y") is Nonepython -m pytest packages/omnibias-core/tests/test_condition.py -k test_constructor_depth_cap -qRead the implementation
def apply_constructor(
hypothesis: ConditionHypothesis,
constructor: str,
grammar: GrammarSpec,
*,
left: str | None = None,
right: str | None = None,
) -> ConditionHypothesis | None:
"""Rewrite ``hypothesis``. Returns ``None`` if the constructor is illegal."""
if constructor not in TYPED_CONSTRUCTORS:
return None
if constructor not in grammar.constructors:
return None
if len(hypothesis.constructors) >= grammar.max_growth_depth:
return None
names = hypothesis.token_names()
if constructor in {"compose_jets", "multiply_columns"}:
if left is None or right is None:
return None
if left not in names or right not in names:
return None
product = f"{left}*{right}"
if product in names:
return None
token = ConditionToken(hypothesis.sort, product)
return ConditionHypothesis(
sort=hypothesis.sort,
tokens=hypothesis.tokens + (token,),
constructors=hypothesis.constructors + (constructor,),
coefficients=hypothesis.coefficients,
grammar_id=hypothesis.grammar_id,
)
if constructor == "raise_ore_degree":
if hypothesis.sort != "ore" or not hypothesis.coefficients:
return None
order = int(hypothesis.coefficients[0]) + 1
rest = hypothesis.coefficients[1:]
return ConditionHypothesis(
sort="ore",
tokens=hypothesis.tokens,
constructors=hypothesis.constructors + ("raise_ore_degree",),
coefficients=(str(order),) + rest,
grammar_id=hypothesis.grammar_id,
)
if constructor == "split_partition":
if any("@" in token.name for token in hypothesis.tokens):
return None
grown: list[ConditionToken] = []
for token in hypothesis.tokens:
grown.append(ConditionToken(token.sort, f"{token.name}@0"))
grown.append(ConditionToken(token.sort, f"{token.name}@1"))
return ConditionHypothesis(
sort=hypothesis.sort,
tokens=tuple(grown),
constructors=hypothesis.constructors + ("split_partition",),
coefficients=hypothesis.coefficients,
grammar_id=hypothesis.grammar_id,
)
if constructor == "add_minor_edge":
if left is None or right is None or left == right:
return None
lo, hi = (left, right) if left < right else (right, left)
if not _vertex_ok(lo) or not _vertex_ok(hi):
return None
edge = f"e:{lo}-{hi}"
if edge in names:
return None
token = ConditionToken("forbidden_minor", edge)
return ConditionHypothesis(
sort="forbidden_minor",
tokens=hypothesis.tokens + (token,),
constructors=hypothesis.constructors + ("add_minor_edge",),
coefficients=hypothesis.coefficients,
grammar_id=hypothesis.grammar_id,
)
return NoneOther public import paths
omnibias.core.proof.apply_constructoromnibias.core.proof.condition.apply_constructor
bind_sorts
omnibias.core.proof.bind_sortsSource ↗bind_sorts(observation: Observation | None, sorts: Sequence[ConditionSort] | None=None) -> dict[ConditionSort, FiniteFamily]Apply registered factories. None means the sort does not apply.
Parameters
| Name | Type & default | Contract |
|---|---|---|
observationpositional-or-keyword | Observation | NoneRequired | See the operation contract and implementation below. |
sortspositional-or-keyword | Sequence[ConditionSort] | NoneDefault: None | See the operation contract and implementation below. |
dict[ConditionSort, FiniteFamily]Regression example · poly only observation binds only sos
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_poly_only_observation_binds_only_sos() -> None:
obs = observation_planted_sos()
bound = bind_sorts(obs)
assert set(bound) == {"sos_template"}
family = bind_sos_template(obs)
assert family is not None
result = run_discovery(family.statement, family, "score_guided", budget=4)
assert result.status == "PROVED"
assert bind_sos_template(Observation(tag="tanh")) is None
assert bind_sos_onset(obs) is Nonepython -m pytest packages/omnibias-sos/tests/test_conditions.py -k test_poly_only_observation_binds_only_sos -qRegression example · binder none drops sort and forces incomplete
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_binder_none_drops_sort_and_forces_incomplete() -> None:
saved = _isolated()
try:
def _bind_ore(obs: Observation | None) -> object | None:
if obs is None:
return _AlwaysHit()
return None
from omnibias.core.proof.condition import register_condition_sort
register_condition_sort("ore", _bind_ore)
obs = Observation(tag="tanh", jet_names=("y",), jet_rows=(("1",),))
assert bind_sorts(obs, ("ore",)) == {}
meta = KindMetaFamily(
sorts=("ore",),
observation=obs,
grammar_complete=True,
)
assert meta.complete is False
result = run_discovery(meta.statement, meta, "score_guided", budget=4)
assert result.status == "BLOCKED"
assert result.search_incomplete is True
finally:
_restore(saved)python -m pytest packages/omnibias-core/tests/test_observe.py -k test_binder_none_drops_sort_and_forces_incomplete -qRead the implementation
def bind_sorts(
observation: Observation | None,
sorts: Sequence[ConditionSort] | None = None,
) -> dict[ConditionSort, FiniteFamily]:
"""Apply registered factories. ``None`` means the sort does not apply."""
wanted: tuple[ConditionSort, ...]
if sorts is not None:
wanted = tuple(sorts)
else:
registered = list_condition_sorts()
wanted = registered if registered else ALL_CONDITION_SORTS
out: dict[ConditionSort, FiniteFamily] = {}
for sort in wanted:
factory = _SORT_FACTORIES.get(sort)
if factory is None:
continue
family = _invoke_factory(factory, observation)
if family is not None:
out[sort] = family
return outOther public import paths
omnibias.core.proof.bind_sortsomnibias.core.proof.condition.bind_sorts
condition_honesty
omnibias.core.proof.condition_honestySource ↗condition_honesty(*, discovered: bool) -> dict[str, bool]Honesty keys for a condition-language check. Forbidden claims stay False.
Parameters
| Name | Type & default | Contract |
|---|---|---|
discoveredkeyword-only | boolRequired | See the operation contract and implementation below. |
dict[str, bool]Executed regression · honesty keys never claim no condition
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_honesty_keys_never_claim_no_condition() -> None:
honesty = condition_honesty(discovered=True)
assert honesty["discovered_by_omnibias"] is True
assert honesty["no_condition_exists_claim"] is False
assert honesty["unnamed_condition_complete_claim"] is Falsepython -m pytest "packages/omnibias-core/tests/test_condition.py::test_honesty_keys_never_claim_no_condition" -qRead the implementation
def condition_honesty(*, discovered: bool) -> dict[str, bool]:
"""Honesty keys for a condition-language check. Forbidden claims stay False."""
return {
"discovered_by_omnibias": discovered,
"dgg_congestion_theorem_refuted": False,
"erdos_146_claim": False,
"erdos_180_claim": False,
"erdos_183_claim": False,
"jacobian_n2_claim": False,
"no_condition_exists_claim": False,
"ten_proofs_formalization_claim": False,
"unnamed_condition_complete_claim": False,
}Other public import paths
omnibias.core.proof.condition_honestyomnibias.core.proof.condition.condition_honesty
condition_sort_factory
omnibias.core.proof.condition.condition_sort_factorySource ↗condition_sort_factory(sort: ConditionSort) -> ConditionSortFactory | NoneThe module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortpositional-or-keyword | ConditionSortRequired | See the operation contract and implementation below. |
ConditionSortFactory | NoneRead the implementation
def condition_sort_factory(sort: ConditionSort) -> ConditionSortFactory | None:
return _SORT_FACTORIES.get(sort)emit_condition
omnibias.core.proof.emit_conditionSource ↗emit_condition(hypothesis: ConditionHypothesis, *, parent: str, parent_status: Literal['already_false', 'already_true', 'open']='open', existential: bool=True, obligation: str | None=None) -> StatementTurn a proposed condition into a Statement the engine can adjudicate.
Parameters
| Name | Type & default | Contract |
|---|---|---|
hypothesispositional-or-keyword | ConditionHypothesisRequired | See the operation contract and implementation below. |
parentkeyword-only | strRequired | See the operation contract and implementation below. |
parent_statuskeyword-only | Literal['already_false', 'already_true', 'open']Default: 'open' | See the operation contract and implementation below. |
existentialkeyword-only | boolDefault: True | See the operation contract and implementation below. |
obligationkeyword-only | str | NoneDefault: None | See the operation contract and implementation below. |
StatementExecuted regression · emit condition statement
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_emit_condition_statement() -> None:
statement = emit_condition(_jet("yp"), parent="Riccati identities", parent_status="already_true")
assert statement.name == "condition_jet_monomial"
assert "yp" in statement.obligation
assert statement.parent_status == "already_true"python -m pytest "packages/omnibias-core/tests/test_condition.py::test_emit_condition_statement" -qRead the implementation
def emit_condition(
hypothesis: ConditionHypothesis,
*,
parent: str,
parent_status: Literal["already_false", "already_true", "open"] = "open",
existential: bool = True,
obligation: str | None = None,
) -> Statement:
"""Turn a proposed condition into a :class:`Statement` the engine can adjudicate."""
return Statement(
name=f"condition_{hypothesis.sort}",
obligation=obligation or f"the hypothesis {hypothesis.pretty()} holds in its grammar",
parent=parent,
parent_status=parent_status,
existential=existential,
)Other public import paths
omnibias.core.proof.emit_conditionomnibias.core.proof.condition.emit_condition
grow_neighbors
omnibias.core.proof.grow_neighborsSource ↗grow_neighbors(hypothesis: ConditionHypothesis, grammar: GrammarSpec) -> tuple[ConditionHypothesis, ...]All one-step typed growths of hypothesis inside grammar.
Parameters
| Name | Type & default | Contract |
|---|---|---|
hypothesispositional-or-keyword | ConditionHypothesisRequired | See the operation contract and implementation below. |
grammarpositional-or-keyword | GrammarSpecRequired | See the operation contract and implementation below. |
tuple[ConditionHypothesis, ...]Read the implementation
def grow_neighbors(
hypothesis: ConditionHypothesis,
grammar: GrammarSpec,
) -> tuple[ConditionHypothesis, ...]:
"""All one-step typed growths of ``hypothesis`` inside ``grammar``."""
seen: set[ConditionHypothesis] = set()
out: list[ConditionHypothesis] = []
names = hypothesis.token_names()
product_ctor = (
"compose_jets"
if "compose_jets" in grammar.constructors
else "multiply_columns"
if "multiply_columns" in grammar.constructors
else None
)
if product_ctor is not None:
for i, left in enumerate(names):
for right in names[i:]:
grown = apply_constructor(
hypothesis, product_ctor, grammar, left=left, right=right
)
if grown is not None and grown not in seen:
seen.add(grown)
out.append(grown)
if "raise_ore_degree" in grammar.constructors:
grown = apply_constructor(hypothesis, "raise_ore_degree", grammar)
if grown is not None and grown not in seen:
seen.add(grown)
out.append(grown)
if "split_partition" in grammar.constructors:
grown = apply_constructor(hypothesis, "split_partition", grammar)
if grown is not None and grown not in seen:
seen.add(grown)
out.append(grown)
if "add_minor_edge" in grammar.constructors:
verts = [str(i) for i in range(5)]
for i, left in enumerate(verts):
for right in verts[i + 1 :]:
grown = apply_constructor(
hypothesis, "add_minor_edge", grammar, left=left, right=right
)
if grown is not None and grown not in seen:
seen.add(grown)
out.append(grown)
return tuple(out)Other public import paths
omnibias.core.proof.grow_neighborsomnibias.core.proof.condition.grow_neighbors
list_condition_sorts
omnibias.core.proof.list_condition_sortsSource ↗list_condition_sorts() -> tuple[ConditionSort, ...]The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
tuple[ConditionSort, ...]Executed regression · poly only observation binds only sos
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_poly_only_observation_binds_only_sos() -> None:
obs = observation_planted_sos()
bound = bind_sorts(obs)
assert set(bound) == {"sos_template"}
family = bind_sos_template(obs)
assert family is not None
result = run_discovery(family.statement, family, "score_guided", budget=4)
assert result.status == "PROVED"
assert bind_sos_template(Observation(tag="tanh")) is None
assert bind_sos_onset(obs) is Nonepython -m pytest "packages/omnibias-sos/tests/test_conditions.py::test_poly_only_observation_binds_only_sos" -qRead the implementation
def list_condition_sorts() -> tuple[ConditionSort, ...]:
return tuple(sorted(_SORT_FACTORIES, key=str))Other public import paths
omnibias.core.proof.list_condition_sortsomnibias.core.proof.condition.list_condition_sorts
register_condition_sort
omnibias.core.proof.register_condition_sortSource ↗register_condition_sort(sort: ConditionSort, factory: ConditionSortFactory) -> NoneRegister a package factory that builds a FiniteFamily for sort.
Parameters
| Name | Type & default | Contract |
|---|---|---|
sortpositional-or-keyword | ConditionSortRequired | See the operation contract and implementation below. |
factorypositional-or-keyword | ConditionSortFactoryRequired | See the operation contract and implementation below. |
NoneExplicit validation & failure cases
- When
existing is not None and existing is not factory, raisesValueError(f'condition sort collision: {sort!r} already registered').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · zero budget select class is incomplete
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_zero_budget_select_class_is_incomplete() -> None:
saved = _isolated()
try:
from omnibias.core.proof.condition import register_condition_sort
register_condition_sort("jet_monomial", lambda obs: _AlwaysHit())
obs = Observation(tag="tanh", jet_names=("y",), jet_rows=(("1",),))
selection = select_class(obs, sorts=("jet_monomial",), budget=0)
assert selection.result is not None
assert selection.result.status == "BLOCKED"
assert selection.result.search_incomplete is True
assert selection.result.evaluated == 0
assert selection.honesty["no_condition_exists_claim"] is False
finally:
_restore(saved)python -m pytest "packages/omnibias-core/tests/test_observe.py::test_zero_budget_select_class_is_incomplete" -qRegression example · select class miss is search incomplete
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_select_class_miss_is_search_incomplete() -> None:
saved = _isolated()
try:
from omnibias.core.proof.condition import register_condition_sort
register_condition_sort("jet_monomial", lambda obs: _AlwaysMiss())
obs = Observation(tag="tanh", jet_names=("y",), jet_rows=(("1",),))
selection = select_class(obs, sorts=("jet_monomial",))
assert selection.best is None
assert selection.search_incomplete is True
assert selection.grammar_complete is False
assert selection.honesty["no_condition_exists_claim"] is False
assert selection.honesty["unnamed_condition_complete_claim"] is False
assert selection.result is not None
assert selection.result.detail == "search_incomplete"
finally:
_restore(saved)python -m pytest packages/omnibias-core/tests/test_observe.py -k test_select_class_miss_is_search_incomplete -qRead the implementation
def register_condition_sort(sort: ConditionSort, factory: ConditionSortFactory) -> None:
"""Register a package factory that builds a :class:`FiniteFamily` for ``sort``."""
existing = _SORT_FACTORIES.get(sort)
if existing is not None and existing is not factory:
raise ValueError(f"condition sort collision: {sort!r} already registered")
_SORT_FACTORIES[sort] = factoryOther public import paths
omnibias.core.proof.register_condition_sortomnibias.core.proof.condition.register_condition_sort
select_class
omnibias.core.proof.select_classSource ↗select_class(observation: Observation, *, collect: bool=True, memory: ClassMemory | None=None, gate: Any | None=None, grammar_complete: bool=False, sorts: Sequence[ConditionSort] | None=None, budget: int | None=None, inner_budget: int | None=None, grow: bool=True, max_growth_depth: int=1) -> ClassSelectionBind, optionally reorder, collect certified hits, and rank.
grammar_complete is accepted and ignored — this driver never marks a
grammar complete. Soft RMSE never writes ExactCheck. On an exact
miss, grow=True applies one legal constructor step (still incomplete).
Parameters
| Name | Type & default | Contract |
|---|---|---|
observationpositional-or-keyword | ObservationRequired | See the operation contract and implementation below. |
collectkeyword-only | boolDefault: True | See the operation contract and implementation below. |
memorykeyword-only | ClassMemory | NoneDefault: None | See the operation contract and implementation below. |
gatekeyword-only | Any | NoneDefault: None | See the operation contract and implementation below. |
grammar_completekeyword-only | boolDefault: False | See the operation contract and implementation below. |
sortskeyword-only | Sequence[ConditionSort] | NoneDefault: None | See the operation contract and implementation below. |
budgetkeyword-only | int | NoneDefault: None | See the operation contract and implementation below. |
inner_budgetkeyword-only | int | NoneDefault: None | See the operation contract and implementation below. |
growkeyword-only | boolDefault: True | See the operation contract and implementation below. |
max_growth_depthkeyword-only | intDefault: 1 | See the operation contract and implementation below. |
ClassSelectionExecuted regression · zero budget select class is incomplete
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_zero_budget_select_class_is_incomplete() -> None:
saved = _isolated()
try:
from omnibias.core.proof.condition import register_condition_sort
register_condition_sort("jet_monomial", lambda obs: _AlwaysHit())
obs = Observation(tag="tanh", jet_names=("y",), jet_rows=(("1",),))
selection = select_class(obs, sorts=("jet_monomial",), budget=0)
assert selection.result is not None
assert selection.result.status == "BLOCKED"
assert selection.result.search_incomplete is True
assert selection.result.evaluated == 0
assert selection.honesty["no_condition_exists_claim"] is False
finally:
_restore(saved)python -m pytest "packages/omnibias-core/tests/test_observe.py::test_zero_budget_select_class_is_incomplete" -qRegression example · select class miss is search incomplete
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_select_class_miss_is_search_incomplete() -> None:
saved = _isolated()
try:
from omnibias.core.proof.condition import register_condition_sort
register_condition_sort("jet_monomial", lambda obs: _AlwaysMiss())
obs = Observation(tag="tanh", jet_names=("y",), jet_rows=(("1",),))
selection = select_class(obs, sorts=("jet_monomial",))
assert selection.best is None
assert selection.search_incomplete is True
assert selection.grammar_complete is False
assert selection.honesty["no_condition_exists_claim"] is False
assert selection.honesty["unnamed_condition_complete_claim"] is False
assert selection.result is not None
assert selection.result.detail == "search_incomplete"
finally:
_restore(saved)python -m pytest packages/omnibias-core/tests/test_observe.py -k test_select_class_miss_is_search_incomplete -qRead the implementation
def select_class(
observation: Observation,
*,
collect: bool = True,
memory: ClassMemory | None = None,
gate: Any | None = None,
grammar_complete: bool = False,
sorts: Sequence[ConditionSort] | None = None,
budget: int | None = None,
inner_budget: int | None = None,
grow: bool = True,
max_growth_depth: int = 1,
) -> ClassSelection:
"""Bind, optionally reorder, collect certified hits, and rank.
``grammar_complete`` is accepted and ignored — this driver never marks a
grammar complete. Soft RMSE never writes :class:`ExactCheck`. On an exact
miss, ``grow=True`` applies one legal constructor step (still incomplete).
"""
_ = grammar_complete
if sorts is not None:
requested = tuple(sorts)
else:
registered = list_condition_sorts()
requested = registered if registered else ALL_CONDITION_SORTS
if gate is not None:
proposed = tuple(str(item) for item in gate.propose(observation))
order = [sort for sort in proposed if sort in requested]
for sort in requested:
if sort not in order:
order.append(sort)
ordered = cast(tuple[ConditionSort, ...], tuple(order))
sort_scores = {str(sort): len(ordered) - index for index, sort in enumerate(ordered)}
else:
ordered = requested
sort_scores = None
n_sorts = len(ordered)
if budget is None:
outer = n_sorts
else:
outer = budget
inner = 32 if inner_budget is None else inner_budget
meta = KindMetaFamily(
sorts=ordered,
observation=observation,
sort_scores=sort_scores,
grammar_complete=False,
budget=inner,
)
result = run_discovery(
meta.statement,
meta,
"score_guided",
budget=outer,
collect=collect,
)
hits: list[ClassHit] = []
for candidate in result.solutions:
checked: ExactCheck | None
if candidate == result.candidate and result.check is not None:
checked = result.check
else:
checked = meta.check(candidate)
if checked is None or not checked.ok:
continue
unique = False
if result.characterization is not None and len(result.solutions) == 1:
unique = result.characterization.unique_in_family
hits.append(class_hit_from_check(str(candidate), checked, unique_in_family=unique))
if grow and outer > 0 and not any(hit.tier == "exact" for hit in hits):
hits.extend(
_grow_miss_hits(meta._resolved, max_growth_depth=max_growth_depth)
)
ranked = rank_class_hits(hits)
best = ranked[0] if ranked else None
if memory is not None and best is not None and best.tier == "exact":
memory.record(observation, best.sort)
discovered = best is not None and best.tier in {"exact", "enclosure"}
return ClassSelection(
observation=observation,
hits=tuple(ranked),
best=best,
honesty=condition_honesty(discovered=discovered),
search_incomplete=result.search_incomplete or not meta.complete,
grammar_complete=False,
result=result,
)Other public import paths
omnibias.core.proof.select_classomnibias.core.proof.condition.select_class