instruction stringlengths 0 29.8k ⌀ |
|---|
I can think of three major hurdles:
* NP-hardness only gives you information about complexity *in the limit*. For many NP-complete problems, algorithms exist that solve all instances of interest (in a certain scenario) reasonable fast. In other words, for any *fixed* problem size (e.g. a given "key"), the problem i... |
One of the most basic things you can do is a [Diffie-Hellman key exchange](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange). It does not require you to have keys set up before the communication starts as it negotiates one in a way that listeners can not derive the key themselves. See the comprehensive... |
You need to check that your friend, Bob, has your correct phone number, but you cannot ask him directly. You must write the question on a card which and give it to Eve who will take the card to Bob and return the answer to you. What must you write on the card, besides the question, to ensure Bob can encode the message ... |
Cryptography assumes the existance of hard problems on the average case. So, worst case hardness as in NP-hardness proofs is not sufficient. One such problem is Integer Factorization. |
Cryptography assumes the existence of a problem that is hard in the *average* case. Worst case hardness as in the NP-hardness proofs is not sufficient. One problem that is hard in expectation is integer factorization. |
> I have no way to learn (say) $m_1$ unless I know $m_2$.
That is exactly the problem - if you re-use the same key, and someone has access to one message you encrypted in both plaintext and encrypted form, they can use that to find your key:
$$
(m_2 \oplus k) \oplus m_2 = k
$$
As an alternative scenario, if y... |
Cryptography assumes the existence of a problem that is hard in the *average* case. Worst case hardness as in the NP-hardness proofs is not sufficient. One problem that is believed to be hard on average is integer factorization. Proving the average-case NP-completness of natural NP-complete problem is a major open prob... |
Worst-case Hardness of NP-complete problems is not sufficient for cryptography. Even if NP-complete problems are hard in the worst-case (P≠NP ), they still could be efficiently solvable in the average-case. Cryptography assumes the existence of average-case intractable problems in NP. Also, proving the existence of ha... |
I wrote
$\qquad \displaystyle \sum\limits_{i=1}^n \frac{1}{i} = \sum\limits_{i=1}^n \cal{O}(1) = \cal{O}(n)$
but my friend says this is wrong. From the TCS cheat sheet I know that the sum is also called $H_n$ which has logarithmic growth in $n$. So my bound is not very sharp, but is sufficient for the analysis I ... |
What goes wrong with sums of Landau terms? |
|asymptotics|landau-notation| |
We were given the following exercise.
> Let
>
> $\qquad \displaystyle f(n) = \begin{cases} 1 & 0^n \text{ occurs in the decimal representation of } \pi \\ 0 & \text{else}\end{cases}$
>
> Prove that $f$ is computable.
How is this possible? As far as I know, we do not know wether $\pi$ contains every sequence ... |
How can it be decidable wether $\pi$ has some sequence of digits? |
|undecidability| |
I was reading [an article](http://www.eecg.toronto.edu/~livio/papers/flexsc-osdi10.pdf) that describes the switch between user-space and kernel-space that happens upon a system call. The article says
> An application expects the completion of the system call before resuming user-mode execution.
Now, until now I ... |
|algorithms|asymptotics|landau-notation| |
|computability|undecidability| |
(I'm a student with some mathematical background and I'd like to know how to count the number of a specific kind of binary trees.)
Looking at Wikipedia page for [Binary Trees][1], I've noticed this assertion that the number of rooted binary trees of size $n$ would be this [Catalan Number][2]:
$$C_n = \dfrac{1}{n+1}... |
Counting binary trees |
|combinatorics|binary-trees| |
There are only two possibilities to consider.
* For every positive integer $n$, the string $0^n$ appears in the decimal representation of $\pi$. In this case, the algorithm that always returns 1 is always correct.
* There is a largest integer $N$ such that $0^N$ appears in the decimal representation of $\pi$. I... |
What you wrote is perfectly correct. The $n$th harmonic number is indeed in the set $O(n)$.
*Proof:* $\sum_{i=1}^n \frac{1}{i} \le \ln n + 1 \le 2n = O(n)$. $\square$
The upper bound $O(n)$ isn't _tight_, but it's correct. |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An execellent reference is [Ana... |
Intuitively, "balanced trees" should be trees where left and right sub-trees at each node must have "approximately the same" number of nodes.
Of course, when we talk about red-black trees*(see definition at the end) being balanced, we actually mean that they are _height_ balanced and in that sense, they are balanced... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
**No.** Consider a red-black tree with the following special structure.
* The left subtree is a complete binary tree with depth $d$, in which every node is black.
* The right subtree is a complete binary tree with depth $2d$, in which every node at odd depth is red, and every node at even depth is black.
It's s... |
A deterministic finite automaton (DFA) is a state machine model capable of accepting all and only regular languages. DFAs can be (and usually are) defined in such a way that each state must provide some transition for all elements of the input alphabet; in other words, the transition function $\delta : Q \times \Sigma ... |
Languages accepted by modified versions of finite automata |
|formal-languages|automata|finite-automata| |
**Claim**: Red-black trees can be arbitrarily un-$\mu$-balanced.
**Proof Idea**: Fill the right subtree with as many nodes as possible and the left with as few nodes as possible for a given number $k$ of black nodes on every root-leaf path.
**Proof**: Define a sequence $T_k$ of red-black trees so that $T_k$ has $... |
I wrote
$\qquad \displaystyle \sum\limits_{i=1}^n \frac{1}{i} = \sum\limits_{i=1}^n \cal{O}(1) = \cal{O}(n)$
but my friend says this is wrong. From the TCS cheat sheet I know that the sum is also called $H_n$ which has logarithmic growth in $n$. So my bound is not very sharp, but is sufficient for the analysis I ... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
The question is:
$L = \{a^n \mid \text{there exists a number } p \geq n \text{ such that both } p \text{ and } p+2 \text{ are prime}\}$. Is $L$ regular?
This question looked suspicious at the first glance and I've realized that it is connected with the [twin prime conjecture][1]. My problem is that the conjecture... |
Is this language defined using twin primes regular? |
|formal-languages|automata|regular-languages|finite-automata| |
Intuitively, "balanced trees" should be trees where left and right sub-trees at each node must have "approximately the same" number of nodes.
Of course, when we talk about red-black trees*(see definition at the end) being balanced, we actually mean that they are _height_ balanced and in that sense, they are balanced... |
If the twin prime conjecture is true, then $L = a^{*}$, which is regular. If the twin prime conjecture is not true, then there are finitely many twin primes; indeed, there is a largest pair of twin primes $\{p, p + 2\}$. In this case, $L = \{a^{n} | n < p + 1\}$, a finite language. In either case, you get a regular lan... |
Let
$\qquad L = \{a^n \mid \exists_{p \geq n}\ p\,,\ p+2 \text{ are prime}\}.$
Is $L$ regular?
This question looked suspicious at the first glance and I've realized that it is connected with the [twin prime conjecture][1]. My problem is that the conjecture has not been resolved yet, so I am not sure how can ... |
Yes, this language is regular. The twin prime conjecture need not be resolved in order to see this:
Suppose the twin prime conjecture is true, that is, for any $n$, we can find a prime $p \geq n$ such that $p+2$ is prime. Then in particular, $L = \{ a^n | n \in N \}$, as the condition is always true. This last langu... |
It is regular in either case.
* If there are infinitely many twin primes, then $L=\{a^n:n\geq 0\}=L(a^*)\}$.
* If there are finitely many twin primes, then $L$ is finite, and thus regular. |
To start off the analysis, I can say that $L(DFA) \subseteq L(DDFA)$ for type-1.
You can do this by duplicating a DFA and adding edges to duplicated states. If a state $s_1$ has a transition to $s_2$ on $x$, you make a transition from $s_1$ to $s_2'$ on $x$ as well. In addition, $s_1'$ has a transition to $s_2$ and ... |
$L(DDFA)\subseteq L(DFA)$ can be proven by adapting the usual powerset construction with a modified final state condition.
Usually, a state after performing the powerset construction is final if one of the states in the set is final in the original automaton.
In type 1 DDFA, final states in the constructed auto... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
|combinatorics|binary-trees|discrete-mathematics| |
How can it be decidable whether $\pi$ has some sequence of digits? |
$L(DDFA)\subseteq L(DFA)$ can be proven by adapting the usual powerset construction with a modified final state condition. In the power set construction, states are sets of states from the original automaton. Usually after performing the powerset construction, a state is final if one of the states in the set is final i... |
To start off the analysis, I can say that $L(DFA) \subseteq L(DDFA)$ for type-1.
You can do this by duplicating a DFA and adding edges to duplicated states. If a state $s_1$ has a transition to $s_2$ on $x$, you make a transition from $s_1$ to $s_2'$ on $x$ as well. In addition, $s_1'$ has a transition to $s_2$ and ... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
It is not uncommon to see students starting their PhDs with only a limited background in mathematics and the formal aspects of computer science. Obviously it will be very difficult for such students to become theoretical computer scientists, but it would be good if they could become savvy with using formal methods and ... |
Path to formal methods |
|formal-methods|education| |
$L(DDFA)\subseteq L(DFA)$ can be proven by adapting the usual powerset construction with a modified final state condition. In the power set construction, states are sets of states from the original automaton. Usually after performing the powerset construction, a state is final if one of the states in the set is final i... |
This combined with Alex's answer give the complete picture.
$L(DDFA)\subseteq L(DFA)$ can be proven by adapting the usual powerset construction with a modified final state condition. In the power set construction, states are sets of states from the original automaton. Usually after performing the powerset constructi... |
In the preface of his book “Mathematical Discovery, On Understanding, Learning, and Teaching Problems Solving” George Pólya writes:
> Solving problems is a practical art, like swimming, or skiing, or
> playing the piano: you can learn it only be imitation and practice.
> This book cannot offer you a magic key that... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
It is not uncommon to see students starting their PhDs with only a limited background in mathematics and the formal aspects of computer science. Obviously it will be very difficult for such students to become theoretical computer scientists, but it would be good if they could become savvy with using formal methods and ... |
This combined with Alex's answer give the complete picture.
$L(DDFA)\subseteq L(DFA)$ can be proven by adapting the usual powerset construction with a modified final state condition. In the power set construction, states are sets of states from the original automaton. Usually after performing the powerset constructi... |
This combined with [Alex's answer][1] give the complete picture.
$L(DDFA)\subseteq L(DFA)$ can be proven by adapting the usual powerset construction with a modified final state condition. In the power set construction, states are sets of states from the original automaton. Usually after performing the powerset const... |
In the preface of his book “Mathematical Discovery, On Understanding, Learning, and Teaching Problems Solving” George Pólya writes:
> Solving problems is a practical art, like swimming, or skiing, or
> playing the piano: you can learn it only be imitation and practice.
> This book cannot offer you a magic key that... |
Formal methods such as Z, B, TLA, CafeObj heavily rely on set theory, logic, category theory, lambda calculus, and automata for modelling the concepts of types, data, and computation.
You can either jump into a comprehensive monograph such as [Logics of Specification Languages, by Dines Bjørner and Martin C. Henson ... |
Discrete mathematics is the study of mathematical structures that are fundamentally discrete rather than continuous. |
null |
Discrete mathematics is the study of mathematical structures that are fundamentally discrete rather than continuous. In contrast to real numbers that have the property of varying "smoothly", the objects studied in discrete mathematics – such as integers, graphs, and statements in logic – do not vary smoothly in this wa... |
null |
About the One-Time-Pad (OTP) encryption method |
null |
What you are doing is a very convenient abuse of notation.
Some pedants will say that what you write is nonsense, as $\mathcal{O}(f)$ denotes a _set_ and you cannot do arithmetic operations on them the way you are doing.
But it is a good idea to ignore those pedants and assume that $\mathcal{O}(f)$ stands for _so... |
What you are doing is a very convenient abuse of notation.
Some pedants will say that what you write is nonsense, as $\mathcal{O}(f)$ denotes a _set_ and you cannot do arithmetic operations on them the way you are doing.
But it is a good idea to ignore those pedants and assume that $\mathcal{O}(f)$ stands for _so... |
In a previous question about [exotic state machines][1], Alex ten Brink and Raphael addressed the computational capabilities of a peculiar kind of state machine: min-heap automata. They were able to show that the set of languages accepted by such machines ($HAL$) is neither a subset nor a superset of the set of context... |
Proving properties of min-heap automata |
|formal-languages|automata| |
It is regular in either case.
* If there are infinitely many twin primes, then $L=\{a^n:n\geq 0\}=L(a^*)$.
* If there are finitely many twin primes, then $L$ is finite, therefore regular. |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
**1 -** Quick sort is inplace (doesn't need extra memmory, other than a constant amount.)
**2 -** Quick sort is easier to implement than other efficient sorting algorithms.
**3 -** Quick sort has smaller constant factors in it's running time than other efficient sorting algorithms.
Update:
For merge so... |
Bob doesn't have to send any messages that you can decrypt. He only has to prove to you that he has your phone number. Therefore, [Cryptographic Hash Functions][1], (one-way encryption) offers an alternative to a public key cryptosystem. [SHA-2][2] is currently a popular example of such a function.
In this strategy,... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
**Claim**: Red-black trees can be arbitrarily un-$\mu$-balanced.
**Proof Idea**: Fill the right subtree with as many nodes as possible and the left with as few nodes as possible for a given number $k$ of black nodes on every root-leaf path.
**Proof**: Define a sequence $T_k$ of red-black trees so that $T_k$ has $... |
Questions about CF-languages, that is, languages described by context-free grammars. |
null |
The advantage of this approach is that round robin scheduling is very efficient, so you don't need to rely on a more complex scheduler, which would steal cycles. Introducing longer time slices for higher priority processes would decrease the responsiveness of other threads and make it harder for the OS to jump in to de... |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
In a previous question about [exotic state machines][1], Alex ten Brink and Raphael addressed the computational capabilities of a peculiar kind of state machine: min-heap automata. They were able to show that the set of languages accepted by such machines ($HAL$) is neither a subset nor a superset of the set of context... |
Proving closure under reversal of languages accepted by min-heap automata |
In a previous question about [exotic state machines][1], Alex ten Brink and Raphael addressed the computational capabilities of a peculiar kind of state machine: min-heap automata. They were able to show that the set of languages accepted by such machines ($HAL$) is neither a subset nor a superset of the set of context... |
Proving closure under complementation of languages accepted by min-heap automata |
|formal-languages|automata| |
In a previous question about [exotic state machines][1], Alex ten Brink and Raphael addressed the computational capabilities of a peculiar kind of state machine: min-heap automata. They were able to show that the set of languages accepted by such machines ($HAL$) is neither a subset nor a superset of the set of context... |
Computational power of deterministic versus nondeterministic min-heap automata |
|formal-languages|automata| |
A simple solution would be:
Both Alice and Bob agree on the same colour. and it's no problem if Eve knows that one, we'll call this P. Let's say it's yellow. Now, Alice and Bob both randomly choose a private colour, say "x". Alice chooses red, and Bob chooses blue. Now they mix them together with the P. Alice now ha... |
The following DFA is a lexical analyzer which is supposed to recognize comments. The lexical analyzer will ignore the comment and goes back to the state one. I'm told that there's something wrong with it but I can't figure it out. What's the problem?
![enter image description here][1]
FWIW, those tiny signs are s... |
A DFA for recognizing comments |
|compilers|dfa| |
In state 2 there is no transition for when you encounter a character other than `*`. The same is true in state 4 with `/`.
Also it's not entirely clear what happens in state 1 if you encounter something other than `/`, but it looks like that's because that part's intentionally cut off. |
* There is no initial state, so there's no automaton. I suppose $1$ is the initial state.
* From state 4 you can still read several times the symbol $*$ and accept the comment. For example, the coment `/*hello*/` is being accepted, but the comment `/*hello**/` is not. So you need $\delta(4,*)=4$.
* Also, you need mor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.