agent_logic.evaluation.evaluator

Expression evaluator module.

This module provides utilities for evaluating logical expressions with different truth assignments.

Classes

Evaluator()

Evaluates logical expressions with different truth assignments.

class agent_logic.evaluation.evaluator.Evaluator[source]

Bases: object

Evaluates logical expressions with different truth assignments.

This class provides methods to evaluate expressions and determine logical properties such as consistency, validity, and equivalence.

static are_equivalent(expr1, expr2)[source]

Determines if two expressions are logically equivalent.

Expressions are equivalent if they have the same truth value for all possible truth assignments to their variables.

Parameters:
Return type:

bool

Returns:

True if the expressions are equivalent, False otherwise

static evaluate(expression, context)[source]

Evaluates a logical expression under a given context of truth values.

Return type:

bool

Parameters:
static evaluate_with_assignment(expression, assignment)[source]

Evaluates a logical expression under a specific truth assignment.

Parameters:
  • expression (LogicalExpression) – The logical expression to evaluate

  • assignment (Dict[str, bool]) – Dictionary mapping variable names to boolean values

Return type:

bool

Returns:

Boolean result of evaluating the expression

static expression_depth(expression)[source]

Computes the depth of a logical expression.

Return type:

int

Parameters:

expression (LogicalExpression)

static is_satisfiable(expression)[source]

Determines if an expression is satisfiable (true for at least one assignment).

Parameters:

expression (LogicalExpression) – The logical expression to check

Return type:

bool

Returns:

True if the expression is satisfiable, False otherwise

static is_valid(expression)[source]

Determines if an expression is valid (true for all assignments).

Parameters:

expression (LogicalExpression) – The logical expression to check

Return type:

bool

Returns:

True if the expression is valid, False otherwise