Download ppt

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Strings and
Languages
1
Review





Sets and sequences
Functions and relations
Graphs
Boolean logic:     
Proof techniques:
–
2
Construction, Contradiction, Pigeon Hole
Principle, Induction
Deductive Proof (1/2)


3
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.
Deductive Proof (2/2)
4
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
Problems and Languages



5
Problem: defined using input and output
Decision Problem: output is either yes or
no
Language: set of all inputs where output is
yes
Alphabets


6
An alphabet is a finite non-empty set.
An alphabet is generally denoted by the
symbol Σ.
Strings (or words)






7
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
Languages



8
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  Σ*)
Operations on Languages






9
Star (L*)
Concatenation (L1.L2)
Union (L1  L2)
Intersection (L1  L2)
Complement
Reversal LR
Questions (1/3)

What is the language for the following decision
problem?
Decision Problem:
–
–



10
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.
Questions (2/3)




11
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.
Questions (3/3)



12
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
Related documents