instruction stringlengths 0 29.8k ⌀ |
|---|
Given a set B and B’s superset A, if B is missing 1 number (let’s say B’) but don’t know which number it is, how to find that number?
That is,
>B’ = B \ {y}, for some missing element y \
B = A \ {x}, for some elements x \
I’d like to know {y}
The original context is from [Problem6](https://cs251.stanford.edu/h... |
null |
What you asking about is [mathematical induction][1] theorem, more known as mathematical induction principle. It states, that
$$\begin{cases}{}
P(n_0) \text{ true} & \\
(\forall n \geqslant n_0)\big(P(n)\Rightarrow P(n+1)\big) &
\end{cases} \Rightarrow (\forall n\geqslant n_0)P(n) $$
verbally it means, that fo... |
Lookaround assertions do not extend expressive power of regular expressions: it is still the set of regular languages. See [1] for proof. There is also a reference to the paper [2] where they prove this by conversion to a DFA.
[1] Berglund M, van der Merwe B, van Litsenborgh S (2021) Regular Expressions with Loo... |
At every point in time, the space on the stack must be large enough to handle all variables that are in scope. And you generally don't want to use more stack space than needed to avoid wasting space.
Now lets say you required 104 bytes of stack space before entering a scope, and 108 bytes are required within the sc... |
> dynamic programming always give optimal solution whereas greedy algorithm is sub-optimal
Not True. There are problems where even a greedy approach would result in an optimal solution(Fractional knapsack, Minimum cost spanning tree, etc). **An algorithm is said to be greedy if at every step it chooses a candidate a... |
null |
null |
Given a typical popular programming language, its [native type theory](https://arxiv.org/abs/2102.04672) is a dependent type theory which describes invariants, preconditions, predicates, and other generalizations of typical type-system features. The title says it all: what are some strong examples of popular languages ... |
What are strong examples of programming languages whose type systems don't embed into their native type theory? |
|programming-languages|type-theory|dependent-types| |
>Let P be the complexity class of languages decidable by Turing machines running in polynomial time. Say a prefix $s$ of a string $x$ is a long prefix (or an L prefix) if $|s|\ge |x|/2$. For a language $A$, let $LP(A)$ be the language of all L prefixes of strings in $A$. Show that $P$ is not closed under $LP(\cdot )$ u... |
How can we show that P is not closed under taking all long prefixes? |
|complexity-theory|turing-machines|np|strings|polynomial-time| |
The *period* of a PRNG is how many random numbers you can generate before the sequence starts to repeat. If you don't mind using lower-quality PRNG algorithms, some classic ones (which fell out of favour for good reason) have short periods; for example **an LCG can be constructed with any period you want, even for non... |
The *period* of a PRNG is how many random numbers you can generate before the sequence starts to repeat. If you don't mind using lower-quality PRNG algorithms, some classic ones (which fell out of favour for good reason) have short periods; for example **an LCG can be constructed with any period you want, even for non... |
**Input**: A TM $M$ and an integer $k$.
**Output**: Yes if $M$ halts within $2\uparrow\uparrow k$ steps (where $\uparrow\uparrow$ is [tetration][1] (iterated exponentiation)).
---
Intuitively, it seems like this has to be NONELEMENTARY (and its decidability is immediate) from the undecidability of the halting ... |
Is this version of the halting problem NONELEMENTARY? |
|complexity-theory|time-complexity|computability|halting-problem| |
My question relates to Problem 22.-2 in Introduction to Algorithms 3rd edition.
There biconnected components are defined as maximal sets of edges such that any two edges in the set lie on a common simple cycle. The problems that I am having are the last two tasks of this problem, namely
1. proving that biconnecte... |
null |
null |
#### Two different biconnected components does not share an edge
<!--
Path, simple path, cycle and simple cycle are defined in Appendix B.4 of that textbook.
A path is a sequence $v_0, v_1, \ldots, v_k$ of vertices such that $(v_{i-1}, v_i)$ is an edge. A path is simple if all vertices in the path are distinct. ... |
null |
null |
null |
I know the circuit depth for long multiplication can easily be made $O(\log(n))$ by increasing the computational complexity by a constant factor, and I’m pretty sure the same applies to Karatsuba and Toom-Cook. However, I don’t understand enough about the asymptotically faster algorithms to know their circuit depth. Ar... |
What is the circuit depth of asymptotically fast multiplication algorithms? |
|algorithms|parallel-computing|multiplication| |
The concept of brain computer implants assumes that there's some net positive for either a machine or the brain when it comes to calculating or computing things. Usually there is a focus on what the computer can do for the human brain, but this takes the reverse. Essentially what exactly can the human brain do for a co... |
What benefit does the brain have on computers in a human brain computer |
|computer-vs-human|human-computing| |
It looks like you are on the right track. However, some of your statements are not clear. For example, I do not see the relevance of "the existence of bijection from the computable numbers to $\Bbb Q$".
Hint 1.
>! As you might have suspected, it is not possible to computably enumerate all computable numbers, alth... |
First suppose that $p \ne 1/2$, and let $q=1-p$. If the first step is clockwise, then the problem is a gambler's ruin problem, and the chance of success (visiting all nodes) is
$$\frac{1-q/p}{1-(q/p)^{n+1}} \,,$$
See [1] or [2], section 17.3 or [3]. If the first step is counterclockwise, then the chance of success ... |
null |
null |
>Let P be the complexity class of languages decidable by Turing machines running in polynomial time. Say a prefix $s$ of a string $x$ is a long prefix (or an L prefix) if $|s|\ge |x|/2$. For a language $A$, let $LP(A)$ be the language of all L prefixes of strings in $A$. Show that $P$ is not closed under $LP(\cdot )$ u... |
null |
Consider the decision LWE setting, where we have to distinguish between $(A, As + e)$ and $(A, u)$, for a randomly chosen $m \times n$ matrix $A$, an $n \times 1$ secret vector $s$, an $m \times 1$ Gaussian secret vector $e$, and a randomly chosen $m \times 1$ vector $u$.
I have a few questions regarding this settin... |
Two questions on LWE |
|algorithms|time-complexity|cryptography| |
null |
So if someone proves with an algorithm that SAT can be solved in deterministic polynomial time, then P = NP and that's it? |
How to prove that P = NP? |
|satisfiability| |
What is your intended application?
Apart from PRNGs, there are also [quasirandom sequence](https://en.wikipedia.org/wiki/Low-discrepancy_sequence) generators. They are (almost certainly) not cryptographically secure, but have other desirable properties. From [mathworld](https://mathworld.wolfram.com/QuasirandomSeque... |
null |
I know the circuit depth for long multiplication can easily be made $O(\log(n))$ (possibly at the cost of increasing the computational complexity by a small constant factor), and I’m pretty sure the same applies to Karatsuba and Toom-Cook. However, I don’t understand enough about the asymptotically faster algorithms to... |
I know the circuit depth for long multiplication can easily be made $O(\log(n))$ (possibly at the cost of increasing the computational complexity by a small constant factor), and I’m pretty sure the same applies to Karatsuba and Toom-Cook. However, I don’t understand enough about the asymptotically faster algorithms to... |
I know the circuit depth for long multiplication can easily be made $O(\log(n))$ (possibly at the cost of increasing the computational complexity by a small constant factor), and I’m pretty sure the same applies to Karatsuba and Toom-Cook. However, I don’t understand enough about the asymptotically faster algorithms (e... |
I know the circuit depth (i.e. amount of sequential operations on the longest path) for long multiplication can easily be made $O(\log(n))$ (possibly at the cost of increasing the computational complexity by a small constant factor), and I’m pretty sure the same applies to Karatsuba and Toom-Cook. However, I don’t unde... |
Consider the decision LWE setting, where we have to distinguish between $(A, As + e)$ and $(A, u)$, for a randomly chosen $m \times n$ matrix $A$, an $n \times 1$ secret vector $s$, an $m \times 1$ Gaussian secret vector $e$, and a randomly chosen $m \times 1$ vector $u$.
In [many places][1], a "lossy version" of th... |
LWE with a low rank matrix |
Registers are often divided into data registers and address registers ([link][1]). In [Nand2Tetris][2], constants can only be loaded into the address register, but not the data register. I am interested in the rationale behind that limitation, what design priorities are the reason to allow A register to read from bus d... |
Nand2Tetris only allow load constant to A register, any real-world CPUs with similar limitations? |
|cpu| |
Consider the problems:
$$
GHP = \{<M>| \mbox{ there are infinitely many inputs that $M$ halts on}\}.
$$
I'd like to prove that $GHP\notin (RE\cup \overline{RE})$, but it doesn't seem straightforward easy.
Any ideas?
---
My first thought was to try the opposite: suppose that there were at most $k$ halti... |
Is this "generalized halting problem" not in RE? |
|complexity-theory|time-complexity|computability|halting-problem|recursively-enumerable| |
Consider the problems:
$$
GHP = \{<M>| \mbox{ there are infinitely many inputs that $M$ halts on}\}.
$$
I'd like to prove that $GHP\notin RE$, but it doesn't seem straightforward easy.
Any ideas?
---
My first thought was to try the opposite: suppose that there were at most $k$ halting inputs. Then we c... |
null |
What is the Halting on all inputs problem? It is the problem about the language $$TOTAL=\{⟨M⟩\mid M \text{ is a TM and }M\text{ halts on all inputs} \}.$$
What is the complement of the Halting problem? It is the problem about the language $$\overline{HALT}= \{⟨M, w⟩\mid M \text{ is a TM and }M\text{ does not halt on... |
null |
Consider this "generalized halting problem":
$$
GHP = \{<M>| \mbox{ there are infinitely many inputs that $M$ halts on}\}.
$$
I'd like to prove that $GHP\notin RE$, but it doesn't seem straightforward easy.
Any ideas?
---
My first thought was to try the opposite: suppose that there were at most $k$ hal... |
Is the set of Turing machines that halt on infinitely many inputs not recursively enumerable? |
|complexity-theory|computability|halting-problem|recursively-enumerable| |
Given a set B and B’s superset A, if B is missing 1 number (let’s y) but don’t know which number it is, how to find that number?
That is,
>B’ = B \ {y}, for some unknown element y \
B = A \ {x}, for some unknown elements x \
I’d like to know y.
The original context is from [Problem6](https://cs251.stanford.edu... |
Identify the missing number in a set given its superset |
|algorithms|bit-manipulation|communication-complexity| |
Yes, that would be it – just as if someone had found $a,b,c,n>2$ satisfying $a^n+b^n=c^n$, that would have been it for Fermat's last theorem.
No one ever found such numbers, and the reason turned out to be that there aren't any: the conjecture was true. It seems likely that the reason no one has found a polynomial-t... |
I assume that computers make many mistakes (like errors, bugs, glitches, etc.), which can be observed from the amount of questions asked everyday on different communities (like Stack Overflow) showing people trying to fix such issues.
If computers really make many errors (as I assumed earlier) then critical tasks (l... |
Are computers really reliable? |
|computer-architecture|error-estimation|reliability| |
Most errors in computer systems are caused by humans directly through design and programming errors.
Almost all questions on Stack Overflow concern programming problems and most errors that make it to end users are software bugs (human oversight).
Logic errors in hardware design (human oversight) have also caus... |
Most errors in computer systems are caused by humans directly through design and programming errors.
Almost all questions on Stack Overflow concern programming problems and most errors that make it to end users are software bugs (human oversight).
Logic errors in hardware design (human oversight) have also caus... |
I assume that computers make many mistakes (like errors, bugs, glitches, etc.), which can be observed from the amount of questions asked everyday on different communities (like Stack Overflow) showing people trying to fix such issues.
If computers really make many errors (as I assumed earlier) then critical tasks (l... |
null |
I assume that computers make many mistakes (like errors, bugs, glitches, etc.), which can be observed from the amount of questions asked everyday on different communities (like Stack Overflow) showing people trying to fix such issues.
If computers really make many errors (as I assumed earlier) then critical tasks (l... |
In the "Hack CPU" ([Wikipedia/HackCPU][1]) from Nand2Tetris and https://nandgame.com, there are two registers, D and A. The D register is a general purpose data register that provide one of the two inputs to the ALU analog, and the value in the D register can only come from the output of the ALU. The A register holds t... |
"Hack computer" from Nand2Tetris D register, any real world examples of similar design? |
The "Hack CPU" ([Wikipedia/HackCPU][1]) is a theoretical computer design created by Noam Nisan and Shimon Schocken and described in their book and also used in their Coursera course Nand2Tetris, and in the game https://nandgame.com. Their CPU only has two registers, A and D. Both registers are loaded via the output of ... |
"Hack computer" from Nand2Tetris registers, any real world examples of similar design? |
The "Hack CPU" ([Wikipedia/Hack_computer][1]) is a theoretical computer design created by Noam Nisan and Shimon Schocken and described in their book and also used in their Coursera course Nand2Tetris, and in the game https://nandgame.com. Their CPU only has two registers, A and D. Both registers are loaded via the outp... |
Yes, most CPUs(*) have an [accumulator-based architecture](https://en.wikipedia.org/wiki/Accumulator_(computing)#Accumulator_machines) -- they have an accumulator that can only be loaded from the ALU, and whose output can only go back into the ALU, and one input of the ALU connected only to the accumulator.
(The D reg... |
You might be interested in reading about various "[commitment scheme][1]s" in [cryptography][2].
Commitment schemes are easier to implement than "fair exchange", but make weaker guarantees --
typically they can be designed so two parties send some initial messages (where Alice has initial message A and Bob has init... |
Let $h(x)=(1-\frac1{x})^{\frac x2}$ for $x\ge2$.
**Claim**: $h(x)\gt\frac12$ if $x\gt2$.
Proof: Let $g(x)=\ln(1-x)+x$ for $0\le x\lt1$.
Since $g'(x)=-\frac1{1-x} + 1 \le 0$, we have $g(x)\ge g(0)=0$.
<!--
$$h'(x)=f(x)^{g(x)}\left(g'(x) \log (f(x))+\frac{g(x)f'(x)}{f(x)}\right)$$
$$h'(x)=(1-\frac1{x})^... |
Let $h(x)=(1-\frac1{x})^{\frac x2}$ for $x\ge2$.
**Claim**: $h(x)\gt\frac12$ if $x\gt2$.
Proof: Let $g(x)=\ln(1-x)+x$ for $0\le x\lt1$.
Since $g'(x)=-\frac1{1-x} + 1 \le 0$, we have $g(x)\ge g(0)=0$.
<!--
$$h'(x)=f(x)^{g(x)}\left(g'(x) \log (f(x))+\frac{g(x)f'(x)}{f(x)}\right)$$
$$h'(x)=(1-\frac1{x})^... |
null |
null |
null |
null |
Most errors in computer systems are caused by humans directly through design and programming errors.
Almost all questions on Stack Overflow concern programming problems and most errors that make it to end users are software bugs (human oversight).
Logic errors in hardware design (human oversight) have also caus... |
First of all nothing is unfailable. And if it be only, that its hit by a meteorite and gets completely destroyed.
Under the assumption, that there are no external factors, such as power failures, excessive heat, flooding, cosmic rays, etc. a computer will do exactly what you tell it to do.
As mentioned in other ... |
The complexity class $\mathsf{BPP}$ is typically defined as the class of all problems for which:
1. Running an algorithm once takes polynomial time at most.
2. The answer is correct with the probability at least $2/3$.
The complexity class $\mathsf{PP}$, on the other hand, has $1/2$ instead of $2/3$ in the secon... |
Semi-bounded probabilistic polynomial-time, is it equal to BPP? |
|complexity-theory|polynomial-time|probabilistic-algorithms| |
The complexity class $\mathsf{BPP}$ is typically defined as the class of all problems for which:
1. Running an algorithm once takes polynomial time at most.
2. The answer is correct with the probability at least $2/3$.
The complexity class $\mathsf{PP}$, on the other hand, has $1/2$ instead of $2/3$ in the secon... |
Your class is the same as BPP. If you run your algorithm $n$ times, then in the YES case, the expected number of YES answers is at least $(2/3)n$, while in the NO case, the expected number of YES answers is at most $(1/2)n$. Moreover, both of these values are concentrated by Chernoff bounds. Therefore if you answer YES... |
In fact, GHP is very far from r.e. - it is [$\Pi^0_2$](https://en.wikipedia.org/wiki/Arithmetical_hierarchy)-complete, meaning that in particular it is strictly more complicated (in the sense of [Turing reducibility](https://en.wikipedia.org/wiki/Turing_reduction)) than any r.e. set. This includes the halting problem i... |
I've got a bit of a puzzle here that sits at the intersection of mathematics and technology. Hopefully this doesn't fall into brainteaser territory - I'm not sure a neat solution is possible!
I have two devices. Each one has a short token they would like to share. I am happy for either device to get the other's toke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.