Translating Sentences into Logical Expressions and Solving Puzzles - Prof. Alper Ungor, Assignments of Computer Science

A series of lectures notes from the cot3100: propositional equivalences course taught by alper ¨ung"or in january 2007. The notes cover various topics related to propositional logic, including translating natural language sentences into logical expressions, solving puzzles using propositional logic, and understanding tautologies, contradictions, and equivalences. The notes provide examples and explanations of how to apply these concepts, as well as truth tables to determine logical equivalences.

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-ve3
koofers-user-ve3 🇺🇸

10 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COT3100: Propositional Equivalences 1
Logic and Proofs
Alper ¨
Ung¨
or
Jan 2007
COT3100: Applications of Discrete Structures Jan 2007
Alper ¨
Ung¨
or
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Translating Sentences into Logical Expressions and Solving Puzzles - Prof. Alper Ungor and more Assignments Computer Science in PDF only on Docsity!

COT3100: Propositional Equivalences

1

Logic and Proofs

Alper ¨

Ung ¨

or

Jan 2007

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

2

1 – Translating from Natural Languages

E XAMPLE

. Translate the following sentence into a logical expression: p “I met my ex-girlfriend today and either she grew taller or I got shorter.”

= “I met my ex-girlfriend today.”

q

= “She grew taller.”

r

= “I got shorter.”

p ∧ ( q ∨ r ) p

q

r

would mean something else:

p “I got shorter or I met my ex-girlfriend today and she grew taller”

∧ ( q ⊕ r )

would also mean something else...

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

4

2 – Solving Puzzles using Propositional Logic

E XAMPLE

. An island has two types of inhabitants: knights, who always tell the truth, and

“Bob is a knight” and Bob says “The two of us are opposite types.”knaves, who always lie. You meet two people from this island: Alice and Bob. Alice says

Let

p = “Alice is a knight.”

p = “Alice is a knave.”

Let

q = “Bob is a knight.”

q = “Bob is a knave.”

Alice said

q

and Bob said

p

q .

Island Rule:

Alice is a knight iff what she said is true and Bob is a knight iff what he said

is true.

( p ↔ q ) ∧ ( q ↔ ( p ⊕ q

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

5

Let

p = “Alice is a knight.”

p = “Alice is a knave.”

Let

q = “Bob is a knight.”

q = “Bob is a knave.”

Alice said

q

and Bob said

p

q .

Island Rule:

Alice is a knight iff what she said is true and Bob is a knight iff what he said

is true.

( p ↔ q ) ∧ ( q ↔ ( p ⊕ q

Alice said

Bob said

Island rule

p q ¬ p ¬ q p ⊕ q ( p ↔ q ) ∧ ( q ↔ ( p ⊕ q

T T F F F F T F F T T F F T T F T F F F T T F T Hence, Both Alice and Bob are knaves.

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

7

4 – Equivalence

The compound propositions

p

and

q

are called

logically equivalent

, denoted by

p

q , if

p

q

is a tautology.

Remark:

The symbol

is not a logical connective and

p

q

is not a compound

proposition but rather is the statement that

p

q

is a tautology.

equivalent if their columns in the truth table are the same.Use truth tables to determine logical equivalences. Two compound propositions are

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

8

5 – Proving De Morgan Laws

E XAMPLE

. State the negation of “I am a doctor or a lawyer.” “I am not a doctor and I am not a lawyer.”

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

10

6 – Equivalence Example

E XAMPLE

. “If you are a freshman you can get a free ticket” “Either you are not a freshman or you can get a free ticket.”

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

11

7 – Distributive Law

p ∨ ( q ∧ r ) ≡ ( p ∨ q ) ∧ ( p ∨ r ) p ∧ ( q ∨ r ) ≡ ( p ∧ q ) ∨ ( p ∧ r )

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

13

Equivalence

Name

p (^) ∨

( q ∨ r ) ≡ ( p

(^) ∨

(^) q ) ∨ (^) r

Associative Laws

p (^) ∧

( q ∧ r ) ≡ ( p

(^) ∧

(^) q ) ∧ (^) r

p (^) ∨

( q ∧ r ) ≡ ( p

(^) ∨

(^) q ) ∧ (^) ( p (^) ∨

r )

Distributive Laws

p (^) ∧

( q ∨ r ) ≡ ( p

(^) ∧

(^) q ) ∨ (^) ( p (^) ∧

r )

¬ ( p (^) ∨

q ) ≡ ¬

p ∧ ¬

q

De Morgan Laws

¬ ( p (^) ∧

q ) ≡ ¬

p ∨ ¬

q

p (^) ∨

( p ∧ (^) q ) ≡

p

Absorption Laws

p (^) ∧

( p ∨ (^) q ) ≡

p

p (^) ∨ ¬

p

T

Negation Laws

p (^) ∧ ¬

p

F

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

14

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

16

8 – Constructing new equivalences

E XAMPLE

. Show that

¬ ( p → q )

and

p

∧ ¬

q

are logically equivalent.

¬ ( p → q ) ≡ ¬ ( ¬ p ∨ q )

(See page 10 of these slides)

≡ ¬ ( ¬ p )

q

(De Morgan’s Law)

p

∧ ¬

q

(Double negation)

Alper ¨ Jan 2007

Ung ¨

COT3100: Propositional Equivalences

17

9 – Proving a Tautology

E XAMPLE

. Show that

( p ∧ q ) → ( p ∨ q )

is a tautology.

( p ∧ q ) → ( p ∨ q ) ≡ ¬ ( p ∧ q ) ∨ ( p ∨ q )

(See page 10 of these slides)

p

∨ ¬

q ) ∨ ( p ∨ q )

(De Morgan’s Law)

p

∨ ¬

q ∨ p ) ∨ q

(Associative Law)

≡ ( ¬ p ∨ p

q ) ∨

q

(Commutative Law)

≡ ( ¬ p ∨ p ) ∨ ( ¬ q ∨ q )

(Associative Law)

T

T

(Negation Law)

T

Alper ¨ Jan 2007

Ung ¨