0% found this document useful (0 votes)
14 views35 pages

Lec 2

Uploaded by

h.khaled
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views35 pages

Lec 2

Uploaded by

h.khaled
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Introduction to Logic

Propositional Logic

Prof. Ammar Mohammed


Professor of Computer Sceince
Cairo University
Fall 2022
Agenda

Syntax of Propositional Logic


Propositional Constants
Logical Operators

Semantics
Truth Assignments for propositional constants
Meaning of logical operators

Evaluation
Truth Assignments to values of compound sentences

Satisfaction
Values of compound sentences to truth assignments
Truth Tables
Propositional Languages

A propositional vocablary is a set/sequence of primitive


symbols, called proposition constants.

Given a propositional vocabulary, a propositional


sentence is either (1) a member of the vocabulary or
(2) a compound expression formed from members of the
vocabulary and logical operators and parentheses.
(Details to follow.)

A propositional language is the set of all propositional


sentences that can be formed from a propositional
vocabulary.
Proposition Constants

By convention (in this course), proposition constants are


written as strings of alphanumeric characters beginning
with a lower case letter.
Examples:
raining
r32aining
rAiNiNg
rainingorsnowing
Non-Examples:
324567
raining.or.snowing
Compound Sentences (part I)

Negations:
¬raining
The argument of a negation is called the target.

Conjunctions:
(raining Ù snowing)
The arguments of a conjunction are called conjuncts.

Disjunctions:
(raining Ú snowing)
The arguments of a disjunction are called disjuncts.
Compound Sentences (part II)

Implications:
(raining Þ cloudy)
The left argument of an implication is the antecedent.
The right argument is the consequent.

Equivalences:
(cloudy Û raining)
Nested Compound Sentences

¬raining
(raining Ù snowing)
(raining Ú snowing)
(raining Þ cloudy)
(cloudy Û raining)

¬(raining Ù snowing)
((raining Ù snowing) Þ cloudy)
(cloudy Þ (raining Ù snowing))
((cloudy Ù wet) Û (raining Ú snowing))
(¬raining Þ (cloudy Þ snowing))
Parentheses Removal

Dropping Parentheses is good:

(p Ù q) ® p Ù q

But it can lead to ambiguities:

((p Ú q) Ù r) ® p Ú q Ù r

(p Ú (q Ù r)) ® p Ú q Ù r
Precedence

Parentheses can be dropped when the structure of an


expression can be determined by precedence.
¬
Ù
Ú
Þ
Û
An operand surrounded by operators associates with
operator of higher precedence.
¬p Ú q ® ((¬p) Ú q)
p Ú q Ù r ® (p Ú (q Ù r))
p Ù q Þ r ® ((p Ù q) Þ r)
p Þ q Û r ® ((p Þ q) Û r)
Precedence (continued)

If surrounded by two occurrences of Ù or Ú, the operand


associates with the operator to the left.

p Ù q Ù r ® ((p Ù q) Ù r)
p Ú q Ú r ® ((p Ú q) Ú r)

If surrounded by two occurrences of Þ or Û, the


operand associates with the operator to the right.

p Þ q Þ r ® (p Þ (q Þ r))
p Û q Û r ® (p Û (q Û r))
Natural Language Examples
Consider a propositional language with three proposition
constants—mushroom, purple, and poisonous—each
indicating the property suggested by its spelling. Using
these proposition constants, encode the following
English sentences as Propositional Logic sentences.

(a) All purple mushrooms are poisonous.


(b) A mushroom is poisonous only if it is purple.
(c) A mushroom is not poisonous unless it is purple.
(d) No purple mushroom is poisonous.
Natural Language Examples
Consider a propositional language with three proposition
constants—mushroom, purple, and poisonous—each
indicating the property suggested by its spelling. Using
these proposition constants, encode the following
English sentences as Propositional Logic sentences.

Vocabulary: purple, mushroom, poisonous


Natural Language Examples

Vocabulary: purple, mushroom, poisonous

Purple mushrooms are poisonous.


mushroom Ù purple Þ poisonous
mushroom Þ (purple Þ poisonous)
Natural Language Examples

Vocabulary: purple, mushroom, poisonous

A mushroom is poisonous only if it is purple.


mushroom Þ (¬purple Þ ¬poisonous)
mushroom Þ (poisonous Þ purple)
mushroom Ù poisonous Þ purple
Natural Language Examples

Vocabulary: purple, mushroom, poisonous

A mushroom is not poisonous unless it is purple.


mushroom Þ (¬purple Þ ¬poisonous)
mushroom Þ (poisonous Þ purple)
mushroom Ù poisonous Þ purple
Natural Language Examples

Vocabulary: purple, mushroom, poisonous

No purple mushroom is poisonous


¬(mushroom Ù poisonous Ù purple)
mushroom Ù poisonous Þ ¬purple
Propositional Interpretation

A propositional interpretation is an association between


the propositional constants in a propositional language
and the values T or F. (Later, written as 1 and 0.)

We sometimes view an interpretation as a Boolean vector


of values for the items in the signature of the language
(when the signature is ordered).

i = TFT
Sentential Interpretation

A sentential interpretation is an association between the


sentences in a propositional language and the truth values
T or F.

pi = T (p Ú q)i = T
qi = F (¬q Ú r)i = T
ri = T ((p Ú q) Ù (¬q Ú r))i = T

A propositional interpretation defines a sentential


interpretation by application of operator semantics.
Operator Semantics

Negation:

For example, if the interpretation of p is F, then the


interpretation of ¬p is T.

For example, if the interpretation of (pÙq) is T, then the


interpretation of ¬(pÙq) is F.
Operator Semantics (continued)

Conjunction: Disjunction:

NB: The type of disjunction here is called inclusive or,


which says that a disjunction is true if and only if at least
one of its disjuncts is true. This contrasts with exclusive
or, which says that a disjunction is true if and only if an
odd number of its disjuncts is true.
Operator Semantics (continued)

Implication:

NB: The semantics of implication here is called material


implication. Any implication is true if the antecedent is
false, whether or not there is a connection to the
consequent.
Operator Semantics (concluded)

Equivalence:
Evaluation

Interpretation i:

Compound Sentence
(p Ú q) Ù (¬q Ú r)
(T Ú F) Ù (¬F Ú T)
(T Ú F) Ù (T Ú T)
TÙT
T
Truth Tables
A truth table is a table of all possible interpretations
for the propositional constants in a language.

One column per constant.

One row per interpretation.

For a language with n constants,


there are 2n interpretations.
Evaluation versus Satisfaction

Evaluation:

Satisfaction:
Satisfaction
Method to find all propositional interpretations that
satisfy a given set of sentences:

(1) Form a truth table for the propositional constants.

(2) For each sentence in the set and each row in the truth
table, check whether the row satisfies the sentence. If
not, cross out the row.

(3) Any row remaining satisfies all sentences in the set.


(Note that there might be more than one.)
Satisfaction Example

qÞr
Satisfaction Example (continued)

qÞr

p ÞqÙr
Satisfaction Example (concluded)

qÞr

p ÞqÙr

¬r
EXAMPLE–NATURAL LANGUAGE

The following examples concern three properties of people, and


we assign a different proposition constant to each of these
properties. We use the constant c to mean that a person is cool.
We use the constant f to mean that a person is funny. And we
use the constant p to mean that a person is popular.
EXAMPLE–NATURAL LANGUAGE
consider the English sentence
- If a person is cool or funny, then he is popular.

- A person is popular only if he is either cool or funny

- A person is popular if and only if he is either cool or funny.

- There is no one who is both cool and funny.


EXAMPLE–NATURAL LANGUAGE
Suppose we were to imagine a person who is cool and funny
and popular, i.e., the proposition constants c and f and p are
all true.

- Evaluate the sentence

- Evaluate the sentence


EXAMPLE–NATURAL LANGUAGE
Suppose we were to imagine a person who is cool and funny
and popular, i.e., the proposition constants c and f and p are
all true.

- Evaluate the sentence


Exercise 1
Consider a truth assignment in which p is true, q is false, r is
true. Use this truth assignment to evaluate the following
sentences.
Exercise 2
Consider the sentences shown below. There are three
proposition constants here, meaning that there are eight
possible truth assignments. How many of these assignments
satisfy all of these sentences?

You might also like