Phiber
Phiber

Reputation: 1103

Reverse of the logical operator AND (&)

 a + b = c
 c - a = b

Ok, now

 a & b = c
 c ?? a = b

which operator replace "??" ?
Thanks

Upvotes: 9

Views: 17091

Answers (4)

Jerzy Kawecki
Jerzy Kawecki

Reputation: 1

No operator can replace "??" ! Only relation (logical relation !) b = (c=a)x2 + (not c) can replace ""??".

J.Kawecki: Logical Relations. Warsaw,2019 Druk24h.pl

Upvotes: 0

EagleV_Attnam
EagleV_Attnam

Reputation: 747

You can't.

0 && 0 == 0
1 && 0 == 0

To reverse this, you'd need an operator that gives back both 0 and 1.

(But if b == 1 you do of course know that a == c.)

Upvotes: 12

thor
thor

Reputation: 22530

There is no such operator, because it will be ill-defined if it exists:

so, let a = 0, c = 0

we have

a & 0 = c
a & 1 = c

then, we should have

c ?? a = 0   and  c ?? a = 1

, but an operator/function cannot return two values given the same input/parameters.

Upvotes: 23

Bathsheba
Bathsheba

Reputation: 234865

It's impossible. This is because a & b is a lossy transformation.

You don't know whether any dropped 1 bits were part of a or b.

Upvotes: 22

Related Questions