I'm a bit annoyed with myself that I gave up too quick and had a glimpse of a quine which gave me the way forward. But I can construct the argument, and the sticking point, since I only gleened a small part of the problem.
A quine is a program which outputs (prints) itself. I'll use QBasic which is free and simple. It uses " for quotations and can't print " direct u need to use CHR$(34). I'm going to use ' for simplicity, so to use the program this will need be corrected.
We know then that it must include an output function that is 'PRINT' which sends whatever follows to the output screen. So our starting program is:
PRINT
it does nothing. So we know we need to print itself so we get
PRINT 'PRINT'
which produces an output of: PRINT. But putting new PRINTs in the code while it does produce a new PRINT in the output, also puts a new PRINT in the code so we never solve the problem.
What we need to do is add a PRINT to the output without typing it directly in the program. The easiest way to do this is to put the PRINT in memory (like a second screen) and then copy that twice to the output. That way you have 2 prints in the program (like the example above) and two in the output. Thus the problem has been solved and the backbone of the quine is done.
convert PRINT 'PRINT' to
a$ = 'PRINT': PRINT a$ a$
This was the sticking point for me last night, I was stuck on the approach of thinking that the a$ must include the program so I was starting like this:
a$ = 'a$ = ': PRINT a$ a$ -- This creates another problem of the type above. You need to mix data/code between the two parts of the equation ... it will be explained.
So given the basic structure above all we need to do is fill in the syntactic details. Firstly let us get the PRINT statement right so that it outputs as close as we possible to the above. In other words lets take the program elements of the first part and feed them into the data element of the PRINT statement in th second part.
: PRINT 'a$ = '' + a$ + '':' + a$
This outputs: a$ = 'PRINT': PRINT
So now take the program code of the second part (after the :) and feed that into the a$ data of the first part.
a$ = "PRINT 'a$ = '' + a$ + '':' + a$' :
Stick those together and you got a quine
a$ = "PRINT 'a$ = '' + a$ + '':' + a$' : PRINT 'a$ = '' + a$ + '':' + a$
However this does not work because on each line the data is enclosed by " marks, while the representation of " as data is '. If they were the same the program does not know whether to treat them as string delimiters or just parts of a string. If you then start filling out CHR$(34) then the code just keeps expanding endlessly.
This method does not work.
Trying to code delimiters and then enclode them within other delimiters is bound to fail because you will always have that problem we started with of a highest level delimiter which cannot be encoded.
A brute force method to solve this is to not use delimiters at all. The CHR$(34) method suggested above is the only way in QBasic to PRINT a " symbol since the " symbol is recognised by the language so we PRINT CHR$(34). We will have to use this method anyway somewhere.
So convert the whole string into ASC codes. There is a standard method in the language using READ to assign a variable with data from a DATA list.
Simply write the READ, DATA block with a line to print the CHR$ of each number, and another line to collect the list of data. Then once the data has all been read it prints the collection of data.
So the quine program reads its own data. Turns this into character output and then prints the data that it constructed itself from.
What the program could do is find its own place in memory and read itself into another memory location. Not that amazing really.
In the Quine though I've done that work already creating the data list. Using a recursive algorithm to write the program block, then encode it, then see how big it is and adjust the program and the code parameters until they match.
To note then: obviously the program gets written first. Without the engine nothing happens. This is a general solution to the problem of outputting data. Then just get it to print the data again to produce the data block at the end of the program. Then put in the data specific to itself and voila.
Its not as neat or intriguing as the first approach and I write endlessly here trying to find a way into the problem of "encoding itself". This second solution simply avoids the problem completely ... but how?
===
blurb from the first draft of this entry...
Now I'm interested in this process analogously because what I am having difficulty with, and the basis of my proof if such exists, is the implication of dualisms. For example where someone presents a limit to knowledge then this limit must be different from the knowledge itself. This is analogous to the data / program distinction. Other examples are subject / object. However if arguments of the Quine type can be constructed we have a way of expressing the "back breaking" job that dualisms create and find a way of overcoming the division.
Maybe then this investigation does not lead to a disproof of limits, but rather an personal understanding of how to construct limits within themselves, so that we can have something which full represents itself.
It is interesting that to do this we need to construct 2 copies of the partial structure, and that partial structure "represents" that dual creation. This if we were a "quine" only processing data we would know that our theorum on which we worked had two copies.
Q: how could a quine ever know that it was a quine? The process of comparing program and output is done by the user?
Q2: Next task a binary quine.
Q3: Is there a self-organising automaton version of the quine using recursive processes like above? Thesis/Anti-thesis -> Synthesis.
A search for happiness in poverty. Happiness with personal loss, and a challenge to the wisdom of economic growth and environmental exploitation.
Subscribe to:
Post Comments (Atom)
"The Jewish Fallacy" OR "The Inauthenticity of the West"
I initially thought to start up a discussion to formalise what I was going to name the "Jewish Fallacy" and I'm sure there is ...
-
The classic antimony is between : (1) action that is chosen freely and (2) action that comes about through physical causation. To date no ...
-
Well that was quite interesting ChatGPT can't really "think" of anything to detract from the argument that Jews have no clai...
-
There are few people in England I meet these days who do not think we are being ruled by an non-democratic elite. The question is just who t...
No comments:
Post a Comment