Proof: Reversing an Empty List
Let's prove the following theorem:
reverse of [ ] = [ ]
In this proof, we use the "Reversing a List" properties 1 and 2 prove that the reverse of an empty list is simply an empty list.
Proof:
# | Claim | Reason |
---|---|---|
1 | reverse of [ ] = reverse of remaining stack [ ] and already reversed stack [ ] | reverse of [ ] = reverse of remaining stack [ ] and already reversed stack [ ] |
2 | reverse of remaining stack [ ] and already reversed stack [ ] = [ ] | reverse of remaining stack [ ] and already reversed stack [ ] = [ ] |
3 | reverse of [ ] = [ ] | if reverse of [ ] = reverse of remaining stack [ ] and already reversed stack [ ] and reverse of remaining stack [ ] and already reversed stack [ ] = [ ], then reverse of [ ] = [ ] |
Comments
Please log in to add comments