instruction
stringlengths
0
29.8k
⌀
|formal-languages|turing-machines|turing-recognizable|
According to the theorem(see reference) on the rigidity of frameworks: > A rectangular framework is rigid if and only if its associated bipartite graph is connected. Now consider the case for a 2-by-2 rectangular framework. [![enter image description here][2]][2] [![enter image description here][3]][3] In...
Let $S = \{P_1, P_2, ..., P_m\}$ be a set of convex polygons in $\mathbb R^2$ with a total of $n$ vertices. Polygons are defined by ordered lists of vertices, and each vertex is represented by a pair $(x,y)$ of its Cartesian coordinates. Polygons may have non-empty pairwise intersections. A convex polygon is called ...
null
I'm trying to write a gradient ascent approach to partitioning a polygon in Euclidean 2-space. The algorithm will change the partition line one unit square at a time. As part of the loss function, each unit square should have values $w$ and $d$, where $w$ is the weight of this square and $d$ is the distance to the aver...
How to efficiently recalculate iterative weighted center
|algorithms|graphs|optimization|logic|
I'm trying to write a gradient ascent approach to partitioning a polygon in Euclidean 2-space. The algorithm will change the partition line one unit square at a time. As part of the loss function, each unit square should have values $w$ and $d$, where $w$ is the weight of this square and $d$ is the distance to the aver...
null
I'm trying to write a gradient ascent approach to partitioning a polygon in Euclidean 2-space. The algorithm will change the partition line one unit square at a time. As part of the loss function, each unit square should have values $w$ and $d$, where $w$ is the weight of this square and $d$ is the distance to the aver...
It is a polytope because it can be expressed as a system of linear inequalities. See https://en.wikipedia.org/wiki/Multi-commodity_flow_problem. In particular, let $d$ be a demand and $f$ a flow; there is a system of linear inequalities on $d,f$ that capture the condition that $f$ is a legal flow that achieves $d$. ...
{"Voters":[{"Id":147547,"DisplayName":"Soham Chatterjee"}]}
I was recently sorting a large list of names - I just ended up sorting it in Python, but it inspired in me the following question. If we're given a list $L$ of $n$ numbers, but can only see $k$ contiguous elements at a time and can shift a group of elements at once, what would be the fastest way to sort this list? I...
If $BPP = P$ (as is widely believed), then $BPP^{NP} = P^{NP}$. Since $IP = PSPACE$, $BPP^{NP} = IP$ would mean that $P^{NP} = PSPACE$, which seems unlikely (e.g. polynomial time hierarchy would collapse). Furthermore, [Sipser–Lautemann theorem][1] shows unconditionally that $BPP \subseteq NP^{NP}$, which means that $B...
Absolutely not. See you are talking about $NP-hard$ problems. $NP-hard$ problems are not necessarily in $NP$. Thats why they may not be reducible from one another. Cor example $SAT$ is $NP-hard$ as well as $HALT$. $SAT$ can be reduced to $HALT$ but the opposite is not true cause otherwise you will solve the halting pro...
- By "$T$ runs in polynomial time", I mean that $T$ halts for every input of length $n$ in at most $O(n^k)$ steps for some $k$. - By Turing-recognizable, I mean that there exists a Turing machine that halts in the accept state iff the input $w = <T> \in L$. I'm not really sure how to approach this problem. It seems...
Prove that the language L = { <T> : T is a Turing machine that runs in polynomial time } is not Turing-recognizeable
|complexity-theory|turing-machines|turing-recognizable|
- By "$T$ runs in polynomial time", I mean that $T$ halts for every input of length $n$ in at most $O(n^k)$ steps for some $k$. - By Turing-recognizable, I mean that there exists a Turing machine that halts in the accept state iff the input $w = <T> \in L$. I'm not really sure how to approach this problem. It seems...
Let L = { y = {0,1}* | y = code(M) for some Turing Machine M and M halts on no input} How can I prove whether this language recognizable or unrecognizable?
So the problem starts with a graph in which every node is connected with every node by a weighted edge. The goal is to find a weight treshold W, so that every edge that has a weight lower than or equal to W gets removed, which results in the maximum amount of connected components. A connected component is defined as at...
null
This framework can be skewed: ----------------------------------------------------- [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/KDGPO.png
The picture shows that the given framework is not a rigid framework since it can be skewed in the following manner: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/KDGPO.png
null
null
Suppose $L$ is decidable with a Turing machine $T$. Now we will show $\sim HALT\leq L$. Create a Turing machine $\mathcal{M}$ from $\langle M,x\rangle$ which on any input runs $M$ on $x$ for $|x|$ many steps. If $M$ halts within $|x|$ many steps then $\mathcal{M}$ goes on a loop and halts after $2^{|x|^c}$ many ste...
The simplest example of a non-Turing-recognizable language is the complement of $A_{\text{TM}}$, $$\overline{A_\text{TM}}=\{\langle M,w\rangle\mid M\text{ is a TM and }M\text{ does not accepts }w\}.$$ Let us reduce $\overline{A_\text{TM}}$ to $L$. ------ Given a TM $M$ and a string $w$, construct the following...
- By "$T$ runs in polynomial time", I mean that $T$ halts for every input of length $n$ in $O(n^k)$ steps for some $k$. - By Turing-recognizable, I mean that there exists a Turing machine that halts in the accept state iff the input $w = \langle T\rangle \in L$. I'm not really sure how to approach this problem. It ...
- By "$T$ runs in polynomial time", I mean that $T$ halts for every input of length $n$ in $O(n^k)$ steps for some $k$. - By Turing-recognizable, I mean that there exists a Turing machine that halts in the accept state iff the input $w = \langle T\rangle \in L$. I'm not really sure how to approach this problem. It ...
The simplest example of a non-Turing-recognizable language is the complement of $A_{\text{TM}}$, $$\overline{A_\text{TM}}=\{\langle M,w\rangle\mid M\text{ is a TM and }M\text{ does not accepts }w\}.$$ Let us reduce $\overline{A_\text{TM}}$ to $L$. ------ Given a TM $M$ and a string $w$, construct the following...
null
- By "$T$ runs in polynomial time", I mean that $T$ halts for every input of length $n$ in $O(n^k)$ steps for some $k$. - By Turing-recognizable, I mean that there exists a Turing machine that halts in the accept state iff the input $w = \langle T\rangle \in L$. I'm not really sure how to approach this problem. It ...
Say I have f(x1,x2,x3,...) where the output is either 0 for all inputs (unsatisfiable) or a variable boolean output of 0 or 1 depending on the input (satisfiable). Let's not consider functions that are always satisfiable) If I don't know whether f is satisfiable or not: Can I find a function f' (in polynomial tim...
Can you transform 3sat (or equivalent) into another satisfiability problem that increases the ratio of solutions to non-solutions
|complexity-theory|np-complete|np-hard|satisfiability|3-sat|
Given two problems, $A$ and $B$, that are NP-hard. Is either one of the following is true? 1. $A \leq_m$ B 2. $B \leq_m$ A In other words, is there always a relationship between any two arbitrary NP-hard problems? Also, I am speaking of polynomial time reductions, but I don't think specifying that will chang...
Do all NP-hard problems have a reduction from one to another (Either A $\leq_m$ B or B $\leq_m$ A)
Say I have f(x1,x2,x3,...) where the output is either 0 for all inputs (unsatisfiable) or a variable boolean output of 0 or 1 depending on the input (satisfiable). Let's not consider functions that are always satisfiable) If I don't know whether f is satisfiable or not: Can I find a function f' (in polynomial tim...
I've been trying to come up with a proper grammar for this sort of language: L = { aˣbʸaˣbʸ | x, y >= 0 } I have failed to find a way to enforce consistent generation of terminals on either part (the same amount of a's and b's on both "sides", where a side would be aˣbʸ). I've observed that this language could...
Devising a grammar for language L = { a^xb^ya^xb^y | x, y >= 0 }
|formal-languages|context-free|formal-grammars|context-sensitive|
Absolutely not. See you are talking about $NP-hard$ problems. $NP-hard$ problems are not necessarily in $NP$. Thats why they may not be reducible from one another. Cor example $SAT$ is $NP-hard$ as well as $HALT$. $SAT$ can be reduced to $HALT$ but the opposite is not true cause otherwise you will solve the halting pro...
null
If a linear program has some integer and continuous variables, then the problem is known as *Mixed-Integer Linear Program*. Moreover, if the number of integer variables are constant, then the problem can be solved in polynomial time (see Proposition 8.1 from [here][1]). Therefore, if any $L(\mathcal{A}, \mathcal{B}...
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1}
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]}
The answer is probably no. Because if this were the case we would have a polynomial time randomized solution to 3-sat (as mentioned by steven in the comments), and we haven't found that yet.
I'm trying to write a gradient ascent approach to partitioning a polygon in Euclidean 2-space (something like the below, where our polygon is a circle and we partition such that all points above the secant line in the circle are in $S_1$ and all points below the secant line within the circle are in $S_2$). [![circle...
Let $W = \{w_1, \dotsc, w_m \}$ be the set of weights (assume that all weights are different for simplicity). Without loss of generality assume that $w_1 > w_2 > \dotsc > w_m$, and the graph is connected. Note that the sorted order can be obtained in $O(m \log m)$ time. An efficient algorithm can make use of [union-...
Find a weight threshold for edges for maximum number of connected components in a graph
Turing machines do not have infinite but *unbounded* tapes. In his paper, Turing describes his machines as a model of human computers. (The word "computer" at the time mainly referred to the young people employed to process the UK census data :) He was very careful about his infinities, and he specifically said that th...
Turing machines do not have infinite but *unbounded* tapes. In his paper, Turing describes his machines as a model of human computers. (The word "computer" at the time mainly referred to the young people employed to process the UK census data :) He was very careful about his infinities, and he specifically said that th...
null
Say we have context-free grammar for function declarations and calls (C-style) START = DECLLIST CALLLIST DECLLIST = FDECL DECLLIST | FDECL CALLLIST = FCALL CALLLIST | FCALL FDECL ::= fname lbrac TARGS rbrac semicolon TARGS ::= TARGFST TARGSREM TARGFST ::= type name TARGSREM ::= co...
Context-sensitive grammar for function calls
|context-sensitive|
I'm trying to write a gradient ascent approach to partitioning a polygon in Euclidean 2-space (something like the below, where our polygon is a circle and we partition such that all points above the secant line in the circle are in $S_1$ and all points below the secant line within the circle are in $S_2$). [![circle...
With $k=1$ you can solve this in $O(n \log n)$ time using sorting networks. Pick a [sorting network](https://en.wikipedia.org/wiki/Sorting_network) of size $O(n \log n)$. You can implement each comparator using $O(1)$ steps, in your model. (To compare-and-sort the items at indices $i,j$, first cut the item at $i$ ...
(Sorry for my previous ill-posed question; I deleted it. This question is a refinement.) For every computer we use, it has finite RAM. In perspective of complexity theory, it's one giant memory that is accessible in constant time. However, Turing machines have unbounded memory, and thus cannot be represented in fini...
For random-access Turing machines, is a pointer an arbitrary-length integer?
|turing-machines|computation-models|
No, the polytime m-degrees are not linearly ordered even above SAT. We can get even stronger incomparability: there are sets which aren't even *arbitrary-time Turing-comparable*. This was proved by Kleene and Post (Friedberg and Muchnik proved an elaboration where the sets involved are also required to be c.e.).
{"Voters":[{"Id":156762,"DisplayName":"Sandra"}]}
null
Arbitrary-length integers don't require pointers. There are many ways to store an arbitrary-length string without using a pointer. Here is a simple way: encode the $n$-bit string $s_1 \cdots s_n$ as the bit-string $$1 s_1 1 s_2 \cdots 1 s_{n-1} 0 s_n.$$ This can be stored in contiguous memory. Of course, you c...
In a real compiler, normally we don't enforce this kind of rule in the grammar itself. Instead, we parse to a parse tree using a grammar that doesn't enforce this rule; and then we follow it up with a programmatic check on the parse tree to check whether it follows this rule (e.g., whether it obeys the type system, et...
I'm reading OSTEP for my Operating Systems course, and I have a question from [Chp.6.3](https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-mechanisms.pdf): >Note that there are two types of register saves/restores that happen during this protocol. The first is when the timer interrupt occurs; in this case, the user regist...
Question about Context Switching
|operating-systems|virtual-memory|process-scheduling|os-kernel|
I'm reading OSTEP for my Operating Systems course, and I have a question from [Chp.6.3](https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-mechanisms.pdf): >Note that there are two types of register saves/restores that happen during this protocol. The first is when the timer interrupt occurs; in this case, the user regist...
null
null
I was asked a question whether I could come up with a 2-CNF over several variables that has no 2-DNF representation. However I thought that any CNF can be converted to DNF through some manipulations e.g. De Morgan, distributivity, etc.
Is any 2-CNF has 2-DNF representation?
|logic|first-order-logic|propositional-logic|
How about $\phi = (x_1 \vee x_2) \wedge (x_1 \vee x_3) \wedge (x_1 \vee x_4)$? This formula is satisfied iff $x_1$ is true, or $x_2$, $x_3$, and $x_4$ are all true. Suppose that $\phi$ had a $2$-DNF representation $\phi'$ and assume (w.l.o.g.) that: - All clauses of $\phi$ contain exactly two variables (you can r...
null
How about $\phi = (x_1 \vee x_2) \wedge (x_1 \vee x_3) \wedge (x_1 \vee x_4)$? This formula is satisfied iff $x_1$ is true, or $x_2$, $x_3$, and $x_4$ are all true. Suppose that $\phi$ had a $2$-DNF representation $\phi'$ and assume (w.l.o.g.) that: - All clauses of $\phi$ contain exactly two literals (you can re...
null
What I think is meant by "kernel registers" in this context is any values that are stored in registers within the kernel itself. Note: In what follows, I'm going to talk about what happens in xv6, which is the educational operating system kernel used by this book. Most modern operating systems do something broadly s...
How about $\phi = (x_1 \vee x_2) \wedge (x_1 \vee x_3) \wedge (x_1 \vee x_4)$? This formula is satisfied iff $x_1$ is true, or $x_2$, $x_3$, and $x_4$ are all true. Suppose that $\phi$ had a $2$-DNF representation $\phi'$ and assume (w.l.o.g.) that: - All clauses of $\phi$ contain exactly two literals (you can re...
I'm in the process of designing a data structure (using only linked lists and arrays) with the following complexity requirements: -initialize 0(1) - get,delete,modify by index O(sqrt(n)) - add_last 0(sqrt(n)) In order to cover all original n elements I've decided to make a collection of lists numbered 1,2,...,√3n...
Finding correct list containing a specific i in a collection of lists
|time-complexity|data-structures|
null
null
null
The program counter holds an address. Period. The CPU fetches an instruction from that address. Period. Most CPUs today have a hardware unit called an MMU (memory management unit) which sits between the CPU and the RAM and messes with the addresses. The MMU takes the top many bits from the address and looks them up ...
null
null
I have a weakly connected digraph, and I'd like to divide it into $k$ weakly connected subgraphs. I'm not able to find exactly what I'm looking for using `networkx`, so I'm wondering if there's an easy way to do this by combining some of the existing functionality, such as: `weakly_connected_components`: https://n...
How to divide weakly connected graph into "k" weakly connected subgraphs (using e.g. networkx)?
|graphs|directed-graphs|
null
I have a list with strings like below. abc.* abc.def.* abc.xyz.* Since abc.def.* is an extension of abc.* my method should detect such strings or if I find a string that is an extension of another wildcard string the method should return false. How can I achieve this efficiently in Java ? I know I can do it ...
How to find if a string in a list is an extension of another string with wild card *
|java|
null
null