4.4 Theory of Computation Flashcards
(32 cards)
Procedural abstraction
Procedural abstraction represents a computational method.
o The result of abstracting away the actual values used in any particular computation is a
computational pattern or computational method - a procedure
Abstraction by generalisation (or categorisation)
Abstraction by generalisation (or categorisation)
is a grouping by common characteristics to arrive
at a hierarchical relationship of the ‘is a kind of’
type.
Functional abstraction
Functional abstraction the particular computation method is hidden.
o The result of a procedural abstraction is a procedure, not a function. To get a function requires yet
another abstraction, which disregards the particular computation method. This is functional
abstraction.
Data abstraction
Data abstraction - details of how data are actually represented are hidden, allowing new kinds of data
objects to be constructed from previously defined types of data objects
o Data abstraction is a methodology that enables us to isolate how a compound data object is used
from the details of how it is constructed. For example, a stack could be implemented as an array
and a pointer for top of stack.
Problem abstraction/reduction
Problem abstraction/reduction - details are removed until the problem is represented in a way that is
possible to solve, because the problem reduces to one that has already been solved.
Representational abstraction
Representational abstraction is a representation
arrived at by removing unnecessary details
Decomposition
Decomposition - procedural decomposition means breaking a problem into a number of subproblems, so
that each sub-problem accomplishes an identifiable task, which might itself be further subdivided.
Composition
Composition - build a composition abstraction by combining procedures to form compound procedures.
o build data abstractions by combining data objects to form compound data, for example tree data
structure
Finite State Machine vs Turing Machine
The difference between a Finite State Machine and a Turing Machine, is that a Turing Machine has a memory in
the form of a tape. A Finite State Machine cannot store data.
Finite State Machine
Finite state machines are used to design computer programs and sequential logic circuits. They’re not a real
machine, but more of a design tool to show how a ‘machine’ could react to external events.
A Finite state machine can only be in any one of a finite number of states at any given moment. An FSM changes
between states when there is a trigger condition or some input.
Mealy Machine
A mealy machine is simply an FSM with an output. The outputs are determined by both the FSM current state and
the current input. As with a standard FSM, there can only be one possible transition for each given state and input.
A set/set notation
A set is an unordered collection of values or symbols in which each value or symbol occurs only once. Repeated
values are not allowed. A set is defined by listing each member of the set using the following notation
A finite set
A finite set is a set whose elements can
be counted off by natural numbers up
to a particular number.
Cardinality
The number of elements in a finite set.
Infinite Set
A set which has no end value and is
represented by a “…” at the end (or
sometimes the beginning) of the set.
Infinite sets cannot be counted off up to
a certain number.
Countable set
A countable set can be counted off
against a subset of the natural numbers.
This includes the finite sets, but also
countably infinite sets
Countably infinite set
A countably infinite set is a set where it
is possible to count the elements off
against the set of natural numbers.
Cartesian product of sets
The cartesian product of two sets is the set of all ordered pairs (a, b) where a is a member of set A and b is a member
of set B.
Subset and Proper subset
The symbol for Subset is ⊆ and the symbol for a proper subset is ⊂
If every member of set A is also a member of set B then we can say that “A is a subset of B”.
We would write this as A ⊆ B
If set A is a subset of, but not equal to set B, then we can say that “A is a proper subset of B”.
We would write this as A ⊂ B
Intersection in sets
The symbol for an intersection is ∩. The intersection of two sets contains all of the members
which both sets have in common.
Union in sets
The symbol for a union is ∪. We can add two sets together. This will result in a new set which
contains everything in either sets A or B.
Difference in sets
The symbol for difference is \ (sometimes a – symbol though). The difference of two sets is
everything which is in the first set but not in the second set.
Regular expression
A regular expression is simply a way of describing a set and that regular expressions allow particular types of
languages to be described in a convenient shorthand notation.
Why use a regular expression?
* Used in software for searching files or commands
* Also used for filtering text, firewalls, finding virus definitions, etc…
- OR
? - 0 or 1
* - 0 or more of the preceding elements
+ - 1 or more of the preceding elements
( ) - Grouping or ordering
Regular language
A language is called regular if it can be represented by a regular expression. A regular language is any language that a
Finite State Machine (FSM) will accept