instruction
stringlengths
0
29.8k
⌀
null
In several explanations of coinductive definitions (for example, in the answers to https://cs.stackexchange.com/questions/525/what-is-coinduction), we're told that while an inductive definition gives us the smallest set with a specified set of properties (the constructors), coinduction gives us the *largest* set such w...
"Largest set" in coinductive definitions
|logic|proof-techniques|formal-methods|coinduction|
Here is a tentative self-answer. I think it must just be that there is an additional requirement that wasn't mentioned in the tutorials I read, namely that one of the destructors must apply to each element of the set. So in the case of infinite streams we are looking at a set $\mathcal{E}$ such that * *every*...
Here is a tentative self-answer. I think it must just be that there is an additional requirement that wasn't mentioned in the tutorials I read, namely that one of the destructors must apply to each element of the set. So in the case of infinite streams we are looking at a set $\mathcal{E}$ such that * *every*...
null
null
Yes $FGI \preceq_P DGI$ also holds. Assume you have a black box $B$ that solves $DGI$ in polynomial time. You can easily solve $FGI$ in deterministic polynomial time with polynomial many calls to $B$. First let $K_n$ be a clique on $n$ vertices. Let us define the function `addClique(G, v, n)` that adds to a graph $G...
I guess it largely depends on how you define "useful"? Here is a proof of a sorting algorithm: https://blog.adacore.com/i-cant-believe-that-i-can-prove-that-it-can-sort
Many processors with complex instructions split them up internally into less complex instructions and execute those. Often these are called “micro-OPs”. Intel x86 processors often split one instruction into four "micro-OPs". I think ARM 32 bit processors split "load multiple registers" and "store multiple registers" in...
Many constructive proofs could be useful. For example, to prove that every set of points in the plane (in general position) have a [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation), you would give the algorithm for producing the Delaunay triangulation, along with a proof that the result of ...
Many processors with complex instructions split them up internally into less complex instructions and execute those. Often these are called “micro-OPs”. Intel x86 processors often split one instruction into four "micro-OPs". I think ARM 32 bit processors split "load multiple registers" and "store multiple registers" in...
null
null
In CLRS it is stated that the class $\mathcal{H}_{p, m} = \{ h_{ab}:\mathbf{Z}_p \to \mathbf{Z}_m \mid a \in \mathbf{Z}_p^*, b \in \mathbf{Z}_p\}$, $h_{ab}(x) = (ax+b) \mod p \mod m$, $m < p$ prime has $p(p-1)$ members. However, I don't see why some of these functions couldn't turn out to be the same. I've investigated...
Universal class $\mathcal{H}_{p, m}$ of hash functions has $p(p-1)$ members
|discrete-mathematics|hashing|modular-arithmetic|
In CLRS it is stated that the class $\mathcal{H}_{p, m} = \{ h_{ab}:\mathbf{Z}_p \to \mathbf{Z}_m \mid a \in \mathbf{Z}_p^*, b \in \mathbf{Z}_p\}$, $h_{ab}(x) = (ax+b) \mod p \mod m$, $m < p$ prime has $p(p-1)$ members. However, I don't see why some of these functions couldn't turn out to be the same. I've investigated...
Let $ A $ be an array of $ n $ integer arrays with unknown lengths and $ s \in \mathbb{Z} $ a given number. I want to find the number of combinations of numbers from each array, such that their sum is $ s $. In set theory terms, if I have $ n $ tuples, $ A_1, A_2, \ldots A_n $, I want to find all $ (a_1, a_2, \ldots, ...
Finding number of combinations of numbers from multiple arrays that add up to a given value
|algorithms|arrays|efficiency|
In CLRS it is stated that the class $\mathcal{H}_{p, m} = \{ h_{ab}:\mathbf{Z}_p \to \mathbf{Z}_m \mid a \in \mathbf{Z}_p^*, b \in \mathbf{Z}_p\}$, $h_{ab}(x) = (ax+b) \mod p \mod m$, $m < p$ prime has $p(p-1)$ members. However, I don't see why some of these functions couldn't turn out to be the same. I've investigated...
The claim is false in general. If $p=3$ and $m=2$, there are only 3 such functions, as can be found by enumeration. For instance, $h_{1,2}(x) = h_{2,0}(x)$ for all $x$. It's possible that there might exist some constant $c_0$ such that the claim is true for all $p>m>c_0$. I doubt there's a simple proof. Heuristi...
I am trying to find the language generated by this context-free grammar ``` S → aSb | bbY | Yaa Y → bY | aY | ε ``` I understand that one way to solve is this to find set of strings that satisfies this grammar, But I don't see a common pattern in those strings. Strings that belong to this language are ``...
Find the language generated by the Context Free Grammaer
|automata|context-free|formal-grammars|
The claim is false in general. If $p=3$ and $m=2$, there are only 3 such functions, as can be found by enumeration. For instance, $h_{1,2}(x) = h_{2,0}(x)$ for all $x$. It seems very plausible to me that there might exist some constant $c_0$ such that the claim is true for all $p>m>c_0$. I doubt there's a simple ...
null
|algorithms|arrays|efficiency|knapsack-problems|subset-sum|
Find the language generated by the Context Free Grammar
The problem is NP-hard. As @AspiringMat [explains](https://cs.stackexchange.com/questions/154695/finding-number-of-combinations-of-numbers-from-multiple-arrays-that-add-up-to-a?noredirect=1#comment325313_154695), even to determine whether there exists any solution at all is as hard as [the partition problem](https://e...
[This](https://en.wikipedia.org/wiki/Bloom_filter#Probability_of_false_positives) and [this](https://hur.st/bloomfilter/?n=100&p=&m=10&k=1) agree that there will be near 100% false positive rate with Bloom's filter should number of elements in the set ($n$) be greater than the number of bits in the filter ($m$). E.g...
What is the point of Bloom's filter if its false positive rate is so high?
|space-complexity|bloom-filters|
$m$ is the total size of the filter in bits, not the number of bits per entry. With $m=1000$ the formula gives a false positive rate of around 10%, roughly the same as the 1000-bit list of hashes (whose false positive rate is 100/1024 if all hashes are distinct). With $k=3$ and $m=500$ you get a false positive rate ...
I am trying to find the language generated by this context-free grammar ``` S → aSb | bbY | Yaa Y → bY | aY | ε ``` I understand that one way to solve is this to find set of strings that satisfies this grammar, But I don't see a common pattern in those strings. Some of the strings that belong to this lang...
|context-free|formal-grammars|derivation|
The generation of strings by this context-free grammar can be split into four stages. 1. Apply $S \to aSb$ zero or more times. We get $S\Rightarrow^*a^kSb^k$ for $k\ge0$. 2. Apply $S\to bbY$ or $S \to Yaa$ once. We get $a^kSb^k\Rightarrow a^kbbYb^k$ or $a^kSb^k\Rightarrow a^kYaab^k$. 3. Apply $Y\t...
The generation of strings by this context-free grammar can be split into four stages. At each stage, we use some expression to represent which sentential forms can be generated so far. 1. Apply $S \to aSb$ zero or more times. We get $S\Rightarrow^*a^kSb^k$ for $k\ge0$. 2. Apply $S\to bbY$ or $S \to Yaa$ onc...
The generation of strings by this context-free grammar can be split into four stages. At each stage, we can use some expressions to represent all sentential forms that can be generated so far. As long as you can understand/manipulate them consistently, you are good to go. 1. Apply $S \to aSb$ zero or more times....
$m$ is the total size of the filter in bits, not the number of bits per entry. With $m=1000$ the formula gives a false positive rate of around 10%, roughly the same as the 1000-bit list of hashes (whose false positive rate is 100/1024 if all hashes are distinct). With $k=3$ and $m=500$ you get a false positive rate ...
The generation of strings by this context-free grammar can be split into four stages. At each stage, we can use some expressions to represent all sentential forms that can be generated so far. As long as you can understand/manipulate them consistently, you are good to go. 1. Apply $S \to aSb$ zero or more times....
http://www.csl.mtu.edu/cs3331.ck/common/05-Sync-Basics.pdf 1.Does starvation-freedom imply deadlock-freedom? Yes. Since starvation-freedom says a process will eventually enter its CS, all processes will enter their CS. So, no two processes are deadlocked. 2.Does starvation-freedom imply bounded-waiting? No. sta...
**Refer**: http://www.csl.mtu.edu/cs3331.ck/common/05-Sync-Basics.pdf 1. Does starvation-freedom imply deadlock-freedom? **Yes**. Since starvation-freedom says a process will eventually enter its CS, all processes will enter their CS. So, no two processes are deadlocked. 2. Does starvation-freedom imply bounded-w...
Suppose that I have a space $\mathcal{X} = \{x_1, x_2, \ldots, x_n\}$ and a set $\mathcal{S} \subseteq \mathcal{X}$ with $|\mathcal{S}|$ many elements. A naive set membership function $f:\mathcal{X} \to \{\text{in},\text{not in}\}$ would look like this: $$ f: x \mapsto \begin{cases} \text{in $\mathcal{S}$} & ...
Any approximate set membership function with logarithmic space complexity?
I am wondering about this small question, why aren't this regular expression are not equal? (a+b)^* = (a*b)^*
Regular Expression Equality
|regular-expressions|
I am wondering about this small question, why aren't this regular expression are not equal? (a+b)* = (a* b)*
I am wondering about this small question, why aren't this regular expression are not equal? (a+b)* a* = (a* b)* a*
A regular expression is defined by a syntax: it means that a regular expression is a sequence of symbols following certain rules. If two regular expression have different symbols, they are different. However, it is natural to define a semantic, or interpretation, associated to regular expression. The interpretati...
I am wondering about this small question, why aren't these regular expressions equal? $(a+b)^* a^*$ and $(a^* b)^* a^*$
null
null
null
The expected running time, $T(n)$, of quicksort when the pivot is chosen uniformly at random satisfies $$ T(n) \leq \mathcal O(n) +\frac{1}{n}\sum^{n-1}_{i=0}(T(i) + T(n - i)),$$ which leads to the known bound of $\mathcal O (n \log n)$. Suppose we consider the following procedure to discard bad pivots: after samp...
Analysis of randomized algorithms
|algorithm-analysis|runtime-analysis|sorting|randomized-algorithms|quicksort|
null
null
Sure, you can store an approximate representation with only log storage, but the error rate will be insanely high, so it will likely be useless in practice. For instance, one approximate representation is to store the first $\log |\mathcal{S}|$ entries of $\mathcal{S}$. Note that, at least with the most natural rep...
Why isn't it possible to have P=NP, but not all problems in P are in NP-hard? The diagram of the various classes would look something like: [![enter image description here][1]][1] We have P=NP, but not all problems in P lie inside NP-hard. The intersection of P and NP-hard is still NP-complete. Lander's theore...
Why can't we have P=NP but P not contained in NP-hard?
|complexity-theory|np-hard|
Because we know that $\emptyset$ and $\Sigma^*$ belong to P, but are not NP-hard.
null
> Does this always work on larger matrices with 2*n rows and 2*n+1 columns where n is the number of variables? (I think it may need non-redundant (linearly independent?) rows.) It works but since there are assignments other than -1 and 1, how will you use the row echelon form to make any conclusions about the 1-in-...
Every problem in P is polynomial-time reducible to every other problem in P. If P=NP then every problem in NP is polynomial-time reducible to every problem in P, i.e., every problem in P is NP-hard.
NP-hardness is technically defined in terms of Karp reduction, in which the answer to the target problem must be the answer to the source problem, and not in terms of Cook reduction, in which the target problem is used as an oracle. This means that the empty language and the language of all words aren't in NP-hard even...
The expected running time, $T(n)$, of quicksort when the pivot is chosen uniformly at random satisfies $$ T(n) \leq \mathcal O(n) +\frac{1}{n}\sum^{n-1}_{i=0}(T(i) + T(n - i)),$$ which leads to the known bound of $\mathcal O (n \log n)$. Suppose we consider the following procedure to discard bad pivots: after samp...
Whether or not P is equal to NP, it is definitely not the case that P is a subset of NP-hard. This is because we know that $\emptyset$ and $\Sigma^*$ belong to P, but are not NP-hard.
Why do you think the Immediate type instructions are limiting its immediate values to only 12 bits, while upper immediate type instructions can handle immediate values of 20 bits.
Risc v Instruction format
|computer-architecture|
null
null
I am new to Hough transform, though I have some basic idea about it. I am currently trying to fit the best line to a cluster of points $\left(x_i, y_i\right), i = 1,2,\cdots , N$, where there are many outliers, as well. The true points have very low noise. So, the main issue is to correctly identify outliers and rejec...
grouping/clustering of lines using Hough transform
|optimization|machine-learning|computer-vision|clustering|
if we define halting problem as follows $ \begin{align*} h(m,n) &= \begin{cases} 1 & \text{if program $m$ halts on input $n$} \\ 0 & \text{otherwise} \\ \end{cases} \end{align*} $ and we have two different sometimes correct solution $f$ and $g$ for $h$ then we can compute $h$ as fol...
Can you find a counter example for this sketch of a solution to the halting problem?
if we define halting problem as follows $ \begin{align*} h(m,n) &= \begin{cases} 1 & \text{if program $m$ halts on input $n$} \\ 0 & \text{otherwise} \\ \end{cases} \end{align*} $ and we have a sometimes correct solution $f$ for $h$ that is always correct if it says "1" then we can...
I started wondering this reading about the x86-SSE instruction rsqrtss being faster (and more accurate) than the Fast inverse square root. Here and there I have also read about other specialized hardware instructions that replaced popular software algorithms for better performance. Is it really always the case that a s...
Is a specialized hardware instruction always faster than a software implementation, and if so, is there a general reason?
|algorithms|performance|instruction-set|
I started wondering this reading about the x86-SSE instruction rsqrtss being faster (and more accurate) than the Fast inverse square root. Here and there I have also read about other specialized hardware instructions that replaced staple software algorithms for better performance. Is it really always the case that a sp...
I started wondering this after reading about the x86-SSE instruction `rsqrtss` being faster (and more accurate) than the Fast inverse square root. I have also read about other specialized hardware instructions that replaced staple software algorithms for better performance. Can a specialized hardware instruction genera...
null
Some sources state that an algorithm that solves the SAT problem does not only need to answer the question whether the given formula is satisfiable or not, but additionally in the case where the formula is satisfiable, it needs to provide a satisfying assingment. Is this true or not? I am bit confused, since I thoug...
Is the SAT Problem an existential question?
|complexity-theory|satisfiability|p-vs-np|3-sat|
if we define halting problem as follows $ \begin{align*} h(m,n) &= \begin{cases} 1 & \text{if program $m$ halts on input $n$} \\ 0 & \text{otherwise} \\ \end{cases} \end{align*} $ and we have a sometimes correct solution $f$ for $h$ that is always correct if it says "1" then we can...
The SAT problem is a **decision** problem. It means that an algorithm that solves SAT must answer `true` or `false`, and not necessarily find a satisfying assignment. However, as many decision problems, there is a **functionnal** problem associated to SAT, that asks to find a satisfying assignment when there exists ...
|complexity-theory|
It is easy to show that the answer is definitely yes (specialized hardware can beat software). Because a software algorithm runs on a general-purpose CPU, which is a piece of hardware. So a software algorithm is at the same time a hardware one. And it can be beaten as soon as optimizations/shortcuts can be found ...
It is easy to show that the answer is definitely yes (specialized hardware can beat software). Because a software algorithm runs on a general-purpose CPU, which is a piece of hardware. So any software algorithm is at the same time a hardware one. And it can be beaten as soon as optimizations/shortcuts can be found i...
I'm taking a Theory of Computation class and we went over the proof to show that for any NFA there is an equivalent DFA, which I understand the proof fully in this case. But if it were in reverse, for example, "For any DFA, there is an equivalent NFA," how different would the NFA -> DFA proof be to the DFA -> NFA proof...
DFA and NFA Equivalence Proof