Logical operation


A logical operation transforms individual propositions into compound propositions. Most logical operations are analogues to natural English expressions such as "not," "and," "or," and "if."

Here's the order in which logical operations should be evaluated:

  1. Parentheses
  2. Negation (\(\lnot\))
  3. Conjunction (\(\land\))
  4. Disjunction (\(\lor\))
  5. Any other logical operation (Parentheses should indicate order)

Logical operations can be unary or binary, meaning they operate on one or two propositions, respectively.

Contents

Negation


Negation is a unary logical operation that reverses the truth value of a proposition. The negation of a proposition \(p\) is denoted \(\lnot p\) and is read as "not \(p.\)"

\(p\) \(\lnot p\)
1 0
0 1

Conjunction


Conjunction is a binary logical operation that results in a compound proposition which is true if and only if the starting propositions are both true. The conjunction of propositions \(p\) and \(q\) is the proposition \(p \land q\) and is read "\(p\) and \(q\)". It is true only if both \(p\) and \(q\) are true, and false if \(p\) is false, \(q\) is false, or both \(p\) and \(q\) are false.

\(p\) \(q\) \(p \land q\)
1 1 1
1 0 0
0 1 0
0 0 0

"\(p\) and \(q\)," "\(p\) but \(q\)," "although \(p\), \(q\)," and "despite \(p\), \(q\)" are all conjunctions of \(p\) and \(q.\)

Disjunction


Disjunction is a binary logical operation that results in a compound proposition which is false if and only if the starting propositions are both false. The disjunction of propositions \(p\) and \(q\) is the proposition \(p \lor q\) and is read "\(p\) or \(q\)". It is false only if both \(p\) and \(q\) are false, and true if \(p\) is true, \(q\) is true, or both \(p\) and \(q\) are true.

\(p\) \(q\) \(p \lor q\)
1 1 1
1 0 1
0 1 1
0 0 0

The disjunction operation corresponds with the notion of an "inclusive or."

Exclusive disjunction


In conversation, when we say "or," we sometimes mean that only one of two options is true. But in a disjunction, both options are allowed to be true. To get rid of this ambiguity, the exclusive disjunction was created. Its truth table resembles disjunction with just one notable exception.

Exclusive disjunction is a binary logical operation that results in a compound proposition which is true if and only if the starting propositions have opposite truth values. The exclusive disjunction of propositions \(p\) and \(q\) is the proposition \(p \oplus q\) and is read "either \(p\) or \(q\)". It is true only if just \(p\) is true or just \(q\) is true, and false if both are true, or both are false.

\(p\) \(q\) \(p \oplus q\)
1 1 0
1 0 1
0 1 1
0 0 0

The exclusive disjunction operation corresponds with the notion of an "exclusive or."

Exclusive disjunctions aren't in any of the logic laws, so you may be understandably confused on how to simplify them. Look at the truth tables for exclusive disjunction and the biconditional operation and convince yourself that they are logically opposite. That is to say: \(p \oplus q \equiv \lnot(p \leftrightarrow q).\)

The conditional operation


The conditional operation, a.k.a. implication, is a directed binary logical operation that results in a compound proposition (a conditional proposition) which is false if and only if the first proposition, the hypothesis, is true, while the second proposition, the conclusion, is false. The conditional operation applied to propositions \(p\) and \(q\), in that order, results in the proposition \(p \rightarrow q\) and is read "if \(p\), then \(q\)". The proposition \(p \rightarrow q\) is false if and only if \(p\) is true and \(q\) is false, otherwise, it's true.

\(p\) \(q\) \(p \rightarrow q\)
1 1 1
1 0 0
0 1 1
0 0 1

The final two rows of the truth table are known as vacuous truths where the conclusion is shown to be true or false even though the hypothesis never took effect.

Notice that the choice of which proposition is first and which is second can affect the truth value of a conditional proposition. In other words, order matters here. \(p \rightarrow q\) and \(q \rightarrow p\) are not the same proposition.

For a conditional proposition \(p \rightarrow q\), its converse is \(q \rightarrow p\), its (logically equivalent) contrapositive is \(\lnot q \rightarrow \lnot p\), and its inverse is \(\lnot p \rightarrow \lnot q.\)

"If \(p\), then \(q\)," "\(q\) if \(p\)," "\(p\) implies \(q\)," "\(p\) only if \(q\)," "\(p\) is sufficient for \(q\)," and "\(q\) is necessary for \(p\)" are all implications where \(p\) is the hypothesis and \(q\) is the conclusion.

Example: "If it's a fish, then it can swim."

The biconditional operation


The biconditional operation is a binary logical operation that results in a compound proposition which is true if and only if the starting propositions have the same truth values. The biconditional operation applied to propositions \(p\) and \(q\) results in the proposition \(p \leftrightarrow q\) which is read "\(p\) if and only if \(q\)". The proposition \(p \leftrightarrow q\) is true if and only if \(p \equiv q.\)

\(p\) \(q\) \(p \leftrightarrow q\)
1 1 1
1 0 0
0 1 0
0 0 1

"\(p\) if and only if \(q\)," "\(p\) if \(q\) and \(q\) if \(p\)," "\(p\) is necessary and sufficient for \(q\)," "if \(p\) then \(q\), and conversely," and "\(p\) iff \(q\)" are all correct ways to write \(p \leftrightarrow q.\) The least ambiguous of these options is "\(p\) if \(q\) and \(q\) if \(p\)," which has the added benefit of showing you that if \(p \leftrightarrow q\) is true, \(p \rightarrow q\) and its converse \(q \rightarrow p\) are true. The biconditional operation is sort of like the conditional operation applied in both directions.

If \(p \leftrightarrow q\) is a tautology, then \(p\) causes \(q\), and \(q\) causes \(p.\) So then, one cannot be true without the other also being true. This notion of "if and only if" is used a lot in precise mathematical definitions, as you may have noticed!

Example: "I am breathing if and only if I am alive." Note that this is the same as "I'm alive if I'm breathing and I'm breathing if I'm alive."

⚠ It is not recommended to use "vice versa" to express a biconditional statement, even if you think it sounds cooler.

Alternative denial


Alternative denial, a.k.a. non-conjunction, is a binary logical operation that results in a compound proposition which is false if and only if the starting propositions are both true. The alternative denial of propositions \(p\) and \(q\) is the proposition \(p \uparrow q\) and is read "not both \(p\) and \(q\)". It is false only if both \(p\) and \(q\) are true, and true if \(p\) is false, \(q\) is false, or both \(p\) and \(q\) are false.

\(p\) \(q\) \(p \uparrow q\)
1 1 0
1 0 1
0 1 1
0 0 1

This operation is logically equivalent to the negation of conjunction. In particular, \(p \uparrow q \equiv \lnot (p \land q).\) Its symbol, \(\uparrow\) or \(|\), may be referred to as the Sheffer stroke.

⚠ Due to its ability to form a functionally complete formal system of logic, you can use alternative denial all by itself to form any compound proposition.
Logic & Proofs
IntegerRational numberInequalityReal numberTheoremProofStatementProof by exhaustionUniversal generalizationCounterexampleExistence proofExistential instantiationAxiomLogicTruthPropositionCompound propositionLogical operationLogical equivalenceTautologyContradictionLogic lawPredicateDomainQuantifierArgumentRule of inferenceLogical proofDirect proofProof by contrapositiveIrrational numberProof by contradictionProof by casesSummationDisjunctive normal form
Set Theory
SetElementEmpty setUniversal setSubsetPower setCartesian productStringBinary stringEmpty stringSet operationSet identitySet proof
Functions
FunctionFloor functionCeiling functionInverse function
Algorithms
AlgorithmPseudocodeCommandAsymptotic notationTime complexityAtomic operationBrute-force algorithm
Relations
RelationReflexive relationSymmetric relationTransitive relationRelation compositionEquivalence relationEquivalence class
Number Theory
Integer divisionLinear combinationDivision algorithmModular arithmeticPrime factorizationGreatest common divisorLeast common multiplePrimality testFactoring algorithmEuclid's theoremPrime number theoremEuclidean algorithm
Induction
Proof by inductionFibonacci sequenceProof by strong inductionWell-ordering principleSequenceFactorialRecursive definition
Combinatorics
Rule of productRule of sumBijection rulePermutationCombinationComplement ruleExperimentOutcomeSample spaceEventProbabilityProbability distributionUniform distributionMultisetSixfold wayInclusion-exclusion principlePigeonhole principle
Graph Theory
GraphWalkSubgraphRegular graphComplete graphEmpty graphCycle graphHypercube graphBipartite graphComponentEulerian circuitEulerian trailHamiltonian cycleHamiltonian pathTreeHuffman treeSubstringForestPath graphStarSpanning treeWeighted graphMinimum spanning treeGreedy algorithmPrim's algorithm
Recursion
RecursionRecursive algorithmCorrectness proofDivide-and-conquer algorithmSorting algorithmMerge sort