Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Work on LR(finite) argument

  • Loading branch information...
commit 49ab7c57fbc008138a618f5127b27bec6cc5baf6 1 parent be16d06
Jeffrey Kegler authored
Showing with 39 additions and 32 deletions.
  1. +39 −32 whynot.txt
71 whynot.txt
View
@@ -1,25 +1,30 @@
-Let me outline a less carefully formalized argument than the one in Leo
-1991, one which leads to the same result, but which I think also indicates
+Because of the rewrite of the Marpa algorithm to eliminate LR(0) states,
+I am rewriting the Marpa theory paper. This has led me to re-thinking
+the proofs, and a new look at your 1991 conjecture.
+
+The following argument is less carefully formalized than the argument
+in Leo 1991, but it leads to the same result, and I think it may give
+new insight as to how and why your 1991 works. I think it may explain
why left congruence is a necessary property, and why the result cannot
-be extended to LR(finite pi).
+be extended to LR(finite pi) -- LR for finite partitions.
Conceptually, let's model the parse (not necessarily implementing it)
in terms of reduction decisions, moving from right to left (backwards).
We consider a non-deterministic machine, doing this for all possible
-inputs at once, for some finite input length, |w|. The machine is
-multi-threaded, and the number of threads increases, exponentially and
-without limit, as we move backward over the input.
+inputs at once, for some finite input length, |w|. The machine is theoretical,
+with infinite processors, and the number of threads increases,
+exponentially and without limit, as we move backward over the input.
-The LR property forces us, as we encounter each symbol, for each cell
-of the partition, to choose a specific reduction. But just knowing the
-reduction itself is not sufficient to fully determine the Earley item.
-To be sure we know the origin index, we also need to know the connection
-to other reduction decisions made during the history of our thread.
-Conceptually, I have us proceeding backwards so we cannot determine
-origin indexes as we move, but I think it can seen that once all the
-"histories" have been laid out by the threads, we can change direction,
-retrace the "histories" we have created, and determine the origins of
-each Earley item.
+The LR property forces us, as we encounter each input symbol, for each
+cell of the partition, to choose a specific sequence of reductions in each
+cell of the partition. But just knowing the reduction sequence itself
+is not sufficient to fully determine the set of Earley items. To be sure
+we know the origin indexes, we also need to know the connection to other
+reduction decisions made during the history of our thread. Conceptually,
+I have us proceeding backwards so we cannot determine origin indexes as
+we move, but I think it can seen that once all the "histories" have been
+laid out by the threads, we can change direction, retrace the "histories"
+we have created, and determine the origins of each Earley item.
Consider first, a left congruence. Our threads, as we proceed to the
left, may "fine" into more and more separate histories, but the left
@@ -28,20 +33,22 @@ number of cells in the partition, |pi|. Once there, each thread, and all
its child threads, will make exactly the same reduction decisions as its
"cellmates" for the rest of the input scan.
-Now consider, a finite partition which is not a left congruence.
-The number of reduction decisions, for all threads, at each input symbol
-remains fixed at |pi|, so that the threads, at every input symbol,
-must group themselves into the at most |pi| cells, and make the same
-reduction decisions as their "cellmates". But lack of the left congruence
-property leaves the threads free to change "cellmates" with each change
-of input symobl, so that the possible histories for each thread grows
-exponentially. Taking into account the origin indexes, the number of
-possible Earley items does *not* max out at |pi| times some constant.
-There is in fact no limit on the "fining" of the histories, and the
-number of "histories" can grow as fast as the number of threads.
+Now consider a finite partition which is not a left congruence. Just as
+before, the number of sequences of reduction decisions, for all threads,
+at each input symbol remains fixed at |pi|, so that the threads, at
+every input symbol, must group themselves into at most |pi| cells, and
+make the same sequence of reduction decisions as their "cellmates".
+But lack of the left congruence property leaves the threads free to
+change "cellmates" with each change of input symobl, so that the number
+of possible histories for each thread grows exponentially. Taking into
+account the origin indexes, the number of possible Earley items does *not*
+max out at |pi| times some constant. There is in fact no limit on the
+"fining" of the histories, and the number of "histories" is free to
+increase without limit.
-I think this argument could be made rigorous, though that may well
-take more work than I am able to invest in it. I do hope it at least
-intuitively explains why I think see that left congruence is intimately
-connected to the O(n) result for Leo 1991, and why I think there may
-well be LR(finite pi) grammars which are not O(n).
+I've followed up on this line of argument and I think it leads to a
+new proof of your complexity results of 1991. I have not achieved
+the same level of rigor and detail as in your 1991, but I find this
+line of argument is simpler and the proof that results clearer about
+the connection between the motivation (elimination of right recursion)
+and the LR(finite pi) result.
Please sign in to comment.
Something went wrong with that request. Please try again.