标签: hoare-logic
就hoare逻辑而言,给定循环的循环不变性和变量应该是什么?
{真}
x := 0; y := 0; while (x < a) x := x + 2; y := y + 1;
{x = 2 ∗ y}
I thought of variant as (a-x)/2 and loop invariant as (x=2*y & x<=a)but is it correct?