CS1231 Tutorial 2

Preview:

Citation preview

CS1231 Discrete Structures

Tong W. Ratanapan

Tutorial 2: Sep 2-6, 2013

a0074997@nus.edu.sg

slideshare.net/TongWR

Outline Tutorial 1 Revision

Discussion

CS1231 Tutorial 2 Tong W. Ratanapan

Correction

Consultation

Launchpad @ N-House (level 1, block 15, PGP)

Wednesday 1-2pm

Outline Tutorial 1 Revision

Discussion

CS1231 Tutorial 2 Tong W. Ratanapan

Outline

Outline Tutorial 1 Revision

Discussion

CS1231 Tutorial 2 Tong W. Ratanapan

0. Outline

1. Tutorial 1 1. Pigeon Hole Principle 2. Pure Existence Proof 3. Inclusion-Exclusion Principle

Outline Tutorial 1 Revision

Discussion

CS1231 Tutorial 2 Tong W. Ratanapan

0. Outline

1. Tutorial 1 1. Pigeon Hole Principle 2. Pure Existence Proof 3. Inclusion-Exclusion Principle

2. Revision 1. Propositional Logic 2. Predicate Logic 3. Model Semantics

Outline Tutorial 1 Revision

Discussion

CS1231 Tutorial 2 Tong W. Ratanapan

0. Outline

1. Tutorial 1 1. Pigeon Hole Principle 2. Pure Existence Proof 3. Inclusion-Exclusion Principle

2. Revision 1. Propositional Logic 2. Predicate Logic 3. Model Semantics

3. Discussion

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Tutorial 1

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Problems & Solutions: http://www.artofproblemsolving.com/Wiki/index.php/Pigeonhole_Principle Applications: http://mindyourdecisions.com/blog/2008/11/25/16-fun-applications-of-the-pigeonhole-principle

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational?

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

rational

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

rational 𝑝 = π‘ž = 2 β†’ π‘π‘ž = 22

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

rational 𝑝 = π‘ž = 2 β†’ π‘π‘ž = 22

; rational by assumption

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

irrational

rational 𝑝 = π‘ž = 2 β†’ π‘π‘ž = 22

; rational by assumption

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

irrational

rational 𝑝 = π‘ž = 2 β†’ π‘π‘ž = 22

; rational by assumption

𝑝 = 22, π‘ž = 2 β†’ π‘π‘ž = 2

22

= 2 ; rational

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Pure Existence Proof

Q: Are there irrational 𝑝, π‘ž such that π‘π‘ž is rational? A: Yes!

22

irrational

rational 𝑝 = π‘ž = 2 β†’ π‘π‘ž = 22

; rational by assumption

𝑝 = 22, π‘ž = 2 β†’ π‘π‘ž = 2

22

= 2 ; rational

doesn’t matter, exists anyway!

Outline Tutorial 1 Revision

Discussion

Pigeonhole Principle Pure Existence Proof Inclusion-Exclusion Principle

CS1231 Tutorial 2 Tong W. Ratanapan

Inclusion-Exclusion Principle

Outline Tutorial 1 Revision

Discussion

Propositional Logic Predicate Logic Model Semantics

CS1231 Tutorial 2 Tong W. Ratanapan

Revision

Outline Tutorial 1 Revision

Discussion

Propositional Logic Predicate Logic Model Semantics

CS1231 Tutorial 2 Tong W. Ratanapan

Propositional Logic

Propositional Logic Formal Syntax of Propositional Logic Predicate Logic Formal Syntax of Predicate Logic

Formal Syntax of Propositional Logic

2.2. Formal Syntax of Propositional Logic

Definition 2.2.1

Let us consider a collection of symbols called propositions orstatements. Let us consider the collection of symbols{>,βŠ₯,∨,∧,Β¬,β‡’,⇔,βŠ•}a. Let us consider the two parenthesissymbols ( and ).

F is a well formed formula (wff) (or atomic statementb) if F isa proposition.

The following are wff (or compound statements) iff F1 and F2are wff. >, βŠ₯, (F1 ∧ F2), (F1 ∨ F2), Β¬(F1), (F1 β‡’ F2),(F1 ⇔ F2), (F1 βŠ• F2).

the above are the only wff.

aThese are the standard connectives. There are more.bp and Β¬p are sometimes refer to as unit statements.

Propositional Logic Formal Syntax of Propositional Logic Predicate Logic Formal Syntax of Predicate Logic

Formal Syntax of Propositional Logic

Different Notations

> T , true, 1βŠ₯ F , false, 0

(p ∧ q) (p.q), p Γ— q, (p&q), (p&&q)(p ∨ q) (p + q), (p | q), (pβ€–q)(p βŠ• q) (pΛ†q)(p ⇔ q) (p ↔ q), (p ≑ q)(p β‡’ q) (p β†’ q), (p βŠƒ q)Β¬p ∼ p, p, !p(p) [p]

Propositional Logic Formal Syntax of Propositional Logic Predicate Logic Formal Syntax of Predicate Logic

Precedence

Precedence and Parenthesis

In this module we do not assume any precedence rule andsystematically use parenthesis to avoid ambiguity.

Truth Tables Propositional Calculus Predicate Calculus

Truth Tables

Truth Table of Negation

F1 Β¬F1true falsefalse true

Truth Tables Propositional Calculus Predicate Calculus

Truth Tables

Truth Table of Conjunction

F1 F2 F1 ∧ F2

true true truetrue false falsefalse true falsefalse false false

Truth Tables Propositional Calculus Predicate Calculus

Truth Tables

Truth Table of Disjunction

F1 F2 F1 ∨ F2

true true truetrue false truefalse true truefalse false false

Truth Tables Propositional Calculus Predicate Calculus

Truth Tables

Truth Table of Exclusive Disjunction

F1 F2 F1 βŠ• F2

true true falsetrue false truefalse true truefalse false false

Truth Tables Propositional Calculus Predicate Calculus

Truth Tables

Truth Table of Implication

F1 F2 F1 β‡’ F2

true true truetrue false falsefalse true truefalse false true

Truth Tables Propositional Calculus Predicate Calculus

Truth Tables

Truth Table of Equivalence

F1 F2 F1 ⇔ F2

true true truetrue false falsefalse true falsefalse false true

Outline Tutorial 1 Revision

Discussion

Propositional Logic Predicate Logic Model Semantics

CS1231 Tutorial 2 Tong W. Ratanapan

Predicate Logic

Propositional Logic Formal Syntax of Propositional Logic Predicate Logic Formal Syntax of Predicate Logic

Formal Syntax of Predicate Logic

Definition 2.4.5

Let us consider a collection of constants. Let us consider acollection of variables, let us consider a collection of predicates(each predicate is associated to a natural number n, called itsvalence or arity, we say that the predicate is n-ary). Let us considerthe corresponding Herbrand’s base. Let us consider the collectionof symbols {>,βŠ₯,∨,∧,Β¬,β‡’,⇔,βŠ•}. Let us consider the twosymbols βˆƒ (the existential quantifier; read β€œthere exists”) and βˆ€(the universal quantifier; read β€œfor all”) called quantifiers....

Propositional Logic Formal Syntax of Propositional Logic Predicate Logic Formal Syntax of Predicate Logic

Formal Syntax of Predicate Logic

Definition 2.4.5 Cont.

F is a well formed formula (wff) or compound statement if Fis an atom of BH .

The following are wffs if F1 and F2 are wffs.

>,βŠ₯,(F1 ∧ F2),(F1 ∨ F2),Β¬(F1),(F1 β‡’ F2),(F1 ⇔ F2),(F1 βŠ• F2).

The following are wffs if F is a wff and X is a variable.

(βˆ€X F ),(βˆƒX F ).

the above are the only wff.

Propositional Logic Formal Syntax of Propositional Logic Predicate Logic Formal Syntax of Predicate Logic

Formal Syntax of Predicate Logic

For example the following are wff.

βˆ€X (βˆ€Y ((odd(X ) ∧ Β¬(even(Y )))β‡’ even(X + Y ))).

βˆ€X (βˆƒY (X ∈ Nβ‡’ (Y ∈ N ∧ Y = s(X )))).

βˆ€X (X ∈ Nβ‡’ s(X ) ∈ N).

For example the following are not wff.

βˆ€X (βˆ€Y ((odd(X ) ∧ ∧ ∧ Β¬(even(Y )))β‡’ even(X + Y ))).

βˆ€X ∧ (βˆƒY (X ∈ Nβ‡’ (Y ∈ N ∧ Y = s(X )))).

X (X ∈ Nβ‡’ s(X ) ∈ N.

Outline Tutorial 1 Revision

Discussion

Propositional Logic Predicate Logic Model Semantics

CS1231 Tutorial 2 Tong W. Ratanapan

Model Semantics

Truth Tables Propositional Calculus Predicate Calculus

Propositional Calculus

3.2. Propositional Calculus

Definition 3.2.1

An interpretation I is a mapping of the propositions to the truthvalues {true, false} such that:

I (>) = true

I (βŠ₯) = false,

I (Β¬F1) = true if I (F1) = false , otherwise I (Β¬F1) = false,

I (F1 ∧ F2) = true if I (F1) = true and I (F2) = true, otherwiseI (F1 ∧ F2) = false,

I (F1 ∨ F2) = true if I (F1) = true or I (F2) = true (or both),otherwise I (F1 ∨ F2) = false,

...

Truth Tables Propositional Calculus Predicate Calculus

Propositional Calculus

Definition Cont.

I (F1 β‡’ F2) = false if I (F1) = true and I (F2) = false,otherwise I (F1 β‡’ F2) = true,

I (F1 ⇔ F2) = true if I (F1) = true = I (F2) = true orI (F1) = false = I (F2) = false, otherwise I (F1 ⇔ F2) = false,

I (F1 βŠ• F2) = true if I (F1) = true or I (F2) = true but notboth, otherwise I (F1 βŠ• F2) = false.

The above is best summarized in truth tables. A truth tablepresents all interpretations of a formula.

Truth Tables Propositional Calculus Predicate Calculus

Models

Definition 3.2.2

An interpretation I is a model of a formula F iff I (F ) = true.

Definition 3.2.3

An interpretation I is a counter-model of a formula F iffI (F ) = false.

Truth Tables Propositional Calculus Predicate Calculus

Models

Definition 3.2.4

A formula F is a tautology (or is valid) iff all interpretations aremodels.

Definition 3.2.5

A formula F is a contradiction iff no interpretation is model.

Definition 3.2.6

A formula F is a contingency iff it is neither a tautology nor acontradiction.

Truth Tables Propositional Calculus Predicate Calculus

Models

Definition 3.2.7

Let F1 and F2 be two formulae. F2 is a logical consequence of F1,we write F1 |= F2 iff all models of F1 are models of F2.

Definition 3.2.8

Let Fn be formulae. Fn is a logical consequence of F1, ...,Fnβˆ’1, wewrite F1, ...,Fnβˆ’1 |= Fn iff all models common to F1, ...,Fnβˆ’1 aremodels of Fn.

Definition 3.2.9

Let F1 and F2 be two formulae F1 and F2 are logicaly equivalent,we write F1 ≑ F2, iff they have the same models.

Outline Tutorial 1 Revision

Discussion

Group activity

CS1231 Tutorial 2 Tong W. Ratanapan

Discussion

Outline Tutorial 1 Revision

Discussion

Group activity

CS1231 Tutorial 2 Tong W. Ratanapan

Divide into 5 groups

Each solves one from 2, 3, 4, 5.odd, 5.even