yin-yang of programs and three-valued logics
DESCRIPTION
Yin-Yang of Programs and Three-Valued Logics. Jerzy Tyszkiewicz Instytut Informatyki UW. Three-valued logics. Programs. Three-Valued Logics for Programs. Explicit SQL Datalog with negation Implicit Every regular programming language Conditional expressions. - PowerPoint PPT PresentationTRANSCRIPT
Yin-Yang of Programs and Three-Valued Logics
Jerzy TyszkiewiczInstytut Informatyki UW
Programs
Three-valued logics
Three-Valued Logics for Programs
• Explicito SQLo Datalog with negation
• Implicito Every regular programming languageo Conditional expressions
SQL, Heyting-Kleene-Łukasiewicz,Goodman-Nguyen-Walker
OR 0 1 NULL
0 0 1 NULL
1 1 1 1
NULL NULL 1 NULL
AND 0 1 NULL
0 0 0 0
1 0 1 NULL
NULL 0 NULL NULL
Sobociński, Schay-Adams-Calabrese
OR 0 1 $
0 0 1 0
1 1 1 1
$ 0 1 $
AND 0 1 $
0 0 0 0
1 0 1 1
$ 0 1 $
Strict evaluation, Bochvar
OR 0 1 $
0 0 1 $
1 1 1 $
$ $ $ $
AND 0 1 $
0 0 0 $
1 0 1 $
$ $ $ $
Lazy evaluation
OR 0 1 $
0 0 1 $
1 1 1 1
$ $ $ $
AND 0 1 $
0 0 0 0
1 0 1 $
$ $ $ $
Conditionals
• An object can red r, yellow y or blue b• Pr(r)=Pr(y)=Pr(b)=1/3
• What is the probability, that it is b, given that if it is not r, then it is b?
• Pr(b |(b |¬ r))• Not a well-defined expression
Conditionals
Conditionals G-N-W
COND 0 1 $
0 $ 0 0
1 $ 1 $
$ $ $ $
Conditional S-A-C
COND 0 1 $
0 $ 0 0
1 $ 1 1
$ $ $ $
Datalog
q(X, Y) ← edge(X, Y)q(X, Z) ← edge(X, Y), q(Y, Z)
Computation stabilises eventually, if started from empty intentional relation q.
The resulting q is two-valued.
Datalog with negation
q(X, Y) ← r(X, Y, Z), ¬q(Y, X)q(X, Y) ← s(X, Y, Z), r(X, Y, Z), q(X, Y), ¬q(Y, Y)
Relation q need not stabilise during computation.
Datalog with negation
• Some tuples are almost always in q• Some tuples are almost always not in q• Some tuples continue changing status forever
Datalog with negation
The resulting relation is three-valued.
•Some tuples are in the computed q•Some tuples are not in the computed q•Some tuples are undecided
Mutual definability of conditional algebras
•Are the connectives of SAC and GNW algebras definable in each other?
Mutual definability of conditional algebras
•The main question is equivalent to defibability of certain three-valued functions by composition of other functions.
•We use programs to enumerate all possible two-argument compositions of the basic connectives.
Mutual definability of conditional algebras
Theorem 1. An n-argument connective f : {0,1,$} →{0,1,$} is definable in SAC iff f($,...,$) =$.There are 6561 of binary ones.In particular, all connectives of GNW aredefinable in SAC.
Mutual definability of conditional algebras
I could pretend not using computer in the proof of Theorem 1.
Mutual definability of conditional algebras
Theorem 2. The conjunction and disjunction of SACare not definable in GNW.COND of SAC is definable in GNW.There are only 849 two-argument connectives definable in GNW.
Mutual definability of conditional algebras
At present I could not give a proof of Theorem 2 without reference to the computer.
Internal structure of conditional algebras
Theorem 3. SAC an GNW have Sheffer-like definable connectives: ones that are definable and suffice alone to define all other connectives.
My co-authors
Piotr Chrząstowski-WachtelAchim HoffmannArthur Ramer
Thank
you!