Home > Archive > Electrical Engineering > March 2006 > definition of logical AND









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author definition of logical AND
dysfunctionally_yours

2006-03-30, 4:21 am

in the context of binary, a logical AND could be defined as the
multiplication of bits

but is this definiton valid in other number systems,like base9 or
decimal systems?

what is the real definition of logical AND?

Robbie Mayhem

2006-03-30, 11:21 am


"dysfunctionally_yours" <sujay.dsa@gmail.com> wrote in message
news:1143704252.011975.194930@v46g2000cwv.googlegroups.com...
> in the context of binary, a logical AND could be defined as the
> multiplication of bits
>
> but is this definiton valid in other number systems,like base9 or
> decimal systems?
>
> what is the real definition of logical AND?
>


Quote from wikipedia follows:-
"In logic and technical fields that use it, conjunction, or and, is a
logical operator in logical calculi, and a rule of inference in deductive
systems. The result of conjoining two propositions is also called their
conjunction. The conjunction is true if both of the combined propositions
are true; else it is false.

For two inputs A and B, the truth table of the operator is as follows.

A | B| A & B

F | F | F

F | T | F

T | F | F

T | T | T

Intuitively, the logical operator works the same as the common English word
"and". The sentence "it's raining, and I'm inside" asserts that two things
are simultaneously true: that it is raining outside, and that I am inside.
Logically, this would be denoted by saying that A stands for "it's raining",
B stands for "I'm inside", together A AND B.

For example, consider:

x > 13 AND x < 27.
If x is 36, then x > 13 is true, but x < 27 is false, so this sentence is
false. But if x is 20, then both parts of the sentence are true, so the
entire conjunction is also true.

Logical conjunction is often used for bitwise operations. Examples:

a.. 0 and 0 = 0
b.. 0 and 1 = 0
c.. 1 and 0 = 0
d.. 1 and 1 = 1
a.. 1100 and 1010 = 1000
Note that in computer science, the AND operator can be used to set a bit to
0 by AND-ing the bit with 0 (A AND 0 = 0 for any (binary) value of A). This
principle is called a "bit mask". For example, if you have a 4-byte-integer
holding a color value, which could be described as 0xAABBGGRR (R-red;
G-green; B-blue; A-alpha), you may want to select one of the colors. The bit
mask for green would be 0x0000FF00. If you apply this bit mask to the
4-byte-integer, it only leaves the bits belonging to green intact
(0x0000GG00)."

End quote

As you can see, the number base is not important in terms of computer
operations (the computer after all understands only if an input is ON
'represented in binary by 1', or OFF 'represented in binary by 0'). Convert
your number base to binary and away you go.

HTH

Rob


daestrom

2006-03-30, 6:21 pm


"dysfunctionally_yours" <sujay.dsa@gmail.com> wrote in message
news:1143704252.011975.194930@v46g2000cwv.googlegroups.com...
> in the context of binary, a logical AND could be defined as the
> multiplication of bits
>
> but is this definiton valid in other number systems,like base9 or
> decimal systems?
>
> what is the real definition of logical AND?
>


For the 'real' definition, see Robbie's post.

I'll just add that it is found in number systems such as binary, that *if*
you consider a non-zero value as 'true', and a zero value as 'false', *then*
you can get results that represent the 'logical and' operation by using
multiplication. But that doesn't *define* the logical conjunction 'and'
*as* multiplication, it just gives us a tool to solve logic problems using
numerical methods.

Similarly, the logical 'or' can be simulated in mathematics by the addition
operator *if* you use the same numeric representations for 'true' (non-zero
value) and 'false' (zero) value and also constrain yourself to only positive
numbers. (for example, 0 + 0 = 0 can represent "<something false> or
<something false> equals a <false result>" while 0 + 12 = 12 can represent
"<something false> or <something true> equals a <true result>" )

Both of these (and other mathematical representations of logical operations)
allow us to use the same computational machinery for solving numeric
problems to solve 'logic' problems. Such as in the modern computer.

daestrom

LinkBot





Other archives available: Cellular phones topics archive | Web Design forum archive | Software help archive | Hardware reviews archive | Programming topics archive

Copyright 2004 - 2008 homeownerschat.com