halting-problem

Halting in non-Turing-complete languages

耗尽温柔 提交于 2020-01-12 13:54:54
问题 The halting problem cannot be solved for Turing complete languages and it can be solved trivially for some non-TC languages like regexes where it always halts. I was wondering if there are any languages that has both the ability to halt and not halt but admits an algorithm that can determine whether it halts. 回答1: Yes. One important class of this kind are primitive recursive functions. This class includes all of the basic things you expect to be able to do with numbers (addition,

Halting in non-Turing-complete languages

自作多情 提交于 2020-01-12 13:53:52
问题 The halting problem cannot be solved for Turing complete languages and it can be solved trivially for some non-TC languages like regexes where it always halts. I was wondering if there are any languages that has both the ability to halt and not halt but admits an algorithm that can determine whether it halts. 回答1: Yes. One important class of this kind are primitive recursive functions. This class includes all of the basic things you expect to be able to do with numbers (addition,

How does this proof, that the halting problem is undecidable, work?

╄→гoц情女王★ 提交于 2019-12-20 08:46:12
问题 I'm going over the proof for The Halting Problem in Intro to the Theory of Computation by Sipser and my main concern is about the proof below: If TM M doesn't know when it's looping (it can't accept or reject which is why a TM is Turing Recognizable for all strings), then how would could the decider H decide if M could possibly be in a loop? The same problem will carry through when TM D does its processing. 回答1: This is a "proof by contradiction", a reductio ad absurdum . (Latin phrases are

“Finding all the code in a given binary is equivalent to the Halting problem.” Really?

我只是一个虾纸丫 提交于 2019-12-18 22:18:24
问题 Was just reading the highly voted question regarding Emulators and the statement It's been proven that finding all the code in a given binary is equivalent to the Halting problem. Really stuck out at me. Surely that can't be true? Isn't it just a large dependency graph? Would be really grateful for some further insight into this statement. 回答1: I believe what is meant is "finding all code that is ever executed", i.e. finding coverage, possibly in combination with dynamically generated code.

Determining whether a regex is a subset of another

ぃ、小莉子 提交于 2019-12-17 21:46:46
问题 I have a large collection of regular expression that when matched call a particular http handler. Some of the older regex's are unreachable (e.g. a.c* ⊃ abc* ) and I'd like to prune them. Is there a library that given two regex's will tell me if the second is subset of the first? I wasn't sure this was decidable at first (it smelled like the halting problem by a different name). But it turns out it's decidable. 回答1: Trying to find the complexity of this problem lead me to this paper. The

Is it possible to make a halting function if you don't call it on itself?

白昼怎懂夜的黑 提交于 2019-12-12 14:24:57
问题 The standard proof of of the impossibility of solving the halting problem is usually something like this //does_halt() takes a function as input and returns true if it will ever finish computing function paradox() {if does_halt(paradox()) { while(true){} } } This proof requires that you call the halting function recursively, but is it possible to make a halting function that always computes the correct result as long as it isn't called on itself? 回答1: That proof does not require recursion.

Do agda programs necessarily terminate?

笑着哭i 提交于 2019-12-09 00:45:55
问题 It has been stated a few places that all agda programs terminate. However I can construct a function like this: stall : ∀ n → ℕ stall 0 = 0 stall x = stall x The syntax highlighter doesn't seem to like it, but there are no compilation errors. Computing the normal form of stall 0 results in 0 . Computing the result of stall 1 causes Emacs to hang in what looks a lot like a non-terminating loop. Is this a bug? Or can Agda sometimes run forever? Or is something more subtle going on? 回答1: In fact

Why does the halting problem make it impossible for software to determine the time complexity of an algorithm

泪湿孤枕 提交于 2019-12-08 07:39:44
问题 I've read some articles about big-Oh calculation and the halting problem. Obviously it's not possible for ALL algoritms to say if they ever are going to stop, for example: while(System.in.readline()){ } However, what would be the big-Oh of such a program? I think it's not defined, for the same reason it's not possible to say if it's ever going to halt. You don't know that. So... There are some possible algorithms, where you cannot say if it's ever going to halt. But if you can't say the, the

Halting in non-Turing-complete languages

我的梦境 提交于 2019-12-04 00:17:58
The halting problem cannot be solved for Turing complete languages and it can be solved trivially for some non-TC languages like regexes where it always halts. I was wondering if there are any languages that has both the ability to halt and not halt but admits an algorithm that can determine whether it halts. A. Rex Yes. One important class of this kind are primitive recursive functions . This class includes all of the basic things you expect to be able to do with numbers (addition, multiplication, etc.), as well as some complex classes like @adrian has mentioned (regular expressions/finite

Infinite loops in Java

拟墨画扇 提交于 2019-12-03 18:37:53
问题 Look at the following infinite while loop in Java. It causes a compile-time error for the statement below it. while(true) { System.out.println("inside while"); } System.out.println("while terminated"); //Unreachable statement - compiler-error. The following same infinite while loop, however works fine and doesn't issue any errors in which I just replaced the condition with a boolean variable. boolean b=true; while(b) { System.out.println("inside while"); } System.out.println("while terminated