instruction stringlengths 0 29.8k ⌀ |
|---|
**Short answer:**
A positive weight is a positive number. A negative weight is a negative number. |
Is there a translation between unit/bind and fmap/join in monads?
https://stackoverflow.com/questions/34398239/with-monads-can-join-be-defined-in-terms-of-bind
gives a partial one:
> bind f m = join (fmap f m)
and
> join x = bind x id
but can we express fmap in terms of unit and bind
and unit in t... |
Translation between unit/bind and map/join in monads |
|functional-programming|monad| |
You can express `fmap` in terms of `unit` and `bind`:
fmap f xs = bind xs (\x -> unit (f x))
You cannot express `unit` in terms of `fmap` and `join`. Intuitively, both `fmap` and `join` "take" a monad as one of their arguments, which means that
neither of those functions, even in combination, give you a way... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
Let's say I have a compute workload that is so large that it has to be spread between 10 identical server nodes, each with processors, memory, storage and network interfaces, and the workload requires a lot of traffic between these nodes. Now, suppose one of these nodes is down. In that case, the intermediate data and ... |
High availability in a generic parallel workload scenario |
|parallel-computing|high-performance-computing| |
I was studying about the minimum pumping length of the language $L$ containing all palindromes over $\{a,b\}$ from [this][1] material about the pumping Lemma for CFLs.
The productions are as follows:
$$S\to aSa \ |\ bSb \ |\ a \ |\ b \ |\ \lambda$$
We have two cases to deal with,
- when the string $w\i... |
Minimum pumping length of a context free language |
|context-free|pumping-lemma|strings|substrings| |
The negative and positive refers to the sign of the number, i.e., a negative weight = negative number.
The reason why negative weights are important is because many algorithms only work when the edge weights are a non-negative.
A simple example of an algorithm is Dijkstra's Algorithm to find shortest paths in a ... |
The negative and positive refers to the sign of the number, i.e., a negative weight = negative number.
The reason why negative weights are important is because many algorithms only work when the edge weights are a non-negative.
A simple example of an algorithm is Dijkstra's Algorithm to find shortest paths in a ... |
null |
### Abstract Problem
I'm looking for a data structure that will (1) allow me to make queries of the form `A.x - B.x <= 0.1 AND A.y + B.y >= C.y + D.y` and (2) allow reasonable (let's say `O(n)` is sufficient) updates to `x` and `y`. The query is meant to be read, "in the query space there are two objects, A and B, tha... |
Data structure for arithmetic logical queries |
|algorithms|data-structures|logic|search-algorithms| |
**#Positive-2SAT** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of #Positive 2-SAT is defined as follows :
For example ,We are given a set of variables :
*... |
**#Positive-2SAT** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of #Positive 2-SAT is defined as follows :
For example ,We are given a set of variables :
*... |
Please ignore the second example in that material you are studying since it contains some errors. Please see the following corrected version of that example.
------
Let $L$ be the language consisting of all palindromes over $\{a, b\}$. The following is an unambiguous grammar for $L$.
$$S \to aSa\mid bSb\mid a\mi... |
I was studying about the minimum pumping length of the language $L$ containing all palindromes over $\{a,b\}$ from [this material][1] about the pumping Lemma for CFLs.
The productions are as follows:
$$S\to aSa \mid bSb \mid a \mid b \mid \lambda$$
We have two cases to deal with,
- when the string $w\in L... |
Minimum pumping length of a context-free language |
So, the way I understand merge sort: We split an array into two halves, then we split those halves into halves, etc. until we get arrays that can be split no further. We kind of build up a tree in the process. Then we do what I call "compare, sort, merge." Starting with the unit-length arrays, we compare the first elem... |
How does merge sort decide how to merge an array? |
|sorting| |
updated table:
[![enter image description here][2]][2]
[2]: https://i.stack.imgur.com/48ENX.png
"?" means it's an open question (unkonwn)
|
I wrote the following table for all the closures in those classes.
is anything there incorrect?
also, would appreciate help with coNP and coRE closures. couldn't find much information about it online.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/p1qVL.png
|
|complexity-theory|computability|np|closure-properties|recursively-enumerable| |
|complexity-theory|computability|np|closure-properties| |
I apologize for the simple question but I'm confused as to what is a tautology and what isn't and I haven't found a clear definition. I think that a tautology is a propositional well-defined formula which is true in all states. Does this allow T v F to be a tautology because it is true in all states and T and F are pro... |
Is T V F a tautology? |
|propositional-logic| |
**#Positive-2SAT** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of #Positive 2-SAT is defined as follows :
For example ,We are given a set of variables :
*... |
(Consider $T=true$, $F=false$)
I apologize for the simple question but I'm confused as to what is a tautology and what isn't and I haven't found a clear definition. I think that a tautology is a propositional well-defined formula which is true in all states. Does this allow T v F to be a tautology because it is true i... |
(Consider $T=true$, $F=false$)
I apologize for the simple question but I'm confused as to what is a tautology and what isn't and I haven't found a clear definition. I think that a tautology is a propositional well-defined formula which is true in all states. Does this allow $T$ v $F$ to be a tautology because it is tr... |
A tautology is something that is always true. $T\lor F$ is an almost-trivial example of one (the trivial example would be $T$ by itself).
As a bonus, a contradiction is something that is always false. The trivial example is $F$ and an almost-trivial example like the one you asked about would be $T\land F$. |
Probably the best way to think of $T$ and $F$ is that they are "constants".
If you think of arithmetic-type algebra, $x$ and $y$ are pronumerals or variables, but $0$ and $1$ are constants. $T$ and $F$ are not unlike $1$ and $0$ (respectively). They are propositions in the same way that $x$ and $y$ are numbers.
A... |
It depends on the operating system, in general. Some don't load the first code page, but let the load-on-demand system handle that!
The ABI does determine the state of the user program at the point where its entry is invoked. There may or may not be a user stack set up.
In the SysV ABI for x86-64 follow, the user... |
null |
When you address physical memory, in the kernel, is it just another value like `0xf78f9` just like virtual addresses (and the only thing that is different is that the processor is in real-mode)? Is it all contiguous (from my understanding it is a concatenation of the Physical Page Number and the Page Offset)?
How ca... |
Physical memory address space |
|operating-systems|memory-management|memory-hardware|virtual-memory|paging| |
If a machine can decide a context-sensitive language (like the language of palindromes with a non-linear center) is that fact a proof that the machine is Turing-complete?
Can this be used to prove Turing completeness of a programming language when a program that can decide a string of a context-sensitive language ca... |
Is a machine Turing-complete when it can decide a context-sensitive language? |
|formal-languages|turing-machines|formal-grammars|turing-completeness| |
If a machine can decide a context-sensitive language (like the language of palindromes with a non-linear center) is that fact a proof that the machine is Turing-complete?
Can this be used to prove Turing completeness of a programming language when a program that can decide a string of a context-sensitive language ca... |
I am not sure what you want to be confirmed in your explanation. The structure of MergeSort is a typical Divide & Conquer pattern as follows:
MergeSort(S):
if |S| == 1
Skip; // Nothing to do, S is already sorted
else
S0, S1:= Split(S); // S0 and S1 are shorter than S
Merg... |
**#Positive-2SAT** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of **#Positive 2-SAT** is defined as follows :
For example ,We are given a set of variables :
... |
I am not sure what you want to be confirmed in your explanation. The structure of MergeSort is a typical Divide & Conquer pattern as follows:
MergeSort(S):
if |S| == 1
Skip; // Nothing to do, S is already sorted
else
S0, S1:= Split(S); // S0 and S1 are shorter than S
Merg... |
I am not sure what you want to be confirmed in your explanation. The structure of MergeSort is a typical Divide & Conquer pattern as follows:
MergeSort(S):
if |S| == 1
Skip; // Nothing to do, S is already sorted
else
S0, S1:= Split(S); // S0 and S1 are two halves of S
Mer... |
The whole point of using the abstraction of virtual addresses (which is to say, giving every process the illusion that it has all the memory reserved for itself) is to free the application software from the concerns of managing the physical memory and isolate processes from each other.
The specifics involve a number... |
***#Positive-2SAT*** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of *#Positive 2-SAT* is defined as follows :
For example ,We are given a set of variables :
... |
I have an algorithmic problem that I managed to reduce to the following form:
Given a graph with $N$ elements, select exactly $K$ elements to maximize the following:
$$
\max \Sigma_{k \in K} V(S_k) + \Sigma_{k \in K} \Sigma_{j \in K} E(S_k, S_j)
$$
The unary values $V$ and binary values $E$ can be considered... |
Find maximum sum of K elements in a graph with unary and binary terms |
|algorithms|graphs| |
|algorithms|graphs|clique| |
No. Context-sensitive languages [can be recognized by linear-time nondeterministic Turing machines](https://en.wikipedia.org/wiki/Context-sensitive_language), which are not Turing complete.
The ability to recognize a recursively enumerable set also does not prove that the language is Turing-complete. For instance,... |
I have this hypothesis class:
H = {ha : R → {0, 1} | a > 0, a ∈ R, where ha(x) = 1[−a,a](x) =
{ 1, x ∈ [−a, a]
0, x ̸ ∈ [−a, a] }
I need to compute the growth function for m>= 0. So I think that this function has the VCdim=2 because you can't realize label (1, 0, 1), but I don't know how to calculate the growt... |
How to calculate the growth function of a hypothesis class? |
|machine-learning|statistics|vc-dimension| |
0∗+(1+ϵ)(0+01)∗1(0+01)* might be the answer
|
|complexity-theory|counting| |
I have a graph which grew according to a **recursive algorithm**, i.e., it started with a single vertex and then, one after another, new vertices arrived and connected to existing ones.
Now, I'm given the complete graph with, say, $n$ vertices. **I would like to determine (efficiently) which vertex was the first one... |
Finding the first vertex in a recursively growing graph |
|graphs|probability-theory| |
I have an undirected graph which grew according to a **recursive algorithm**, i.e., it started with a single vertex and then, one after another, new vertices arrived and connected to existing ones.
Now, I'm given the graph with, say, $n$ vertices. **I would like to determine (efficiently) which vertex was the first ... |
I am trying to costruct an $f$-timer for the function $f:\mathbb{N}\rightarrow\mathbb{N}: x\mapsto \lfloor cx^2\log x\rfloor$ for a proper constant $c>0$; so I need a TM that for every input of lenght $x$, the computation finished in time $cx^2\log x$. How can I approach this problem? Thanks in advance.
PS: my def... |
How to construct an f-Timer |
|complexity-theory|turing-machines| |
What is the complexity class of the problem if there exist two different interpretations that do not satisfy a given Boolean formula? I believe the problem of existence of an interpretation that does not satisfy a given Boolean formula is in P |
Complexity Class of the Problem: Existence of Unsatisfying Interpretations in Boolean Formulas |
|complexity-theory|satisfiability|polynomial-time|boolean-algebra|sat-solvers| |
null |
(ab)*(a+ε)+(ba)*(b+ε) will work. |
Suppose I have two function that always return 1 + 1:
def one_plus_one():
return 1 + 1
and Python's `eval(x)` that accepts any string as input and produce any possible output as the current computer can execute.
So, can I say that the `one_plus_one` function is a Finite Automata (or Finite State ... |
Designing functions/programs according to automaton |
|automata| |
Empty or a singleton will work. Among the strings of at least two characters, $a$ and $b$ must alternate.
Hence $$b^+(ab)^*a^+$$
|
null |
|complexity-theory|complexity-classes|counting| |
null |
I am trying to solve the single source shortest path problem, but with the added constraint that there is an additional weight on each edge (so we have two weights in total for each edge, call them p and q) and for this additional weight, we want the shortest path to be strictly monotonically increasing along the whole... |
Single Source Shortest Path Problem with Multiple Weights Each Edge |
|graphs|shortest-path|weighted-graphs|dijkstras-algorithm| |
I have read the definition of treewidth/tree-decomposition both in Wikipedia and in here:
https://medium.com/@karlrombauts/treewidth-how-all-graphs-are-trees-in-disguise-ec699b69e2fb
I'm finding something hard to understand why the treewidth of a tree is $1$. By the definition of tree-decomposition, I may select to... |
In my Computer Science graduation, I came across this concept of Belief Revision, which focus on knowledge representation and the possible operations that can be done with the facts that a "rational agent" knows.
I'd like to know what are the applications of that field in real life and some examples of software bein... |
What are the applications of Belief Revision? |
|logic|propositional-logic|theory|knowledge-representation| |
|logic|artificial-intelligence|propositional-logic|theory|knowledge-representation| |
Most lattice problems, such as the shortest vector problem, the closest vector problem, shortest basis problem, etc, are NP-hard and thus conjectured to be worst-case exponential time in the rank of the lattice.
However, suppose the rank is determined in advance, and is particularly low, like 2D and 3D. Then, the on... |
How difficult are lattice algorithms for low-dimensional lattices? |
|complexity-theory|time-complexity|np-hard|cryptography|lattices| |
Maybe not exactly what you're looking for, but the Monty Hall problem is famously counterintuitive.
There are three doors. One conceals a car, and the other two goats. You select one door. The host opens another door, and it has a goat. By changing your choice to the other closed door, you double your odds of choosi... |
You can use the following variant of the [Floyd-Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm):
Let $u$ and $v$ be any vertices in the graph. Let $E_u$ and $E_v$ be the set of edges incident on $u$ and $v$, respectively.
Then, define $S[u,v,e_u,e_v,k]$ be the shortest path of... |
You can use the following variant of the [Floyd-Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm):
Let $u$ and $v$ be any vertices in the graph. Let $E_u$ and $E_v$ be the set of edges incident on $u$ and $v$, respectively.
Then, define $S[u,v,e_u,e_v,k]$ be the shortest path of... |
***#Positive-2SAT*** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of *#Positive 2-SAT* is defined as follows :
For example ,We are given a set of variables :
... |
You can use the following variant of the [Floyd-Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm):
Let $u$ and $v$ be any vertices in the graph. Let $E_u$ and $E_v$ be the set of edges incident on $u$ and $v$, respectively.
Then, define $S[u,v,e_u,e_v,k]$ be the shortest path of... |
***#Positive-2SAT*** is the problem of counting the number of satisfying assignments to a given Positive 2-CNF formula i.e 2-CNF formulas in which each literal is a positive occurrence of a variable.
The following variant of *#Positive 2-SAT* is defined as follows :
For example ,We are given a set of variables :
... |
# Pseudonym
(Shameless repeat of previous nomination, because laziness is a virtue.)
G'day, everyone. I would like to nominate myself for moderator. Thank you in advance for considering me.
I chose this handle when I was a teenager (at some point in the 1980s) after reading Douglas Hofstadter's *Gödel, Escher,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.