_Membership

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

Marker trait for the nodes that produce a truth degree from crisp input: the hedges (Very, Somewhat) and the membership curves (TriMF, TrapMF, GaussMF, SigMF), plus the explicit conversion _TruthOf.

These are the fuzzy tier's entry points: a membership function maps a crisp measurement into [0, 1], and everything downstream is an ordinary truth value that the connectives already understand. Their eval therefore returns _Truth.of(degree) rather than a plain number — a membership degree is a truth value, and returning one is what lets very(trimf(t, 0, 10, 20)) and somewhat(x) compose without an explicit cast at every step.

Arguments are read with asDegree, which accepts a bare number in [0, 1] as well as a _Bool/_Truth: a hedge has no other domain, so there is none of the ambiguity that makes the connectives insist on asTruth. An argument outside the domain, or one that does not reduce, leaves the node symbolic.

Attributes

Graph
Supertypes
trait _Expression
class Object
trait Matchable
class Any
Known subtypes
class GaussMF
class SigMF
class Somewhat
class TrapMF
class TriMF
class Very
class _TruthOf
Show all

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