instruction stringlengths 0 29.8k ⌀ |
|---|
I tested my [XSAT solver](https://cs.stackexchange.com/questions/148462/conflict-clusters-another-p-np-proof) using the 4 pigeons in 3 holes problem converted to XSAT. The pigeon hole instance I give below had 108 variables and 88 clauses after being converted to monotone XSAT. My solver quickly proved the instance was... |
Detecting whether a machine $M$ is *looping* (meaning that it has reached the same configuration (**not only of its internal state but also of the tape**) twice), is indeed as "easy" as recording the configurations as we simulate $M$ and checking whether the current one was already seen.
This method is of course inc... |
We had this problem on our Algorithms final. It threw me off because if $\log$ is $\log_2$ then graphing the function shows this is not true, but if $\log$ is $\log_{10}$ then it looks like it is. How can this idea be formalised? |
Is $n^{1.03} = \Omega(n \log \log n)$? |
|asymptotics|big-o-notation| |
I have this tiny program for finding largest prime divisor (taken from Code Review Stackexchange and written by user Altinak: https://codereview.stackexchange.com/a/74792):
Here is my try to write it in pseudocode:
```
GLOBAL VARIABLE highest;
factorize(n, f) {
if (n < f)
return n
while (n mod ... |
Any hints about loop invariant of weird loop? |
|asymptotics|big-o-notation|landau-notation| |
I tested my [XSAT solver](https://cs.stackexchange.com/questions/148462/conflict-clusters-another-p-np-proof) using the 4 pigeons in 3 holes problem converted to XSAT. The pigeon hole instance I give below had 108 variables and 88 clauses after being converted to monotone XSAT. My solver quickly proved the instance was... |
In a word, no.
Even TRNGs carry artifacts from natural processes which must be filtered out by slow entropy polling, random polling, inversion and XOR from the same source but over two different time periods, using many such sources, and combinations of all of the above.
The time between Geiger counter ticks is a... |
Recall what big-omega means.
$f(n)$ is $\Omega(g(n))$ if there exists an $n_0$ and a constant $c$ such that for all $n > n_0$, $f(n) \ge c\cdot g(n)$.
To satisfy this definition, $n_0$ can be as large as it needs to be, and $c$ can be as small as it needs to be. Part of the challenge is finding a suitable $n_0$ a... |
Can Rural Postman Problem with arbitrary start and end be reduced to Rural Postman Problem with single depot node?
The rural postman problem is:
*Given a weighted MultiDiGraph $G=(V,E)$, a subset of edges $A$ must be traversed. The path must start and end at the depot node. Find the shortest of all such path... |
null |
null |
They can be empty, but the pumping lemma is used to prove that a language is *not* context free.
It says that if a language is context free, such a configuration always exists, and it's the case for $a^nb^n$ as one can take $u=a^{n-1}, v=a, w=\varepsilon, x=b, y=b^{n-1}$.
The lemma says that one such configuration ... |
You can use immutable, singly linked lists to generate partial permutations in $O(n \operatorname{choose} k)$ operations and memory, which is likely optimal. Here's an example in the Scala programming language:
```scala
class PartialPermutations( n: Int, k: Int ):
require(n >= k)
require(0 <= k)
def fore... |
You can use immutable, singly linked lists to generate partial permutations in $O(n \operatorname{choose} k)$ operations and memory, which is likely optimal. Here's an example in the Scala programming language:
```scala
class PartialPermutations( n: Int, k: Int ):
require(n >= k)
require(0 <= k)
def fore... |
Since I know that the reduction **Clique** $\leq_{p}$ **Vertex-Cover** and **Vertex-Cover** $\leq_{p}$ **Set-Cover** are possible, I know how to show this using transitivity property of reductions. However is there a direct reduction from **Clique** to **Set-Cover** problem possible ? I have not found any reductions o... |
How to prove Set-Cover problem is NP hard via reduction from Clique problem? |
|complexity-theory|np-hard|polynomial-time-reductions|set-cover|clique| |
I wondered if, for a fixed integer k ≥ 3, the divisibility by k is in P/poly.
How can I construct a boolean circuit for each n ∈ N, that takes as input an n-bit integer x and outputs whether 3|x?
The Chinese Reminder Theorem and Little Fermat's Theorem can be of help here but I haven't figured out how I can constr... |
n (mod k) circuit using Chinese Reminder and Little Fermat's Theorem |
|digital-circuits|modular-arithmetic| |
I wondered if, for a fixed integer k ≥ 3, the divisibility by k is in P/poly.
How can I construct a boolean circuit for each n ∈ N, that takes as input an n-bit integer x and outputs whether 3|x?
The Chinese Reminder Theorem and Little Fermat's Theorem can be of help here but I haven't figured out how I can constr... |
null |
Sadly, my knowledge of circuits is quite limited, so I will try to answer the question algorithmically. If You go through your bits from most to least significant, You could reconstruct Your number as follows:
```
number = 0
foreach bit in [a[n-1], a[n-2], ..., a[n]] do
number = 2*number + bit
end foreach
... |
Sadly, my knowledge of circuits is quite limited, so I will try to answer the question algorithmically. If You go through your bits from most to least significant, You could reconstruct Your number as follows:
```
number = 0
foreach bit in [a[n-1], a[n-2], ..., a[n]] do
number = 2*number + bit
end foreach
... |
Sadly, my knowledge of circuits is quite limited, so I will try to answer the question algorithmically. If You go through your bits from most to least significant, You could reconstruct Your number as follows:
```
number = 0
foreach bit in [a[n-1], a[n-2], ..., a[n]] do
number = 2*number + bit
end foreach
... |
I wondered if, for a fixed integer k ≥ 3, the divisibility by k is in P/poly.
How can I construct a boolean circuit for each n ∈ N, that takes as input an n-bit integer x and outputs whether 3|x?
The Chinese Remainder Theorem and Little Fermat's Theorem can be of help here but I haven't figured out how I can const... |
Sadly, my knowledge of circuits is quite limited, so I will try to answer the question algorithmically. If You go through your bits from most to least significant, You could reconstruct Your number as follows:
```
number = 0
foreach bit in [a[n-1], a[n-2], ..., a[n]] do
number = 2*number + bit
end foreach
... |
Sadly, my knowledge of circuits is quite limited, so I will try to answer the question algorithmically. If You go through your bits from most to least significant, You could reconstruct Your number as follows:
```
number = 0
foreach bit in [a[n-1], a[n-2], ..., a[n]] do
number = 2*number + bit
end foreach
... |
null |
A monad is an endofunctor $T:C\rightarrow C$ with natural transformations $\eta:id_C\rightarrow T$ and $\mu:T^2\rightarrow T$.
Being natural transformations mean that $$T(f)\circ \eta_A = \eta_B\circ id_C(f)$$ should hold and $$T(f)\circ\mu_A = \mu_B\circ T^2(f)$$ also. These are the algebraic expressions that the d... |
What is the object translating part of a monadic endofunctor? |
|functional-programming|category-theory|monad| |
T1 T2
R(A)
W(A)
W(A)
Commit
Commit
is not recoverable, even though it satisfies the condition you mentioned about the commit order of transactions.
Let's walk through it:
1. T1 reads and writes A.
2. T2 writes A.
3. T2 commits.
4. T1 commits.
If a failure occur... |
Objects are isomorphic to identity morphisms. So, the object-translating portion of the endofunctor is a subportion of the morphism-translating portion, also carried by `map`. |
As a cryptographic primitive, universal hashing should have somewhat a criterion on its security. How is it defined? |
What is the definition of security of universal hashing |
|hash|cryptography|security| |
Sadly, my knowledge of circuits is quite limited, so I will try to answer the question algorithmically. If You go through your bits from most to least significant, You could reconstruct Your number as follows:
```
number = 0
foreach bit in [a[n-1], a[n-2], ..., a[n]] do
number = 2*number + bit
end foreach
... |
The [Brotli](https://en.wikipedia.org/wiki/Brotli) compression algorithm is somewhat like that. It is however a text compression algorithm. It uses a dictionary of words common in HTML documents. It is however packaged with the (de)compression software not the compressed data. |
The language $L_1 = \{ a^nb^nc^n \}$ is often given as an example of a context-sensitive language.
I am wondering if the language $L_2 = \{ a^nb^na^n \}$ belongs also to the same category? |
Is { a^nb^na^n} a context-sensitive language? |
|formal-languages|formal-grammars|context-sensitive| |
null |
null |
Given a 3 bit number, we can find a 2 bit number with the same remainder modulo 3. That means we map 0 to 7 to 0, 1, 2, 0 or 3, 1, 2, 0 or 3, and 1. So we take the number xyz and create a circuit C that outputs y’, z’ as follows: If x=0 then y’ = y, z’ = z. If x = 1 then with 4 modulo 3 = 1 we map 1yz to 01 if y = z an... |
Given a 3 bit number, we can find a 2 bit number with the same remainder modulo 3. That means we map 0 to 7 to 0, 1, 2, 0 or 3, 1, 2, 0 or 3, and 1. So we take the number xyz and create a circuit C that outputs y’, z’ as follows: If x=0 then y’ = y, z’ = z. If x = 1 then with 4 modulo 3 = 1 we map 1yz to 01 if y = z an... |
The grammar:
> $S\to aS'Ba\mid \varepsilon$
>
> $S'\to aS'Ba\mid aba$ (so that only the start symbol can generate the empty word)
>
> $aB \to Ba$ (to move the $a$'s to the right)
>
> $bB \to bb$ (to transform all $B$'s into $b$'s)
is a noncontracting grammar generating the language $\{a^nb^na^n\mid n\geqsla... |
As a cryptographic primitive, universal hashing should have somewhat a criterion on its security. How is its (computational) security defined? |
The grammar:
> $S\to aS'Ba\mid \varepsilon$
>
> $S'\to aS'Ba\mid aba$ (so that only the start symbol can generate the empty word)
>
> $aB \to Ba$ (to move the inner $a$'s to the right)
>
> $bB \to bb$ (to transform all $B$'s into $b$'s)
is a noncontracting grammar generating the language $\{a^nb^na^n\mid n\... |
As a cryptographic primitive, universal hashing should have somewhat a criterion on its security. How is its (computational) security defined? Or, in other words, what "breaks" a universal hashing? |
null |
I'm not quite sure how you would define success, but here are a couple of references and some context to help you get started.
Have a look at this paper in the AI Journal:
[A computational approach to George Boole’s discovery of Mathematical Logic](https://www.sciencedirect.com/science/article/pii/S00043702970001... |
There's a variety of formal definitions, let me illustrate by giving the three most common definitions. Let $\Pr_{h\in \mathcal{H}}[X]$ denote the probability of event $X$ if $h$ is chosen independently and uniformly at random from set $\mathcal{H}$. A hash function family $\mathcal{H}$ is $\epsilon$-almost universal ... |
Here is some JS code that performs the n mod k operations. To visualize I generate all 8-bit representations and let them run through the function to output a truth table, outputting True if divisible by k and False otherwise. For higher bit-inputs one can adapt the code.
function mod(n, k) {
if (n < 0 |... |
The [Brotli](https://en.wikipedia.org/wiki/Brotli) compression algorithm is somewhat like that. It is however a text compression algorithm. It uses a dictionary of words common in HTML documents which is packaged with the (de)compression software not the compressed data. |
null |
null |
I found this question in one of our past exams, and I'm not to sure about the correct answer.
I have a language L1 (which i don't know anything about) and another language **L2**, which is regular, the question is: given that **L1L2**, **L2L1** are regular can i also say for sure that L1 is regular?
At first my ... |
What can i say about L1 given that L2, L1L2 and L2L1 are regular? |
|regular-languages|finite-automata|closure-properties| |
```
T1 T2
R(A)
W(A)
W(A)
Commit
Commit
```
is not recoverable, even though it satisfies the condition you mentioned about the commit order of transactions.
Let's walk through it:
1. T1 reads and writes A.
2. T2 writes A.
3. T2 commits.
4. T1 commits.
If a failure occurs after... |
null |
It's given that the bandwidth-delay product defines the number of bits that can fill the link; while the sender can send (1+(2*Bandwidth*Delay)) units before getting acknowledged for the first unit. Can anyone help me to realize the practical implication the phenomenon of filling the link will imply? What can be the sp... |
What is practical implication of Bandwidth delay product? |
|computer-networks|network-flow|network-topology|tcp| |
To compare complexity orders, plots are your false friends. Because you may need to look at astronomical values to detect curve crossings. Nothing replaces analytical study.
For example, on a plot $n^{30}$ (in blue) seems to completely outperform $3^n$, but in reality, the latter grows much much faster !
[![enter... |
I’m interested in substitution systems: maps which use a set of rules to transform elements of a sequence into a new sequence.
For simplicity we will consider here only binary 1-D arrays.
Unlike the [Wolfram language definition][1], I suppose that LHS of rule may be any length.
So a set of rules like `[[0] → ... |
Periodicity of substitution system |
|algorithms|arrays|iteration| |
To compare complexity orders, plots are your false friends. Because you may need to look at astronomical values to detect curve crossings. Nothing replaces analytical study.
For example, on a plot $n^{30}$ (in blue) seems to completely outperform $3^n$, but in reality, the latter grows much much faster !
[$. The problem is that $n^{0.03}$ grows very fast, but not for small n, not for large n, but for absolutely huge n.
Assume "log" is the base 2 logarithm. Then for $n = 2^{100}$ we have $n^{0.03} = 2^{100 \cdot 0.03} = 2^3 = 8.$ $\log \log n$ ... |
Given a 3 bit number, we can find a 2 bit number with the same remainder modulo 3. That means we map 0 to 7 to 0, 1, 2, 0 or 3, 1, 2, 0 or 3, and 1. So we take the number xyz and create a circuit C that outputs y’, z’ as follows: If x=0 then y’ = y, z’ = z. If x = 1 then with 4 modulo 3 = 1 we map 1yz to 01 if y = z an... |
There is a very commonly used index formula to map between 2d and 1d:
```
for x=0; x<width; ++x
for y=0; y<height; ++y
i = x + y * width
```
One option, is to just run this, store the indices, then use the index when needed (unless you want to generate the whole index on the fly)
For example:
```
f... |
There are two problems: One, a Turing machine doesn't necessarily halt. That's because it has unlimited amounts of state. Your PC with 128 GB of RAM = 1 Terabit only has $2^{1024 \cdot 1024 \cdot 1024 \cdot 1024}$ different states, so it has to reach the same state again.
Two, if you simulate the Turing machine and... |
null |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.