propositional and predicate logic at the end of this lecture you should be able to: distinguish...
TRANSCRIPT
![Page 1: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/1.jpg)
Propositional and predicate logic
At the end of this lecture you should be able to:
• distinguish between propositions and predicates;
• utilize and construct truth tables for a number of logical connectives;
• explain the three-valued logic system;
• determine whether two expressions are logically equivalent;
• explain the difference between bound and unbound variables;
• bind variables by substitution and by quantification.
![Page 2: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/2.jpg)
Propositions
In classical logic, propositions are statements that are either TRUE or FALSE.
Following are examples of propositions that evaluate to TRUE
There are seven days in a weekAccra is the capital of Ghana2 + 4 = 6
Following propositions evaluate to FALSE
The angles of a triangle add up to 360London is the capital of France2 - 4 = 7
![Page 3: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/3.jpg)
Using symbols
In mathematics we often represent a proposition symbolically by a variable name such as P or Q.
For example:
P : I go shopping on WednesdaysQ : 102.001 > 101.31
![Page 4: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/4.jpg)
Logical connectives
Propositions can be combined into compound statements by operators called logical connectives;
The purpose of defining these connectives is to provide precise meanings to such words as "and" and "or" that occur in the natural language;
The way we give semantic meaning to these connectives is to provide tables known as truth tables;
These give a value for every possible combination of the values of the individual statements that make up the compound proposition.
![Page 5: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/5.jpg)
Negation
the operation known as negation yields a proposition with a value opposite to that of the original one;
the operator in question is called the not operator;
it is represented by the symbol ¬;
if P is a proposition, then not P is represented by:
¬P
if P represented the statement I like dogs,
then ¬P represents the statement I do not like dogs.
![Page 6: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/6.jpg)
The truth table for the 'not' operator
P ¬P
T
TF
F
![Page 7: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/7.jpg)
The and operator
The operator known as and is represented by the symbol .
The statement P and Q is therefore represented by:
P Q
If P represents: I like shopping
and Q represents: The sun is shining
then P Q would represent the statement:
I like shopping and the sun is shining.
![Page 8: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/8.jpg)
The truth table for 'and'
P Q P Q
T T T
T
T
F F
F F
F F F
![Page 9: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/9.jpg)
The or operator
The operator known as or is represented by the symbol
;
The statement P or Q is therefore represented by:
P Q
If P represents: It is raining
and Q represents: Today is Tuesday
then P Q would represent the statement:
It is raining or today is Tuesday.
![Page 10: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/10.jpg)
The truth table for ‘or'
P Q P Q
T T T
T
T
F T
F T
F F F
![Page 11: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/11.jpg)
The truth table for 'exclusive or'
P Q P Q
T T F
T
T
F T
F T
F F F
![Page 12: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/12.jpg)
The implication operator
The implication operator attempts to give meaning to the expression P implies Q;
The implication operator is represented by the symbol
The statement P implies Q is therefore represented by:
P Q
An alternative way of expressing implication is if P then Q.
if P represents: It is Wednesday
and Q represents: I do the ironing
then P Q would represent the statement:
if it is Wednesday I do the ironing.
![Page 13: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/13.jpg)
The truth table for implication
P Q P Q
T T T
T
T
F F
F T
F F T
![Page 14: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/14.jpg)
The equivalence operator
The idea of equivalence deals with the "otherwise" part of implication;
This is analogous to an IF ... THEN ... ELSE statement in a programming language;
It is represented by the symbol .
Effectively it states:
if P is true then Q is true, otherwise Q is false;
in other words:
P is equivalent to Q, which is represented by:
P Q
![Page 15: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/15.jpg)
The truth table for equivalence
P Q P Q
T T T
T
T
F F
F F
F F T
![Page 16: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/16.jpg)
Three-valued logic
Both in the world of computing and the world of mathematics, occasions arise when it is not possible to evaluate expressions precisely;
For example, when somebody tried to evaluate the square root of a negative integer;
It is possible to account for such situations by defining a three-valued logic.
![Page 17: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/17.jpg)
Three valued truth table for ‘and’
P Q P Q
T T T
T F F
T Undefined Undefined
F T F
F F F
F Undefined F
Undefined T Undefined
Undefined F F
Undefined Undefined Undefined
![Page 18: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/18.jpg)
Compound statements Use brackets to avoid confusion
Illustration
Assume that
P represents the statement Physics is easyQ represents the statement Chemistry is interesting
then: ¬P Q would mean
Physics is not easy and chemistry is interesting.
And ¬(P Q) would mean
It is not true both that physics is easy and that chemistry is interesting.
![Page 19: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/19.jpg)
Logical equivalence
Two compound propositions are said to be logically equivalent if identical results are obtained from constructing their truth tables;
This is denoted by the symbol .
For example ¬ ¬P P
P ¬ P ¬ ¬ P
T TF
F T F
![Page 20: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/20.jpg)
Logical equivalence : a demonstration
(P Q) P Q
P Q P Q (P Q)
T
T
T
T
T T
T
T
F
F
F F
F
F
F
F
P Q P Q
T
T
T
F
T
T
T
T
F
F
F
F
![Page 21: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/21.jpg)
Tautologies
A statement which is always true (that is, all the rows of the truth table evaluate to true) is called a tautology.
For example, the following statement is a tautology:
P P
This can be seen from the truth table:
P ¬ P P P
T
T
T
FT
F
![Page 22: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/22.jpg)
Contradictions
A statement which is always false (i.e. all rows of the truth table evaluate to false) is called a contradiction.
For example, the following statement is a contradiction:
P P
Again, this can be seen from the truth table:
P ¬ P P P
T
F
F
FT
F
![Page 23: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/23.jpg)
Sets
The propositional logic allows us to argue about individual values, but it does not give us the ability to argue about sets of values.
A set is any well-defined, unordered, collection of objects;
For example we could refer to:
the set containing all the people who work in a particular office;
the set of whole numbers from 1 to 10;
the set of the days of the week;
the set of all the breeds of cat in the world.
![Page 24: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/24.jpg)
We often denote the name of the set by an upper case letter and the elements by lower case letters.
For example:
A = {s, d, f, h, k } B = {a, b, c, d, e, f}
the symbol means "is an element of".
the statement "d is an element of A" is written: d A
the statement "p is not an element of A" is written: p A
For the purpose of reasoning about sets of values, a more powerful tool than the propositional logic has been devised, namely the predicate logic;
Representing sets
![Page 25: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/25.jpg)
Predicates
A predicate is a truth valued expression containing free variables;
These allow the expression to be evaluated by giving different values to the variables;
Once the variables are evaluated they are said to be bound.
Examples
C(x): x is a catStudies(x,y): x studies yPrime(n): n is a prime number
![Page 26: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/26.jpg)
Binding Variables
Predicates such as those above do not yet have a value - they only have a value when the variables themselves are given a value;
There are two ways in which this can be done.
1. By substitution (giving a value to the variable)
2. By Quantification
![Page 27: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/27.jpg)
Substitution
C( x )
Studies( x , y )
Prime( x )
Simba ): Simba is a cat
Olawale, physics ): Olawale studies physics
3 ): 3 is a prime number
![Page 28: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/28.jpg)
Quantification
A quantifier is a mechanism for specifying an expression about a set of values;
There are three quantifiers that we can use, each with its own symbol:
The Universal Quantifier,
The Existential Quantifier
The Unique Existential Quantifier !
![Page 29: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/29.jpg)
The Universal Quantifier,
This quantifier enables a predicate to make a statement about all the elements in a particular set.;
For example:
If M(x) is the predicate x chases mice, we could write:
x Cats M(x)
this reads:
For all the x’s which are members of the set Cats, x chases mice
Or
All cats chase mice.
![Page 30: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/30.jpg)
The Existential Quantifier
In this case, a statement is made about whether or not at least one element of a set meets a particular criterion.
For example
if, P(n) is the predicate n is a prime number, we could write:
n P(n)
this reads:
There exists an n in the set of natural numbers such that n is a prime number
or
There exists at least one prime number in the set of natural numbers.
![Page 31: Propositional and predicate logic At the end of this lecture you should be able to: distinguish between propositions and predicates; utilize and construct](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e615503460f94b5c5e9/html5/thumbnails/31.jpg)
The Unique Existential Quantifier !
This quantifier modifies a predicate to make a statement about whether or not precisely one element of a set meets a particular criterion.
For example
If G(x) is the predicate x is green, we could write
!x Cats G(x)
this would mean:
There is one and only one cat that is green.