πŸŽ“ Computer Science & Engineering Portal

Master Engineering Disciplines with Structured Notes

Comprehensive academic lecture notes, exam-oriented unit summaries, laboratory manuals, and previous year question papers designed strictly for university students.

πŸ“‘

University Syllabi

AKTU & AICTE aligned semester guidelines.

πŸ“

Exam Question Papers

Previous 5 years solved university papers.

πŸ’‘

Lab Manuals & Viva

Practical codes with outputs & interview Qs.

Core Subjects & Units Hub

Click on any specific unit to immediately view its lecture notes below

Viewing All Lectures

Closure properties of CFL

Context-free languages are closed under βˆ’

  • Union
  • Concatenation
  • Kleene Star operation

Union

Let L1 and L2 be two context free languages. Then L1 βˆͺ L2 is also context free.

Example

Let L1 = { anbn , n > 0}. Corresponding grammar G1 will have P: S1 β†’ aAb|ab

Let L2 = { cmdm , m β‰₯ 0}. Corresponding grammar G2 will have P: S2 β†’ cBb| Ξ΅

Union of L1 and L2, L = L1 βˆͺ L2 = { anbn } βˆͺ { cmdm }

The corresponding grammar G will have the additional production S β†’ S1 | S2

Concatenation

If L1 and L2 are context free languages, then L1L2 is also context free.

Example

Union of the languages L1 and L2, L = L1L2 = { anbncmdm }

The corresponding grammar G will have the additional production S β†’ S1 S2

Kleene Star

If L is a context free language, then L* is also context free.

Example

Let L = { anbn , n β‰₯ 0}. Corresponding grammar G will have P: S β†’ aAb| Ξ΅

Kleene Star L1 = { anbn }*

The corresponding grammar G1 will have additional productions S1 β†’ SS1 | Ξ΅

Context-free languages are not closed under βˆ’

  • Intersection βˆ’ If L1 and L2 are context free languages, then L1 ∩ L2 is not necessarily context free.

  • Intersection with Regular Language βˆ’ If L1 is a regular language and L2 is a context free language, then L1 ∩ L2 is a context free language.

  • Complement βˆ’ If L1 is a context free language, then L1’ may not be context free.

Labels: ,

Discussion & Queries (<$I18NNumComments$>):

<$CommentPager$>
<$I18NAtCommentTimeWithPermalink$>, <$I18NCommentAuthorSaid$>

<$BlogCommentBody$>

<$BlogCommentDeleteIcon$>
<$CommentPager$>