instruction stringlengths 0 29.8k ⌀ |
|---|
The 1's complement of a number $n$ equals $2^w-1-n$, where $w$ is the word length. The two's complement is $2^w-n$.
So $x-y=-(y+(-x))=2^w-1-(y+2^w-1-x)=2^w-(y+2^w-x)$ and the subtraction can indeed be made using 1's complement or 2's complement logic.
|
In a CCC, we have the following equivalence:
$$C(a ⇒ Tb, Ta ⇒ Tb) \cong C((a ⇒ Tb)×Ta, Tb)$$
Using tensorial strength, to give an element of the latter it suffices to give an element of:
$$C(T((a ⇒ Tb) × a), Tb)$$
And then using the evaluation map, it suffices to give:
$$C(TTb, Tb)$$
But this is given... |
"Faster" has no meaning when you compare theoretical algorithms. In general the complexities are only known asymptotically, and for practical problem sizes these expressions can be completely irrelevant. Furthermore, in practice you deal more with expected complexities than with worst cases, and the former can strongly... |
"Faster" has no meaning when you compare theoretical algorithms. In general the complexities are only known asymptotically, and for practical problem sizes these expressions can be completely irrelevant. Furthermore, in practice you deal more with expected complexities than with worst cases, and the former can strongly... |
null |
null |
Set of all strings over Σ (i.e. Σ∗) is Countably Infinite or Uncountably Infinite? |
Set of all strings over Σ is CI or not? |
|undecidability|decidability| |
$\lambda$, $a$, $b$, $aa$, $ab$, $ba$, $bb$, $aaa$, $aab$, $aba$, $abb$, $baa$, $bab$, $bba$, $bbb$, $aaaa$, $\dots$, |
It depends on what is meant by a *syntax analyzer*.
Generally, in computer science, different people often mean different things by the same term, so always consult the definition you were given.
It is very easy for a syntax analyzer to do this.
Let's assume it is based on a parser that uses a well-known parsing... |
null |
Let us assume your set is $S=\cup_{n\geq1}\Sigma^n$.
Clearly, this set is infinitely large. All that is left to figure out is if $S$ is countable.
Any set with a bijection to the set of Natural Numbers, i.e., $\{0,1,2,\ldots\}$, is countable.
*Use the above fact to determine why $S$ is an infinitely large count... |
If a virus is defined as a self-reproducing program, then Rice's theorem implies there can be no infallible virus-detecting algorithm.
Can we take that one step further, as follows? If you have the source code for a virus-detecting program, could you use it to produce a virus that the program will fail to detect? |
Exploiting weaknesses in virus-detecting software? |
|rice-theorem| |
I am currently watching the [FreeCodeCamp Algorithms and Data Structures Tutorial](https://www.youtube.com/watch?v=8hly31xKli0). In the explanation for exponential time complexity, they explain that using a brute force attack on a combination lock would create O(x^n) time complexity. I am confused as this attack sounds... |
Time Complexity of Linear Search vs Brute Force |
|algorithms|time-complexity|search-algorithms|big-o-notation| |
Time complexity is expressed as a function of some parameter, which is usually the size of the input.
The combination lock is not a perfect analogy as it is not immediately clear what the input would be. This confusion goes away once you deal with formally specified computational problems.
However, say that you w... |
You are absolutely right that they are the same algorithm! At least, in this context. "Brute-force attack" is a general term referring to finding a solution to the problem at hand by trying every possibility. Linear-search usually refers to a more specific case where you are scanning through a specified, arbitrarily or... |
That line of reasoning demonstrates that if you have the source code for a virus-detecting program, there exists a virus that the program will fail to detect.
But it says nothing about how easy or hard it might be to actually construct (find) such a virus. Such matters are beyond the scope of computability theory. ... |
So in the halting problem, there is a program that reverses the output of a program that tells if the input program halts or runs forever(I'll call it the main program further). The whole paradox is based on the fact that if we feed this "reverser" program to the main program the reverser program will be in two differe... |
Why there can't be two instances of a "reverse" program in the Halting problem? |
|turing-machines|halting-problem|decidability| |
The main point of the halting problem is that you are running programs on deterministic machines, that means that the execution is always the same.
Given a program and an input, it either halts or it doesn't halt, there is no in between, and certainly not both at the same time. |
null |
Following the reasoning of the Halting Problem, you can indeed make a "virus" that performs the following action:
```
if (this very virus will not be flagged)
infect everything in sight
else
do nothing
```
This is practically possible: you just would have to bundle the entire antivirus with your progra... |
**Definitions**: Let $n \in \mathbb{N}, n \geq 1$. We write $|\alpha|$ to denote the length in characters of an expression $\alpha$ in propositional logic. We define *partial evaluation* in the normal way where evaluation is applied to an expression containing constants until no more evaluation is possible. So for exam... |
null |
null |
null |
null |
They are both correct, but the N is different.
Algorithmic brute force:
Inputs:
X: Size of each combination element
N: Number of combination elements
Algorithm generates all possible combinations and tries each one.
Algorithm is O(X^N)
Linear brute force:
Inputs:
N: List of all possible combina... |
[Equivalence](https://en.wikipedia.org/wiki/Logical_equivalence): Not every SAT instance can be expressed as a system of linear equations. For instance, $x_1 \lor x_2$ cannot be expressed as a system of linear equations.
[Equisatisfiability](https://en.wikipedia.org/wiki/Equisatisfiability): Every SAT instance is e... |
I am working on giving an MSOL formula for an NP-hard problem; this proves that the problem is linear-time solvable on bounded treewidth graphs. Given a graph $G = (V, E)$, the problem would be to find a subset $S \subseteq V$ such that each vertex of degree at least three has at least two neighbors and at most three n... |
Use of degree variable in an MSOL formula |
|algorithms|np-hard|treewidth| |
I am working on giving an MSOL formula for an NP-hard problem; this proves that the problem is linear-time solvable on bounded treewidth graphs. Given a graph $G = (V, E)$, the problem would be to find a subset $S \subseteq V$ such that each vertex of degree at least three has at least two neighbors and at most three n... |
Use of the degree variable in an MSOL formula |
It's all about what you call $n$.
If $n$ denotes the length of the key, then the complexity can be exponential $O(a^n)$.
If $n$ denotes the number of combinations that can be tried, obviously $O(n)$. But given that $n=a^l$ where $l$ is the key length, that is still $O(a^l)$. |
It's all about what you call $n$.
If $n$ denotes the length of the key, then the complexity can be exponential $O(a^n)$.
If $n$ denotes the number of combinations that can be tried, obviously $O(n)$. But given that $n=a^l$ where $l$ is the key length, that is still $O(a^l)$.
|
> main concern is whether or not $d(v)$ can be used in the formula
The answer to this is _no_.
However, if you want to ask whether the degree is (equal to, at least, at most) some fixed constant $c$, then you can make a formula like this:
$$d(v) \geq c \; \triangleq \; \exists u_1 \exists u_2 \cdots \exists u_... |
null |
I am trying to solve the following problem:
Suppose there are traders who can exchange one good for another. Each trader $i$ defines two functions $y = f_{i1}(x)$ and $x = f_{i2}(y)$, with which we can determine how much of $y$ or $x$ we can receive after exchanging with this trader. For example, trader 1 can exchan... |
Let me remind the principle of the proof:
- Assume that we can write a program $H$ that is able to tell if any input program $I$ halts or not.
- Using $H$, we create a program $G$ that halts if $I$ does not halt, and conversely.
- Now we apply $G$ to itself as input ($I=G$). If $G$ halts, $H$ will say so and $... |
Let me remind the principle of the proof:
- Assume that we can write a program $H$ that is able to tell if any input program $I$ halts or not.
- Using $H$, we create a program $G$ that halts if $I$ does not halt, and conversely.
- Now we apply $G$ to itself as input ($I=G$). If $G$ halts, $H$ will say so and $... |
I'm trying to isolate the key differences between induction and recursion so that I am able to know when to use one over the other.
From my understanding, both can be used to prove properties about recursive structures. |
When to do proof by structural induction Vs defining a recursive function? |
|recursion|induction| |
null |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable}**. The reason I ask is that although it doesn't actually seem to generate information which would create a contradiction wi... |
Can a decider return "Undecidable" on the Halting Problem? |
|turing-machines|computability|halting-problem| |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**. The reason I ask is that although it doesn't actually seem to generate information which would create a... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**. The reason I ask is that although it doesn't actually seem to generate information which would create a... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**. The reason I ask is that although it doesn't actually seem to generate information which would create a... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**. The reason I ask is that although it doesn't actually seem to generate information which would create a... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**. The reason I ask is that although it doesn't actually seem to generate information which would create a... |
Presumably, you don't use the term "undecidable" in its formal sense. It is easy to write a program that returns "halts", "does not halt" or "don't know". In particular, a program that always returns "don't know" can do (though there are also less trivial solutions).
I don't see in what way this would "break" the Ha... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**. The reason I ask is that although it doesn't actually seem to generate information which would create a... |
Presumably, you don't use the term "undecidable" in its formal sense. It is easy to write a program that returns "halts", "does not halt" or "don't know". In particular, a program that always returns "don't know" can do (though there are also less trivial solutions, for instance by detecting Pascal-style for and while ... |
I'm trying to isolate the key differences between induction and recursion so that I am able to know when to use one over the other.
From my understanding, both can be used to prove properties about recursive structures.
For example:
Consider a recursive structure $x \in X$. In order to prove that for all $x$, ... |
Say that I have a plasma gun:
[![enter image description here][1]][1]
It's easy to compute the trajectory of the plasma ray starting from the gun.
However, another ray may come from afar:
[![enter image description here][2]][2]
As everybody knows, plasma rays are deviated when they collide. In fact, they a... |
It's all about what you call $n$.
If $n$ denotes the length of the key, then the complexity can be exponential $O(a^n)$.
If $n$ denotes the number of combinations that can be tried, obviously $O(n)$. But given that $n=a^l$ where $l$ is the key length, that is still $O(a^l)$.
----------
**Other example:**
... |
It depends on what is meant by a *syntax analyzer*.
Generally, in computer science, different people often mean different things by the same term, so always consult the definition you were given.
It is very easy for a syntax analyzer to do this.
Let's assume it is based on a parser that uses a well-known parsing... |
I'm trying to isolate the key differences between induction and recursion so that I am able to know when to use one over the other.
From my understanding, both can be used to prove properties about recursive structures.
For example:
Consider a recursive structure $x \in X$. In order to prove that for all $x$, ... |
I'm trying to isolate the key differences between induction and recursion so that I am able to know when to use one over the other.
From my understanding, both can be used to prove properties about recursive structures.
For example:
Consider a recursive structure $x \in X$. In order to prove that for all $x$, ... |
I'm trying to isolate the key differences between induction and recursion so that I am able to know when to use one over the other.
From my understanding, both can be used to prove properties about recursive structures.
For example:
Consider a recursive structure $x \in X$. In order to prove that for all $x$, ... |
I have a genetic algorithm/programming problem where I need the best arrange of items in a binary tree. My question is the best way to mutate/cross this binary tree subject to constraints described below.
All items need to be leaves in this binary tree and there are no nodes with only one branch populated. That is, ... |
GA/GP subtree crossover/mutation with all items present? |
|genetic-algorithms| |
null |
null |
In the book *Self-Stabilization* (Dolev, 2000) the author provides a proof (p.19) of Dijkstra's self-stabilizing mutual exclusion algorithm. An excerpt of the book showing the proof is found below.
[![proof of Dijkstra's self-stabilizing mutual exclusion algorithm][1]][1]
At the end of the proof for *Theorem 2.1*... |
Why must a safe configuration be reached in `n^2 + n` rounds in Dijkstra's Self-stabilizing mutual exclusion algorithm? |
|algorithms|algorithm-analysis| |
One possible approach is to use the [Bentley-Ottman algorithm](https://en.wikipedia.org/wiki/Bentley%E2%80%93Ottmann_algorithm) (or similar algorithm) to find all intersections between line segments.
More specifically: for each plasma gun, add a directed line starting at the plasma gun and proceeding in a straight l... |
That line of reasoning demonstrates that if you have a virus-detecting program, there exists a virus that the program will fail to detect.
But it says nothing about how easy or hard it might be to actually construct (find) such a virus. Such matters are beyond the scope of computability theory. If you care about t... |
null |
I'm trying to isolate the key differences between induction and recursion so that I am able to know when to use one over the other.
From my understanding, both can be used to prove properties about recursive structures.
For example:
Consider a recursive structure $x \in X$. In order to prove that for all $x$, ... |
null |
From the comments:
Does there exist a partition A⊔B
of all instances of the halting problem, such that the halting problem is decidable for instances in A
, and such that given an instance I
we can determine if it belongs to A?
note: my question actually is strictly interested in if the naive assumption above ... |
From the comments:
Does there exist a partition A⊔B
of all instances of the halting problem, such that the halting problem is decidable for instances in A
, and such that given an instance I
we can determine if it belongs to A?
note: my question actually is strictly interested in if the naive assumption above ... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**.
Here's the halting problem, roughly, in python:
# The decider function tries to determine... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**.
Here's the halting problem, roughly, in python:
# The decider function tries to determine... |
So, I know there is no general algorithm for the halting problem, but I was curious if a three output decider could at least give us "an" output **{0 if doesn't halt, 1 if halts, U if undecidable for this decider}**.
Here's the halting problem, roughly, in python:
# The decider function tries to determine... |
null |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"},{"Id":1100,"DisplayName":"Tom van der Zanden"},{"Id":79440,"DisplayName":"Nathaniel"}]} |
null |
Consider the problem of scheduling jobs with different lengths on a single machine while the jobs have the same release times and different due dates. The goal is to schedule the maximum number of scheduled jobs such that none of the scheduled jobs is late. Can this problem solved in polynomial time if jobs are non-pre... |
Scheduling jobs with the same release time and different due dates on a single machinne |
|np-hard|approximation|scheduling|polynomial-time-reductions|pseudo-polynomial| |
Here are a couple articles on the matter.
[From Big-Step to Small-Step Semantics and Back with Interpreter Specialisation][1]
and
[Automatic Transformation of a Big-Step Skeletal
Semantics into Small-Step][2]
Also, if you need to write your own semantics for a functionnal language, you should have a look at pc... |
null |
Let us assume, we have a FSM (to be precise, an epsilon-NFA) in which I've got redundant structures.
I am looking for a framework that allows to factor out the redundant part into some kind of subautomaton, respectively a more canonical representation and naming of this kind of NFA.
As illustration I've got the... |
Linked Finite State Machine |
|finite-automata| |
null |
Linear search runs in linear time $O(n)$ where $n$ is the input size. For example, if you add one item to the array, one extra step is needed.
Brute-force attacks need linear time $O(n)$, but here, $n$ is the value, because the value does not index an array. Therefore, to increase the memory usage in constant steps,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.