Context Sensitive Grammar (Automata theory)

  • Thread starter Thread starter Dafydd
  • Start date Start date
  • Tags Tags
    Theory
AI Thread Summary
Context Sensitive Grammar (CSG) allows for multiple valid substitutions, leading to confusion about the order and choice of these substitutions. In the example provided, the transformation of S to abNSc or an empty string depends on the desired outcome, and substitutions can be chosen freely as long as they adhere to the production rules. The arbitrary nature of substitutions can create the impression of randomness, but understanding the target string helps guide the process. The discussion highlights the flexibility in applying rules while constructing strings in CSG. Ultimately, the key is recognizing that while substitutions can be chosen freely, they must lead to the intended result.
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!
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
15
Views
5K
Replies
7
Views
3K
Replies
7
Views
10K
Replies
3
Views
2K
Replies
2
Views
4K
Replies
5
Views
4K
Replies
7
Views
3K
Back
Top