Determine if the string is in L(G)

  • Context: MHB 
  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    String
Click For Summary
SUMMARY

The discussion focuses on developing an $O(n^3)$ algorithm to determine if a string $w=a_1 a_2 \dots a_n$ belongs to the language $L(G)$ defined by a context-free grammar $G=(N,\Sigma ,P, S)$ in Chomsky normal form. The proposed solution utilizes dynamic programming, specifically by maintaining a set $N[i,i+s]$ of all symbols that can derive substrings $x_i\dots x_{i+s}$. This approach is detailed in Section 3.6 of "Elements of the Theory of Computation" by Lewis and Papadimitriou, Theorem 7.16 in "Introduction to the Theory of Computation" by Sipser, and Section 7.4.4 in "Introduction to Automata Theory, Languages, and Computation" by Hopcroft, Motwani, and Ullman.

PREREQUISITES
  • Understanding of context-free grammars and Chomsky normal form
  • Familiarity with dynamic programming techniques
  • Knowledge of algorithm complexity analysis, specifically $O(n^3)$ algorithms
  • Basic concepts of formal languages and automata theory
NEXT STEPS
  • Study dynamic programming applications in parsing algorithms
  • Review Section 3.6 in "Elements of the Theory of Computation" for detailed algorithmic insights
  • Explore Theorem 7.16 in "Introduction to the Theory of Computation" for theoretical foundations
  • Investigate Section 7.4.4 in "Introduction to Automata Theory, Languages, and Computation" for additional context-free grammar examples
USEFUL FOR

Students and professionals in computer science, particularly those focusing on algorithms, formal languages, and automata theory, will benefit from this discussion.

mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hey! :o

I have to write an $O(n^3)$ algorithm to determine whether a given string $w=a_1 a_2 \dots a_n$ is in $L(G)$, where $G=(N,\Sigma ,P, S)$ is a context-free grammar in Chomsky normal form.

Could you give me some hints how to do that?? (Wondering)
 
Technology news on Phys.org
Could you explain me how we could use the dynamic programming in this case?? (Wondering)
 
This is described in Section 3.6 in [1], Theorem 7.16 in [2] and Section 7.4.4 in [3]. Briefly, the idea is the following. Given a word $x_1\dots x_n$, for each $i$ and $s$ such that $1\le i\le i+s\le n$ find the set $N[i,i+s]$ of all symbols that can derive $x_i\dots x_{i+s}$. This computation occurs in a loop where $s$ changes from 1 to $n-1$.

[1] Lewis, Papadimitriou. Elements of the Theory of Computation. 2nd edition.

[2] Sipser. Introduction to the Theory of Computation. 2nd edition.

[3] Hopcroft, Motwani, Ullman. Introduction to Automata Theory, Languages, and Computation. 2nd edition.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
12
Views
3K