I am working on a knowledgebase system as a hobby project, and I would like to incorporate some mechanisms for logic reasoning under uncertainty. I have looked into Kleene's three-valued logic, but I am puzzled by the (well known) problem with tautology/contradiction.
Denote the truth values by $\top$ (true), $\bot$ (false), and $?$ (unknown). The problem is that, because $\neg\ ?\ =\ ?$, the formulas $p \lor \neg p$ and $p \land \neg p$ are no longer a tautology/contradiction: if $p =\ ?$, then the truth tables give $\ ?\ \lor \neg\ ?\ =\ ?\ \lor\ ? =\ ?$, and similarly, $\ ?\ \land \neg\ ? =\ ?$ . But intuition suggests that even though we don't know the truth value of $p$, we should still have $p \lor \neg p = \top$ and $p \land \neg p = \bot\ $, as with boolean logic.
I think this is because truth tables don't recognize the difference between a conjuction or disjunction between (i) two distinct unknowns, and (ii) one unknown and its own inverse. In case (i), the result should indeed be unknown, as the truth tables indicate, but in case (ii) it should not, we should obtain $\ ?\ \lor \neg\ ?\ = \top$ and $\ ?\ \land \neg\ ?\ = \bot\ $. I have a feeling there is also some issue with treating $\ ?\ $ as a third truth value, while it actually means there is no known truth value, but this is not clear to me.
I feel there should be some way of treating tautology/contradiction in three-valued logic without causing logical inconsistencies, but I am not well versed in logic, and I can't really read research level logic papers, that stuff is just over my head.
Is there any known solution to this problem, for example in automated reasoning or knowledgebase systems? If so, I would very much appreciate an intuitive (rather than super formal) explanation.
What you need is the notion of supervaluation. Let $P$ be the set of atomic propositions. Then a valuation is any function from $P$ to $\{\top,\bot,?\}$. A valuation $\overline v$ is a complete extension of an evaluation $v$ if for all $p\in P$ it is the case that
(Intuitively, a complete extension $\overline v$ is a way the world can be that is consistent with the information contained in $v$.)
Given a valuation $v$, a sentence $\phi$ is supervaluation-true if $\phi$ is classically true under all complete extensions of $v$, and similarly for supervaluation-false.
Take the sentence $p\vee\neg p$ as example when the truth value of $p$ is unknown, i.e. $v(p)=\mathord ?$. Any complete extension $\overline v$ of $v$ will have $\overline v(p)=\top$ or $\overline v(p)=\bot$. In both cases $p\vee\neg p$ is classically true. Hence, $p\vee\neg p$ is supervaluation-true in this case. Of course, $p\vee\neg p$ is also supervaluation-true if $v(p)=\top$ or $v(p)=\bot$, so $p\vee\neg p$ always comes out supervaluation-true, as desired.