proof

Proof that the halting problem is NP-hard?

半城伤御伤魂 提交于 2019-11-29 00:12:50
问题 In this answer to a question about the definitions of NP, NP-hard, and NP-complete, Jason makes the claim that The halting problem is the classic NP-hard problem. This is the problem that given a program P and input I, will it halt? This is a decision problem but it is not in NP. It is clear that any NP-complete problem can be reduced to this one. While I agree that the halting problem is intuitively a much "harder" problem than anything in NP, I honestly cannot come up with a formal,

proofs about regular expressions

北战南征 提交于 2019-11-28 21:11:12
问题 Does anyone know any examples of the following? Proof developments about regular expressions (possibly extended with backreferences) in proof assistants (such as Coq). Programs in dependently-typed languages (such as Agda) about regular expressions. 回答1: Certified Programming with Dependent Types has a section on creating a verified regular expression matcher. Coq Contribs has an automata contribution that might be useful. Jan-Oliver Kaiser formalized the equivalence between regular

Number of binary search trees over n distinct elements

ぃ、小莉子 提交于 2019-11-28 18:53:54
How many binary search trees can be constructed from n distinct elements? And how can we find a mathematically proved formula for it? Example: If we have 3 distinct elements, say 1, 2, 3, there are 5 binary search trees. Given n elements, the number of binary search trees that can be made from those elements is given by the nth Catalan number (denoted C n ). This is equal to Intuitively, the Catalan numbers represent the number of ways that you can create a structure out of n elements that is made in the following way: Order the elements as 1, 2, 3, ..., n. Pick one of those elements to use as

How to understand the time complexity of Kademlia node operation

雨燕双飞 提交于 2019-11-28 12:52:17
I'm now learning Kademlia network by reading the classical paper Kademlia: A Peer-to-peer Information System Based on the XOR Metric . I want to understand the complexity of its operation but still cannot figure it out. In the 3 Sketch of proof section, the paper gives two definitions: Depth of a node (h) : 160 − i, where i is the smallest index of a non-empty bucket Node y’s bucket height in node x : the index of the bucket into which x would insert y minus the index of x’s least significant empty bucket . And three conclusions: With overwhelming probability the height of a any given node

How or is that possible to prove or falsify `forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.` in Coq?

最后都变了- 提交于 2019-11-28 11:18:32
I want to prove or falsify forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q. in Coq. Here is my approach. Inductive True2 : Prop := | One : True2 | Two : True2. Lemma True_has_one : forall (t0 t1 : True), t0 = t1. Proof. intros. destruct t0. destruct t1. reflexivity. Qed. Lemma not_True2_has_one : (forall (t0 t1 : True2), t0 = t1) -> False. Proof. intros. specialize (H One Two). inversion H. But, inversion H does nothing. I think maybe it's because the coq's proof independence (I'm not a native English speaker, and I don't know the exact words, please forgive my ignorance), and coq makes it

How to understand the time complexity of Kademlia node operation

≯℡__Kan透↙ 提交于 2019-11-27 07:18:58
问题 I'm now learning Kademlia network by reading the classical paper Kademlia: A Peer-to-peer Information System Based on the XOR Metric. I want to understand the complexity of its operation but still cannot figure it out. In the 3 Sketch of proof section, the paper gives two definitions: Depth of a node (h) : 160 − i, where i is the smallest index of a non-empty bucket Node y’s bucket height in node x : the index of the bucket into which x would insert y minus the index of x’s least significant

How to prove that the C statement -x, ~x+1, and ~(x-1) yield the same results?

╄→гoц情女王★ 提交于 2019-11-27 04:06:40
问题 I want to know the logic behind this statement, the proof. The C expression -x, ~x+1, and ~(x-1) all yield the same results for any x. I can show this is true for specific examples. I think the way to prove this has something to do with the properties of two's complement. Any ideas? 回答1: Consider what you get when you add a number to its bitwise complement. The bitwise complement of an n-bit integer x has a 1 everywhere x has a 0, and vice versa. So it's clear to see: x + ~x = 0b11...11 (n

Concrete example showing that monads are not closed under composition (with proof)?

*爱你&永不变心* 提交于 2019-11-26 04:36:54
问题 It is well-known that applicative functors are closed under composition but monads are not. However, I have been having trouble finding a concrete counterexample showing that monads do not always compose. This answer gives [String -> a] as an example of a non-monad. After playing around with it for a bit, I believe it intuitively, but that answer just says \"join cannot be implemented\" without really giving any justification. I would like something more formal. Of course there are lots of