/
COMP 382 COMP 382

COMP 382 - PowerPoint Presentation

briana-ranney
briana-ranney . @briana-ranney
Follow
401 views
Uploaded On 2015-10-19

COMP 382 - PPT Presentation

Unit 1 Questions Swarat Chaudhuri amp John Greiner What do you need to do after class Do first assignment Take first quiz Sign up for tutorial section Read 10 chapters of textbook Response Counter ID: 165674

response counter cons case counter response case cons append list red blue empty yellow founded inductive relation order reverse

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "COMP 382" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

COMP 382Unit 1 Questions

Swarat

Chaudhuri & John GreinerSlide2

What do you need to do after class?

Do first assignment

Take first quiz

Sign up for tutorial sectionRead 10 chapters of textbook

Response CounterSlide3

List definition has how many cases?

1

2

34

Response CounterSlide4

f

unction append (x: List, y: List): List {

match x

case Empty => ???

case Cons(m, z) => ???

}

How to complete base case?

x

y

Empty

Response CounterSlide5

function append (x: List, y: List): List {

match x

case Empty => y

case Cons(m, z) => ???

}

How to complete inductive case?

Cons(m, append(x, z))

Cons(m, append(z, x))

Cons(m, append(y, z))

Cons(m, append(z, y))

Response CounterSlide6

function reverse (x: List): List {

match x

case Empty => Empty

case Cons(m, z) => ???

}

How to complete inductive case?

Cons(z, m)

a

ppend(z, m)

a

ppend(reverse(z), m)

a

ppend(reverse(z), Cons(m, Empty))

0 of 0Slide7

To prove:

is divisible by

, for

.

How many cases in inductive proof?

 

1

2

3

4

 

0 of 117Slide8

To prove:

is divisible by

, for

.

What is the inductive case?

 

If

, then

.

If

, then

.

 

Response CounterSlide9

To prove:

, for

.

What is base case?

 

 

Response CounterSlide10

< is a well-founded relation over

.

TrueFalse

Response CounterSlide11

 is a well-founded relation over

.

TrueFalse

Response CounterSlide12

< is a well-founded relation over

.

TrueFalse

Response CounterSlide13

Which is a well-founded relation on

ℕ×ℕ

?

iff

 

 

Response CounterSlide14

For chips puzzle, do induction on what?

Remove a red and anything → Put in none.

Remove two yellow → Put in 1 yellow, 5 blue.

Remove a blue and not red → Put in 10 red.Total # of chipsLex. order (#red, #yellow, #blue)

Lex. order (#blue, #yellow, #red)Lex. order (#yellow, #blue, #red)

Response CounterSlide15

Induction guarantees what for inductively-defined programs?

Termination

Correctness

Most efficient algorithmNo such general statement always holds

Response Counter