_Truth

it.grypho.scala.leonardo.core._Truth
See the_Truth companion class
object _Truth

Companion for the graded truth value _Truth; holds the smart factory and the named unknown constant.

_Truth.of collapses the crisp endpoints 0.0 / 1.0 back to _Bool(false) / _Bool(true), so every existing _Bool(b) pattern match across the codebase keeps firing on crisp results — only a genuinely intermediate degree ever becomes a _Truth. This mirrors _Complex.of's collapse of a zero imaginary part back to _Number.

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
_Truth.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def fromSymmetric(s: Double): _Value

Reads a symmetric ternary digit as a truth value.

Reads a symmetric ternary digit as a truth value.

Symmetric ternary spells the three truth values {-1, 0, 1} where the default alphabet uses {0, 1/2, 1}; the two are related by the affine map t = (s + 1) / 2, of which _Truth.symmetric is the inverse. This is a change of digits only — the same rule table drives both spellings.

Value parameters

s

the symmetric digit; -1 is false, 0 is unknown, 1 is true

Attributes

Returns

the corresponding truth value, via _Truth.of (so ±1 collapse to _Bool)

def of(d: Double): _Value

Smart factory: clamps d into [0, 1] and collapses the crisp endpoints to _Bool, preserving the boolean fast path and all _Bool(b) pattern matches.

Smart factory: clamps d into [0, 1] and collapses the crisp endpoints to _Bool, preserving the boolean fast path and all _Bool(b) pattern matches.

Value parameters

d

the truth degree; values outside [0, 1] are clamped, NaN becomes Unknown (unreachable from the min–max kernels, which are closed over [0, 1])

Attributes

Returns

_Bool(false) for 0.0, _Bool(true) for 1.0, a _Truth otherwise

def toSymmetric(v: _Value): Option[Double]

Reads any truth-valued result as a symmetric ternary digit.

Reads any truth-valued result as a symmetric ternary digit.

The counterpart of fromSymmetric for values that may be _Bool rather than _Truth (the crisp endpoints, which of collapses).

Value parameters

v

the value to read

Attributes

Returns

the symmetric digit in [-1, 1], or None when v is not truth-valued

Concrete fields

The third Kleene truth value, unknown — neither true nor false.

The third Kleene truth value, unknown — neither true nor false.

Under the min–max rule table this is the fixpoint 0.5: not unknown = unknown and unknown and unknown = unknown.

Attributes