Struct biodivine_sketchbook::algorithms::fo_logic::fol_tree::FolTreeNode
source · pub struct FolTreeNode {
pub formula_str: String,
pub height: u32,
pub node_type: NodeType,
}
Expand description
A single node in a syntax tree of a FOL formula.
Each node tracks its:
- height
; A positive integer starting from 0 (for term nodes).
- node_type
; A collection of node data represented through NodeType
.
- subform_str
; A canonical string representation of the FOL formula, which is
used for uniqueness testing during simplification and canonization.
Fields§
§formula_str: String
§height: u32
§node_type: NodeType
Implementations§
source§impl FolTreeNode
impl FolTreeNode
sourcepub fn from_tokens(tokens: &[FolToken]) -> Result<FolTreeNode, String>
pub fn from_tokens(tokens: &[FolToken]) -> Result<FolTreeNode, String>
“Parse” a new FolTreeNode from a list of FolToken objects.
Note that this is a very “low-level” function. Unless you know what you are doing, you should probably use some of the functions in crate::algorithms::fo_logic::parser instead.
sourcepub fn mk_quantifier(
child: FolTreeNode,
var: &str,
op: Quantifier,
) -> FolTreeNode
pub fn mk_quantifier( child: FolTreeNode, var: &str, op: Quantifier, ) -> FolTreeNode
Create a “quantifier” FolTreeNode from the given arguments.
See also NodeType::Quantifier.
sourcepub fn mk_unary(child: FolTreeNode, op: UnaryOp) -> FolTreeNode
pub fn mk_unary(child: FolTreeNode, op: UnaryOp) -> FolTreeNode
Create a “unary” FolTreeNode from the given arguments.
See also NodeType::Unary.
sourcepub fn mk_binary(
left: FolTreeNode,
right: FolTreeNode,
op: BinaryOp,
) -> FolTreeNode
pub fn mk_binary( left: FolTreeNode, right: FolTreeNode, op: BinaryOp, ) -> FolTreeNode
Create a “binary” FolTreeNode from the given arguments.
See also NodeType::Binary.
sourcepub fn mk_constant(constant_val: bool) -> FolTreeNode
pub fn mk_constant(constant_val: bool) -> FolTreeNode
Create a FolTreeNode representing a Boolean constant.
See also NodeType::Terminal and Atom::True / Atom::False.
sourcepub fn mk_variable(var_name: &str) -> FolTreeNode
pub fn mk_variable(var_name: &str) -> FolTreeNode
Create a FolTreeNode representing a variable.
See also NodeType::Terminal and Atom::Var.
sourcefn mk_atom(atom: Atom) -> FolTreeNode
fn mk_atom(atom: Atom) -> FolTreeNode
A helper function which creates a new FolTreeNode for the given Atom value.
sourcepub fn mk_function(
name: &str,
inner_nodes: Vec<FolTreeNode>,
is_update: bool,
) -> FolTreeNode
pub fn mk_function( name: &str, inner_nodes: Vec<FolTreeNode>, is_update: bool, ) -> FolTreeNode
Create a FolTreeNode representing a function symbol applied to given arguments.
source§impl FolTreeNode
impl FolTreeNode
sourcepub fn from_fn_update(
fn_update: FnUpdate,
bn_context: &BooleanNetwork,
) -> FolTreeNode
pub fn from_fn_update( fn_update: FnUpdate, bn_context: &BooleanNetwork, ) -> FolTreeNode
Recursively obtain the FolTreeNode
from a similar FnUpdate
object of the [biodivine_lib_param_bn]
library that is used internally for update functions.
The provided BN gives context for variable and parameter IDs.
sourcepub fn substitute_variable(
&self,
var: &str,
expression: &FolTreeNode,
) -> FolTreeNode
pub fn substitute_variable( &self, var: &str, expression: &FolTreeNode, ) -> FolTreeNode
Create a copy of this FolTreeNode with every occurrence of variable var
substituted
for FolTreeNode expression
.
You must ensure that no conflicts arise with quantification. For instance, this should be safe in case you are not substituting to quantified variables.
Trait Implementations§
source§impl Clone for FolTreeNode
impl Clone for FolTreeNode
source§fn clone(&self) -> FolTreeNode
fn clone(&self) -> FolTreeNode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FolTreeNode
impl Debug for FolTreeNode
source§impl Display for FolTreeNode
impl Display for FolTreeNode
source§impl Hash for FolTreeNode
impl Hash for FolTreeNode
source§impl PartialEq for FolTreeNode
impl PartialEq for FolTreeNode
impl Eq for FolTreeNode
impl StructuralPartialEq for FolTreeNode
Auto Trait Implementations§
impl Freeze for FolTreeNode
impl RefUnwindSafe for FolTreeNode
impl Send for FolTreeNode
impl Sync for FolTreeNode
impl Unpin for FolTreeNode
impl UnwindSafe for FolTreeNode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.