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