1. | (for all x)[A(x) -> B(x)] | hyp |
2. | (there exists x)A(x) | hyp |
3. | A(s) | ei, 2 |
4. | A(s) -> B(s) | ui, 1 |
5. | B(s) | mp, 3,4 |
6. | (there exists x)B(x) | eg, 5 |
1. | (there exists x)(for all y)[M(x) /\ R(x,y)] | hyp |
2. | (for all x)(for all y)[R(x,y)-> T(x,y)] | hyp |
3. | (for all y)[M(s) /\ R(s,y)] | ei,1 |
4. | M(s) /\ R(s,y) | ui,3 |
5. | (for all y)[R(s,y)-> T(s,y)] | ui,2 |
6. | R(s,y)-> T(s,y) | ui,5 |
7. | R(s,y) | simp,4 |
8. | T(s,y) | mp,6,7 |
9. | M(s) | simp,4 |
10. | M(s) /\ T(s,y) | con,7,9 |
11. | (for all y)[M(s) /\ T(s,y)] | ug,10 |
12. | (there exists x)(for all y)[M(x) /\ T(x,y)] | eg,11 |
{z = 3} x := z + 1 y := x + 2 {y = 6} if y > 0 then z := y + 1 else z := 2 * y endif {z = 7}Given the precondition {z=3} and the postcondition {y=6}, working backwards, from y := x + 2, we get {x=4}. From x:=z+1, we get {z=3}, which is the precondition. The second part is checked analogously, by verifying the two Hoare triples: {y=6 /\ y>0}z:=y+1{z=7} and {y=6 /\ y<0}z:=2*y{z=7}. Note that the precondition in the second case is clearly contradictory, so we actually don't have to check anything.
n=2 | n2=4 >= 4 = 2n |
n=3 | n2=9 >= 8 = 2n |
n=4 | n2=16>= 16 = 2n. |
A = |
|
. |
x1+x2+···+xn< |
|
=A, |
A = |
|
< A |
|
= |
|
|||||||||||||
2 | = |
|
|||||||||||||
2 | = |
|
|||||||||||||
2q3 | = | p3 |