Download
# 1 Introduction to Computability Theory PowerPoint Presentation, PPT - DocSlides

alexa-scheidler | 2015-12-04 | General
** Tags : **
1-introduction-to-computability-theory-566
derivation grammar
example2 exps
grammar
derivation
exps
example2
arithmetical
input
rule
context
free
languages
language
output
regular
word
class
### Presentations text content in 1 Introduction to Computability Theory

Show

Lecture5: Context . Free Languages. Prof. Amos Israeli. On the last lecture we completed our study of regular languages. (There is still a lot to learn but our time is limited…).. Introduction and Motivation. ID: 213749

- Views :
**53**

**Direct Link:**- Link:https://www.docslides.com/alexa-scheidler/1-introduction-to-computability-theory-566
**Embed code:**

Download this presentation

DownloadNote - The PPT/PDF document "1 Introduction to Computability Theory" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Slide1

1

Introduction to Computability Theory

Lecture5: Context

Free Languages

Prof. Amos Israeli

Slide2On the last lecture we completed our study of regular languages. (There is still a lot to learn but our time is limited…).

Introduction and Motivation

2

Slide3In our study of RL-s we Covered:Motivation and definition of regular languages.DFA-s, NFA-s, RE-s and their equivalence.Non Regular Languages and the Pumping Lemma.

Introduction and Motivation

3

Slide4In this lecture, we turn to Context Free Grammars and Context Free Languages.The class of Context Free Languages is an intermediate class between the class of regular languages and the class of Decidable Languages (To be defined).

Introduction and Motivation

4

Slide5A Context Free Grammar is a “machine” that creates a language.A language created by a CF grammar is called A Context Free Language.(We will show that) The class of Context Free Languages Properly Contains the class of Regular Languages.

Introduction and Motivation

5

Slide6Consider grammar : A CFL consists of substitution rules called Productions.The capital letters are the Variables. The other symbols are the Terminals.

Context Free Grammar - Example

6

Slide7Consider grammar : The grammar generates the language called the language of , denoted by .

Context Free Grammar - Example

7

Slide8Consider grammar : This is a Derivation of the word by : On each step, a single rule is activated. This mechanism is nondeterministic.

Context Free Grammar - Example

8

Slide9This is A Parse Tree of the word by :

Context Free Grammar - Example

9

Slide10Each internal node of the tree is associated with a single production.

Context Free Grammar - Example

10

Slide11A Context Free Grammar is a 4-tupple where: is a finite set called the variables. is a finite set, disjoint from V called the terminals. is a set of rules, where a rule is a variable and a string of variables and terminals, and is the start variable .

CF Grammar – A Formal Definition

11

,

Slide12A word is a string of terminals.A derivation of a word w from a context Free Grammar is a sequence of strings ,over , where: is the start variable of G. For each , is obtained by activating a single production (rule) of G on one of the variables of .

A Derivation – A Formal Definition

12

Slide13A word w is in the Language of grammar G, denoted by , if there exists a derivation whose rightmost string is w .Thus,

CF Grammar – A Formal Definition

13

Slide14Grammar

: Rules:1. 2. 3.

Example2: Arithmetical EXPS

14

Slide15Derivation of by Grammar : input

Example2: Arithmetical EXPS

15

Slide16Derivation of by Grammar : input rule

Example2: Arithmetical EXPS

16

Slide17Derivation of by Grammar

: input output rule

Example2: Arithmetical EXPS

17

Slide18Derivation of by Grammar

: input

Example2: Arithmetical EXPS

18

Slide19Derivation of by Grammar : input rule

Example2: Arithmetical EXPS

19

Slide20Derivation of by Grammar : input output rule

Example2: Arithmetical EXPS

20

Slide21Derivation of by Grammar : input

Example2: Arithmetical EXPS

21

Slide22Derivation of by Grammar : input rule

Example2: Arithmetical EXPS

22

Slide23Derivation of by Grammar : input output rule

Example2: Arithmetical EXPS

23

Slide24Derivation of by Grammar : input

Example2: Arithmetical EXPS

24

Slide25Derivation of by Grammar : input rule

Example2: Arithmetical EXPS

25

Slide26Derivation of by Grammar

: input output rule

Example2: Arithmetical EXPS

26

Slide27Derivation of by Grammar

: input

Example2: Arithmetical EXPS

27

Slide28Derivation of by Grammar

: input rule

Example2: Arithmetical EXPS

28

Slide29Derivation of by Grammar

: input output rule

Example2: Arithmetical EXPS

29

Slide30Derivation of by Grammar

: input

Example2: Arithmetical EXPS

30

Slide31Derivation of by Grammar

: input rule

Example2: Arithmetical EXPS

31

Slide32Derivation of by Grammar

: input output rule

Example2: Arithmetical EXPS

32

Slide33Derivation of by Grammar

: input

Example2: Arithmetical EXPS

33

Slide34Derivation of by Grammar

: input rule

Example2: Arithmetical EXPS

34

Slide35Derivation of by Grammar

: input output rule

Example2: Arithmetical EXPS

35

Slide36Derivation of by Grammar

: input

Example2: Arithmetical EXPS

36

Slide37Derivation of by Grammar

: input rule

Example2: Arithmetical EXPS

37

Slide38Derivation of by Grammar

: output rule

Example2: Arithmetical EXPS

38

Slide39Derivation of by Grammar

: input

Example2: Arithmetical EXPS

39

Slide40Derivation of by Grammar

: input rule

Example2: Arithmetical EXPS

40

Slide41Derivation of by Grammar

: output rule

Example2: Arithmetical EXPS

41

Slide42Derivation of by Grammar

: input

Example2: Arithmetical EXPS

42

Slide43Derivation of by Grammar

: input rule

Example2: Arithmetical EXPS

43

Slide44Derivation of by Grammar

:

Example2: Arithmetical EXPS

44

Slide45Derivation of by Grammar :

Example2: Arithmetical EXPS

45

Note:

There is more than one derivation.

Slide46To be Demonstrated on the blackboard

Example3: The Language of WF ( )

46

Slide47We already saw that a word may have more then a single derivation from the same grammar.A Leftmost Derivation is a derivation in which rules are applied in order left to right.A grammar is ambiguous if it has Two parse trees.

Ambiguity

47

Slide48Reminder: Two parse trees are equal if they are equal as trees and if all productions corresponding to inner nodes are also equal .

Ambiguity

48

Slide49Grammar : Rules:

Example4: Similar to Arith. EXPS

49

,

,

Slide50Example4: 1

st

Parse Tree for______

50

Slide51Example4: 2

nd

Parse Tree for_____

51

Slide52Note: Some ambiguous grammars may have an unambiguous equivalent grammar.But: There exist Inherently Ambiguous Grammars , i.e. an ambiguous grammar that does not have an equivalent unambiguous one.

Ambiguity

52

Slide53Q: From a computational point of view, how strong are context free languages?A: Since the language is not regular and it is CF, we conclude that . Q: Can one prove ?A: Yes.

Discussion

53

Slide54Q: A language is regular if it is recognized by a DFA (or NFA). Does there exist a type of machine that characterizes CFL?A: Yes, those are the Push-Down Automata (Next Lecture). . Q: Can one prove a language not to be CFL ?A: Yes, by the Pumping Lemma for CFL-s . For example: is not CFL.

Discussion

54

Next Slides