instruction stringlengths 0 29.8k ⌀ |
|---|
null |
null |
null |
I have two questions about the validity of lambda expressions.
First, is a variable on it's own a valid lambda expression (ex: λx)
Second, take for example these two lambda expressions (λx.fxya and λz.fxya). They're identical besides the fact that the bounded variable is different. Does this affect it's validity... |
Valid Lambda Expressions |
|lambda-calculus| |
The best solution I know of is to use a SAT solver.
I don't know whether there is a better solution. I don't see any proof that an arbitrary 3SAT problem can be reduced to it. (OK, strictly speaking, this is impossible for the concrete problem you list with arrays of size 16, because that is a finite problem, and ... |
variables take one or more location in memory, depend on variables type, pointers contain address just for one memory location only. |
null |
I need to prove that the binary operator $-_\pm: \mathbb{P}^\pm\times\mathbb{P}^\pm\rightarrow\mathbb{P}^\pm$ is increasing in each of its arguments, where
$$
\mathbb{P}^\pm = \{\top_\pm, \leq0,\neq0, \geq0,<0,=0,>0,\bot_\pm\}
$$
are the abstract properties it operates on. They represent the "signs" of values... |
Abstract Interpretation: prove that the sign subtraction is increasing in each of its parameters |
|formal-methods| |
If you keep moving from node to node like that, you will end up visiting a node that was visited before. That's the point when you've entered a cycle, and the task becomes trivial.
Since the question was tagged with `dynamic-programming`, you may be interested in this alternative approach. To simplify things, let's ... |
This semester we have a class related to Operating Systems.The class itself is not obligatory but the class is done at the same time with a core class and I will simply not waste a year for 1 class so I have decided to access the resources of the Operating Systems class and study on my own.
A process is any program... |
What does the data field store? |
|process-scheduling|os-kernel| |
I do not have a good answer for you, as this is an active research area and we simply don't know any good algorithms, or indeed if there exists any, but here are some pointers.
1. The problem is NP-complete, even with 2 sets where one set has size 2 ([Van 't Hof et al.](https://www.sciencedirect.com/science/article/... |
I am trying to construct an AFA from a NFA, how do I know if a state of NFA becoms existential or universal in the AFA?
|
How to convert a NFA to alternating finite automata AFA? |
|automata|finite-automata| |
null |
Consider the following planar triangulated graph $G$. There are $n+2$ vertices: $\{x,y,u_1,\dotsc,u_n,v_1,\dotsc,v_n\}$. The edge set is $\{(x,y),(x,u_1),\dotsc,(x,u_n),(y,v_1),\dotsc,(y,v_n),(u_1,v_1),\dotsc,(u_n,v_n),(u_1,u_2),\dotsc,(u_{n-1},u_n),(v_1,v_2),\dotsc,(v_{n-1},v_n), (y,u_1),(v_1,u_2),\dotsc,(v_{n-1},u_n)... |
null |
"Data field" is not the usual term. The usual term that we use is "segment".
There are essentially five kinds of "data" that a process can use:
- *Stack*. You know what the stack is: it's memory that is implicitly or explicitly allocated by the program as calls occur. This can be a little more complex in its det... |
null |
An induced subgraph $G’$ of a graph $G$ is a subset of its vertices along with all the edges that are present in $G$ among those vertices. For $G’$ to be a tree, all vertices of a cycle in $G$ cannot be in $G’$. The tree composed of bold edges in the illustration given below shows an induced tree $T$. Vertex $u$ cannot... |
The [pumping lemma](https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages) is allowed to be used in this assignment, so I have tried to make $|0^{m+b|y|-|y|}| = |xy^b| = a!, a\ge |y|,a\ge n$ so that $gcd(|0^{m+b|y|-|y|}|,n) \neq 1$. |
How to prove that $L=\{0^m1^n\;|\; \mathbf{gcd}(m,n)=1\}$ is not regular |
I was reading a book titled "Essentials of Logic Programming.", most parts of the book are easy to understand. but now having a problem with Theme 45: incremental constructions of the minimal model. The relevant parts are shown below.
Some notations: $P$ is a definite program, $B(P)$ is the Herbrand base of $P$, $G(... |
null |
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1} |
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]} |
Consider the following planar triangulated graph $G$. There are $n+2$ vertices: $\{x,y,u_1,\dotsc,u_n,v_1,\dotsc,v_n\}$. The edge set is $\{(x,y),(x,u_1),\dotsc,(x,u_n),(y,v_1),\dotsc,(y,v_n),(u_1,v_1),\dotsc,(u_n,v_n),(u_1,u_2),\dotsc,(u_{n-1},u_n),(v_1,v_2),\dotsc,(v_{n-1},v_n), (y,u_1),(v_1,u_2),\dotsc,(v_{n-1},u_n)... |
Yes. See https://cs.stackexchange.com/q/43/755. In particular, https://cs.stackexchange.com/a/48/755 says $LL \subset LR(1)$, where $LL = \cup_k LL(k)$, hence $LL(k) \subseteq LL \subset LR(1)$ for all $k$.
See also https://cs.stackexchange.com/q/60763/755. Make sure to distinguish between a grammar vs the langua... |
This sounds like homework so I will just give a high level idea. The idea behind the pumping lemma is that regular languages are so structured that any long enough word in the language has a sub-word that you can “pump” as many times as desired without exiting the language. In your case, we want to use this to show tha... |
Consider the language L given by the regular expression (a + b ) ∗ b(a + b) over the alphabet {a, b} . The smallest
number of states needed in a deterministic finite-state automaton (DFA) accepting L is : ?
My attempt : I designed the following DFA
[![My DFA for the language][1]][1]
[1]: https://i.stack.im... |
Minimum number of states in a DFA |
|finite-automata| |
Consider the language L given by the regular expression (a + b )<sup>*b(a + b) over the alphabet {a, b} . The smallest
number of states needed in a deterministic finite-state automaton (DFA) accepting L is :
My attempt :
I designed the following DFA
[![My DFA for the language][1]][1]
[1]: https://i.sta... |
|regular-languages|finite-automata| |
I'm trying to figure out an algorithm for this specific problem.
**The problem**: I have N people (say 60 but could be far more) that I want to organize into groups of 4 on a monthly cadence.
**The constraints**:
1. Each month, groups should contain people that haven't been grouped before (until they've been... |
How can I organize groups of people, who don't know each other, on a regular cadence? |
|algorithms|combinatorics| |
Given the following theorem and definitions from *Introduction to Algorithms* 3rd edition by CLRS:
**Theorem 22.5: (Correctness of breadth-first search**)
Let $G = (V, E)$ be a directed or undirected graph, and suppose that $BFS$ is run on $G$ from a given source vertex $s \in V$. Then, during its execution, $BF... |
|algorithms|graphs|algorithm-analysis|shortest-path|check-my-answer| |
What do you call a *valid* λ-expression? This is not a standard concept.
Anyways, λ-expressions are the terms built inductively as follows:
* given a fixed set $V$ of variables, all $x \in V$ are λ-expressions,
* for any variable $x$ and λ-expression $M$, $λx.M$ is a λ-expression,
* for any λ-expressions $M$ a... |
null |
Here's one potential approach. First, partition all people who work at the company according to their team. This way, you get sets $T_1, \ldots, T_k$. Now, for every 4-tuple $(a,b,c,d)$, with $1 \leq a < b < c < d \leq k$, you can enumerate the groups $g_1, \ldots, g_m$ where the first person belongs to $T_a$, the seco... |
How to calculate the time complexity of a algorithm which contains while loops or if statements using summations? I only know how they work with the for loops. And I'm guessing the if loop are calculated as a time complexity of (1)?
```
r=1
for i=6 to n+2
do {
j=n−3
while j≥log7(n−1)
do {
... |
Time complexity summations |
|algorithms|time-complexity|asymptotics|summation| |
I have a set of points $P = \{p_1, \dots, p_m \}, \; 0 \le m \le 10^4$ on a plane of two colors (red and green). Each point has integer x-coordinate (all x-coordinates are different), and non-negative y-coordinate (y-coordinate can be non-integer). In addition, each point has a weight $w \in \mathbb{R}^+$.
I can mat... |
Matching points on a plane with maximum total weight |
|graphs|dynamic-programming|computational-geometry|linear-programming| |
null |
null |
Consider signed integers with common addition and multiplication.
Reassociation of expression is another equivalent form.
Say expressions:
a * b + a * c + c * b
a * (b + c) + c * b
a * b + c * (a + b)
Are all reassociations of each other.
Lets call optimal reassociation with one with minima... |
I have a set of points $P = \{p_1, \dots, p_m \}, \; 0 \le m \le 10^4$ on a plane of two colors (red and green). Each point has integer x-coordinate (all x-coordinates are different), and non-negative y-coordinate (y-coordinate can be non-integer). In addition, each point has a weight $w \in \mathbb{R}^+$.
I can mat... |
In case someone with real interest runs into this problem:
Start with a and b, then perform two steps. Observe how both a and b become smaller. Assume the result after two steps is a'', b'', then find a constant c < 1 so that you can guarantee a'' < c\*a, and b'' < c\*b.
With that you can easily find an upper bo... |
When a know fast primality finds that its input is not a prime, it has a proof that there must be a non-trivial factor hidden somewhere, but it doesn't have the slightest clue what that factor would be (unless a primality tester first does a quick check if its input is even. or divisible by 3, 5 or 7).
So the best ... |
null |
I understand the statement that "Curry-Howard is important to proof assistants" as simply a statement that proof assistants work by creating a proof term in a suitable dependently-typed lambda calculus. Once a proof term is created and type-checked, the proof assistant accepts the proof as valid.
So, the whole idea ... |
I think that Fenwick trees/binary indexed trees are much easier to understand *and prove* if you don't think of them as trees at all.
### Partial Sum Array
Given a subject array $A$ of length $N$, that we want to track prefix sums of, a Fenwick tree is just an array $F$ of $N+1$ partial sums, such that:
$$F_0 ... |
I think that Fenwick trees/binary indexed trees are much easier to understand *and prove* if you don't think of them as trees at all.
### Partial Sum Array
Given a subject array $A_0 ... A_{N-1}$ of length $N$, that we want to track prefix sums of, a Fenwick tree is just an array $F$ of $N+1$ partial sums, such t... |
What is the subproblem associated with this DP and what are the terms to calculate? |
Feedback Vertex Set in graphs with bounded tree width using Dynamic Programming |
|graphs|dynamic-programming| |
null |
null |
null |
I have a set of points $P = \{p_1, \dots, p_m \}, \; 0 \le m \le 10^4$ on a plane of two colors (red and green). Each point has integer x-coordinate (all x-coordinates are different), and non-negative y-coordinate (y-coordinate can be non-integer). In addition, each point has a weight $w \in \mathbb{R}^+$.
I can mat... |
There are two different methods: Method 1 is that the page table maps a logical address to a physical address. Since two processes use the same logical addresses (for totally different things), process B using the page table set up for process A would be fatal, so that page table needs to be swapped out. That's time co... |
When a know fast primality finds that its input is not a prime, it has a proof that there must be a non-trivial factor hidden somewhere, but it doesn't have the slightest clue what that factor would be (unless a primality tester first does a quick check if its input is even. or divisible by 3, 5 or 7).
So the best ... |
Yes, there are. There is an algorithm that, given any PDA $P$ and any input word $x$, directly checks whether $x$ is accepted by $P$, without first converting $P$ to a CFG. The algorithm takes running time $O(n^3)$ (treating the size of $P$ as a constant that is absorbed into the big-O notation).
The idea is that,... |
null |
Yes, there are. There is an algorithm that, given any PDA $P$ and any input word $x$, directly checks whether $x$ is accepted by $P$, without first converting $P$ to a CFG. The algorithm takes running time $O(n^3)$ (treating the size of $P$ as a constant that is absorbed into the big-O notation).
The idea is that,... |
>Your task is to count the number of ways numbers $1,2,…,n$ can be divided into two sets of equal sum. For example, if n=$7$, there are four solutions:
${1,3,4,6}$ and ${2,5,7}$,
${1,2,5,6}$ and ${3,4,7}$,
${1,2,4,7}$ and ${3,5,6}$,
${1,6,7}$ and ${2,3,4,5}$
Input
The only input line contains an integer n.
Outpu... |
CSES problem Two Sets II |
|algorithms|dynamic-programming| |
>Your task is to count the number of ways numbers $1,2,…,n$ can be divided into two sets of equal sum. For example, if n=$7$, there are four solutions:
${1,3,4,6}$ and ${2,5,7}$,
${1,2,5,6}$ and ${3,4,7}$,
${1,2,4,7}$ and ${3,5,6}$,
${1,6,7}$ and ${2,3,4,5}$
Input
The only input line contains an integer n.
Outpu... |
|np-complete|compilers|integers|polynomials| |
This can be expressed as an instance of linear programming and then solved with a LP solver. The unknowns are the weights on all possible vectors (at most $\sim m^2/2$ of them), the constraints provide linear inequalities, and the objective function to maximize is a linear function of the unknowns. |
I am wondering why is read/write operations on I/O devices much faster when we use DMA?I must be that when using DMA we have 1 less clock cycle to access the local buffer of a IO device since it is already part of the main memory.Am I correct? |
Why when we use DMA , Read/Write operations on I/O devices are faster? |
|computer-architecture|operating-systems|memory-management| |
null |
null |
Question about remainder in automata construction that checks divisibility |
Given are the coordinates of a convex polygonal area ("field"), a moving circle of radius r ("crayon") and a home location for the crayon ("home") well outside the field.
**Main goal**: Get the shortest total end-to-end path of the crayon so the crayon fills most of the area of the field, without painting at all out... |
null |
Could you please explain to me why this is so I have tried Lopital's rule but it doesn't add any clarification. |
why f(n)= n*sqrt(n) and g(n)=n^2/(logn) f(n) = o(g(n))? |
|algorithms|complexity-theory|asymptotics|big-o-notation| |
null |
I have figured this out after experimenting some time with the code. The issue was that we cannot divide dp[sum]/2 since we need modulo inverse to calculate the quotient. |
I have figured this out after experimenting some time with the code. The issue was that we cannot divide $dp[sum]/2$ since we need modulo inverse to calculate the quotient. |
$f(n) = n^{1.5}$ and $g(n) = n^2/\log n$.
Note that $\log n$ grows slower than any polynomial function.
Try to compute $$\lim_{n \to \infty} \frac{f(n)}{g(n)}$$
Which grows faster, $\log n$ or $\sqrt n$? |
I understand that in Dynamic Programming approach the subproblems are solved in a particular order from smallest to largest. In LCS how the subproblems sizes are defined and in which order it is solved. |
Dynamic Programming for LCS problem |
|dynamic-programming| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.