Logic Symbols
| Symbol | Meaning |
|---|---|
| There exists | |
| For all | |
| p implies q (if p, then q) | |
| p if and only if q This is a connective, like | |
| p if and only if q (p and q are equivalent) (This is the same as ?) | |
| p is equivalent to q (equal, but for logic) This is a “fact”, like | |
| x is an element of A | |
| A is a subset of B | |
| Difference between set A and B | |
| ~p | NOT p (Negation) |
| AND | |
| OR | |
| Set to be a working copy of (not a logic symbol) |
Logic Laws
Commutative
Associative
Distributive
- applying twice: and vice versa
Identities
Universal Bound
Negation
Double Negative
Idempotent
Absorption
Implication
- (Can be deduced from the point above)
- no name for this: this is derived from implication law, distributive law, negation law and identity law
De Morgan’s
These laws can be extended to more than two variables
Logical Arguments
Definition
An argument (argument form) is a sequence of statements (statement forms). All statements in an argument, except for the final one are called premises (or assumptions or hypothesis). The final statement is called the conclusion The symbol, , which is read “therefore”, is normally placed before the conclusion.
Example Argument
Note: this argument is invalid
Valid or Invalid
To say that an argument is valid means that no matter what statements are substituted for the statement variables in its premises, if the resulting premises are all true, then the conclusion is also true. i.e. For an argument to be valid: IF all premises are true, THEN conclusion must be true
Test Validity with Truth Table
- Identify all the premises and conclusion of the argument form
- Construct a truth table showing the truth values of all the premises and the conclusion
- Identify critical rows: Rows in which all the premises are true
- There is a critical row in which the conclusion is false The argument form is valid
- The conclusion in every critical row is true The argument form is valid
Syllogism
An argument form consisting of two premises and a conclusion
Modus Ponens
This is a commonly used form of syllogism: if then
Modus Tollens
Also a commonly used form of syllogism: if then
Rules of Inference
Rules of Inference are Logical Arguments that are valid. Rules of Inference can be chained together to prove more complex logical arguments.
Modus Ponens
if then
Modus Tollens
if then
Generalisation
The conclusion is a more general form of the premise: Anton is a junior (More generally,) Anton is a junior or Anton is a senior
Specialisation
Discard extraneous information to concentrate on the property of interest Ana knows graph algorithms and Ana knows numerical analysis (In particular,) Ana knows graph algorithms
Elimination
When there are two possibilities and one can be ruled out, the other must be the case
Transitivity
Proof by Division into Cases
Suppose one thing or another is true If in both cases, a certain conclusion follows, this conclusion must also be true
Contradiction
Conjunction Premises
Conditional (if)
Statements of the form is called the hypothesis or antecedent is called the conclusion or consequent “if , then ” ” only if ” ” is a sufficient condition for ” ” is a necessary condition for “
Vacuously True
In the case that is false, is true (vacuously true or true by default)
Implication Law
(Can be deduced from above)
Variants of Conditional Statements
Contrapositive
The contrapositive of is The contrapositive of “if p then q” is “if ~q then ~p” A conditional statement is always logically equivalent to its contrapositive e.g. If Howard can swim across the lake, then Howard can swim to the island If Howard cannot swim to the island, then Howard cannot swim across the lake
Converse
The converse of is The converse of “if p then q” is “if q then p”
Inverse
The inverse of is The inverse of “if p then q” is “if ~p then ~q”
Notes
The converse of a conditional statement the inverse of the logical statement (They are contrapositive) Summary:
- conditional statement contrapositive
- converse inverse
- conditional statement converse
Biconditional (iff)
Statements of the form ” if and only if ” or ” iff ” ” is a necessary and sufficient condition for ”
Logic Connectives
Order of Operations
- ~ (Not)
- and are coequal in order of operation (for CS1231S)
- and are coequal in order of operation
Examples
is unambiguous is ambiguous
Not (Negation)
Symbol
~ (also )
Truth Table
| p | ~p |
|---|---|
| T | F |
| F | T |
And (Conjuction)
Symbol
Truth Table
| p | q | p q |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | F |
Or (Disjunction)
Symbol
Truth Table
| p | q | p q |
|---|---|---|
| T | T | T |
| T | F | T |
| F | T | T |
| F | F | F |
Xor
Symbol
(Not used for CS1231S)
Truth Table
| T | T | T | T | F | F |
| T | F | T | F | T | T |
| F | T | T | F | T | T |
| F | F | F | F | T | F |
Implies
Symbol
Truth Table
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
If and Only If
Symbol
Truth Table
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |
Logical Equivalence
Definition
Two statements are called logically equivalent iff they have identical truth values for each possible substitution of statements for their statement variables.
Notation
The logical equivalence of statement forms and is denoted by
How to Show Not
There are two ways to show that statement forms and are not logically equivalent:
Truth Table
Find at least one row where their truth values differ
Example
Show that and are not logically equivalent
| T | T | F | F | T | F | F |
| T | F | F | T | F | T | F |
| The last row of the table shows that they are not logically equivalent |
Counter example
Find concrete statements for each of the two forms, one of which is true and the other of which is false
Example
Show that and are not logically equivalent Let be true and be false Will evaluate to true Will evaluate to false Therefore, they cannot be logically equivalent
Quantified Statements
These are known as quantifiers
Universal Statement
Definition
Let be a predicate and the domain of A universal statement is a statement of the form "" i.e. Says that a certain property is true for ALL elements in a set
Example
All positive integers are greater than zero
Keywords
- All
- Every
- Any
Symbol
Negation
Negation of a universal statement (“all are”) existential statement (“some are not” / “there is at least one that is not”)
Notes
A value for for which is false is called a counterexample Implicit Quantification: Sometimes, quantification has to be inferred from context
- If then
- Is interpreted to mean: real numbers , (if then )
Conditional Statement
Definition
Says that IF one thing is true, THEN another thing also has to be true
Example
If 378 is divisible by 18, then 378 is divisible by 6
Keyword
if … then
Symbol
Universal Conditional Statement
Definition
Note: if not specified, “for all” is for the whole domain: , where is the domain of
Equivalent Forms
By changing the domain, a universal conditional statement can be converted to a universal statement: Suppose By narrowing to be the set of all values that make true, set ,
Negation
-(A) -(B) Substitute (B) into (A)
Vacuous Truth
is vacuously true or true by default iff is false for every in (or is an empty set)
Variants
Variants mentioned in Logical Conditional Statements can be extended to universal conditional statements They follow the same relations to each other (statement contrapositive etc.)
Existential Statement
Definition
Let be a predicate and the domain of An existential statement is a statement of the form "" Says that there is at least one thing for which the property is true
Example
There is a prime number that is even
Keywords
- There exists
- There is
- Some
Symbol
Negation
Negation of an existential statement (“some are”) universal statement (“none are” / “all are not”)
Notes
denotes “there exists a unique” or “there is one and only one”
Multiply Quantified Statements
Multiple quantifiers can be used for a single statement e.g.
Negation
Negate statements “from outside in”