Boost logo

Boost :

From: Richard Peters (R.A.Peters_at_[hidden])
Date: 2002-08-02 06:03:17


Well, I haven't had the need yet for tri-state logic, but from a theoretical point
of view, I'm very interested.
First, I'll explain what my idea is about tri-state logic. We've had an overflow of
way too theoretical coarses on university about these kind of things (Denotational
semantics of functional languages! yay!), but maybe I'm still totally wrong about
existing practices of tri-state logic.

In the functional language that we studied, a character named "bottom" ( _|_ )
represents undefinedness. It is often the result of a non-terminating function. A
tri-state bool as three states: true, false, bottom.
Defining a function negation is simple:
not true = false, not false = true, not bottom = bottom.
Defining a function or is more difficult:
{true, false} or {true, false} yields the expected values, bottom or bottom = bottom
but: true or bottom = ?, false or bottom = ?, bottom or true = ?, bottom or false =
?

There are three possibilities for filling these in:
The strict interpretation:
    bottom or {true, false} = bottom, {true, false} or bottom = bottom
    the strict interpretation means, if one of the parameters is bottom, then the
result is bottom
The strongest monotic extension of the two valued operator:
    bottom or true = true, bottom or false = bottom, true or bottom = true, false or
bottom = bottom
    this means something like if you're sure of the answer from examining one
parameter, you don't need to know the other one.
The sequential/asymmetric interpretiation:
    true or y = true, bottom or y = bottom, false or y = y
    this means that the first parameter is examined. In functional languages, when
the first parameter doesn't terminate, the operator doesn't terminate. When the
first parameter terminates, and you don't know the answer yet, you examine the
second parameter. x or y is different from y or x (true or bottom = true, bottom or
true = bottom)

Fuzzy logic is something completely than this. Bottom is not something like
"trueish", "falseish" or "something in between". A fuzzy bool is totally different
and has totally different purposes than a tri-state bool. If I would use a fuzzy
bool, I think I'd rather take a floating type in the range [0, 1] with maybe
operators that are a bit undeterministic. (Today, it says "It's a bit blue",
tomorrow, "nah I think it's more greenish")
And for the name of the third state, I'm in favor of "bottom", it's a
well-established name, and short.

Douglas Gregor wrote:
>
> The type, tribool, can be either true, false, or indeterminate. It
> follows the normal rules for 3-valued logic, and supports all boolean

hmm... the "normal" rules... I'm wondering what rules you used :) Is it difficult to
add the three interpretations above?

Best regards,

Richard Peters


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk