Proof: Pop Index Result Example 2
Let's prove the following theorem:
remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 0 and visited stack is [ ] = [ 2, [ 1, [ ] ] ]
Proof:
# | Claim | Reason |
---|---|---|
1 | remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 0 and visited stack is [ ] = reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) | remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 0 and visited stack is [ ] = reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) |
2 | result of dumping [ 2, [ 1, [ ] ] ] to [ ] = [ 1, [ 2, [ ] ] ] | result of dumping [ 2, [ 1, [ ] ] ] to [ ] = [ 1, [ 2, [ ] ] ] |
3 | reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) = reverse of [ 1, [ 2, [ ] ] ] | if result of dumping [ 2, [ 1, [ ] ] ] to [ ] = [ 1, [ 2, [ ] ] ], then reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) = reverse of [ 1, [ 2, [ ] ] ] |
4 | reverse of [ 1, [ 2, [ ] ] ] = [ 2, [ 1, [ ] ] ] | reverse of [ 1, [ 2, [ ] ] ] = [ 2, [ 1, [ ] ] ] |
5 | reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) = [ 2, [ 1, [ ] ] ] | if reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) = reverse of [ 1, [ 2, [ ] ] ] and reverse of [ 1, [ 2, [ ] ] ] = [ 2, [ 1, [ ] ] ], then reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) = [ 2, [ 1, [ ] ] ] |
6 | remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 0 and visited stack is [ ] = [ 2, [ 1, [ ] ] ] | if remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 0 and visited stack is [ ] = reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) and reverse of (result of dumping [ 2, [ 1, [ ] ] ] to [ ]) = [ 2, [ 1, [ ] ] ], then remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 0 and visited stack is [ ] = [ 2, [ 1, [ ] ] ] |
Comments
Please log in to add comments