set-theory

Russell's Paradox

Let X be the set of all sets that do not contain themselves. Is X a member of X? ...

Is there set division in SQL?

I'm fully aware that set division can be accomplished through a series of other operations, so my question is: Is there a command for set division in SQL? ...

Database operation that can be applied repeatedly and produce the same results?

I'm drawing a blank, or as some would say, having a senior moment. I know there’s a formal definition and a name for the concept where a db operation (stored procedure) that runs in a database will yield the same results if run repeatedly. It's something in the genre of the Mathematician’s reflexive, symmetric, transitive, etc. ...

How do I find a subset of items in two sets of data that partially differ?

I am trying to get the subset of items in dataA that are in dataB, and have different values of property c. The properties a and b can be used as an index, so I have tried to filter out only the useful pairs then check to see if they have a different c value. This is the linq expression I came up with, and it does work, but It seems li...

efficient algorithm to compare similarity between sets of numbers?

Hello, I have a large number of sets of numbers. Each set contains 10 numbers and I need to remove all sets that have 5 or more number (unordered) matches with any other set. For example: set 1: {12,14,222,998,1,89,43,22,7654,23} set 2: {44,23,64,76,987,3,2345,443,431,88} set 3: {998,22,7654,345,112,32,89,9842,31,23} Given the 3 set...

Prolog list difference routine.

I am trying to implement a list difference routine in prolog. For some reason the following fails: difference(Xs,Ys,D) :- difference(Xs,Ys,[],D). difference([],_,A,D) :- D is A, !. difference([X|Xs],Ys,A,D) :- not(member(X,Ys)), A1 is [X|A], difference(Xs,Ys,A1,D). When trying: ?- difference([1,2],[],D). I get this error: ER...

Approaches for using and analyzing set data in time.

I am designing an interactive installation for a gallery where I will receive input telling me which of 8 input transducers have been bridged. For example if someone touches strip number 1, I will be able to detect that. For convenience let's notate that as {1}. If they touch 1 and 2 simultaniously, I will be able to detect that connecti...

SQL query to identify completely contained subset

I am scratching my head to figure out a solution to the following question: I have a table with two fields, USER_ID and CLIENT_ID. For each USER_ID there are 1 to n CLIENT_IDs. Let us say that user A is linked to clients 1,2 and 3. I want to construct a query that returns other users that also are linked to all of these clients. They m...

What is a data structure for quickly finding non-empty intersections of a list of sets?

I have a set of N items, which are sets of integers, let's assume it's ordered and call it I[1..N]. Given a candidate set, I need to find the subset of I which have non-empty intersections with the candidate. So, for example, if: I = [{1,2}, {2,3}, {4,5}] I'm looking to define valid_items(items, candidate), such that: valid_items(I,...

determine if intersection of a set with conjunction of two other sets is empty

For any three given sets A, B and C: is there a way to determine (programmatically) whether there is an element of A that is part of the conjunction (edit: intersection) of B and C? example: A: all numbers greater than 3 B: all numbers lesser than 7 C: all numbers that equal 5 In this case there is an element in set A, being the numb...

Set Theory and .NET

Recently I came across a situation where set theory and set math fit what I was doing to the letter (granted there was an easier way to accomplish what I needed - i.e. LINQ - but I didn't think of that at the time). However I didn't know of any generic set libraries. Granted IEnumerables provide some set operations (Union, etc.), but not...

Recursive sql subset query, using connect by

I have two tables that look a little like this AGR_TERR_DEF_TERRS ID DEF_ID TERRITORY_ID (foreign key links to TERRITORIES.ID) TERRITORIES ID NAME PARENT_ID (parent_id and id are recursive) Given two DEF_IDs, I need a function which checks whether the territories of one is a complete subset of the other. I've been playing...

implimenting set theory operations in php

Does anyone have any examples or know of any resources that show how to implement set theory operations in pure php? ...

LINQ to Entities plus Set Theory: Unable to create a constant value of type 'ITextEntity'. Only primitive types ('such as Int32, String, and Guid')...

I have a LINQ to Entities query (using EF 4) that has some pretty complicated set-based filtering going on. The code compiles just fine, but when I try to run it, I get the following error: Unable to create a constant value of type 'ITextEntity'. Only primitive types ('such as Int32, String, and Guid') are supported in this context. ...

Finding overlapping sets

I'm writing a Digital Fountain system in C#. Part of this system creates me sets of integers, I need to find the combinations of sets which create can leave me with a set of just one item. What's the fastest way to do this? Set A: 1,2,3,4,5,6 Set B: 1,2,3,4,6 Set C: 1,2,3 Set D: 5,6 Solutions: A - B => 5 A - (C + D) => 4 I don't need...