instruction
stringlengths
0
29.8k
⌀
|check-my-answer|minimum-cuts|directed-graphs|
Schaefer's theorem is stated in many places, e.g., [on Wikipedia](https://en.wikipedia.org/wiki/Schaefer%27s_dichotomy_theorem#Original_presentation). Can you define a set $S$ of relations so that your problem has the form specified in Schaefer's theorem? No, you cannot. Therefore, Schaefer's theorem does not apply....
How to construct DPDA for the following language $L=\{a,b\}^* \setminus a^nb^n \setminus b^na^n $ $L_1 = \{a,b\}^* \setminus a^nb^n =\{a^i b^j \, | \, i>j\}\,\cup\,\{a^i b^j\ \ | \ i<j\}\,\cup\,(a+b)^* b (a+b)^* a (a+b)^*$. At this step I got stuck. What is next? How to express additional difference $b^na^n$?...
DPDA for language $L=\{a,b\}^* \setminus a^nb^n \setminus b^na^n$
I was wondering whether the size of the minimal cut in a directed graph (digraph) is conserved under an operation of transposition. This may be trivial as I haven't been able to find anything here or on Google when searching for different variants of the query "directed graph transpose minimal cut preservation\cons...
I'm pretty beginner in Coq. I want to formalize negative and positive occurrence of an atom in a proposition inside coq the definition is as down below:<br> [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/e1BU3.png I want to define this property as an *Inductive prop* so I use it with mo...
Defining 2 inductive propositions relying on each other in Coq
|logic|proof-assistants|coq|
I was wondering whether the [transpose][1] of graph maintains the same size of the minimal cut in a directed graph (digraph). This may be trivial as I haven't been able to find anything here or on Google when searching for different variants of the query "directed graph transpose minimal cut preservation\conservatio...
Does the transpose of a digraph has the same minimal cut size as the original?
Is the min-cut size of a directed graphs transpose the same as that of the original?
null
We refactor code lots of times as developers. Metaphorically, our program space is an infinite-dimensional Rubik's cube. Things can be rearranged, preserving the code's action, so a "symmetry structure" is at play. You can do things in code that can be factored sort of like distributive law in a ring, but there are w...
What is the closest theory to "The theory of code refactoring"?
|algorithms|programming-languages|software-engineering|applied-theory|code-generation|
null
Given $L=(a+b)^*- a^nb^n-b^na^n$ which could be written as $L=(a+b)^*- (a^nb^n \cup b^na^n)=(a+b)^* \bigcap (a^nb^n \cup b^na^n)^\complement= (a+b)^* \bigcap \{(a+b)^*-(a^nb^n \cup b^na^n)\}=(a+b)^*\bigcap(\{a^mb^n | m\neq n\}\cup\{b^ma^n | m\neq n\})=\{a^mb^n | m\neq n\}\cup\{b^ma^n | m\neq n\},$ from here you...
You can use [mutually defined inductive types](https://coq.inria.fr/refman/language/core/inductive.html#mutually-defined-inductive-types), using the `with` construct. Here is the standard simple example on how to do that: ``` Inductive even : nat -> Prop := | evenO : even 0 | evenS n : odd n -> even (S n) wi...
null
Given an undirected graph $G$, how to reduce this problem :"Judge whether every edge of $G$ can be given a orientation such that for every vertex $v$ in $G$ has input-degree of at most $k$" to a max flow problem? I tried the method in this [link]( https://cs.stackexchange.com/questions/134149/) where input or output...
How to reduce $k$-oriented problem to max flow problem?
|algorithms|graphs|reductions|network-flow|
Basic code refactoring is not about symmetries but rather about *equivalences*. When code $C$ is transformed by refactoring to become code $C'$, we expect $C$ and $C'$ to "do the same thing". (This applies to simple forms of refactoring only.) There are several notions of equivalence of code, such as: * programs ...
A similar solution to the one given [here](https://cs.stackexchange.com/a/134150/107966) works here as well. Instead of reducing the problem to a max-flow problem, you can reduce the problem to the [circulation problem](https://en.wikipedia.org/wiki/Circulation_problem). The circulation problem allows you have a lower ...
A similar solution to the one given [here](https://cs.stackexchange.com/a/134150/107966) works here as well. The following is the reduction (non-highlighted statements are directly taken from [Steven's answer](https://cs.stackexchange.com/a/134150/107966)): Given $G=(V,E)$, create a directed bipartite graph $H=(V+E,...
A similar solution to the one given [here](https://cs.stackexchange.com/a/134150/107966) works here as well. The following is the reduction (non-highlighted statements are directly taken from [Steven's answer](https://cs.stackexchange.com/a/134150/107966)): Given $G=(V,E)$, create a directed bipartite graph $H=(V+E,...
null
You can use [mutually defined inductive types](https://coq.inria.fr/refman/language/core/inductive.html#mutually-defined-inductive-types), using the `with` construct. Here is the standard simple example on how to do that: ``` Inductive even : nat -> Prop := | evenO : even 0 | evenS n : odd n -> even (S n) wi...
null
|programming-languages|software-engineering|applied-theory|
What is the closest theory to "The theory of code refactoring"?
null
Recently, I have taken a Computer Science exam for the course *Operating Systems*. One question was as follows: > Which statements about real-time operating systems are true? I selected two options, but according to the exam answers, three options were correct for this question. The following option is also corre...
Worst Case Response Time (WCRT) analysis the only necessary test for real time tasks
|logic|operating-systems|scheduling|real-time|
Worst Case Response Time (WCRT) analysis the only necessary test for real time tasks?
Recently, I have taken a Computer Science exam for the course *Operating Systems*. One question was as follows: > Which statements about real-time operating systems are true? I selected two options, but according to the exam answers, three options were correct for this question. The following option is also corre...
With regards to algorithms does anyone could explain what's exactly a *free-primitive*? By chance is a *free-primitive* any kinda sorting?
With regards to algorithms what's exactly a free-primitive?
|algorithms|
Strong Exponential Time Hypothesis states that general SAT, where clauses are not limited in length, can't be solved in time $o(2^n)$. It's proven that DPLL algorithm requires $\Omega(2^n)$ time in the worst case. CDCL algorithms, however, use more sophisticated approaches to SAT solving, primarily by using partial ...
Is it an open problem if CDCL algorithms violate SETH?
|time-complexity|runtime-analysis|satisfiability|
Strong Exponential Time Hypothesis states that general SAT, where clauses are not limited in length, can't be solved in time $o(2^n)$. It's proven that DPLL algorithm requires $\Omega(2^n)$ time in the worst case. CDCL algorithms, however, use more sophisticated approaches to SAT solving, primarily by using partial ...
No, it doesn't imply that there will be $\Omega(n)$ clauses of length $\le k$. Satisfiability of 100-CNF formulas (where all clauses have exactly 100 literals) is still NP-hard, even though there are 0 clauses of length $\le 99$. Also, you have not accurately stated the [strong exponential time hypothesis](https://...
With regards to algorithms does anyone could explain what's exactly a *free-primitive*? By chance is a *free-primitive* any kinda sorting? Edit: I've read about that from book *Algorithms Illuminated Part 1: The Basics by Tim Roughgarden* page 31.
Strong Exponential Time Hypothesis states that general SAT, where clauses are not limited in length, can't be solved in time $o(2^n)$. It's proven that DPLL algorithm requires $\Omega(2^n)$ time in the worst case. CDCL algorithms, however, use more sophisticated approaches to SAT solving, primarily by using partial ...
null
Google DeepMind recently published a new paper which describes how they used a reinforcement learning to discover faster sorting algorithms. A summary of the paper is [here][1] and the paper is [here][2]. It appears the reinforcement learning model is trying to write list sorting functions in assembler which are cor...
DeepMind Alphadev: How did it use Reinforcement Learning to reduce the search space?
|machine-learning|reinforcement-learning|
null
[Wikipedia][1] shows graph width $k$ as the degeneracy, an ordering of the vertices $v_1,\ldots , v_k$ for which, if we orient each edge $(v_i, v_j)$ towards $i$ where $i<j$, the maximal degree is at most $k$. However, I recently came across another definition: > A graph $G = (V, E)$ has width $k$ if there exist...
On definitions of graph width
|graphs|trees|graph-traversal|treewidth|
Strong Exponential Time Hypothesis states that general SAT, where clauses are not limited in length, can't be solved in time $o(2^n)$. It's proven that DPLL algorithm requires $\Omega(2^n)$ time in the worst case. CDCL algorithms, however, use more sophisticated approaches to SAT solving, primarily by using partial ...
No. *Free-primitive* is not any particular algorithm. The author has himself chosen this notion to make the writing interesting. By calling an algorithm *primitive*, he mean that the algorithm is so basic that many other complex algorithms frequently use it as a subroutine. Moreover, by calling an algorithm a *free...
null
I'm trying to solve the project planning problem using DLX and exact cover matrix, but i'm struggling to find the set of constraints (columns) and the set of options (rows) to achieve this. Here is a sample that represents the main constraints of the problem. - Each project have a set of tasks (T1, T2, T3) - Each p...
Exact cover matrix for project planning
|combinatorics|
Strong Exponential Time Hypothesis states that general SAT, where clauses are not limited in length, can't be solved in time $o(2^n)$. It's proven that DPLL algorithm requires $\Omega(2^n)$ time in the worst case. CDCL algorithms, however, use more sophisticated approaches to SAT solving, primarily by using partial ...
I'm trying to solve the project planning problem using [DLX](https://en.wikipedia.org/wiki/Knuth%27s_Algorithm_X) and exact cover matrix, but I'm struggling to find the set of constraints (columns) and the set of options (rows) to achieve this. Here is a sample that represents the main constraints of the problem. - ...
null
Your problem fall under deadlock avoidance and can be solved easily by [Bankers algorithm. ](https://www-geeksforgeeks-org.cdn.ampproject.org/v/s/www.geeksforgeeks.org/deadlock-prevention/amp/?amp_gsa=1&amp_js_v=a9&usqp=mq331AQIUAKwASCAAgM%3D#amp_tf=From%20%251%24s&aoh=16889086058555&referrer=https%3A%2F%2Fwww.google.c...
|balanced-search-trees|red-black-trees|
Let $n$ be the minimum possible size of a 4-regular graph with girth $g$. Consider a graph with a minimum degree of at least four with girth $g$, can I say that the size of such graph must be at least $n$ (as each vertex has at least four neighbours, making the graph more denser than a 4-regular graph; hence, in order ...
Super graph restriction based on girth
|graphs|
No, you can't say that, unless you prove it to be true. The way to know what you can say is to try to prove it; if you can prove it, you can say it, otherwise you can't. It is possible that offering more freedom in the permissible degrees for each vertex allows constructing a smaller graph, so you can't trivially i...
**Lemma:** For all $c\ge\log_2\Big(\dfrac{1+\sqrt{5}}{2}\Big)\approx 0.692$ we have $F_n\le 2^{cn}$ for all $n\ge 0$ ___ Since $T(n-1)\ge T(n-2)$ we have, $$ T(n)=T(n-1)+T(n-2)+3\ge 2T(n-1)+3\\ T(n-1)\ge 2T(n-2)+3\\ T(n-2)\ge 2T(n-3)+3\\ \vdots $$ Therefore, \begin{align} T(n)&\ge 2T(n-1)+3\ge 2\big[2T(n-2)+...
null
How to find and return the maximum number of edge-disjoint trails of equal length $k$ of a directed weighted multi-graph $G=(V,E)$ between arbitrary start and end vertices? The start and end vertices may be different for each trail, although they need not be different. (I'd like the output to be the paths themselves,...
This is not a complete solution. But the following reduction simplifies it. The problem can be reduced to finding maximum number of edge disjoint paths of length $k$ between two vertices $s$ and $t$ in a directed graph. I am assuming that the given graph is unweighted. However, a similar reduction also works for we...
null
null
**Lemma:** For all $c\ge\log_2\Big(\dfrac{1+\sqrt{5}}{2}\Big)\approx 0.692$ we have $F_n\le 2^{cn}$ for all $n\ge 0$ ___ Since $T(n-1)\ge T(n-2)$ we have, $$ T(n)=T(n-1)+T(n-2)+3\ge 2T(n-1)+3\\ T(n-1)\ge 2T(n-2)+3\\ T(n-2)\ge 2T(n-3)+3\\ \vdots $$ Therefore, \begin{align} T(n)&\ge 2T(n-1)+3\ge 2\big[2T(n-2)+...
Given $L=(a+b)^*- a^nb^n-b^na^n$ which could be written as $L=(a+b)^*- (a^nb^n \cup b^na^n)=(a+b)^* \bigcap (a^nb^n \cup b^na^n)^\complement= (a+b)^* \bigcap \{(a+b)^*-(a^nb^n \cup b^na^n)\}=(a+b)^*\bigcap(\{a^mb^n | m\neq n\}\cup\{b^ma^n | m\neq n\}\cup a(a+b)^*a\cup b(a+b)^*b \cup a^* \cup b^*) =\{a^mb^n | m\neq n...
With regards to algorithms does anyone could explain what's exactly a *free-primitive*? By chance is a *free-primitive* any kinda sorting? I've read about that from book *Algorithms Illuminated Part 1: The Basics by Tim Roughgarden* page 31.
null
> Note: This question assumes familiarity with [cons](https://en.wikipedia.org/wiki/Cons)-style linked lists (e.g., from Lisp or Scheme). > > It also assumes familiarity with snoc-style lists. Snoc is like cons, except it appends elements to the end of the list, instead of the beginning. A cons is _car_/_cdr_ pair...
Is there an equivalent to "car" and "cdr" for "snoc"?
|terminology|linked-lists|
Given $L=(a+b)^*- a^nb^n-b^na^n$ which could be written as $L=(a+b)^*- (a^nb^n \cup b^na^n)=(a+b)^* \bigcap (a^nb^n \cup b^na^n)^\complement= (a+b)^* \bigcap \{(a+b)^*-(a^nb^n \cup b^na^n)\}=(a+b)^*\bigcap(\{a^mb^n | m\neq n\}\cup\{b^ma^n | m\neq n\}\cup a(a+b)^*a\cup b(a+b)^*b) =\{a^mb^n | m\neq n\}\cup\{b^ma^n | m...
**Lemma:** For all $c\ge\log_2\Big(\dfrac{1+\sqrt{5}}{2}\Big)\approx 0.6942$ we have $F_n\le 2^{cn}$ for all $n\ge 0$ ___ Since $T(n-1)\ge T(n-2)$ we have, $$ T(n)=T(n-1)+T(n-2)+3\ge 2T(n-1)+3\\ T(n-1)\ge 2T(n-2)+3\\ T(n-2)\ge 2T(n-3)+3\\ \vdots $$ Therefore, \begin{align} T(n)&\ge 2T(n-1)+3\ge 2\big[2T(n-2)...
Given $L=(a+b)^*- a^nb^n-b^na^n$ which could be written as $L=(a+b)^*- (a^nb^n \cup b^na^n)=(a+b)^* \bigcap (a^nb^n \cup b^na^n)^\complement= (a+b)^* \bigcap \{(a+b)^*-(a^nb^n \cup b^na^n)\}=(a+b)^*\bigcap(\{a^mb^n | m\neq n\}\cup\{b^ma^n | m\neq n\}\cup a(a+b)^*a\cup b(a+b)^*b \cup (ab)^*b \cup (ba) ^*a) =\{a^mb^n ...
null
null
Thanks in advance for assistance and patience with my hardware naivety Reading the below answer about the NMI on pin 6 for an Apple 6502, and the signal on the pin falls from high to low, how does this get recognized by the edge detector to CPU food chain? Is there "hardware polling" (each cycle check/read a bit, c...
Are edge-triggered interrupts "hardware polled"?
|cpu|
Thanks in advance for assistance and patience with my hardware naivety Reading the below answer about the NMI on pin 6 for an Apple 6502, and the signal on the pin falls from high to low, how does this get recognized by the edge detector to CPU food chain? Is there "hardware polling" (each cycle check/read a bit, c...
$$T(n)=T(n-1)+T(n-2)+a$$ is a linear recurrence with constant coefficients, and its solution is obtained as usual by combining - the general solution of the homogenous equation $$T_h(n)=T_h(n-1)+T_h(n-2),$$ which is the Fibonacci recurrence, and - a particular solution of the non-homogeneous equation, in this ...
$$T(n)=T(n-1)+T(n-2)+a$$ is a linear recurrence with constant coefficients, and its solution is obtained as usual by combining - the general solution of the homogenous equation $$T_h(n)=T_h(n-1)+T_h(n-2),$$ which is the Fibonacci recurrence, and - a particular solution of the non-homogeneous equation, in this ...
null
null
I want to find "interesting" elements in a sequence of symbols that are independent of their absolute position in that sequence. Formally, I have a window size $s \in \mathbb{N}$ and a finite alphabet $\Sigma$. I'm looking for a function $f: \Sigma^s \to \{0, \; ..., \; s\}$ that points to the first interesting pos...
Finding Shift-Invariant "Interesting" Elements In Words
|optimization|word-combinatorics|
I want to find "interesting" elements in a sequence of symbols that are independent of their absolute position in that sequence. Formally, I have a window size $s \in \mathbb{N}$ and a finite alphabet $\Sigma$. I'm looking for a function $f: \Sigma^s \to \{0, \; ..., \; s\}$ that points to the first interesting pos...