# Equivalence relation and order relationship

### Equivalence relations (article) | Khan Academy

Equality is both an equivalence relation and a partial order. Equality is also the only relation on a set that is. An equivalence relation on a set S, is a relation on S which is reflexive This is an equivalence relation for rather trivial reasons. 1. obvious . Order Relations. Equivalence Relations Countable total orders The fact that this is an equivalence relation follows from standard properties of congruence (see theorem.

So for example, consider the set of colors C: Equivalence Relation When talking about equality we naturally expect special properties from the binary relation: Every element should be equal to itself. A relation with that property is called reflexive. If a is equal to b, then b should also be equal to a. A relation with that property is symmetric. And finally if two elements a and b are equal and b is equal to some other element c, then naturally a should be equal to c as well.

A relation with that property is called transitive Every binary relation that is reflexive, symmetric and transitive is called an equivalence relation.

It is not reflexive: It is not transitive: But it is symmetric: It is a relation defined like so: You can verify yourself that equality is indeed an equivalence relation, i. Equality is the strictest equivalence relation you can imagine: However, the weaker equivalence relations are useful as well.

In those more elements are considered equivalent than are actually equal.

### Equivalence Relations

For example, we can define an equivalence relation of colors as I would see them: So I would say that, in addition to the other equalities, cyan is equivalent to blue. I added cyan, blue and blue, cyan to the pairs we had previously. And those types only indirectly define a set, the set of their values. For some types it is pretty straightforward what values they have. This type clearly defines the color set C from earlier: Or its value could be an array of size integers, meaning foo would be like std:: It all depends on the additional semantics.

You have types that are just encoding of mathematical constructs, like containers, integers, or even something like std:: They are usually found in libraries. And then there are types that encode behaviors and actions, like GUI or business logic classes. There is no good answer here.

It usually is some unique owner over a resource. As there is only one owner no two objects will actually be equal.

## foonathan::blog()

If you exclude really weird deleter this will only return true if both are nullptr or you are comparing one object to itself due to the reflexive nature of equivalence relations. This leads to the following rule: Instead provide a custom comparison predicate or use std:: But this can be a different value than the value of the entire object, we might want to lookup using the label of a button, for example. If we have a clear value, we can define a mathematical equivalence relation on this set of value.

When should we use which?

- Abstract Algebra/Equivalence relations and congruence classes
- Equivalence relations

If you implement an equivalence relation of the values that is a true equality i. If you implement a weaker equivalence relation of your values i. There are two reasons for that. First is the principle of least astonishment: Furthermore, there is only one equality but many equivalences: Why single out any single one of them and give them the special name?

Giving it a special name also makes it clear which equivalence it is. The other reason is more mathematical: A regular function is a function that will give you equal outputs when you call it with equal inputs. A regular function of std:: But this means that operator[] is no longer a regular function: It will always return a lowercase character.

**Part - 13 - Equivalence Classes and Partitions in HINDI - Equivalence Class partitions example**

Let G denote the set of bijective functions over A that preserve the partition structure of A: Then the following three connected theorems hold: This transformation group characterisation of equivalence relations differs fundamentally from the way lattices characterize order relations.

The arguments of the lattice theory operations meet and join are elements of some universe A.

Moving to groups in general, let H be a subgroup of some group G. Interchanging a and b yields the left cosets. G is closed under composition.

## Equivalence relation

The composition of any two elements of G exists, because the domain and codomain of any element of G is A. Moreover, the composition of bijections is bijective ; [11] Existence of identity function. This holds for all functions over all domains. Hence G is also a transformation group and an automorphism group because function composition preserves the partitioning of A.

Then we can form a groupoid representing this equivalence relation as follows. The advantages of regarding an equivalence relation as a special case of a groupoid include: Whereas the notion of "free equivalence relation" does not exist, that of a free groupoid on a directed graph does. Thus it is meaningful to speak of a "presentation of an equivalence relation," i. This leads to the notion of an internal groupoid in a category.

The canonical map ker: Less formally, the equivalence relation ker on X, takes each function f: Equivalence relations and mathematical logic[ edit ] Equivalence relations are a ready source of examples or counterexamples. An implication of model theory is that the properties defining a relation can be proved independent of each other and hence necessary parts of the definition if and only if, for each property, examples can be found of relations not satisfying the given property while satisfying all the other properties.

Hence the three defining properties of equivalence relations can be proved mutually independent by the following three examples: Or any preorder ; Symmetric and transitive: Or any partial equivalence relation ; Reflexive and symmetric: Properties definable in first-order logic that an equivalence relation may or may not possess include: