




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
theory computer science lecture notes
Typology: Lecture notes
1 / 162
This page cannot be seen from the preview
Don't miss anything!





























































































Pieces are set up on a playing board. Dice are thrown, and a number is generated on random. Depending on number, the pieces on the board must be rearranged in a fashion completely specified by the rules. The child has no options about changing the board. Everything is determined by the dice.
A child has a simple computer (input device, processing unit, memory, output device) and wished to calculate the sum of 3 plus 4. The child writes a program, which is a sequence of instructions that are fed into the machine one at a time. Each instruction is executed as soon as it is read, and then the next instruction is read. If all goes well, the machine outputs the number 7 and
Computer is also deterministic : the resultant state is completely determined by the prior state and the input instruction.
(^) The input of Game (the number generated by rolling dice) is depended on whether anyone has won the game yet. But the input of the computer program is the number of instruction which is predetermined before running the program.
Now we will consider the input of both the game and computer as strings of alphabet instead of the number generated randomly by the dice or the command instruction of the program.
front
pad
rear
pad
automatic door
INPUT SIGNAL NEITHER FRONT REAR BOTH
STATE
CLOSED CLOSED OPEN CLOSED CLOSED OPEN CLOSED OPEN OPEN OPEN
(^) A finite automaton is a collection of 3 things:
(^) A finite set of states, one of which is designated as the initial state, called the start state , and some (maybe none) of which are designated as final states. (^) An alphabet of possible input letters. (^) A finite set of transitions that tell for each state and for each letter of the input alphabet which state to go to next.
(^) start state = q 1 (^) final state = q 2 (^) transitions = each arrows (^) alphabet = each labels (^) When this automaton receives an input string such as 1101, it processes that string and produce output (Accept or Reject).
q 1
0
1
(^10)
0,
q 2 q 3
(^) M 1 = (Q,,,q 0 ,F) , where (^) Q = {q 1 , q 2 , q 3 }, (^) = {0,1}, (^) is described as (^) q 1 is the start state , and (^) F = {q 2 }.
0 1 q 1 q 1 q 2 q 2 q 3 q 2 q 3 q 2 q 2
q 1
0
1
(^10)
0,
q 2 q 3
(^) A = {w | w contains at least one 1 and an even number of 0s follow that last 1}
L(M 1 ) = A, or equivalently, M1 recognizes A
q 1
0
1
(^10)
0,
q 2 q 3
(^) M 2 = (Q,,,q 0 ,F) , where (^) Q = (^) = (^) is described as (^) is the start state , and (^) F = { }.
0 1 q 1 q 2
q 1
(^0 1 )
q 2
0
(^) If the start state is also a final state, what string does it automatically accept? (^) L(M 3 ) = { w | w is the empty string or ends in a 0}
q 1 q 2
0
0
1 1
(^) M 4 = (Q,,,q 0 ,F) , where (^) Q = (^) = (^) is described as
(^) is the start state , and (^) F = { }.
a b q 1 q 2 r 1 r 2
a
q 1 r 1
q 2 r 2
a
a a
b a
b
b (^) b