intro to computer science module 2
DESCRIPTION
Revision uploaded March 14, 2014 This is module 2 of an introductory course that will introduce computer science and software engineering to the novice, and it is also a course that will teach even veteran computer scientists some new concepts, or explain concepts they thought they understood well. Concepts are introduced with hands on experience using object-oriented pseudo code (which can very easily be translated to C#, Java, C++, etc.) and functional programming pseudo code (which can easily be translated into F#, Erlang, Python, Haskell, etc.)TRANSCRIPT
![Page 1: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/1.jpg)
Foundations of Computer Science and Software Engineering
module 2/30
WALID S. SABA
![Page 2: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/2.jpg)
Foundations of Computer Science and Software Engineering
ALBERT EINSTIEN
TO THE TEACHER
![Page 3: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/3.jpg)
Foundations of Computer Science and Software Engineering
TO THE STUDENT
SOCRATES
![Page 4: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/4.jpg)
Foundations of Computer Science and Software Engineering
About this CourseThis is an introductory course that will introduce computer science and software engineering to the novice, and it is also a course that will teach even veteran computer scientists some new concepts, or explain concepts they thought they understood well. Concepts are introduced with hands on experience using object-oriented pseudo code (which can very easily be translated to C#, Java, C++, etc.) and functional programming pseudo code (which can easily be translated into F#, Erlang, Python, Haskell, etc.)
About the AuthorWalid Saba has 20 years of experience in information technology, where he worked at such places as the American Institutes for Research, AT&T Bell Labs, Metlife, Nortel Networks, IBM and Cognos. He has also spent 7 years in academia where he has taught computer science at Carelton University, the New Jersey Institute of Technology, the University of Windsor, and the American University of Beirut. He has published over 30 technical articles, including an award wining paper that he recieved at KI-2008 in Germany. Walid holds a PhD in Computer Science which he obtained from Carleton University in1999
![Page 5: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/5.jpg)
MODULE 2 (1 hour)
MATHEMATICAL PRILIMENARIES – LOGIC
Foundations of Computer Science and Software Engineering
![Page 6: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/6.jpg)
Introduction to Computer Science – Preliminaries
![Page 7: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/7.jpg)
Introduction to Computer Science – Preliminaries
![Page 8: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/8.jpg)
Introduction to Computer Science – Preliminaries
![Page 9: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/9.jpg)
Introduction to Computer Science – Preliminaries
Huh?
![Page 10: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/10.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Logic is a system of reasoning to systematically determine the soundness (or validity) of an argument
![Page 11: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/11.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
The simplest logical system is that of “propositional logic” – which is roughly equivalent to what is also known in computer science and computer engineering as “Boolean algebra”
Logic is a system of reasoning to systematically determine the soundness (or validity) of an argument
![Page 12: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/12.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Logic is a system of reasoning to systematically determine the soundness (or validity) of an argument
The simplest logical system is that of “propositional logic” – which is roughly equivalent to what is also known in computer science and computer engineering as “Boolean algebra”
Sentences (or declarative statements) that express or declare some proposition, are assigned the value True or False
![Page 13: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/13.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Sentences (or declarative statements) that express or declare some proposition, are assigned the value True or False
![Page 14: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/14.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Sentences (or declarative statements) that express or declare some proposition, are assigned the value True or False
Examples of sentences that can be assigned True or False:
![Page 15: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/15.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Sentences (or declarative statements) that express or declare some proposition, are assigned the value True or False
Examples of sentences that can be assigned True or False:
![Page 16: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/16.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Sentences (or declarative statements) that express or declare some proposition, are assigned the value True or False
Examples of sentences that can be assigned True or False:
![Page 17: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/17.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Sentences (or declarative statements) that express or declare some proposition, are assigned the value True or False
Examples of sentences that can be assigned True or False:
![Page 18: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/18.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
![Page 19: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/19.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
Everyone in France Speaks Chinese
The moon is made of cheese
Introduction to Computer Science – Preliminaries
![Page 20: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/20.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
Everyone in France Speaks ChineseANDThe moon is made of cheese
Introduction to Computer Science – Preliminaries
![Page 21: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/21.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
Everyone in France Speaks Chinese
The moon is made of cheese
Introduction to Computer Science – Preliminaries
![Page 22: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/22.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
Everyone in France Speaks ChineseORThe moon is made of cheese
Introduction to Computer Science – Preliminaries
![Page 23: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/23.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
If Everyone in France Speaks ChineseThen The moon is made of cheese
Introduction to Computer Science – Preliminaries
![Page 24: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/24.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
If Everyone in France Speaks ChineseThen The moon is made of cheese
Introduction to Computer Science – Preliminaries
![Page 25: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/25.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
Simple sentences (that are assigned a truth value such as True or False) can be combined into compound statements (that are also be assigned a truth value)
It is NOT True thatEveryone in France Speaks Chinese
Introduction to Computer Science – Preliminaries
![Page 26: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/26.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
If we have two propositions (sentences, or declarative statements), p and q, then we can say:
Introduction to Computer Science – Preliminaries
![Page 27: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/27.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
If we have two propositions (sentences, or declarative statements), p and q, then we can say:
Introduction to Computer Science – Preliminaries
![Page 28: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/28.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
If we have two propositions (sentences, or declarative statements), p and q, then we can say:
Introduction to Computer Science – Preliminaries
![Page 29: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/29.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
If we have two propositions (sentences, or declarative statements), p and q, then we can say:
Introduction to Computer Science – Preliminaries
![Page 30: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/30.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
If we have two propositions (sentences, or declarative statements), p and q, then we can say:
Introduction to Computer Science – Preliminaries
![Page 31: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/31.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
According to the above, we can make an infinite number of sentences, such as
Introduction to Computer Science – Preliminaries
![Page 32: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/32.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
But if we know the truth values of two simple sentences, how do we determine the truth value of a compound sentence?
TTFF
TFTF
TFFF
TTFF
TFTF
TTTF
TTFF
TFTF
TF
FT
TFTT
p and q is true whenboth are true, andfalse otherwise
p or q is true wheneither one is true, otherwise it is false
if p then q is false only when p is true and q is false
not p is false when p is true & true when p is false
Introduction to Computer Science – Preliminaries
![Page 33: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/33.jpg)
Propositional Logic
Introduction to Computer Science – Preliminaries
iff (if and only if), or as it is also called bi-directional if or equivalence
Introduction to Computer Science – Preliminaries
![Page 34: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/34.jpg)
Equivalence
Introduction to Computer Science – Preliminaries
Two formulas P and Q are equivalent iff (if and only if) they have the same truth value for every truth value assignment of their symbols. We write
Introduction to Computer Science – Preliminaries
![Page 35: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/35.jpg)
Equivalence
Introduction to Computer Science – Preliminaries
Two formulas P and Q are equivalent iff (if and only if) they have the same truth value for every truth value assignment of their symbols. We write
EXAMPLE
Introduction to Computer Science – Preliminaries
![Page 36: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/36.jpg)
Equivalence
Introduction to Computer Science – Preliminaries
All possible truth value assignments of P and Q
Two formulas P and Q are equivalent iff (if and only if) they have the same truth value for every truth value assignment of their symbols. We write
EXAMPLE
Introduction to Computer Science – Preliminaries
![Page 37: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/37.jpg)
Equivalence
Introduction to Computer Science – Preliminaries
All possible truth value assignments of P and Q
Two formulas P and Q are equivalent iff (if and only if) they have the same truth value for every truth value assignment of their symbols. We write
EXAMPLE
Introduction to Computer Science – Preliminaries
![Page 38: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/38.jpg)
Equivalence
Introduction to Computer Science – Preliminaries
All possible truth value assignments of P and Q
Two formulas P and Q are equivalent iff (if and only if) they have the same truth value for every truth value assignment of their symbols. We write
EXAMPLE
Introduction to Computer Science – Preliminaries
![Page 39: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/39.jpg)
Equivalence
Introduction to Computer Science – Preliminaries
All possible truth value assignments of P and Q
These two statements have the same truth value for every truth value assignment of P and Q, and thus they are equivalent
Two formulas P and Q are equivalent iff (if and only if) they have the same truth value for every truth value assignment of their symbols. We write
EXAMPLE
Introduction to Computer Science – Preliminaries
![Page 40: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/40.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
Introduction to Computer Science – Preliminaries
![Page 41: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/41.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Introduction to Computer Science – Preliminaries
![Page 42: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/42.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Let us try something more interesting. Is the following a valid formula?
Introduction to Computer Science – Preliminaries
![Page 43: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/43.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Let us try something more interesting. Is the following a valid formula?
It seems like this is a sound (valid) statement, since the formula states the following:
Introduction to Computer Science – Preliminaries
![Page 44: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/44.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Let us try something more interesting. Is the following a valid formula?
It seems like this is a sound (valid) statement, since the formula states the following:
saying it is not true that both p and q are true
Introduction to Computer Science – Preliminaries
![Page 45: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/45.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Let us try something more interesting. Is the following a valid formula?
It seems like this is a sound (valid) statement, since the formula states the following:
saying it is not true that both p and q are true is exactly like saying
Introduction to Computer Science – Preliminaries
![Page 46: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/46.jpg)
Introduction to Computer Science – Preliminaries
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Let us try something more interesting. Is the following a valid formula?
It seems like this is a sound (valid) statement, since the formula states the following:
saying it is not true that both p and q are true is exactly like saying either p is false or q is false
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
Introduction to Computer Science – Preliminaries
![Page 47: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/47.jpg)
Introduction to Computer Science – Preliminaries
ValidityA formula is valid if it is true for every possible truth assignment of its symbols. Or, a formula is valid if it cannot be made false for any truth assignment
AS A TRIVIAL EXAMPLE is a formula that is always true – cannot be false!
Let us try something more interesting. Is the following a valid formula?
It seems like this is a sound (valid) statement, since the formula states the following:
saying it is not true that both p and q are true is exactly like saying either p is false or q is false
Which seems reasonable
Introduction to Computer Science – Preliminaries
![Page 48: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/48.jpg)
Introduction to Computer Science – Preliminaries
ValidityWhile it sounds reasonable to claim that is a valid statement, we need to systematically check if this statement is true for every truth assignment of p and q
Introduction to Computer Science – Preliminaries
![Page 49: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/49.jpg)
Introduction to Computer Science – Preliminaries
ValidityWhile it sounds reasonable to claim that is a valid statement, we need to systematically check if this statement is true for every truth assignment of p and q
Introduction to Computer Science – Preliminaries
![Page 50: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/50.jpg)
Introduction to Computer Science – Preliminaries
ValidityWhile it sounds reasonable to claim that is a valid statement, we need to systematically check if this statement is true for every truth assignment of p and q
Introduction to Computer Science – Preliminaries
![Page 51: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/51.jpg)
Introduction to Computer Science – Preliminaries
ValidityWhile it sounds reasonable to claim that is a valid statement, we need to systematically check if this statement is true for every truth assignment of p and q
Introduction to Computer Science – Preliminaries
![Page 52: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/52.jpg)
Introduction to Computer Science – Preliminaries
ValidityWhile it sounds reasonable to claim that is a valid statement, we need to systematically check if this statement is true for every truth assignment of p and q
Introduction to Computer Science – Preliminaries
![Page 53: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/53.jpg)
Introduction to Computer Science – Preliminaries
ValidityWhile it sounds reasonable to claim that is a valid statement, we need to systematically check if this statement is true for every truth assignment of p and q
This statement is valid since it cannot be made false, or since it is true for every possible truth assignment of p and q
Introduction to Computer Science – Preliminaries
![Page 54: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/54.jpg)
Introduction to Computer Science – Preliminaries
SatisfiabilityA formula is satisfiable if there is at least one possible truth assignment that will make it true – otherwise, we say the formula is unsatisfiable
AS A TRIVIAL EXAMPLE is a formula that is satisfiable since it can be made true when p is true or when q is false
Introduction to Computer Science – Preliminaries
![Page 55: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/55.jpg)
Introduction to Computer Science – Preliminaries
SatisfiabilityA formula is satisfiable if there is at least one possible truth assignment that will make it true – otherwise, we say the formula is unsatisfiable
AS A TRIVIAL EXAMPLE is a formula that is satisfiable since it can be made true when p is true or when q is false
Now, is the formula satisfiable?
Introduction to Computer Science – Preliminaries
![Page 56: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/56.jpg)
Introduction to Computer Science – Preliminaries
SatisfiabilityA formula is satisfiable if there is at least one possible truth assignment that will make it true – otherwise, we say the formula is unsatisfiable
AS A TRIVIAL EXAMPLE is a formula that is satisfiable since it can be made true when p is true or when q is false
Now, is the formula satisfiable?
Are there truth values for r, p and q that will make it true?
Introduction to Computer Science – Preliminaries
![Page 57: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/57.jpg)
Introduction to Computer Science – Preliminaries
SatisfiabilityA formula is satisfiable if there is at least one possible truth assignment that will make it true – otherwise, we say the formula is unsatisfiable
AS A TRIVIAL EXAMPLE is a formula that is satisfiable since it can be made true when p is true or when q is false
Now, is the formula satisfiable?
Are there truth values for r, p and q that will make it true?If it can be made true, in how many ways?
Introduction to Computer Science – Preliminaries
![Page 58: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/58.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
Introduction to Computer Science – Preliminaries
![Page 59: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/59.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
This statement can be made true ...
Introduction to Computer Science – Preliminaries
![Page 60: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/60.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
If we have the following:
Introduction to Computer Science – Preliminaries
![Page 61: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/61.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
Which means we have the following:
Introduction to Computer Science – Preliminaries
![Page 62: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/62.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
The OR statement can be made true in three ways
Introduction to Computer Science – Preliminaries
![Page 63: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/63.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
So we have 3 possible ways to make our formula true (so it satisfiable in 3 ways)
Introduction to Computer Science – Preliminaries
![Page 64: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/64.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
So we have 3 possible ways to make our formula true (so it satisfiable in 3 ways)
An alternative to this process is to make the entire truth table and select at the end the rows for which the last formula comes out to be true.
For a formula with 3 symbols this might not be too much, but what if we had 6 or 10 symbols?
Introduction to Computer Science – Preliminaries
![Page 65: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/65.jpg)
Introduction to Computer Science – Preliminaries
Satisfiability
So we have 3 possible ways to make our formula true (so it satisfiable in 3 ways)
Try it out! Plug the different truth values of the three combinations we arrived at to see if the original formula comes out to be true!
Introduction to Computer Science – Preliminaries
![Page 66: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/66.jpg)
Applications of Propositional Logic
Introduction to Computer Science – Preliminaries
DIGITAL REPRESENTATION OF DECIMAL DIGITS
Every digit is displayed by turning some variables ON (true) and some variables OFF (false)
![Page 67: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/67.jpg)
Applications of Propositional Logic
Introduction to Computer Science – Preliminaries
DIGITAL REPRESENTATION OF DECIMAL DIGITS
Every digit is displayed by turning some variables ON (true) and some variables OFF (false)
![Page 68: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/68.jpg)
Applications of Propositional Logic
Introduction to Computer Science – Preliminaries
DIGITAL REPRESENTATION OF DECIMAL DIGITS
?
Every digit is displayed by turning some variables ON (true) and some variables OFF (false)
![Page 69: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/69.jpg)
Limitations of Propositional Logic
Introduction to Computer Science – Preliminaries
Consider the following declarative sentences:
![Page 70: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/70.jpg)
Limitations of Propositional Logic
Introduction to Computer Science – Preliminaries
Consider the following declarative sentences:
Assuming that p and q are true (that is, assuming we agreed that p and q are true), then r should follow from p and q. In other words this statement should be a valid (always true)
![Page 71: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/71.jpg)
Limitations of Propositional Logic
Introduction to Computer Science – Preliminaries
Consider the following declarative sentences:
Assuming that p and q are true (that is, assuming we agreed that p and q are true), then r should follow from p and q. In other words this statement should be a valid (always true)
But this statement is not valid – it is not true for all possible truth values of p, q and r
![Page 72: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/72.jpg)
Limitations of Propositional Logic
Introduction to Computer Science – Preliminaries
Consider the following declarative sentences:
Assuming that p and q are true (that is, assuming we agreed that p and q are true), then r should follow from p and q. In other words this statement should be a valid (always true)
But this statement is not valid – it is not true for all possible truth values of p, q and rWHAT WENT WRONG?
![Page 73: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/73.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
It turns out that certain valid inferences cannot be made in propositional logic, and a more powerful logic is needed
![Page 74: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/74.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
It turns out that certain valid inferences cannot be made in propositional logic, and a more powerful logic is needed
First-Order Logic (FOL), or the Predicate Calculus, as it is also called, introduces predicates, quantifiers and variables
![Page 75: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/75.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
It turns out that certain valid inferences cannot be made in propositional logic, and a more powerful logic is needed
First-Order Logic (FOL), or the Predicate Calculus, as it is also called, introduces predicates, quantifiers and variables
![Page 76: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/76.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Variables introduced by quantifiers have scope
![Page 77: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/77.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Variables introduced by quantifiers have scope
This is the scope of the variable x
![Page 78: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/78.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Variables introduced by quantifiers have scope
This is the scope of the variable x
This is the scope of the variable y
![Page 79: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/79.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Variables introduced by quantifiers have scope
This is the scope of the variable x
This is the scope of the variable y
Note that the scope of y is within the scope of x
![Page 80: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/80.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Variables introduced by quantifiers have scope
This is the scope of the variable x
This is the scope of the variable y
Note that the scope of y is within the scope of x
Later in the course we will see that the notion of introducing and defining variables in a certain scope in programming languages is exactly the same as that in first-order logic
![Page 81: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/81.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Example predicates
Is true if the square of x is y
![Page 82: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/82.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Example predicates
Is true if the square of x is y
Is true if x is positive
![Page 83: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/83.jpg)
First-Order Logic (FOL)
Introduction to Computer Science – Preliminaries
Example predicates
Is true if the square of x is y
Is true if x is positive
For any x and for any y, if y is the square of x, then y is positive
![Page 84: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/84.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inference Rules in Logic: Modus Ponens (MP)An important rule of inference in propositional logic is called modus ponens, which can be described as follows:
![Page 85: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/85.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
An important rule of inference in propositional logic is called modus ponens, which can be described as follows:
The rule says: if p implies q, and we can establish p, therefore we can conclude q.
Inference Rules in Logic: Modus Ponens (MP)
![Page 86: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/86.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
The modus ponens inference rule states the following: if p implies q, and p, then q
Inference Rules in Logic: Modus Ponens (MP)
![Page 87: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/87.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
The modus ponens inference rule states the following: if p implies q, and p, then q
The modus ponens inference rule is a valid inference rule, since it is true for all possible truth value assignments of p and q
Inference Rules in Logic: Modus Ponens (MP)
![Page 88: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/88.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
The modus ponens inference rule states the following: if p implies q, and p, then q
The modus ponens inference rule is a valid inference rule, since it is true for all possible truth value assignments of p and q
Inference Rules in Logic: Modus Ponens (MP)
![Page 89: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/89.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
The modus ponens inference rule states the following: if p implies q, and p, then q
The modus ponens inference rule is a valid inference rule, since it is true for all possible truth value assignments of p and q
Inference Rules in Logic: Modus Ponens (MP)
![Page 90: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/90.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
The modus ponens inference rule states the following: if p implies q, and p, then q
The modus ponens inference rule is a valid inference rule, since it is true for all possible truth value assignments of p and q
Inference Rules in Logic: Modus Ponens (MP)
![Page 91: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/91.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
The modus ponens inference rule states the following: if p implies q, and p, then q
The modus ponens inference rule is a valid inference rule, since it is true for all possible truth value assignments of p and q
Inference Rules in Logic: Modus Ponens (MP)
![Page 92: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/92.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Other Inference RulesOther basic but important inference rules include the following:
![Page 93: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/93.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Other Inference RulesOther basic but important inference rules include the following:
If p is true, and q is true, then we can infer (p and q)
![Page 94: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/94.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Other Inference RulesOther basic but important inference rules include the following:
If (p and q) is true, the we can infer p and we can infer q
If p is true, and q is true, then we can infer (p and q)
![Page 95: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/95.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Other Inference RulesOther basic but important inference rules include the following:
If (p and q) is true, the we can infer p and we can infer q
(elimination)if (not p or q) is true, and we know p is true, then q must be true
If p is true, and q is true, then we can infer (p and q)
![Page 96: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/96.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOLLet us now re-consider this argument and use first order logic to make this inference:
![Page 97: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/97.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOLLet us now re-consider this argument and use first order logic to make this inference:
Let us introduce these predicates:
True if x is a mathematician
True if x is clever
![Page 98: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/98.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOL
![Page 99: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/99.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOL
1.
![Page 100: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/100.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOL
1.
2.
![Page 101: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/101.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOL
1.
2.
3.
![Page 102: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/102.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Inferences in FOL
1.
2.
3.
4.
![Page 103: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/103.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning Let us see how we can use FOL in data and information representation and reasoning
Suppose we want to represent the blocks world depicted graphically below, where the goal is stack all the blocks from A (at the top) to E (at the bottom) and where the rule that we should follow is that a block cannot be placed on top of another block unless it precedes it alphabetically
![Page 104: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/104.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – predicates to describe the domain
![Page 105: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/105.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – predicates to describe the domain
![Page 106: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/106.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
If block x is not stacked, and block x precedes y, and block y is free, then block x can be placed on top of block y
Representing the domain – rules of movement
![Page 107: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/107.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – domain knowledge
If block x precedes y, and block y precedes z, then block x precedes block y
![Page 108: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/108.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – describing the state of affairs
![Page 109: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/109.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – describing the state of affairs
![Page 110: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/110.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – describing the state of affairs
![Page 111: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/111.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
Using FOL in Representation and Reasoning
Representing the domain – describing the state of affairs
![Page 112: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/112.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
FOL can be used to define sets and relations
As an example, let us define the predicate even
0 is even (or, that 0 is even is true!)
Any number is even if the one preceding it is not
![Page 113: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/113.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Let us test this definition
![Page 114: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/114.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Let us test this definition
![Page 115: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/115.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Let us test this definition
Check using the above definition of even if even(5) comes out to be true or false
![Page 116: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/116.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Let us test this definition
Later in the course you will see how we can write a simple function/program to test whether some input number is an even number of not
![Page 117: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/117.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Sets, which are unordered collections of objects, can be defined using predicates in FOL
The sets A and B have the same objects. A is defined intensionally, i.e., using logical formulas, and B is defined extensionally, i.e., by actually enumerating the actual objects
![Page 118: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/118.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Sets, which are unordered collections of objects, can be defined using predicates in FOL
The sets A and B have the same objects. A is defined intensionally, i.e., using logical formulas, and B is defined extensionally, i.e., by actually enumerating the actual objects
Define the set that would contain the elements {3, 7, 9, 11} without listing the elements but using the predicate even
![Page 119: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/119.jpg)
Introduction to Computer Science – PreliminariesIntroduction to Computer Science – Preliminaries
FOL in Computing Science
Sets, which are unordered collections of objects, can be defined using predicates in FOL
The sets A and B have the same objects. A is defined intensionally, i.e., using logical formulas, and B is defined extensionally, i.e., by actually enumerating the actual objects
Sets, relations (between sets) and functions will be the subject of the next module!
![Page 120: Intro to computer science module 2](https://reader036.vdocument.in/reader036/viewer/2022070313/55494eabb4c905f74e8b48a2/html5/thumbnails/120.jpg)
Introduction to Computer Science
END OF MODULE 2
MATHEMATICAL PRILIMENARIES – SETS, RELATIONS AND FUNCTIONSNext module