JetBrains-Research / HumanEval-Dafny

Translating humaneval into dafny
Apache License 2.0
4 stars 1 forks source link

013-greatest_common_divisor does not guarantee that result is the gcd #48

Open jesyspa opened 1 week ago

jesyspa commented 1 week ago

The postcondition does not relate the result to the inputs at all.

alex28sh commented 1 week ago

We could prove that gcd divides both a and b, like that https://gist.github.com/alex28sh/fc2608027fdb923b1f524fe7ccfad5d9

alex28sh commented 1 week ago

Though it requires some changes in code, it preserves the idea with modulo division

jesyspa commented 6 days ago

I think that would be an improvement, though proving it's the greatest such number would also be interesting. I'm not sure whether it's best to express divisibility by this kind of existence statement, or by n % k == 0, by the way.