instruction
stringlengths
0
29.8k
⌀
Yes, $\mbox{Before}(\beta)$ and $\mbox{After}(\beta)$ are context-free languages. Here's how I would prove it. First, a lemma (which is the crux). If $L$ is CF then: $\mbox{Before}(L,\beta) = \{ \gamma \ |\ \exists \delta . \gamma \beta \delta \in L \}$ and $\mbox{After}(L,\beta) = \{ \gamma \ |\ \exists...
Let $G = (N, T, \delta, S)$ a context-free grammar. It is easy to see that $\operatorname{SF}(G)$ is context-free; construct $G'=(N',T',\delta',N_S)$ like this: * $N' = \{N_A \mid A \in N\}$ * $T' = N \cup T$ * $\delta' = \{\alpha(A) \to \alpha(\beta)\mid A\to\beta \in \delta \}$ with $\alpha(t)=t$ for all $...
Let $G = (N, T, \delta, S)$ a context-free grammar. It is easy to see that $\operatorname{SF}(G)$ is context-free; construct $G'=(N',T',\delta',N_S)$ like this: * $N' = \{N_A \mid A \in N\}$ * $T' = N \cup T$ * $\delta' = \{\alpha(A) \to \alpha(\beta)\mid A\to\beta \in \delta \}$ with $\alpha(t)=t$ for all $...
Let $G = (N, T, \delta, S)$ a context-free grammar. It is easy to see that $\operatorname{SF}(G)$ is context-free; construct $G'=(N',T',\delta',N_S)$ like this: * $N' = \{N_A \mid A \in N\}$ * $T' = N \cup T$ * $\delta' = \{\alpha(A) \to \alpha(\beta)\mid A\to\beta \in \delta \}$ with $\alpha(t)=t$ for all $...
Let $G = (N, T, \delta, S)$ a context-free grammar. It is easy to see that $\operatorname{SF}(G)$ is context-free; construct $G'=(N',T',\delta',N_S)$ like this: * $N' = \{N_A \mid A \in N\}$ * $T' = N \cup T$ * $\delta' = \{\alpha(A) \to \alpha(\beta)\mid A\to\beta \in \delta \}$ with $\alpha(t)=t$ for all $...
|algorithms|data-structures|reference-request|cpu-cache|
Let $G$ be a context-free grammar. A string of terminals and nonterminals of $G$ is said to be a *sentential form* of $G$ if you can obtain it by applying productions of $G$ zero or more times to the start symbol of $S$. Let $\operatorname{SF}(G)$ be the set of sentential forms of $G$. Let $\alpha \in \operatorname{...
|formal-languages|context-free|formal-grammars|
|algorithms|data-structures|computer-architecture|reference-request|cpu-cache|
Yes, $\mbox{Before}(\beta)$ and $\mbox{After}(\beta)$ are context-free languages. Here's how I would prove it. First, a lemma (which is the crux). If $L$ is CF then: $\mbox{Before}(L,\beta) = \{ \gamma \ |\ \exists \delta . \gamma \beta \delta \in L \}$ and $\mbox{After}(L,\beta) = \{ \gamma \ |\ \exists...
I'm trying to prove that a heap with n nodes has ceiling(n/2) leaves, but I can't figure out the right way to do it. One possibility I thought of is induction, and using the fact that a heap with even nodes has a parent with only one child. Likewise, odd-noded heaps have only leaves or full nodes. I'm not sure how I...
Proving a heap has ceiling(n/2) leaves
|binary-trees|
Yes, $\mbox{Before}(\beta)$ and $\mbox{After}(\beta)$ are context-free languages. Here's how I would prove it. First, a lemma (which is the crux). If $L$ is CF then: $\mbox{Before}(L,\beta) = \{ \gamma \ |\ \exists \delta . \gamma \beta \delta \in L \}$ and $\mbox{After}(L,\beta) = \{ \gamma \ |\ \exists...
null
Let $G = (N, T, \delta, S)$ a context-free grammar. It is easy to see that $\operatorname{SF}(G)$ is context-free; construct $G'=(N',T',\delta',N_S)$ like this: * $N' = \{N_A \mid A \in N\}$ * $T' = N \cup T$ * $\delta' = \{\alpha(A) \to \alpha(\beta)\mid A\to\beta \in \delta \} \cup \{N_A \to A \mid A\in N\}$ ...
Yes, $\mbox{Before}(\beta)$ and $\mbox{After}(\beta)$ are context-free languages. Here's how I would prove it. First, a lemma (which is the crux). If $L$ is CF then: $\mbox{Before}(L,\beta) = \{ \gamma \ |\ \exists \delta . \gamma \beta \delta \in L \}$ and $\mbox{After}(L,\beta) = \{ \gamma \ |\ \exists...
I'm trying to prove that a heap with n nodes has $\left\lceil \frac{n}{2} \right\rceil$ leaves, but I can't figure out the right way to do it. One possibility I thought of is induction, and using the fact that a heap with an even number of nodes has one with only one child. Likewise, heaps with odd size have only le...
Proving a heap has $\lceil n/2 \rceil$ leaves
|data-structures|binary-trees|
I'm trying to prove that a [heap][1] with n nodes has at most $\left\lceil \frac{n}{2} \right\rceil$ leaves, but I can't figure out the right way to do it. One possibility I thought of is induction, and using the fact that a heap with an even number of nodes has one with only one child. Likewise, heaps with odd size...
null
Proving a heap has at most $\lceil n/2 \rceil$ leaves
A [recurrence relation](http://en.wikipedia.org/wiki/Recurrence_relation) is a way to define a sequence in which later elements are computed from earlier elements. Note that a sequence can but need not consist of numbers; sequences of words, trees and all kinds of other things are equally possible. ### Examples ...
null
a definition of a sequence where later elements are expressed as a function of earlier elements.
null
Ehrenfeucht, Karhumäki and Rozenberg have shown that binary PCP (where the domain is binary) is decidable. Halava and Holub later showed that it's actually in P.
Yes, $\mbox{Before}(\beta)$ and $\mbox{After}(\beta)$ are context-free languages. Here's how I would prove it. First, a lemma (which is the crux). If $L$ is CF then: $\mbox{Before}(L,\beta) = \{ \gamma \ |\ \exists \delta . \gamma \beta \delta \in L \}$ and $\mbox{After}(L,\beta) = \{ \gamma \ |\ \exists...
|data-structures|graphs|machine-learning|
|formal-languages|computability|context-free|regular-languages|turing-machines|
|machine-learning|data-mining|evolutionary-algorithms|heuristic-algorithms|
|machine-learning|data-mining|heuristic-algorithms|evolutionary-computing|
|machine-learning|data-mining|evolutionary-computing|
|programming-languages|formal-methods|semantics|process-algebras|
|algorithms|context-free|formal-grammars|compilers|
|programming-languages|formal-methods|semantics|process-algebras|
|algorithms|data-structures|binary-trees|
|formal-languages|formal-grammars|
I'm trying to prove that a [heap][1] with n nodes has at most $\left\lceil \frac{n}{2} \right\rceil$ leaves, but I can't figure out the right way to do it. One possibility I thought of is induction, and using the fact that a heap with an even number of nodes has one with only one child. Likewise, heaps with odd size...
I am looking for some hints in a question asked by my instructor. So I just figured out this decision problem is NP-complete: In a graph G, is there a spanning tree in G that contain an exact set of S {x1, x2, ... xn) as leafs. I figured out we can prove that it is NP-complete by reducing Hamiltonian path to this...
NP complete proof
|np-hard|
I'm trying to prove that a [heap][1] with n nodes, where each node has at most 2 children, has at most $\left\lceil \frac{n}{2} \right\rceil$ leaves, but I can't figure out the right way to do it. One possibility I thought of is induction, and using the fact that a heap with an even number of nodes has one with only...
Logic gates are an abstract device which can be implemented with electromagnetic relays, vacuum tubes, or transistors. These implemenations have been successful in computing in part because of various properties of chainability, durability, and size beyond their basic binary stability. They also work well because e...
Logic gates from everyday materials
|computer-architecture|
null
I am looking for some hints in a question asked by my instructor. So I just figured out this decision problem is $\sf{NP\text{-}complete}$: In a graph $G$, is there a spanning tree in $G$ that contain an exact set of $S=\{x_1, x_2,\ldots, x_n\}$ as leafs. I figured out we can prove that it is $\sf{NP\text{-}compl...
NP completeness proof of a spanning tree problem
|complexity-theory|np-hard|
null
|computer-architecture|didactics|
I assume now that the question is the following: > Given a [full binary tree](https://en.wikipedia.org/wiki/Full_binary_tree#Types_of_binary_trees) with $n$ nodes, prove that is contains at most $\left\lceil \frac{n}{2} \right\rceil$ leaves. Let us work with the tree definition $\mathrm{Tree}= \mathrm{Leaf} \mid ...
null
I assume now that the question is the following: > Given a binary tree with $n$ nodes, prove that it contains at most $\left\lceil \frac{n}{2} \right\rceil$ leaves. Let us work with the tree definition $\mathrm{Tree}= \mathrm{Empty}\mid \mathrm{Leaf} \mid \mathrm{Node}(\mathrm{Tree},\mathrm{Tree})$. For $T$ such...
I have a homework assignment that I've been bashing my head against for some time, and I'd appreciate any hints. It is about choosing a known problem, the NP-completeness of which is proven, and constructing a reduction from that problem to the following problem I'll call DGD (directed graph diagnosis). An instance ...
Proving that directed graph diagnosis is NP-hard
|np-hard|graphs|
I'm trying to prove that a binary [heap][1] with $n$ nodes has at most $\left\lceil \frac{n}{2} \right\rceil$ leaves, but I can't figure out the right way to do it. One possibility I thought of is induction, and using the fact that a heap with an even number of nodes has one with only one child. Likewise, heaps with...
I have a homework assignment that I've been bashing my head against for some time, and I'd appreciate any hints. It is about choosing a known problem, the NP-completeness of which is proven, and constructing a reduction from that problem to the following problem I'll call DGD (directed graph diagnosis). ----- Probl...
I have a homework assignment that I've been bashing my head against for some time, and I'd appreciate any hints. It is about choosing a known problem, the NP-completeness of which is proven, and constructing a reduction from that problem to the following problem I'll call DGD (directed graph diagnosis). ###Problem##...
I have a homework assignment that I've been bashing my head against for some time, and I'd appreciate any hints. It is about choosing a known problem, the NP-completeness of which is proven, and constructing a reduction from that problem to the following problem I'll call DGD (directed graph diagnosis). ###Problem##...
Reduce from [SET-COVER](https://en.wikipedia.org/wiki/Set_cover) instead. Let $S_1,\dots,S_m \subseteq\{1,\dots,n\}$ with $k\in\mathbb{N}$ an instance of set cover. Define an instance of DGD like this: * $V= \{s_1,\dots,s_m,e_1,\dots,e_n,o\}$ * $E= \{(s_i,e_j)\mid j \in S_i\} \cup\{(e_j,o)\mid j=1,\dots,n\}$ ...
Reduce from NP-complete [SET-COVER](https://en.wikipedia.org/wiki/Set_cover) instead. Let $S_1,\dots,S_m \subseteq\{1,\dots,n\}$ with $k\in\mathbb{N}$ an instance of set cover. Define an instance of DGD like this: * $V= \{s_1,\dots,s_m,e_1,\dots,e_n,o\}$ * $E= \{(s_i,e_j)\mid j \in S_i\} \cup\{(e_j,o)\mid j=1,...
You should have a look at [automata theory][1]. There's plenty of material about it. In example, you may define a regular language with a [nondeterministic finite automaton][2] with labelled edges: a string belongs to the language if the automaton can follow the transitions labelled by its characters and stops in a ...
I'm looking for the mathematical theory which deals with describing formal languages (set of strings) in general and not just grammar hierarchies.
Is there some other way to describe a formal language other than grammars?
|grammars|
null
Are there other ways to describe formal languages other than grammars?
It is possible to build a Turing machine with "Lego" elements without any electric components, only with pneumatic transmission of energy. The guys who did this used some logic gates with pneumatic but this was the very easy part. The underlying automaton was way harder to build. ([webpage][1] in French. The other Turi...
|formal-languages|formal-grammars|
I'm looking for mathematical theories that deal with describing formal languages (set of strings) in general and not just grammar hierarchies.
Further to the above answer, one can describe and classify languages in terms of "generators" and closure properties. For example, it makes sense to talk about the smallest <a href="http://en.wikipedia.org/wiki/Abstract_family_of_languages">AFL</a> generated by some language. A good place to start learning about this t...
Reduce from NP-complete [SET-COVER](https://en.wikipedia.org/wiki/Set_cover) instead. Let $S_1,\dots,S_m \subseteq\{1,\dots,n\}$ with $k\in\mathbb{N}$ an instance of set cover. Define an instance of DGD like this: * $V= \{s_1,\dots,s_m,e_1,\dots,e_n,o\}$ * $E= \{(s_i,e_j)\mid j \in S_i\} \cup\{(e_j,o)\mid j=1,...
null
A regular formal language can be described by: 1. Regular Grammar 2. Finite Automaton (Deterministic/Nondeterministic) 3. Regular Expression 1., 2. and 3. are equivalent and from one of them you can construct the others. A context-free formal language can be described by: 1. Context-free Grammar 2....
Logic gates are an abstract device which can be implemented with electromagnetic relays, vacuum tubes, or transistors. These implemenations have been successful in computing in part because of various properties of chainability, durability, and size beyond their basic binary stability. They also work well because ele...
Reduce from NP-complete [SET-COVER](https://en.wikipedia.org/wiki/Set_cover) instead. Let $S_1,\dots,S_m \subseteq\{1,\dots,n\}$ with $k\in\mathbb{N}$ an instance of set cover. Define an instance $(V,E,k')$ of DGD like this: * $V= \{s_1,\dots,s_m,o_1,\dots,o_m,e_1,\dots,e_n,o\}$ * $E= \{(s_i,o_i) \mid i = 1,\d...
I have been reading this site with a great deal of interest, but I find a lot of it goes over my head. This has made me wish to learn a lot more about algorithms and CS in general. As far as I can tell from my research, there are 2 main ways of doing this. 1. I can by a nice thick heavy book and work my way through...
How To Best Learn About Algorithms In Depth
|algorithms|
Two books stand out for me as the way to get into algorithms: * The Algorithm Design Manual **by** Steven S. Skiena * Introduction to Algorithms **by** T Cormen, C Leiserson, R Rivest and C Stein The first is perhaps more of a hands-on manual, whereas the latter is more like the bible, but with proof. The str...
I am learning automated theorem proving by myself and looked at [Coq](http://coq.inria.fr/) and did the first chapter of the intoduction to [Isabelle](http://www.cl.cam.ac.uk/research/hvg/isabelle/). I have known Prolog for a few decades and am now learning F#, so ML, O'Caml and LISP are a bonus. Haskell is a differ...
Learning Automated Theorem Proving
|coq|
|coq|automated-theorem-proving|
I learned about algorithms in a university course years ago. But if you are to do algorithms using a book, then you need a good one. Two books stand out for me as the way to get into algorithms: * The Algorithm Design Manual **by** Steven S. Skiena * Introduction to Algorithms **by** T Cormen, C Leiserson, R Rivest...
There are plenty of possibilities. Others have already mentioned automata which offer a rich selection. Consider the following frameworks, too: 1. Some languages can be defined directly by *(co)[inductive definitions](https://en.wikipedia.org/wiki/Inductive_definition)*. For instance, the smallest fixpoint of $\...
|complexity-theory|np-hard|graphs|
In short, your guesses are correct. For the purpose of this answer, let’s call the three problems in question as follows: * Equality version: Given a graph <i>G</i> = (<i>V</i>, <i>E</i>) and a set <i>S</i>⊆<i>V</i>, decide whether <i>G</i> has a spanning tree <i>T</i> such that the set of leaves in <i>T</i> is equ...
From the [Chomsky hierarchy][1] there are four types of formal languages(each of them is a subset of the ones after it): A **regular formal language** can be described by: 1. Regular Grammar 2. Finite Automaton (Deterministic/Nondeterministic) 3. Regular Expression 1., 2. and 3. are equivalent and from o...
In short, your guesses are correct. For the purpose of this answer, let’s call the three problems in question as follows: * Equality version: Given a graph $G = (V, E)$ and a set $S \subseteq V$, decide whether $G$ has a spanning tree $T$ such that the set of leaves in $T$ is equal to $S$. As you stated, this is N...
I am learning automated theorem proving by myself and looked at [Coq](http://coq.inria.fr/) and did the first chapter of the intoduction to [Isabelle](http://www.cl.cam.ac.uk/research/hvg/isabelle/). I have known Prolog for a few decades and am now learning F#, so ML, O'Caml and LISP are a bonus. Haskell is a differ...
In short, your guesses are correct. For the purpose of this answer, let’s call the three problems in question as follows: * Equality version: Given a graph $G = (V, E)$ and a set $S \subseteq V$, decide whether $G$ has a spanning tree $T$ such that the set of leaves in $T$ is equal to $S$. As you stated, this is N...
I assume now that the question is the following: > Given a binary tree with $n$ nodes, prove that it contains at most $\left\lceil \frac{n}{2} \right\rceil$ leaves. Let us work with the tree definition $\mathrm{Tree}= \mathrm{Empty}\mid \mathrm{Leaf} \mid \mathrm{Node}(\mathrm{Tree},\mathrm{Tree})$. For $T$ such...