_Connective

it.grypho.scala.leonardo.logic._Connective
sealed trait _Connective extends _Expression

Marker trait for the five logical connectives: And, Or, Not, Implies, and Xor.

Operands are untyped core._Expressions so equations and other domains compose without cross-domain imports. eval runs the shared Kleene/Zadeh min–max rule table (kleeneAnd, kleeneOr, kleeneNot, kleeneImplies, kleeneXor) over operands widened by asTruth, so core._Bool and core._Truth operands mix freely and the boolean behaviour is a special case of the graded table rather than a separate branch. The result is rebuilt through _Truth.of, which collapses a crisp degree back to _Bool. Any other concrete operand (a _Number, a matrix) leaves the node symbolic.

eval consults its Environment for two knobs, neither of which is a second node hierarchy: the truth-value encoding (symmetricLogic, which additionally admits the digits {-1, 0, 1} as truth values -- a change of digits, never a change of meaning) and the semantics (LogicSemantics, selecting the t-norm / t-conorm pair: min-max, product, or Lukasiewicz). All three semantics agree with classical logic on the crisp values, so the boolean and three-valued tiers are unaffected by the default.

Deliberately NOT marked core._ElementWise: that marker means derive/simplify/ expand/integrate distribute over children (linear containers only), and the connectives are not linear -- derive(a and b, x) must stay symbolic.

Attributes

Graph
Supertypes
trait _Expression
class Object
trait Matchable
class Any
Known subtypes
class And
class Implies
class Not
class Or
class Xor

Members list

Value members

Inherited and Abstract methods

def children: List[_Expression]

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Attributes

Inherited from:
_Expression
def eval(env: Environment): Either[_Expression, _Value]

Reduces this expression in the given environment.

Reduces this expression in the given environment.

Value parameters

env

variable bindings and display precision

Attributes

Returns

Right(v) when all free variables resolved to concrete values; Left(e) when reduction is partial or impossible

Inherited from:
_Expression
def rebuild(newChildren: List[_Expression]): _Expression

Reconstructs the same node shape with replacement sub-expressions.

Reconstructs the same node shape with replacement sub-expressions.

Value parameters

newChildren

replacements in the same order and count as children

Attributes

Inherited from:
_Expression

Inherited fields

lazy val freeVars: Set[String]

Cached set of free variable names; O(1) after the first access.

Cached set of free variable names; O(1) after the first access.

Attributes

Inherited from:
_Expression