Exotic Logics

Aaron Brady castironpi at gmail.com
Wed Jun 17 13:20:51 EDT 2009


On Jun 17, 10:04 am, Aaron Brady <castiro... at gmail.com> wrote:
snip
> You (OP) may be interested in the definitions of the fuzzy operators:
>
> and( x, y ) := min( x, y )
> or( x, y ) := max( x, y )
> not( x ) := 1 (one)- x
> nand( x, y ) := not( and( x, y ) ) = 1- min( x, y )
>
> Defining 'xor' as '( x or y ) and ( not( x and y ) )', we have:
>
> xor( x, y ) := min( max( x, y ), 1- min( x, y ) )
>
> However, defining 'xor' as '( x and not y ) or ( y and not x )', we
> don't have:
>
> xor( x, y ) := max( min( x, 1- y ), min( y, 1-x ) )

Corollary:

xor1( x, y ) === xor2( x, y ).

Non-exhaustive demonstration, excerpt:

>>> def xor1( x, y ):
...     return min( max( x, y ), 1- min( x, y ) )
...
>>> def xor2( x, y ):
...     return max( min( x, 1- y ), min( y, 1- x ) )
...
>>> for i in range( 0, 11, 2 ):
...     for j in range( 0, 11, 2 ):
...             print i, j, xor2( x, y )*10, '  ',
...     print

0 0 0.0    0 2 2.0    0 4 4.0    0 6 6.0    0 8 8.0
2 0 2.0    2 2 2.0    2 4 4.0    2 6 6.0    2 8 8.0
4 0 4.0    4 2 4.0    4 4 4.0    4 6 6.0    4 8 6.0
6 0 6.0    6 2 6.0    6 4 6.0    6 6 4.0    6 8 4.0
8 0 8.0    8 2 8.0    8 4 6.0    8 6 4.0    8 8 2.0
10 0 10.0  10 2 8.0   10 4 6.0   10 6 4.0   10 8 2.0

They appear to be equal.

I forgot to mention, fuzzy values take on values from the continuous
open or closed range 0 to 1.



More information about the Python-list mailing list