review 3 - people.engr.tamu.edu · logical connectives - summary let b={t,f}. assign to each...

Post on 29-Sep-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Review 3Andreas Klappenecker

Final Exam

Friday, May 4, 2012, starting at 12:30pm, usual classroom

Topics

Week Topic Reading

1/17-1/20 Algorithms and their Complexity Chapter 3

1/23-1/27 Logic and Proofs Chapter 1

1/30-2/3 Logic and Proofs Chapter 1

2/6-2/10 Sets and Functions Chapter 2

2/13-2/17 Sequences and Sums Chapter 2

2/20-2/24 Induction and Recursion Chapter 5

2/27-3/2 Induction and Recursion Chapter 5

3/5-3/9 Counting Chapter 6

3/12-3/16 Spring Break

3/19-3/23 Solving Recurrences Chapter 8

3/26-3/30 Relations Chapter 9

4/2-4/6 Models of Computation Chapter 13

4/9-4/13 Models of Computation Chapter 13

4/16-4/20 Models of Computation Chapter 13

4/23-4/27 Applications

4/30-5/1 Review

Tentative dates for Midterm 1: Tuesday 2/21/2012Midterm 2: Tuesday 3/27/2012Final exam: Friday 5/4/2012 starting at 12:30pm in our classroom.

Collaboration

For the assignments in this class, discussion of concepts with others is encouraged, but all assignments must be done on your own, unless otherwise instructed. Reference every source you use, whether it is a person, a book, a paper, a solution set, a web page or whatever. You MUST write up your assignments in your own words. Copying is strictly forbidden.

- 2 -

Course Topics, Calendar of Activities, Major Assignment Dates

Logical Connectives - Summary

Let B={t,f}. Assign to each connective a function M: B->B

that determines its semantics. 4 The Semantics of Propositional Logic

Let B = {t, f} denote the set of truth values, where t and f represent trueand false, respectively. We associate to the logical connective ¬ the functionM¬ : B→ B given by

P M¬(P )f tt f

Thus, M¬(P ) is true if and only if P is false. This justifies the name negationfor this connective. The graph of the function M¬ given above is called thetruth table of the negation connective. Similarly, we associate to a connectiveX in the set {∧,∨,⊕,→,↔} a binary function MX : B × B → B. The truthtables of these connectives are as follows:

P Q M∧(P, Q) M∨(P,Q) M⊕(P, Q) M→(P, Q) M↔(P, Q)f f f f f t tf t f t t t ft f f t t f ft t t t f t t

You should very carefully inspect this table! It is critical that you memorizeand fully understand the meaning of each connective.

The semantics of the language Prop is given by assigning truth values toeach proposition in Prop. Clearly, an arbitrary assignment of truth values isnot interesting, since we would like everything to be consistent with the meaningof the connectives that we have just learned. For example, if the propositions aand b have been assigned the value t, then it is reasonable to insist that a ∧ bbe assigned the value t as well. Therefore, we will introduce the concept of avaluation, which models the semantics of Prop in an appropriate way.

A valuation v : Prop→ B is a function that assigns a truth value to eachproposition in Prop such thatV1. v�¬a� = M¬(v�a�)V2. v�(a ∧ b)� = M∧(v�a� , v�b�)V3. v�(a ∨ b)� = M∨(v�a� , v�b�)V4. v�(a⊕ b)� = M⊕(v�a� , v�b�)V5. v�(a→ b)� = M→(v�a� , v�b�)V6. v�(a↔ b)� = M↔(v�a� , v�b�)holds for all propositions a and b in Prop. The properties V1–V6 ensurethat the valuation respects the meaning of the connectives. We can restrict avaluation v to a subset of the set of proposition. If A and B are subsets ofProp such that A ⊆ B, and vA : A → B and vB : B → B are valuations, thenvB is called an extension of the valuation vA if and only if vB coincides withvA when restricted to A.

The consistency conditions V1-V6 are quite stringent, as the next theoremshows.

5

4 The Semantics of Propositional Logic

Let B = {t, f} denote the set of truth values, where t and f represent trueand false, respectively. We associate to the logical connective ¬ the functionM¬ : B→ B given by

P M¬(P )f tt f

Thus, M¬(P ) is true if and only if P is false. This justifies the name negationfor this connective. The graph of the function M¬ given above is called thetruth table of the negation connective. Similarly, we associate to a connectiveX in the set {∧,∨,⊕,→,↔} a binary function MX : B × B → B. The truthtables of these connectives are as follows:

P Q M∧(P, Q) M∨(P,Q) M⊕(P, Q) M→(P, Q) M↔(P, Q)f f f f f t tf t f t t t ft f f t t f ft t t t f t t

You should very carefully inspect this table! It is critical that you memorizeand fully understand the meaning of each connective.

The semantics of the language Prop is given by assigning truth values toeach proposition in Prop. Clearly, an arbitrary assignment of truth values isnot interesting, since we would like everything to be consistent with the meaningof the connectives that we have just learned. For example, if the propositions aand b have been assigned the value t, then it is reasonable to insist that a ∧ bbe assigned the value t as well. Therefore, we will introduce the concept of avaluation, which models the semantics of Prop in an appropriate way.

A valuation v : Prop→ B is a function that assigns a truth value to eachproposition in Prop such thatV1. v�¬a� = M¬(v�a�)V2. v�(a ∧ b)� = M∧(v�a� , v�b�)V3. v�(a ∨ b)� = M∨(v�a� , v�b�)V4. v�(a⊕ b)� = M⊕(v�a� , v�b�)V5. v�(a→ b)� = M→(v�a� , v�b�)V6. v�(a↔ b)� = M↔(v�a� , v�b�)holds for all propositions a and b in Prop. The properties V1–V6 ensurethat the valuation respects the meaning of the connectives. We can restrict avaluation v to a subset of the set of proposition. If A and B are subsets ofProp such that A ⊆ B, and vA : A → B and vB : B → B are valuations, thenvB is called an extension of the valuation vA if and only if vB coincides withvA when restricted to A.

The consistency conditions V1-V6 are quite stringent, as the next theoremshows.

5

Conditional

Perhaps the most important logical connective is the conditional, also known as implication:

p -> q

The statement asserts that q holds on the condition that p holds. We call p the hypothesis or premise, and q the conclusion or consequence. Typical usage in proofs:

“If p, then q”; “p implies q”; “q only if p”; “q when p”; “q follows from p”

“p is sufficient for q”; “a sufficient condition for q is p”; “a necessary condition for p is q”; “q is necessary for p”

Logical Equivalence

Two statements involving quantifiers and predicates are logically equivalent if and only if they have the same truth values no matter which predicates are substituted into these statements and which domain is used.

We write A ≡ B for logically equivalent A and B.

You use logical equivalences to derive more convenient forms statements.

Example: De Morgan’s laws.

De Morgan’s Laws

¬∀xP (x) ≡ ∃x¬P (x)

¬∃xP (x) ≡ ∀x¬P (x)

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

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

Valid Arguments

An argument in propositional logic is a sequence of propositions that end with a proposition called conclusion. The argument is called valid if the conclusion follows from the preceding statements (called premises).

In other words, in a valid argument it is impossible that all premises are true but the conclusion is false.

Modus Ponens

The tautology (p ⋀ (p->q)) -> q is the basis for the rule of inference called “modus ponens”.

p

p -> q

-------

∴ q

Modus Tollens

¬q

p -> q

------

∴¬ p

“The University will not close on Wednesday.”

“If it snows on Wednesday, then the University will close.”

Therefore, “It will not snow on Wednesday”

Formal Argument

¬p ∧ qr → p¬r → ss → t

∴ t

Argument

1) ¬p ∧ q Hypothesis

2) ¬p Simplification of 1)

3) r → p Hypothesis

4) ¬r Modus tollens using 2) and 3)

5) ¬r → s Hyposthesis

6) s Modus ponens using 4), 5)

7) s → t Hypothesis

8) t Modus ponens using 6), 7)

Proofs

Direct Proof

Proof by Contradiction

Proof by Induction

- weak induction

- strong induction

- structural induction

- transfinite induction (= induction over well-ordered sets)

Set Theory

You should be familiar with

- the builder notation

- subsets, equality of sets

- union, intersection, set difference, complement

- cartesian product, power set

- cardinality of sets (when is |A| <= |B|?)

- countable and uncountable sets

De Morgan Laws

A ∩B = A ∪B

Proof :

A ∩B = {x | x �∈ A ∩B} by definition of complement

= {x | ¬(x ∈ A ∩B)}= {x | ¬(x ∈ A ∧ x ∈ B)} by definition of intersection

= {x | ¬(x ∈ A) ∨ ¬(x ∈ B)} de Morgan’s law from logic

= {x | (x �∈ A) ∨ (x �∈ B)} by definition of �∈= {x | x ∈ A ∨ x ∈ B} by definition of complement

= {x | x ∈ A ∪B} by definition of union

= A ∪B

14

Functions

Let f: A -> B be a function.

We call

- A the domain of f and

- B the codomain of f.

The range of f is the set

f(A) = { f(a) | a in A }

15

Functions

Let A and B be sets. Consider a function f: A-> B.

- When is f surjective?

- When is f injective?

- When is f bijective?

16

Floor and Ceiling Functions

The floor function ⎣⎦: R -> Z assigns to a real

number x the largest integer <= x.

The ceiling function ⎡⎤: R -> Z assigns to a real

number x the smallest integer >= x.

⎣3.2⎦= 3 and ⎡3.2⎤= 4

⎣-3.2⎦= -4 and ⎡-3.2⎤= -3

17

Basic Facts

We have⎣x⎦= n if and only if n <= x < n+1.

We have⎡x⎤=n if and only if n-1< x <= n.

We have⎣x⎦= n if and only if x-1 < n <= x.

We have⎡x⎤=n if and only if x<= n < x+1.

18

Example

19

Prove or disprove:

��

�x�� = �√x�

Example 3

20

Let m = ���x��

Hence, m ≤��x� < m+ 1

Thus, m2 ≤ �x� < (m+ 1)2

It follows that m2 ≤ x < (m+ 1)2

Therefore, m ≤√x < m+ 1

Thus, we can conclude that m = �√x�

This proves our claim.

Series and Sums

You need to know

- sequence notations

- important sequences

- summation notation

- geometric sum

- sum of first n positive integers

21

Geometric SeriesIf a and r �= 0 are real numbers, then

n�

j=0

arj =

�arn+1−a

r−1 if r �= 1

(n+ 1)a if r = 1

Proof:The case r = 1 holds, since arj = a for each of then+ 1 terms of the sum.

The case r �= 1 holds, since

(r − 1)�n

j=0 arj =

n�

j=0

arj+1 −n�

j=0

arj

=n+1�

j=1

arj −n�

j=0

arj

= arn+1 − aand dividing by (r − 1) yields the claim.

Extremely useful!

Sum of First n Positive Integers .

For all n ≥ 1, we haven�

k=1

k = n(n+ 1)/2

We prove this by induction.Basis step: For n = 1, we have

1�

k=1

k = 1 = 1(1 + 1)/2.

Extremely useful!

Try to complete the proof yourself...

Infinite Geometric Series

Let x be a real number such that |x| < 1. Then

∞�

k=0

xk =1

1− x.

Asymptotic Notations

You need to know

- big Oh notation

- big Omega notation

- big Theta notation

- be able to prove that f = O(g), ...

- be able to show that O(g)=O(h)

Big Oh Notation

Let f,g: N -> R be functions from the natural numbers to the set of real numbers.

We write f ∈ O(g) if and only if there exists some real number n0 and a positive real constant U such that |f(n)| <= U|g(n)| for all n satisfying n >= n0

Big Ω

We define f(n) = Ω(g(n)) if and only if there exists a constant L and a natural number n0 such that

L |g(n)| <= |f(n)|

holds for all n >= n0.

In other words, f(n) = Ω(g(n)) if and only if g(n) = O(f(n)).

Big Θ

We define f(n) = Θ(g(n)) if and only if there exist constants L and U and a natural number n0 such that

L|g(n)| <= |f(n)| <= U|g(n)|

holds for all n >= n0.

In other words, f(n) = Θ(g(n)) if and only if

f(n) = Ω(g(n)) and f(n) = O(g(n)).

Counting

You need to know

- the basic counting principles (product rule, sum rule,...)

- (generalized) pigeonhole principle

- permutations and combinations

- binomial coefficients

- binomial theorem

- counting with repeated elements

Pigeonhole Principle

In any cocktail party n >=2 people, there must be at least two people who have the same number of friends (assuming that the friends relation is symmetric and irreflexive).

The number of friends of each person ranges between 0 and n-1.

Case 1: Everyone has at least one friend.

If everyone has at least one friend, then each person has between 1 to n-1 friends. Since we have n people, and just n-1 different values, there must be two partygoers that have the same number of friends by the pigeonhole principle.

Case 2: Someone has no friends.

If someone lacks any friends, then that person is a stranger to all other guests. Because friend is symmetric, the highest value anyone else could have is n - 2, that is, everyone has between 0 to n – 2 friends. Since we have n people, and just n-1 different values, there must be two partygoers that have the same number of friends by the pigeonhole principle.

Solving Recurrences

You need to be able to solve recurrences by

- solving characteristic equations (for homogeneous linear recurrences of degree 2)

- by inspecting, guessing, and verifying a solution

- by applying the master theorem

Relations

You need to know

- the basic properties of relations (reflexive, symmetric, antisymmetric, transitive, ...)

- how to show that a relation is an equivalence relation

- the congruence relation mod m

- how to show that a relation is a partial order

- what an order lattice is

Formal Languages

You need to

- be familiar with the Chomsky Hierarchy

- be able to determine the language associated with a grammar

- know the characterization of regular languages as languages accepted by finite state automata or languages described by regular expressions

- be familiar with finite state machines and finite state automata

Hints

Read the textbook and the slides.

Study quizzes, homeworks, old exams.

Drill using odd numbered exercises.

Scan through review sections of the textbook.

Get enough sleep.

top related