1 / 12

Strings and Languages

Strings and Languages. Review. Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: Construction, Contradiction, Pigeon Hole Principle, Induction. Deductive Proof (1/2). Thm: Every horse has infinite no. of legs.

eros
Download Presentation

Strings and Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Strings and Languages

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

  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. 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. 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. Alphabets • An alphabet is a finite non-empty set. • An alphabet is generally denoted by the symbol Σ.

  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 w1 and w2 – copy of w1 followed by copy of w2 • Reversal wR – w’s symbols reversed

  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. Operations on Languages • Star (L*) • Concatenation (L1.L2) • Union (L1 L2) • Intersection (L1  L2) • Complement • Reversal LR

  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 LR.

  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 L2 = {λ, 00,0000} be defined over the alphabet ∑ = {0}. Describe the strings in the set L2*. • Describe the complement of L2.

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

More Related