1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering...

44
1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 http://cpe.gmu.edu/~khintz Adaptation to this class and additional comments by Marek Perkowski

Transcript of 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering...

Page 1: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

1

Sequential Machine TheorySequential Machine Theory

Prof. K. J. HintzDepartment of Electrical and Computer

Engineering

Lecture 1

http://cpe.gmu.edu/~khintz

Adaptation to this class and additional comments by Marek Perkowski

Page 2: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

2

Why Sequential Machine Theory (SMT)?

Why Sequential Machine Theory (SMT)?

• Sequential Machine Theory – SMT• Some Things Cannot be Parallelized• Theory Leads to New Ways of Doing Things, has also

practical applications in software and hardware (compiler design, controllers design, etc.)

• Understand Fundamental FSM Limits• Minimize FSM Complexity and Size• Find the “Essence” of a Machine,

– what does it mean that there is a machine for certain task?

Page 3: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

3

Why Sequential Machine Theory?Why Sequential Machine Theory?

• Discuss FSM properties that are unencumbered by Implementation Issues:– Software– Hardware– FPGA/ASIC/Memory, etc.

• Technology is Changing Rapidly, the core of the theory remains forever.

• Theory is a Framework within which to Understand and Integrate Practical Considerations

Page 4: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

4

Hardware/SoftwareHardware/Software

• There Is an Equivalence Relation Between Hardware and Software– Anything that can be done in one can be done

in the other…perhaps faster/slower– System design now done in hardware

description languages (VHDL, Verilog, higher) without regard for realization method

• Hardware/software/split decision deferred until later stage in design

Page 5: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

5

Hardware/SoftwareHardware/Software

• Hardware/Software equivalence extends to formal languages– Different classes of computational machines

are related to different classes of formal languages

– Finite State Machines (FSM) can be equivalently represented by one class of languages

Page 6: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

6

Formal LanguagesFormal Languages

• Unambiguous

• Can Be Finite or Infinite– Give some simple examples

• Can Be Rule-based or Enumerated

• Various Classes With Different Properties

Page 7: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

7

Finite State MachinesFinite State Machines

• FSMs are Equivalent to One Class of Languages• Prototypical Sequence Controller

– Generator– acceptor– controller

• Many Processes Have Temporal Dependencies and Cannot Be Parallelized, – the need some form of state machine.

• FSM Costs– Hardware: More States More Hardware– Time: More States, Slower Operation – Technology dependent: how many CPLD chips?

Page 8: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

8

Goal of this set of lecturesGoal of this set of lecturesGoal of this set of lecturesGoal of this set of lectures

• Develop understanding of Hardware/Software/Language Equivalence

• Understand Properties of FSM• Develop Ability to Convert FSM

Specification Into Set-theoretic Formulation• Develop Ability to Partition Large Machine

Into Greatest Number of Smallest Machines– This reduction is unique

Page 9: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

9

Machine/Mathematics HierarchyMachine/Mathematics Hierarchy

• AI Theory Intelligent Machines

• Computer Theory Computer Design

• Automata Theory Finite State Machine

• Boolean Algebra Combinational Logic

Page 10: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

10

Combinational LogicCombinational Logic

• Feedforward• Output Is Only a Function of Input• No Feedback

– No memory– No temporal dependency

• Two-Valued Function Minimization Techniques – Well-known Minimization Techniques

• Multi-valued Function Minimization – Well-known Heuristics

Page 11: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

11

Finite State MachineFinite State Machine

• Feedback• Behavior Depends Both on Present State and

Present Input• State Minimization

– Well-known – With Guaranteed Minimum

• Realization Minimization – Unsolved problem of Digital Design– Technology related, combinational design related

Page 12: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

12

Computer Design: Turing MachinesComputer Design: Turing Machines

• Defined by Turing Computability– Can compute anything that is “computable”– Some things are not computable

• Assumed Infinite Memory• State Dependent Behavior• Elements:

– Control Unit is specified and implemented as FSM– Tape infinite– Head– Head movements

• Show example of a very simple Turing machine now: x--> x+1

Page 13: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

13

Intelligent MachinesIntelligent Machines

• Some machines display an ability to learn– How a machine can learn?

• Some problems are possibly not computable– What problems?– Why not computable?– Something must be infinite?

Page 14: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

14

Automata, Automata, akaaka FSM FSMAutomata, Automata, akaaka FSM FSM• Concepts of Machines:

– Mechanical• Counters, adders

– Computer programs– Political

• Towns, highways, social groups, parties, etc

– Biological• Tissues, cells, genetic, neural, societies

– Abstract mathematical• Functions, relations, graphs You should be

able to use FSM

concepts in other areas

like robotics

Page 15: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

15

FSM - Abstract mathematical concept of many types of behavior

FSM - Abstract mathematical concept of many types of behavior

• Discrete– Continuous system can be discretized to any

degree of resolution

• Finite State: – finite alphabets for inputs, outputs and states.

• Input/Output– Some cause, some result

Page 16: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

16

Set Theoretic Formulation of Finite State Machine

Set Theoretic Formulation of Finite State Machine

S I O, , , ,

• S: Finite set of possible states

• I: Finite set of possible inputs

• O: Finite set of possible outputs

• : Rule defining state change

• : Rule determining outputs

Page 17: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

17

Types of FSMsTypes of FSMs

• Moore FSM– Output is a function of state only

• Mealy FSM– Output is a function of both the present state

and the present input

Discuss timing differences, show examples and diagrams, discuss fast signaling and PLD realization

Page 18: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

18

Types of FSMsTypes of FSMs

• Finite State Acceptors, Language Recognizers– Start in a single, specified state– End in particular state(s)

• Pushdown Automata – Not an FSM– Assumed infinite stack with access only to

topmost element

Page 19: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

19

ComputerComputer

• Turing Machine – Assumed infinite read/write tape– FSM controls read/write/tape motion– Definition of computable function– Universal Turing Machine reads FSM behavior

from tape

Page 20: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

20

Review of Set TheoryReview of Set TheoryReview of Set TheoryReview of Set Theory

• Element: “a”, a single object with no special property

• Set: “A”, a collection of elements, i.e.,

– Enumerated Set:

– Finite Set:

a A

A

A

A

1

2 1 2 3

3

2 5 7 4

, , ,

, , ,a a a

Larry, Curly, Moe

A4 0 10 a a: , integer

Page 21: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

21

SetsSets

– Infinite set

– Set of sets

A

A5

6

R

I

real numbers

integers

A A A7 3 6 ,

Page 22: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

22

SubsetsSubsets

• All elements of B are elements of A and there may be one or more elements of A that is not an element of B

B A A3

Larry,

Curly,

Moe

A6

integers

A7

A A6 7

Page 23: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

23

Proper SubsetProper Subset

• All elements of B are elements of A and there is at least one element of A that is not an element of B

B A

Page 24: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

24

Set EqualitySet Equality

• Set A is equal to set B

AB

BA

BA

and

iff

Page 25: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

25

SetsSets

• Null Set– A set with no elements,

• Every set is a subset of itself

• Every set contains the null set

Page 26: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

26

Operations on SetsOperations on Sets

• Intersection

• Union

C A B

C A B

a a a|

D A B

D A B

a a a|

Logical AND

Logical OR

Page 27: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

27

Operations on SetsOperations on Sets

• Set Difference

• Cartesian Product, Direct Product

E A B

E A B

a a a|

BAF

BAF

yxyx |,

Page 28: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

28

Special SetsSpecial Sets

• Powerset: set of all subsets of A

*no braces around the null set since the symbol represents the set

1,0,1,0,

then

1,0

let .,.

2 ,

A

A

A

P

ge

P ba

Page 29: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

29

Special SetsSpecial Sets

• Disjoint sets: A and B are disjoint if

• Cover:

A B

ii

if

all

set another covers

sets, ofset A

BA

A

B,BB 2,1

We know set covering problem from 572. It was defined as a matrix problem

Page 30: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

30

Properties of Operations on SetsProperties of Operations on Sets

• Commutative, Abelian

• Associative

• Distributive

A B B A

A B B A

A B C A B C

A B C A B C

LHD

RHD

A B C A B A C

A B C A C B C

Left hand distributive

Page 31: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

31

Partition of a SetPartition of a Set

• Properties

• pi are called “pi-blocks” or “-blocks” of PI

i

i

P

p

Ap

p

Ap|pA

c)

, b)

disjoint, are a)

and,

Page 32: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

32

Relations Between SetsRelations Between Sets

• If A and B are sets, then the relation from A to B,

is a subset of the Cartesian product of A and B, i.e.,

• R-related:

R:A B

R A B

not necessarily a proper subset

a b, R

Page 33: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

33

Domain of a RelationDomain of a Relation

BABA bbaa somefor ,|Dom RR :

a

A

B

b

Domain of R

R

Page 34: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

34

Range of a RelationRange of a Relation

Range for some R: RA B B A b a b a| ,

a

A

B

bR

Range of R

Page 35: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

35

Inverse Relation, R-1Inverse Relation, R-1

ABAB

BA

RR

R

baab ,|,

then

:

Given

1

a

bA

BR-1

Page 36: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

36

Partial Function, MappingPartial Function, Mapping

• A single-valued relation such that

if

and

then

a b

a b

b b

,

,

R

R

a

AB

b

b’

R

a’ *

* can be many to one

Page 37: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

37

Partial FunctionPartial Function

– Also called the Image of a under R

– Only one element of B for each element of A

– Single-valued

– Can be a many-to-one mapping

Page 38: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

38

FunctionFunction

• A partial function with – A b corresponds to each a, but only one b for

each a

– Possibly many-to-one: multiple a’s could map to the same b

ABA : Dom R

Page 39: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

39

Function ExampleFunction Example

wvvu

wvvu

wvu

,4,,3,,2,,1

or,

4,3,2,1

let then

,,4,3,2,1let

R

RRRR

BA

•Unique, one image for each element of A and no more•Defined for each element of A, so a function, not partial•Not one-to-one since 2 elements of A map to v

1 2 3 4

u v w

Page 40: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

40

Surjective (called also Onto) relationsSurjective (called also Onto) relations

• Range of the relation is B– At least one a is related to each b

• Does not imply – single-valued– one-to-one B

A a

R

1234

s1s2s3

Not mapped

Page 41: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

41

Injective, or One-to-One relationsInjective, or One-to-One relations

• “A relation between 2 sets such that pairs can be removed, one member from each set, until both sets have been simultaneously exhausted.”

given ,

and ',

then

a b

a b

a a

R

R

'

Page 42: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

43

BijectiveBijective

• A function which is both Injective and Surjective is Bijective.– Also called “one-to-one” and “onto”

• A bijective function has an inverse, R-1, and it is unique

Page 43: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

44

Function ExamplesFunction Examples

• Monotonically increasing

if injective

• Not one-to-one,

but single-valued

A

B

B

A

b

a a’

Page 44: 1 Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 1 khintz Adaptation to this.

45

Function ExamplesFunction Examples

• Multivalued, but one-to-one

A

B

a

b

b’

b’’

There are no two a’s which would have the same b, so it is one-to-one