Sei sulla pagina 1di 31

Computers and the science of

computing
What is (Not) a computer
• Input, Process, output
Are these computers?
• Juice mixers
• Kitchen Grinders
• Washing Machines
A computer
• Makes significant decisions about it’s inputs
• Can even reject an input
• Is capable of storing inputs
• Is capable of making decisions about it’s
inputs and outputs
Focus of this course
• In this course, we deal with models of abstract
computing machines rather than the architecture
and design of a modern digital computer
• We consider computer as a machine that
computes an output for a given input while being
controlled by a program or table of instructions
• The essential core of a computing machine known
as automaton (Automata, in plural)
Idea of computing
• Input to computing machines are a single
string of symbols
• Symbols are taken from a set of all possible
input symbols known as input alphabet
• String is a sequence of zero or more symbols
from the alphabet
• Output- Yes or no
• A typical automaton does not produce any
real output
• We do not consider how fast or efficient a
computation is
• We focus only in checking whether the
computing machine can compute an output
for a given input.
Computing machines and Languages
• A problem can be stated in two ways
– As a conventional problem, Give input,
find/calculate/compute.. Print output
– As a yes-or-no (True or False) question
• Set of input strings is called a formal language
• The words problem and language are even
considered interchangeable
Why are they called languages?
• A language such as English can be considered
to be nothing but the set of all valid words,
phrases and clauses in English.
• Even a human or natural language such as
English is nothing but a set of strings.
• Since the set of strings that we consider in the
context of computing machines are not
natural to humans , we call them formal
languages.
Birth of the Science of Computing
• Alan Turing is considered to be Father of modern
Computer Science
• Famous paper in 1936
• Illustrated the idea of a general-purpose
computing machine with a central control unit
and a memory unit with a reading head.
• Turing also showed that any computing machine,
when asked to compute a function that is not
computable, goes to an in-finte loop and never
halts for some input strings.- Halting Problem
Why study science of computing?
• Essential science behind all computing
• Natural language processing and computational
linguistics
• Design of compilers
• Automata theory plays a major role in designing
ATMs, kiosks,etc.
• Basis for various aspects of digital and VLSI design
• Helps to frame a solid foundation to learn new
computing technologies and more programming
languages
Some Basics
What is automata theory
• Automata theory is the study of abstract
computational devices
• Abstract devices are (simplified) models of
real computations
• Computations happen everywhere: On your
laptop, on your cell phone, in nature, …
• Why do we need abstract models?
A simple computer

BATTERY

input: switch
output: light bulb
actions: flip switch
states: on, off
A simple “computer”

BATTERY start off on

input: switch
output: light bulb bulb is on if and only if
there was an odd number
actions: f for “flip switch” of flips
states: on, off
Another “computer”
1
1 start off off
1

2 2 2 2
BATTERY
1
2
off on
1

inputs: switches 1 and 2


actions: 1 for “flip switch 1” bulb is on if and only if
actions: 2 for “flip switch 2” both switches were flipped
an odd number of times
states: on, off
A design problem
1 4

?
5
BATTERY

Can you design a circuit where the light is on if and only


if all the switches were flipped exactly the same number
of times?
A design problem
• Such devices are difficult to reason about,
because they can be designed in an infinite
number of ways
• By representing them as abstract
computational devices, or automata, we will
learn how to answer such questions
These devices can model many things
• They can describe the operation of any “small
computer”, like the control component of an
alarm clock or a microwave
• They are also used in lexical analyzers to recognize
well formed expressions in programming
languages:

ab1 is a legal name of a variable in C


5u= is not
Different kinds of automata
• This was only one example of a computational
device, and there are others
• We will look at different devices, and look at
the following questions:
– What can a given type of device compute, and
what are its limitations?
– Is one type of device more powerful than
another?
Preliminaries of automata theory
• How do we formalize the question
Can device A solve problem B?

• First, we need a formal way of describing the


problems that we are interested in solving
Problems
• Examples of problems we will consider
– Given a word s, does it contain the subword “fool”?
– Given a number n, is it divisible by 7?
– Given a pair of words s and t, are they the same?
– Given an expression with brackets, e.g. (()()), does
every left bracket match with a subsequent right
bracket?
• All of these have “yes/no” answers.
• There are other types of problems, that ask “Find
this” or “How many of that” but we won’t look at
those.
Alphabets and strings
• A common way to talk about words, number, pairs
of words, etc. is by representing them as strings
• To define strings, we start with an alphabet
An alphabet is a finite set of symbols.

• Examples
S1 = {a, b, c, d, …, z}: the set of letters in English
S2 = {0, 1, …, 9}: the set of (base 10) digits
S3 = {a, b, …, z, #}: the set of letters plus the
special symbol #
S4 = {(, )}: the set of open and closed brackets
Strings
A string over alphabet S is a finite sequence
of symbols in S.

• The empty string will be denoted by e


• Examples
abfbz is a string over S1 = {a, b, c, d, …, z}
9021 is a string over S2 = {0, 1, …, 9}
ab#bc is a string over S3 = {a, b, …, z, #}
))()(() is a string over S4 = {(, )}
Languages
A language is a set of strings over an alphabet.

• Languages can be used to describe problems


with “yes/no” answers, for example:
L1 = The set of all strings over S1 that contain
the substring “fool”
L2 = The set of all strings over S2 that are divisible by 7
= {7, 14, 21, …}
L3 = The set of all strings of the form s#s where s is any
string over {a, b, …, z}
L4 = The set of all strings over S4 where every ( can be
matched with a subsequent )

Potrebbero piacerti anche