Skip to main content

ExprComplexity

Struct ExprComplexity 

Source
pub struct ExprComplexity {
Show 15 fields pub total_nodes: usize, pub depth: usize, pub width: usize, pub num_variables: usize, pub num_constants: usize, pub num_predicates: usize, pub num_quantifiers: usize, pub quantifier_depth: usize, pub num_negations: usize, pub num_connectives: usize, pub num_arithmetic: usize, pub num_set_ops: usize, pub num_let_bindings: usize, pub branching_factor: f64, pub leaf_ratio: f64,
}
Expand description

Comprehensive complexity metrics for a TLExpr tree.

Fields§

§total_nodes: usize

Total AST nodes in the expression tree.

§depth: usize

Maximum depth of the tree (root = depth 1).

§width: usize

Maximum number of siblings at any single level.

§num_variables: usize

Number of distinct variable names across the tree.

§num_constants: usize

Number of constant / literal nodes.

§num_predicates: usize

Number of predicate application nodes.

§num_quantifiers: usize

Number of quantifier nodes (ForAll, Exists, soft, counting, etc.).

§quantifier_depth: usize

Maximum nesting depth of quantifiers.

§num_negations: usize

Number of Not / FuzzyNot nodes.

§num_connectives: usize

Number of connective nodes (And, Or, Imply, Iff, TNorm, TCoNorm, etc.).

§num_arithmetic: usize

Number of arithmetic operation nodes.

§num_set_ops: usize

Number of set operation nodes.

§num_let_bindings: usize

Number of let / lambda / fixpoint binding nodes.

§branching_factor: f64

Average children per internal (non-leaf) node.

§leaf_ratio: f64

Ratio of leaf nodes to total nodes.

Implementations§

Source§

impl ExprComplexity

Source

pub fn analyze(expr: &TLExpr) -> Self

Compute complexity metrics for a TLExpr.

Source

pub fn score(&self) -> f64

A scalar “complexity score” summarising overall complexity (weighted sum).

Source

pub fn is_simple(&self, threshold: f64) -> bool

Returns true when the scalar Self::score is below threshold.

Source

pub fn summary(&self) -> String

Human-readable one-line summary.

Source

pub fn format_table(&self) -> String

Tabular representation of all metrics.

Trait Implementations§

Source§

impl Clone for ExprComplexity

Source§

fn clone(&self) -> ExprComplexity

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExprComplexity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExprComplexity

Source§

fn default() -> ExprComplexity

Returns the “default value” for a type. Read more
Source§

impl Display for ExprComplexity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.