Main Page | Report this Page
 
   
Science Forum Index  »  Logic Forum  »  XOR representation of AND
Page 1 of 1    
Author Message
Steven
Posted: Tue Apr 22, 2008 6:36 pm
Guest
Is it possible to represent the logic AND operation using only
NOT and XOR operations? For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

However, is it possible to represent AND using XOR and NOT operators?
I've spent the past few hours trying to do so, thinking that it
must be possible. However, the longer I worked with it, the more I
realized just how symmetrical XOR is in nearly every respect. This is
what makes the whole ordeal tricky. I've searched the internet, and
looked in a textbook that I have, but haven't been able to find any
such representation of the AND operation. I slowly began to wonder if
it's even possible. Does anyone know for sure?
Thanks for your time.
Guest
Posted: Tue Apr 22, 2008 6:48 pm
On Apr 22, 9:36 pm, Steven <evanss...@yahoo.com> wrote:
Quote:
     Is it possible to represent the logic AND operation using only
NOT and XOR operations?  For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

However, is it possible to represent AND using XOR and NOT operators?
     I've spent the past few hours trying to do so, thinking that it
must be possible.  However, the longer I worked with it, the more I
realized just how symmetrical XOR is in nearly every respect.  This is
what makes the whole ordeal tricky.  I've searched the internet, and
looked in a textbook that I have, but haven't been able to find any
such representation of the AND operation.  I slowly began to wonder if
it's even possible.  Does anyone know for sure?
     Thanks for your time.

I think it requires "False" as well.
You have to set one of the XOR inputs to always false.


Russell
- 2 many 2 count
PiperAlpha167
Posted: Tue Apr 22, 2008 9:08 pm
Guest
On Apr 22, 9:36 pm, Steven <evanss...@yahoo.com> wrote:
Quote:
     Is it possible to represent the logic AND operation using only
NOT and XOR operations?  For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

However, is it possible to represent AND using XOR and NOT operators?
     I've spent the past few hours trying to do so, thinking that it
must be possible.  However, the longer I worked with it, the more I
realized just how symmetrical XOR is in nearly every respect.  This is
what makes the whole ordeal tricky.  I've searched the internet, and
looked in a textbook that I have, but haven't been able to find any
such representation of the AND operation.  I slowly began to wonder if
it's even possible.  Does anyone know for sure?
     Thanks for your time.

The set {~,xor} is inadequate. The set {~,<->} is also inadequate and
for the same reason.
You've already put your finger on the reason. You might prove the
inadequacy of either of
these sets by demonstrating that conjunction (your example) cannot be
expressed by any
combination of ~ and xor (or <-> if you like).

You might find it surprising that the set {->,xor} is adequate.
The key is to note that xor is just the denial of material
equivalence.

Note: I think I mistakenly sent this post to "reply to author". My
bad.
William Elliot
Posted: Wed Apr 23, 2008 1:15 am
Guest
On Tue, 22 Apr 2008, Steven wrote:

Quote:
Is it possible to represent the logic AND operation using only
NOT and XOR operations? For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

~(p & q) <-> (~p v ~q)


Quote:
However, is it possible to represent AND using XOR and NOT operators?

(p & ~q) xv (~p & q) xv (p & q) <-> (p v q)
William Elliot
Posted: Wed Apr 23, 2008 2:18 am
Guest
On Tue, 22 Apr 2008, William Elliot wrote:

Quote:
On Tue, 22 Apr 2008, Steven wrote:

Is it possible to represent the logic AND operation using only
NOT and XOR operations? For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

~(p & q) <-> (~p v ~q)

However, is it possible to represent AND using XOR and NOT operators?

(p & ~q) xv (~p & q) xv (p & q) <-> (p v q)

Dang, that's wrong.


What you ask is the same as asking to represent OR by XOR and NOT.
Marshall
Posted: Wed Apr 23, 2008 7:23 am
Guest
On Apr 23, 9:32 am, Jan Burse <janbu...@fastmail.fm> wrote:
Quote:
Steven schrieb:

Is it possible to represent the logic AND operation using only
NOT and XOR operations? For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

However, is it possible to represent AND using XOR and NOT operators?
I've spent the past few hours trying to do so, thinking that it
must be possible. However, the longer I worked with it, the more I
realized just how symmetrical XOR is in nearly every respect. This is
what makes the whole ordeal tricky. I've searched the internet, and
looked in a textbook that I have, but haven't been able to find any
such representation of the AND operation. I slowly began to wonder if
it's even possible. Does anyone know for sure?
Thanks for your time.

Observe xor is commutative and associate,
so any expression involving + (xor), 1, 0 and
variables can be brought into the form:

a1*x1 + .. + an*xn + b*1 + c*0

(Just count the variables/constants in the
expression tree, a*x is short hand for
a-times x+..+x)

Now further observe:

(2*n+1) * x = x
(2*n) * x = 0

So an expression over the variables x, y, will
reduce to one of the following:

0
1
x
x + 1
y
y + 1
y + x
y + x + 1

All of them not being the and. Q.E.D.

Neat.


Quote:
P.S.: Similar tricks applicable if the set
of base operations is arbitrarly given??

How similar is similar enough?

Of the 16 possible binary functions over {0, 1},
2 are commutative but not associative, 2 are
associative and not commutative, 6 are both,
and 6 are neither.


Marshall
Jan Burse
Posted: Wed Apr 23, 2008 11:32 am
Guest
Steven schrieb:
Quote:
Is it possible to represent the logic AND operation using only
NOT and XOR operations? For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

However, is it possible to represent AND using XOR and NOT operators?
I've spent the past few hours trying to do so, thinking that it
must be possible. However, the longer I worked with it, the more I
realized just how symmetrical XOR is in nearly every respect. This is
what makes the whole ordeal tricky. I've searched the internet, and
looked in a textbook that I have, but haven't been able to find any
such representation of the AND operation. I slowly began to wonder if
it's even possible. Does anyone know for sure?
Thanks for your time.

Observe xor is commutative and associate,
so any expression involving + (xor), 1, 0 and
variables can be brought into the form:

a1*x1 + .. + an*xn + b*1 + c*0

(Just count the variables/constants in the
expression tree, a*x is short hand for
a-times x+..+x)

Now further observe:

(2*n+1) * x = x
(2*n) * x = 0

So an expression over the variables x, y, will
reduce to one of the following:

0
1
x
x + 1
y
y + 1
y + x
y + x + 1

All of them not being the and. Q.E.D.

Best Regards

P.S.: Similar tricks applicable if the set
of base operations is arbitrarly given??
herbzet
Posted: Wed Apr 23, 2008 5:01 pm
Guest
PiperAlpha167 wrote:
Quote:

On Apr 22, 9:36 pm, Steven <evanss...@yahoo.com> wrote:
Is it possible to represent the logic AND operation using only
NOT and XOR operations? For instance, I know that the AND operation
can be expressed using only OR and NOT operators:

AB = !(!A + !B)

However, is it possible to represent AND using XOR and NOT operators?
I've spent the past few hours trying to do so, thinking that it
must be possible. However, the longer I worked with it, the more I
realized just how symmetrical XOR is in nearly every respect. This is
what makes the whole ordeal tricky. I've searched the internet, and
looked in a textbook that I have, but haven't been able to find any
such representation of the AND operation. I slowly began to wonder if
it's even possible. Does anyone know for sure?
Thanks for your time.

The set {~,xor} is inadequate. The set {~,<->} is also inadequate and
for the same reason.
You've already put your finger on the reason. You might prove the
inadequacy of either of
these sets by demonstrating that conjunction (your example) cannot be
expressed by any
combination of ~ and xor (or <-> if you like).

You might find it surprising that the set {->,xor} is adequate.
The key is to note that xor is just the denial of material
equivalence.

(A xor B) =/= ~(A -> B) for A = 0 (false) and B = 1 (true).

I'm sure you just misspoke.

You are correct that the set {->, xor} form a complete basis
for propositional logic.

Let 0 =def (A xor A).
Let ~A =def (A -> 0)
Let (A v B) =def (~A -> B)
Let (A & B) =def ~(A -> ~B) (or use De Morgan's law)

etc.

Any truth functional operator, including those of arity > 2,
is equivalent to a formula in disjunctive (or conjunctive)
normal form, which shows that {v, &, ~} is a complete base
for truth functional logic, and thus so is {->, xor} since
we can then define all of them as just shown.

Example: Define 3-place operator #ABC

# A B C
-|-------
0| 1 1 1
1| 1 1 0
1| 1 0 1
0| 1 0 0
0| 0 1 1
0| 0 1 0
1| 0 0 1
0| 0 0 0

This takes the value 1 on three lines, so we write three conjunctions

(A & B & ~C), (A & ~B & C), (~A & ~B & C)

one for each line. Their disjunction

(A & B & ~C) v (A & ~B & C) v (~A & ~B & C)

is equivalent to #ABC.

To put in conjunctive normal form, we take the five lines which
evaluate to 0 and write the disjunction of five conjunctive clauses

(A & B & C) v (A & ~B & ~C) v (~A & B & C) v (~A & B & ~C) v (~A & ~B & ~C)

which is equal to ~#ABC, and negate it

~((A & B & C) v (A & ~B & ~C) v (~A & B & C) v (~A & B & ~C) v (~A & ~B &
~C))

apply De Morgan's Law several times to get

(~A v ~B v ~C) & (~A v B v C) & (A v ~B v ~C) & (A v ~B v C) & (A v B v C).

which is #ABC in conjunctive normal form.

Since conjunction and disjunction are related by De Morgan's law,
the complete functional basis {v, &, ~} can be reduced to either
of {v, ~} or {&, ~}.

The set {->, ~} is also complete, since either of disjunction or
conjunction can be defined with them, as shown at the top of my
post.

--
hz
Marshall
Posted: Thu Apr 24, 2008 6:11 am
Guest
On Apr 24, 8:28 am, Jan Burse <janbu...@fastmail.fm> wrote:
Quote:
Marshall schrieb:

P.S.: Similar tricks applicable if the set
of base operations is arbitrarly given??

How similar is similar enough?

Of the 16 possible binary functions over {0, 1},
2 are commutative but not associative, 2 are
associative and not commutative, 6 are both,
and 6 are neither.

Marshall

Similar in the sense that the size of tree
can be reduced. Every binary function:

f: B x B -> B (B={0,1})

Can be viewed as two unary functions:

g0: B -> B, (g0(x)=f(0,x))
g1: B -> B, (g1(x)=f(1,x))

If g0(0)=1, and g0(1)=0, we can write for
the orbit of g0, orbit(g0)={01}.

The orbit of these functions is always finite,
and has one of the following forms:

0{1}

{0} {1}

{01}

1{0}

So maybe tree depth 4 is upper bound?

Ah! Very nice.


Marshall
Jan Burse
Posted: Thu Apr 24, 2008 10:28 am
Guest
Marshall schrieb:
Quote:
P.S.: Similar tricks applicable if the set
of base operations is arbitrarly given??

How similar is similar enough?

Of the 16 possible binary functions over {0, 1},
2 are commutative but not associative, 2 are
associative and not commutative, 6 are both,
and 6 are neither.


Marshall

Similar in the sense that the size of tree
can be reduced. Every binary function:

f: B x B -> B (B={0,1})

Can be viewed as two unary functions:

g0: B -> B, (g0(x)=f(0,x))
g1: B -> B, (g1(x)=f(1,x))

If g0(0)=1, and g0(1)=0, we can write for
the orbit of g0, orbit(g0)={01}.

The orbit of these functions is always finite,
and has one of the following forms:

0{1}

{0} {1}

{01}

1{0}

So maybe tree depth 4 is upper bound?

Best Regards
PiperAlpha167
Posted: Thu Apr 24, 2008 10:07 pm
Guest
On Apr 23, 3:01 pm, herbzet <herb...@gmail.com> wrote:
Quote:

(A xor B)  =/=  ~(A -> B) for A = 0 (false) and B = 1 (true).

I'm sure you just misspoke.


Misspoke?
I'd say it's a bit closer to the truth to say that you just misread.
But thanks anyway for your attention.
herbzet
Posted: Fri Apr 25, 2008 9:31 pm
Guest
PiperAlpha167 wrote:
Quote:

On Apr 23, 3:01 pm, herbzet <herb...@gmail.com> wrote:

(A xor B) =/= ~(A -> B) for A = 0 (false) and B = 1 (true).

I'm sure you just misspoke.


Misspoke?
I'd say it's a bit closer to the truth to say that you just misread.
But thanks anyway for your attention.

You're right -- I misread. Sorry.

--
hz
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Fri Dec 05, 2008 1:35 am