Let $G=(\Sigma,N,R,S)$ be a context-free grammar. For every production rule A --> w, we say that its length is $r$ if $|w|=r$. In addition $n = |N|$, and $k =$ the maximal length of a production rule in the grammar. We assume here that $L(G)$ is not empty. Find a tight upper bound (an arithmetic expression f(n,k)) for the shortest word in L(G). Namely, find an expression such that the shortest word in L(G) is at most f(n,k), but there is another context-free grammar F such that the shortest word in L(F) is exactly f(n,k). Thanks a lot :)
2026-03-28 06:14:53.1774678493
The shortest word in context free language
882 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in AUTOMATA
- Exitstance of DPA of L = $\{ww^r\}$
- Automata defined by group presentations.
- How to prove convergence of a sequence of binary numbers
- A finite automaton that accepts at least three $a$s and at least two $b$s.
- Is my DFA correct?
- Intersection of two languages (Formal Languages and Automata Theory)
- Is there any universal algorithm converting grammar to Turing Machine?
- Build a Context-Free Grammar for a given language
- Prove that $B = B ^+$ iff $BB \subseteq B$
- Proving a Language is Regular via Automata
Related Questions in CONTEXT-FREE-GRAMMAR
- Constructing context free grammar with a number constraint to one of the elements in the language
- Converting CFG to a regular expression
- Is First Order Logic Syntax Context Free?
- Can first-order logic be recognized by a pushdown automaton?
- Build a Context-Free Grammar for a given language
- Regular expression: At least two a's and doesn't end in bb
- Context Free Grammar for a 3-variable language
- Given language, say if it is regular, context-free and proove it.
- How to calculate the minimum pumping length for some L?
- Significance of reflexive and transitive closure in String, Language & CFG
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Intuitively, if we're trying to make the word as short as possible, we might want to get rid of the non-terminals as soon as possible and replace them by as few terminals as we can.
More formally, if the language $L(G)$ is non-empty, the grammar must contain at least one rule of the form $A\rightarrow w$ with $w$ containing no non-terminals (otherwise one would never be able to get rid of them all); let's call such rule terminal too. Now, consider the terminal rule with $|w|$ as short as possible. Whenever we encounter the non-terminal $A$, we'd have to eventually apply some terminal rule to get rid of it. However, any such rule would result in at least as many terminals as applying the chosen one straight away; so we can safely apply the chosen rule as soon as we can and forget all other rules applicable to $A$ (as they won't be used ever).
The grammar can be simplified a bit now: Since $A$ is now essentially the same as $w$, we can actually get rid of $A$ completely and replace it by $w$ in all the rules. Doing so reduces the set of non-terminals by one and possibly expands the length of the remaining production rules. This expansion is at most $k$-fold, though, because each rule has at most $k$ non-terminals on the right-hand side (and, very importantly, this stays true after the expansion too). The new grammar has $(n-1)$ non-terminals and the maximal length of production rule in it dos not exceed $k^2$.
Not very surprisingly, we can repeat the same process over and over, reducing the number of non-terminals by $1$ and expanding the production rules at most $k$-fold each time. Repeating it $(n-1)$ times in total yields a grammar with just one non-terminal and production rules of length not exceeding $f(n,k)=k^n$, which gives us the desired upper bound on the length of the shortest word in $G$.
In order to see that it's tight, it's sufficient to consider a very simple grammar $G_{n,k}=(\{a\},\{A_1,A_2,\ldots A_n\}, R, A_1)$ with ruleset $R$: $$\begin{eqnarray*} A_1 & \rightarrow & \overbrace{A_2A_2 \ldots A_2}^{k} \\ A_2 & \rightarrow & A_3A_3 \ldots A_3 \\ & \ldots & \\ A_{n-1} & \rightarrow & A_nA_n \ldots A_n\\ A_n & \rightarrow & \underbrace{aa\ldots a}_{k} \\ \end{eqnarray*}$$