python: example dicho improved

parent c5d55701
...@@ -21,10 +21,10 @@ v = input("quelle valeur cherchez-vous : ") ...@@ -21,10 +21,10 @@ v = input("quelle valeur cherchez-vous : ")
l = 0 l = 0
u = n-1 u = n-1
r = -1 r = -1
while r == -1 and l <= u: while l <= u:
#@ invariant 0 <= l and u < n #@ invariant 0 <= l and u < n
#@ invariant -1 <= r < n #@ invariant r == -1
#@ invariant if r >= 0 then a[r] == v else forall i. 0 <= i < n -> a[i] == v -> l <= i <= u #@ invariant forall i. 0 <= i < n -> a[i] == v -> l <= i <= u
#@ variant u-l #@ variant u-l
m = (l + u) // 2 m = (l + u) // 2
#@ assert l <= m and m <= u #@ assert l <= m and m <= u
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment