# Equality

The notions of sameness in human languages precedes the notion of equality and reflects the fact that thing appears to be the same.

The notion of equality is formally defined in Maths. `3 = 2 + 1`, `3 = 4 - 1`, etc. In a human languages Equal means the Same. Equality imply sameness.

The notion of equality as sameness is only applicable to abstract concepts such as Numbers. `3 = 3` means the same `Number`.

This means that each occurence of a symbol `3` is a reference to (or an association with) to the very same concept of the Number 3 (`One` more than `2` and `One` less than `4`).

In the Real World - the given Universe (as opposed to the universe of ideas) the notion of sameness is not applicable. Two atoms of Hydrogen or two atoms of Carbon, two molecules of water are logically equal but not the same.

In the physical world Sameness (of being the same thing) is defined as occupying of the exactly same physical location (in a molecule or in computer memory) of which multiple references (reflections or projections) has been made. Each reflection of a Moon is of the very same Moon (this beautiful metaphor is as old as humanity itself, and even older).

The notion of `Equality` is not applicable to physical things (leave alone humans!) only to numbers or other abstract concepts (like a law-abiding citizen). The notions of Sameness and Equivalency are the ones applicable to physical things (which are processes really).

Notice that the notions of `Sameness` and `Equality` but not Equivalency require an observer. Same atoms are equal from the point of view of molecular biology (this is how Life itself is possible at all) but it cannot tell one from another since they all are equivalent.

## Substitutability

The implication of Equality is Substitutability.

This means that in some contexts, such as arithmetics, Equal can be substituted to the equal without losing the meaning or logical validity of an expression.

This is the Universal Principle. It is prior any maths.

## Formalized notion of Equality

Formalized notion of equality in Haskell - Minimal complete definition: either equal `'=='` or unequal `'/='`.

```class  Eq a  where
(==), (/=)  :: a -> a -> Bool

x /= y   =   not (x == y)
x == y   =   not (x /= y)
```

Equality for Integers (particular kind of Numbers)

```instance Eq Int where
i1 == i2 = eqInt i2 i2
```

Equality for homogehous `Lists` (particular kind of a data-structure)

```instance (Eq a) => Eq [a] where
[]     == []     = True
(x:xs) == (y:ys) = (x == y) && (xs == ys)
```