Sie sind auf Seite 1von 6

1.What is an equivalence class?

The notion of equivalence classes is useful for constructing sets out of already
constructed ones. The set of all equivalence classes in X given an equivalence
relation ~ is usually denoted as X / ~ and called the quotient set of X by ~. Th
is operation can be thought of (very informally) as the act of "dividing" the in
put set by the equivalence relation, hence both the name "quotient", and the not
ation, which are both reminiscent of division. One way in which the quotient set
resembles division is that if X is finite and the equivalence classes are all e
quinumerous, then the order of X/~ is the quotient of the order of X by the orde
r of an equivalence class. The quotient set is to be thought of as the set X wit
h all the equivalent points identified.
For any equivalence relation, there is a canonical projection map p from X to X/
~ given by p(x) = [x]. This map is always surjective. In cases where X has some
additional structure, one considers equivalence relations which preserve that st
ructure. Then one says that that structure is well-defined, and the quotient set
inherits the structure to become an object of the same category in a natural fa
shion; the map that sends a to [a] is then an epimorphism in that category. See
congruence relation.
The alternative notation [a]R can be used to denote that we mean the equivalence
class of the element a specifically with respect to the equivalence relation R.
This is said to be the R-equivalence class of a.

If X is the set of all cars, and ~ is the equivalence relation "has the same col
or as", then one particular equivalence class consists of all green cars. X / ~
could be naturally identified with the set of all car colors.
Consider the "modulo 2" equivalence relation on the set Z of integers: x~y if an
d only if x-y is even. This relation gives rise to exactly two equivalence class
es: one class consisting of all even numbers, and the other consisting of all od
d numbers. Under this relation [7] [9] and [1] all represent the same element of
Z / ~.
The rational numbers can be constructed as the set of equivalence classes of ord
ered pairs of integers (a,b) with b not zero, where the equivalence relation is
defined by
(a,b) ~ (c,d) if and only if ad = bc.
Here the equivalence class of the pair (a,b) can be identified with rational num
ber a/b.
Any function f : X ? Y defines an equivalence relation on X by x1 ~ x2 if and on
ly if f(x1) = f(x2). The equivalence class of x is the set of all elements in X
which get mapped to f(x), i.e. the class [x] is the inverse image of f(x). This
equivalence relation is known as the kernel of f.
Given a group G and a subgroup H, we can define an equivalence relation on G by
x ~ y if and only if xy -1 ? H. The equivalence classes are known as right coset
s of H in G; one of them is H itself. They all have the same number of elements
(or cardinality in the case of an infinite H). If H is a normal subgroup, then t
he set of all cosets is itself a group in a natural way.
Every group can be partitioned into equivalence classes called conjugacy classes
.
The homotopy class of a continuous map f is the equivalence class of all maps ho
motopic to f.
In natural language processing, an equivalence class is a set of all references
to a single person, place, thing, or event, either real or conceptual. For examp
le, in the sentence "GE shareholders will vote for a successor to the company's
outgoing CEO Jack Welch", GE and the company are synonymous, and thus constitute
one equivalence class. There are separate equivalence classes for GE shareholde
rs and Jack Welch.
In an equivalence relation's matrix, the equivalence classes appear as blocks. I
n this example these equivalence blocks are marked in different colors, to be ea
sily recognized.
Properties
Because of the properties of an equivalence relation it holds that a is in [a] a
nd that any two equivalence classes are either equal or disjoint. It follows tha
t the set of all equivalence classes of X forms a partition of X: every element
of X belongs to one and only one equivalence class. Conversely every partition o
f X also defines an equivalence relation over X.
It also follows from the properties of an equivalence relation that
a ~ b if and only if [a] = [b].
If ~ is an equivalence relation on X, and P(x) is a property of elements of x, s
uch that whenever x ~ y, P(x) is true if P(y) is true, then the property P is sa
id to be well-defined or a class invariant under the relation ~.
A frequent particular case occurs when f is a function from X to another set Y;
if x1 ~ x2 implies f(x1) = f(x2) then f is said to be a morphism for ~, a class
invariant under ~, or simply invariant under ~. This occurs, e.g. in the charact
er theory of finite groups. The latter case with the function f can be expressed
by a commutative triangle. See also invariant. Some authors use "compatible wit
h ~" or just "respects ~" instead of "invariant under ~".
More generally, a function may map equivalent arguments (under an equivalence re
lation ~A) to equivalent values (under an equivalence relation ~B). Such a funct
ion is known as a morphism from ~A to ~B.
-------------------------------------------

2.What are turing machines?


A Turing machine is the simplest form of a computer. The concept was invented by
Alan Turing in 1936. This was the first computer invented (on paper only).
I- Principles of a Turing machine.
In its simplest form, a Turing machine is composed of a "tape", a ribbon of pape
r of indefinite length. There is a "head" that can read the symbol, chose to wri
te a new symbol in place, and then move left or right. The Turing machine is sai
d to be in a certain "state". Finally, the program is a list of "transitions", t
hat is a list that says, given a current state and a symbol currently under the
head, what should be written on the tape, what state the machine should go, and
whether the head should move left or right.
The tape is used to store data. In addition, it can also store a series of trans
itions (a small programs) and thus, the head can run "sub-programs". We then say
a Turing machine is emulating another one (the one on the tape).
By analogy with modern computers, the tape is the memory and the head is the mic
roprocessor.
Although it is composed of pretty simple capabilities, Turing argued that this s
imple machine could performed any computation, that is, could realize anything t
hat results from operations. In 1950, he discussed that the mind is itself the r
esults of operations (at the neural level) and thus is the creator of the artifi
cial intelligence studies.
For examples, see : Turing machine simulator
Virtual Turing machine

One way to know that a simple mechanism has the same computational capabilities
than a Turing machine is to see if it can emulate a Turing machine. Only these m
echanisms are powerful enough. Indirectly, it shows that humans are also Turing
machines since we can emulate them.
II- The Automaton with Append.
I chose to implement in Lego a slightly different version of the original Turing
machine. Instead of having a bi directional tape, it uses a stack. When the sym
bol beneath the stack is read (and removed), the machine changes "states" and ca
n add zero, one or two symbols on top of the stack.
This variation is maybe very different yet it is possible to show that this simp
le machine has the same capabilities than a Turing machine. Among other things,
it can emulate a Turing machine placed on the stack.
I programmed a small interface (through an Access database so Microsoft Access m
ust be installed on your computer) to enter an test simple Automaton With Append
(AWA or AAA in French). Follow this link to download the demo: AAA.zip.
One reason to build the automaton with append instead of the original Turing mac
hine was that I avoided building a bi directional (near) infinite tape.
III- Building the automaton with LEGO
It turned out to be a very difficult project since, among other things, the cons
truction needs to be "binary", that is, to be able to deliver one and only one s
ymbol on the top of the stack, to pull one and only one symbol from beneath the
stack, and that, for an indefinite period of time. In itself, adding a symbol is
not that complicated, but doing this with "binary" precision is another matter
entirely.
a) the symbols
The symbols themselves are made of cylinders. Using plates, I can code in binary
so that the cylinder below is (1,0,1) or the number 5. This kind of bar code is
easy to read using the light detector.

b) the memory
The stack is a small hollow tower in which the symbols can fall horizontally. It
is therefore a "compact" memory, containing near 10 bytes per 6 inches! Another
difficulty is to make sure the symbols will always remain horizontal, which imp
lies equal friction everywhere. Below is shown one section but many can be conne
cted together. I used two sections (since I pretty much ran out of beams at that
point).

c) the reader
The reader is at the bottom of the memory. It is a mechanism meant to expulse on
e symbol at a time. The expulsed symbol pass in front of the light detector (not
shown) so that the bar code can be read .

It is composed of the lower part of the memory stack and of a lever (shown on th
e side) that pushes the symbol out, activated in and out by the red axle.
d) the stacker
The stacker is at the top. Its purpose is to place new symbols on the stack. It
is maybe the most difficult part of the automaton. Only one bank is shown in the
picture, but 5 were actually implemented (see pictures below).

It works using the two blue blades. Every time the blades turn 90 degrees, one s
ymbol falls down the memory onto the stack.
In order to turn exactly 90 degrees, I used the rotation sensor described in the
section "Rotation sensor", connected onto the red axle for each bank.
Since in the full implementation, there are 5 banks, the correct bank cannot be
controlled directly from the RCX which has only three outputs. Therefore, a sele
ctor is required that can select, using one motors, which of (up to 5) output mu
st be activated. I used the third design from the page on my 2-to-7 multiplexors
.
e- putting it all together
All the designs shown above are available in LDRAW files:
a- the symbol: symbol.dat
b- the memory: memory.dat
c- the reader: reader_b.dat, reader_a.dat
d- the stacker: provider.dat and the rotation sensor: rotation3.dat
e-the selecter: multi_v3.dat

IV- Programming
Well, this Turing machine is not entirely mechanical... I used the RCX to store
the transition table. Since the symbols are bar codes read with a light detector
, it would have been very difficult to continue with a physical mechanism.
Three subroutines are required, one to select which symbol to provide on top of
the memory, one to turn the provider one quarter of a turn, and one to pull out
one symbol from the bottom of the memory (reading it on the way).
These routines were programmed using PRO-BOT.
The subroutine Stacker turns the provider one quarter of a turn. It uses a senso
r that turns off then on:
Declare Stacker CONSTANT 2
Declare stack MOTOR 1
Declare stacking SENSOR 0
Declare stacker_duration CONSTANT 10
SetSensorType(stacking, SWITCH_TYPE)
BeginOfSub(Stacker)
On(stack)
While(stacking = Open)
EndWhile()
Wait(stacker_duration)
While(stacking = Close)
EndWhile()
Wait(stacker_duration)
Off(stack)
EndOfSub()
The second subroutine select which symbol to provide. It uses two global variabl
es, one which indicates the current location and another one which indicate whic
h is the desired symbol. It compares the actual position with the desired positi
on and move the motor Selecter accordingly:
BeginOfSub(Selecter)
{if there is a move to do}
If(objective <> actual_pos)
{decide which way, backward or forward}
If(objective < actual_pos)
SetRwd(select)
Else
SetFwd(select)
EndIF()
{perform the moves for the right duration}
While(actual_pos <> objective)
SetVar(select_duration, next_step)
{if this is the last or first symbol}
If(actual_pos = nrnotch)
SetVar(select_duration, first_step)
EndIF()
If(actual_pos = CONSTANT,1)
SetVar(select_duration, first_step)
EndIF()
{move one notch}
On(select)
Wait(select_duration)
Off(select)
{update actual position }
If(objective < actual_pos)
SubVar(actual_pos, CONSTANT,1)
Else
SumVar(actual_pos, CONSTANT,1)
EndIF()
EndWhile()
EndIF()
PlayTone(400,20)
EndOfSub()
The last subroutine Reader removes one symbol from the bottom of the memory stac
k, reading it along the way, returning in the variable Symbol the number of blac
k bars on it:
Declare Reader CONSTANT 4
Declare read MOTOR 2
Declare reading SENSOR 2
Declare reader_duration CONSTANT 19
Declare gray_luminance CONSTANT 700
Declare couleur VARIABLE 30
Declare Symbol VARIABLE 29
Declare read_timer TIMER 0
BeginOfSub(Reader)
{0-initialise}
SetVar(Symbol, constant,1)
SetVar(couleur, black)
{a- pull out}
ClearTimer(read_timer)
On(read)
While(read_timer < reader_duration)
EndWhile()
AlterDir(read)
{b- push in, reading the symbol}
ClearTimer(read_timer)
While(read_timer < reader_duration)
If(couleur = white)
If(reading > gray_luminance)
SetVar(couleur, black)
SumVar(Symbol, constant,1)
EndIF()
EndIF()
If(couleur = black)
If(reading < gray_luminance)
SetVar(couleur, white)
EndIF()
EndIF()
EndWhile()
AlterDir(read)
Off(read)
{c- remove two for the black of the reader}
SubVar(Symbol, constant,2)
EndOfSub()
A complete listing of the source code is provided in this text file: AAA.rcp.
These three routines are the building blocks used in a main program that run the
automaton. The main program can be generated automatically by the demo program
indicated earlier, AAA.mdb.

Das könnte Ihnen auch gefallen