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 6661257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:15:26+00:00 2026-05-26T02:15:26+00:00

Is it possible to come up with a linear grammar with unequal number of

  • 0

Is it possible to come up with a linear grammar with unequal number of 0s and 1s?

Such as 0100, 01100, 111,1,0, 100101001…

I know there is a context-free grammar for this, but is there a linear grammar?

Thanks.

  • 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-05-26T02:15:27+00:00Added an answer on May 26, 2026 at 2:15 am

    A grammar is regular if and only if it is either left regular or right regular. The left regular grammars are equivalent to the left linear grammars. The right regular grammars are equivalent to the right linear grammars. Therefore, if a regular grammar exists that generates the indicated language, then it is either right or left regular, and hence equivalent to either a left or right linear grammar.

    edit1:

    Note that there’s no regular grammar generating the indicated language LUNEQ. To see this, consider the fact that LEQ = { w : na(w) = nb(w)} is the complement of LUNEQ. Because the regular languages are closed under complementation and LEQ is not a regular language, LUNEQ is not a regular language.

    edit2:

    I believe the pumping lemma for linear languages can be used to show that the indicated language LUNEQ is not linear. Here is what I’ve come up with. I’m fairly confident it’s correct. My primary concern is that you were asked – presumably – for a linear language generating the indicated language; however, I came to the conclusion that there is no such grammar.

    Assume LUNEQ is linear. By the pumping lemma for linear languages, there exists an n > 0 depending on LUNEQ such that for all z ∈ LUNEQ, z can be written uvwxy where:

    • |vx| > 0,
    • |uvxy| ≤ n, and
    • uviwxiy ∈ LUNEQ for all i ≥ 0.

    Let n be the constant guaranteed be the pumping lemma. Consider the string

    • z = anb(n! + 2n)an

    Since z ∈ LUNEQ, it can be decomposed into substrings uvwxy satisfying the constraints of the pumping lemma such that, for all i ≥ 0, the string

    • uviwxiy = a|u|ai|v|a(n – |u| – |v|)b(n! + 2n)a(n – |x| – |y|)ai|x|a|y|

    is a member of LUNEQ. Since 1 ≤ |vx| ≤ n, |vx| divides n!. Hence, (n!|vx|-1 + 1) is a natural number. Setting i to (n!|vx|-1 + 1) gives the string

    • z‘ = uv(n!|vx|-1 + 1)wx(n!|vx|-1 + 1)y = a|u|a(n!|vx|-1 + 1)|v|a(n – |u| – |v|)b(n! + 2n)a(n – |x| – |y|)a(n!|vx|-1 + 1)|x|a|y|

    Simplifying the pumped string gives us an equal number of a‘s and b‘s:

    • na(z‘) = 2n – |vx| + (n!|vx|-1 + 1)|vx| = 2n + n!

    Since (2n + n!) is equivalent to the number of b‘s in the pumped string, z‘ ∉ LUNEQ. But this contradicts the assumption that LUNEQ is a linear language. Hence, LUNEQ is not a linear language.

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

Sidebar

Related Questions

Possible Duplicate: C# Why can equal decimals produce unequal hash values? I've come across
Is it possible for UDP data to come to you corrupted? I know it
I expect there are many possible solutions to this question, I can come up
Possible Duplicate: Dynamically Importing JavasScript Is there a way to access variables which come
Possible Duplicate: How come I can't remove the blue textarea border in Twitter Bootstrap?
Is it possible to add come comment at the beginning of files during checkout
I'm trying to come up with the largest possible group of friends that would
Possible Duplicate: Where does ‘Hello world’ come from? What was the first Hello World
I'm trying to come up with an algorithm that will print out all possible
I have a form containing a ModelMultipleChoiceField . Is it possible to come up

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.