Chomsky Hierarchy and Pumping Lemma for Context-Free Languages

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/17

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

18 Terms

1
New cards

A Hierarchy of Languages

  • Studied regular and context-free languages in some detail. 

  • All regular languages are also context-free languages, but some context-free languages are not regular. 

  • We can therefore construct a containment hierarchy of these languages. 

  • Languages at each level are a strict subset of the languages at the next level.

2
New cards

The Universe of Languages

  • The universe of languages:

3
New cards

The Chomsky Hierarchy

Chomsky hierarchy - containment hierarchy for languages that includes the two families of languages we have studied, but also goes beyond them.

4
New cards

Containment of Language Classes

  • The containment of Language Classes

5
New cards

Other Classes of Language

  • In addition to the languages of the Chomsky hierarchy, we have met several others during the course:

    • Finite languages

    • Infinite languages

    • Inherently ambiguous languages

    • Languages accepted by DPA by final state

    • Languages accepted by a DPA by empty stack

    • Languages with an s-grammar

6
New cards

Relationship between Language Classes

  • Relationship between language classes

7
New cards

Type - 0 Languages

  • We have been primarily interested in simple language classes and their applications in relatively constrained problems. 

  • At Type-0 we can become more interested in asking what computations can be done by any computational device.

8
New cards

Turing Machines

  • A Turing machine is an automaton like those we have studied, but with an infinitely long ‘tape’ that it can read and write to. 

  • A linear-bounded automaton is essentially the same but the tape has a fixed finite length.

9
New cards

Computability

  • Turing machines help computer scientists to understand the limits of computation. 

  • Church-Turing Thesis - everything computable is computable by a Turing machine. 

  • But if this is the case, how do Turing machines

    • Compute algorithmic expressions?

    • Execute stored programs?

    • . . .

10
New cards

Incomputable Problems

  • There are problems for which one cannot create a Turing machine (nor a Java program, C program, . . . ) that will always halt with a ‘yes’ or ‘no’ answer. 

    • Halting problem

    • Post correspondence problem 

    • . . .

11
New cards

What do we want from a Programming Language?

  • Expressiveness 

    • Most natural languages are context-free - but if we want to have matching brackets (or nested begin-end, for-next, etc. statements) then need a more powerful language than a regular one. 

  • Clarity 

    • The meaning of a program has to be unambiguous. Inherently ambiguous languages must therefore be avoided, and unambiguous grammars should be preferred. 

  • Efficiency

    • Parsing non-deterministic languages can involve huge amounts of work having to be done in parallel or lots of backtracking. Using a deterministic language makes the understanding of the language much simpler.

12
New cards

Good Choices for Programming Languages

  • Good choices for programming languages

13
New cards

Attaching Meaning to Programs

  • In this module - interested in syntax - rules describing whether an item is in a language. 

  • If the items in our languages are computer programs then we also need to associate them with semantics - what the item means. 

  • One way to do this is using an attribute grammar. 

  • Each production in the grammar has an associated rule stating how the meaning of the LHS symbol is made up from the meanings of the RHS symbols.

14
New cards

Closure Properties for Context-Free Languages

  • Theorem - the family of CFLs is closed under union, concatenation and star-closure. 

  • Proof outline - suppose L1 and L2 are CFLs with grammars G1 = (V1, T1, S1, P1) and G2 = (V2, T2, S2, P2).

15
New cards

Intersection and Complementation for CFLs

  • Intersection and Complementation for CFLs

16
New cards

Pumping Lemma for Context-Free Languages

  • We previously looked at how Pumping Lemma for Regular Languages encapsulated a result about regular languages, and could be used to show that a language was not regular. 

  • Look at a similar result for CFLs. This time, it says that, in any sufficiently-long string in a CFL, we can find two substrings that can be pumped (repeated as often as desired), and the result remains in the language. Again, we can use this Pumping Lemma to show that a language is not context-free.

17
New cards

Proof Outline

Proof outline:

18
New cards

Template for Application of PL for CFLs

Template for Application of PL for CFGs