Week 8 - Predicate Logic B
4.201 De Morgan's law for quantifiers
- Intuition of In Set theory
- Often we must consider the negation of a quantified expression.
- Example
- : "All university's are connected to the network"
- : "There is at least one computer in the university operating on Linux"
- Intuitively
- The negation of S can be verified if there is at least one computer not connected to the network.
- The negation of P can be verified if all university computers are not operating on Linux.
- De Morgan's laws formalise these intuitions.
- De Morgan's Law for Quantifiers
- The rules for negating quantifiers can be summarised as:
- Example:
- Let S: "Every student of Computer Science has taken a course in Neural Networks"
- S can be expressed as:
- U = {students in CS}
- P(x) = "x has taken course in Neural Networks"
- The Negation of S:
- It is not the case that every student of CS has taken a course in Neural Networks.:
- This implies that: "There is at least one student who has not taken a course in Neural Networks."
- It is not the case that every student of CS has taken a course in Neural Networks.:
- Let S: "Every student of Computer Science has taken a course in Neural Networks"
- Example 2:
- Let R denote: "There is a student in CS who didn't take a course in ML"
- R can be expressed as:
- U = {students in CS}
- Q(x) = "x didn't take course in ML"
- The Negation of R:
- It is not the case that there is a student in CS who didn't take a course in ML
- This implies that: "every student in CS has taken a ML course."
- Let R denote: "There is a student in CS who didn't take a course in ML"
- The rules for negating quantifiers can be summarised as:
- Negating Nested Quantifiers
- For nested quantifiers: apply De Morgan's laws from left to right.
- Example
- Let denote propositional function of variables: x, y and z.
- is built by moving the negation of the right through all quantifiers and replacing each with and vice versa.
- Let denote propositional function of variables: x, y and z.
4.203 Rules of inference
- Argument (Logic)
- An argument in Propositional Logic is a sequence of Propositionlled the conclusion
- The other propositions in the argument are called premises or hypotheses.
-
- An argument is valid if the truth of all its premises implies the truth of the conclusion.
-
Example 1
- "If you have access to the internet, you can order a book on ML"
- "You have access to the internet"
- Therefore: "You can order a book on ML"
- The argument is valid:
-
All premises are true, so the conclusion must be true.
Access to internet Order a book on ML If you have access to the internet, order a book on ML 0 0 1 0 1 1 1 0 0 1 1 1
-
-
The only time that statment is true in row 4, it the time order a book on ML is true.
- Example 2
- "If you have acces to the internet, you can order a book on ML"
- "You can order a book on ML"
- Therefore: "You have access to the internet"
-
The argument is not valid:
- there are situations where premises are true and conclusion is false.
Access to internet Order a book on ML If you have access to the internet, order a book on ML 0 0 1 0 1 1 1 0 0 1 1 1
-
In row 2, the premise is true, but the conclusion is false.
- Rules of Inference
- Building blocks in constructing incrementally complex valid arguments.
- We can use truth table to figure out if argument is True or False but it's too laborious when you have lots of vars.
- If you have 8 propositional variables, you would need a truth table with rows.
- Rules of inference provide simpler way of proving the validity of arguments.
- Every rule of inference can be proved using a tautology.
- Modus ponens
- Tautology:
- The rule of inference:
- (if the conditional statement p implies q is true)
- (and the conditional statement is true)
- Then: (then the conclusion q is also true)
- Example:
- p: "It is snowing"
- q: "I will study Discrete Maths"
- "If it is snowing, I will study D.M."
- "It is snowing"
- Therefore: "I will study Discrete Maths"
- Modus tollens
- Tautology:
- The rule of inference:
- Then:
- Example:
- : It is snowing
- : I will study Discrete Maths
- "If it is snowing, I will study Discrete Maths"
- "I will not study Discrete Maths"
- Therefore: "It is not snowing"
- Conjunction
- Tautology:
- The rule of inference:
- Example:
- : I will study Programming.
- : I will study Discrete Maths."
- "I will study Programming."
- "I will study Discrete Maths"
- Therefore: "I will study Programming and Discrete Maths"
- Simplification
- Tautology:
- The rule of inference:
- Therefore:
- Example:
- : I will study Discrete Math
- : I will study Programming.
- I will study Discrete Math and programming.
- Therefore: "I will study Discrete Math"
- Addition
- Tautology:
- The rule of inference:
- Therefore:
- Example:
- : "I will visit Paris"
- : "I will study Discrete Math"
- "I will visit Paris"
- Therefore: "I will visit Paris or I will study Discrete Math"
- Hypothetical syllogism
- Tautology:
- The rule of inference:
- Therefore:
- Example:
- : It is snowing
- : I will study Discrete Maths
- If it is snowing, I will study Discrete Math.
- If I study Discrete Math, I will pass the quizzes.
- Therefore: if it is snowing, I will pass the quizzes.
- Disjunctive syllogism
- Tautology:
- The rule of inference:
- Therefore:
- Example:
- : I will study Discrete Maths
- : I will study Art.
- "I will study Discrete Maths or I will study Art"
- "I will not study Discrete Maths"
- Therefore: "I will study art"
- Resolution
- Tautology:
- The rule of inference:
- Therefore:
- Example:
- : It is raining.
- : It is snowing.
- : It is cold.
- "It is raining or it is snowing."
- "It is not raining or it is cold."
- Therefore: "It is snowing or it is cold."
- Building Valid Arguments
- To build a valid argument, we need to follow these steps:
- If initially written as English, transform into argument form by choosing a variable for each simple proposition.
- Start with the hypothesis of the argument
- Build a sequence of steps in which each step follows from the previous step by applying:
- rules of inference.
- laws of logic.
- The final step of the argument is the conclusion.
- Example 1
- Building a valid argument from these premises:
- "It is not cold tonight"
- "We will go to the theatre only if it is cold."
- "If we do not go to the theatre, we will watch a movie at home."
- "If we watch a movie at home, we will need to make popcorn."
- Prop variables:
- p: It is cold tonight.
- q: We will go to the theatre.
- r: We will watch a movie at home.
- s: We will need to make popcorn.
- : It is not cold tonight.
- : We will go to the theatre only if it is cold.
- : If we do not go to the theatre, we will watch a movie at home.
- : If we watch a movie at home, we will need to make popcorn.
- Building a valid argument from these premises:
- Example 2
-
- - Hypothesis
-
- - Hypothesis
-
- - Modus tollens 1, 2
-
- - Hypothesis
-
- - Modus ponens 3,4
-
- - Hypothesis.
-
- - Modus ponens 5, 6
- Conclusion: we will need to make popcorn.
-
- To build a valid argument, we need to follow these steps:
- Logical Fallacies
- A fallacy is the use of incorrect argument when reasoning
- Formal fallacies can be expressed in propositional logic and proved to be incorrect.
- Some of the widely use formal fallacies are:
- affirming the consequent
- a conclusion that denies premises
- contradictory premises
- denying the antecedent
- existential fallacy
- exclusive premises
- Example
- Consider the argument:
- If you have internet acces, you can order this book.
- You can order this book.
- Therefore, you have internet access.
- This argument can be formalised as: if and then
- Where
- : You have internet access
- : You can order this book
- The proposition is not a tautology, because it is false when p is false and q is true.
- This is an incorrect argument using the fallacy of affirming the consequent (or conclusion).
- Consider the argument:
4.205 Rules of inference with quantifiers
- Rules of Inference with Quantifiers
- Previously introduced rules of inference for propositions.
- Now describe important rules of inference for statements involving quantifiers.
- These rules of inference remove or reintroduce quantifiers within a statement.
- Universal Instantiation (UI)
- The rule of inference:
- Example:
- All comp science students study discrete maths.
- Therefore, John, who is a computer science student, studies discrete math.
- The rule of inference:
- Universal Generalization (UG)
- The rule of inference:
- for an arbitrary element of the domain.
- Example:
- DS = {all data science students}
- Let c be an arbitrary element in DS.
- c studies ML.
- Therefore , studies ML.
- The rule of inference:
- Existential Instantiation (EI)
- The rule of inference:
- for some element of the domain.
- Example:
- DS = {all data science students}
- There exists a student of data science who uses Python Pandas Library.
- Therefore, there is a student who is using Pandas.
- The rule of inference:
- Existential Generalization (EG)
- The rule of inference: * for some element of the domain. * Therefore,
- Example:
- DS = {all data science students}
- John, a student of data science, got a A in ML.
- Therefore, there exists someone in DS who got an A in ML.
- Universal Modus Ponens
- The rule of inference:
- for some element of the domain.
- Example:
- DS = {all comp sci students}
- Every computer science student studying data science will study ML.
- John is a computer science student studying data sciecnce.
- Therefore, John will study ML.
- The rule of inference:
- Universal Modus Tollens
- The rule of inference:
- for some element of the domain.
- Example
- CS = {all computer science students}
- Every computer science student studying data science will study machine learning.
- John is not studying machine learning.
- Therefore, John is not studying data science.
- The rule of inference:
- Expressing complex statements
- Given a statement in natural language, we can formalise it using the following steps as appropriate:
-
- Determine the universe of discourse of variables.
-
- Reformulate the statements by making "for all" and "there exists" explicit
-
- Reformulate the satement by introducing variavbles and defining predicates.
-
- Reformulate the statement by introducing quantifiers and logical operations.
-
- Example 1
- Express the statement S: "There exists a real number between any two not equal real numbers".
- The universe of discourse is: real numbers.
- Introduce variables and predicates:
- "For all real numbers x and y, there exists z between x and y."
- Introduce quantifiers and logical operations:
- if then where
- Example 2
- Express the statement S: "every student has taken a course in machine learning".
- The expression will depend on the choice of the universe of discourse.
- Case 1: U = {all students}
- Let M(x) be: "x has taken a course in ML."
- S can be expressed as:
- Case 2: U = {all people}
- Let S(x) be: "x is a student" and M(x) the same as in case 1
- S can be expressed as
- Note: is not correct.
- Example 3
- Express the statement S: "some student has taken a course in machine learning".
- The expression will depend on the choice of the universe of discourse.
- Case 1: U = {all students}
- Let M(x) be: "x has taken a course in ML."
- S can be expressed as:
- Case 2: U = {all people}
- Let S(x) be: "x is a student" and M(x) the same as in case 1.
- S can be expressed as
- Note: is not correct.
- Express the statement S: "some student has taken a course in machine learning".
- Given a statement in natural language, we can formalise it using the following steps as appropriate:
Problem sheets
Question 1.
Let be the predicate "$x^2 > x$" with the domain the set of all real numbers. Write , , and and indicate which are true and false.
Question 2.
Let be the predicate "$x^2 > x$" with the domain the set of of all real numbers.
What are the values and ?
Question 3.
-
Let D = {1, 2, 3, 4} and consider the following statement: . Write one way to read this statement and show that it is true.
-
,
- ,
- ,
- ,
The statement is true for all , hence it is true.
,
Question 4.
-
Consider the following statement:
such that
Write one way to read this statement, and show that is it true.
, , therefore, the statement is true.
-
Let and consider the following statement:
, , , ,
Therefore, the statement is false.
Question 5.
Rewrite each of the statements formally, using quantifiers and variables.
- All triangles have three sides.
, has 3 sides (where is the set of all triangles).
- No dogs have wings.
, doesn't have wings (where is the set of all dogs).
- Some programs are structured.
, is a structured program (where is the set of all programs).
Question 6.
Rewrite the following statements in form of if then ___
- If a real number is an integer, then it is a rational number.
real number , if is an integer, then is a rational number.
- All bytes have eight bits.
, if is a byte, then has eight bits.
- No fire trucks are green.
, if is a fire truck, then is not green.
Question 7.
A prime number is an integer greater than 1 whose only positive integer factors are itself and 1.
Consider the following predicate Prime(n): n is prime and Even(n): n is even.
Use the notation Prime(n) and Even(n) to rewrite the following statement: "There is an integer that is both prime and even"
such that
Question 8.
Determine the truth value of each of the following where : , where and are real numbers:
This is false as there exists, where and , such that P(1, 1) is false.
True. There exists where and such that P(x, y) is true.
True. For all there exists with
False. There is no that doesn't have a that is smaller than .
Question 9.
Let P(x) denote the statement x is taking discrete math.
The domain of discourse is the set of all students.
Write the statements in words:
- every student is taking the Discrete Maths course. - every student is not taking a Discrete Maths course. - it is not the case that every student is taking the Discrete Maths course. - there exists one student who is taking a Discrete Maths course. - some student is not taking a Discrete Maths course. - no student is taking a Discrete Maths course.
Question 10.
Let P(x) denote the statement 'x is a professional athelete' and let Q(x) denote the statement "x plays football".
The domain of discourse is the set of all people.
Write the following in words:
Every professional athlete plays football.
Either someone does not play football or some football player is a pro athlete.
Every one is a professional athlete and plays football.
Question 11.
Let denote the statment "x is a professional athlete" and let denote the statement "x plays football".
The domain of dis-course is teh set of all people.
Write the negation of each proposition symbolically and in words.
There are people who are professional athletes that don't play football.
It is not the case that if you play football you are a professional athere.
There are people who are either not profressional athleses or not football players.
Question 12.
Let and denote the propositional functions:
P(x): x is greater than 2. Q(x): x^2 is greater than 4.
where, the universe of discourse for both P(x) and Q(x) is the set of real number,
- Use quantifiers and logical operators to write the following statement formally:
"if a real number is greater than 2, then its square is greater than 4"
- Write a formal and informal contrapositive, converse and inverse of the statement above in (1).
Contrapositive:
If the square of x is not greater than 4, then x is not greater than 2.
Converse:
If the square of x is greater than 4, than x is greater than 2.
Inverse:
If x is less than or equal to 2, then the square of x is less than or equal to 4.
Question 13.
Rewrite each of the following statements in English as simply as possible without using the symbols or variables.
- color , an animal such that is colored .
For every colour, we can find an animal that has that colour.
- a book such that person , has read .
There is at least one book that every person has read.
- odd integer , an integer such that
For every odd integer , there is an integer k where
- , a real number such that
For every read number x, there is another number y where adding them together gives 0.
Question 14.
Rewrite the statement "No good cars are cheap" in the form if then
if is a good car, then is NOT cheap.
Indicate whether each of the following arguments is valid or invalid and justify your answers.
- No good cars are cheap A Ferrari is a good car. A Ferrari is not cheap
This is a valid argument using Universal Modus Ponens or Universal Instantiation (UI)
- No good cars are cheap. A BMW is not cheap. a BMW is not a good car.
This is invalid. Converse error.
Question 15.
Let x be any student and C(x), B(x) and P(x) be the following statements:
C(x): “x is in this class“. B(x): “x has read the book”. P(x): “x has passed the first exam”.
Rewrite the following symbolically and state whether it a valid argument.
A student in this class has not read the book
Everyone in this class passed the first exam
∴ Someone who passed the first exam has not read the book
This is valid (not sure why).
4.209 Predicate logic - Peer-graded
Question
Use the following rules of inference: existential instantiation, universal instantiation, disjunctive syllogism, modus tollens and existential generalisation to show that:
if:
Hypothesis 1: Hypothesis 2: Hypothesis 3: Hypothesis 4 : are true
then:
Conclusion: is true.
Answer
We can use the following steps:
- Existential instantiation: Since is true, there exists some specific object such that .
- Universal instantiation: Since is true, we can instantiate this to
- Disjunctive syllogism: Since we know that from step 1, and from step 2, we can conclude that must be true.
- Universal instantiation: Since , we can instantiate this to .
- Disjunctive syllogism: since we know that is true from step 3, and is true, we can conclude that must be true.
- Universal instantiation: since is true, we can instantiate this to
- Modus tollens: since we know that is true from step 5, and from step 6, we can conclude that must be true.
- Existential generalisation: Since is true for a specific object , we can conclude that is true.