packages feed

code-conjure-0.4.4: bench/terpret.out

TerpreT benchmark #1: invert

invert :: [Bool] -> [Bool]
-- testing 4 combinations of argument values
-- pruning with 41/51 rules
-- looking through 2 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 5 candidates of size 3
-- looking through 10 candidates of size 4
-- looking through 17 candidates of size 5
-- looking through 41 candidates of size 6
invert []  =  []
invert (p:ps)  =  not p:invert ps

TerpreT benchmark #2: prepend zero

prependZero :: [Bool] -> [Bool]
-- testing 3 combinations of argument values
-- pruning with 41/51 rules
-- looking through 2 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 5 candidates of size 3
prependZero ps  =  False:ps

TerpreT benchmark #3: binary decrement

decrement :: [Bool] -> [Bool]
-- testing 3 combinations of argument values
-- pruning with 41/51 rules
-- looking through 2 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 5 candidates of size 3
-- looking through 10 candidates of size 4
-- looking through 17 candidates of size 5
-- looking through 41 candidates of size 6
-- looking through 86 candidates of size 7
-- looking through 202 candidates of size 8
-- looking through 487 candidates of size 9
decrement []  =  []
decrement (p:ps)  =  not p:(if p then ps else decrement ps)

TerpreT benchmark #4: controlled shift

cshift :: (Bool,Bool,Bool) -> (Bool,Bool,Bool)
-- testing 4 combinations of argument values
-- pruning with 41/51 rules
-- reasoning produced 2 incorrect properties, please re-run with more tests for faster results
-- looking through 1 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 0 candidates of size 3
-- looking through 10 candidates of size 4
-- looking through 125 candidates of size 5
-- looking through 225 candidates of size 6
-- looking through 1075 candidates of size 7
-- looking through 2457 candidates of size 8
-- looking through 8154 candidates of size 9
-- looking through 27432 candidates of size 10
-- looking through 174839 candidates of size 11
cshift (p,q,r)  =  if p then (p,r,q) else (p,q,r)

cshift :: Bool -> Bool -> Bool -> (Bool,Bool,Bool)
-- testing 4 combinations of argument values
-- pruning with 41/51 rules
-- reasoning produced 2 incorrect properties, please re-run with more tests for faster results
-- looking through 0 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 0 candidates of size 3
-- looking through 125 candidates of size 4
-- looking through 225 candidates of size 5
-- looking through 1035 candidates of size 6
-- looking through 2457 candidates of size 7
-- looking through 20250 candidates of size 8
cshift False p q  =  (False,p,q)
cshift True p q  =  (True,q,p)

TerpreT benchmark #5: full adder

fadder :: Bool -> Bool -> Bool -> (Bool,Bool)
-- testing 8 combinations of argument values
-- pruning with 18/22 rules
-- looking through 0 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 9 candidates of size 3
-- looking through 18 candidates of size 4
-- looking through 45 candidates of size 5
-- looking through 108 candidates of size 6
-- looking through 300 candidates of size 7
-- looking through 816 candidates of size 8
-- looking through 2148 candidates of size 9
-- looking through 5520 candidates of size 10
-- looking through 13656 candidates of size 11
fadder p q r  =  if p == q then (p,r) else (r,not r)

TerpreT benchmark #6: 2-bit adder

adder2 :: (Bool,Bool) -> (Bool,Bool) -> (Bool,Bool,Bool)
-- testing 5 combinations of argument values
-- pruning with 74/92 rules
-- reasoning produced 2 incorrect properties, please re-run with more tests for faster results
-- looking through 0 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 0 candidates of size 3
-- looking through 8 candidates of size 4
-- looking through 128 candidates of size 5
-- looking through 408 candidates of size 6
cannot conjure

TerpreT benchmark #7: access

access :: [A] -> Int -> A
-- testing 5 combinations of argument values
-- pruning with 0/0 rules
-- looking through 0 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 1 candidates of size 3
xs `access` x  =  xs !! x

access :: [A] -> Int -> A
-- testing 5 combinations of argument values
-- pruning with 4/7 rules
-- looking through 1 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 3 candidates of size 3
-- looking through 7 candidates of size 4
-- looking through 19 candidates of size 5
-- looking through 23 candidates of size 6
-- looking through 68 candidates of size 7
[] `access` 0  =  undefined
[] `access` x  =  undefined
(x:xs) `access` 0  =  x
(x:xs) `access` y  =  xs `access` (y - 1)

TerpreT benchmark #8: decrement elements

decrelements :: [Int] -> [Int]
-- testing 3 combinations of argument values
-- pruning with 3/23 rules
-- looking through 2 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 3 candidates of size 3
-- looking through 7 candidates of size 4
-- looking through 9 candidates of size 5
-- looking through 29 candidates of size 6
-- looking through 41 candidates of size 7
decrelements []  =  []
decrelements (x:xs)  =  x - 1:decrelements xs

decrelements :: [Int] -> [Int]
-- testing 3 combinations of argument values
-- pruning with 5/26 rules
-- looking through 2 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 3 candidates of size 3
-- looking through 8 candidates of size 4
decrelements xs  =  map (subtract 1) xs