Context Sensitive Grammar (Automata theory)

  • Thread starter Thread starter Dafydd
  • Start date Start date
  • Tags Tags
    Theory
Click For Summary
SUMMARY

This discussion focuses on Context Sensitive Grammar (CSG) and its application in automata theory. The user seeks clarification on the non-deterministic nature of substitutions in CSG, specifically regarding the production rules for the languages {an bn cn | n E N} and {1, 1^2, 1^4, 1^8, ...}. The conversation highlights that substitutions can be chosen freely, emphasizing the flexibility in applying production rules to derive strings. Understanding this flexibility is crucial for mastering context-sensitive languages.

PREREQUISITES
  • Context Sensitive Grammar principles
  • Production rules in formal languages
  • Non-determinism in automata theory
  • Basic understanding of language generation
NEXT STEPS
  • Study the Chomsky hierarchy of grammars
  • Learn about non-deterministic finite automata (NFA)
  • Explore parsing techniques for context-sensitive languages
  • Investigate applications of CSG in computational linguistics
USEFUL FOR

Students of computer science, linguists, and anyone interested in formal language theory and automata, particularly those looking to deepen their understanding of context-sensitive grammars.

Dafydd
Messages
11
Reaction score
0
Sorry if this is the wrong forum.

I'm trying to get my head around Context Sensitive Grammar. In my coursebook, there's an example ('e' here is the empty string, epsilon, and 'E' is the "set member" symbol):

The language {an bn cn | n E N} is described by the following rules:

S -> e | abNSc
bNa -> abN
bNb -> bbN
bNc -> bc

And then it shows how to build aabbcc:

S -> abNSc
-> abNabNScc
-> abNabNcc
-> aabNbcc
-> aabbNcc
-> aabbcc

The part I don't understand is why S becomes abNSc after the first substitution, while the second time it becomes an empty string. The rules state both substitutions are possible, but not when to use which one. Can this be choosen freely?

Another language (with 4 non-deterministic symbols S, D, [, ]) describes {1, 1^2, 1^4, 1^8, ...}. Its rules:

S -> [1]
[ -> [D
D1 -> 11D
D] -> ]
[ -> e
] -> e

Example, building the string 11111111:

S -> [1] -> [D1] ->* [DDD1]
-> [DD1D]
-> [D11D1D]
-> [D1111DD]
-> [11D111DD]
-> [1111D11DD]
-> [111111D1DD]
-> [11111111DDD]
-> [11111111DD]
-> [11111111D]
-> [11111111]
-> [11111111
-> 11111111

Again, the number of times a substitution is carried out seems to be random, or at least arbitrary. Why do you not just keep doing the substitution from [ to [D indefinitely? Because you know how many times it needs to be done in order to get the resulting string you want? Can you choose to do the substitutions in any order you want (as long as it gets you the result you want), or is there a pattern to follow?

Thanks for any help.
 
Technology news on Phys.org
The language defined by a grammar consists of every string that you can produce by applying the production rules.
Can you choose to do the substitutions in any order you want
So yeah.
 
That's all I needed to hear. Thank you!
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 15 ·
Replies
15
Views
6K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
10K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
5K