instruction
stringlengths
35
11.4k
This is what is known about the halting problem and semi-decidability :- The halting problem says that for a given input x and a machine H, we can't say whether the machine H halts or not on input x. A language is said to be Semi-decidable if there exists a Turing machine which halts if a word belongs to the language (...
I'm trying to implement an Hopfield Network for pictures of 32x32 bits either 1 or -1; I have these 3 pictures and I transform each of them in a vector of 1024 elements. Then I take the 3 vectors and I build a matrix M: U = [v1 v2 v3] So I compute: M = (U*U')/1024 where M is a matrix of 1024*1024 elements and I set ...
According to wikipedia (https://en.wikipedia.org/wiki/P-complete): The most basic P-complete problem is this: given a Turing machine, an input for that machine, and a number T (written in unary), does that machine halt on that input within the first T steps? It is clear that this problem is P-complete. if T is written...
I've recently come across a following problem. In a rectangular array of ones and zeros one has to find maximum non-degenerate rectangle whose sides are filled with ones. By "maximum" i mean any rectangle with maximum possible perimeter. By "non-degenerate" i mean that all sides consist of at least two cells. We do not...
How is the 3-SAT problem reduced to solving for a system of nonlinear modular equations? I have read https://stackoverflow.com/questions/4294270/how-to-prove-that-a-problem-is-np-complete in how to prove that a problem is NP complete?. But how is this done for systems of nonlinear modular equations specifically? In t...
Suggest a data structure to perform a query $sumRange(low,high)$ which will return the sum of the elements whose key $k$ satisfies $low \le k \le high$ in $\Theta(\log n)$ time. I found the original problem here (although it's for counting) but it runs in $\Theta(n)$ time. However, I think with additional data struct...
From Wikipedia: Off-side_rule#Implementation, there is a statement: ...This requires that the lexer hold state, namely the current indentation level, and thus can detect changes in indentation when this changes, and thus the lexical grammar is not context-free – INDENT/DEDENT depend on the contextual information...
How to find a pair of indices $1\le i \le n$,$1\le j \le n$, $i\neq j$ in array $A[1..n]$ such that $0\le A[i]-A[j]\le\frac{max(A)-min(A)}{n-1}$ in $\Theta(n)$ time? max(A) is the max number in the array while min(A) is the min number. Let $avg=\frac{max(A)-min(A)}{n-1}$. If we sort the array $A$ and calculate the dif...
I am supposed to create an algorithm for this statement: “Two input lists of size n have at least one element in common” This is my algorithm: bool func(L1, L2){ val1, val2 = 0; for(int i=0; i<n; i++){ val1=L1[i]; for(int j=0; j<n; j++){ val2 = L2[j]; if(val2 = val1){ ...
I am trying to wrap my hand around the undecidability proof of the Halting problem, and to me it really seems to be more of a proof about representation than decidability. Namely, the proof that some languages are undecidable by Turing machines seems to simply state that I cannot find finite representations for arbitra...
Max-heap is called a "strong" max-heap if all the nodes at certain level are less than all the nodes at the level before them. What is the most efficient way to build such a heap from a given array? I was thinking about something similar to the regular build heap algorithm: scanning the array from right to left, compa...
Lets say i have a sequence ${6, 10, 11, 16, 17}$. Each number represents number of coins. The task is to find the minimum swaps to convert the sequence into AP Lets say common difference is $3$. To convert into AP, I'll do the following Take one coin from $10$ and give it to $11$. one from $16$ and give it to $17$. So...
By the definition of L=DLOGSPACE or of NL=NLOGSPACE (or any sublinear space class) there is an extra tape (for the Turing machine): the input tape, which is only for reading - but for arbitrary reading. The machine can read the first 10 cells and then maybe go back to read the 1st und 2nd cell. My question is: If we r...
I had an exam in algorithms. The question stated: Given $n$ points in the plane, find an algorithm that finds two centers (which can be any centers in the plane) such that the sum of the squares of the distances from the points is minimized. Prove your algorithm and analyse its complexity. As I understood this questi...
Is anyone aware of an algorithm to determine which vertices/edges would disconnect an undirected graph if removed? For all vertices/edges. Of course I could run a BFS for each vertex and for each edge to test if the remaining graph would be connected. But is there anything more efficient? In the end I would like to uni...
Assume that n is the number variables of the given 3CNF formula (n≥3) and all clauses in the given 3CNF formula are different. That means that for each clause, each literal can be either positive or negative and be one of the n variables, so the number of options for each literal is 2n, but each clause has exactly 3 li...
Given an N x M matrix. The task is to repeat the following steps K! times. Add all the elements of the matrix and get a matrix sum (S) % mod 10^9 + 7 Add S to all the elements. % mod 10^9 + 7 Repeat. What I can think of regarding the complexity it will O(K! x N x M). But K ranges from 1 to 10^5 and this is a huge num...
How do we know INVERSIONS-COUNT algorithm (exercise 14.1-7 from here), implemented in balanced tree really works? We assume that the tree data structure we're using is an order statistic tree which means that a) it's a balanced binary tree, b) each node $x$ is augmented with $size$ field which tells us the size of the ...
I have some interesting problem: Prove that following problem is in $L$ (decidable in logarythmic time). Decide if given undirected graph $G=(\{1,\ldots,n\}, E)$ such that $\forall_{i,j\in \{1,\ldots,n\}} i\le j \to \operatorname{dist}(1, i) \le \operatorname{dist}(1,j)$. Graph is represented as adjacent ma...
Finding all anagrams for a word $w$ from a set of words is a problem with many well-known solutions (for example make a hash table mapping from the bag of letters of a word to the word). But what about finding multi-word anagrams? For example "Eleven plus two" is an anagram of "Twelve plus one". In other words, given...
Question: I want to construct a optimal directory tree structure to access $n$ ($n < 256$) elements using only the keyboard with as few key presses as possible. For this one could consider the directory as double linked list with connections between the first and the last element. To access element E, one then would tr...
Inspired by this post, I thought it would be a good idea to ask an analogous question in the context of distributed systems - While most of us are familiar with the notion of Time Complexity as a measure of efficiency of algorithms, In the world of distributed systems, another important measure of efficiency plays a p...
Suppose I have a (recursive) function $f:\Bbb N\rightarrow\Bbb N$ whose range is infinite, and I want to list all the function values without repeating. That is, if $f(0)=1,f(1)=1,f(2)=5,f(3)=6,f(4)=6,f(5)=2$, I need a program with outputs $1,5,6,2$ I need it to firstly list $1$, then $5$, then $6$ and then $2$. My i...
If I were to construct a KD tree representing a sufficiently dense space, could it be used as a decision tree by querying it for the nearest neighbor to the point to classify?
In C++ a simple function like int id_int(int x){return x;} has type id_int :: int->int a class template like template<class T> class List<T>{...}; has kind List :: *->* But what is the type or kind of a function template like template<class T> T id(T x){return x;} Could it be id :: \x. x->x? Does this even make sen...
In CLRS, it works through an example going through a recurrence relation proof using the "substitution method". We have the recurrence $$T(n) = 2T(\lfloor n/2 \rfloor) + n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (4.19)$$ It claims: We guess that our solution is $T(n) = O(n \lg(n)...
Where can I find some code to generate random self-avoiding walks on 2 and 3-dimensional lattices whose side-lengths are powers of two? The walk should pass through every point on the lattice More specifically, how can I find a random hamiltonian path on a large $2^n \times 2^n$ or $2^n \times 2^n \times 2^n$ grid grap...
I was solving the 8 queen problem and tried to look through the internet for comparison solutions to see how my solutions compared to others. I found one very small bruteforce solution that confused me. And i was wondering if anyone care to explain how the diagonal comparison actually works? void solve(int n, int col, ...
Definition: A minimal 3CNF formula is an unsatisfiable 3CNF formula with minimum clauses connected by conjunctions, where each clause is disjunction of 3 literals, that is if any of it's clauses is removed from the formula, then the 3CNF formula becomes satisfiable. For some natural number n, where n is the number of a...
How do you formally invalidate a question about the decidability of a partial halting problem solver that answers correctly with the following kind of input: Turing machines that don't use the partial halting problem solver inside? I made this question and it was marked as unclear. I deleted it. This is my question: "L...
Comparative studies of tools like AProver, 2LS
I know and admit that this is long, but please read it slow and understand everything. I think that this is one of the most interesting questions asked in computer science ever. I don't expect for quick answers. Take your time to read slowly and to understand everything. I can wait. I don't rush. In 1SAT, the turing ma...
Prove: $P\ne BPP$ implies $P\ne NP$. Obviously $P\subseteq BPP$ so the assumption is really $BPP\subsetneq P$. I'm trying to show the implication by contradiction. Let's assume that $P=NP$ and let's look at some language $L\in BPP$. Then, it has a proper probabilistic TM which decides it. At first, I thought that I ...
Given the following page table with a 24 Bit virtual address and 4KB page size and 4 byte long entries (%X means hexadecimal values): I don't understand how to translate e.g. address %X00ABBA here. I really tried but I don't understand. I know I have 12 bits for the VPN, so I take 00A and look it up in the page table....
Where $n + 1 = 0$ and $0 - 1 = n$? The $n + 1 = 0$ case can be achieved by using the modulus operator, but I can't figure out how to treat the $0 - 1 = n$ case.
I'm a new user so I cannot respond directly to this post here. I'm confused about the answers to the question, namely that MAX-2-XOR-SAT is in $P$ iff each clause is of the form $(x_i \oplus \neg x_j)$ (or is it $(x_i \oplus x_j)$? There were two different answers). Couldn't you make a simple substitution $\neg x_i \r...
I understand from the Wikipedia page on the Busy Beaver problem that the Busy Beaver values for 5-state 2-symbol (quintuple) Turing-machines have not been determined, because there are 'holdout' machines whose halting behavior is as of yet unknown. Can someone provide me with a concrete example of such a 5-state 2-symb...
The title says it all, I think. We know there are universal Turing-machines that only use a binary alphabet. But who proved this first? Turing himself showed the existence of a universal Turing machine ... but did he also show that such a machine can exist using only a binary alphabet? Or was that someone else? Or was...
I have trouble understanding Syntax directed translation/definition/actions. I am reading dragon book but it confuses me even more. Having production for simple arithmetic $$ \mathit{expr} \rightarrow \mathit{expr} + \mathit{expr} \mathbin{|} \mathit{expr} - \mathit{expr} \mathbin{|} \mathit{num} $$ $$ \mathit{nu...
I am new to understanding computer science algorithms. I understand the process of the binary search, but I am having a slight misunderstanding with its efficiency. In a size of $s = 2^n$ elements, it would take, on average, $n$ steps to find a particular element. Taking the base 2 logarithm of both sides yields $\log_...
The description of this game is already exists in this link I am quoting from this link the description of the game to ease the reading of this question: In a game, where there are m active bombs, each one with a number above zero, and n standing levers, where each can be either pushed forward or pulled backward, and ...
LTL works with Boolean propositions. People probably studied extensions to non-Boolean propositions... Do you know a good starting reference? (I am aware of STL, but it also seems to talk about clocks, is there a variant without clocks?) Update: the question is not about "true, false, maybe" but rather about LTL where ...
I am curious about an image processing algorithm used in this code pulled from this github repo. I have posted an explanation of the code below. import numpy as np import cv2 import sys def calc_sloop_change(histo, mode, tolerance): sloop = 0 for i in range(0, len(histo)): if histo[i] > max(1, toleran...
so hey, I've been recently reading about the Two-Pointer algorithm that allows us to find pairs $(i,j)$ such that $a[i] + a[j] = x$ in $O(m+n)$ instead of the trivial $O(mn)$ time. I was wondering how can I find the number of pairs $(i,j)$ in time less than $O(mn)$. I was trying to use Two-Pointer but it seems that it...
Let $L$ to be the following problem: $$L = \{ \langle M,x,1^t \rangle \mid \text{$M$ accepts $x$ after $t$ steps with probability at least $3/4$} \}.$$ Show that if $L\in BPP$ then $NP\subseteq BPP$. I already showed that $L$ is $BPP$-hard. I think a reduction from $3SAT$ to $L$ need to be shown (logarithmic/poly...
An algorithm has a calculation whose worst case time complexity $T(x)=O(x^2)$ that outputs solutions $y$ & $z$ for input $x$ (the algorithm's worst case time complexity is greater than quadratic time): for (i = 1; i <= x; i++) { for (j = 1; j <= i; j++) { // Some quadratic time calculation of...
Recently, I encountered terminologies such as primitive recursion and recursion combinator. One of the sources is here link I googled and read some, but missing the points of them. I know that recursion occurs when a function appears within its definition. While $\lambda$-calculus cannot express such recursive definit...
I'm working on a problem that is very similar to the bin packing problem, but for me, the objective is to minimize the maximum weight given m bins. The problem statement is: Given n items, each with a certain weight less than some maximum weight (w_max), how do you pack them into m bins so that you minimize the maximum...
After reviewing the Bellman-Ford algorithm I can see that it runs with time complexity of $O(n^2)$ or, more exactly, $O(VE)$. It is necessary to loop (V-1) times the number of edges which is in fact 2 nested loops. This is true even if it includes the detection of negative cycles because this task only needs a last loo...
Consider the well-known language: $$L = \{\langle M,x,1^t \rangle \ \ |\ \text{$M$ accepts $x$ after $t$ steps}\}$$ I've encountered some technical problem while trying to show a logarithmic reduction from some $L'\in P$ (which will show completeness of $L$) Basically, the reduction is: $$f(x) = \langle M_{L'},x,n^c\ra...
Let $X = \{x_1, ... , x_k\}$ and $Y = \{y_1, ... , y_h\}$. A subset $S \subset X \times Y$ is a correspondence if : $\forall x, \exists y, (x,y) \in S$ and $\forall y, \exists x, (x,y) \in S$ That is to say, $S$ fully projects onto $X$ and $Y$. Now for the problem. Given an $n \times m$ matrix of subsets $(S_{i,j})$...
Two computing models can be shown to be co complete if each can encode a universal simulator for the other. Two logics can be shown to be co complete if an encoding of the rules of inferences (and maybe axioms if present) of each be shown to be theorems of the other. In computability this has led to a natural idea of...
I stumbled upon these two defintions of a turing machine: http://www.cs.um.edu.mt/gordon.pace/Teaching/Complexity/CoursePage/Notes/chapter5.pdf http://scholar.harvard.edu/files/harrylewis/files/s6_sols.pdf The difference which bothers me is that the second one allows only left and right movements whereas the first allo...
I transformed the MNIST dataset as follows:(X (70000 x 784) is the training matrix) np.random.seed(42) def transform_X(): for i in range(len(X[:,1])): np.random.shuffle(X[i,:]) I had thought that shuffling the pixels in an image would make the digits unrecognizable by humans,but the machine learning algori...
I stumbled upon the following post while learning about turing machines: Right moving turing machine I kind of understand the intuition behind why a TM that only moves to the right works like a FSA but I can't think of a general way to create a let's say DFA (or NFA, doesn't really matter) which accepts the same langua...
I would like to estimate complexity in space and time of generating every combination of every size for a given sequence. Exemple : seq = [1,2,3] combinations = [{1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}] From what i know, for a given sequence of size n and a fixed combination size k, the number of combination gen...
I'm trying to solve the problem for finding majority element of given array. I made two attempts to solve the problem, but seems that both have something wrong in them. First one relies on the logic that : 1) If $A$ is array with $n$ elements then $A$ has majority element $\Leftrightarrow A_{1} = A[1,...,\frac{n}{2}],...
Problem statement: Given an array of N integers, find its number of negative subarrays (i.e sub arrays having negative summation). E.g: for an array $[1,-2, 4, -5, 1]$ there are 9 subarrays whose sum is negative. Subarray means sequential array within an array. My code: It's complexity is $\theta(n^{2})$ as we can see....
My understanding is that "page replacement" entails replacing the contents of a frame to bring in a new frame in it's place corresponding to a new page. Since it is not the page, but the frame that changes, shouldn't this process be called "frame replacement"?
Given a set of $n$ points $P$ and a set of $n$ points $Q$ in 3 dimensional space, what's the fastest algorithm to uniquely pair points in $P$ with points in $Q$ so that the sum of the square of the distance between points in $P$ and their corresponding point in $Q$ is minimized? Each point in $P$ must be matched with o...
I'm trying to represent a directed acyclic graph using a structure similar to an adjacency list. The difference is, for a given vertex v, I need to know precisely which nodes are inwardly adjacent to v, and which nodes are outwardly adjacent to v. To get around this, my idea was to use a list of pairs, where each pair ...
From the link below I understand the behaviour of different kinds of registers. However that raises few more queries in my mind. https://stackoverflow.com/questions/8871633/whats-the-difference-between-safe-regular-and-atomic-registers What is behaviour of Regular registers when there are overlapping writes? Why do we...
Every example of a total, computable but non-primitive recursive function seems to be explicitly constructed for proof theory, or in Godelian proofs of "what is the name of this book?" kind. But is there a non-primitive recursive function or algorithm that occurs naturally, like in physics or number theory or even in i...
The algorithm works as follows: For each clause, the algorithm turns the middle disjunction into conjunction, i.e. if an arbitrary clause is of the form: (l1 ∨ l2) ∨ (l3 ∨ l4) Then after turning the middle disjunction into conjunction the 4CNF clause becomes conjunction of two 2CNF clauses: (l1 ∨ l2) ∧ (l3 ∨ l4) After ...
I propose a simple polynomial algorithm for the following problem. Given $m$ integers each one stored on $n$ bits, output the integer that appears the most often. Reserve a memory area with $2^n$ slots/registers/locations/cells, each cell being long enough to store the number $m$. This requires constant time because w...
Given a set of elements $N$, a set $S$ of subsets of $N$, and a function $v:S \to \mathbb R$, determine a set $R\subseteq S$ of non-overlapping subsets that maximizes the total value. Has this problem already been studied somewhere, or is it linked to some well-known optimization problem?
Given a weighted directed acyclic graph (DAG), I need to find all maximum weighted paths between the start node(s), i.e. zero incoming edges, and the end node(s), i.e. zero outgoing edges. My current approach is doing the followings. Add an extra node $S$ (source) and put directed edges to all starting nodes with zero...
If someone compiled a program with all optimization settings enabled, would it be possible to create source code that, if it was compiled with all optimizations disabled, produced an identical binary? We'll assume that inline assembly and similar features are not used. If this is not always possible, (and I suspect it ...
if i have an equation like $$f_n = x + y + z + a + b$$ and each variable has a discrete answer like $a = 0, 1 , 3$ . $b = 2 ,4,5$ etc. i want to find the global optimum minimization point. I used Ant colony optimization (ACO) to solve the equation but i am stuck in the heuristic information and how to comp...
I've seen a numerous interesting abstract machines (i.e. CESK) and evaluators (diverse meta-circular S-expression evaluators, i.e. vau, COLA) and other models (concatenative, SK/Lambda calculus) which implement some novel(?) computational ideas, but almost every time each model boils down to: Executing a stream of pr...
I'm studying for my theory of computation exam and came accross the following question: Construct an appropriate Turing machine for the following language and prove or disprove it's semi-decidability: $A := \{w \in \{0, 1\}^*\ |\ \exists x \in \{0, 1\}^* .f_w(x) = |x| \}$ The way I interpret this is that $A$ consists...
I have implemented my own CSP solver using a Backtracking algorithm. Within the Backtracking algorithm I apply a Forward Checking algorithm (reducing domains of connected, unnasigned variables) that only works with Binary constraints. The problem I have is that the CSP I try to solve has lots of n-ary constraints, maki...
I have a propositional formula $F$ and an assignment of truth variables $A$. The assignment $A$ assigns a truth value to each variable in $F$ and then it can be evaluated. I have a function which for a given formula $F$ and a given assignment $A$ checks if both $A$ and $\overline A$ evaluate to the same truth value. It...
I am trying to solve this question on Sedgewick's and Wayne's Algorithms book: Suppose that a linear-probing table of size 10^6 is half full, with occupied positions chosen at random. Estimate the probability that all positions with indices divisible by 100 are occupied. So we had 500.000 inserts on the hash table an...
Like this one, for example, but for computer science. Maybe some survey of that kind was conducted for CS as well?
Given a positive integer n, find the list of positive integers whose product is the largest among all the list whose sum is n. For example, if n is 4 the desired list is 2, 2 because 2x2 = 4 is larger than 1x1x1x1 = 1, 2x1x1 = 2 and 3x1 = 3, if n is 5, the desired list is 2, 3. What is the desired list if n = 2001? Act...
I am trying to detect patterns in huge code bases. I managed to filter the entire codebase into a tagged string, as in: ABACBABAABBCBABA The result should be: ABA *3 CBA *2 I'm trying to build / use an algorithm which will find ANY unknown repeating pattern inside the string. The length of the pattern, it's composition...
I've around $500$ binary (black and white) images, of which I attach $2$ samples. I'm working on a machine learning problem of classifying images like them. I'd like to know what image features I can use that'd be very distinct for distinct images of this type. I tried HOG features, but the difficulty is they're very...
How to design a DFA of all strings over (0,1) such that every block of 5 consecutive symbols contains at least 2 0's?
A lot of times, I’ve needed to split a given set of people into a given number of teams but with some complications, like: Alice and Bob CANNOT be on the same team. Carol and David just HAVE TO BE on the same team. I feel like this is already a thing. There's gotta already be work in this problem. Where would I even ...
Just out of curiosity, What problems are believed to have an efficient algorithm, yet haven't been found such an algorithm for them? This question came up to my mind after reading about PRIMES problem. I hope this question is appropriate for this forum Thanks!
I have a number $n$ and an integer $x$ which ends on $1, 3, 7 \ or\ 9$, meaning that the last digit (rightmost digit) of $x$ is one of those 4 numbers. Now if $z = x * y$, what number do I have to choose for $y$ such that the $n$ last (rightmost) digits of $z$ are equal to $1$ (I mean the numerical value of the rightm...
I think that consensus number of mem-to-mem-swap(a,b) operation which atomically swaps the values between shared locations a and b (shared R/W memory) is infinite , but I'm having trouble proving it. I thought about implementing CAS with mem-to-mem-swap but comparing atomically is problematic, I think there is straight...
I often meet such kind of the definition of the set of trees, as: The set of unranked $\Sigma$-trees, denoted by $T$, is the smallest set of strings over $\Sigma$ and the parenthesis symbols ‘)’ and ‘(’ such that for each $a\in\Sigma$ and $w\in T^*$, $a(w)$ is in $T$. (http://dl.acm.org/citation.cfm?id=2101368) One que...
I'm designing a web app to host e-sports tournaments and want to create an algorithm that generates tournament brackets. Given a list of participants' user ID's (minimum 4, maximum let's say 64), I want to generate a bracket in the form of a list of pairings, where each element of the pair represents a match participan...
I've a test in a few days and I've a few issues with some of the subjects. Let's start with kernels, basically I understood that a kernel needs to be positive semi-definite and symmetric in order to be valid. Is that enough? For example the following kernel, $\mathrm{kernel}(x,y) = 2 k(x,y)$ for some $k$ which is a val...
Which families of the error correcting codes have an efficient decoding algorithm? I know that decoding a general linear code is NP hard (the general decoding problem). I also know that Goppa codes and alternate codes have such algorithms due to Patterson. Hamming codes also belong to this category. If someone can prov...
Definitions: positive CNF is a conjunctive normal form formula, where all literals are positive, i.e. the unary connective ¬ does not exist in the formula. negative CNF is a conjunctive normal form formula, where all literals are negative, i.e. the unary connective ¬ appears next to each literal. My question is: Given ...
I'm interested in finding the minimum number of words needed to define some fraction (perhaps 95%) of the words occurring in an English dictionary (while ignoring the challenges of disambiguating conjugations & contractions, questions about what is and is not a word, etc). My approach to this problem was to program a v...
Consider the binary search problem on a sorted array containing $n$ integers on 16 bits. Everybody agrees that the binary search needs $O(\log(n))$ time, because it makes at worst $O(\log(n))$ steps. But: at each step it needs to calculate a midpoint. The first midpoint is $[n/2]$. The next midpoint could be $[n/2]+[n/...
What is the complexity of the problem of computing the cardinality of the union of many (finite) and small sets? What is both the time and space complexity of the naive algorithm that does this computation? An inefficient recursive algorithm to do this task is: Where This results in Θ(2n) exponential blow up time com...
In parallel programming, what is the practical use for pack/unpack and gather/scatter? I searched for practical examples and didn't find any use of those.
i'm in trouble trying to prove the following proposition: Proposition If $\ C$ is a class closed under reductions and a $\ C$-Complete problem belongs to $\ coC$, then $C=coC$. Note: $C$ can be any class. To prove that proposition i thought to split the proof in two ways: (*): $C \subseteq coC$ I suppose it exists such...
I am trying to solve a Constraint Satisfaction Problem that involves lots of n-ary constraints. But the solver I have implemented only works with algorithms for binary constraints. I've been reading into the topic of the biniraztion of constraints (http://ktiml.mff.cuni.cz/~bartak/constraints/binary.html) but I am stil...
I've been trying to understand type inference for Hindley-Milner-based languages, and I'm struggling to understand how generalization works. Let's say I have the following program in Haskell: x :: Int x = id 1 y :: Char y = id 'a' id :: a -> a id x = x If the type-checker traverses the program from top to bottom, th...
I have two sets $A$ and $B$, I want to reduce $A$ to $B$ and $B$ to $A$. Formulas consist of a finite set of variables $\mathcal{V}$. An assignment $\sigma$ assigns truth values to each variable in $F$. When writing $F(\sigma)$ for an assignment $\sigma : \mathcal{V} \rightarrow \{0, 1\}$ I refer to the application of ...
Today I had an insight into an alternative deterministic algorithm for testing the primality of a number. I want to know if this algorithm is useful, and worth pursuing. I'll describe the idea behind the algorithm below: Let the fastest gcd algorithm we know be $g^*(a, b)$. $g^*$ takes in two numbers and finds th...
One of the hyperparameters for LSTM networks is temperature. What is it?
Is computing the cardinality of sum of regular expressions without kleene star closure is EXPTIME problem? Note that sum of regular expressions is union of regular expressions. The alphabet of each regular expression is Σ={0,1}, and each regular expression in the sum is concatenation of 0, 1 and (0+1). There is no klee...
Does the time complexity of the following pseudo-algorithm simplify as $O(n^2 log(n)) = O(n^2)$? SOME ALGORITHM GET n FOR (i=1; i<=n; i++) { calculationOfN[i] // some polylogarithmic time calculation FOR (j=1; j<=n; j++) { // some linear calculation } ...