Prerequisite – Finite automata, L-graphs and what they represent
L-graphs can generate context sensitive languages, but it’s much harder to program a context sensitive language over programming a regular one. This is why I’ve came up with a hypothesis about what kind of L-graphs can generate a regular language. But first, I need to introduce you to what I call an iterating nest.
As you can remember a nest is a neutral path
, where
and
are cycles and
path is neutral. We will call
an iterating nest, if
,
and
paths print the same string of symbols several times, to be more exact
prints
,
prints
,
prints
,
and
is a string of input symbols (better, if at least one of
).
From this definition comes out the next hypothesis.
Hypothesis – If in a context free L-graph G all nests are iterating, then the language defined by this L-graph G, L(G), is regular.
If this hypothesis will be proven in the near future, it can change a lot in programming that will make creating new easy programming languages much easier than it already is. The hypothesis above leads to the next algorithm of converting context free L-graphs with iterating nests to an NFA.
Algorithm – Converting a context free L-graph with iterating complements to a corresponding NFA
Input – Context free L-graph
with iterating complements
Output – ![]()
- Step-1: Languages of the L-graph and NFA must be the same, thusly, we won’t need a new alphabet
. (Comment: we build context free L-graph G’’, which is equal to the start graph G’, with no conflicting nests)
- Step-2: Build Core(1, 1) for the graph G.
V’’ := {(v,
) | v
V of
canon k
Core(1, 1), v
k}
:= { arcs
| start and final states
V’’}
For all k
Core(1, 1):
Step 1’. v := 1st state of canon k.
.
V’’
Step 2’.
arc from state
followed this arc into new state defined with following rules:
, if the input bracket on this arc
;
, if the input bracket is an opening one;
, if the input bracket is a closing bracket
v := 2nd state of canon k
V’’
Step 3’. Repeat Step 2’, while there are still arcs in the canon. - Step-3: Build Core(1, 2).
If the canon has 2 equal arcs in a row: the start state and the final state match; we add the arc from given state into itself, using this arc, to
.
Add the remaining in
arcs v – u
to
in the form of
- Step-4:

(Comment: following is an algorithm of converting context free L-graph G’’ into NFA G’) - Step-5: Do the following to every iterating complement
in G’’:
Add a new state v. Create a path that starts in state
, equal to
. From v into
create the path, equal to
. Delete cycles
and
.
- Step-6: G’ = G’’, where arcs are not loaded with brackets.
So that every step above is clear I’m showing you the next example.
Context free L-graph with iterating complements
,
which determines the ![]()
Start graph G

Core(1, 1) = { 1 – a – 2 ; 1 – a, (1 – 1 – a – 2 – a, )1 – 2 ; 1 – b, (2 – 2 – c, )2 – 3 }
Core(1, 2) = Core(1, 1)
{ 1 – a, (1 – 1 – a, (1 – 1 – a – 2 – a, )1 – 2 – a, )1 – 2 }
Step 2: Step 1’ – Step 3’
![Rendered by QuickLaTeX.com \Rightarrow\\ V'' = \{(1, \varepsilon), (2, (_2), (3, \varepsilon), (1, (_1), (2, )_1), (2, \varepsilon)\}\\* \lambda'' = \{ \\*(: \{ (1, \varepsilon) - a - (1, (); (1, () - a - (1, () \}, \\*): \{ (2, )) - a - (2, )); (2, )) - a - (2, \varepsilon) \}, \\*\big[: \{ (1, \varepsilon) - b - (2, [) \}, \\*\big]: \{ (2, [) - c - (3, \varepsilon) \}, \\*\varepsilon: \{ (1, \varepsilon) - a - (2, \varepsilon); (1, () - a - (2, )) \} \}\\ P''_0 = (1, \varepsilon)\\ F'' = \{(2, \varepsilon), (3, \varepsilon)\}\\ G'' = (\Sigma'', V'', P'', \lambda'', P''_0, F'')](https://web.archive.org/web/20201128152527im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-ab58afb93958e34efbd4bbbcd5df155a_l3.png)
Intermediate graph G’’

NFA G’
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Conversion of Epsilon-NFA to NFA
- NFA for language at least one of the symbols occurring an odd number of times
- ∈-NFA of Regular Language L = {ab,ba}
- Difference between DFA and NFA
- Conversion from NFA to DFA
- Program to Implement NFA with epsilon move to DFA Conversion
- Regular expression to ∈-NFA
- NFA machines accepting all strings that ends or not ends with substring 'ab'
- NFA to accept strings that has atleast one character occurring in a multiple of 3
- NFA which accepts set of strings over an alphabet {0, 1, 2} such that the final digit has appeared before
- ∈-NFA of L = (a* + b*)
- Recursive and Recursive Enumerable Languages in TOC
- Decidability and Undecidability in TOC
- Mealy and Moore Machines in TOC
- Undecidability and Reducibility in TOC
- L-graphs and what they represent in TOC
- Computable and non-computable problems in TOC
- Kleene's Theorem in TOC | Part-1
- Determining Countability in TOC
- Turing Machine in TOC
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

