instruction stringlengths 0 29.8k ⌀ |
|---|
While removing null production from cfg as below,
```
S->ABC
A->aA|^
B->bB|^
C->aaC|^
```
now as shown above we know that A,B and C all are nullable that makes S also nullable.
like I did as below:
```
S->ABC|AB|AC|BC|A|B|C|^
A->aA|a
B->bB|b
C->aaC|aa
```
The question is am I co... |
Removing null production from cfg |
|context-free|formal-grammars|logic|regular-expressions|chomsky-hierarchy| |
I am trying to understand two player (prover-Merlin and verifier-Arthur) interactive proof complexity classes and had a few doubts.
As I understand, the classes $MA$ and $AM$ involve two players, where Merlin tries to convince Arthur about solution to a problem by sending messages such that if the proof is correct ... |
Explanation of classes MA and AM and AM equivalence in case of PH[2]=PSPACE? |
|complexity-theory| |
Explanation of classes MA and AM? AM equivalence in case of PH[2]=PSPACE? |
I have a desktop PC with the CPU Intel I7-12700F with **180 TDP**, the CPU fan Zalman CNPS10X extreme, and Windows 11 and my problem is that The CPU cooling causes much noise when simple tasks are being performed; opening directories or windows, opening or closing small programs such as Notepad, Calculator, web browser... |
I have the following virtual address:
+---------+----------+----------+
+ 7 Bit x | 13 Bit y | Offset d +
+---------+----------+----------+
I now have the following task:
1. Of how many pages consists the virtual address space?
2. What size has one page?
3. How much memory can be ad... |
How to calculate page number of pages and page size for multilevel paging? |
|memory-management|virtual-memory|paging| |
How can I prove that ***!(ab)*(!a+b)(!b+b)=!a*** in boolean algebra? This is an exercise from a past paper of my teacher but I can't really find the way to the answer. I would appreciate some help. |
!(ab)*(!a+b)(!b+b)=!a Boolean Algebra |
|boolean-algebra| |
Can someone please explain classes MA and AM (with an example)? What happens to AM in case of PH[2]=PSPACE? |
$$\begin{align}&a=1\to &1\,(1+b)\,1&=1,\\&a=0\to &!b\,b\,\cdots&=0.\end{align}$$ |
**!** is a negation and will be replaced by **¬** in this answer. This would transform your equation to **¬(ab)(¬a+b)(¬b+b)**. "True" has a value of 1 and "False" has a value of 0. The operations are applied on these numbers in **mod 2** arithmetic. The negation of 0 would be 1 and vice versa, so **(¬b+b)=1**. Since mu... |
How do single and multiple dispatch differ?
In particular, I am wondering why some programming languages, both interpreted and compiled (such as Python and Java), natively support single dispatch but not multiple dispatch. Possibly a bit naive to think so, but isn't multiple dispatch a straight-forward generalizatio... |
What are fundamental differences between single dispatch and multiple dispatch? |
|programming-languages|programming-paradigms| |
The third factor is always $1$. Then
$$\begin{align}&a=0\to &1\,(1+b)&=1,\\&a=1\to &!b\,b&=0.\end{align}$$ |
|reference-request|database-theory|databases|software-engineering|finite-model-theory| |
My CNF file ends with many pairs of clauses that represent that two variables are equivalent (eg: -3 7, 3 -7, 5 -11, -5 11, etc.). Do most SAT solvers automatically pre-process these and replace every occurrence of one variable by the other (eg: replace every 7 by 3, and every 11 by 5), or should I first do the replace... |
Should I remove equivalent variables in a CNF file to be used by a SAT solver? |
|satisfiability| |
Let $X_1,...X_T$ be i.i.d. random variables supported on the $[-1,1]$ segment, with an expected value of 0 and positive variance.
Let $H_t = | \sum_{i=1}^t X_i|$, and let $H = \max_{1\leq t\leq T} H_t$.
I'm interested in lower bounds on $\mathbb E[H_T]$ and $\mathbb E[H]$.
Any ideas?
_______
Using Jensen's i... |
Lower bound of continuous random walk |
|lower-bounds|random-walks| |
Let $X_1,...X_T$ be i.i.d. random variables supported on the $[-1,1]$ segment, with an expected value of 0 and positive variance.
Let $H_t = | \sum_{i=1}^t X_i|$, and let $H = \max_{1\leq t\leq T} H_t$.
I'm interested in lower bounds on $\mathbb E[H_T]$ and $\mathbb E[H]$.
Any ideas?
_______
Using Jensen's i... |
Let $X_1,...X_T$ be i.i.d. random variables supported on the $[-1,1]$ segment, with an expected value of 0 and positive variance.
Let $H_t = | \sum_{i=1}^t X_i|$, and let $H = \max_{1\leq t\leq T} H_t$.
I'm interested in lower bounds on $\mathbb E[H_T]$ and $\mathbb E[H]$.
Any ideas?
_______
Using Jensen's i... |
I came across this definition in my book but I'm not sure that I understand it correctly.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/PwnqL.png
Isn't this the same as saying: $\langle S, s\rangle \rightarrow s = \langle S, s\rangle \rightarrow s$ implies that $s=s$? Why do they us... |
Definition of "deterministic" semantics in While language |
|semantics| |
The Maximum Acyclic Subgraph (MAS) problem is:
> Given a directed graph $G = (V, E)$, find
the largest subset of edges which are acyclic.
In [this paper](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4389531) the authors state the following algorithm:
> A simple randomized algorithm achieves a fact... |
How to prove this simple randomized algorithm is 2-approximate for MAS? |
|approximation| |
Here is a [very closely related, but NOT a duplicate question.][1]
One time, I decided to test how long it takes to compute $2^x$ compared to $e^x$ in Python. I expected $2^x$ to be faster as in binary, the base computers use, you can just append 0 to the number 1 $x$ times. I entered into Python IDLE (Python's Inte... |
Why is computing $e^x$ faster than computing $2^x$? |
To prove the approximation guarantee for any algorithm, we mostly aim to find a lower bound on the optimal value (for *minimization problem*) or an upper bound on the optimal value (for *maximization problem*).
Since yours is a maximization problem, a trivial upper bound is $|E|$ for the optimal value since any sol... |
The reason is simple: `2**100` returns a bignum, with full accuracy. There is more work to handle the bignum representation than mere binary shifts. On the opposite, `e**100` returns a float and uses the built-in power function of the processor.
```python
>>> from timeit import timeit
>>> timeit('2**100')
0.20831... |
null |
It won't hurt to do that, but you probably don't need to. If you happen to know that two variables are equivalent, a much easier way to let the solver use this information is simply to assert that they are equivalent:
$$\neg x_3 \leftrightarrow x_7$$
Which becomes, in CNF:
$$\left(x_3 \vee x_7\right) \wedge \l... |
It won't hurt to do that, but you probably don't need to. If you happen to know that two variables are equivalent, a much easier way to let the solver use this information is simply to assert that they are equivalent:
$$\neg x_3 \leftrightarrow x_7$$
Which becomes, in CNF:
$$\left(x_3 \vee x_7\right) \wedge \l... |
The relationship exists. All of these were invented by Alan Turing. Alan Turing is the godfather of computer science who laid the solid foundations long before the first electronic computer has even been built. Naming these after him is giving the deserved respect for him, especially since all of these were actually in... |
The relationship exists. All of these were invented by Alan Turing. Alan Turing is the godfather of computer science who laid the solid foundations long before the first electronic computer has even been built. Naming these after him is giving the deserved respect for him, especially since all of these were actually in... |
The relationship exists. All of these were invented by Alan Turing. Alan Turing is the godfather of computer science who laid the solid foundations long before the first electronic computer has even been built. Naming these after him is giving the deserved respect for him, especially since all of these were actually in... |
null |
**!** is a negation and will be replaced by **¬** in this answer. This would transform your equation to **¬(ab)(¬a+b)(¬b+b)**. "True" has a value of 1 and "False" has a value of 0. The operations are applied on these numbers in **mod 2** arithmetic. The negation of 0 would be 1 and vice versa, so **(¬b+b)=1**. Since mu... |
TM's have no physical limitations (they are never built). Computers do.
TM's don't have a specific running time (they are never truly run). Computers die after some years.
|
TM's have no physical limitations (they are never built). Computers do.
TM's don't have a specific running time (they are never truly run). Computers die after some years.
----------
If you are thinking of a "theoretical computer" of any kind, if it is Turing-complete then it can perform the same computations. |
null |
null |
null |
If you multiply the Q1.15 format by $2^{15}$ you get a Q16.0, i.e. an integer.
Evaluate
$$0.0650\times 2^{15}=2129.92$$ which you round to $2130=100001010010_b$.
Now you revert to Q1.15 by padding to get $15$ bits after the point:
$$0.000100001010010_b$$
(this is exactly $0.06500244140625$.) |
**Seeking an indexing data structure that is smaller than quadratic in space.**
As part of an NLP algorithm using word embeddings of 300-dimensions, I am trying to improve the speed of [Word Mover's Distance](http://proceedings.mlr.press/v37/kusnerb15.pdf) (WMD). (Isn't everybody?) Computing the cost matrix is expen... |
After pondering this for days, I have arrived at a possible data structure. It may be some time before I get to testing whether it performs as well as hoped.
The index will be derived from the Hilbert Curve ordering of the points. The index construction time will be O(N-cubed).
1. Normalize and Quantize coordina... |
After pondering this for days, I have arrived at a possible data structure. It may be some time before I get to testing whether it performs as well as hoped.
The index will be derived from the Hilbert Curve ordering of the points. The index construction time will be O(N-cubed).
1. Normalize and Quantize coordina... |
At work I'm looking for a data structure that supports the following operations:
$$insert(X, A, B)$$
$$delete(X)$$
$$glb(C)$$
$insert$ adds the range $[A, B)$ into the data structure with value $X$ associated with it AND shifts all ranges after (exclusive) $A$ by $B - A$.
$delete$ removes the range associate... |
Data structure for fast look up of ranges, but that allows insertion |
|algorithms|data-structures| |
In general, the complexity of theorem proving in a particular logical system (such as ZFC) is recursively enumerable (RE), and is complete for this class -- that is, equally as hard as solving the halting problem. To see this, we can show a reduction both ways:
- First, to show that theorem proving is RE: the statem... |
While removing null production from cfg as below,
```
S->ABC
A->aA|^
B->bB|^
C->aaC|^
```
now as shown above we know that A,B and C all are nullable that makes S also nullable.
like I'd do as below:
```
S->ABC|AB|AC|BC|A|B|C|^
A->aA|a
B->bB|b
C->aaC|aa
```
The question is how do I... |
Sorry for making up a name for the thing, the main reason for posting this question is that I can't find out the name of the problem that i'm thinking about.
I was messing around with min/max DP stuff, and when looking at a knapsack problem I wondered if you could apply DP if each item affected the total value of th... |
Is there a non bruteforce apporach to solving a "synergistic knapsack"? |
|algorithms|algorithm-analysis|knapsack-problems| |
Sorry for making up a name for the thing, the main reason for posting this question is that I can't find out the name of the problem that i'm thinking about.
I was messing around with min/max DP stuff, and when looking at a knapsack problem I wondered if you could apply DP if each item affected the total value of th... |
You can achieve $O(\log n)$ time for all operations using a [self-balancing binary tree](https://en.wikipedia.org/wiki/Self-balancing_binary_search_tree). Augment the tree so that you can store a value $\delta$ in each internal node; the meaning is that we add $\delta$ to the key of all descendants of that node. So t... |
Assume that if an item A is paired with an item B to earn a discount based on synergy it may not also be paired with an item C or another B to earn an additional synergy.
1. Construct N^2/2 synthetic items formed by all pairs A+B which have value as the sum of values and weight as the sum of weights adjusted by syne... |
TLDR: Transform the problem to a standard knapsack problem, then use a standard algorithm.
Assume that if an item A is paired with an item B to earn a discount based on synergy it may not also be paired with an item C or another B to earn an additional synergy.
1. Construct N^2/2 synthetic items formed by all pai... |
TLDR: Transform the problem to a standard knapsack problem, then use a standard algorithm.
Assume that if an item A is paired with an item B to earn a discount based on synergy it may not also be paired with an item C or another B to earn an additional synergy.
1. Construct N(N+1)/2 synthetic items formed by all ... |
[![enter image description here][1]][1]
here is the original question, I built already a DFA using the states of M(the TM), well defined the transition function, and so on, I'm trying to show that L(M) = L(DFA), and having difficulties to formalize it properly.
I'm taking a word in L(M), I know that it accepte... |
Turing machine moving right |
|turing-machines| |
I'm working on implementing a puzzle board game called [Double-Choco][1] published by Nikoli magazine
Where the board is a 2-dimensional matrix with cells that are either white or gray. The goal is to divide the grid into blocks by drawing solid lines over the dotted lines. Each block must contain a pair of areas ... |
generating solvable puzzles for a Double-Choco puzzle game. efficient data structure and algorithm to be used in? |
|algorithms|graphs|data-structures|optimization|backtracking| |
null |
Suppose I have an acyclic directed graph of Nodes which subscribe to Events. When an Event callback is activated for some Node, the Node's internal update() method is called. Then, because the Node has updated(), it needs to call all of the Nodes it is pointing to and tell them to update() as well, and this process rep... |
Networks and data flow - graph algorithms for propagating updates from nodes correctly |
|algorithms|graphs|data-structures|distributed-systems|network-flow| |
null |
My objective: is to have a robot follow me. (I'm using an arduiono bot for this)
So I started off what some code that wasn't so dynamic.
Essentially I had no issues with the robot following me (holding a cardboard because these robots need a good flat surface to see) when I was right in front of it, but when it tur... |
How do I get my arduinobot to turn to the center of a moving object |
|robotics| |
null |
null |
Let $G=(V,E)$ be a Hamiltonian DAG.
Since $G$ is Hamiltonian, there exists a path $p = [v_1, \ldots, v_n]$ where $\{v_1,\ldots, v_n\}=V$. By [definition](https://en.wikipedia.org/wiki/Topological_sorting), $p$ is a topological ordering.
Note that $v_i$ must come after each of $v_1, \ldots, v_{i-1}$ in _every_ to... |
The following post discussed how to convert(approximate) NURBS curve into cubic Bézier curve:
https://cs.stackexchange.com/questions/102819/convert-nurbs-curve-into-cubic-bezier-curve
I am trying to come up with an algorithm that converts(approximates) NURBS surface into cubic Bézier surfaces(patches), here is my t... |
Convert NURBS surface into Cubic Bezier Surface |
|algorithms|graphics|topology|digital-curve| |
There is a chess tournament planned. It is a single-elimination tournament, and for spectacle purposes, only one match at a time will take place, on a table in the middle of the stage. The winner of a match will have to stand offstage if they don't play the next match. The loser will be out of any further consideration... |
Does the obvious way to seat the champion minimize the total number of times a player has to stand? |
Let $M=\left\langle Q, \Sigma, \Gamma, \delta_M, q_0, q_{a c c}, q_{r e j}\right\rangle$ be a TM whose reading head can only move to the right. Prove that $L(M) \in R E G$. For simplicity you may assume first that for all $q \in Q$ it holds that $\delta_M(q, \sqcup) \in\left\{q_{a c c}, q_{r e j}\right\} \times \Gamma ... |
I want to define a DPDA based on a set of rules:
one or more uppercase letters **('A'-'Z')** is a formula.
one or more lowercase letters **('a'-'z')** is a formula.
if **X** and **Y** are formulas, then this is a formula: **X** followed by **'&'** followed by **Y**.
if **X** is a formula, then this is a formula: ... |
Deterministic pushdown automata that checks for a specific variable in nesting levels |
|context-free|pushdown-automata| |
I've run across an interesting problem at work that I'm not quite sure how to grapple.
Broadly, there is a suite of of $n$ tests to ensure the quality of a product. However, the tests are both time-intensive and frequently run so it's necessary to tradeoff confidence for performance.
### Approach 1: knapsack
Fo... |
Modelling redundancy in tests |
|algorithms|algorithm-design|software-testing|features|boolean-complexity| |
Algorithm design: Model redundancy in tests |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.