Lecture 9 - Context-Free Languages & Context-Free Grammars Flashcards

Context-Free/Regular Grammars, Context-Free/Regular Languages

1
Q

Finite Automata are:

A

Formal language recognizers - they are devices that accept valid strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Context-free Grammars are:

A

A certain type of formal language generators - they are devices that produce valid strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A Context-Free Grammar is a

A

Quadruple
G = (V, Σ, R, S)

V is an alphabet
Σ ⊆ V is a set of terminals
V − Σ is the set of nonterminals
R is a finite set of rules R ⊆ (V − Σ) × V∗
S ∈ V − Σ is the start symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Terminal vs Nonterminal

A
  • Alphabet the words of the language are made from and we
    denote its elements, by small letters or symbol σ
                VS
  • Symbols of capital letters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A language L is a context-free language iff.

A

There is
a context-free grammar G such that
L = L(G)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Definition of the language L(G) generated by G

A

L(G) = {w ∈ Σ∗ :
S∗⇒G w}

where ⇒∗G
is a transitive, reflexive closure of ⇒G

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is fact 1?

A

The language L = {a^nb^n : n ≥ 0} is context-free

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is fact 2?

A

RL != CFL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the theorem?

A

The class of all regular languages is a proper subset of the class of all context-free languages, i.e.
RL ⊂ CFL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A context-free grammar is called regular, or right-linear iff.

A

R ⊆ (V − Σ) × Σ∗ ((V − Σ) ∪ {e})

A regular (right-linear) grammar is a context-free grammar such that the right-hand side of every rule
contains at most one nonterminal, which if present, must be
the last symbol in the string. The rules must have a form
A → wB, A → w for any A, B ∈ V − Σ,
w ∈ Σ∗

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

L-G Theorem

A

Establishes
the relationship between the Regular Languages
and Regular Grammars; Language L is regular iff. there exists a regular grammar G such that
L = L(G)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

R-CF Theorem

A

By definition, any regular grammar is context free and
hence generates a context-free language; The class RL of all regular languages is a proper subset
of the class CFL of all context-free languages, i.e.
RL ⊂ CFL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly