A Variation of Levin Search for All Well-Defined Problems
Fouad B. Chedid

TL;DR
This paper presents a simplified variation of Levin Search, inspired by Hutter's work, that efficiently solves well-defined problems by leveraging provable bounds on the fastest algorithms.
Contribution
The paper introduces a new, simpler algorithm that improves upon previous methods by reducing the runtime bound to a quadratic function of the proof length times the fastest algorithm's runtime.
Findings
Achieves problem-solving time bounded by O(l(f)^2) times the fastest algorithm's runtime.
Simplifies the existing algorithms by integrating ideas from Hutter's approach.
Provides a more practical and theoretically efficient method for solving well-defined problems.
Abstract
In 1973, L.A. Levin published an algorithm that solves any inversion problem as quickly as the fastest algorithm computing a solution for in time bounded by , where is the length of the binary encoding of , and is the runtime of plus the time to verify its correctness. In 2002, M. Hutter published an algorithm that solves any well-defined problem as quickly as the fastest algorithm computing a solution for in time bounded by , where and , where is the length of the binary encoding of a proof that produces a pair , where is a provable time bound on the runtime of the fastest program provably equivalent to . In this paper, we rewrite Levin Search using the ideas of Hutter so that weβ¦
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsComputability, Logic, AI Algorithms Β· Algorithms and Data Compression Β· semigroups and automata theory
A Variation of Levin Search for All Well-Defined Problems
Fouad B. Chedid
AβSharqiyah University, Ibra, Oman
Abstract
In 1973, L.A. Levin published an algorithm that solves any inversion problem as quickly as the fastest algorithm computing a solution for in time bounded by , where is the length of the binary encoding of , and is the runtime of plus the time to verify its correctness. In 2002, M. Hutter published an algorithm that solves any well-defined problem as quickly as the fastest algorithm computing a solution for in time bounded by , where and , where is the length of the binary encoding of a proof that produces a pair , where is a provable time bound on the runtime of the fastest program provably equivalent to . In this paper, we rewrite Levin Search using the ideas of Hutter so that we have a new simple algorithm that solves any well-defined problem as quickly as the fastest algorithm computing a solution for in time bounded by .
keywords: Computational Complexity; Algorithmic Information Theory; Levin Search.
1 Introduction
We recall that the class is the set of all decision problems that can be solved efficiently on a nondeterministic Turing Machine. Alternatively, is the set of all decision problems whose guessed solutions can be verified efficienlty on a deterministic Turing Machine, or equivalently todayβs computers. The interesting part is that the set of all hardest problems in the class (also known as -complete problems) have so far defied any efficient solutions on real computers. This has been a very frustrating challenge given that many of the -complete problems are about real-world applications that we really would like to be able to solve efficiently.
Leonid Levin [6], and independently from Stephen Cook [1], defined the class , identified the class -complete, and gave a few reductions that show the -completeness of some problems (independent from the work of Richard Karp [3]). In that same paper [6], Levin gave an algorithm to deal with -complete problems provided that someone develops a proof that shows . In this case, Levinβs algorithm can be used to develop a polynomial-time solution for every -complete problem. In particular, Levinβs algorithm works with a very broad class of mathematical problems that can be put in the form of inverting easily computable functions. For example, suppose we have a function , where we know nothing about except that it is easily computable. The challenge is to find and to do so in a minimal amount of time. The idea of Levinβs algorithm is to go through the space of all algorithms in search for a fastest algorithm that knows the secret of . In general, let be an inversion problem and let be a known fastest algorithm for that runs in time , where is the runtime of plus the time to verify its correctness. The Universal Search algorithm of Levin, also known as Levin Search, is an effective procedure for findng in time bounded by , where is the length of the binary encoding of . Levin Search can also be used with some forms of optimization and prediction problems, and it is theoretically optimal. The following is a pseudocode for Levin Search: **Pseudocode Levin Search
**.
for all programs , in parallel, do
run for at most steps
if is proved to generate a correct solution for , then return for and halt.
endfor
goto for all programs
**End of Pseudocode
**The idea of Levin Search is to search the space of all programs in increasing order of , or equivalently in decreasing order of , where is the probability contributed to in the overall Solomonoffβs algorithmic probability [8] of finding a solution for . By construction, gives short programs a better chance of being successful on the assumption that short programs are more worthy (Occamβs razor). We mention that the main idea of Levin Search was behind the notion of Levin Complexity, which defines a computable version of Kolmogorov complexity based on time-bounded Turing machines. Let be a fixed reference universal Turing machine, the Levin complexity of a finite binary string is defined as
[TABLE]
Returning to Levin Search, during each iteration of the βforβ loop, each program is assigned a fraction of time proportional to its probability, which basically says that short programs get to run more often.
The rest of this paper is organized as follows. Section 2 describes a sequential implementation of Levin Search and shows that it solves any inversion problem as quickly as the fastest algorithm computing a solution for , save for a factor of . Section 3 describes an improvement on Levin Search for all well-defined problems. A problem is designated as well-defined if its solutions can be formally proved correct and have provably quickly computable time bounds. This improvement, known as Hutterβs algorithm [2], describes an algorithm that solves any well-defined problem as quickly as the fastest algorithm computing a solution for , save for a factor of . Section 4 contains our contribution. We rewrite Levin Search using the ideas of Hutter so that we have a new simple algorithm that solves any well-defined problem as quickly as the fastest algorithm computing a solution for , save for a factor of , where is the length of the binary encoding of a proof that produces a pair , where is a provable time bound on the runtime of the fastest program provably equivalent to . Section 5 contains some concluding remarks.
2 Sequential Levin Search
The pseudocode of Levin Search from the previous section cannot be readily executed on todayβs computers. A sequential version of Levin Search can simulate the parallel execution of all programs by running programs, each for a fraction of time, one after another, in increasing order of their length. Hereafter, we assume that all progams are encoded using prefix-free codes, using for example, Shannon-Fano coding [9]. Let be an inversion problem and let be a known fastest algorithm for that runs in time , where is the runtime of plus the time to verify its correctness. Also, let be the length of the binary encoding of program . **Algorithm Levin Search
**;
for all programs of length do
run for at most steps.
if is proved to generate a correct solution for , return for and halt.
endfor
goto for all programs
End of Levin Search During each time step , the algorithm runs all programs of length in increasing order of their length and gives each program a fraction of time proportional to . Time Analysis. The following proof for the runtime complexity of Levin Search is due to Solomonoff [7]. The βforβ loop in the algorithm takes time . This is true by Kraft inequality [5]. Now, suppose that Levin Search stops at time . Then, the total runtime of this algorithm is
[TABLE]
Moreover, the runtime of is
[TABLE]
Thus,
[TABLE]
This is true because the multiplicative constant is independent of the instance of the problem . We mention that it is this huge multiplicative constant that limits the applicability of Levin Search in practice.
It seems that a possible way to improve the runtime of Levin Search is to find a way, where not all programs of length get executed, for each value of . Ideally, we would like a way that executes at most a single program for each value of , preferably a shortest and fastest one, and this is exactly what we will present in Section 4.
3 Hutterβs Fastest and Shortest Algorithm for All Well-Defined Problems
In [2], Hutter presented an improvement on Levin Search for problems that are well-defined. By this, Hutter means a problem whose solutions can be formally proved correct and have provably quickly computable time bounds. Let be a known fastest algorithm for some well-defined problem . Then, Hutterβs algorithm will construct a solution that is provably equivalent to , for all , in time proportional to , where is a provable time bound on the runtime of , is the time needed to compute , and and are constants which depend on but not on . This shows that Hutterβs agorithm runs in time , save for a factor of 5.
Our work in the next section is inspired by the ideas of Hutter, and so, for completeness, we have included below the details of Hutterβs algorithm as they appear in [2].
The main idea of Hutterβs algorithm is to search the space of all proofs111Given a formal logic system with a set of axioms and inference rules. A proof in is a sequence of formulas, where each formula is either an axiom in or is something that can be inferred using βs axioms and inference rules, and previoulsy inferred formulas. in some formal axiomatic system, and not the space of all programs. In particular, the algorithm searches for those proofs that can tell us which programs are provably equivalent to and have provably quickly computable time bounds. This is doable since the set of all proofs in any formal sysem is enumerable. Moreover, in [2], Hutter showed how to formalize the notions of provability, Turing Machines, and computation time. Let be a fixed reference Universal Turing machine. For finite binary strings and , we assume that
- β’
computes the output of program on input .
- β’
returns a time bound on the runtime of program on input .
Moreover, Hutter defined the following two terms:
- β’
A term is defined such that the formula is true if and only if .
- β’
A term is defined such that the formula is true if and only if takes steps; that is, if .
Then, we say that programs and are provably equivalent if the formula can be proved. The algorithm of Hutter is as follows. **Algorithm Hutter()
**Let , , and .
Run A,B, and C concurrently with 10%, 10%, and 80% of computational resources, respectively. **Algorithm A
**{ This algorithm identifies programs that are provably equivalent to and have provably computable time bounds }
for do
pick the proof in the list of all proofs and
if the last formula in the proof is equal to and
, for some pair of strings then
Let .
End A **Algorithm B
**{ This algorithm finds the program with the shortest time bound in .}
for all in do
run on all in parallel for all with relative computational
resources .
if halts for some and then
and .
endfor all
End B **Algorithm C
**For do
pick the currenlty fastest program with time bound .
run on for steps.
if halts in less than steps, then print result and abort computation
of A, B, and C.
endfor
End C In [2], it was shown that the overall runtime of Hutterβs algorithm is
[TABLE]
where and .
4 A Variation of Levin Search Inspired by the Fastest and Shortest Algorithm of Hutter
We rewrite Levin Search so that it searches, in parallel, the space of all proofs, and not the space of all programs. Let be a known fastest algorithm for some well-defined problem . Then, our algorithm will construct a solution , for all , that is provably equivalent to in time , save for a factor of , where is a provable time bound on the runtime of the fastest program provably equivalent to . We assume a formal axiomatic system and the same terms and defined in Hutterβs algorithm. Moreover, we assume that all pairs are encoded using prefix-free codes, and hence, we have , by Kraft inequality. The following is our Modified Levin Search algorithm: **Algorithm Modified Levin Search()
**; ; ; { is initialized to the empty string }
for all proofs of length do
write down the first characters of proof .
if the last formula in these characters is equal to
and , for some pair of strings then
run for at most steps.
if halts and then
and .
endfor
if then
run for at most steps with time bound .
if halts, then return for and halt.
endif
go to for all proofs
End of Modified Levin Search We note that during each time step , Modified Levin Search runs at most a single provably fast program that is provably equivalent to . **Running time calculation: ** Following [2], let be the finite number of axioms in . Then, each proof is a sequence , for some positive integer , where each is either an axiom or a formula in . It takes time to check if is an axiom, and time to check if is a formula that can be inferred from other formulas , . Thus, checking the validity of all formulas in , and hence the validity of the proof , takes time. The βforβ loop in Modified Levin Search takes time
[TABLE]
This is true because , by Kraft inequality. we next have
[TABLE]
where is the proof that procuded the pair with the shortest provable time bound , among all proofs of length . Thus, the runtime of Modified Levin Search is equal to
[TABLE]
where is the length of the binary encoding of the proof that produced the resultant pair . Suppose that Modified Levin Search stops at time .Then
[TABLE]
This shows that Modified Levin Search runs in time , save for a factor of .
5 Concluding Remarks
We recall that Hutterβs algorithm was designed for well-defined problems. These are problems the solutions of which can be formally proved correct and have provably quickly computable time bounds. For programs provably correct (they halt and compute the correct answer), but for which no quickly computable time bounds exist (For example, the traveling salesman problem), Hutter [2] explained that an obvious time bound for a progam is its actual running time . By replacing with in the runtime of Hutterβs algorithm, and by noticing that, in this case, becomes , we have
[TABLE]
where is the length of the binary encoding of , and is the length of the binary encoding of a proof that produces the program that is provably equivalent to the fastest known algorithm for the problem in hand. Thus, for such programs, Hutterβs algorithm is optimal, save for a huge constant multiplicative term and a huge constant additive term.
We next calculate the runtime of our algorithm in case we are dealing with programs that can be provably correct, but for which no quickly computable time bounds exist. Suppose that our algorithm stops at time . Then, we have
[TABLE]
We also have . Thus,
[TABLE]
Thus, for such programs, the runtime of our algorithm also suffers from a huge constant multiplicative term, but with no additinoal huge additive terms.
We conclude this paper by recalling an approach, proposed by Solomonoff in 1985 [7], to manage the huge multiplicative constant in the big-oh notation of the running time of Levin Search. We do so because we think that the importance of that work of Solomonoff is not widely appreciated. Solomonoff argued that if machines are going to have a problem solving capability similar to that of humans, then machines cannot start from scratch everytime they attempt to solve a new problem. We, humans, rely on our previous knolwedge of solutions to other problems to figure out a solution for a new problem. The basic idea of Solomonoff is that we should be able to construct via a list of references to previously discovered solutions for other related problems. We can imagine writing the code for as , where is a reference to a solution for problem stored on a separate work tape of a Kolmogorov-Uspensky Machine [4]. This way, the solution is a sequence of calls to other solutions stored on the work tapes. This way, the length of would be made significantly smaller than the sum of the lengths of , and the saving in the length of would exponentially decrease the multiplicate constant in the big-oh notation of Levin Search.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] S. A. Cook, The complexity of theorem-proving procedures, Proceedings of the Third Annual ACM Symposium on Theory of Computing. (1971) 151β158.
- 2[2] M. Hutter, The fastest and shortest algorithm for all well-defined problems, International Journal of Foundations of Computer Science . 13:3 (2002) 431β443.
- 3[3] R. M. Karp, Reducibility among combinatorial problems, In R.E. Miller and J.W. Thatcher (editors). Complexity of Computer Computations. (1972) 85β103.
- 4[4] A.N. Kolmogorov and V.A. Uspenski, On the definition of an algorithm, Uspehi Mat. Nauk. 13 (1958), 3β28. AMS Transl. 2nd ser. 29 (1963) 217β245.
- 5[5] L.G. Kraft, A device for quantizing, grouping, and coding amplitude modulated pulses, MS Thesis, Electrical and Engineering Department, MIT.
- 6[6] L. A. Levin, Universal sequential search problems, Problemy Peredaci Informacii . 9 (1973) 115β116. Translated in Problems of Information Transmission . 9 (1973) 265β266.
- 7[7] R. J. Solomonoff, Optimum sequential searh. (1985) 1β13.
- 8[8] R. J. Solomonoff, A formal theory of inductive inference: Part 1 and 2, Inform. Control . 7 (1964) 1β22, 224β254.
