instruction stringlengths 0 29.8k ⌀ |
|---|
Testing functions written in aarch64 asm |
|assembly| |
i want to prove the reduction from $\#permanent _{-1,0,1}$ to $\#permanent _{0,1,2,3,\dots,n}$ and from $\#permanent _{0,1,2,3,\dots,n}$ to $\#permanent _{0,1}$ but i dont see how to do that |
reduction from $\#permanent _{-1,0,1}$ to $\#permanent _{0,1,2,3,\dots,n}$ |
|complexity-theory| |
I'm asked to categorize the language $L=${$a^nb^m : n\neq 7m, \ n,m\in \mathbb{N}$}, therefor I need to distinguish if it's regular, context free, or non context free (in $P$)
We know CFLs are closed under union, and I belive $L_1=${$a^nb^m : n<7m$} can be represented by the CFG $S\rightarrow Ab | aAb | aaAb | ... ... |
Unsure wether a language is context free or not |
|context-free| |
null |
I'm asked to categorize the language $L=${$a^nb^m : n\neq 7m, \ n,m\in \mathbb{N}$}, therefor I need to distinguish if it's regular, context free, or non context free (in $P$)
We know CFLs are closed under union, and I belive $L_1=${$a^nb^m : n<7m$} can be represented by the CFG $S\rightarrow Ab | aAb | aaAb | ... ... |
What proof of the completeness of resolution do you know? Chances are it can be easily adapted to this more general setting.
Alternatively, you can reduce it to plain completeness. One way is as follows. Assume a clause $C=l_1\lor\dots\lor l_k$ is implied by a CNF $F$. Then the CNF $F\land\let\ob\overline\ob{l_1}\la... |
i want to prove the reduction from $\#permanent _{-1,0,1}$ to $\#permanent _{0,1,2,3,\dots,n}$ and from $\#permanent _{0,1,2,3,\dots,n}$ to $\#permanent _{0,1}$ ( to prove that $\#permanent _{0,1}$ is$\#pcomplete$) but i dont see how to do that
?The permanent of a matrix $A=\{A_{i,j}\}$ is defined as
\begin{equat... |
null |
What's the state of the art for a durable, distributed worker queue on top of a consistent, transactional database (such as SQL)? More concretely, the problem I'm trying to investigate is the following:
- worker picks queue item
- worker starts processing
- worker dies (eg machine reboot)
How can a eg: worker... |
Papers on durable queue design with multiple distributed workers |
|queues| |
null |
An easy way prove the language context free is to use the closure properties of context-free languages.
Note that the following grammar with start variable $S$ generates $L' = \{a^nb^m : n = 7m\}$
$$S \to a^7Sb | \varepsilon.$$
Therefore
$$L_1 = a^+L' = \{a^nb^m : n > 7m, n, m \in \mathbb{N}\}$$
and
$... |
An easy way prove the language context free is to use the closure properties of context-free languages.
Note that the following grammar with start variable $S$ generates $L' = \{a^nb^m : n = 7m\}$
$$S \to a^7Sb | \varepsilon.$$
Therefore
$$L_1 = a^+L' = \{a^nb^m : n > 7m\}$$
and
$$L_2 = a^+ \setminus ... |
The naive approach is the following two steps:
1. For each point, insert it into its respective box in $O(n)$.
2. For each box, iterate every point in it to keep track of the minimum distance to the center and return the point in $O(n)$.
There is no faster algorithm as reading the inputs already takes $O(n)$. |
null |
null |
You add either 0 to 6 a's on the left and one or more b's on the right, or you add one or more a's on the left. Then you add 7 a's on the left and one b on the right zero or more times. |
Is $L=\{a^nb^m : n\neq 7m, \ n,m\in \mathbb{N}\}$ context free? |
The problem goes as follows:
Given a graph G with a set of Vertices V, each having some capacity u, and edges between them E (not fully-connected) associated with some cost c (cost to send a unit of traffic across), some nodes want to send data of some size D to someo ther node (which they may not be connected to) w... |
Optimal way to send data across an unknown network |
|graphs|distributed-systems| |
This is at least as hard as the problem of detecting a $k$-clique in a graph, given a promise that there contains at least one $k$-clique in the graph. In particular, given a graph $G$, let $S_i$ be equal to the set of vertices adjacent to vertex $i$, along with $i$.
This problem is NP-hard. If you had a polynomia... |
null |
An easy way prove the language context free is to use the closure properties of context-free languages.
Note that the following grammar with start variable $S$ generates $L' = \{a^nb^m : n = 7m\}$
$$S \to a^7Sb | \varepsilon.$$
Therefore
$$L_1 = a^+L' = \{a^nb^m : n > 7m\}$$
and
$$L_2 = a^+ \setminus ... |
No. There's no reason to believe that the human brain includes all parts of physics. In fact we're pretty sure it doesn't include many, like black hole physics and high energy particle collisions. So if black hole physics is uncomputable, that would disprove the physical Church-Turing thesis, but wouldn't prevent you f... |
How to prove that every clause that is implied by the input formula (learned or not) can be derived using resolution with weakening rule:
$\frac{C}
{C \vee D}$
(A clause $C$ is implied by $F$ if for all possible assignments $A$ it holds that $F[A]\implies C[A]$.) |
null |
null |
As part of programming a game, I'm trying to generate all the paths through an NxN matrix that touch every cell once without revisiting any, starting from (0,0). Considering the matrix as a graph, each such path in a 4x4 matrix would then contain 16 vertices and 15 edges. Each step of the path can only move 1 matrix ce... |
Find every Hamiltonian path through a 4x4 matrix starting from a given X,Y? |
|hamiltonian-path| |
As part of programming a game, I'm trying to generate all the paths through an NxN matrix that touch every cell once without revisiting any, starting from (0,0). Considering the matrix as a graph, each such path in a 4x4 matrix would then contain 16 vertices and 15 edges. Each step of the path can only move 1 matrix ce... |
I am aware of bubble sort correctness proof. But what is wrong with following argument while using induction.
Proof: Assume correctness of array size $1$ and $n$ (base and hypothesis). Then for induction step: remove one element out of $n+1$ elements array, which makes array with $n$ elements. According to hypothesi... |
Correctness proof of bubble sort(bogus proof) |
|algorithms|sorting|search-algorithms|correctness-proof| |
As part of programming a game, I'm trying to generate all the paths through an NxN matrix that touch every cell once without revisiting any, starting from (0,0). Considering the matrix as a graph, each such path in a 4x4 matrix would then contain 16 vertices and 15 edges. Each step of the path can only move 1 matrix ce... |
Firstly, note the following claim:
**Claim**: Let $S$ be any set of $n$ elements. Let $B$ be any binary tree with $n$ empty nodes. Then, there exists a mapping of $S$ to the nodes of $B$ such that $B$ is a binary search tree of set $S$.
**Proof**: The claim follows since inorder traversal of the tree can be mapp... |
Firstly, note the following claim:
**Claim**: Let $S$ be any set of $n$ elements. Let $B$ be any binary tree with $n$ empty nodes. Then, there exists a mapping of $S$ to the nodes of $B$ such that $B$ is a binary search tree of set $S$.
**Proof**: The claim follows since inorder traversal of the tree can be mapp... |
As others have pointed out, the problem is NP-hard. The best we can expect in this case is an approximation algorithm. Set-Cover is a natural choice for this. But the main hurdle here is that the subsets are not explicitly handed out to us. If we somehow have a subset of all possible stabbings, we immediately have a $O... |
null |
BubbleSort can be expressed in a few different ways, I'm assuming you're referring to something similar to [wikipedias](https://en.wikipedia.org/wiki/Bubble_sort#Pseudocode_implementation) formulation.
The mistake in your proof is that you assume that sorting an $n + 1$ element list is the same as sorting an $n$ ele... |
BubbleSort can be expressed in a few different ways, I'm assuming you're referring to something similar to [wikipedias](https://en.wikipedia.org/wiki/Bubble_sort#Pseudocode_implementation) formulation.
The mistake in your proof is that you assume that sorting an $n + 1$ element list is the same as sorting an $n$ ele... |
BubbleSort can be expressed in a few different ways, I'm assuming you're referring to something similar to [wikipedias](https://en.wikipedia.org/wiki/Bubble_sort#Pseudocode_implementation) formulation.
The mistake in your proof is that you assume that sorting an $n + 1$ element list is the same as sorting an $n$ ele... |
null |
null |
I'm trying to decide whether $L_c=${$w=uxu, | \ u,x\in \Sigma ^* \ and \ |u|=c $} for some constant $c\in \mathbb{N}$ is context free or not.
initialliy, I've thought about choosing $x=\epsilon$ which will lead to $w=uu, \ u\in \Sigma ^* $ but I've been told that since $c$ is a constant, it wont be the same langua... |
Deciding if a language is CFL or in $p$ |
|context-free|pumping-lemma| |
Deciding if a language is CFL or in $P$ |
null |
Observe that for some $c \in \mathbb{N}$, $|\Sigma^c| = |\Sigma|^c$.
Therefore
$$L_c = \bigcup_{u \in \Sigma^c} u\Sigma^*u$$
is the union of a finite number of regular languages.
So $L_c$ must be regular/context-free. |
Observe that for some $c \in \mathbb{N}$ and finite alphabet $\Sigma$, $\Sigma^c$ with $|\Sigma^c| = |\Sigma|^c$ is finite.
Therefore
$$L_c = \bigcup_{u \in \Sigma^c} u\Sigma^*u$$
is the union of a finite number of regular languages.
So $L_c$ must be regular/context-free. |
In the classic 0-1 knapsack problem, I am using the following (dynamic programming) algorithm to construct a "dp table":
```
def knapsack(weights, values, capacity, n):
n = len(weights)
weights = np.concatenate(([0], weights)) # Prepend a zero
values = np.concatenate(([0], values)) # Prepend a ze... |
Knapsack Problem: Find Top-K Lower Profit Solutions |
|algorithms|dynamic-programming|knapsack-problems|backtracking| |
As part of programming a game, I'm trying to generate all the paths through an NxN matrix that touch every cell once without revisiting any, starting from (0,0). Considering the matrix as a graph, each such path in a 4x4 matrix would then contain 16 vertices and 15 edges. Each step of the path can only move 1 matrix ce... |
null |
null |
As part of programming a game, I'm trying to generate all the paths through an NxN matrix that touch every cell once without revisiting any, starting from (0,0). Considering the matrix as a graph, each such path in a 4x4 matrix would then contain 16 vertices and 15 edges. Each step of the path can only move 1 matrix ce... |
You are given a binary pattern p. Problem is to construct a binary sequence of length n such that by sliding p over our sequence there is always at least one position where two 1s align (one in the pattern and other in our sequence).
For example let p = 101,then our sequence might be 0011001100...
if we set p = ... |
Problem of constructing binary sequence with least possible 1s under given constraint |
|graphs|combinatorics|discrete-mathematics|set-cover| |
How can we that for every 2-connected graph G with an odd number of vertices, the unsatisfiable Tseitin formula for it is minimally unsatisfiable, that is, if we remove even a single clause, it becomes satisfiable? |
Tseitin formula on 2-connected graph |
|graphs|satisfiability|propositional-logic|3-sat|connected-components| |
How can we prove that for every 2-connected graph G with an odd number of vertices, the unsatisfiable Tseitin formula for it is minimally unsatisfiable, that is, if we remove even a single clause, it becomes satisfiable? |
How can we prove that for $\\$ every $\\$ 2-connected graph G with an odd number of vertices, the unsatisfiable Tseitin formula for it is minimally unsatisfiable, that is, if we remove even a single clause, it becomes satisfiable? |
null |
null |
null |
I found an answer that works well. The basic concept is to iterate a sorted list of all 'points of interest' (start and end location of intervals). Iterating that (scan line) allows us to maintain a stack of 'active intervals' (push when interval starts; pop when interval ends) where the top one is the dominating inter... |
null |
Observe that for some $c \in \mathbb{N}$ and finite alphabet $\Sigma$, $\Sigma^c$ with $|\Sigma^c| = |\Sigma|^c$ is finite.
Therefore
$$L_c = \bigcup_{u \in \Sigma^c} u\Sigma^*u$$
is the union of a finite number of regular languages.
So $L_c$ must be regular/context-free.
---
Assume that $\Sigma$ and $c$... |
The cut and cycle properties of the minimum spanning tree are well-known. It is easy to use similar arguments to prove them. But I wonder if one property implies the other.
> Cut property: Suppose edges X are part of an MST of G=(V, E). Pick any subset of nodes S for which X does not cross between S and V-S, and le... |
Does the MST's "cut property" iimply the "cycle property"? |
|minimum-spanning-tree| |
Let $[0,100]$ denote the interval of real numbers between $0$ and $100$. Given a function $f:[0,100]^n \rightarrow \mathbb{R}^+$, I want to implement the following simple algorithm to search for the point in $[0,100]^n$ maximizing $f$:
1.- Observe the value of $f$ at $k$ random points chosen uniformly in $[0,100]^n$... |
Best internal representation of a random variable to enable iterative sampling and interpolation/regression |
|optimization|statistics|polynomials|sampling| |
null |
I'm trying to understand the proof of undecidability of the halting problem. Some resources give a short proof based on a proof by contradiction. There is no mention of diagonalization. But some others also mention diagonalization in the proof. I'm rather confused about the role of diagonalization in this proof. Is it ... |
What is the role of diagonalization in the proof of undecidability of the halting problem? |
|undecidability|halting-problem|diagonalization| |
Good ideas! Unfortunately there is no single correct answer to your question. There is a "no free lunch" theorem that says every approach will work better on some functions $f$ and worse on others. So you will need to make a choice that is based on intuition, domain knowledge, or experiments. It might depend on wha... |
Dynamic programming algorithms can often be viewed as a shortest-paths problem on a suitable dag. Then, if you only want the top-1 solution, i.e., the shortest path, you can use prev pointers to find the shortest path. If you want the top-$k$ solutions, you can use any algorithm for finding the $k$ shortest paths in ... |
As part of programming a game, I'm trying to generate all the paths through an NxN matrix that touch every cell once without revisiting any, starting from (0,0). Considering the matrix as a graph, each such path in a 4x4 matrix would then contain 16 vertices and 15 edges. Each step of the path can only move 1 matrix ce... |
Unless you found an unusual proof, they're all [refutations by contradiction](https://en.wikipedia.org/wiki/Proof_by_contradiction#Refutation_by_contradiction) (not "proofs by contradiction", although that is common parlance) and they all are a form of diagonalization because (this form) of diagonalization is a refutat... |
Unless you found an unusual proof, they're all [refutations by contradiction](https://en.wikipedia.org/wiki/Proof_by_contradiction#Refutation_by_contradiction) (not "proofs by contradiction", although that is common parlance) *and* they all are qlso a form of diagonalization: to refute the claim, we assume there were a... |
I have implemented an N-dimensional Non-Uniform Discrete Fourier Transform (in this case it's specifically an *inverse* NUDFT) using PyTorch. My goal with this implementation is to have a function which is given an N-dimensional array of values and a list of non-grid-aligned, non-uniform points to interpolate its value... |
How can I reduce the complexity of an inverse DFT where I have a uniform frequency series being evaluated at non-uniform target points? |
|time-complexity|optimization|space-complexity|fourier-transform|fast-fourier-transform| |
The cut and cycle properties of the minimum spanning tree are well-known. It is easy to use similar arguments to prove them. But I wonder if one property be derived from the other.
> Cut property: Suppose edges X are part of an MST of G=(V, E). Pick any subset of nodes S for which X does not cross between S and V-S... |
Can the MST's "cut property" be derived from the "cycle property" and vice versa? |
I have found out how to find the maximum of a "bitonic" array. The problem is as follows.
An array is bitonic if it is comprised of an increasing or decreasing sequence of integers followed immediately by a decreasing or increasing (respectively) sequence of integers. Write a program that, given a bitonic array of n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.