(review) a binary relation R on a set S is a set of pairs of elements of S. In other words, R ⊆ S × S. In other words, R is a set of edges in a directed graph with vertices S.
Relations can relate more than two sets. In general, a relation on S, T, U, … is a subset of S × T × U × ⋯.
Example: a database table can be thought of as a set of rows; each row can be thought of as a tuple. Thus the table is a relation on S, T, U, … where S is the set of possible values for the first column, T is the set of possible values for the second column, and so on.
notation: if R is a binary relation and (x, y) ∈ R we write xRy. this generalizes relations like " = " and "≤".
relations generalize functions. You can think of a function F as a relation: yFx if y = F(x). Relation composition (as defined last lecture) is then the same as function composition.
(review) if R is a relation on a set S then
A relation satisfying all three properties is called an equivalence relation. Equivalence relations "act like" the = relation.
If you ever write a function as part of a program and call it something like "equals" or "equiv", you should check that it actually defines an equivalence relation!
Recall when discussing number theory, we defined the equivalence class of x (written [x]m) as $\{Y \in \N | x \equiv y (mod~m)\}$.
This construction generalizes to any equivalence relation. If R is an equivalence relation on S, and if x ∈ S, then we can define the equivalence class of x ([x]R) as {y ∈ S∣xRy}.
The set of all equivalence classes of S (using the relation R) is called the quotient of S by R, or simply S / R (read "S mod R").
If you think of R as a graph, it must consist of a collection of a collection of subgraphs, each of which is completely connected; these subgraphs are the equivalence classes of S / R.
For the last portion of the lecture we started discussing finite automata. Finite automata are a very simple way to model certain computations that take strings as input and output yes or no.
Key definitions:
Note: because δ is a function, there must be a transition from every state on every character.
A machine processes a string one character at a time, starting in the start state and following a transition for each character until it consumes the whole string. After it processes the string, it accepts if it ends in a final state, and it rejects otherwise.
Convince yourself that the above machine accepts all (and only) the strings in the language L = {x∣x has an even number of 0's}.