Chapter 6: Recursion and Induction Flashcards

1
Q

Recursively define a list

A

base: []
step: s:l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is Lists_s

A

The set of all lists over set S

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is an operation defined on a list

A

Define base case, Define step case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Give the general structure of a proof by induction on lists

A

Base case: prove the statement for the case where all occurrences of l have been replaced with []

Ind Hypothesis: given statement holds for list l

Step case: prove the statement for the case where all occurrences of l have been replaced by s:l using the induction hypothesis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a full binary tree

A

Full: 0 children or most
Binary: at most two children
Tree: recursive data type made from nodes and edges

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give the recursive definition of a full binary tree

A

for every element s of S there is a tree s which is a node labelled s
For two given trees t, t’ labelled over S and an s in S there is a Tree_s(t, t’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do we define operations on trees?

A

Define what happens to Tree s

Define what happens to Tree_s(t, t’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe a proof by induction on trees

A

Base: show the statement holds for Tree s
Ind hypothesis: The statement holds for Tree t and Tree t’
Step case: show the statement holds for Tree_s(t, t’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Give the recursive definition of an ordered binary tree

A
Base: Tree_s is ordered for all s in N
Step: Trees_s(t, t') is ordered if:
    for every m in Labels(t) m <= s
    for every m' in Labels(t')  s <= m'
    t and t' are ordered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Give the recursive definition of a string

A

Base: elipson is a string
Step: if s is in S and w is a string, then ws is a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Give the recursive definition of logical propositions

A

Base: for every prop var Z, Z is a proposition
Step: if A and B are propositions:
not A, A and B, A or B, A implies B are propositions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe a proof by induction for propositions

A

Base case: show the statement holds for every propositional variable
Ind Hypothesis: assume the statement holds for A and B
Step case: Show that given the Ind Hyp, the statement holds for not A, A and B, A or B, A implies B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the base and step cases for regex?

A

Base: elipson, alphabet
Step: +, |, *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the base and step cases for a grammar?

A

Base: provided by start symbol
Step: provided by each production rule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the base and step cases of a parse tree?

A

Base: the tree corresponding to one node labelled S
Step: if R -> Y is a rule of the grammar and there is a leaf labelled R, add children to that leaf one for every symbol in Y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Give the recursive definition of the Natural numbers

A

Base case: there is a natural number 0

Step case: for each natural number n there is a natural number Sn, the successor of n

17
Q

How do we define operations on natural numbers?

A

Base: what to do with 0
Step: what to do with Sn

18
Q

Proof by induction with natural numbers?

A

Base: Replace Sm with 0
Ind Hypothesis: The statement works for Sn
Step: show it works for SSn