Complexity of Equivalence of Categories - complexity-theory

I'm trying to find a characterization of the computational complexity of the equivalence problem for finitely presented categories.
Given two categories C and D, an equivalence is two functors F : C -> D and G : D -> C and two natural isomorphisms FG -> I_D and I_C -> GF, where I_C : C -> C and I_D : D -> D are the identity functors on C and D.
The equivalence problem is to determine the existence of an equivalence for two finitely presented categories. This problem is undecidable, but I am hoping that it is still recursively enumerable or co-recursively enumerable. Any help would be greatly appreciated.
https://en.wikipedia.org/wiki/Equivalence_of_categories
https://en.wikipedia.org/wiki/Finite_presentation

Related

proving that a language is part of a grammar and vice versa

so here a grammar R and a Langauge L, I want to prove that from R comes out L.
R={S→abS|ε} , L={(ab)n|n≥0}
so I thought I would prove that L(G) ⊆ L and L(G) ⊇ L are right.
for L (G) ⊆ L: I show by induction on the number i of derivative steps that after every derivative step u → w through which w results from u according to the rules of R, w = v1v2 or w = v1v2w with | v2 | = | v1 | and v1 ∈ {a} ∗ and v2 ∈ {b} ∗.
and in the induction start: at i = 0 it produces that w is ε and at i = 1 w is {ε, abS}.
is that right so far ?
so here a grammar R and a Langauge L, I want to prove that from R comes out L.
Probably what you want to do is show that the language L(R) of some grammar R is the same as some other language L specified another way (in your case, set-builder notation with a regular expression).
so I thought I would prove that L(G) ⊆ L and L(G) ⊇ L are right.
Given the above assumption, you are correct in thinking this is the right way to proceed with the proof.
for L (G) ⊆ L: I show by induction on the number i of derivative steps that after every derivative step u → w through which w results from u according to the rules of R, w = v1v2 or w = v1v2w with | v2 | = | v1 | and v1 ∈ {a} ∗ and v2 ∈ {b} ∗. and in the induction start: at i = 0 it produces that w is ε and at i = 1 w is {ε, abS}.
This is hard for me to follow. That's not to say it's wrong. Let me write it down in my own words and perhaps you or others can judge whether we are saying the same thing.
We want to show that L(R) is a subset of L. That is, any string generated by the grammar R is contained in the language L. We can prove this by mathematical induction on the number of steps in the derivation of strings generated by the grammar. We start with the base case of one derivation step: S -> e produces the empty word, which is a string in the language L by choosing n = 0. Now that we have established the base case, we can state the induction hypothesis: assume that for all strings derived from the grammar in a number of steps up to and including k, those strings are also in L. Now we must prove the induction step: that any string derived in k+1 steps from the grammar is also in L. Let w be any string derived from the grammar in k+1 steps. From the grammar it is clear that the derivation of w must be S -> abS -> ababS -> ... -> abab...abS -> abab...abe = abab...ab. But this derivation is the same as the derivation of a string from the grammar in k steps, except that there was one extra application of S -> abS before the application of S -> e. By the induction hypothesis we know that the string w' derived in k steps is of the form (ab)^m for some m at least zero, and adding an extra application of S -> abS to the derivation adds ab. Because (ab)^m(ab) = (ab)^(m+1) we can choose n = m+1. So, all strings derived from the grammar in k+1 steps are also in the language, as required.
To prove that all strings in the language can be derived in the grammar, consider the following construction: to derive the string (ab)^n in the grammar, apply the production S -> abS a number of times equal to n, and the production S -> e exactly once. The first step gives an intermediate form (ab)^nS and the second step gives a closed form string (ab)^n.

what algorithm for rules mining in itemsets

I have following data, every entry contains an itemset and to which class it belongs to (positive or negative).
What algorithm I can use to find out that what combination of items indicate positive or negative?
In the following case, I want to find out that (B, C) indicate positive and (D, E) indicate negative.
B, C, A -> positive
B, C, D -> positive
B, C, E -> positive
B, D, E -> negative
C, D, E -> negative
A, D, E -> negative
result: (B, C) indicate positive, (D, E) indicate negative.
I've tried frequent itemsets and apriori, result is not good, is there any other possible method?
One typical algorithm could be mapping each pair of items in each record (itemset) into its positive or negative class and then count the number of mappings to either positive nor negative classes and compare the results to know which number is greater. That's the class you are looking for each pair.
It's very costly especially when your itemsets have large number of items reside in so, generally, you need some sort of data structures to store and retrieve data in fast and efficient way.

Transitive set merging

Is there a well-known algorithm, that given a collection of sets, would merge together every two sets that have at least one common element? So for example, given the following input:
A B C
B D
A E
F G H
I J
K F
L M N
E O
It would produce:
A B C D E O
F G H K
I J
L M N
I already have a working implementation, but it seems to be common enough that there has to be a name for what I am doing.
You can model this as a simple graph problem: Introduce a node for every distinct element. Introduce a node for every set. Connect every set to the elements it contains. You get an (undirected) bipartite graph, in which the connected components are the solution of your problem. You can use depth-first search to find the CCs.
The runtime should be linear (with hash tables, so only expected runtime unless your numbers are bounded).
I don't think it deserves a special name, it's just an application of well-known concepts.

Generating half of all permutations by never generating a permutation and its reverse?

I am looking for an algorithm that computes only half of the possible permutations. For example elements a b c have the following permutations:
a b c
a c b
b a c
b c a
c a b
c b a
When a permutation is an opposite (in reverse order) of another permutation, they are considered to be the same. For example, (a b c) ~ (c b a). I need the algorithm to compute only half the permutations. In this case, that would be either (a b c) (a c b) (b a c) or (c b a) (b c a) (c a b). I suppose different sets of 3 are possible too, depending on the algorithm.
I have tried searching for this algorithm, all I have found language-specific algorithm using included function with permutation indexing. I need a general pseudo-code. I'm working with VB.NET
Thank you !
You could do it this way:
Use a double for-loop to fix the beginning and end of the permutation, with index[end] > index[beginning];
Generate all the permutations for the leftover elements and put them in between.
E.g., for 4 elements:
a * * b -> a c d b, a d c b
a * * c -> a b d c, a c d b
a * * d -> a b c d, a c b d
b * * c -> b a d c, b d a c
b * * d -> b a c d, b c a d
c * * d -> c a b d, c b a d
Since the first and last element will never be the last and first elemnt of another permutation when generate the permutations this way, and you are producing exactly n! / 2 permutations, it is guaranteed the you only get half of all the permutations.
It is same as generating normal one it is just that first is lexicographically before last. So you put first on first place, then all lex greater on last and other in middle as usually.
This condition can be also used as filter to filter out unwanted if that makes simpler.
thank you for the help. I will post my pseudocode for this problem in case anyone else needs it in the future:
SET of size (n)
SUBSET of size (n-2)
for i=1 to n
for j=i+1 to n
create SUBSET = SET \ { SET[i] , SET[j] }
do permutations loop, function for SUBSET
{
calculate a permutation P for SUBSET
construct full permutation FP = SET[i] & P & SET[j]
print or use FP
continue permutations loop
}
next j
next i

How to deal with crossover when sequence matters?

How does one go about crossing over two parents when the children must have a particular ordering?
For example, when applying genetic algorithms to the Travelling Salesman Problem on a fixed graph of vertices / edges, you must contend with the fact that not all vertices can travel to other vertices. This makes crossover much more difficult because unlike the TSP in which all vertices may travel to all other vertices, when a crossover is performed it must be done at a point that produces a legal path. The alternative is to just crossover anyway and reject illegal paths, but the risk is great computational expensive and few to no legal paths.
I've read about permutation crossover but I'm not entirely sure how this solves the issue. Can someone point me in the right direction or advise?
Ordering should, as far as possible, not be a constraint in genetic programming. Maybe you should contemplate to pick up another format for your solutions.
For example, in your TSP, consider the codon A->B.
Instead of the meaning 'take the edge from A to B', you could consider 'take the shortest path from A to B'. This way, your solutions are always feasible. You just have to pre-compute a shortest path matrix as a pre-processing.
Now, this does not guarantee that candidates will be feasible solutions after your crossover. Your crossover should be tuned in order to guarantee that your solution are still feasible. For example, for the TSP, consider the sequences :
1 : A B C D E F G H
2 : A D E G C B F H
Choose a pivot randomly (E in our example). This leads to the following sequences to be completed :
1' : A B C D E . . .
2' : A D E . . . . .
All the vertices have to be visited in order to have a valid solution. In 1', F, G and H have to be visited. We order them as they are in sequence 2. In 2', G, C, B, F and H are re-ordered as in 1 :
1' : A B C D E G F H
2' : A D E B C F G H
Hope this helps.

Resources