Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9092535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:52:02+00:00 2026-06-16T22:52:02+00:00

I need some help with deciding if a given language is regular, context-free or

  • 0

I need some help with deciding if a given language is regular, context-free or not context-free. A brief, informal explanation is sufficient in the answer, hence no need to use pumping lemma.

Lets say I have the following lanugages:

L1 = { w ∈ {a, b, c, d}* | #a(w) is even, #b(w) = 1 mod 3, w does not have 
                           a substring abc }

L2 = { w  ∈ {a, b, c, d}* | #a(w) is even, #b(w) < #c(w) }

L3 = { w  ∈ {a, b, c, d}* | #a(w) < #b(w) < #c(w) }

This is my solution:

L1 = L2 ∩ L3 ∩ L4 where

L2 = #a(w) is even
L3 = #b(w) = 1 mod 3
L4 = w does not have a substring abc 

A DFA can be constructed for L2, becuse L2 does not need infinite memory, so L2 is regular. For L3 the same reasoning as above. And for L4 we can construct a DFA that simply does not accept “abc”, hence regular.

L1 is regular because regular languages are closed under ∩ .

For L2 we can divide the language into:

L2 = L3 ∩ L4 where

L3 = #a(w) is even
L4 = #b(w) < #c(w)

We know that a DFA can be constructed for L3, hence L3 is regular. L4 is context-free because we can construct a PDA where a stack is used to count the number of a:s and b:s.

L2 is hence context-free because the ∩ of a regular language and a context-free language result in a context-free language.

For L3 we can see that it’s non context-free because we are limitied to 1 stack, and to do more than 1 comparison we need more stacks.

Is my reasonings rights ? I have a exam soon and need to know if I have got the idea behind this.

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:52:03+00:00Added an answer on June 16, 2026 at 10:52 pm

    Yes, you are correct on all three counts. L1 is regular, L2 is context-free, and L3 is not context-free. You correctly apply closure properties for L1 and L2, and your reasoning is more or less correct for the last one. For the last one, I would caution you against using that rule… since there may be more than one way to think about how a language could be recognized, some of which require more than a stack, and some of which don’t. Take, for instance, the non-context-free language L = {a^n b^n c^n}. The complement of this language is context-free, although sloppy application of the rule you use might lead you to believe otherwise (until you’d properly considered the matter).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

need some help. I need to count regular working days for a given date
Need some help with Python syntax Pesudo code if param is not None in
Need some help with crypto routines in Java. Given a PKCS#7 signature, I want
Need some help, I have a regular expression that appears to work just fine
I am relatively new to revision control and I need some help deciding if
Need some help please with this error : TypeError : 'unicode' object does not
Need some help with a small problem. I'm not too hot on the maths
I need help decoding this regular expression from sprockets. I am not sure what
I need some help deciding between the Professional or the Enterprise versions of Monotouch.
Need some help... I have jasperserver 4.1 installed on my ubuntu. It runs via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.