instruction
stringlengths
0
29.8k
⌀
How should I imagine $M_w[\epsilon]\downarrow$ for the empty halting problem or $M_w[w]\downarrow$
I'm learning about computability problems e.g. reducing the general halting problem to the halting problem on a blank tape. But before I can understand this problem I first have to understand what exactly $M_w$, $M_w[\epsilon]$, and $M_w[w]$ are. I know the concept of encoding a Turing machine $M$ e.g. by generatin...
I'm learning about computability problems e.g. reducing the general halting problem to the halting problem on a blank tape. But before I can understand this problem I first have to understand what exactly $M_w$, $M_w[\epsilon]$, and $M_w[w]$ are. I know the concept of encoding a Turing machine $M$ e.g. by generatin...
I'm learning about computability problems e.g. reducing the general halting problem to the halting problem on a blank tape. But before I can understand this problem I first have to understand what exactly $M_w$, $M_w[\epsilon]$, and $M_w[w]$ are. I know the concept of encoding a Turing machine $M$ e.g. by generatin...
I'm learning about computability problems e.g. reducing the general halting problem to the halting problem on a blank tape. But before I can understand this problem I first have to understand what exactly $M_w$, $M_w[\epsilon]$, and $M_w[w]$ are. I know the concept of encoding a Turing machine $M$ e.g. by generatin...
null
null
You are playing with boxes on a $K_{1, n}$-$\textbf{subdivision}$ graph $G:=(V, E)$ whose number of vertices is odd, i.e., $|V| \equiv 1$ (mod $2$) with a given central point $C$ such that $\forall v \in V - \{C\}, deg(v) \leq 2$. Actually, $C$ is the center of the star graph $G$. Your goal is to move $n:= (|V| - 1)/2$...
Playing with boxes: NP-hard? [Graph Theory]
|algorithms|complexity-theory|graphs|sorting|combinatorics|
You are playing with boxes on a $K_{1, n}$-$\textbf{subdivision}$ graph $G:=(V, E)$ whose number of vertices is odd, i.e., $|V| \equiv 1$ (mod $2$) with a given central point $C$ such that $\forall v \in V - \{C\}, deg(v) \leq 2$. Actually, $C$ is the center of the star graph $G$. Your goal is to move $n:= (|V| - 1)/2$...
Argument for an $\epsilon$ free LL(1) grammar being in LR(0)?
### Problem This is a HW problem from CMU 15-455 ([hw10][1], p1(a)), spring 17 by Ryan O'Donnell. Assume $L \in {\sf RP \backslash ZPP}$. Define $$ L' = \left\{ (x, y) : \text{either $x \in L$ and $y \notin L$, or vice versa} \right\}, $$ Prove that $L' \notin {\sf RP} \cap {\sf coRP}$. ### My Thoughts T...
construct language in ${\sf BPP \backslash (RP \cup coRP)}$ assuming $\sf RP \neq ZPP$
|complexity-theory|time-complexity|complexity-classes|randomness|
I have an operation that is performed many times and is thus performance sensitive where I need to calculate product of a matrix and inverse of a matrix as below. Both matrices are 4x4 and consist of floats. M3 = Inverse(M1)*M2 Now in this specific scenario M1 and M2 very often equal each other. Let's say 75...
Checking for equality before calculating product of a matrix with inverse of another matrix
|linear-algebra|
This is a purely theoretical question: among the known [flood fill](https://en.wikipedia.org/wiki/Flood_fill) algorithms, there is one which does not require any dynamically-sized data structures, explicit or implicit: the so-called [Walk-based filling][1], expressed there in *structured English*, e.g. ``` ... while...
Is there a working O(1)-space flood fill algorithm?
|algorithms|graphics|
null
Yes, your optimization is worthwhile. If the cost of performing the inversion and multiplication is $c_\times$ and the cost of comparing the two matrices is $c_=$, then the expected cost of your optimization is $c_= + 0.25 c_\times$, whereas the cost of always multiplying is $c_\times$. We can then use simple algeb...
To show $L'\notin \mathsf{RP \cup coRP}$ you can essentially follow the proof of $\mathsf{ZPP=RP\cap coRP}$. Since $L\neq \Sigma^*,\varnothing$ (otherwise it's in ZPP), there exist $y_1\in L, y_2\notin L$. Note that you don't have to find $y_1,y_2$ at runtime, as you can simply hardcode them into your machine for $...
null
null
You are playing with boxes on a $K_{1, n}$-$\textbf{subdivision}$ graph $G:=(V, E)$ whose number of vertices is odd, i.e., $|V| \equiv 1$ (mod $2$) with a given central point $C$ such that $\forall v \in V - \{C\}, deg(v) \leq 2$. Actually, $C$ is the center of the star graph $G$. Your goal is to move $n:= (|V| - 1)/2$...
A Markov chain $\{ X_n, n \geqslant 0\}$ with states 0, 1, 2 has the transition probability matrix $$P= \begin{bmatrix} \frac12 & \frac13 & \frac16 \\ 0 & \frac12 & \frac23 \\ \frac12 & 0 & \frac12 \end{bmatrix}$$ If $P\{X_0 =0 \} = P\{X_0=1\}=\frac14$ find $E[X_3]$ How to answer this question?
Expected value of Markov chain after nth steps
|probability-theory|markov-chains|
I'm looking for good introductory resources (books, articles, notes, websites, videos, e.t.c.) on polyhedral compilation. I'm especially interested in applications related to deep learning / GPU computation acceleration. Thanks in advance.
Good resources on polyhedral compilation
|optimization|compilers|
$E[X_3] = 0\cdot P(X_3=0) + 1\cdot P(X_3=1) + 2\cdot P(X_3=2)$ Hence $$E[X_3]= \frac14 P^3_{01} + \frac14P^3_{11} + \frac12P^3_{21} + 2\left[ \frac14P^3_{02} +\frac14P^3_{12} + \frac12P^3_{22}\right]$$
I have searched for a bit eventually arriving at well known websites like codeforces, atcoder, codewars, codinggame or the various OJs. They mostly involve solving tasks where usually the main focus is elementary discrete maths + data structures and algorithms. However, I cannot find any that target the more theor...
Are there any (theoretical-esque) computer science "competitions" at Undergrad level similar to Putnam?
|reference-request|theory|reference-question|programming-contest|
How does one formally prove that, given a DFA $M=<Q,T,\delta,q_0,F>$, the following NFA $M^R = <Q_R, T, \delta_R, q_R, F_R>$ recognizes the reverse of M's language? We build $M^R$ like this: - $Q_R = Q \cup \{q_R\}$, where $q_R$ is a new state which will be the start state of $M_R$ - $F_R = \{q_R\}$ - $\delta_R(q...
How to prove reverse of DFA?
|formal-languages|finite-automata|
How is slope error calculated for Bresenham’s Algorithm for both 2D and 3D?
How does one formally prove that, given a DFA $M=\langle Q,T,\delta,q_0,F\rangle$, the following NFA $M^R = \langle Q_R, T, \delta_R, q_R, F_R\rangle$ recognizes the reverse of M's language? We build $M^R$ like this: - $Q_R = Q \cup \{q_R\}$, where $q_R$ is a new state which will be the start state of $M_R$ - $F_R...
Suppose that $P \not= NP$. Then my understanding is not all instances of NP-complete problems can be *solved* in polynomial time. That is for every NP-complete problem, there are a colleciton of instances of that problem where the solution (correct certificate) cannot be determined in polynomial time (I do not mean tha...
P vs. NP problem and understanding "worst case complexity"
|complexity-theory|time-complexity|p-vs-np|
What you wrote isn't clear. This is a problem with using English to try to summarize mathematics: it is easy to write an English sentence that is ambiguous. If you mean "there is a set of instances, such that there is no single algorithm that solves every instance in that set correctly", then the answer is: correct...
null
In linguistics, the word 'statement' means something that is true or false, [closer to a declarative sentence][1], but in programming, [the meaning is closer to an imperative sentence][2]. What is the reason for this difference? [1]: https://en.wikipedia.org/wiki/Sentence_(linguistics)#By_purpose [2]: http...
Why is there a difference between the meaning of the word 'statement' in programming and linguistics?
|terminology|programming-languages|
In our class the following exercises/examples were given: Compute/find $n_0$ and c from the formal definition of each Landau symbol to show that: $n^{2/3} \in \Omega(log^8(n))$. Then in the Solution the following was done: $n_0=1$ and $c=(\frac{1}{12})^8$. Show: for each $n>n_0: n^{2/3} \ge c \cdot log^8...
Landau Notation/Big O notation
|algorithms|big-o-notation|
null
>Let $S = \{\langle M\rangle | M \text{ is a TM and } L(M) = \{ \langle M\rangle\}\}$. Prove that neither $S$ nor $\overline{S}$ is Turing-recognizable. I think the statement can be proved via a contradiction. Suppose $S$ is Turing recognizable and let $M$ be a TM recognizing it. Then M accepts all strings $\la...
If you want to show that $f(n) \in \Omega(g(n))$ then you are free to choose $n_0$ and $c$ as long as $\forall n \ge n_0$, $f(n) \ge c \cdot g(n)$ (Reverse the inequality for big-oh.) There is no particular reason to chose one set of values over another, except that you can sometimes make the math easier if you choose...
>If $RA$ is context-free for a regular language R, is $A$ context-free? I think this statement is true. Let G be the CFG given by the rules $S_0\mapsto LA_1, S\mapsto LA_1, A_1\mapsto SA_2 | RS | 1, A_2\mapsto RS | 1, L\mapsto 0, R\mapsto 1$, where $S_0$ is the start symbol. How would one modify G to get a CFG that ...
if $RA$ is context-free, is $A$ context-free?
|formal-languages|context-free|formal-grammars|
>I was wondering how to express (with proof) the context-free language generated by the following rules of a context-free grammar concisely, where $S$ is the start variable: $S\mapsto aABb, A\mapsto BAS |\epsilon, B\mapsto a | b.$ >By "concisely," I mean something like $\{a^i b^i : i\ge 0\},$ which is recognized ...
concisely expressing a context-free language
|formal-languages|automata|context-free|formal-grammars|
>I was wondering how to determine (with proof) whether the context-free language generated by the following rules of a context-free grammar is regular, where $S$ is the start variable: $S\mapsto aABb, A\mapsto BAS |\epsilon, B\mapsto a | b.$ It doesn't seem easy to determine exactly what set of strings the given ...
determining whether a context-free language is regular
|formal-languages|regular-languages|automata|context-free|formal-grammars|
>I was wondering how to determine (with proof) whether the context-free language generated by the following rules of a context-free grammar is regular, where $S$ is the start variable: $S\mapsto aABb, A\mapsto BAS |\epsilon, B\mapsto a | b.$ It doesn't seem easy to determine exactly what set of strings the given ...
I have searched for a bit eventually arriving at well known websites like codeforces, atcoder, codewars, codinggame or the various OJs. They mostly involve solving tasks where usually the main focus is elementary discrete maths + data structures and algorithms. However, I cannot find any that target the more theor...
null
I have searched for a bit eventually arriving at well known websites like codeforces, atcoder, codewars, codinggame or the various OJs. They mostly involve solving tasks where usually the main focus is elementary discrete maths + data structures and algorithms. However, I cannot find any that target the more theor...
if two vectors are used for ex, vector<vector<int>> temp; vector<int> temp2; then what will be the space complexity, will it be O(n) or O(n^2)?
what will be the space complexity of the following?
|space-complexity|
If both graphs have the same unique labels, there is a unique minimal way to edit edges: remove edges missing in the target, and add edges missing in the source. This problem is solvable in a linear time. For finding the minimal-distance path graph (permutation), this is equivalent to the 0-1 TSP (the traveling sale...
null
Claim: $L(G)\cap L(a^*b^*)=\{a^{2n-1}b^{2n}\mid n\ge1\}\cup\{a^{2n}b^{2n-1}\mid n\ge1\}$. Proof: Substituting $BAS \mid \epsilon$ for $A$ in rule $S\to aABb$, we obtain a context-free grammar $G_1$ that is equivalent to $G$, $$G_1: \ S\to aBASBb \mid aBb, \ A\to BAS \mid \epsilon, \ B\to a \mid b.$$ Let us in...
I was wondering how to determine (with proof) whether the context-free language generated by the following context-free grammar $G$ is regular, where $S$ is the start variable and $a$, $b$ are the non-terminals. > $G:\ S\to aABb,\ A\to BAS \mid\epsilon,\ B\to a \mid b.$ It doesn't seem easy to determine exactly w...
The reason is very simple. In computer science, as well as in many other sciences, concepts are given names without much recourse to linguistic and historic significance of the name. This is not to say that names are chosen randomly, far from it, but I cannot imagine a group of people who are constructing a programming...
As you suspected, $L(G)$ is nonregular. A useful strategy to prove the language generated by a context-free grammar is nonregular is to find a regular language such that their intersection is nonregular. We know the intersection of a context-free language and a regular language is still context-free. Furthermore, w...
null
Note that $\Sigma^*A=\Sigma^*$ is a regular language, where $A$ is any language that contains the empty string<!-- such as $\{a^nb^nc^n\mid n\ge0\}$-->. So, given language $A$, the existence of an regular language $R$ such that $RA$ is regular (and hence also context-free) does not imply $A$ is context-free. Nor does i...
Here is the relevant text on that book, sixth edition. > Perfect Binary Trees > > A perfect binary tree is one that is both full and complete. All leaf nodes will be at the same level, and this level has the maximum number of nodes. As you have observed, the statements quoted above is somewhat ambiguous and conf...
I have been studying the Branch and Bound paradigm. I came across an approach to solve the Travelling Salesman Problem using branch and bound where a specific kind of bounding function was used. I've been wondering why this bounding function (which performs a kind of reduction on the adjacency matrix of the graph under...
|lower-bounds|traveling-salesman|branch-and-bound|
I have been studying the Branch and Bound paradigm. I came across an approach to solve the Travelling Salesman Problem using branch and bound where a specific kind of bounding function was used. I've been wondering why this bounding function (which performs a kind of reduction on the adjacency matrix of the graph under...
I have been studying the Branch and Bound paradigm. I came across an approach to solve the Travelling Salesman Problem using branch and bound where a specific kind of bounding function was used. I've been wondering why this bounding function (which performs a kind of reduction on the adjacency matrix of the graph under...
null
null
You meet numerous "jargonic" meanings of common words in the field of mathematics, of which computer science is a branch (and in many other fields). E.g. a function: - an activity that is natural to or the purpose of a person or thing. vs. - a relation or expression involving one or more variables.
You meet numerous "jargonic" meanings of common words in the field of mathematics, of which computer science is a branch (and in many other fields). E.g. a function: - an activity that is natural to or the purpose of a person or thing. vs. - a relation or expression involving one or more variables. I ac...
null
You meet numerous "jargonic" meanings of common words in the field of mathematics, of which computer science is a branch (and in many other fields). E.g. a function: - an activity that is natural to or the purpose of a person or thing. vs. - a relation or expression involving one or more variables. --...
You meet numerous "jargonic" meanings of common words in the field of mathematics, of which computer science is a branch (and in many other fields). E.g. a function: - an activity that is natural to or the purpose of a person or thing. vs. - a relation or expression involving one or more variables. --...
The complexity of `temp` will be $$\sum_{i=1}^n v_i$$ where $n$ denotes the size of the outer vector and the $v_i$ are the sizes of the inner vectors (assuming elements of bounded size). Space complexities are in principle given in terms of units of storage.
Consider the following two strings: $$s_1 = a^n, s_2 = a^{2n}$$ The longest common subsequence has length $n$. There are [$2n$ choose $n$] such longest subsequences, or $\frac{(2n)!}{n!n!} = \frac{2n \cdot \ldots \cdot (n+1)}{n \cdot \ldots \cdot 1} = \frac{2n}{n} \cdot (\ldots )\cdot \frac{n+1}{1}$. Each factor...
null
I'm designing an expression language that's trying to (a) be maximally compatible with a different ambiguous language; and (b) be LR(1). I'm facing the current fragment of the language: $$ \begin{align} S & → T \quad | \quad \texttt{prefix} \quad T \quad S \\ T & → F \quad | \quad T \texttt{-} F \quad | \quad ...
How to disambiguate CFG with unary/binary minus and binary prefix operator
|formal-languages|context-free|ambiguity|language-design|lr-k|
Can fine-grained hardness (e.g. ${\sf DIAMETER} \notin {\sf TIME}(mn^{1-\epsilon})$) be attached to classical hardness (e.g., $\sf P \neq NP)$ in some way? **My thought**: to prove fine-grained hardness, we construct reductions from $A$ to $B$, then "perturbation" on $A$'s complexity will cause a perturbation on $B$...
Can fine-grained hardness (${\sf DIAMETER} \notin {\sf TIME}(mn^{1-\epsilon})$) be attached to classical hardness (e.g., $\sf P \neq NP$) in some way?