unicode_fol_kit.fuzzy_evaluate

unicode_fol_kit.fuzzy_evaluate(node, valuation, domain=None, sort_universes=None, tnorm='lukasiewicz')

Compute the fuzzy truth degree in [0, 1] of an FL/MSFL formula.

Parameters:
  • node (Node) – an FL or MSFL formula node. Build it with MSFLParser(fuzzy=True) (unsorted FL) or MSFLParser(many_sorted=True, fuzzy=True) (sorted MSFL).

  • valuation (Dict[str, float]) – maps a ground atom’s canonical key — its to_unicode_str() rendering, e.g. 'P(alice)' — to a degree in [0, 1]. A missing key raises KeyError with a helpful message.

  • domain (Set[str] | None) – a set of constant-name strings over which unsorted quantifiers range. Required whenever a Quantifier is evaluated.

  • sort_universes (Dict[str, Set[str]] | None) – maps each sort name to its set of constant-name strings; SortedQuantifier ranges over the universe of its sort.

  • tnorm (str) – which continuous t-norm fixes the strong connectives ⊗ ⊕ → ¬ ↔ — "lukasiewicz" (default), "godel" or "product". The weak ∧ / ∨ are always min / max, and ∀ / ∃ always inf / sup, regardless.

Returns:

The truth degree as a float clamped to [0, 1].

Raises:
  • KeyError – a ground atom’s key is absent from the valuation.

  • ValueError – a quantifier lacks its domain / sort universe, or one is empty, or tnorm is unknown.

  • TypeError – the node carries a classical connective, lambda construct, numeric literal, comparison atom, or otherwise unsupported type.

Return type:

float