Uploaded by manas.findme

Session 1

advertisement
Session 01 – Basic Concepts of Logic
Session 1
Introduction to Logic
Contents
Introduction, p 1
1.1. Propositions, p 1
1.2 Truth Tables, p 3
1.3. Logical connectives and compound propositions, p 5
Summary, p 12
Learning outcomes, p 13
Introduction
The basic concepts of mathematical logic will be discussed in this session,
together with the logical notations and assigning meanings to them.
Logic is crucial to many different branches of computer science, including
architecture (logic gates), software engineering (specification and
verification), programming languages (logic programming), databases
(relational algebra and SQL), artificial intelligence (automatic theorem
proving), algorithms (complexity and expressiveness), and theory of
computation (general notions of computability).
1.1 Propositions
Definition 1.1
A proposition is a declarative statement which is either true or false, but not
both simultaneously.
1
Session 01 – Basic Concepts of Logic
Example 1.1
The following are some examples of propositions.
1. Snow is white.
2. A triangles has three sides.
3. 2 + 5 > 9 .
4. This boy is wearing a red shirt.
5. It rained last night.
We can see that in example 1.1, propositions 1 and 2 are true, whereas
proposition 3 is false. The truth or falsity of proposition 4 depends on the
context in which it was stated. The truth or falsity of proposition 5 depends
on when and where it was stated.
The truth or falsity of a proposition is called its truth value and is denoted by
𝑇 (true) and F (false) respectively.
We use lowercase letters such as 𝑝, π‘ž, π‘Ÿ, … .
to denote propositions.
Example 1.2
𝑝: Snow is white.
π‘ž: This boy is wearing a red shirt.
Note that commands, requests, questions, and exclamations etc. are not
propositions since we cannot declare them as true of false.
Example 1.3
The followings are not propositions.
1. Do not bring mobile phones in to the examination hall.
2
Session 01 – Basic Concepts of Logic
2. Please bring me a cup of tea.
3. Did you forget to bring your umbrella?
4. Long live the king!
The propositions 1-5 in Example 1.1 are called simple propositions as they
make only a single statement. But a proposition can be made by combining
two or more statements which are simple propositions.
For example, let the proposition p be ‘if you study hard then you will pass
the examination’. If you carefully study the proposition 𝑝 you will see it
hides some of the sentences and their relation inside the proposition 𝑝.
We can identify that ‘you study hard’ and ‘you pass the examination’ are the
hidden sentences in 𝑝 which are two simple propositions.
Our language would tell us more if we could capture the relation between
the parts of a given proposition, instead of hiding them. In the next two
topics we will discuss how to connect/compound two simple propositions
and how to identify their truth value in detail.
1.2 Truth tables
We note that from the definition of propositional logic a proposition can have
only two possible values: either true or false. Here we will be presenting the
truth value of a proposition using a table that will later be helpful for our
further studies in logic. It is called a Truth table.
As we will see later, truth tables have three uses:
•
to provide the truth value for a sentence
•
to determine under what conditions a complex sentence is true or false
•
to determine if an argument is valid.
In this session we are describing only the first two uses only.
We will find the truth value of a statement by identifying all the simple
propositions that compose the statement and then on the left side of the table
we stipulate all the possible truth values of these simple propositions and
3
Session 01 – Basic Concepts of Logic
write these out. On the right side of the table, we then identify under what
conditions the sentence (that is composed by simple propositions) is true or
false.
Now let us consider the simplest situation which is, the proposition 𝑝 is a
simple proposition. So here the left side of the truth table gets only a single
simple proposition which take two possible truth values True (𝑇) or False(
𝐹 ) giving only two rows to the table.
𝑝
𝑇
𝐹
To complete the truth table, we place the dependent sentence on the top right
side and describe its truth value in relation to the truth value of its parts i.e.,
we want to identify the truth value of 𝑝 , which has only one part, 𝑝. The truth
table thus has the final form:
𝑝
𝑝
𝑇
𝑇
𝐹
𝐹
Now let 𝑝 be a statement that is made of two simple propositions π‘ž and π‘Ÿ .
Then we can write the truth table as below.
π‘ž
π‘Ÿ
𝑇
T
𝑇
𝑇
𝐹
𝑇
𝐹
𝐹
𝑝
4
Session 01 – Basic Concepts of Logic
First two column of the table gives us all the possible combinations of truth
values that can have by both simple propositions π‘ž and π‘Ÿ which is 4 totally.
Here we cannot complete the right side of the table since we do not know
how the proposition 𝑝 depends on simple propositions π‘ž and π‘Ÿ .
Under the next topic we will see how two propositions combined and how
their truth values represent using a truth table.
1.3 Logical connectives and compound propositions
Simple propositions can be combined with logical connectives to form
compound propositions representing various forms of complicated ideas.
Here, we will be using four commonly used logical connectives; ‘NOT’,
‘AND’, ‘OR’, ‘IF β‹― THEN β‹―’.
NOT (Notation: οƒ˜)
Logical connective ‘Not’ has the meaning of the word “not” in English.
Now let 𝑝 be a proposition. Then the compounded proposition ¬ 𝑝 is read
as “the negation of 𝑝” or “not 𝑝”.
Input
𝑝
𝑡𝑢𝑻
οƒ˜
Output
¬π‘
And it reverses the truth value of the proposition i.e., ¬ 𝑝 is true when 𝑝 is
false, and ¬ 𝑝 is false when p is true.
Example 1.4
1. Let p denote the proposition “the child is injured”. Then the ¬ 𝑝
can be written as “the child is not injured.”
5
Session 01 – Basic Concepts of Logic
2. Let q denote the proposition “all children are innocent”. Then ¬ π‘ž
states that “not all children are innocent” or “some children are not
innocent”.
This relationship between 𝑝 and ¬ 𝑝 is summarized in the following table
by giving the truth value of ¬ 𝑝 for all possible truth values of 𝑝.
Truth table of ¬ 𝑝
p
οƒ˜p
𝑇
𝐹
𝐹
𝑇
AND (Notation: )
Logical connective  has the meaning of the word “and” in English.
Now let propositions 𝑝 and π‘ž as our inputs. Then the compounded
proposition 𝑝 ∧ π‘ž read as “ 𝑝 and π‘ž”.
Input 1
𝒑
𝑨𝑡𝑫
Output
∧
𝒑∧𝒒
Input 2
𝒒
The compounded proposition 𝑝 ∧ π‘ž
are true. Otherwise, 𝑝 ∧ π‘ž is false.
will be true only when both p and q
Example 1.5
1. Let p be the proposition “student attends lectures” and π‘ž be “student
studies hard”. Then 𝑝 ∧ π‘ž means that the student attends lectures and
studies hard.
2. Let 𝑝 be the proposition “it is raining” and π‘ž be “it is lightning”.
Then 𝑝 ∧ π‘ž means that it is raining and lightning.
6
Session 01 – Basic Concepts of Logic
The corresponding truth table can be given as below.
Truth table of p ∧ π‘ž
P
Q
pq
𝑇
𝑇
𝑇
𝑇
𝐹
𝐹
𝐹
𝑇
𝐹
𝐹
𝐹
𝐹
Example 1.6
Let π‘Ÿ be the statement “I give you Rs 500 and I buy you a ticket to the
concert tonight”.
Then we can decompose this proposition as
𝑝 : I give you Rs 500
π‘ž : I buy you a ticket to the concert tonight.
Then we can present π‘Ÿ as 𝑝 ∧ π‘ž.
Now you can see the followings:
•
•
•
•
If I give you the money and also, I buy you the ticket, then I have
done as the statement r claims. So, that “I give you Rs 500 and I buy
you a ticket to the concert tonight” become true (represent the first
row in the truth table).
If I give you the money but I don’t buy you the ticket, then I have
violated my claim and so, it becomes false (represent the second row
in the truth table).
If I do not give you Rs 500, but I buy you a ticket for the concert still
make the statement r false (represent the third row in the truth table).
If I don’t give you money, and I don’t buy you a ticket then still I
have lied, and my claim become false (represent the fourth row in
the truth table).
7
Session 01 – Basic Concepts of Logic
OR (Notation: ∨)
Logical connective ∨ has the meaning of the word “inclusive or” in English.
Now let propositions 𝑝 and π‘ž as our inputs. Then the compound proposition
𝑝 ∨ π‘ž is read as “ 𝑝 or π‘ž”.
Input 1
𝒑
OR
∨
Input 2
𝒒
Output
𝒑∨𝒒
Then the compound proposition 𝑝 ∨ π‘ž will be true if at least one of 𝑝
π‘ž is true. Otherwise, 𝑝 ∨ π‘ž is false.
and
Example 1.7
Let 𝑝 be the proposition “it is raining” and π‘ž be “sprinkler is on”. Then
𝑝 ∧ π‘ž means that it is raining, or sprinkler is on (or both).
The corresponding truth table can be given as below.
Truth table of p ∧ π‘ž
𝑝
π‘ž
𝑝 ∨π‘ž
𝑇
𝑇
𝑇
𝑇
𝐹
𝑇
𝐹
𝑇
𝑇
𝐹
𝐹
𝐹
Example 1.8
Let π‘Ÿ be the statement “I give you Rs 500 or I buy you a ticket to the concert
tonight”.
8
Session 01 – Basic Concepts of Logic
Then we can decompose this proposition as 𝑝: I give you Rs 500, π‘ž : I buy
you a ticket to the concert tonight. Then we can present π‘Ÿ by 𝑝 ∨ π‘ž.
Now you can claim the followings:
•
•
•
•
If I give you the money and, I buy you the ticket, my claim that “I
give you Rs 500 or I buy you a ticket to the concert tonight” is true
(represent the first row in the truth table).
If I give you the money but I don’t buy you the ticket, and my claim
is still true (represent the second row in the truth table).
If I do not give you Rs 500, but I buy you a ticket for the concert do
still make the statement r true (represent the third row in the truth
table).
But if I don’t give you money, and I don’t buy you a ticket then I
have lied, and my claim become false (represent the fourth row in
the truth table).
IF β‹― THEN β‹― (Notation: →)
Logical connective → has the meaning of the word “if β‹―then β‹―” in
English.
Let 𝑝. and π‘ž. be propositions. Then the compound proposition 𝑝 → π‘ž is
read as “𝑝 implies π‘ž” or “if 𝑝 then π‘ž”.
Input 1
𝒑
Input 2
𝒒
IF β‹―THEN
β‹―
→
Output
𝒑→𝒒
The compound proposition 𝑝 → π‘ž will be false only when p is true and π‘ž
is false. Otherwise 𝑝 → π‘ž is true i.e., 𝑝 → π‘ž is true irrespective of the truth
value of π‘ž when 𝑝 is false.
Example 1.9
1. Let p be the proposition “sun is shining” and π‘ž be “sky is blue”.
Then 𝑝 → π‘ž means that if the sun is shining then the sky is blue.
9
Session 01 – Basic Concepts of Logic
2. Let 𝑝: it is raining, π‘ž: grass is wet. Then 𝑝 → π‘ž means that the grass
is wet whenever it is raining.
3. Let 𝑝: 2 + 3 = 6, snow is red. Then 𝑝 → π‘ž is true because 𝑝 is
false.
The corresponding truth table can be given as below.
Truth table of p → π‘ž
𝑝
π‘ž
𝑝→ π‘ž
𝑇
𝑇
𝑇
𝑇
𝐹
𝐹
𝐹
𝑇
𝑇
𝐹
𝐹
𝑇
Example 1.10
Let π‘Ÿ be the statement “if you give me Rs 500, then I will buy you a ticket to
the concert tonight”.
Then we can decompose this proposition as 𝑝: you give me Rs 500, π‘ž: I will
buy you a ticket to the concert tonight. Then we can present π‘Ÿ by 𝑝 → π‘ž.
Now you can claim the followings:
•
•
•
•
If you give me the money and I will buy you the ticket, my claim
that “If you give me Rs 500, then I will buy you a ticket to the
concert tonight” is true (represent the first row in the truth table).
if you give me the money and I don’t buy you the ticket, I lied, and
my claim is false (represent the second row in the truth table).
if you do not give me Rs 500, but I buy you a ticket for the concert
as a gift (represent the third row in the truth table).
if you don’t give me money, and I do not buy you a ticket also
perfectly consistent with my claim (represent the fourth row in the
truth table).
Note:
You might note here that the order of the proposition is matter in this
connectivity → while not in the previous connectivity’s  ,οƒš.
10
Session 01 – Basic Concepts of Logic
That is, the compounded proposition 𝑝 ∧ π‘ž is same as 𝑝 ∧ π‘ž q and 𝑝 ∨ π‘ž
is same as 𝑝 ∨ π‘ž but 𝑝 → π‘ž is not same as 𝑝 → π‘ž.
Example 1.11
1. Represent the scenario: “If the girl cries but is not sick then she does
not need a doctor.” as a compound proposition in propositional logic.
Answer:
First, we need to identify and symbolize the propositions present in the
given scenario. Let us define the propositions 𝑝, π‘ž and π‘Ÿ as:
𝑝: the girl cries.
π‘ž: girl is sick.
π‘Ÿ: girl needs a doctor.
Then the above scenario can be symbolized as (𝑝 ∧ (¬π‘ž)) → (¬π‘Ÿ)
2. With respect to the propositions defined in Example 1.11 (1),
express the compound proposition (¬ (π‘ž ∨ 𝑝)) → (¬π‘Ÿ) in natural
English.
Answer:
The girl does not need a doctor if she is neither sick nor cries.
Note:
The binding order of logical connectives from highest to lowest precedence
is as follows:
¬ ,∨ ,∧, →
We can omit unnecessary parentheses by using the binding order of
connectives. For example, the compound proposition in Example 1.11 (1)
can be written as 𝑝 ∧ ¬π‘ž → ¬π‘Ÿ.
11
Session 01 – Basic Concepts of Logic
But you may still use additional parentheses as you wish in order to
increase the clarity of your expressions.
Activity 1.1
Let 𝑝, π‘ž be the propositions. Find the truth values of 𝑝 → (𝑝 ∨ π‘ž) and (𝑝 ∨ π‘ž) → 𝑝 using
a same truth table.
Activity 1.2
Let p be the proposition “she is sick” π‘ž be “she is injured”, π‘Ÿ be “she needs a doctor.”
and s be “she needs a lawyer”.
1. Symbolize the following compound propositions:
i. She needs a lawyer or a doctor if she is sick or injured.
ii. She does not need a doctor or a lawyer if she is neither sick nor injured.
iii. If she needs a lawyer then she is both sick and injured.
iv. She needs a doctor only if she is sick.
2. Express the following compound propositions in natural English:
i. 𝑝 ∧ π‘ž
¬π‘Ÿ ∨ ( 𝑝 ∨ π‘ž )
ii.
iii. 𝑝 → (π‘ž → π‘Ÿ)
Answers to the Activity 1.1
Truth table for 𝑝 → (𝑝 ∨ π‘ž) and (𝑝 ∨ π‘ž) → 𝑝
𝑝
π‘ž
𝑝∨ π‘ž
𝑝 → (𝑝 ∨ π‘ž)
(𝑝 ∨ π‘ž) → 𝑝
𝑇
𝑇
𝑇
𝑇
𝑇
𝑇
𝐹
𝑇
𝑇
𝑇
𝐹
𝑇
𝑇
𝑇
𝐹
𝐹
𝐹
𝐹
𝑇
𝑇
12
Session 01 – Basic Concepts of Logic
Answers to the Activity 1.2
1.
i. (𝑝 ∨ π‘ž) → (𝑠 ∨ π‘Ÿ)
ii. οƒ˜(𝑝 ∨ π‘ž) → οƒ˜(𝑠 ∨ π‘Ÿ)
iii. 𝑠 → (𝑝 ∧ π‘ž)
iv. π‘Ÿ → 𝑝
2.
i. She is both sick and injured.
ii. She does not need a doctor unless she is sick or injured.
iii. If she is sick, if she is injured, then she needs a doctor.
Summary
Propositional logic, the simplest symbolic logic system, is based on
propositions which are declarative statements that are either true or false,
but not both. Compound propositions representing complex ideas can be
formed by combining propositions with logical connectives. Truth table is a
convenient way to check the truth or falsity of a compound proposition.
Learning outcomes
After studying this session, you should be able to
Express natural language sentences in symbolic language by means of
symbolization.
Explain the propositional logic system and its fundamentals.
Explain and exemplify the true value status of a proposition by constructing
a truth table.
References:
Craig DeLancey ; A Concise Introduction to Logic, Open SUNY Textbooks,
2017.
13
Download