Day21-ClassNotes - Rose

advertisement
MA/CSSE 474 Day 21 Announcements and Summary
Announcements:
1) Yesterday my teaching schedule changed significantly. Michael and Amy Wollowski had their baby, and I am taking
over Michael's 230 class. So there may be fewer of these notes pages and fewer graded HW problems in the future.
a) The class meets periods 9-10 TRF, so I will not be available to help you with this course during those hours.
2) Midterm grade summary: {A: 21, B+: 10, B: 8, C+: 5, C: 4, F:2}
3) Candidate talk tomorrow 10th hour. Jessica Wu, MIT. What we see on paper and conversations with the search
committee indicate that she may be our top candidate. Be there if you can!
4) Exam 2 Tomorrow, Tuesday Jan 21 in class
a) Unlike previous Monday assignments, HW8 is not short, since you will have had extra time to work on HW6 and
7 (because of the long break and postponed assignments), so you should be able to start HW8 earlier than the
weekend.
5) Exam2 material: 5.1-5.8, 6.1-6.4, 8.1-8.6, 9.1-9.2, HW 1-8. You can bring 2 double-sided sheets of paper.
a) After the Exam 1 "time overrun" on Exam 1, I decided that there is no reasonable induction problem at the
(high) level of this course over material we have seen that fits well on a 50-minute test, so I I will wait until the
final exam.
6) HW 9 is available. Due Friday Jan 24. A short and fairly easy assignment.
7) HW10 due Tuesday, Jan 28. I'll do my best to have it be available Thursday afternoon.
Main ideas from today
Context-Free Grammars
1) Review: CFG G = (V, G, R, S), where
(this is from yesterday)
a)  is the terminal alphabet; it contains the symbols that make up the strings in L(G), and
b) N is the nonterminal alphabet a set of working symbols that G uses to structure the language. These symbols
disappear by the time the grammar finishes its job and generates a string.
Often we just write the
(Note:  ∩ N = .) Rule alphabet: V =  ∪ N
productions. The lhs of the
first production is the start
c) R: A set of productions of the form A  β, where A ∊ N and β ∊ V*.
symbol. Anything that
d) G has a unique start symbol, S ∊ N
appears on the lhs of some
production is assumed to
be a nonterminal
2) More review:
a) Notation conventions: a,b,c ∈ Σ, A,B,C ∈ N, α,β,γ,x,y,z ∈ V*
b) One derivation step: x G y iff ∃α,β,γ∈V*, A∈N ((x = A) ∧ (A   ∈ R) ∧ (y =   ))
c) G* is the reflexive, transitive closure of G
d) The language defined by a grammar: L(G) = {w  * : S G* w}
i) If G is S  aSb, S   , What is L(G)?
ii) If S x G α, we say that α is a sentential form of G. If α∊T*, it is a sentence (sometimes called a word) in
L(G)
e) A language L is context-free if there is some context-free grammar G such that L = L(G).
CFL
3) Hints for designing context-free grammars
a) Generate related regions together. AnBn
b) Generate concatenated regions: A  BC
c) Generate outside in:
A  aAb
n n m
d) Example: L = {a b c : n, m  0}
nk nk
n1 n1 n2 n2
e) Example: L = { a b a b ...a b : k  0 and i≤k (ni  0)}
f)
Example: L = {anbm : n  m}
4) There are straightforward algorithms for removing non-productive and unreachable non-terminals form a grammar.
5) Prove that a grammar is correct: L: AnBn = {anbn : n  0}
G: S  a S b, S  
a) Show that if w ∈ L, then S ⇒* w.
Induction on what? What to prove by induction? Use this to prove what we want.
6) Show that if S ⇒* w, then w ∈ L.
Induction on what? What to prove by induction? Use this to prove what we want.
Download