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