unicode_fol_kit.kleene_value

unicode_fol_kit.kleene_value(formula, valuation, domain=None)[source]

Strong-Kleene three-valued truth value of a classical formula.

Parameters:
  • formula (Node) – a classical FOL formula node (Atom, Not, And, Or, Xor, Implies, Iff, Quantifier). Build it with MSFLParser().

  • valuation (Dict[str, float]) – maps a ground atom’s canonical key — its to_unicode_str() rendering, e.g. 'P' or 'P(a)' — to a value in {0.0, 0.5, 1.0}. A missing key raises KeyError.

  • domain (Set[str] | None) – a set of constant-name strings over which quantifiers range (∀ = min, ∃ = max). Required whenever a Quantifier is present.

Returns:

The truth value as one of 0.0, 0.5 or 1.0.

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

  • ValueError – a quantifier lacks a domain (or the domain is empty), or a valuation entry is not snappable to {0.0, 0.5, 1.0}.

  • NotImplementedError – the node is a Łukasiewicz, sorted, lambda or modal construct, which has no strong-Kleene three-valued reading here.

  • TypeError – the node is a bare term, not a formula, or otherwise unsupported.

Return type:

float