Proof: Reverse One Element List
Let's prove the following theorem:
reverse of [ x, [ ] ] = [ x, [ ] ]
Proof:
# | Claim | Reason |
---|---|---|
1 | reverse of [ x, [ ] ] = reverse of remaining stack [ x, [ ] ] and already reversed stack [ ] | reverse of [ x, [ ] ] = reverse of remaining stack [ x, [ ] ] and already reversed stack [ ] |
2 | reverse of remaining stack [ x, [ ] ] and already reversed stack [ ] = [ x, [ ] ] | reverse of remaining stack [ x, [ ] ] and already reversed stack [ ] = [ x, [ ] ] |
3 | reverse of [ x, [ ] ] = [ x, [ ] ] | if reverse of [ x, [ ] ] = reverse of remaining stack [ x, [ ] ] and already reversed stack [ ] and reverse of remaining stack [ x, [ ] ] and already reversed stack [ ] = [ x, [ ] ], then reverse of [ x, [ ] ] = [ x, [ ] ] |
Comments
Please log in to add comments