instruction stringlengths 0 29.8k ⌀ |
|---|
|p-vs-np| |
"No", you can use "basic English".
If you succeeded, you would have created a [**constructive proof**][1]. Proofs in mathematics are often a mix of "basic English" as you call it and mathematical formulae, but they must not contain either to be a valid proof.
Suppose have have such a flowchart, what you need to p... |
A Turing machine, it must be remembered, *is* a kind of flowchart. So is the structure of a computer program generally. So turning "a flowchart" into a formal answer to the problem should be fairly easy, if it actually did work. Indeed, if one started with a terribly formal answer to **P** versus **NP**, most comp... |
I heard that random in coumuters isn't really random but there is no efficient algorithm to detect it .How it can be detect it at all ? |
How it can be detect that random number generator is not really random? |
|randomness|random-number-generator| |
A Turing machine, it must be remembered, *is* a kind of flowchart. So is the structure of a computer program generally. So turning "a flowchart" into a formal answer to the problem should be fairly easy, if it actually did work. Indeed, if one started with a terribly formal answer to **P** versus **NP**, most comp... |
I am resuming syntax rules for a small language:
\begin{eqnarray*}
e_C &::=& \epsilon \mid constant \\
\textit{prefix-op} &::=& - \\
\textit{infix-op} &::=& + \mid - \mid * \\
e_E &::=& e_C \mid \textit{prefix-op} \; e_E \mid e_E \; \textit{infix-op} \; e_E \mid \textit{function}_E (e_{E,0}, e_{E,1},\ldots) \mi... |
null |
I need some help with deciding if a given language is regular, context-free or not context-free.
Lets say I have the following lanugages:
L1 = { w ∈ {a, b, c, d}* | #a(w) is even, #b(w) = 1 mod 3, w does not have
a substring abc }
L2 = { w ∈ {a, b, c, d}* | #a(w) i... |
Deciding whether a Lanugage is Context-free/Regular/Non Context-Free |
|regular-languages|automata|context-free|regular-expressions| |
I'm trying to understand context-sensitive grammars.
I understand why languages like
>
1. {ww | w is a string}
2. {a<sup>n</sup> b<sup>n</sup> c<sup>n</sup> | a,b,c are symbols}
are not context free, but what I'd like to know if a language similar to the untyped lambda calculus is context sensitive.
I'd... |
null |
I'm trying to understand context-sensitive grammars.
I understand why languages like
>
1. $\{ww \mid w \in A^*\}$
2. $\{a^n b^n c^n \mid n\in\mathbb{N}\}$
are not context free, but what I'd like to know if a language similar to the untyped lambda calculus is context sensitive.
I'd like to see an example... |
|formal-grammars|programming-languages|lambda-calculus|context-sensitive| |
I heard that random number generation in computers isn't really random, but there is no efficient algorithm to detect it. How can it be detected at all ? |
"No", you can use "basic English".
If you succeeded, you would have created a [**constructive proof**][1]. Proofs in mathematics are often a mix of "basic English" as you call it and mathematical formulae, but they need not contain either to be a valid proof.
Suppose you have such a flowchart, what you need to pr... |
null |
I'm trying to understand the equivalence in expressive power of formal grammars whose rules take the form:
$$ \alpha \rightarrow \beta $$ where $ |\alpha| \leq |\beta| $ (called a *monotonic* grammar), and grammars whose rules take the form:
$$ \alpha B \gamma \rightarrow \alpha C \gamma $$
where $\alpha $ an... |
Demonstrating that for every monotonic grammar there is an equivalent context-sensitive grammar |
|formal-grammars|context-sensitive| |
null |
If the data is really a tree graph, then maybe a [Prüfer code](http://en.wikipedia.org/wiki/Pr%C3%BCfer_sequence)? |
First replace ever terminal $a$ with a non-terminal $X_a$ and add a production $X_a \to a$, because context sensitive grammars only work on non-terminals. Then, replace every production $A_1\dots A_n \to B_1\dots B_n$ with a sequence of productions $$\begin{align} A_1A_2\dots A_n &\to B_1A_2\dots A_n \\ B_1A_2A_3\dots ... |
There is an exercise in **Distributed Algorithm** I have some difficulties to solve. There are few ideas, however nothing useful at the time. I will appreciate any help with it.
Graph $G$ is a $k$-tree if it's possible to divide all it's edges to $k$ trees ($k$ subgraphs without a loop). Given network $N$ every proc... |
k-Trees Graph Coloring |
|algorithms|proof-techniques|distributed-systems| |
null |
> Is it $\mathsf{NP}$-hard to decide whether $\mathsf{P}=\mathsf{NP}$ ?
If so, what are the implications ? Is there result suggesting that it is the case ? |
Is it $\mathsf{NP}$-hard to decide whether $\mathsf{P}=\mathsf{NP}$? |
|complexity-theory| |
Due to [Godel incompleteness][1] Theorem it could as well be that there is no proof of $P = NP$ and no proof of $P \ne NP$ and hence no algorithm to decide whether $P = NP.$
So we are not even sure if there is a proof for one of the two equalities let alone an algorithm to decide if the equality holds or not (in a wa... |
From what I have discovered, there is no general technique to modify the semantic actions while removing left-recursion. Instead, the best method is to take a representative example, draw its parse tree, and then checking which semantic actions give us the same result as the previous grammar. |
null |
I have a question about a specific pumping lemma problem for Context-Free Languages.
Suppose we have the following Language:
L = {(a^i)(b^j)(c^k)(d^l) | 0 < i < k AND j > l > 0 }
Here is my attemp to prove that the language is not context-free:
Assume L context-free. Take the constant n>0 from the lemm... |
Pumping lemma for Context-Free Languages |
|formal-languages|formal-grammars|context-free|pumping-lemma| |
I have a question about a specific pumping lemma problem for Context-Free Languages.
Suppose we have the following Language:
> $L = \{a^{i}b^{j}c^{k}d^{l} \mid 0 < i < k \wedge j > l > 0 \}$
Here is my attemp to prove that the language is not context-free:
Assume $L$ is context-free. Let $n>0$ be the pumpin... |
I need some help with deciding if a given language is regular, context-free or not context-free.
Lets' say I have the following lanugages over the alphabet $\mathcal{A} = \{a,b,c,d\}$:
$$ \begin{align}
L_1 &= \{ w \in \mathcal{A}^* \mid \text{\(\#a(w)\) is even and \(\#b(w) = 1 \mathrel{\mathrm{mod}} 3\) and \... |
Let me rephrase property 3 of the pumping lemma: for every $l \geq 0$, $uv^lwx^ly \in L$. Now let's consider the seven different cases:
Case 1: $vx = a^i$ where $i > 0$. Choose $l = 2$ to get $a^{n+i} b^{n+1} c^{n+1} d^n \notin L$.
Case 2: $vx = a^ib^j$ where $i,j > 0$. Like case 1 or case 3.
Case 3: $vx = b^i... |
null |
True randomness is impossible for computers, as everything they do is deterministic. If you call a random number generation program, it will give you the same result every time if you give it the same input.
Many random number generators dodge this by using the current system time as input. This gives a long strin... |
I am looking to calculate the physical address corresponding to a logical address in a paging memory management scheme. I just want to make sure I am getting the calculation right, as I fear I could be wrong somewhere.
So, the data I have is as follows:
* The logical address: 717
* Logical memory size: 1024 b... |
How to work out physical address corresponding to logical address? |
|operating-systems|memory-management|paging| |
A proof that P = NP might get accepted by a mathematical journal, but it will never be accepted by the elite professionals. The reasons is that they know that P != NP (at least for all practical purposes). They also know that it is unbelievable difficult to prove this, so even a proof that P != NP will be received with... |
null |
You are correct in your reasoning that the pages are 256 bytes and that the physical memory capacity is 4096 bytes.
However, there are errors after that.
The offset is the distance (in bytes) relative to the start of the page. I.e., logical_address mod page_size. The bits for this portion of the logical address... |
**Computers Being Really Random:**
True randomness is impossible for Turing Machines in a theoretical sense, and most computers can't generate truly random output. Therefore, some modern computers include hardware that allows the computer to access an outside source which will hopefully include some randomness. O... |
Does anyone have a pointer to a resource or, even better, a tip to provide on how to efficiently generate a very large matrix representing a connected graph.
Graph can be randomly created although I would ideally generate a graph of desired size and topology similar to what one can do with [JGraphT][1].
My gener... |
Generating a adjacency matrix representing a DAG |
|graphs|adjacency-matrix| |
Continuing in the vein of two prior questions [(1)](http://cs.stackexchange.com/questions/6562/generalizing-the-comparison-sorting-lower-bound-proof) and [(2)](http://cs.stackexchange.com/questions/7349/proofs-based-on-narrowing-down-sets-of-possibilities), we started with sorting, where we had
1. a set of $n!$ inpu... |
Progress of algorithms in problem spaces |
|proof-techniques|lower-bounds| |
Basic idea: Pick a random assignment and check it.
Then, repeat it many times. Even if one of the assignments satisfies the formula you answer "YES" (otherwise, you answer "NO")
We know that the input formula is "simple": in plain words it means that either it is not-satisfiable **or** it has "many" satisfying a... |
I'm currently studying the book "Introduction to Algorithms - Cormen". Although a proof of correctness for the BFS algorithm is given, there isn't one any for the DFS in the book. So i was courious about how it can be shown that DFS visits all the nodes.
I also googled for it. But it seems that every lecturer do some ... |
DFS - Proof of Correctness |
|graphs|correctness-proof| |
I'm currently studying the book "Introduction to Algorithms - Cormen". Although a proof of correctness for the BFS algorithm is given, there isn't one any for the DFS in the book. So i was courious about how it can be shown that DFS visits all the nodes.
I also googled for it. But it seems that every lecturer do some ... |
I had the same problem when I was an undergrad. I can see you understand the algorithm. And, to _prove that it works_ is to explain it formally that it works.
Why we have many proofs ? because we may have algorithms that are not correct, and we need to show that our algorithm is correct and actually work _always!_.... |
I had the same problem when I was an undergrad. I can see you understand the algorithm. And, to _prove that it works_ is to explain it formally that it works.
Why we have many proofs ? because we may have algorithms that are not correct, and we need to show that our algorithm is correct and actually work _always!_.... |
I have a problem finding the right string to pump for the following language:
![enter image description here][1]
Which string should I choose to pump ? The problem is that I don't know how to handle the fact that I have p+q and q+r ?
Can I choose:
![enter image description here][2]
[1]: https://i.s... |
Pumping lemma problem - Choosing the right string to pump |
|formal-languages|automata|context-free|pumping-lemma| |
I have a problem finding the right string to pump for the following language:
$$L_1 = \{a^{p+q}b^rc^sd^{q+r}e^s \mid p, q, r, s \ge 0\}$$
Which string should I choose to pump? The problem is that I don't know how to handle the fact that I have $p+q$ and $q+r$?
Can I choose:
$$Z = a^{2n}b^nc^nd^{2n}e^s$$
Th... |
If $k$ is the *pump length* from the regular pumping lemma choose $w=c^ke^k$. Clearly, $w\in L_1$, but if you pump you have to change the number of $c$'s while leaving the $e$'s unaltered. Hence after pumping the word is no longer a member of $L_1$. |
1. Yes and No. If you see this as "amortized" number of possibilities removed in each step, then yes (follows trivially since you need $n^2$ time but have a search space of $n!$), but it is very difficult to formalize a notion of how many possibilities in each step are removed. You would need a notion of what a "step" ... |
null |
A similar question is this:
> Is $(a \vee \neg b) \wedge (\neg a \vee b)$ $\mathsf{NP}$-hard?
The question itself doesn't make much sense, as $\mathsf{NP}$ (as well as $\mathsf{NP}$-hard) defines a set of languages, but $(a \vee \neg b) \wedge (\neg a \vee b)$ is (just like $\mathsf{P} = \mathsf{NP}$) a word, an ... |
I am struggling in trying to figure out a non-deterministic algorithm for the following problem.
Consider the following problem, called the figure-of-eight problem (FOE). An instance is an undirected graph $G = (V,E)$ with vertices $V$ and edges $E$. $G$ is a yes-instance if there is a sequence of vertices $(v_{0},v_... |
Non-deterministic algorithm for solving figure of 8 |
|algorithms|complexity-theory|graphs|nondeterminism| |
null |
A similar question is this:
> Is $(a \vee \neg b) \wedge (\neg a \vee b)$ $\mathsf{NP}$-hard?
The question itself doesn't make much sense, as $\mathsf{NP}$ (as well as $\mathsf{NP}$-hard) defines a set of languages, but $(a \vee \neg b) \wedge (\neg a \vee b)$ is (just like $\mathsf{P} = \mathsf{NP}$) a word, an ... |
If you want to prove that this problem is in NP, then all you have to do is to come up with a polytime algorithm that verifies the correctness of a solution. I.e., in polynomial time, verify that a given sequence satisfies the conditions you wrote.
This should also help you in actually construct the non-determinist... |
|graphs|correctness-proof| |
Yes there is an easy way to generate a random DAG. If a graph is a DAG it can be separated into levels or ranks. The idea is to rank the nodes and randomly generate edges from lower ranked nodes to higher ranked nodes. A little bit of Googling finds the exact same question asked on [stackoverflow a few months ago][1] (... |
When returning the min element, I assume you also want to remove it from the data structure? Otherwise it's trivial to just always keep track of the least element when you alter the data structures via any of the other operations.
I'm not entirely sure how much cheating you allow, but you could keep two additional ... |
null |
It is said that computability theory is also called recursion theory. Why is it called like that? Why recursion has this much importance? |
Importance of recursion in computability theory |
|computability|recursion| |
Computability theory is the study of computable functions :-).
Such functions are usually (in this community) defined as functions that can be expressed with a Turing machine.
More formally a function $f: \mathbb{N} \mapsto \mathbb{N}$ is *computable* if there exist a Turing $T$ such that if the input to $T$ is... |
Computability theory is the study of computable functions :-).
Such functions are usually (in this community) defined as functions that can be expressed with a Turing machine.
More formally a function $f: \mathbb{N} \mapsto \mathbb{N}$ is *computable* if there exist a Turing $T$ such that if the input to $T$ is... |
null |
I need some help with explaining why a grammar is not LL(1).
Let us take the following grammar:
S -> aB | bA | e
A -> aS | bAA
B -> b
This is my attempt:
For the grammar to be LL(1) it is a necessary condition that for any strings c1γ and c2β, derivable from S->aB and A-> aS respectively, we h... |
Eplaining why a grammar is not LL(1) |
|formal-languages|regular-languages|context-free|pushdown-automata| |
Yes, context-sensitive grammars (CSG) are powerful enough to make undefined/undeclared/unbound variables check, but unfortunately we don't know any efficient algorithm to parse strings of CSG.
A real example of a context-sensitive language is the C programming language. A feature like declare variables first and the... |
null |
In the 1920's and 1930's people were trying to figure out what it means to be able to "effectively compute a function" (remember, there were no general purpose computing machines around, and computing was something done by people).
Several definitions of "computable" were proposed, of which three are best known:
... |
|computability|terminology| |
Yes, if the grammar is ambiguous (at least one sentence has more than one parse tree), then the grammar is not in LL(1).
In general, you compute the LL(1) parse table and use it to answer the question. Your grammar is LL(1) if each cell in the table has at most 1 grammar rule. In other words, at least one table entr... |
I need some help with explaining why a grammar is not LL(1).
Let us take the following grammar:
$$
\begin{align}
S \rightarrow & aB \mid bA \mid \varepsilon \\
A \rightarrow & aS \mid bAA \\
B \rightarrow & b \\
\end{align}
$$
This is my attempt:
For the grammar to be LL(1) it is a necessary condition... |
Given some complexity class $\mathsf{C}$, I want to know if there exists a function (Turing machine) $F:\mathbb{N} \to \mathsf{C}$ such that, if $S$ is any set for which the problem $x \mapsto x \in S$ is in $\mathsf{C}$, then $F(n)$ is a Turing machine which (partially, if $\mathsf C = \mathsf{RE}$) decides $x \in S$ ... |
Which complexity classes are $\mathsf{RE}$? |
|complexity-theory|computability| |
Time-bounded classes can be enumerated. Suppose we want to enumerate all languages in P. Every language in P is accepted by some Turing machine $T$ running in time $f(n)$ for some polynomial $f$. We can construct a Turing machine $T'$ that emulates $T$ but also keeps track of the time, and stops after $f(n)$ steps. Eve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.