pub enum FnUpdate {
    Const(bool),
    Var(VariableId),
    Param(ParameterIdVec<VariableId>),
    Not(Box<FnUpdate>),
    Binary(BinaryOpBox<FnUpdate>, Box<FnUpdate>),
}
Expand description

A Boolean update function formula which references Variables and Parameters of a BooleanNetwork.

An update function specifies the evolution rules for one specific Variable of a BooleanNetwork. The arguments used in the function must be the same as specified by the RegulatoryGraph of the network.

Variants

Const(bool)

A true/false constant.

Var(VariableId)

References a network variable.

Param(ParameterIdVec<VariableId>)

References a network parameter (uninterpreted function).

The variable list are the arguments of the function invocation.

Not(Box<FnUpdate>)

Negation.

Binary(BinaryOpBox<FnUpdate>, Box<FnUpdate>)

Binary boolean operation.

Implementations

(internal) Evaluate this FnUpdate into symbolic BddParams that represent all parameter valuations for which this function evaluates to true.

Convert a BooleanExpression to a FnUpdate, using RegulatoryGraph to resolve variable names.

Constructor and destructor utility methods. These mainly avoid unnecessary boxing and exhaustive pattern matching when not necessary.

Create a true formula.

Create a false formula.

Create an x formula where x is a Boolean variable.

Create a p(x_1, ..., x_k) formula where p is a parameter function and x_1 through x_k are its arguments.

Create a !phi formula, where phi is an inner FnUpdate.

Create a phi 'op' psi where phi and psi are arguments of op operator.

Negate this function.

Create a conjunction.

Create a disjunction.

Create an exclusive or.

Create an implication.

Create an equivalence.

If Const, return the value, otherwise return None.

If Var, return the id, otherwise return None.

If Param, return the id and args, otherwise return None.

If Not, return the inner function, otherwise return None.

If Binary, return the operator and left/right formulas, otherwise return None.

Other utility methods.

Return a sorted vector of all variables that are actually used as inputs in this function.

Return a sorted vector of all parameters (i.e. uninterpreted functions) that are used in this update function.

Convert this update function to a string, taking names from the provided BooleanNetwork.

If possible, evaluate this function using the given network variable valuation.

Note that this only works when the function output does not depend on parameters, and all necessary variable values are part of the valuation. Otherwise, the function returns None, as the value cannot be determined.

However, note that in some cases, even a partially specified function can be evaluated. For example, A & f(X, Y) is false whenever A = false, regardless of uninterpreted function f. In such cases, this method may still output the correct result.

In other words, the meaning of this method should be interpreted as “if it is possible to unambiguously evaluate this function using the provided valuation, do it; otherwise return None”.

Test that this update function is a syntactic specialisation of the provided FnUpdate.

Syntactic specialisation is a function that has the same abstract syntax tree, except that some occurrences of parameters can be substituted for more concrete Boolean functions.

Note that this is not entirely bulletproof, as it does not check for usage of multiple parameters within the same function, which could influence the semantics of the main function, but does not influence the specialisation.

Allows us to iterate through all nodes of the abstract syntax tree of this function in post-order.

Note that this is a preliminary version of the API. A more robust implementation should provide a standard iterator interface.

Create a copy of this function which replaces every occurrence of every VariableId with a new one supplied by the provided vector (original VariableId is the index into the vector). Similarly replaces every ParameterId.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.