Skip to main content

omnibias.boolean.inequality

0.1.0a2AlphaPython >=3.10Apache-2.0

Boolean truth tables, multilinear extensions, algebraic spectra, and finite-temperature gate systems.

import omnibias.boolean.inequality
Module contract & mathematical conventions

Boolean inequality adapter (theory 09-30).

Exact solve_system on a finite cube. Propose is skipped. budget == 0 is search_incomplete.

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.

CLASS

BooleanInequalityBackend​

omnibias.boolean.BooleanInequalityBackendSource ↗
class BooleanInequalityBackend

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Executed regression · boolean three verdicts

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_boolean_three_verdicts() -> None:
    register_inequality_backend(BooleanInequalityBackend())
    proved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]]},
    )
    disproved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[1, 1]]},
    )
    blocked = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]], "budget": 0},
    )
    assert run_inequality_pipeline(proved)[0] == "PROVED"
    assert run_inequality_pipeline(disproved)[0] == "DISPROVED"
    assert run_inequality_pipeline(blocked)[0] == "BLOCKED"
python -m pytest "packages/omnibias-boolean/tests/test_inequality_adapter.py::test_boolean_three_verdicts" -q

Fields & methods

sortfield
sort: ClassVar[InequalitySort] = 'boolean'

Declared ClassVar[InequalitySort] field on BooleanInequalityBackend. Default expression: 'boolean'.

View source ↗
proposemethod
propose(self, system: InequalitySystem) -> Proposal

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
systempositional-or-keywordInequalitySystemRequiredSee the operation contract and implementation below.

Returns: Proposal

Executed regression · boolean three verdicts

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_boolean_three_verdicts() -> None:
    register_inequality_backend(BooleanInequalityBackend())
    proved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]]},
    )
    disproved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[1, 1]]},
    )
    blocked = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]], "budget": 0},
    )
    assert run_inequality_pipeline(proved)[0] == "PROVED"
    assert run_inequality_pipeline(disproved)[0] == "DISPROVED"
    assert run_inequality_pipeline(blocked)[0] == "BLOCKED"
python -m pytest "packages/omnibias-boolean/tests/test_inequality_adapter.py::test_boolean_three_verdicts" -q
Method implementation
    def propose(self, system: InequalitySystem) -> Proposal:
        return Proposal(method="exact_skip", skipped=True)
View source ↗
rationalizemethod
rationalize(self, system: InequalitySystem, proposal: Proposal) -> RationalWitness

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
systempositional-or-keywordInequalitySystemRequiredSee the operation contract and implementation below.
proposalpositional-or-keywordProposalRequiredSee the operation contract and implementation below.

Returns: RationalWitness

Executed regression · boolean three verdicts

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_boolean_three_verdicts() -> None:
    register_inequality_backend(BooleanInequalityBackend())
    proved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]]},
    )
    disproved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[1, 1]]},
    )
    blocked = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]], "budget": 0},
    )
    assert run_inequality_pipeline(proved)[0] == "PROVED"
    assert run_inequality_pipeline(disproved)[0] == "DISPROVED"
    assert run_inequality_pipeline(blocked)[0] == "BLOCKED"
python -m pytest "packages/omnibias-boolean/tests/test_inequality_adapter.py::test_boolean_three_verdicts" -q
Method implementation
    def rationalize(
        self, system: InequalitySystem, proposal: Proposal
    ) -> RationalWitness:
        return RationalWitness(method="none")
View source ↗
checkmethod
check(self, system: InequalitySystem, witness: RationalWitness) -> ExactCheck

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
systempositional-or-keywordInequalitySystemRequiredSee the operation contract and implementation below.
witnesspositional-or-keywordRationalWitnessRequiredSee the operation contract and implementation below.

Returns: ExactCheck

Executed regression · boolean three verdicts

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_boolean_three_verdicts() -> None:
    register_inequality_backend(BooleanInequalityBackend())
    proved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]]},
    )
    disproved = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[1, 1]]},
    )
    blocked = InequalitySystem(
        sort="boolean",
        existential=True,
        data={"tables": [[0, 0, 0, 1]], "budget": 0},
    )
    assert run_inequality_pipeline(proved)[0] == "PROVED"
    assert run_inequality_pipeline(disproved)[0] == "DISPROVED"
    assert run_inequality_pipeline(blocked)[0] == "BLOCKED"
python -m pytest "packages/omnibias-boolean/tests/test_inequality_adapter.py::test_boolean_three_verdicts" -q
Method implementation
    def check(
        self, system: InequalitySystem, witness: RationalWitness
    ) -> ExactCheck:
        if int(system.data.get("budget", 1)) == 0:
            return ExactCheck(
                ok=False,
                payload={
                    "role": "inconclusive",
                    "method": "search_incomplete",
                    "honesty": {
                        "complete_solver": False,
                    },
                    "detail": "search_incomplete",
                },
            )
        tables = _tables(system.data.get("tables", ()))
        if not tables:
            return ExactCheck(
                ok=False,
                payload={
                    "role": "inconclusive",
                    "method": "empty_system",
                    "honesty": {"complete_solver": False},
                    "detail": "no_tables",
                },
            )
        solution = solve_system(tables)
        honesty = {
            "complete_solver": True,
            "unsat_proof": not solution.consistent,
        }
        if solution.consistent:
            sols = solution.enumerate_solutions()
            return ExactCheck(
                ok=True,
                payload={
                    "role": "witness",
                    "method": "solve_system",
                    "honesty": honesty,
                    "detail": "boolean_sat",
                    "n_solutions": len(sols),
                },
            )
        return ExactCheck(
            ok=False,
            payload={
                "role": "empty",
                "method": "solve_system",
                "honesty": honesty,
                "detail": "boolean_unsat",
                "complete": True,
            },
        )
View source ↗
Read the implementation
class BooleanInequalityBackend:
    sort: ClassVar[InequalitySort] = "boolean"

    def propose(self, system: InequalitySystem) -> Proposal:
        return Proposal(method="exact_skip", skipped=True)

    def rationalize(
        self, system: InequalitySystem, proposal: Proposal
    ) -> RationalWitness:
        return RationalWitness(method="none")

    def check(
        self, system: InequalitySystem, witness: RationalWitness
    ) -> ExactCheck:
        if int(system.data.get("budget", 1)) == 0:
            return ExactCheck(
                ok=False,
                payload={
                    "role": "inconclusive",
                    "method": "search_incomplete",
                    "honesty": {
                        "complete_solver": False,
                    },
                    "detail": "search_incomplete",
                },
            )
        tables = _tables(system.data.get("tables", ()))
        if not tables:
            return ExactCheck(
                ok=False,
                payload={
                    "role": "inconclusive",
                    "method": "empty_system",
                    "honesty": {"complete_solver": False},
                    "detail": "no_tables",
                },
            )
        solution = solve_system(tables)
        honesty = {
            "complete_solver": True,
            "unsat_proof": not solution.consistent,
        }
        if solution.consistent:
            sols = solution.enumerate_solutions()
            return ExactCheck(
                ok=True,
                payload={
                    "role": "witness",
                    "method": "solve_system",
                    "honesty": honesty,
                    "detail": "boolean_sat",
                    "n_solutions": len(sols),
                },
            )
        return ExactCheck(
            ok=False,
            payload={
                "role": "empty",
                "method": "solve_system",
                "honesty": honesty,
                "detail": "boolean_unsat",
                "complete": True,
            },
        )
Other public import paths
  • omnibias.boolean.BooleanInequalityBackend
  • omnibias.boolean.inequality.BooleanInequalityBackend