instruction stringlengths 0 29.8k ⌀ |
|---|
|complexity-theory|np-complete| |
You should consider putting RelU after every Linear layer (except the output layer). Chaining multiple linear layers without an activation like that is equivalent to a single linear layer, but you're restricting the rank of that layer. |
null |
I am not aware of any direct-to-float PRNGs. The primary issue is that it is very difficult to get high quality random numbers using floating point operations. PRNGs typically leverage well understood integer behaviors to generate random-esque sequences with good properties.
Practically speaking, the subtractions ... |
Is every problem which can be solved by an algorithm using polynomial space in PSPACE? |
null |
Natural language is indeed ambiguous and depends a lot on semantics and specific context [[ref](https://math.stackexchange.com/a/2130413/993447)].
In English, Either/Or usually means Exclusive Or because we tend to use in the situation where two options are presented and exactly one should be True (let's say selecte... |
I understand separation logic as a form of verification method, similar to Hoare logic. That is, they allow to reason about statements of the form $\{P\} C \{Q\}$, where $C$ is an instruction, and $P$ is pre-condition, $Q$ a post-condition.
My question is: How is separation logic used in practice? Do we _manually_ ... |
How do static analysis tools automate separation logic? |
|software-verification|smt-solvers| |
We can see the following observations on the sets $D$ and $C = V\setminus D$:
Every edge in $E$ contains exactly one node in $D$
$\rightarrow$ Every edge in $E$ contains exactly one node in $C$
$\rightarrow$ Both $D$ and $C$ are vertex covers of $G$
$\rightarrow$ Both $D$ and $C$ are independent sets (the c... |
null |
As you said yourself: The definition of PSPACE is all problems that can be solved using polynomial space. Therefore, if a problem can be solved using polynomial space, then it is in PSPACE.
PSPACE is a very large class of problems, and it contains pretty much every problem you will ever come across. |
To extend the answer provided by @Arno, the problems sought by the OP are those belonging to the class of NP-intermediate problems: $N P I=N P \backslash(P \cup N P C)$. Despite the interest, we still do not know of any natural problem belonging to this class, all we have are natural candidates, e.g. graph isomorphism,... |
Yes. When IBM created its POWER processors which may have been the first ones with a fused multiply-add operation, they managed to implement the linear-congruential method using floating point, generating large numbers of random numbers in parallel at a rate of one per cycle. |
To extend the answer provided by @Arno, the problems sought by the OP are those belonging to the class of NP-intermediate problems: $N P I=N P \backslash(P \cup N P C)$. Despite the interest, we still do not know of any natural problem belonging to this class, all we have are natural candidates, e.g. graph isomorphism,... |
null |
It helps to begin by asking: What language does this NFA recognize? There are two distinct pathways, one that recognizes (10)* (including the empty string) and one that recognizes 0* (again, including the empty string).
To build a DFA for this language, it helps to try to describe what you know about the string seen... |
I was studying pumping lemma for CFL and in the proof it says that, we choose the shortest parse tree if there are multiple parse trees and we also choose $R$ the repeating variable such that it's the lowest in the tree.
It says that it satisfies **condition 2** $(|vy| \gt 0)$ & **3** $(|vxy| \leq p)$. I don't underst... |
Parse tree choices for proving the pumping lemma for CFL |
|context-free|pumping-lemma| |
This answers the problem only partially (in particular, for the minimization)
Whether or not the set $D$ exists is equivalent to the fact that $G$ is bipartite. This can be tested in polynomial time.
To see the equivalence, note that $G$ is bipartite if and only if it does not contain an odd cycle. If $G$ is bipart... |
Here's an idea, find the min-cut edge set $C$ with respect to the required $s$-$t$. Thus, all $s$-$t$ paths will have exactly one edge from this set $C$.
Now collapse all end points of the edges present in $C$ into a single vertex (but do not include the edges as they would create self-loops). It is safe to assume tha... |
null |
OP points to a particular [implementation](https://github.com/opencv/opencv/issues/17148) of the `mish` activation function for accuracy specifications, so I had to characterize this first. That implementation uses single precision (`float`), and is stable and accurate in the positive half-plane. In the negative half-p... |
Given an undirected graph $G$ and two vertices $s$ and $t$, i want to find a minimum set of edges $E$ in $G$ such that every (simple) $s$-$t$-path contains at least 2 edges from $E$.\
Is this problem solvable in polynomial time? What if the paths should not contain 2, but $r$ edges in $E$?
I know that for $r=1$, th... |
I came across this interesting problem in a test and I couldn't complete it.
There is a string given s which can consists of numbers between 0-9 and '?'. In place of '?' we can insert any of the numbers between 0 to 9. We need to find the number of ways in which it can be done so that no two adjacent numbers are sam... |
Number of ways in which a '?' in a given string can be replaced with numbers from [0-9] |
|algorithms|dynamic-programming|recursion| |
I think Maths is a very wide term these days. It could include algebra, calculus, geometry, trigonometry, statistics and so on. And generally, we refer to one or more domains when talk about any topic or concept in mathematics. Now, talking to your point whether you need a good knowledge of maths, so the answer is NO!.... |
I'm searching for equivalent problem classes from the polynomial hierarchy to function problems. I have this problem similar to traveling salesperson, which imo lies in the second order of polynomial hierarchy. However the existence of an answer can always be answered with yes due to the structure of the problem. There... |
complexity theory: polynomial hierarchy for function problems / TSP with output |
|complexity-theory|traveling-salesman|polynomial-time-hierarchy| |
Both matrices relate corresponding points in two images. The difference is that in the case of the Fundamental matrix, the points are in pixel coordinates, while in the case of the Essential matrix, the points are in "normalized image coordinates". Normalized image coordinates have the origin at the optical center of t... |
**Background**
I'm writing algorithms for generating arbitrary strings from a formal language $L \subseteq \Sigma^*$, one symbol at a time from left to right, while also ensuring that the strings do not exceed a given length $N$. My algorithm cannot fail partway and backtrack, i.e. it can't just generate a string fr... |
Efficiently generating valid strings from a deterministic CFG, one symbol at a time, subject to a length limit |
|algorithms|formal-languages|context-free|pushdown-automata|parsers| |
**Background**
I'm writing algorithms for generating arbitrary strings from a formal language $L \subseteq \Sigma^*$, one symbol at a time from left to right, while also ensuring that the strings do not exceed a given length $N$. My algorithm cannot fail partway and backtrack, i.e. it can't just generate a string fr... |
**Lemma 1.** *The general problem (with $r$ given as input) is solvable in polynomial time.*
*Proof.* 1. Fix a problem instance $(G=(V, E), s, t)$.
For brevity, define an *$r$-cut* to be any edge subset $C\subseteq E$
such that every $s$-$t$ path contains at least $r$ edges in $C$.
The goal is to find a minimum-... |
**Lemma 1.** *The general problem (with $r$ given as input) is solvable in polynomial time.*
*Proof.* 1. Fix a problem instance $(G=(V, E), s, t)$.
For brevity, define an *$r$-cut* to be any edge subset $C\subseteq E$
such that every $s$-$t$ path contains at least $r$ edges in $C$.
The goal is to find a minimum-... |
I am currently reading Michael Soltys' *Analysis of Algorithms (2nd Edition)*, and Problem 1.13 of the subsection titled *Invariance* reads:
> Let $n$ be an odd number, and suppose that we have the set $\{1,2,\dots,2n\}$. We pick any two numbers $a$, $b$ in the set, delete them from the set, and replace them with $|... |
Invariance Textbook Problem: Clarification Needed |
|algorithms|proof-techniques|induction|loop-invariants| |
{"OriginalQuestionIds":[13327],"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
null |
I think they don't mean to consider a "set" of numbers (where $\{3, 4, 5, 5\} = \{3, 4, 5\}$) but rather a list or multiset of numbers.
In that case the result is true: initially the sum of the entries of the list is $n(2n+1)$ which is odd, and at each step the parity of the sum of the entries is preserved. When you... |
I don't know if this post belongs in this site because I feel it might be a programming question, but also I feel it might be related to the way **Color Spaces** work, if it does't belong here I can change it. I would like to know how many different **HSV colors** are possible to generate using **OpenCV**. HSV colors a... |
How many different colors are possible to generate in the HSV Color Space using OpenCV? |
|combinatorics|computer-vision|python| |
The question asks to write the shortest regular expression possible to the following automaton:
[![enter image description here][1]][1]
I see only one way to tackle the problem:
Use one of the methods mentioned here https://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressi... |
Shortest regular expression possible |
|finite-automata|regular-expressions| |
I want to make a simple C program in order to measure L1, L2 and L3 latencies of my CPU. I know some info about them:
```
Caches (sum of all):
L1d: 128 KiB (4 instances)
L1i: 256 KiB (4 instances)
L2: 2 MiB (4 instances)
L3: 4 MiB... |
Measuring Cache Access Time |
|computer-architecture|cpu-cache|memory-access| |
If you try to use recursion naively, you'll attempt to solve the problem for $w a$, where $w$ is a string and $a$ is a character (the possible characters being $\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ?\}$). This will fail, since the number of possibilities for $w a$ depends not only on the number of possibilities for $w$, but... |
The existing answers provide good examples of the requested condition,
but I think there's some intuition missing.
What makes a language hard to decide is not what it contains, but the
combination of what it contains and *does not* contain. That is, it is
the "shape" of the language *boundary* that makes it hard... |
In terms of the combinators $S = λxλyλz·xz(yz)$, $K = λxλy·x$, $I = λx·x$ and $B = λxλyλz·x(yz)$ and letting $C_n$ denote the Church numerals, with $C_0 = K I$, $C_1 = I$, $C_{n+1} = S B C_n$, for $n = 1, 2, 3, ...$ (noting also that $S B (K I) = I$ under η-equivalence), something that is closer to what you're looking ... |
Reduction from Hamiltonian Path (which is just a special case of TSP anyway):
Take an unweighted graph $G$ and make into a complete weighted graph $G'$ by adding a heavy edge (say, $\ell(e) = 2n$) for every $e\not\in E(G)$, and keeping $\ell(e)=1$ for $e\in E(G)$.
For any vector $\mathbf{x}$, the subset of edges ... |
Reduction from Hamiltonian Path (which is just a special case of TSP anyway):
Take an unweighted graph $G$ and make into a complete weighted graph $G'$ by adding a heavy edge (say, $\ell(e) = 2n$) for every $e\not\in E(G)$, and keeping $\ell(e)=1$ for $e\in E(G)$.
For any vector $\mathbf{x}$, the subset of edges ... |
As other answers have pointed out, most PRNGs using floating-point computation and floating-point storage for the PRNG state simply use the floating-point unit to perform integer arithmetic, using the significand part of IEEE-754 floating-point types to store the integers. One (historical) motivation for this is that h... |
null |
The λ-abstraction takes everything to the right, as far as it can, no matter what the surrounding context. So, it takes priority.
I tried $y\ λx·x\ y$ in [Combo](https://github.com/RockBrentwood/Combo), which I put up on GitHub. I just added a "compile-only" option in it a few days ago. The expressions $(y\ λx·x)\ y... |
|regular-languages|automata|finite-automata|regular-expressions| |
The question asks to write the shortest regular expression possible to the following automaton:
[![enter image description here][1]][1]
I see only one way to tackle the problem:
Use one of the methods mentioned here https://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressi... |
To solve this question, you should not blindly apply some algorithm. Instead, start by understanding what the given automaton does. When you do this, you will see that the automaton is needlessly complicated for the language it describes - so any direct translation from automata to regular expressions will probably be ... |
Frame it as the least fixed point solution to the following system in [Kleene algebra](https://en.wikipedia.org/wiki/Kleene_algebra):
$$
A ≥ 1 + a B + b C,\quad
B ≥ 1 + a D + b E,\quad
C ≥ 1 + a D + b D,\\
D ≥ a B + b C,\quad
E ≥ a C + b B,\quad
A.
$$
where the final term ($A$) indicates the "starting expressi... |
Frame it as the least fixed point solution to the following system in [Kleene algebra](https://en.wikipedia.org/wiki/Kleene_algebra):
$$
A ≥ 1 + a B + b C,\quad
B ≥ 1 + a D + b E,\quad
C ≥ 1 + a D + b D,\\
D ≥ a B + b C,\quad
E ≥ a C + b B,\quad
A.
$$
where the final term ($A$) indicates the "starting expressi... |
The data consists of fixed text, and numbers that are multiples of 0.000001 or 0.1, converted to numbers or dates as text. So step 1 is that you multiply these numbers by 1,000,000 or 10 with an integer result.
Step 2 is recording not the numbers, but differences between consecutive number which are much smaller. A... |
Frame it as the least fixed point solution to the following system in [Kleene algebra](https://en.wikipedia.org/wiki/Kleene_algebra):
$$
A ≥ 1 + a B + b C,\quad
B ≥ 1 + a D + b E,\quad
C ≥ 1 + a D + b D,\\
D ≥ a B + b C,\quad
E ≥ a C + b B,\quad
A.
$$
where the final term ($A$) indicates the "starting expressi... |
Given an undirected graph, two vertices $s$ and $t$, and two integers $k$,$l$ - what is the complexity of finding $\ell$ edge-disjoint $s$-$t$-paths such that at least $k$ of them are pairwise internally disjoint? Being internally disjoint means that the paths are vertex disjoint except for $s$ and $t$.
I know that ... |
in my quest to understand computability theory, I came across this question, and it made me think that I don't fully understand the theory
is this language in R RE or coRE? or neither
$$ L=\{ <M>|M \ Is \ a \ TM \ that \ accepts \ all \ even \ length \ words \} $$
in terms of where intuition this language... |
is this language in R RE or coRE? or neither $$ L=\{ <M>|M \ Is \ a \ TM \ that \ accepts \ all \ even \ length \ words \} $$ |
|formal-languages|computability| |
Without going through the details of how, it might be instructive to see what the worst case looks like. That also contains the essence of the closed-form (or more accurately: "fail-safe") solution, but I digress...
A 4-state automaton with states $\{A,B,C,D\}$ and $A$ as the start state, with transitions can be wri... |
The constructions in the other answers are nice, but end up with somewhat artificial languages created by disjunction. There are also more natural languages that also do the trick:
Let $L_1$ be the set of trees that can be embedded in the 2D integer grid, such that the vertices are placed on distinct grid points and... |
Is this language in R, RE or coRE? or neither $ L=\{\langle M\rangle\mid M$ is a TM that accepts all even length words$\}$ |
In English, no distinction is made between inclusive and exclusive OR.
That is, there is no word or specific idiom that makes these distinctions.
The purpose of the word "or" in English is not as a logical operator, but to connect a series of alternatives together in a sentence.
When the system of logical oper... |
in my quest to understand computability theory, I came across this question, and it made me think that I don't fully understand the theory
is this language in R RE or coRE? or neither
$$ L=\{ <M>|M \ Is \ a \ TM \ that \ accepts \ all \ even \ length \ words \} $$
my attempt:
in terms of where intu... |
I am learning about finite automata and trying to create a machine that matches
**`{w ∈ Σ∗| w does not contain the substring 10}`**
I created a DFA where it either starts with `1` or `0`. I know it's not the most concise FA, but is it accurate?[![][1]][1]
[1]: https://i.stack.imgur.com/0KF0g.png |
A more concise Finite Automata for 10 substring? |
|regular-languages|finite-automata|regular-expressions|computation-models|substrings| |
That’s trivial. Take an NP-complete language $L$ with three symbols $a, b$, and $c$. Let $L’$ be the same language with $a, b, c$ replaced with $d, e, f$.
Now pick $L_1 = L, L_2 = (a \cup b \cup c)^*$, and $L_3 = L_2 (\epsilon \cup L’)$. |
Your automat**on** (automata is the plural word) is wrong:
- as @Knogger stated, there is no initial state
- finite automata (unless generalized) can only have one-letter transitions, so transitions $01$ are not allowed
- even if $01$ transitions are allowed, this would create $10$ as substring, since $0101$ co... |
The constructions in the other answers are nice, but end up with somewhat artificial languages created by disjunction. There are more natural languages that also do the trick:
Let $L_1$ be the set of trees that can be embedded in the 2D integer grid, such that the vertices are placed on distinct grid points and the ... |
|complexity-theory|np-complete|p-vs-np| |
I **originally** thought it was 0(01)*(01)*0 U 1(01)*(01)1 where:
- two versions: one that starts and ends with 0, the other that starts and ends with 1
- connected by plus, which does not mean union of both but either or
- repeat of (01)* to make the string even. For example, for 0010 you would
1. start with 0
... |
What is the regular language for L = {w | w has even length, and starts and ends with the same symbol}? |
|computability|regular-languages|finite-automata|context-free|regular-expressions| |
I **originally** thought it was 0(01)*(01)*0 U 1(01)*(01)1 where:
- two versions: one that starts and ends with 0, the other that starts and ends with 1
- connected by plus, which does not mean union of both but either or
- repeat of (01)* to make the string even. For example, for 0010 you would
1. start with 0
... |
Your regex is incorrect since $0011 \in (00+11+01+10)^∗(00+11)$ but $0011 \notin L$.
Assuming we only consider words over $\{0, 1\}$, the language is recognised by
$$1\big((0 + 1)(0 + 1)\big)^*1 + 0\big((0 + 1)(0 + 1)\big)^*0$$
and more generally for alphabet $\Sigma$
$$\bigcup_{c \in \Sigma} c(\Sigma\Sigma)^... |
So I am trying to draw a finite automation that has no limits on the length, but cannot have the substring of `10`
I created a DFA that could satisfy this requirement, but am uncertain about the accept states having `01` because you can use the loop to create something like (i.e. 10**10**10).
[![enter image desc... |
Draw a finite automation for {w ∈ Σ ∗ | w does not contain the substring 10} |
|computability|regular-languages|finite-automata|regular-expressions|computation-models| |
I'm learning about Turing machine program,i want to know how we write a Turing machine program about any given problem, like a string is accepted by Turing machine, program (for a Single Tape Turing Machine) that checks if a binary
number on the tape is an even number etc |
How to write a turing machine program for any given problem? |
|turing-machines|turing-recognizable| |
Is it required that your finite automaton accepts empty strings? The only requirement appears to be the non-occurrence of $10$. If so, $a$ must be an accepting state.
The idea is that whenever your finite automaton accepts a $1$, it cannot accept any more $0$s. The following DFA is my suggestion.
[![enter image d... |
Is it possible for there to exist two context-free grammars where the set of rules of the first is a proper subset of the set of rules of the second, yet the language generated by the second grammar is a proper subset of the language generated by the first?
|
Subset Relations Between CFGs and Their Languages |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.