DS020 오토마타형식언어 Chapter 3. Regular Languages and Regular Grammars

Slides:



Advertisements
Similar presentations
CHAPTER 5 TOP-DOWN PARSING SUNG-DONG KIM, DEPT. OF COMPUTER ENGINEERING, HANSUNG UNIVERSITY.
Advertisements

Classroom English How do you say _________ in Korean? _________ 는 한국어로 뭐예요 ?
Lesson 11 What’s Your Type? 여러분의 유형은 무엇인가요 ?. What job do you want to have in the future? 여러분은 미래에 어떤 직업을 갖고 싶은가 ? p.218.
Part 4 문제 풀이 요령 1. 음성이 나오기 전에 문제를 먼저 읽고, key word 잡는다. 2. 첫 문제가 주제, 장소, 정체 ( 화자, 청자 ) 일 경우 두, 세 번째 문제부터 해결 할 준비를 한다. 3. 음성을 들으면서 순서대로 이해하며 문제 해결한다. ( paraphrasing.
언어와 문법 (languages, grammar)
컴파일러 입문 제 5 장 Context-Free 문법.
Unit 2. No Time for Exercise?
Compiler Lecture Note, Inroduction to FL theory
Sources of the Magnetic Field
Chapter 7 ARP and RARP.
6.9 Redundant Structures and the Unit Load Method
Compiler Lecture Note, Inroduction to FL theory
축산 인식개선을 위한 농협의 추진 사례 ( ) 농협중앙회 축산지원단장 박인희.
4장 구문(Syntax).
강좌 개요 2009년 1학기 컴퓨터의 개념 및 실습.
LISTEN AND UNDERSTAND LISTEN AND SING
과목 홈페이지  전산학개론 이메일 숙제를 제출할 경우, 메일 제목은 반드시 ‘[전산학개론]’으로 시작.
Discrete Math II Howon Kim
2. 형식언어 (Formal Language)
못 앤디 씨, 피아노 칠 수 있어요? 아니요, 지금 피아노 못 쳐요. Sogang Korean Level 1B
오토메타 형식언어 2003년도 제 2학기.
III. Problems of Second Chapter (Fluid Statics)
DS020 오토마타형식언어 Chapter 6. Simplification of Context-Free Grammars and Normal Forms Exercises October 16, 2003.
제 34 장 금융정책과 재정정책이 총수요에 미치는 효과 1.
제 5장. Context-Free Languages
이산수학(Discrete Mathematics) 수학적 귀납법 (Mathematical Induction)
Tel : Office : 2공학관 408호 오토마타 및 형식언어 김 현 성 Tel : Office : 2공학관 408호
Chapter 7. PUSHDOWN AUTOMATA Exercises
고대수학 1. 바빌로니아 이집트 그리스 인도 아랍 중국 미대륙.
재귀 혹은 귀납 Recursive or Inductive Definition 집합을 정의하는 방법
Chapter 2. Finite Automata Exercises
Discrete Math II Howon Kim
숭실대학교 마이닝연구실 김완섭 2009년 2월 8일 아이디어  - 상관분석에 대한 연구
주요 내용 형식 언어와 문법 정규식과 정규 집합 유한 상태 기계 정규 문법과 유한 상태 기계와 정규집합.
계수와 응용 (Counting and Its Applications)
Student A Say “I’m going to ask you some questions about The Internet and Technology.” Are you ready?
Open Class Lesson- L2B3 Greeting (5’ 00”) Word Like Daddy, Like Mommy
듣기 퀴즈.
The Best Thing I've Learned This Year
이산수학(Discrete Mathematics)  증명 전략 (Proof Strategy)
제 4 장. Regular Language의 특성
학습목표 Pumping Lemma와 Closure 특성을 통해 CFL와 Language Family간의 관계 이해
성문영어구문 pattern 관계대명사의 생 략.
9. Do you have a scientific mind?
Talk and talk Could you…? 영어 7-b
Introduction to Programming Language
Discrete Math II Howon Kim
위· 아래 · 앞 · 뒤 위 아래 앞 뒤 옆 안 밖 사이 Sogang Korean 1A UNIT 5 “위, 아래, 앞, 뒤”
3. 정규 언어(Regular Language)
: 부정(negative)의 의미를 나타내는 접두사
CEO가 가져야 할 품질 혁신 마인드.
Discrete Math II Howon Kim
Operating System Multiple Access Chatting Program using Multithread
Chapter 5. Context-Free Language Exercises
이산수학(Discrete Mathematics)
점화와 응용 (Recurrence and Its Applications)
The World of English by George E.K. Whitehead.
창 병 모 숙명여대 전산학과 자바 언어를 위한 CFA 창 병 모 숙명여대 전산학과
이산수학(Discrete Mathematics)
이산수학(Discrete Mathematics)  증명 전략 (Proof Strategy)
이산수학(Discrete Mathematics) 수열과 합 (Sequences and Summations)
제 3장. Regular Languages 와 Regular Grammars
For regex_compile function in grep.c
제10장. Other Models of TM’s 학습목표
[CPA340] Algorithms and Practice Youn-Hee Han
빈칸에 알맞은 것을 [보기]에서 골라 문장을 완성하시오
Elementary Korean 2 :Chapter 7 review
Chapter 4. Energy and Potential
Chapter 7: Deadlocks.
Sawasdee ka.
Presentation transcript:

DS020 오토마타형식언어 Chapter 3. Regular Languages and Regular Grammars Chapter 4. Properties of Regular Languages Exercises September 25, 2003

4. Find a regular expression for the set {anbm: (n+m) is even} (aa)*(bb)* + a(aa)*b(bb)* 힌트 : n과 m이 모두 짝수인 경우와 홀수인 경우로 나누어서 생각해봅시다. September 25, 2003

9. Give a regular expression for aaaa*bb* + aaa*bbb* + aa*bbbb* 힌트 : n과 m은 1 이상이고 둘의 곱은 3이상이 되기 위하여 고려해야 하는 최소의 경우를 생각해봅시다. September 25, 2003

14. Give a regular expressions for the following languages on (a) all strings containing exactly one a // (b + c)* a (b + c)* (b) all strings containing no more than three a’s (c) all strings which contain at least one occurrence of each symbol in // (a+b+c)*a(a+b+c)*b(a+b+c)*c(a+b+c)* + // (a+b+c)*a(a+b+c)*c(a+b+c)*b(a+b+c)* + // (a+b+c)*b(a+b+c)*a(a+b+c)*c(a+b+c)* + // (a+b+c)*b(a+b+c)*c(a+b+c)*a(a+b+c)* + // (a+b+c)*c(a+b+c)*a(a+b+c)*b(a+b+c)* + // (a+b+c)*c(a+b+c)*b(a+b+c)*a(a+b+c)* (d) all strings which contain no run of a’s of length greater than two (e) all strings in which all runs of a’s have lengths that are multiplies of three // (b + c)* ( aaa (b + c)*)* 힌트 : 각 조건을 잘 음미해 보고 문제를 풀어봅시다. September 25, 2003

3.1 REGULAR EXPRESSION 22. Formal languages can be used to describe a variety of two-dimensional figures. Chain-code languages are defined on the alphabet , where these symbols stand for unit-length straight lines in the directions up, down, right, and left, respectively. An example of this notation is urdl, which stands for the square with sides of init length. Draw pictures of the figures denoted by the expressions (rd)*, (urddru)*, and (ruldr)*. 힌트 : 직접 한번씩 그려봅시다. 간단한 모양이 반복되는군요. ^^ September 25, 2003

3.1 REGULAR EXPRESSION 23. In exercise 22, what are sufficient conditions on the expression so that the picture is a closed contour in the sense that the beginning and ending point are the same? Are these conditions also necessary? September 25, 2003

4. Find dfa’s that accept the following languages. 3.2 CONNECTION BETWEEN REGULAR EXPRESSION AND REGULAR LANGUAGES 4. Find dfa’s that accept the following languages. (a) (b) (c) (d) 힌트 : 그리기 쉬운 nfa를 먼저 그리고 난 후 dfa로 변환해 봅시다. September 25, 2003

3.2 CONNECTION BETWEEN REGULAR EXPRESSION AND REGULAR LANGUAGES 10. Find regular expressions for the languages accepted by the following automata. b*aa*ab*a 힌트 : (a) one-way 문제는 그냥 쭉 따라가기만 하면 됩니다. 힌트 : (b) 초기 상태를 non-final으로 만든 후 state수를 줄여나가 봅시다. 힌트 : (c) final state의 수를 하나로 줄여봅시다. September 25, 2003

3.2 CONNECTION BETWEEN REGULAR EXPRESSION AND REGULAR LANGUAGES 17. In some applications, such as programs that check spelling, we may not need an exact match of the pattern, only an approximate one, once the notion of an approximate match has been made precise, automata theory can be applied to construct approximate pattern matchers. As an illustration of this, consider patterns derived from the original ones by insertion of one symbol. Let L be a regular language on and define insert(L) = . In effect, insert(L) contains all the words created from L by inserting a spurious anywhere in a word. (a) Given an NFA for L, show how one can construct an NFA for insert(L) (b) discuss how you might use this to write a pattern-recognition program for insert(L), using as input a regular expression for L. September 25, 2003

Construct a DFA that accepts the language generated by the grammar 3.3 REGULAR GRAMMARS Construct a DFA that accepts the language generated by the grammar S  abA, A  baB, B  aA | bb 힌트 : SabA는 stats S에서 ab 가 나오면 state A로 간다는 의미입니다. September 25, 2003

3.3 REGULAR GRAMMARS 2. Find a regular grammar that generates the language L = (aa*(ab + a)*) S  aA // S 에서 a가 들어오면 A로 간다. A  aA // A에서 a가 들어오면 A로 간다. A  B // A는 아무 입력 없이 B로 갈 수 있다. B  abB | aB | λ // B는 ab 혹은 a 가 들어오면 B로 가고, 아무 입력 // 이 없을 수도 있다. 힌트 : 일단 FA를 구성하고 난 후 문법으로 옮겨봅시다. September 25, 2003

3.3 REGULAR GRAMMARS 9. Find a left-linear and right-linear grammars for the language L((aab*ab)*) left-linear S  Aab | λ A  Ab | Saa right-linear S  aaA | λ A  bA | abS 힌트 : left-linear와 right-linear의 유사점과 차이점에 관하여 잘 생각해 봅시다. September 25, 2003

4.1 Closure Properties of Regular Languages 2. Use the construction in Theorem 4.1 to find an nfa that accepts following language (a) L((a + b) a*) ∩ L(baa*) // baa* (b) L(ab*a*) ∩ L(a*b*a) // a(a+bb*a) 힌트 : 교집합의 좌 우측에 대하여 두 개의 dfa를 구성하고 동시에 accept하는 길을 찾아봅시다. September 25, 2003

4.1 Closure Properties of Regular Languages 6. The symmetric difference of two sets S1 and S2 is defined as follow: Show that the family of regular languages is closed under symmetric difference S1ӨS2={x: x∈S1 or x∈S2, but x is not in both S1 and S2} September 25, 2003

10. Let L1=L(a*baa*) and L2=L(aba*). Find L1/L2 4.1 Closure Properties of Regular Languages 10. Let L1=L(a*baa*) and L2=L(aba*). Find L1/L2 a* 힌트 : 예제 4.5를 그대로 따라서 해봅시다. ^^ September 25, 2003

4.1 Closure Properties of Regular Languages 15. The left quotient of a language L1 with respect to L2 is defined as follow: Show that the family of regular languages is closed under left quotient with a regular language L2/L1={y: x∈L2, xy∈L1} 힌트 : left quotient를 이해한 후 right quotient를 이해해 봅시다. September 25, 2003

4.1 Closure Properties of Regular Languages 20. For a string a1a2…an define the operation on a language as shift(a1a2…an)=a2…ana1. From this, we can define the operation on a language as shift(L)={v:v = shift(w) for some w ∈L} September 25, 2003

4.2. Elementary Questions About Regular Languages 5. A language is said to be a palindrome language if L = LR. Find an algorithm for determining if a given regular language is a palindrome language 힌트 : L과 LR에 대한 DFA를 먼저 구성하고, 정리 4.7을 적용시켜 봅시다. September 25, 2003

4.2. Elementary Questions About Regular Languages 9. Let L be a regular language on ∑ and w be any string in ∑*. Find an algorithm to determine if L contains any w such that is a substring of it, that is, such that, with u, v ∈∑* September 25, 2003

4.2. Elementary Questions About Regular Languages 12. Let L be any regular language on ∑ = {a, b}. Show that an algorithm exists for determining if L contains any strings of even length September 25, 2003

4. Prove that the following languages are not regular 4.3 Identifying Nonregular Languages 4. Prove that the following languages are not regular (b) L = {anblak: k≠n+l} // w = ambma2m (d) L = {anbl: n≤l} // w = ambm (f) L = {ww: w∈{a,b}*} // w = ambm 힌트 : pumping lemma 문제는 충분히 풀어서 익히도록 합시다. 관건은 어떻게 w를 잘 선택하느냐 하는 것입니다. September 25, 2003

4.3 Identifying Nonregular Languages 8. Prove or disprove the following statement. If L1 and L2 are nonregular languages, then (L1 U L2) is also nonregular September 25, 2003

4.3 Identifying Nonregular Languages 9. Consider the languages below. For each, make a conjecture whether or not it is regular. Then prove your conjecture (a) L = {anblak: n + l + k > 5} // regular language (c) L = {anbl: n / l is an integer} // non-regular language (e) L = {anbl: n ≤ l ≤ 2n} // non-regular language 힌트 : regular이면 FA 혹은 regular grammar를 찾고, 아니면 pumping lemma를 이용합시다. September 25, 2003

4.3 Identifying Nonregular Languages 15. Let P be an infinite but countable set, and associate with each p∈P a language Lp. The smallest set containing every Lp is the union over the infinite set P; it will be denoted by U p∈P Lp. Show by example that the family of regular languages is not closed under infinite union September 25, 2003