> - Why is it non-trivial to design a quine? I mean write a code that
> reads in the same source file and prints it back!
Partly because then it would be no-brainer to design a quine, and there wont
be any use in wondering about them.
Formally, in languages where 'side-effects' are not allowed (untyped lambda
calculus, pure Haskell), you can not open a file but still write a quine. These
things are easier to argue about if one have a shared vocabulary such as Lambda
calculus. Else in plain English, things are hard to explain and easy to confuse.
> - How does Turing completeness imply that a programming language can be
> used to write a Quine?
Turing completeness implies that
Any Turing complete computer A (hardware+Turning complete language) can simulate
any other Turing complete computer B. Now if you are writing your quine on the
same machine, then a program P0 can be mimicked by a another program P1 which can
be mimicked by another program P2 and so on. Somewhere you will get a program Pn
which is character by character same as P0.
Above proves the existence of quine in any Turing complete language (ultimately
you gonna get it). Or you can simply say that P(Q) prints the code of program
Q. There exists a program Q which does the same thing as P(Q), print
the source code of Q => Quine. Assumption that printing the source code is a
computable function. [1]
[1]:
http://www.madore.org/~david/computers/quine.html
best,
Dilawar