shortest xs = foldr1 shorter (map path (permutations xs)) ;;
So, in particular, this example is genuinely higher order. Strangely
to me, it's counter satisfiable if I instead use
shortest = foldr1 shorter `o` map path `o` permutations ;;
for 'o' function composition. I use 'o' to define 'concatMap', which
is used indirectely by 'shortest'. Anyone see why the point-less
version would be different?
Out of 16 contracts I added, 14 are simple
Cf^n -> CF
annotations, which we think could be discovered automatically. The
two "non-trivial" contracts are
{-# CONTRACT
permutations ::: CF -> (CF&&{xs: not (null xs)})
#-};;
{-# CONTRACT
foldr1 ::: (CF -> CF -> CF) -> (CF&&{xs: not (null xs)}) -> CF
#-};;
I.e., 'permutations' is compatible with 'foldr1'.
Takes 69s to check all contracts, and 29s to check just 'shortest'.
Hopefully I actually implemented all these functions correctly ... the
patch is [2].
-nathan
[1] http://community.haskell.org/~ndm/darcs/catch/examples/Regress/Ant.hs
[2] https://github.com/cpa/haskellcontracts-examples/commit/a3178b9f9b455d162cb71a34ffa96384f2240096
Looked at the 'o' version a little with Dimtrios. We didn't figure
out yet, but the .tptp file is attached. We added an unhelpful
contract for 'o'
{-# CONTRACT
o ::: (CF -> CF) -> (CF -> CF) -> CF -> CF
#-};;
Great. It's good news that they all go through!
Simon