Questions tagged [equivalence-classes]
Use equivalence-classes for questions related to decomposing a set into subsets in which each element produces a constant output given a constant input
equivalence-classes
40
questions
0
votes
0
answers
13
views
Finding equivalent strings through substitutions
I have a problem that's proven to be dramatically more complex than it at first seemed. I have a (long) list of equivalence relations of the form e = abe. I need a function from string to string that ...
0
votes
1
answer
54
views
Develop equivalence relations among pairs of strings
I have a set of <string, string> pairs which represents equivalency among them:
[(“Player1”, “Player2”), (“Player3”, “Player4”), (“Player2”, “Player3”), (“Player11”, “Player13”)]
This means, “...
0
votes
0
answers
258
views
How to write test cases using Equivalence Class, Boundary value, and Basis Path Testing
I have a method isPerfect(x) (with 4<=x<=10000) below, how to write test cases based on Equivalence Class, Boundary Value, and Basis Path Testing:
public boolean checkPerfectNumber(int x) {
...
-2
votes
3
answers
110
views
Scala: group by equivalence relation [closed]
I have a List[String]. I want to group it by a given equivalence relation:
def f(x: String, y: String): Boolean = {
if (x == "" || y == "") {
false
} else {
x == y
}
}...
4
votes
1
answer
968
views
What is the meaning of "equivalence class" in the context of regular expressions?
In certain flavours of regular expression, inside a square bracket expression, the = symbol is a special character that is used as a delimiter for enclosing any one the elements within an equivalence ...
1
vote
1
answer
266
views
Enumerating equivalence classes
What I have: an equivalence relation on the set {1,...,n}, given as the full list of equivalent pairs (a,b) (this is already transitive; no need to compute a transitive closure). n is large (say, a ...
0
votes
0
answers
18
views
How to determine groupings imposed by equivalence pairings of data? [duplicate]
I have a csv file where each row contains a pair of values. For example, it might look something like this:
A, B
B, D
E, G
F, G
H, C
Each row should be interpreted to mean that the two values should ...
0
votes
1
answer
103
views
Proving H intersects K is a subgroup in Prolog (H and K are subgroups)
I am developing a group theory prover. Right now, I am interested in proving if H and K, are subgroups, then H intersects K is a subgroup. I base my proof in constructing an relation (==H) such that ...
0
votes
2
answers
1k
views
Ocaml: Sorting a list into equivalence classes
I recently started learning ocaml and am having trouble figuring out a problem.
Goal:
Given a list of integers and a function, sort the integers into equivalence classes based on the given ...
0
votes
4
answers
717
views
Sorting with equivalence classes in Python
Suppose I have a custom data structure Data that reveals two relevant properties: tag indicates which equivalence class this item belongs in, and rank indicates how good this item is.
I have an ...
1
vote
1
answer
120
views
RL Equivalence Ratio
I need help with some 2 questions , thank for help
There will be L ⊆ Σ* , Prove or disprove:
1. If each RL equivalence class is a regular language, then RL contains an infinite equivalence class
2. ...
0
votes
0
answers
46
views
Find equivalence classes from n-line text file
I have a n-line text file:
1st: 1,2,...1,1
2nd: 1,2,...0,1
3rd: 2,1,...,1,0
4th: 2,2,....,0,1
....
n th:1,2,....,1,1
Each line has 40 numbers, divided by comma. These numbers are indexed from ...
1
vote
2
answers
108
views
Produce all possible equivalent sorts for a given key function
Say I have points:
points = [(1., 1.), (3., 0.), (-1., -1.), (9., 2.), (-4., 2.) ]
If I sort them by y axis:
points = sorted(points , key=lambda k: [k[1], k[0]])
I get
points = [(-1., -1.), (...
95
votes
4
answers
6k
views
Union of 2 sets does not contain all items
How come when I change the order of the two sets in the unions below, I get different results?
set1 = {1, 2, 3}
set2 = {True, False}
print(set1 | set2)
# {False, 1, 2, 3}
print(set2 | set1)
#{False,...
1
vote
1
answer
280
views
Algorithm to determine one-to-one correspondence with an equivalence function
Suppose that I have two sets of items, and a function to check the equivalence of two items (not strict equality so that one item may be equivalent to multiple items in the other set), I want to ...