93 lines
2.8 KiB
Text
93 lines
2.8 KiB
Text
{{wikipedia|Ternary logic}}
|
|
|
|
<br>
|
|
In [[wp:logic|logic]], a '''three-valued logic''' (also '''trivalent''', '''ternary''', or '''trinary logic''', sometimes abbreviated '''3VL''') is any of several [[wp:many-valued logic|many-valued logic]] systems in which there are three [[wp:truth value|truth value]]s indicating ''true'', ''false'' and some indeterminate third value.
|
|
|
|
This is contrasted with the more commonly known [[wp:Principle of bivalence|bivalent]] logics (such as classical sentential or [[wp:boolean logic|boolean logic]]) which provide only for ''true'' and ''false''.
|
|
|
|
Conceptual form and basic ideas were initially created by [[wp:Jan Łukasiewicz|Łukasiewicz]], [[wp:C. I. Lewis|Lewis]] and [[wp:Sulski|Sulski]].
|
|
|
|
These were then re-formulated by [[wp:Grigore Moisil|Grigore Moisil]] in an axiomatic algebraic form, and also extended to ''n''-valued logics in 1945.
|
|
{|
|
|
|+'''Example ''Ternary Logic Operators'' in ''Truth Tables'':'''
|
|
|-
|
|
|
|
|
{| class=wikitable
|
|
|+''not'' a
|
|
|-
|
|
! colspan=2 | ¬
|
|
|-
|
|
| True || False
|
|
|-
|
|
| Maybe || Maybe
|
|
|-
|
|
| False || True
|
|
|}
|
|
||
|
|
{| class=wikitable
|
|
|+a ''and'' b
|
|
|-
|
|
! ∧
|
|
| True || Maybe || False
|
|
|-
|
|
| True || True || Maybe || False
|
|
|-
|
|
| Maybe || Maybe || Maybe || False
|
|
|-
|
|
| False || False || False || False
|
|
|}
|
|
||
|
|
{| class=wikitable
|
|
|-
|
|
|+a ''or'' b
|
|
|-
|
|
! ∨
|
|
| True || Maybe || False
|
|
|-
|
|
| True || True || True || True
|
|
|-
|
|
| Maybe || True || Maybe || Maybe
|
|
|-
|
|
| False || True || Maybe || False
|
|
|}
|
|
|-
|
|
||
|
|
{| class=wikitable
|
|
|-
|
|
|+''if'' a ''then'' b
|
|
|-
|
|
! ⊃
|
|
| True || Maybe || False
|
|
|-
|
|
| True || True || Maybe || False
|
|
|-
|
|
| Maybe || True || Maybe || Maybe
|
|
|-
|
|
| False || True || True || True
|
|
|}
|
|
||
|
|
{| class=wikitable
|
|
|-
|
|
|+a ''is equivalent to'' b
|
|
|-
|
|
! ≡
|
|
| True || Maybe || False
|
|
|-
|
|
| True || True || Maybe || False
|
|
|-
|
|
| Maybe || Maybe || Maybe || Maybe
|
|
|-
|
|
| False || False || Maybe || True
|
|
|}
|
|
|}
|
|
|
|
|
|
;Task:
|
|
* Define a new type that emulates ''ternary logic'' by storing data '''trits'''.
|
|
* Given all the binary logic operators of the original programming language, reimplement these operators for the new ''Ternary logic'' type '''trit'''.
|
|
* Generate a sampling of results using '''trit''' variables.
|
|
* [[wp:Kudos|Kudos]] for actually thinking up a test case algorithm where ''ternary logic'' is intrinsically useful, optimises the test case algorithm and is preferable to binary logic.
|
|
|
|
<br>
|
|
Note: '''[[wp:Setun|Setun]]''' (Сетунь) was a [[wp:balanced ternary|balanced ternary]] computer developed in 1958 at [[wp:Moscow State University|Moscow State University]]. The device was built under the lead of [[wp:Sergei Sobolev|Sergei Sobolev]] and [[wp:Nikolay Brusentsov|Nikolay Brusentsov]]. It was the only modern [[wp:ternary computer|ternary computer]], using three-valued [[wp:ternary logic|ternary logic]]
|
|
<br><br>
|