Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,

Similar presentations


Presentation on theme: "1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,"— Presentation transcript:

1 1 Strings and Languages

2 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction, Pigeon Hole Principle, Induction

3 3 Deductive Proof (1/2) Thm: Every horse has infinite no. of legs. Proof: Horses have an even number of legs. Behind they have two legs, and in front they have fore legs. This makes six legs, which is certainly an odd number of legs for a horse. But the only number that is both odd and even is infinity. Therefore, horses have an infinite number of legs.

4 4 Deductive Proof (2/2) Thm : All numbers are equal to zero. Proof: Suppose that a=b. Then a = b a^2 = ab a^2 - b^2 = ab - b^2 (a + b)(a - b) = b(a - b) a + b = b a = 0

5 5 Problems and Languages Problem: defined using input and output Decision Problem: output is either yes or no Language: set of all inputs where output is yes

6 6 Alphabets An alphabet is a finite non-empty set. An alphabet is generally denoted by the symbol Σ.

7 7 Strings (or words) Defined over an alphabet Σ Is a finite sequence of symbols from Σ Length of string w (|w|) – length of sequence λ – the empty string Concatenation of w 1 and w 2 – copy of w 1 followed by copy of w 2 Reversal w R – w’s symbols reversed

8 8 Languages A language over Σ is a set of strings over Σ Σ * is the set of all strings over Σ A language L over Σ is a subset of Σ * (L  Σ * )

9 9 Operations on Languages Star (L*) Concatenation (L 1.L 2 ) Union (L 1  L 2 ) Intersection (L 1  L 2 ) Complement Reversal L R

10 10 Questions (1/3) What is the language for the following decision problem? Decision Problem: – Input: String w – Output: Yes, if |w| is even What is the decision problem for the language L = {u0v | u,v  {0,1}* } ? What alphabet is the language L defined over? Describe the language L R.

11 11 Questions (2/3) What is the size of the empty set? What is the size of the set containing just the empty string? Let L 2 = {λ, 00,0000} be defined over the alphabet ∑ = {0}. Describe the strings in the set L 2 *. Describe the complement of L 2.

12 12 Questions (3/3) Let L 3 = {awb | w  {a,b}*}. Define the language L 3 R How would you prove that L 3 = {a}.{a,b}*.{b}? How would you prove that L 3 ≠ L 3 R


Download ppt "1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,"

Similar presentations


Ads by Google