shrinking-challenge icon indicating copy to clipboard operation
shrinking-challenge copied to clipboard

difference challenge

Open kostis opened this issue 5 years ago • 6 comments

The difference challenge has various issues:

  • If we keep it, it should become one challenge, not many (also, its first sentence currently has an off-by-one error ;-) )
  • more importantly, its logic needs fixing, most likely by adding the appropriate "not"s (for example, [10,10] is not a falsified sample for the first property because the difference is 0 and, according to the phrasing, the property succeeds in this case).

I could have of course fixed "Test 1" myself, but I am not sure which one should be kept there -- or whether the challenge should be split into three.

Edit: As a more general comment, properties that are true when a disjunction (an or) is satisfied, are not suitable as shrinking challenges, I think. To falsify them, it's enough to invalidate only one of the conjuncts that their negation contains, not both!

kostis avatar Aug 27 '20 09:08 kostis

I agree with everything except - maybe - that a challenge must not have several parts. Why couldn't it if - as in this case - the parts are a variation of a theme?

jlink avatar Aug 27 '20 10:08 jlink

Sure, we can have that but, for presentation purposes in the various tables and such, it may be better to have them as difference-1, difference-2, etc. (Or find some other/better way to present these multi-part challenges.)

kostis avatar Aug 27 '20 10:08 kostis

I just hit probably the same problem.

In the first Difference problem, the smallest falsifiable example for (x,y) -> x < 10 || x == y should be (10,0), right? So either the smallest example or the property needs to change. In second, again it's (10,0). In third, again (10,0).

Looking at the jqwik implementation of the challenge, it indeed has a not on the right side of the ORs. (x,y) -> x < 10 || x /= y -> (10,10) (x,y) -> x < 10 || abs (x - y) < 1 || abs (x - y) > 4 -> (10,6) (x,y) -> x < 10 || abs (x - y) /= 1 -> (10,9)

Janiczek avatar Aug 27 '20 15:08 Janiczek

Looking at the jqwik implementation of the challenge, it indeed has a not on the right side of the ORs. (x,y) -> x < 10 || x /= y -> (10,10) (x,y) -> x < 10 || abs (x - y) < 1 || abs (x - y) > 4 -> (10,6) (x,y) -> x < 10 || abs (x - y) /= 1 -> (10,9)

That's how I intended it to be. The text is wrong.

jlink avatar Aug 27 '20 15:08 jlink

Why is it suggested that Test 3 is harder than Test 1, aren't they almost exactly the same?

flyingmutant avatar Mar 08 '21 15:03 flyingmutant

Well, it's my bias from how jqwik does shrinking. Equality was a special case so case 1 worked from the beginning. Case 3 required special tuning. But of course, this may be completly different in other implementations.

jlink avatar Mar 08 '21 15:03 jlink