mirror of
https://github.com/AdaCore/why3.git
synced 2026-02-12 12:34:55 -08:00
gallery: more proofs of termination
This commit is contained in:
@@ -43,9 +43,10 @@ module Decrease1
|
||||
let rec search_rec (a: array int) (i : int)
|
||||
requires { decrease1 a /\ 0 <= i }
|
||||
ensures {
|
||||
(result = -1 /\ forall j: int. i <= j < length a -> a[j] <> 0)
|
||||
\/ (i <= result < length a /\ a[result] = 0 /\
|
||||
forall j: int. i <= j < result -> a[j] <> 0) }
|
||||
(result = -1 /\ forall j: int. i <= j < length a -> a[j] <> 0)
|
||||
\/ (i <= result < length a /\ a[result] = 0 /\
|
||||
forall j: int. i <= j < result -> a[j] <> 0) }
|
||||
variant { length a - i }
|
||||
= if i < length a then
|
||||
if a[i] = 0 then i
|
||||
else if a[i] > 0 then search_rec a (i + a[i])
|
||||
|
||||
Reference in New Issue
Block a user