biobalm.symbolic_utils#

Utility operations for creating and manipulating symbolic functions.

Functions#

state_to_bdd(→ biodivine_aeon.Bdd)

Convert a BooleanSpace to a BDD encoding the state singleton.

state_list_to_bdd(→ biodivine_aeon.Bdd)

Convert a list of state dictionaries to a BDD representation.

function_eval(→ Literal[0, 1] | None)

Evaluate a BDD Boolean function in the given state.

function_is_true(→ bool)

True if the BDD function evaluates to 1 for the given state (or space).

valuation_to_state(→ biobalm.types.BooleanSpace)

Extract network state from a BddValuation into a BooleanSpace.

Module Contents#

biobalm.symbolic_utils.state_to_bdd(bdd_context: biodivine_aeon.SymbolicContext | biodivine_aeon.BddVariableSet, state: biobalm.types.BooleanSpace) biodivine_aeon.Bdd[source]#

Convert a BooleanSpace to a BDD encoding the state singleton.

Parameters:
  • bdd_context (SymbolicContext | BddVariableSet) – The BDD context in which the state is represented. This is a a biodivine_aeon.BddVariableSet or biodivine_aeon.SymbolicContext (which is automatically converted to biodivine_aeon.BddVariableSet). The context object ensures compatibility between BDDs by maintaining a shared collection of variable names and their ordering.

  • state (BooleanSpace) – The state to convert to a BDD.

Returns:

The BDD encoding the given state.

Return type:

Bdd

biobalm.symbolic_utils.state_list_to_bdd(bdd_context: biodivine_aeon.SymbolicContext | biodivine_aeon.BddVariableSet, states: list[biobalm.types.BooleanSpace]) biodivine_aeon.Bdd[source]#

Convert a list of state dictionaries to a BDD representation.

The BDD will be satisfied in any state in the list and in no others.

Parameters:
  • bdd_context (SymbolicContext | BddVariableSet) – The BDD context in which the state is represented. This is a a biodivine_aeon.BddVariableSet or biodivine_aeon.SymbolicContext (which is automatically converted to biodivine_aeon.BddVariableSet). The context object ensures compatibility between BDDs by maintaining a shared collection of variable names and their ordering.

  • states (list[BooleanSpace]) – The list of states to convert to a BDD.

Returns:

The BDD encoding the given list of states.

Return type:

Bdd

biobalm.symbolic_utils.function_eval(f: biodivine_aeon.Bdd, state: biobalm.types.BooleanSpace) Literal[0, 1] | None[source]#

Evaluate a BDD Boolean function in the given state.

If the state is incomplete (i.e. it is a space), the function value can be undetermined. In such case, None is returned.

Parameters:
  • f (Bdd) – The function to evaluate.

  • state (BooleanSpace) – The state in which the function is evaluated.

Returns:

The function value in the given state, or None if the function is undetermined.

Return type:

Literal[0, 1] | None

biobalm.symbolic_utils.function_is_true(f: biodivine_aeon.Bdd, state: biobalm.types.BooleanSpace) bool[source]#

True if the BDD function evaluates to 1 for the given state (or space).

Parameters:
  • f (Bdd) – The function to evaluate.

  • state (BooleanSpace) – The state in which the function is evaluated.

Returns:

True if the function evaluates to 1 in the given state.

Return type:

bool

biobalm.symbolic_utils.valuation_to_state(ctx: biodivine_aeon.SymbolicContext, valuation: biodivine_aeon.BddValuation) biobalm.types.BooleanSpace[source]#

Extract network state from a BddValuation into a BooleanSpace.

Parameters:
  • f (SymbolicContext) – A context which maps between network variables and their symbolic counterparts.

  • state (BddValuation) – A valuation of the network’s symbolic encoding.

Returns:

A BooleanSpace encoding the state data from the given valuation.

Return type:

BooleanSpace