65. The truecase : produces the precondition {(x >= y && x == x) || (x < y && x == y)} which simplifies to {(x >= y && true) || false} and further simplifies to {x >= y} . Backing over the if condition, we get {(x >= y) && (x >= y)} which simplifies to {x >= y} . max = x; {(x >= y && max == x) || (x < y && max == y)} if (x >= y) { max = x; } else { max = y; } {(x >= y && max == x) || (x < y && max == y)} Conditional Statements (cont.)
66. The falsecase : produces the precondition {(x >= y && y == x) || (x < y && y == y)} which simplifies to {(y == x) || (x < y && true)} and further simplifies to {y >= x} . Backing over the negative of the if condition, we get {(y >= x) && (x < y)} which simplifies to {x < y} . max = y; {(x >= y && max == x) || (x < y && max == y)} if (x >= y) { max = x; } else { max = y; } {(x >= y && max == x) || (x < y && max == y)} Conditional Statements (cont.)
67. if (x >= y) { max = x; } else { max = y; } {(x >= y && max == x) || (x < y && max == y)} Combining the results of each pass, we get: {(x >= y) || (x < y)} Since this is always true, it means that the code segment produces the postcondition for all values of x and y . We write the precondition as simply true . Conditional Statements (cont.)