instruction
stringlengths
0
29.8k
⌀
I have no idea, but my intuition is that you couldn't. You are basically asking if you can implement a regexp matcher with a push-down automaton, and I don't think you can... The regexp can be arbitrarily complex, so there is no way you can store all the state necessary in the push-down automaton states, so you'll nee...
Let $\Sigma$ be a given alphabet. Is there a way to code up Deterministic Finite state Automata (DFA) over $\Sigma$ as strings of $\Sigma$ in such a way that the corresponding subset of $\Sigma^*$ is a regular language? For example for Turing machines, the set of codes of Turing machines over a fixed alphabet is dec...
Is the set of codes of Deterministic Finite-State Automata a regular language?
|logic|finite-automata|automata|formal-languages|computability|
This answer is, in a sense, a completely cheating approach, but it is indeed possible to encode all DFAs as strings. We can write out a DFA by writing out its transition table. We can write out the transition table using just 0s and 1s as follows: first, write out a number of 1s equal to the number of states, then ...
I would suggest first solving the all-pairs [shortest distance problem](http://en.wikipedia.org/wiki/Shortest_path_problem) on the graph $T$ (or at least the single source version for each $p_i$ as the source) using standard approaches. Then, for each function signature $F_j=f_1,\dots,f_n$, compute $\sum_{i=1}^nd(p_i,f...
Here is one direct example: The whole notion of NP-completeness came about when Cook and Levin and others discovered that it was possible to express the existence of an accepting path of computation in a non-deterministic Turing machine in a fairly straightforward manner as a Boolean expression as long as the length...
Given an undirected graph, I define a structure called *k-key* as a path containing $k$ vertices which are connected to a simple cycle which contains $k$ vertices as well. Here's the *k-key problem*: given an undirected graph $G$ and a number $k$, decide whether $G$ contains k $k$-key. I want to show that the k-k...
The $\text{k-key}$ problem
It is quite simple to show that the alternative formulation is NP-hard. The reduction is from the vertex coloring problem. Given a graph G with $n$ vertices, we create an instance of the above problem with $n$ output vertices and $n$ input vertices. Weights are set as follows: For all $i$, let $w_{ii}=1$. For $i \neq j...
There is a time series of 100 data points(say). I wish to assign symbols of 0 1 2 for each unique data point. The issue is I have tried but got stuck since no matter I specify the symbols,the program just outpits probability of 1's and 0's. The following are the Qs 1. How to find probability / correct my code so th...
Time series probability and mutual information
|probability-theory|information-theory|
null
**Define 1** (*Karp Reduction*) A language $L$ is Karp reducible to a language $L'$ if there is a polynomial-time computable function $f:\{0,1\}^*\rightarrow\{0,1\}^*$ such that for every $x$, $x\in L$ if and only if $f(x)\in L'$. **Define 2** (*Levin Reduction*) A language $L$ is Levin reducible to a language...
Is Karp Reduction identical to Levin Reduction
|complexity-theory|reductions|
I am trying to understand the approach for this problem: > "If all streets are one way, there is still a legal way to drive from > one intersection to another" The question is to prove that it can be done in linear time. I am not looking for direct answers but the approach to this problem. How can I think abo...
null
Consider the set of graphs in which the maximum degree of the vertices is a constant number $\Delta$ independent of the number of vertices. Is the vertex coloring problem (that is, color the vertices with minimum number of colors such that no pair of adjacent nodes have the same color) on this set still NP-hard? Why?
Vertex coloring with an upper bound on the degree of the nodes
|algorithms|complexity-theory|graphs|np-complete|
Your discussion successfully confused me :( "Can A be not Turing-recognizable?" **I feel A is always Turing-recognizable**. Here is my thinking, Since B is Turing Recognizable => There is some TM which accepts all the words of language B => There is a TM which accepts (all the words of language A + some other...
Yes, it's still NP-hard. 3-COL is still NP-complete for planar degree 4 graphs [1]. [1] Dailey, D. P. (1980), "Uniqueness of colorability and colorability of planar 4-regular graphs are NP-complete", Discrete Mathematics 30 (3): 289–293, DOI:10.1016/0012-365X(80)90236-8
null
[Entropy](http://en.wikipedia.org/wiki/Entropy_(information_theory)) is, in your case probs = [p_0 p_1 p_2]; logProb = log(probs); entropy = -1 * dot(probs, logProb); You'll have to let us know what two random variables you want to calculate the mutual information of, but with your library it looks ...
What you describe is symbolic model checking, and it is treated in this set of slides: http://react.cs.uni-sb.de/teaching/verification-11-12/downloads/l13.pdf, using reduced ordered BDDs. In a nutshell, you still do the fixpoint iteration, the main issue being how to do the transformation $Q\mapsto \phi_2\vee(\phi_1...
if I have a grammar having a production that contains both left recursion and left factoring like `F --> FBa | cDS | c` who has priority, left recursion or left factoring? Thanks
Left recursion and left factoring..who first?
|formal-languages|formal-grammars|parsers|recursion|factoring|
null
Let $\mathbb F\in\{\mathbb R, \mathbb C\}$ the field of real or complex numbers. Then [1, page 22 in the middle] claims that the following equation can easily be solved in deterministic polynomial time: $$ \sum_{i=1}^n a_ix_i^2=b$$ with $a_i, b\in\mathbb F$. Some discussion suggests, that the algorithmical model assu...
Why is solving of diagnoal quadratic equations over $\mathbb R$ and $\mathbb C$ in $P$?
|algorithms|real-numbers|
Why is solving of diagonal quadratic equations over $\mathbb R$ and $\mathbb C$ in $P$?
I would suggest first solving the all-pairs [shortest distance problem](http://en.wikipedia.org/wiki/Shortest_path_problem) on the graph $T$ (or at least the single source version for each $p_i$ as the source) using standard approaches. Then, for each function signature $F_j=f_1,\dots,f_n$, compute $\sum_{i=1}^nd(p_i,f...
Let $\mathbb F\in\{\mathbb R, \mathbb C\}$ the field of real or complex numbers. Then [1, page 22 in the middle] claims that the following equation can easily be solved in deterministic polynomial time: $$ \sum_{i=1}^n a_ix_i^2=b$$ with $a_i, b\in\mathbb F$. Some discussion suggests, that the algorithmical model assu...
Suppose that someone found an algorithm A for a NP problem (that is not NP-complete) that uses an algorithm B for PSPACE-complete or #P-complete problem during execution. (Remaining part of the algorithm takes polynomial time.) Then suppose there is also an algorithm C for a NP problem that uses the polynomial-consu...
Concept of reduction and algorithm
|complexity-theory|
I can tell that you are confused from your question, but unfortunately I am not sure what's confusing you, maybe you can add more detail. Now to answer you question, it is inconclusive given your description. The fact that you *can* solve a problem from one class by solving another problem from another class does no...
I can tell that you are confused from your question, but unfortunately I am not sure what's confusing you, maybe you can add more detail. Now to answer you question, it is inconclusive given your description. The fact that you *can* solve a problem from one class by solving another problem from another class does no...
Suppose that someone found an algorithm A for a NP problem (that is not NP-complete) that uses an algorithm B for PSPACE-complete or #P-complete problem during execution. (Remaining part of the algorithm takes polynomial time.) Then suppose there is also an algorithm C for a NP problem that uses the polynomial-consu...
I think I see where your confusion arises. Hopefully ;). Suppose you have a problem $\Pi \in NP$, and two algorithms $\mathcal{A}$ and $\mathcal{B}$ that both solve $\Pi$. Assume that $\mathcal{A}$ uses algorithm $\mathcal{A'}$ as a sub-algorithm, where $\mathcal{A'}$ is acutally an algorithm for a $PSPACE$-compl...
The number of vertices in the well-known reduction from 3SAT to directed Hamiltonian Path(dHAMPATH) can be easily reduced to O(n+k), where n is the number of variables and k is the number of clauses, therefore the size of the constructed graph instance is linear to the size of the original 3SAT instance. In the redu...
The number of vertices in the well-known reduction from 3SAT to directed Hamiltonian Path(dHAMPATH) can be easily reduced to $O(n+k)$, where $n$ is the number of variables and $k$ is the number of clauses, therefore the size of the constructed graph instance is linear to the size of the original 3SAT instance. In th...
No. First note that Levin reduction only makes sense with respect to classes which certificate has a meaning, e.g. $\mathsf{NP}$ while Karp reduction is general. The word "certificate" for a problem only makes sense only when a verifier is fixed. Levin's reduction assumes that the verifiers are fixed (otherwise one can...
**Define 1** (*Karp Reduction*) A language $L_1$ is Karp reducible to a language $L_2$ if there is a polynomial-time computable function $f:\{0,1\}^*\rightarrow\{0,1\}^*$ such that for every $x$, $x\in L_1$ if and only if $f(x)\in L_2$. **Define 2** (*Levin Reduction*) A language $L_1$ is Levin reducible to a ...
null
You should refer to the Rendering Equation first[link](http://en.wikipedia.org/wiki/Rendering_equation)
I define a 'long CNF' if it contains at list $2^\frac{n}{2}$ clauses, where $n$ is the number of its variables. $Long-Sat=\{\phi: \phi$ is a satisfiable long CNF formula$\}$ . I'd like to know why does $Long-Sat \in P$. First I thought it is $NPC$ since I can do a polynomial reduction from $SAT$ to $Long-Sat$, no? ...
$Long-Sat=\{\phi: \phi$ is a satisfiable long CNF formula$\}$ and contains $2^\frac{n}{2}$ clauses? Is it in $P$?
|np-complete|reductions|p|
You should first refer to [Rendering Equation](http://en.wikipedia.org/wiki/Rendering_equation). It is the general equation to describe the physically transmitting of light in the view of computer science. Whitted model is just an approximation about the surface integration of the Rendering Equation. It only calcula...
You should first refer to [Rendering Equation](http://en.wikipedia.org/wiki/Rendering_equation). It is the general equation to describe the physically transmitting of light in the view of computer science. Whitted model is just an approximation of the surface integration of the Rendering Equation. It only calculates...
Unless I'm missing something, it's trivially in <b>P</b> as the length of the formula is exponential in the number of variables. Hence all $2^{n}$ truth assignments can be generated and checked in polynomial time in the length of the formula.
I define a *long CNF* to contain at least $2^\frac{n}{2}$ clauses, where $n$ is the number of its variables. Let $\text{Long-SAT}=\{\phi: \phi$ is a satisfiable long CNF formula$\}$. I'd like to know why $\text{Long-SAT} \in P$. First I thought it is $\text{NPC}$ since I can do a polynomial-time reduction from $\te...
$\text{Long-SAT}=\{\phi: \phi$ is a satisfiable long CNF formula$\}$ and contains $2^\frac{n}{2}$ clauses, is it in $P$?
|np-complete|reductions|satisfiability|p|
I'm looking for a simple calculus for reasoning about [reflection][1], namely, the introspection and manipulation of running programs.. > Is there an untyped $\lambda$-calculus extension that enables one to convert $\lambda$-terms to a form that can be syntactically manipulated and then subsequently evaluated? I...
$\lambda$-calculus with reflection
|lambda-calculus|semantics|reflection|
A quick counterexample for your proof: suppose that $x_1, x_2 \in L_1$, $f(x_1) = f(x_2) \in L_2$, and $w$ is a valid certificate for $x_1$ but not for $x_2$ $M_1'(x_1,\langle 0,w \rangle)= M_1(x_1,w)=1$ $M_1'(x_2,\langle 0,w \rangle)= M_1(x_2,w)=0$ By definition $g(x_1,\langle 0,w \rangle) = \langle 1,x_1,w ...
What you describe is symbolic model checking, and it is treated in this [set of slides](http://react.cs.uni-sb.de/teaching/verification-11-12/downloads/l13.pdf), using reduced ordered BDDs. In a nutshell, you still do the fixpoint iteration, the main issue being how to do the transformation $Q\mapsto \phi_2\vee(\phi...
We assume that we are allowed to take square roots in $\mathbb{F}$. $\mathbb{F} = \mathbb{C}$: If $b = 0$ then $x_1 = \cdots = x_n = 0$ is a solution. If $b \neq 0$ and $a_1 = \cdots = a_n = 0$ then there is no solution. Otherwise, let $a_i \neq 0$, and then a solution is $x_i = \sqrt{b/a_i}$ and $x_j = 0$ for $j \n...
Given a directed graph G and two nodes s,t, decide whether there exists some s′ such that s′ is reachable from s while t is NOT reachable from s′. I am wondering whether this problem is in NL. Thanks. PS. I do not mean to crosspost; I posed the question on tcs stackexchange, but I was told that this is no...
Is this problem in NL (related to graph connectivity)
|complexity-theory|graphs|
It is in NL. Here is the outline of a possible proof: * If you already fix <i>s</i>′, you can check whether <i>s</i>′ satisfies your condition or not in NL. Reachability is easy, non-reachability is by the [Immerman–Szelepcsényi theorem](http://en.wikipedia.org/wiki/Immerman%E2%80%93Szelepcs%C3%A9nyi_theorem), and...
null
**Define 1** (*Karp Reduction*) A language $L_1$ is Karp reducible to a language $L_2$ if there is a polynomial-time computable function $f:\{0,1\}^*\rightarrow\{0,1\}^*$ such that for every $x$, $x\in L_1$ if and only if $f(x)\in L_2$. **Define 2** (*Levin Reduction*) A language $L_1$ is Levin reducible to a ...
I'm looking for a simple calculus that supports reasoning about [reflection][1], namely, the introspection and manipulation of running programs. > Is there an untyped $\lambda$-calculus extension that enables one to convert $\lambda$-terms into a form that can be syntactically manipulated and then subsequently evalu...
I'm looking for a simple calculus that supports reasoning about [reflection][1], namely, the introspection and manipulation of running programs. > Is there an untyped $\lambda$-calculus extension that enables one to convert $\lambda$-terms into a form that can be syntactically manipulated and then subsequently evalu...
I'm looking for a simple calculus that supports reasoning about [reflection][1], namely, the introspection and manipulation of running programs. > Is there an untyped $\lambda$-calculus extension that enables one to convert $\lambda$-terms into a form that can be syntactically manipulated and then subsequently evalu...
I'm looking for a simple calculus that supports reasoning about [reflection][1], namely, the introspection and manipulation of running programs. > Is there an untyped $\lambda$-calculus extension that enables one to convert $\lambda$-terms into a form that can be syntactically manipulated and then subsequently evalu...
Is $NP$ with oracle access to $NP$ larger than just $NP$? As I understand $NP^ {NP}$ is just a turing machine that can make queries to an other $NP$ machine if so than $NP$ can simulate $NP^{NP}$? Is there something wrong with this argument?
Does $NP^{NP}=NP$?
|complexity-theory|
(Plain old) regular expression *syntax* (you said "representation") is LR(0). You don't need any lookahead to parse a string representing a regex. You can easily decide this by running a parser generator on a grammar for regexes :-} You can also easily code a simple recursive descent (LL(0)) parser for regexps; any...
All regular languages have LL(1) grammars. To obtain such a grammar, take any DFA for the regular language (perhaps by doing the subset construction on the NFA obtained from the regular expression), then convert it to a right-recursive regular grammar. This grammar is then LL(1), because any pair of productions for t...
If I have a Type 3 Grammar, it can be represented on a pushdown automaton (without doing any operation on the stack) so I can represent regexp by using context free languages. But can I know if a type 3 grammar is LR(1)/LL(1)/SLR(1)[...] without doing any parse table?
Are regular expressions LR(k)?
|untagged|
Jean Louis Krivine introduced an abstract calculus which extends the "Krivine Machine" in a very non-trivial way (note that the Krivine machine already supports the call/cc instruction from lisp): He introduces a "quote" operator in [this article][1] defined in the following manner: if $\phi$ is a $\lambda$-term, no...
null
No. First note that Levin reduction only makes sense with respect to classes which certificate has a meaning, e.g. $\mathsf{NP}$ while Karp reduction is general. The word "certificate" for a problem only makes sense only when a verifier is fixed. Levin's reduction assumes that the verifiers are fixed. You cannot change...
###Definition: Karp Reduction A language $A$ is Karp reducible to a language $B$ if there is a polynomial-time computable function $f:\{0,1\}^*\rightarrow\{0,1\}^*$ such that for every $x$, $x\in A$ if and only if $f(x)\in B$. ###Definition: Levin Reduction A search problem $V_A$ is Levin reducible to a search...
###Definition: Karp Reduction A language $A$ is Karp reducible to a language $B$ if there is a polynomial-time computable function $f:\{0,1\}^*\rightarrow\{0,1\}^*$ such that for every $x$, $x\in A$ if and only if $f(x)\in B$. ###Definition: Levin Reduction A search problem $V_A$ is Levin reducible to a search...
null
###Definition: Karp Reduction A language $A$ is Karp reducible to a language $B$ if there is a polynomial-time computable function $f:\{0,1\}^*\rightarrow\{0,1\}^*$ such that for every $x$, $x\in A$ if and only if $f(x)\in B$. ###Definition: Levin Reduction A search problem $V_A$ is Levin reducible to a search...
Given a set of segments, I would like to compute the set of closed polygons inside the convex hull of the set of the end of those segments. The vertices of the polygons are the intersections of the segments. For example, if you draw these 6 lines restricted to $[-1;1]$ which equations are: $x=-1$, $x=0$, $x=1$, $y=-1$,...
Polygons generated by a set of segments
|algorithms|computational-geometry|
http://cs.stackexchange.com/questions/125/how-to-define-quantum-turing-machines/ I was going through the above discussion on this site and I feel that quantum TM and NON determistic TM are one and the same. (But no one said so in answers and hence im posting this question) **Are these two one and the same TM?** ...