definition of logical AND

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?

Reply to
dysfunctionally_yours
Loading thread data ...

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

Reply to
Robbie Mayhem

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 " or equals a " while 0 + 12 = 12 can represent " or equals a " )

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

Reply to
daestrom

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.