0% found this document useful (0 votes)
28 views41 pages

From English To Propositional Logic

Uploaded by

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

From English To Propositional Logic

Uploaded by

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

Logic in Computer

Science

From English to Propositional Logic


Objectiv
es
Learn how to use propositional logic to model English
propositional sentences.

Understand the relationships between the English connectives


with the propositional logic connectives

Understand how to translate English statement into propositional


logic form
English to Propositional
Logic
Main idea for translating a collection of English sentences to a
statement in propositional logic (PL)

1. Read the passage in English and determine all significant units within the
passage.
1. Identify atomic propositions
2. Determine appropriate logical connectives based on recognizable keywords in
the English sentences
2. Set a scheme of abbreviation by assigning propositional letters of PL, such as p,
q, r,… to sentences of the passage you are translating, such as “John is tall.” or
“Mary is smart.”
3. Using the translation guides (to be presented in this lecture), translate the
sentences of English into formulas of PL.

From: Vaidya, Anand Jayprakash – San Jose State


Logic
Connectives Math ASCII
Unicode
 Negation ¬ ~
 Conjunction ∧ ^
 Disjunction ∨ V
 Implication → ->
 Bi-implication ↔ <->
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example

(1)
a. Clint went to the Chatterbox Cafe. If (1a) is represented as p,
b. Clint did not go to the Chatterbox Then (1b) is represented
Cafe. as ¬p
c. It is not the case that CO2-emissions are
being cut.

Let p = “CO2-emissions are


being cut” Then (1c) is
represented as ¬p
This PPT is adapted from Scott Martin, Ohio State University and Volker
Maximum Logical
Revelation
The Principle of Maximal Logical Revelation: Always
translate to reveal as much logical structure as the taget
language allows for.

•If the sentence is “John is not tall”,


• Set p to “John is tall” and translate as ¬p.
• Do not set p to “John is not tall”, since “not” can be translated
out with “¬”.
•If the sentence is “John is tall and Mary is smart”,
• Set p to “John is tall” and q to “Mary is smart” and translate as p

q.
Source: “Logic and Critical Reasoning”, Vaidya and
• Do not set p to “John is tall andErikson.
Mary is smart”, since “and” can
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Examples: The cat is not on the mat.

 Step 1: Identify the main proposition: The cat is on the mat.


Step 2: Identify negation: "not"
Step 3: Formulate the propositional logic:

 Let P represent "The cat is on the mat."

 The sentence can be translated as ¬P.

This PPT is adapted from Scott Martin, Ohio State University and Volker
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example 2: It is never the case that I will not go to the party.

Step 1: Identify the main proposition: I will go to the party.


Step 2: Identify negation: "never," "not"
Step 3: Formulate the propositional logic:

Let Q represent "I will go to the party."

The sentence can be translated as ¬(¬Q) or simply Q.

This PPT is adapted from Scott Martin, Ohio State University and Volker
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example 3: He is not only intelligent but also not hardworking.

Step 1: Identify the main propositions: He is intelligent, He is hardworking.


Step 2: Identify negation: "not," "not"
Step 3: Formulate the propositional logic:

Let A represent "He is intelligent."


Let B represent "He is hardworking."

The sentence can be translated as ¬A ∧ ¬B

This PPT is adapted from Scott Martin, Ohio State University and Volker
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example 4: She doesn't like coffee or tea.

Step 1: Identify the main propositions: She likes coffee, She likes tea.
Step 2: Identify negation: "doesn't," "or"
Step 3: Formulate the propositional logic:

Let C represent "She likes coffee."


Let T represent "She likes tea."

The sentence can be translated as ¬C∨¬T.

This PPT is adapted from Scott Martin, Ohio State University and Volker
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example 1: She was unable to finish the race.

• Step 1: Identify the negated action: Finish the race.


• Step 2: Formulate the propositional logic:

Let F represent "She finished the race."

The sentence can be translated as ¬F.

This PPT is adapted from Scott Martin, Ohio State University and Volker
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example 2: He was unwilling to participate in the project.

• Step 1: Identify the negated action: Participate in the project.

• Step 2: Formulate the propositional logic:

Let P represent "He participated in the project.“

The sentence can be translated as ¬P.

This PPT is adapted from Scott Martin, Ohio State University and Volker
Negati
on
Negation is easy to recognize because it almost always
includes the word not or morphemes like un-, ir-, etc.

Example 4: He is uncertain about the decision.

• Step 1: Identify the negated state: Certain about the decision.


• Step 2: Formulate the propositional logic:

Let C represent "He is certain about the decision."


The sentence can be translated as ¬C.

This PPT is adapted from Scott Martin, Ohio State University and Volker
Maximum Logical
Revelation
The Principle of Maximal Logical Revelation: Always
translate to reveal as much logical structure as the taget
language allows for.

If the sentence is “John is not tall”,


• set p to “John is tall” and translate as ¬p.
• Do not set p to “John is not tall”, since “not” can be translated
out with
“¬”.
• Search for not, ir-, un- in a sentence.
• Tina is irresponsive translates. Source: “Logic and Critical Reasoning”, Vaidya and
• Consider it as Tina is not responsive
Erikson. and translate to ¬r
Maximum Logical
Revelation
The Principle of Maximal Logical Revelation: Always
translate to reveal as much logical structure as the taget
language allows for.

• Search for not, ir-, un- in a sentence.


• Tina is irresponsive translates.
• Consider it as Tina is not responsive and translate to ¬r

Source: “Logic and Critical Reasoning”, Vaidya and


Erikson.
Conjuncti
on
Conjunction often involves the word and, and these cases are
typically easy to work with. In addition, it involves but, yet.

Example

Chao went to Dillons and Fred went to Best Buy


Let p = “Chao went to
Dillons” Let q = “Fred went to
Best Buy”
Then the claim is
Show all the recordsrepresented
in the data as
base
p ∧for
q people
that…older than 25 and who live in Manhattan
…are

Let p = “Age > 25”


Let q = “City = “Manhattan””
Then the selection criteria is represented as p
∧q
Conjuncti
on
Conjunction often involves the word and, and these cases are
typically easy to work with. In addition, it involves but, yet.

Words Indicating Conjunction:


• and
• Example: John likes tea and Mary prefers coffee.
• but
• Example: She is tired, but she is determined.
• yet
• Example: It was late, yet he continued working.
• while
• Example: She read a book while he watched TV.
Conjuncti
on
Conjunction often involves the word and, and these cases are
typically easy to work with. In addition, it involves but, yet, while.

Example 1: John likes both chocolate and vanilla ice cream.

Step 1: Identify the main propositions: John likes chocolate ice cream, John likes vanilla
ice cream.

Step 2: Formulate the propositional logic:

Let C represent "John likes chocolate ice cream."


Let V represent "John likes vanilla ice cream."

The sentence can be translated as C ∧ V.


Conjuncti
on
Conjunction often involves the word and, and these cases are
typically easy to work with. In addition, it involves but, yet, while.

Example 2: She enjoys both swimming and hiking, but she doesn’t like cycling.

Step 1: Identify the main propositions: She enjoys swimming, She enjoys hiking, She
doesn’t like cycling.

Step 2: Formulate the propositional logic:


• Let S represent "She enjoys swimming.“
• Let H represent "She enjoys hiking.“
• Let C represent "She likes cycling.“

Note: both is showing first you need to apply conjunction on S and H.

The sentence can be translated as (S∧H)∧¬C.


Conjuncti
on
Conjunction often involves the word and, and these cases are
typically easy to work with. In addition, it involves but, yet, while.

Example 3: He is intelligent, yet he is humble.

Step 1: Identify the main propositions: He is intelligent, He is humble.

Step 2: Formulate the propositional logic:


• Let I represent "He is intelligent.“
• Let H represent "He is humble."

The sentence can be translated as I∧H.


Conjuncti
on
Conjunction often involves the word and, and these cases are
typically easy to work with. In addition, it involves but, yet, while.

Example 4: She can play the piano, but she cannot play the guitar.

Step 1: Identify the main propositions: She can play the piano, She cannot play the
guitar.

Step 2: Formulate the propositional logic:


• Let P represent "She can play the piano.“
• Let G represent "She can play the guitar.“

The sentence can be translated as P∧¬G.


Conjuncti
on
Conjunction often involves the word and, and these cases are typically easy to
work with. In addition, it involves but, yet, while.

Example 2: She will go to the concert, but only if she finishes her assignment or her friend picks her up.
The intended meaning could be either:

• G∧(F∨P) (She will go to the concert, but only if she finishes her assignment or her friend picks her up.)

• (G∧F)∨P (She will go to the concert and finish her assignment, or her friend will pick her up.)

Here, the placement of parentheses determines whether both conditions (finishing the assignment and
her friend picking her up) are necessary for her to go to the concert or if each condition can
independently lead to her attending the concert.
Complex Sentences
Example: If I eat before the movie and the movie is too long, I might fall asleep.

The intended meaning could be either:

(E∧L)→A
(If I eat before the movie and the movie is too long, then I might fall asleep.)

E∧(L→A)
(If I eat before the movie, and if the movie is too long, then I might fall asleep.)

In the first interpretation, both conditions (eating before the movie and the movie being too long) must be
true for the possibility of falling asleep.

In the second interpretation, eating before the movie is a definite condition, and whether the movie being too
long leads to falling asleep is uncertain.

In each of these examples, adding parentheses clarifies the intended meaning, ensuring that the logical
relationships between the propositions are accurately represented.
Conjuncti
on
Both (usually together with and) can also be an indicator of
conjunction

Example
Both Chao and Fred have credit
cards
Let p = “Chao has a credit
card” Let q = “Fred has a
credit card”
Then the claim is
represented as p ∧ q
Consider the
Following
UI beat ISU in basketball, but ISU won in football.

I hiked 10 miles with a heavy backpack. Moreover, it was raining as


I hiked.
Venice is a beautiful city. However, the smell of the canals is a bit
distracting.

Words like but, moreover, however also join individual claims whose truth is
asserted (i.e., they can be translated as and), but they also “shade” the
interpretation for the listener/reader.

Such shading is lost in a translation to propositional logic. Source: Inspired by


“Logic and Critical
Reasoning”, Vaidya
and Erikson.
Consider the
Following
Axel Rose”s voice went out, and the crowd threw food on the
stage.
John discovered the cure for cancer and became famous.

Sometimes the use of and implies a temporal order or


causality.
Such aspects cannot be captured directly in propositional
logic.

Source: Inspired by “Logic and Critical Reasoning”, Vaidya and


Erikson.
Collective
Subject
Jane and Bill got
married.
…is not saying quite the same thing as
“Jane got married” and “Bill got married”.

June, July, and August make up the summer


recess.

Main point: Sometimes (e.g., when we have a collective subject) we


do not want to split things joined by and into separate propositions.

Source: Inspired by “Logic and Critical Reasoning”, Vaidya and


Erikson.
Conjuncti
 on
Conjunction sometimes involves the word and, but not always.
The following words can also be translated as conjunctions:

but, nonetheless, however, nevertheless, moreover, although,
whereas, …

Example

(2) Pastor Ingqvist is a Lutheran but Father Wilmer is not.

Let p = “Pastor Ingqvist is a


Lutheran” Let q = “Father
Wilmer is a Lutheran” Then (2) is
represented as p ∧ ¬q
Adapted from Scott Martin, Ohio State
University
Disjuncti
onDisjunction usually involves the word or


but need to distinguish between exclusive-or and
inclusive-or
Example (exclusive-or)
(3) a. You will either pass 301 or fail 301.
Let p = “You will pass Alternatively, we could infer
301” Let q = “You will that pass is the opposite of
fail 301” fail, and have a single
proposition.
Then (3a) is
represented as (p ∨ q)
∧ ¬(p ∧ q), in other
Example (inclusive-or)
words, only one of
these two propositions • In many English
(3) b. 301 is open either in Spring
can be true.
semester or Fall sentences, exclusive-or
semester. is intended
Let p = “301 is open in Spring
• However, in PL, the “or”
semester” Let q = “301 is open in connective is inclusive (so
Fall semester” the exclusion condition
Then (3b) is represented as p ∨ q, must be explicitly
in other words, both p and q can added).
This PPT is adapted from Scott Martin, Ohio State
Disjuncti
onDisjunction usually involves the word or


but need to distinguish between exclusive-or and
inclusive-or

Words Indicating Disjunction:


• or
• Example: He can choose tea or coffee.
• either...or (exclusive-or)
• Example: Either she will come early, or she won’t come at all.
• whether...or
• Example: He will buy a car, whether it’s new or used.
• nor
• Example: She neither reads books nor watches movies.
Disjuncti
onDisjunction usually involves the word or


but need to distinguish between exclusive-or and inclusive-or

Example 2: She likes neither cats nor dogs.

Step 1: Identify the main propositions: She likes cats, She likes dogs.
Step 2: Formulate the propositional logic:

• Let A represent "She likes cats."


Let B represent "She likes dogs."

The sentence can be translated as ¬A∧¬B


Consider the
Following
The system shall maintain the room temperature
within the target range unless a sensor fails.
The unless indicates an exceptional circumstance
where the requirement to maintain the temperature
does not apply.
Let p = “System maintains room temperature within
target range” Let q = “Sensor fails”
Then the requirement could be represented as p ∨ q

Note:
• It might be more natural to write ¬q → p (sensor not failing implies
system working).
• Since A → B is equivalent to ¬A ∨ B, so ¬q → p is
equivalent to ¬¬q ∨ p, which is equivalent to p ∨ q
Implicati
on
Implication is used to capture conditionality. The
following words can also be translated as implications:

if … then … , provided … that …, assuming, only if, given …
Example
a. Wally eats Powdermilk biscuits only if Evelyn makes Intuitively, this is actually
them. an “iff” condition, so our
English language
Let p = “Wally eats Powdermilk characterization of the
biscuits” Let q = “Evelyn makes situation is not adequate.
them” Assuming the literal
reading of the sentence
Then, intuitively, q → p is the intended one, the
b. You can login CS lab computer if you have a CS policy allows login also
account. in situations other than
having a CS account
Let p = “You can login CS lab (e.g., having an
computer” Let q = “You have a Engineering account)
CS account”
Then (4b) is represented as q → p
Adapted from Scott Martin, Ohio State
Double
implication
Double implication makes a stronger claim than the
conditional.
 The following words can be translated as double
implications:

if and only if, just in case, exactly when, …

Example

(5) You get A if andLet


only
p=if your
“You grade
get A”is above 90
Let q = “Your grade is above
90” Then (5) is represented
as p ↔
q (or, (p → q) ∧ (q → p), or
p = q) Adapted from Scott Martin, Ohio State
Exerci
se
Translate each of the following sentences to propositional logic
1. An item was not inserted into the queue.
2. An item can be removed from the queue only if the queue is non-empty.
3. A client must hold the lock on the queue to remove an item from the queue
4. The system shall ensure that the temperature is within the target range and
that camera acquires an image every second.
5. The system user authentication mechanism shall provide authentication via
user-id/password or via retina scan.
6. It is not the case that if the programmer position is open both Jill and Sheila will
apply.
7. Only if Jill applies for the position will Jay apply.
8. Neither Sam nor Alan will apply for the position if Jill applies.
Combinations of
Connectives
Example
a. Florian neither washed the car nor went to the mercantile.
Let p = “Florian washed the car”
Let q = “Florian went to the
mercantile” Then (a) is
represented as

¬(p ∨ q)

b. It”s not true that Clint owns both a Ford and a


Chevy dealership.
Let p = “Clint owns a Ford
dealership” Let q = “Clint owns a
Chevy dealership” Then (b) is
represented as

¬(p ∧ q)
Adapted from Scott Martin, Ohio State
Combinations of
Connectives
Example

a. I met my ex-girlfriend today and either she grew taller or I got


shorter.
Let p = “I met my ex-girlfriend
today” Let q = “She grew
taller”
Let r = “I got shorter”
Then (a) is represented as p ∧
(q ∨ r)
b. You get an A only if you score at least 50% on the midterm or you
submit a HW.
Let p = “You get an A”
Let q = “You score at least 50% on the
midterm” Let r = “You submit a HW”
Then (b) is represented as p → (q ∨
r)
Adapted from Alper Ungor, University of
Florida
Combinations of
Connectives
Example
d1. State the negation of “I am a doctor or a lawyer”.
d2. “I am not a doctor and I am not a lawyer.”
Let p = “I am a
doctor” Let q = “I
am a lawyer” d1:
¬(p ∨ q)
d2: ¬p ∧ ¬q
e1. State the negation of “She is rich and beautiful.”
e2. “She is either not rich or not beautiful”.

Let p = “She is rich”


Let q = “She is
beautiful” e1: ¬(p ∧
q)
e2: ¬p ∨ ¬q Adapted from Alper Ungor, University of
Florida
Combinations of
Connectives
Example

f. If Vettel finishes in the top 10 or Button doesn”t win, then


Vettel will become world champion.

Let p = “Vettel finishes in the


top 10” Let q = “Button wins”
Let r = “Vettel will become
world champion”
Then (f) is represented as
(p ∨ ¬q) → r
Summa
ry
English Propositional Logic
A and B | A but B | A; moreover/however, B A ∧ B
if A, then B | A implies B | A forces B A → B
A if B | A when B | A whenever B B → A
| only if A, B | B only if A
A exactly/precisely when B | A if and only if B A ↔ B | B ↔ A
A or B (or both) | A unless B A ∨ B | ¬ → A
B
either A or B (but not both) A ⊕ B |( A ∨B ) ∧ ¬( A ∧B )
Acknowledgem
ents
• The material in this lecture is based in part on the
following sources:
• “Logic and Critical Reasoning”, Vaidya and Erikson.
• Ideas and examples from Scott Martin, Ohio State University
• Examples from Volker Halbach, Oxford
• Examples from Alper Ungor, University of Florida

You might also like