Logical conjunction is an operation on two logical values, typically the values of two propositions, that produces a value of true if and only if both of its operands are true.
The truth table of p AND q (also written as or in logic, in many programming languages, or p$cdot$q in electronics):
p | q | ∧ |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
The analogue of conjunction for a (possibly infinite) family of statements is universal quantification, which is part of predicate logic.
As a rule of inference, conjunction introduction is a classically valid, simple argument form. The argument form has two premises, A and B. Intuitively, it permits the inference of their conjunction.
or in logical operator notation:
Here is an example of an argument that fits the form conjunction introduction:
Conjunction elimination is another classically valid, simple argument form. Intuitively, it permits the inference from any conjunction of either element of that conjunction.
...or alternately,
In logical operator notation:
...or alternately,
If using binary values for true (1) and false (0), then logical conjunction works exactly like normal arithmetic multiplication.
In high-level computer programming, logical conjunction is commonly represented by an infix operator, usually as a keyword such as "AND
" or the ampersand symbol "&
". Many languages also provide short-circuit control structures corresponding to logical conjunction.
Logical conjunction is often used for bitwise operations, where 0
corresponds to false and 1
to true:
0 AND 0
= 0
,0 AND 1
= 0
,1 AND 0
= 0
,1 AND 1
= 1
.The operation can also be applied to two binary words viewed as bitstrings of equal length, by taking the bitwise AND of each pair of bits at corresponding positions. For example:
11000110 AND 10100011
= 10000010
.
This can be used to select part of a bitstring using a bit mask. For example, 10011101 AND 00001000
= 00001000
extracts the fifth bit of an 8-bit bitstring.
In computer networking, bit masks are used to derive the network address of a subnet within an existing network from a given IP address, by ANDing the IP address and the subnet mask.
Logical conjunction "AND
" is also used in SQL operations to form database queries.
The intersection used in set theory is defined in terms of a logical conjunction: x ∈ A ∩ B if and only if (x ∈ A) ∧ (x ∈ B). Because of this, set-theoretic intersection shares several properties with logical conjunction, such as associativity, commutativity, and idempotence.
The classical "trivium" divides the study of articulate argumentation into the disciplines of grammar, logic, and rhetoric. Grammar concerns those aspects of language that are internal to the language itself, in other words, that can be abstracted from considerations of the object world and the language user. Logic deals with the properties of language and reasoning that are independent of particular manners of interpretation and invariant over conceivable languages. Rhetoric treats those aspects of language and its use in reasoning that necessarily take the nature of the interpreter into consideration.
Natural languages are evolved for many purposes beyond their use in logical argumentation, and so any study of logic in a natural language context must sort out those aspects of natural language that are pertinent to its use in logic and those that are not.
English "and" has properties not captured by logical conjunction, because "and" can sometimes imply order. For example, "They got married and had a child" in common discourse means that the marriage came before the child. Then again the word "and" in common usage can imply a partition of a thing into parts, as "The American flag is red, white, and blue." Here it is not meant that the flag is at once red, white, and blue, but rather that it has a part of each color.
A minor issue of logic and language is the role of the word "but". Logically, the sentence "it's raining, but the sun is shining" is equivalent to "it's raining, and the sun is shining", so logically, "but" is equivalent to "and". However, "but" and "and" are semantically distinct in natural language. Speakers use "but", a conjunction of contradiction, to mark their surprise or reservation vis-a-vis a circumstance that goes against a trend.
One way to resolve this problem of correspondence between symbolic logic and natural language is to observe that the first sentence (using "but"), implies the existence of a hidden but mistaken assumption, namely that the sun does not shine when it rains. We might say that, given probability p that it rains and the sun shines, and probability 1 − p that it rains and the sun does not shine, or that it does not rain at all, we would say "but" in place of "and" when p was low enough to warrant our incredulity.
That implication captures the semantic difference of "and" and "but" without disturbing their logical equivalence. On the other hand, in Brazilian logic, the logical equivalence is broken between A BUT NOT B (where "BUT NOT" is a single operator) and A AND (NOT B), which is a weaker statement.
"But" is also sometimes disjunctive (It never rains but it pours); sometimes minutive (Canada has had but three shots on goal); sometimes contrastive (He was not God, but merely an exalted man); sometimes a spatial preposition (He's waiting but the house); and sometimes interjective (My, but that's a lovely boat). These uses await semantic assimilation with conjunctive "but".
Like "and", "but" is sometimes non-commutative: "He got here, but he got here late" is not equivalent to "He got here late, but he got here". This example shows also that unlike "and", "but" can be felicitously used to conjoin sentences that entail each other; compare "He got here late, and he got here".