Files
why3/examples/bts/587.mlw
MARCHE Claude 39a6cac355 Parser accepts ident after variant
propagate attributes on a variant to the enclosing formula
2023-04-04 12:34:26 +00:00

32 lines
781 B
Plaintext

use int.Int
let f () =
let ref x = 10 in
while x > 0 do
invariant I { 0 <= x <= 10 }
variant V { [@my_variant] [@expl:my_variant_decreases] x }
x <- x - 1
done
let g () =
let ref x = 10 in
let ref y = 10 in
while x > 0 || y > 0 do
invariant I1 { 0 <= x <= 10 }
invariant I2 { 0 <= y <= 10 }
variant V { ([@my_var_x] [@expl:my_var_x_decreases] x) ,
([@my_var_y] [@expl:my_var_y_decreases] y) }
if y > 0 then y <- y - 1 else
(x <- x - 1; y <- 10)
done
let rec h x y
requires R1 { 0 <= x <= 10 }
requires R2 { 0 <= y <= 10 }
variant V { ([@my_var_x] [@expl:my_var_x_decreases] x) ,
([@my_var_y] [@expl:my_var_y_decreases] y) }
= if x > 0 then
if y > 0 then h x (y - 1) else h (x-1) y
else 42