## Tuesday, December 17, 2013

### Odd Logic, 2 of 5; Matrix Logic

MATRIX LOGIC

All boolean functions are odd-linear, either way that you map logic to Z mod 2! This opens up all the mechanics of linear algebra, including vectors and matrices. This 'matrix logic' has two peculiarities; all sums must have an odd number of terms, and there are several multiplications, two of them versions of addition!

Define these matrix logic operations:

x
a   b   c    and         y         =    (a and x) +(b and y)+(c and z)
z

x
a   b   c     or         y         =    (a or x) +(b or y)+(c or z)
z

x
a   b   c    -->         y         =    (a --> x) +(b --> y)+(c --> z)
z

x
a   b   c     -          y         =    (a - x) +(b - y)+(c - z)
z

x
a   b   c    iff         y         =    (a iff x) +(b iff y)+(c iff z)
z

x
a   b   c    xor         y         =    (a xor x) +(b xor y)+(c xor z)
z

That is, we do "dot products" with arbitrary logic operators as
multiplications. Extend this to odd-by-odd products.

For instance, the 'matrix and'

a11  a12  a13            b11  b12  b13
a21  a22  a23    and     b21  b22  b23
a31  a32  a33            b31  b32  b33

is a 3 by 3 logic matrix with i-j entry equal to:

(ai1 and b1j) + (ai2 and b2j) + (ai3 and b3j)

Define 'matrix or' similarly; along with matrix ->, -, etc.

There are matrix scalars too:

a  and  ( x   y   z  )   =   (  (a and x)   (a and y)   (a and z)  )
a  xor  ( x   y   z  )   =   (  (a xor x)   (a xor y)   (a xor z)  )

and so on.

Matrix 'and' and 'or' are associative; but of course commutativity fails, and I am not sure about distribution of 'and' and 'or' over each other.

Matrix 'and' has this identity matrix:
T F F
F T F
F F T

Matrix 'or' has this identity matrix:
F T T
T F T
T T F

The "and-determinant", And-det, of
a  b  c
d  e  f
g  h  i
is
(a and e and i) xor (b and f and g) xor (c and d and h) xor
(g and e and c) xor (h and f and a) xor (i and d and b)
Equivalently; rewrite the matrix with F=0 and T=1, find the determinant mod 2, then translate back.

Given logic matrices A and B:
And-det( A and B )  =  And-det(A) and And-det(B)
The matrix has an and-inverse if its and-determinant equals T.

The "or-determinant" Or-det of
a  b  c
d  e  f
g  h  i
is
(a or e or i) iff (b or f or g) iff (c or d or h) iff (g or e or c) iff
(h or f or a) iff (i or d or b)
Equivalently; rewrite the matrix with F=1 and T=0, find the determinant mod 2, then translate back.

Given logic matrices A and B:
Or-det( A or B )  =  Or-det(A) or Or-det(B)
The matrix has an or-inverse if its or-determinant equals F.
You can of course define eigenvectors and eigenvalues. In fact you get the odd-by-odd matrices over Z mod 2, with both 'and' and 'or' multiplications, along with -->, -, xor and iff!