Proof: Maximum Example
Let's prove the following theorem:
maximum value in stack [ 2, [ 1, [ ] ] ] = 2
In this example, we prove that the maximum value of [2, [1, []]] is 2. We start with just the innermost element, which is 1. We know that the maximum of [1, []] is 1.
Next, we know that 2 is greater than the maximum of [1, []] since the maximum of [1, []] is 1 and 2 > 1. Then we conclude that the maximum of [2, [1, []]] is 2.
Proof:
# | Claim | Reason |
---|---|---|
1 | maximum value in stack [ 1, [ ] ] = 1 | maximum value in stack [ 1, [ ] ] = 1 |
2 | 2 > 1 | 2 > 1 |
3 | 2 > maximum value in stack [ 1, [ ] ] = 2 > 1 | if maximum value in stack [ 1, [ ] ] = 1, then 2 > maximum value in stack [ 1, [ ] ] = 2 > 1 |
4 | 2 > maximum value in stack [ 1, [ ] ] | if 2 > 1 and 2 > maximum value in stack [ 1, [ ] ] = 2 > 1, then 2 > maximum value in stack [ 1, [ ] ] |
5 | maximum value in stack [ 2, [ 1, [ ] ] ] = 2 | if 2 > maximum value in stack [ 1, [ ] ], then maximum value in stack [ 2, [ 1, [ ] ] ] = 2 |
Comments
Please log in to add comments