Slide 1

Slide 1 text

Class 13: State Machines cs2102: Discrete Mathematics | F17 uvacs2102.github.io David Evans | University of Virginia Return Exam 1 Today No problem set due this week! PS6 will be posted soon and due Friday, Oct 20.

Slide 2

Slide 2 text

Plan State Machines Exam 1 Read this week: MCS Chapter 6

Slide 3

Slide 3 text

State Machine

Slide 4

Slide 4 text

Example = , = → , → ) =

Slide 5

Slide 5 text

M =

Slide 6

Slide 6 text

State Machine M = (, : × , ) ∈ ) What does it mean if is total?

Slide 7

Slide 7 text

State Machine M = (, : × , ) ∈ ) What does it mean if is not a function?

Slide 8

Slide 8 text

= = ) = Counter = (, : × , ) ∈ )

Slide 9

Slide 9 text

Is your computer a state machine?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

http://www.wolframalpha.com/input/?i=2%5E(2%5E41)

Slide 15

Slide 15 text

Modeling as State Machine

Slide 16

Slide 16 text

Modeling as State Machine How accurate is this model? How useful is this model?

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

State Machine Executions

Slide 19

Slide 19 text

State Machine Executions The execution of a state machine, = (, ⊆ ×, ) ∈ ) is a (possibly infinite) sequence of states, () , 3 , … , 5 ) that:

Slide 20

Slide 20 text

Two Steps Forward, One Step Back = ℕ =

Slide 21

Slide 21 text

Two Steps Forward, One Step Back = =

Slide 22

Slide 22 text

Reachable States A state is reachable if it appears in some execution. The execution of a state machine, = (, ⊆ ×, ) ∈ ) is a (possibly infinite) sequence of states, () , 3 , … , 5 ) that: 1. ) = ) (it begins with the start state) 2. ∀ ∈ 0, 1, … , − 1 . > → >?3 ∈ (if and are consecutive states in the sequence, there is an edge → ∈ .

Slide 23

Slide 23 text

= , ∈ ℤ, ∈ {, }} = , → + 1, ∈ ℤ} ∪ , → − 2, ∈ ℤ} ) = (0, ) What states are reachable?

Slide 24

Slide 24 text

= , ∈ ℤ, ∈ {, }} = , → + 1, ∈ ℤ} ∪ , → − 2, ∈ ℤ} ) = (0, )

Slide 25

Slide 25 text

Exam 1

Slide 26

Slide 26 text

0 20 40 60 80 <80 [80,85) [85,90) [90,95) [95,100) >=100 Exam 1 Histogram

Slide 27

Slide 27 text

Results by Question 0 (Name) 1 (Inference Rules) 2 (Satisfiability) 3 (Logical Equivalence) 4 (Well Ordering) 5 (Relations) 6 (Proofs) 7 (Induction) Average 30.0 9.374 9.887 9.947 8.632 8.726 8.252 8.792 Median 30 10 10 10 8 10 9 10

Slide 28

Slide 28 text

Proofs • To prove by induction, need to state a predicate with an induction variable • Need to write proofs to convince: showing the structure of your argument is more important than showing a bunch of algebra ∷= whatever is here must use n (and that is what you are doing induction on)

Slide 29

Slide 29 text

Returning Exam 1 Group 1 Group 2 Group 3 Group 4 aa8dp (Akanksha) ea6dc (Elmo) kai4vb (Kelsey) qed4wg (Quinn) aap7sc (Alex) eae4bf (Eliza) kc4au (Kunal) rac4ad (Raina) … … … … dz7as (Daniel) jyy3gx (Josh) pw2hm (Peter) zpg9js (Zach) Front of Classroom

Slide 30

Slide 30 text

Returning Exam 1 Group 1 Group 2 Group 3 Group 4 aa8dp (Akanksha) ea6dc (Elmo) kai4vb (Kelsey) qed4wg (Quinn) aap7sc (Alex) eae4bf (Eliza) kc4au (Kunal) rac4ad (Raina) … … … … dz7as (Daniel) jyy3gx (Josh) pw2hm (Peter) zpg9js (Zach) How can we efficiently sort ~80 people by UVA id? Front of Classroom

Slide 31

Slide 31 text

Returning Exam 1 Group 1 Group 2 Group 3 Group 4 aa8dp (Akanksha) ea6dc (Elmo) kai4vb (Kelsey) qed4wg (Quinn) aap7sc (Alex) eae4bf (Eliza) kc4au (Kunal) rac4ad (Raina) … … … … dz7as (Daniel) jyy3gx (Josh) pw2hm (Peter) zpg9js (Zach) Front of Classroom

Slide 32

Slide 32 text

Charge Read MCS Chapter 6 PS6 will be posted soon, due Oct 20