
Boost : 
Subject: Re: [boost] Ternary logic programming
From: Bjorn Reese (breese_at_[hidden])
Date: 20150705 05:44:58
On 07/05/2015 07:54 AM, Gottlob Frege wrote:
> I see Empty as "I do not know *yet*" (like future). ie Empty == "Value or
> Error eventually"
[...]
> Not sure if it makes complete sense to look at Empty as "Value or Error
> eventually", but I think you get a reasonable truth table out of it, and it
> might apply well to your futures.
With this interpretation the logic becomes that of Kleene's strong
logic of indeterminacy, which is what Boost.Tribool uses. I am going
to call this the "I may care" approach here.
However, there are alternative interpretations.
We could regard Empty as "I don't care". You may have a set of these
variables, and you have to take action at some point even if all the
variables have not become Value or Error so far, but you still want
an indication if none have been set. In that case, you get:
Empty && Error => Error
Empty && Value => Value
Empty && Empty => Empty
Empty  Error => Error
Empty  Value => Value
Empty  Empty => Empty
Another alternative is to regard Empty as "I do care", which makes it
behave like a NaNlike construct. This makes Empty "sticky"; if only
one of the variables is Empty then the entire condition should be
Empty:
Empty && Error => Empty
Empty && Value => Empty
Empty && Empty => Empty
Empty  Error => Empty
Empty  Value => Empty
Empty  Empty => Empty
I agree that "I may care" looks fine for futures, but since Niall is
aiming for general framework of monads, I am less convinced that this
approach is best approach for all. It may very well be that different
monads require different threevalued logic.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk