In this proof, we use the reverse list properties to move elements from the initial list to the result. In each iteration, an element is removed from the front of the initial list and added to the front of the result list. The proof is complete when all elements have moved to the result list.
Quiz (1 point)
Prove that:
reverse of [ 3, [ 2, [ 1, [ ] ] ] ] = [ 1, [ 2, [ 3, [ ] ] ] ]
The following properties may be helpful:
- reverse of xs = reverse of remaining stack xs and already reversed stack [ ]
- reverse of remaining stack [ x, xs ] and already reversed stack ys = reverse of remaining stack xs and already reversed stack [ x, ys ]
- reverse of remaining stack [ x, xs ] and already reversed stack ys = reverse of remaining stack xs and already reversed stack [ x, ys ]
- reverse of remaining stack [ x, [ ] ] and already reversed stack ys = [ x, ys ]
if the following are true:
- a = b
- b = c
then a = c
if the following are true:
- a = b
- b = c
then a = c
if the following are true:
- a = b
- b = c
then a = c
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.