In this example, we prove that the length of the list [10, [12, [14,[]]]] is 3.

At each step, we pop an element from the front of the list and at the same time, increase the count by 1 (the count starts at 0). When the list is empty, we are done counting.

For instance, the following:

length of remaining stack [ 10, [ 12, [ 14, [ ] ] ] ] with count 0

is equal to:

length of remaining stack [ 12, [ 14, [ ] ] ] with count 1

which is equal to:

length of remaining stack [ 14, [ ] ] with count 2

which is equal to:

length of remaining stack [ ] with count 3

which is finally equal to 3

Quiz (1 point)

Prove that:
length of stack [ 10, [ 12, [ 14, [ ] ] ] ] = 3

The following properties may be helpful:

Please write your proof in the table below. Each row should contain one claim. The last claim is the statement that you are trying to prove.

Step Claim Reason (optional) Error Message (if any)
1
2
3
4
5
6
7
8
9
10

Become a subscriber to save your progress, see the correct answer, and more!