code-conjure 0.6.2 → 0.6.4
raw patch · 103 files changed
+2207/−1596 lines, 103 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Conjure: [maxPatternSize] :: Args -> Int
+ Conjure: [showRuntime] :: Args -> Bool
+ Conjure: [target] :: Args -> Int
+ Conjure.Conjurable: conjureCasesFor :: Conjurable f => f -> Expr -> [Expr]
+ Conjure.Engine: [maxPatternSize] :: Args -> Int
+ Conjure.Engine: [showRuntime] :: Args -> Bool
+ Conjure.Engine: [target] :: Args -> Int
- Conjure: Args :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Args
+ Conjure: Args :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Args
- Conjure.Conjurable: type Reification1 = (Expr, Maybe Expr, Maybe [[Expr]], [String], Bool, Expr)
+ Conjure.Conjurable: type Reification1 = (Expr, Maybe Expr, Maybe [[Expr]], [String], [Expr], Expr)
- Conjure.Engine: Args :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Args
+ Conjure.Engine: Args :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Args
Files
- .gitignore +5/−0
- Makefile +12/−3
- TODO.md +51/−0
- bench/carry-on.txt +11/−11
- bench/gps.hs +5/−5
- bench/gps.txt +289/−289
- bench/gps2.hs +4/−3
- bench/gps2.txt +189/−191
- bench/ill-hit.txt +10/−10
- bench/lowtests.hs +1/−1
- bench/lowtests.txt +47/−35
- bench/p12.txt +6/−6
- bench/runtime/lapmatrud/bench/candidates.runtime +1/−1
- bench/runtime/lapmatrud/bench/erroneous.runtime +1/−1
- bench/runtime/lapmatrud/bench/gps.runtime +1/−1
- bench/runtime/lapmatrud/bench/gps2.runtime +1/−1
- bench/runtime/lapmatrud/bench/lowtests.runtime +1/−1
- bench/runtime/lapmatrud/bench/redundants.runtime +1/−1
- bench/runtime/lapmatrud/bench/terpret.runtime +1/−1
- bench/runtime/lapmatrud/bench/unique.runtime +1/−1
- bench/runtime/lapmatrud/eg/arith.runtime +1/−1
- bench/runtime/lapmatrud/eg/bits.runtime +1/−1
- bench/runtime/lapmatrud/eg/bools.runtime +1/−1
- bench/runtime/lapmatrud/eg/bst.runtime +1/−1
- bench/runtime/lapmatrud/eg/count.runtime +1/−1
- bench/runtime/lapmatrud/eg/dupos.runtime +1/−1
- bench/runtime/lapmatrud/eg/factorial.runtime +1/−1
- bench/runtime/lapmatrud/eg/fib01.runtime +1/−1
- bench/runtime/lapmatrud/eg/fibonacci.runtime +1/−1
- bench/runtime/lapmatrud/eg/list.runtime +1/−1
- bench/runtime/lapmatrud/eg/maybe.runtime +1/−1
- bench/runtime/lapmatrud/eg/oddeven.runtime +1/−1
- bench/runtime/lapmatrud/eg/peano.runtime +1/−0
- bench/runtime/lapmatrud/eg/pow.runtime +1/−1
- bench/runtime/lapmatrud/eg/setelem.runtime +1/−1
- bench/runtime/lapmatrud/eg/sort.runtime +1/−1
- bench/runtime/lapmatrud/eg/subset.runtime +1/−1
- bench/runtime/lapmatrud/eg/take-drop.runtime +1/−1
- bench/runtime/lapmatrud/eg/these.runtime +1/−0
- bench/runtime/lapmatrud/eg/tree.runtime +1/−1
- bench/runtime/lapmatrud/eg/tri.runtime +1/−1
- bench/runtime/zero/bench/candidates.runtime +1/−1
- bench/runtime/zero/bench/erroneous.runtime +1/−1
- bench/runtime/zero/bench/gps.runtime +1/−1
- bench/runtime/zero/bench/gps2.runtime +1/−1
- bench/runtime/zero/bench/lowtests.runtime +1/−1
- bench/runtime/zero/bench/terpret.runtime +1/−1
- bench/runtime/zero/bench/weird.runtime +1/−1
- bench/runtime/zero/eg/bst.runtime +1/−1
- bench/runtime/zero/eg/dupos.runtime +1/−1
- bench/runtime/zero/eg/oddeven.runtime +1/−1
- bench/runtime/zero/eg/peano.runtime +1/−0
- bench/runtime/zero/eg/sort.runtime +1/−1
- bench/runtime/zero/eg/subset.runtime +1/−1
- bench/runtime/zero/eg/these.runtime +1/−0
- bench/self.txt +12/−12
- bench/strategies.txt +63/−63
- bench/terpret.hs +1/−1
- bench/terpret.txt +72/−72
- bench/weird.txt +13/−13
- changelog.md +12/−0
- code-conjure.cabal +3/−2
- eg/arith.txt +26/−26
- eg/bits.txt +16/−16
- eg/bools.txt +18/−18
- eg/bst.hs +4/−1
- eg/bst.txt +81/−82
- eg/colin/ListFuns.hs +107/−101
- eg/colin/ListFuns.txt +110/−0
- eg/count.txt +16/−16
- eg/dupos.hs +3/−4
- eg/dupos.txt +48/−48
- eg/either.txt +14/−14
- eg/factorial.txt +13/−13
- eg/fib01.txt +6/−6
- eg/fibonacci.txt +12/−12
- eg/gcd.txt +6/−6
- eg/higher.txt +34/−34
- eg/id.txt +2/−2
- eg/ints.txt +25/−25
- eg/list.txt +55/−55
- eg/maybe.txt +18/−18
- eg/oddeven.txt +24/−24
- eg/peano.hs +50/−0
- eg/peano.txt +25/−0
- eg/pow.txt +14/−14
- eg/replicate.txt +26/−26
- eg/setelem.txt +16/−16
- eg/sort.hs +5/−5
- eg/sort.txt +76/−80
- eg/spec.txt +17/−17
- eg/subset.txt +13/−13
- eg/take-drop.txt +16/−16
- eg/tapps.txt +13/−13
- eg/these.hs +110/−0
- eg/these.txt +99/−0
- eg/tree.hs +3/−0
- eg/tree.txt +83/−83
- eg/tri.txt +7/−7
- mk/depend.mk +34/−0
- src/Conjure/Conjurable.hs +21/−5
- src/Conjure/Conjurable/Derive.hs +18/−1
- src/Conjure/Engine.hs +74/−23
.gitignore view
@@ -28,6 +28,9 @@ **.runtimes +# text output with runtimes+.*.txt+ # benches, prototypes and test programs eg/arith eg/bools@@ -57,6 +60,8 @@ eg/colin/*Funs eg/tri eg/bits+eg/peano+eg/these bench/carry-on bench/strategies bench/self
Makefile view
@@ -47,6 +47,8 @@ eg/bst \ eg/tri \ eg/bits \+ eg/peano \+ eg/these \ bench/candidates \ bench/redundants \ bench/erroneous \@@ -73,6 +75,8 @@ test/red \ test/utils +RMTIME = sed 's/^-- [0-9.]*s, /-- /'+ all: mk/toplibs all-all: all $(EG) $(TESTS)@@ -140,14 +144,19 @@ %.run: % ./$< -%.txt: %+.PRECIOUS: .%.txt # prevent deletion by make++.%.txt: % ./$< >$@ +%.txt: .%.txt+ $(RMTIME) $< >$@+ %.tee: %- $(LONG) unbuffer ./$< | tee $<.txt+ $(LONG) unbuffer ./$< | $(RMTIME) -u | tee $<.txt %.diff: %- ./$< | diff -rud $<.txt -+ ./$< | $(RMTIME) | diff -rud $<.txt - # lists files missing copyright notices list-missing-copyright:
TODO.md view
@@ -3,11 +3,62 @@ A non-exhaustive list of things TO DO for Conjure. +* fix targetiers' lazyness++* rewrite after filling in recursions++* Better error reporting when `Listable` is out-of-scope when using `deriveConjurable`.+ This needs to be implemented on LeanCheck itself.+ * forbid recursion into negatives * consider the size of patterns to thin-out each size partition * consider non top-level cases+++## Rewrite after filling in recursions++When Conjure conjures length, it does it like so:++ length [] = 0+ length (x:xs) = length xs + 1++However, the following would precede in term-rewriting order:++ length [] = 0+ length (x:xs) = 1 + length xs++The problem is that `_ + 1` precedes `1 + _` in our term rewriting order,+so when we do the recursion fillings, we get the first version not the second.++Rewriting after filling in recursions would make it so that we get the wanted+second.++There's an opportunity for a late pruning rule here:++If we rewrite any of the RHS to a smaller expression. We can prune away that+candidate. Considering sub from `eg/colin/ListFuns.hs`:++We encounter the following candidate:++ sub xs [] = True+ sub xs (x:ys) = sub ys ys && sub ys ys++It can be pruned away by simplifying the last RHS to `sub ys ys`:+`p && p` is `p`!+We need to do this pruning in the `fillingsFor` for the most performance gain.++Beware,+we can't really just check for normality: as we can have:++ length xs + 1++without having++ 1 + length xs++We may rewrite to a term of the same size that would not be generated! ## Forbid recursion into negatives
bench/carry-on.txt view
@@ -1,23 +1,23 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 28 candidates of size 5--- looking through 35 candidates of size 6--- looking through 167 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 35 candidates of size 6+-- 167 candidates of size 7 -- tested 95 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) --- looking through 203 candidates of size 8+-- 203 candidates of size 8 -- tested 254 candidates factorial 1 = 1 factorial x = x * factorial (x - 1) --- looking through 1048 candidates of size 9+-- 1048 candidates of size 9 -- tested 547 candidates factorial 0 = 0 factorial 1 = 1@@ -28,8 +28,8 @@ factorial 1 = 1 factorial x = x * factorial (x - 1) --- looking through 1301 candidates of size 10--- looking through 7201 candidates of size 11+-- 1301 candidates of size 10+-- 7201 candidates of size 11 -- tested 3216 candidates factorial 0 = 1 factorial x = x + x * (factorial (x - 1) - 1)
bench/gps.hs view
@@ -345,7 +345,7 @@ gps10c :: IO () gps10c = do- conjureWith args{maxSize=14} "wallisNext" wallisNextP+ conjure "wallisNext" wallisNextP [ pr (1 :: Integer) , pr (2 :: Integer) , prim "+" ((+) :: Integer -> Integer -> Integer)@@ -504,7 +504,7 @@ -- hah! I was expecting Conjure to use an if like above, but it was smarter: -- gps14 [] = 0 -- gps14 (x:xs) = x `mod` 2 + gps14 xs- conjureWith args{maxSize=13} "gps14" gps14p+ conjure "gps14" gps14p [ pr (0 :: Int) , pr (1 :: Int) , pr (2 :: Int)@@ -679,7 +679,7 @@ gps20c :: IO () gps20c = do- conjureWith args{maxSize=22} "isVowel" isVowel'+ conjure "isVowel" isVowel' [ pr 'a' , pr 'e' , pr 'i'@@ -690,7 +690,7 @@ , pr False ] - conjureFromSpecWith args{maxSize=14} "pig1" pig1Spec+ conjureFromSpecWith args{target=50400} "pig1" pig1Spec [ pr "ay" , prif (undefined :: String) , prim "isVowel" isVowel@@ -819,7 +819,7 @@ -- out of reach performance-wise gps25c :: IO ()-gps25c = conjureWith args{maxSize=20} "gps25" gps25p $ take 0+gps25c = conjure "gps25" gps25p $ take 0 [ pr (0 :: Int) , pr (10 :: Int) , pr ([] :: [Int])
bench/gps.txt view
@@ -1,29 +1,29 @@ gps1 :: Int -> Float -> Float -- testing 4 combinations of argument values -- pruning with 0/5 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 2 candidates of size 4+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 2 candidates of size 4 -- tested 4 candidates gps1 x y = fromIntegral x + y gps2 :: Int -> Maybe [Char] -- testing 6 combinations of argument values -- pruning with 9/17 rules--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 3 candidates of size 3--- looking through 2 candidates of size 4--- looking through 2 candidates of size 5--- looking through 0 candidates of size 6--- looking through 32 candidates of size 7--- looking through 32 candidates of size 8--- looking through 48 candidates of size 9--- looking through 32 candidates of size 10--- looking through 16 candidates of size 11--- looking through 512 candidates of size 12--- looking through 1408 candidates of size 13+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 3 candidates of size 3+-- 2 candidates of size 4+-- 2 candidates of size 5+-- 0 candidates of size 6+-- 32 candidates of size 7+-- 32 candidates of size 8+-- 48 candidates of size 9+-- 32 candidates of size 10+-- 16 candidates of size 11+-- 512 candidates of size 12+-- 1408 candidates of size 13 -- tested 1171 candidates gps2 x = if 2000 <= x then Just "large"@@ -32,178 +32,178 @@ gps3 :: Int -> Int -> Int -> [Int] -- testing 2 combinations of argument values -- pruning with 11/33 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 64 candidates of size 4--- looking through 0 candidates of size 5--- looking through 1248 candidates of size 6--- looking through 0 candidates of size 7--- looking through 18672 candidates of size 8+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 64 candidates of size 4+-- 0 candidates of size 5+-- 1248 candidates of size 6+-- 0 candidates of size 7+-- 18672 candidates of size 8 -- tested 12358 candidates gps3 x y z = enumFromThenTo x (x + z) (y - 1) gps3 :: Int -> Int -> Int -> [Int] -- testing 2 combinations of argument values -- pruning with 6/18 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 3 candidates of size 3--- looking through 0 candidates of size 4--- looking through 15 candidates of size 5--- looking through 0 candidates of size 6--- looking through 81 candidates of size 7--- looking through 36 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 0 candidates of size 4+-- 15 candidates of size 5+-- 0 candidates of size 6+-- 81 candidates of size 7+-- 36 candidates of size 8 -- tested 136 candidates cannot conjure gps4 :: [Char] -> [Char] -> [Char] -> Bool -- testing 9 combinations of argument values -- pruning with 11/15 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 6 candidates of size 5--- looking through 0 candidates of size 6--- looking through 0 candidates of size 7--- looking through 0 candidates of size 8--- looking through 102 candidates of size 9--- looking through 30 candidates of size 10--- looking through 15 candidates of size 11+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 6 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 0 candidates of size 8+-- 102 candidates of size 9+-- 30 candidates of size 10+-- 15 candidates of size 11 -- tested 141 candidates gps4 cs ds es = length cs < length ds && length ds < length es gps5 :: [Char] -> [Char] -- testing 5 combinations of argument values -- pruning with 2/3 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 4 candidates of size 5--- looking through 13 candidates of size 6+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 4 candidates of size 5+-- 13 candidates of size 6 -- tested 28 candidates cannot conjure gps6 :: Int -> Int -- testing 9 combinations of argument values -- pruning with 16/18 rules--- looking through 4 candidates of size 1--- looking through 2 candidates of size 2--- looking through 14 candidates of size 3--- looking through 14 candidates of size 4--- looking through 186 candidates of size 5--- looking through 165 candidates of size 6+-- 4 candidates of size 1+-- 2 candidates of size 2+-- 14 candidates of size 3+-- 14 candidates of size 4+-- 186 candidates of size 5+-- 165 candidates of size 6 -- tested 385 candidates cannot conjure gps7 :: [Char] -> ([Char],Int) -- testing 4 combinations of argument values -- pruning with 5/10 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 2 candidates of size 5--- looking through 7 candidates of size 6--- looking through 16 candidates of size 7--- looking through 39 candidates of size 8--- looking through 88 candidates of size 9--- looking through 201 candidates of size 10--- looking through 442 candidates of size 11+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 2 candidates of size 5+-- 7 candidates of size 6+-- 16 candidates of size 7+-- 39 candidates of size 8+-- 88 candidates of size 9+-- 201 candidates of size 10+-- 442 candidates of size 11 -- tested 546 candidates gps7 cs = (init (unlines (words cs)),length (filter (not . isSpace) cs)) gps8 :: [Char] -> [Char] -> [(Int,Char,Char)] -- testing 3 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 0 candidates of size 3--- looking through 0 candidates of size 4+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4 -- tested 0 candidates cannot conjure gps9 :: Int -> [Int] -- testing 3 combinations of argument values -- pruning with 13/14 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 4 candidates of size 3--- looking through 4 candidates of size 4--- looking through 10 candidates of size 5--- looking through 21 candidates of size 6--- looking through 30 candidates of size 7--- looking through 77 candidates of size 8--- looking through 134 candidates of size 9--- looking through 245 candidates of size 10+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 4 candidates of size 3+-- 4 candidates of size 4+-- 10 candidates of size 5+-- 21 candidates of size 6+-- 30 candidates of size 7+-- 77 candidates of size 8+-- 134 candidates of size 9+-- 245 candidates of size 10 -- tested 306 candidates gps9 x = filter even (filter (x >) (map sq [1..x])) wallisNext :: Ratio Integer -> Ratio Integer -- testing 6 combinations of argument values -- pruning with 37/64 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 3 candidates of size 3--- looking through 15 candidates of size 4--- looking through 4 candidates of size 5--- looking through 86 candidates of size 6--- looking through 5 candidates of size 7--- looking through 513 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 15 candidates of size 4+-- 4 candidates of size 5+-- 86 candidates of size 6+-- 5 candidates of size 7+-- 513 candidates of size 8 -- tested 564 candidates wallisNext (x % y) = (y + 1) % (x + 1) wallisNext :: Ratio Integer -> Ratio Integer -- testing 6 combinations of argument values -- pruning with 15/26 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 4 candidates of size 3--- looking through 16 candidates of size 4--- looking through 3 candidates of size 5--- looking through 71 candidates of size 6--- looking through 5 candidates of size 7--- looking through 393 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 4 candidates of size 3+-- 16 candidates of size 4+-- 3 candidates of size 5+-- 71 candidates of size 6+-- 5 candidates of size 7+-- 393 candidates of size 8 -- tested 451 candidates wallisNext (x % y) = (y + 1) % (x + 1) gps10 :: Int -> Ratio Integer -- testing 6 combinations of argument values -- pruning with 3/4 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 3 candidates of size 3--- looking through 3 candidates of size 4--- looking through 2 candidates of size 5--- looking through 5 candidates of size 6--- looking through 8 candidates of size 7--- looking through 13 candidates of size 8+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 3 candidates of size 4+-- 2 candidates of size 5+-- 5 candidates of size 6+-- 8 candidates of size 7+-- 13 candidates of size 8 -- tested 33 candidates gps10 x = product (take x (iterate wallisNext (2 % 3))) gps11 :: [[Char]] -> [Int] -- testing 4 combinations of argument values -- pruning with 1/1 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 1 candidates of size 3--- looking through 1 candidates of size 4+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4 -- tested 2 candidates gps11 css = reverse (map length css) gps11 :: [[Char]] -> [Int] -- testing 4 combinations of argument values -- pruning with 4/4 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 1 candidates of size 5--- looking through 2 candidates of size 6--- looking through 0 candidates of size 7--- looking through 2 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 1 candidates of size 5+-- 2 candidates of size 6+-- 0 candidates of size 7+-- 2 candidates of size 8 -- tested 5 candidates gps11 [] = [] gps11 (cs:css) = gps11 css ++ [length cs]@@ -211,65 +211,65 @@ gps12 :: [Int] -> Int -- testing 6 combinations of argument values -- pruning with 13/27 rules--- looking through 2 candidates of size 1--- looking through 5 candidates of size 2--- looking through 2 candidates of size 3--- looking through 9 candidates of size 4--- looking through 22 candidates of size 5--- looking through 41 candidates of size 6--- looking through 125 candidates of size 7--- looking through 262 candidates of size 8--- looking through 816 candidates of size 9--- looking through 1996 candidates of size 10--- looking through 5925 candidates of size 11+-- 2 candidates of size 1+-- 5 candidates of size 2+-- 2 candidates of size 3+-- 9 candidates of size 4+-- 22 candidates of size 5+-- 41 candidates of size 6+-- 125 candidates of size 7+-- 262 candidates of size 8+-- 816 candidates of size 9+-- 1996 candidates of size 10+-- 5925 candidates of size 11 -- tested 6320 candidates gps12 xs = (length xs - fromJust (findIndex (0 ==) (reverse xs))) - 1 gps13 :: [Ratio Integer] -> Ratio Integer -- testing 3 combinations of argument values -- pruning with 4/8 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 2 candidates of size 3--- looking through 10 candidates of size 4--- looking through 13 candidates of size 5--- looking through 51 candidates of size 6--- looking through 103 candidates of size 7--- looking through 360 candidates of size 8+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 10 candidates of size 4+-- 13 candidates of size 5+-- 51 candidates of size 6+-- 103 candidates of size 7+-- 360 candidates of size 8 -- tested 267 candidates gps13 qs = foldr (+) 0 qs / fromIntegral (length qs) odd :: Int -> Bool -- testing 6 combinations of argument values -- pruning with 12/13 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 3 candidates of size 3--- looking through 2 candidates of size 4--- looking through 37 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 2 candidates of size 4+-- 37 candidates of size 5 -- tested 17 candidates odd x = 0 /= x `mod` 2 gps14 :: [Int] -> Int -- testing 3 combinations of argument values -- pruning with 1/1 rules--- looking through 0 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4+-- 0 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4 -- tested 2 candidates gps14 xs = length (filter odd xs) gps14 :: [Int] -> Int -- testing 3 combinations of argument values -- pruning with 39/58 rules--- looking through 3 candidates of size 1--- looking through 9 candidates of size 2--- looking through 0 candidates of size 3--- looking through 27 candidates of size 4--- looking through 30 candidates of size 5--- looking through 240 candidates of size 6--- looking through 453 candidates of size 7+-- 3 candidates of size 1+-- 9 candidates of size 2+-- 0 candidates of size 3+-- 27 candidates of size 4+-- 30 candidates of size 5+-- 240 candidates of size 6+-- 453 candidates of size 7 -- tested 353 candidates gps14 [] = 0 gps14 (x:xs) = x + gps14 xs `mod` 2@@ -277,36 +277,36 @@ gps15 :: [Int] -> [Int] -> Bool -- testing 5 combinations of argument values -- pruning with 3/7 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 1 candidates of size 3--- looking through 4 candidates of size 4+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3+-- 4 candidates of size 4 -- tested 3 candidates gps15 xs ys = xs == reverse ys gps16 :: [Char] -> [Char] -> Bool -- testing 6 combinations of argument values -- pruning with 3/3 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 2 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 2 candidates of size 5 -- tested 9 candidates gps16 cs ds = sort cs `isSubsequenceOf` sort ds gps17 :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 28 candidates of size 5--- looking through 35 candidates of size 6--- looking through 167 candidates of size 7--- looking through 203 candidates of size 8--- looking through 1048 candidates of size 9+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 35 candidates of size 6+-- 167 candidates of size 7+-- 203 candidates of size 8+-- 1048 candidates of size 9 -- tested 466 candidates gps17 0 = 0 gps17 x = gps17 (x - 1) + x * x@@ -314,15 +314,15 @@ gps18 :: [Int] -> [Int] -> [Int] -- testing 3 combinations of argument values -- pruning with 2/6 rules--- looking through 3 candidates of size 1--- looking through 8 candidates of size 2--- looking through 11 candidates of size 3--- looking through 23 candidates of size 4--- looking through 86 candidates of size 5--- looking through 84 candidates of size 6--- looking through 354 candidates of size 7--- looking through 353 candidates of size 8--- looking through 1528 candidates of size 9+-- 3 candidates of size 1+-- 8 candidates of size 2+-- 11 candidates of size 3+-- 23 candidates of size 4+-- 86 candidates of size 5+-- 84 candidates of size 6+-- 354 candidates of size 7+-- 353 candidates of size 8+-- 1528 candidates of size 9 -- tested 1409 candidates gps18 [] xs = xs gps18 (x:xs) [] = xs@@ -331,46 +331,46 @@ gps18 :: [Int] -> [Int] -> [Int] -- testing 3 combinations of argument values -- pruning with 2/7 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 1 candidates of size 3--- looking through 10 candidates of size 4+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 1 candidates of size 3+-- 10 candidates of size 4 -- tested 13 candidates gps18 xs ys = zipWith (+) xs ys gps19 :: Int -> [Char] -> [Char] -- testing 2 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2+-- 1 candidates of size 1+-- 0 candidates of size 2 -- tested 1 candidates cannot conjure isVowel :: Char -> Bool -- testing 12 combinations of argument values -- pruning with 0/0 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 2 candidates of size 4--- looking through 2 candidates of size 5--- looking through 3 candidates of size 6--- looking through 4 candidates of size 7--- looking through 4 candidates of size 8--- looking through 4 candidates of size 9--- looking through 5 candidates of size 10--- looking through 5 candidates of size 11--- looking through 5 candidates of size 12--- looking through 5 candidates of size 13--- looking through 4 candidates of size 14--- looking through 4 candidates of size 15--- looking through 4 candidates of size 16--- looking through 3 candidates of size 17--- looking through 2 candidates of size 18--- looking through 2 candidates of size 19--- looking through 1 candidates of size 20--- looking through 1 candidates of size 21--- looking through 1 candidates of size 22+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 2 candidates of size 4+-- 2 candidates of size 5+-- 3 candidates of size 6+-- 4 candidates of size 7+-- 4 candidates of size 8+-- 4 candidates of size 9+-- 5 candidates of size 10+-- 5 candidates of size 11+-- 5 candidates of size 12+-- 5 candidates of size 13+-- 4 candidates of size 14+-- 4 candidates of size 15+-- 4 candidates of size 16+-- 3 candidates of size 17+-- 2 candidates of size 18+-- 2 candidates of size 19+-- 1 candidates of size 20+-- 1 candidates of size 21+-- 1 candidates of size 22 -- tested 65 candidates isVowel 'a' = True isVowel 'e' = True@@ -382,20 +382,20 @@ pig1 :: [Char] -> [Char] -- pruning with 5/5 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 4 candidates of size 3--- looking through 8 candidates of size 4--- looking through 13 candidates of size 5--- looking through 28 candidates of size 6--- looking through 46 candidates of size 7--- looking through 126 candidates of size 8--- looking through 200 candidates of size 9--- looking through 631 candidates of size 10--- looking through 1068 candidates of size 11--- looking through 3495 candidates of size 12--- looking through 6381 candidates of size 13--- looking through 20409 candidates of size 14+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3+-- 8 candidates of size 4+-- 13 candidates of size 5+-- 28 candidates of size 6+-- 46 candidates of size 7+-- 126 candidates of size 8+-- 200 candidates of size 9+-- 631 candidates of size 10+-- 1068 candidates of size 11+-- 3495 candidates of size 12+-- 6381 candidates of size 13+-- 20409 candidates of size 14 -- tested 27895 candidates pig1 "" = "ay" pig1 (c:cs) = if isVowel c@@ -404,95 +404,95 @@ gps20c :: [Char] -> [Char] -- pruning with 1/1 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 2 candidates of size 3--- looking through 3 candidates of size 4--- looking through 5 candidates of size 5+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 3 candidates of size 4+-- 5 candidates of size 5 -- tested 12 candidates gps20c cs = unwords (map pig1 (words cs)) gps21 :: [Int] -> [Int] -- testing 4 combinations of argument values -- pruning with 4/4 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 4 candidates of size 5--- looking through 13 candidates of size 6--- looking through 8 candidates of size 7--- looking through 30 candidates of size 8--- looking through 24 candidates of size 9--- looking through 65 candidates of size 10+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 4 candidates of size 5+-- 13 candidates of size 6+-- 8 candidates of size 7+-- 30 candidates of size 8+-- 24 candidates of size 9+-- 65 candidates of size 10 -- tested 92 candidates gps21 [] = [] gps21 (x:xs) = (if x < 0 then 0 else x):gps21 xs gps22 :: [Char] -> Int -- pruning with 5/9 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 1 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 3 candidates of size 6+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 3 candidates of size 6 -- tested 4 candidates gps22 "" = 0 gps22 (c:cs) = gps22 cs + scrabble1 c gps23 :: [Char] -> ([(Int,Int)],Int,Double) -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2+-- 0 candidates of size 1+-- 0 candidates of size 2 -- tested 0 candidates cannot conjure gps24 :: [Char] -> Char -- testing 4 combinations of argument values -- pruning with 15/19 rules--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 3 candidates of size 3--- looking through 2 candidates of size 4--- looking through 8 candidates of size 5--- looking through 13 candidates of size 6--- looking through 30 candidates of size 7--- looking through 75 candidates of size 8--- looking through 194 candidates of size 9--- looking through 470 candidates of size 10+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 3 candidates of size 3+-- 2 candidates of size 4+-- 8 candidates of size 5+-- 13 candidates of size 6+-- 30 candidates of size 7+-- 75 candidates of size 8+-- 194 candidates of size 9+-- 470 candidates of size 10 -- tested 456 candidates gps24 cs = chr (ord ' ' + sum (map ord cs) `mod` 64) gps25 :: Int -> [Int] -- testing 4 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1+-- 0 candidates of size 1 -- tested 0 candidates cannot conjure gps26 :: Int -> Int -> Int -> Int -> Int -> Char -- testing 5 combinations of argument values -- pruning with 4/4 rules--- looking through 5 candidates of size 1--- looking through 0 candidates of size 2+-- 5 candidates of size 1+-- 0 candidates of size 2 -- tested 5 candidates cannot conjure gps27 :: Int -> Int -> Int -> Int -- testing 3 combinations of argument values -- pruning with 14/18 rules--- looking through 3 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 36 candidates of size 6--- looking through 0 candidates of size 7--- looking through 0 candidates of size 8--- looking through 0 candidates of size 9--- looking through 90 candidates of size 10--- looking through 2592 candidates of size 11+-- 3 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 36 candidates of size 6+-- 0 candidates of size 7+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 90 candidates of size 10+-- 2592 candidates of size 11 -- tested 1489 candidates gps27 x y z = if x < y then if y < z then y else z@@ -501,38 +501,38 @@ gps27b :: Int -> Int -> Int -> Int -- testing 3 combinations of argument values -- pruning with 20/30 rules--- looking through 3 candidates of size 1--- looking through 0 candidates of size 2--- looking through 6 candidates of size 3--- looking through 0 candidates of size 4--- looking through 12 candidates of size 5+-- 3 candidates of size 1+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 12 candidates of size 5 -- tested 15 candidates gps27b x y z = min z (max x y) gps28 :: Int -> Int -> Int -> Int -> Int -- testing 5 combinations of argument values -- pruning with 6/10 rules--- looking through 4 candidates of size 1--- looking through 0 candidates of size 2--- looking through 6 candidates of size 3--- looking through 0 candidates of size 4--- looking through 12 candidates of size 5--- looking through 0 candidates of size 6--- looking through 36 candidates of size 7+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 12 candidates of size 5+-- 0 candidates of size 6+-- 36 candidates of size 7 -- tested 25 candidates gps28 x y z x' = x `min` (y `min` (z `min` x')) gps29 :: [Char] -> Int -- pruning with 7/11 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 2 candidates of size 5--- looking through 6 candidates of size 6--- looking through 10 candidates of size 7--- looking through 10 candidates of size 8--- looking through 24 candidates of size 9+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 2 candidates of size 5+-- 6 candidates of size 6+-- 10 candidates of size 7+-- 10 candidates of size 8+-- 24 candidates of size 9 -- tested 38 candidates gps29 "" = 0 gps29 (c:cs) = gps29 cs + (if isVowel c then 1 else 0)
bench/gps2.hs view
@@ -207,7 +207,7 @@ , prim "tell" tell ] - conjure "gps5" gps5p+ conjureWith args{target=50400} "gps5" gps5p [ pr (1 :: Int) , pr (5 :: Int) , pr (10 :: Int)@@ -323,7 +323,7 @@ -- unreachable due to lambda gps10c :: IO ()-gps10c = conjure "gps10" gps10p+gps10c = conjureWith args{target=50400} "gps10" gps10p [ pr (0 :: Int) , pr (1 :: Int) , pr (2 :: Int)@@ -627,7 +627,8 @@ gps22c :: IO () gps22c = do- conjure "digits" digits'+ -- cannot conjure at size 13, maybe beyond?+ conjureWith args{target=10080} "digits" digits' [ pr ([] :: [Int]) , prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "`div`" (div :: Int -> Int -> Int)
bench/gps2.txt view
@@ -1,92 +1,92 @@ gps1 :: [Int] -> Maybe Int -- testing 4 combinations of argument values -- pruning with 11/21 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 1 candidates of size 7--- looking through 0 candidates of size 8--- looking through 1 candidates of size 9--- looking through 2 candidates of size 10+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 1 candidates of size 7+-- 0 candidates of size 8+-- 1 candidates of size 9+-- 2 candidates of size 10 -- tested 5 candidates gps1 xs = findIndex (0 >) (map (foldr (+) 0) (tail (inits xs))) gps1 :: [Int] -> Maybe Int -- testing 4 combinations of argument values -- pruning with 11/21 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 1 candidates of size 5--- looking through 0 candidates of size 6--- looking through 1 candidates of size 7--- looking through 4 candidates of size 8+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 1 candidates of size 5+-- 0 candidates of size 6+-- 1 candidates of size 7+-- 4 candidates of size 8 -- tested 6 candidates gps1 xs = findIndex (0 >) (map sum (tail (inits xs))) gps1 :: Int -> [Int] -> Int -- testing 6 combinations of argument values -- pruning with 8/9 rules--- looking through 4 candidates of size 1--- looking through 24 candidates of size 2--- looking through 75 candidates of size 3--- looking through 216 candidates of size 4+-- 4 candidates of size 1+-- 24 candidates of size 2+-- 75 candidates of size 3+-- 216 candidates of size 4 -- tested 319 candidates cannot conjure gps2 :: Double -> Double -> Int -> Double -- testing 5 combinations of argument values -- pruning with 2/6 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 18 candidates of size 3--- looking through 66 candidates of size 4--- looking through 316 candidates of size 5--- looking through 1376 candidates of size 6+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 18 candidates of size 3+-- 66 candidates of size 4+-- 316 candidates of size 5+-- 1376 candidates of size 6 -- tested 1780 candidates cannot conjure gps3 :: [Char] -> Int -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2+-- 0 candidates of size 1+-- 0 candidates of size 2 -- tested 0 candidates cannot conjure gps4 :: [Char] -> [Char] -- pruning with 13/21 rules--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 8 candidates of size 3--- looking through 20 candidates of size 4--- looking through 51 candidates of size 5--- looking through 119 candidates of size 6+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 8 candidates of size 3+-- 20 candidates of size 4+-- 51 candidates of size 5+-- 119 candidates of size 6 -- tested 203 candidates cannot conjure gps5 :: Int -> [Int] -- testing 6 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1+-- 0 candidates of size 1 -- tested 0 candidates cannot conjure tell :: [Int] -> Int -> [Int] -- pruning with 0/0 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 6 candidates of size 5--- looking through 39 candidates of size 6--- looking through 26 candidates of size 7--- looking through 328 candidates of size 8--- looking through 134 candidates of size 9--- looking through 3229 candidates of size 10+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 6 candidates of size 5+-- 39 candidates of size 6+-- 26 candidates of size 7+-- 328 candidates of size 8+-- 134 candidates of size 9+-- 3229 candidates of size 10 -- tested 783 candidates tell [] x = [] tell (x:xs) y = y `div` x:tell xs (y `mod` x)@@ -94,71 +94,71 @@ gps5 :: Int -> [Int] -- testing 6 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 1 candidates of size 3+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3 -- tested 2 candidates gps5 x = tell [25,10,5,1] x gps5 :: Int -> [Int] -- testing 6 combinations of argument values -- pruning with 12/12 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 5 candidates of size 3--- looking through 9 candidates of size 4--- looking through 45 candidates of size 5--- looking through 82 candidates of size 6--- looking through 428 candidates of size 7--- looking through 882 candidates of size 8--- looking through 4350 candidates of size 9--- looking through 9232 candidates of size 10--- looking through 43847 candidates of size 11+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 5 candidates of size 3+-- 9 candidates of size 4+-- 45 candidates of size 5+-- 82 candidates of size 6+-- 428 candidates of size 7+-- 882 candidates of size 8+-- 4350 candidates of size 9+-- 9232 candidates of size 10+-- 43847 candidates of size 11 -- tested 32290 candidates gps5 x = tell [25,10,5,1] x gps6 :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 1 candidates of size 2+-- 0 candidates of size 1+-- 1 candidates of size 2 -- tested 1 candidates cannot conjure gps7 :: Integer -> Integer -> Ratio Integer -- testing 6 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1+-- 0 candidates of size 1 -- tested 0 candidates cannot conjure gps8 :: Int -> [Int] -> (Int,Int) -- testing 3 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2+-- 0 candidates of size 1+-- 0 candidates of size 2 -- tested 0 candidates cannot conjure gps9 :: Int -> [Char] -- testing 7 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1+-- 0 candidates of size 1 -- tested 0 candidates cannot conjure gps10 :: [Int] -> Int -- testing 7 combinations of argument values -- pruning with 67/100 rules--- looking through 4 candidates of size 1--- looking through 16 candidates of size 2--- looking through 0 candidates of size 3--- looking through 68 candidates of size 4--- looking through 80 candidates of size 5--- looking through 980 candidates of size 6--- looking through 1428 candidates of size 7--- looking through 17324 candidates of size 8--- looking through 30724 candidates of size 9+-- 4 candidates of size 1+-- 16 candidates of size 2+-- 0 candidates of size 3+-- 68 candidates of size 4+-- 80 candidates of size 5+-- 980 candidates of size 6+-- 1428 candidates of size 7+-- 17324 candidates of size 8+-- 30724 candidates of size 9 -- tested 25024 candidates gps10 [] = 0 gps10 (x:xs) = gps10 xs + (x `div` 3 - 2)@@ -166,12 +166,12 @@ gcd :: Int -> Int -> Int -- testing 11 combinations of argument values -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 11 candidates of size 3--- looking through 50 candidates of size 4--- looking through 98 candidates of size 5--- looking through 330 candidates of size 6+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 11 candidates of size 3+-- 50 candidates of size 4+-- 98 candidates of size 5+-- 330 candidates of size 6 -- tested 172 candidates gcd x 0 = x gcd x y = gcd y (x `mod` y)@@ -179,29 +179,29 @@ gps12 :: [Char] -> [Char] -> [Int] -- testing 5 combinations of argument values -- pruning with 1/2 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 4 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 4 candidates of size 5 -- tested 3 candidates gps12 cs ds = findIndices (ds `isPrefixOf`) (tails cs) gps13_leaders :: [Int] -> [Int] -- testing 4 combinations of argument values -- pruning with 5/5 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 1 candidates of size 5--- looking through 2 candidates of size 6--- looking through 1 candidates of size 7--- looking through 4 candidates of size 8--- looking through 7 candidates of size 9--- looking through 21 candidates of size 10--- looking through 34 candidates of size 11--- looking through 67 candidates of size 12+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 1 candidates of size 5+-- 2 candidates of size 6+-- 1 candidates of size 7+-- 4 candidates of size 8+-- 7 candidates of size 9+-- 21 candidates of size 10+-- 34 candidates of size 11+-- 67 candidates of size 12 -- tested 82 candidates gps13_leaders [] = [] gps13_leaders (x:xs) = if all (x >) xs@@ -210,32 +210,32 @@ gps14_luhn :: [Int] -> Int -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2+-- 0 candidates of size 1+-- 0 candidates of size 2 -- tested 0 candidates cannot conjure gps15_mastermind :: () -> () -- pruning with 0/1 rules--- looking through 1 candidates of size 1+-- 1 candidates of size 1 -- tested 1 candidates gps15_mastermind u = u gps16_middle :: [Char] -> [Char] -- testing 7 combinations of argument values -- pruning with 10/11 rules--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 6 candidates of size 3--- looking through 10 candidates of size 4--- looking through 19 candidates of size 5--- looking through 32 candidates of size 6--- looking through 59 candidates of size 7--- looking through 124 candidates of size 8--- looking through 305 candidates of size 9--- looking through 822 candidates of size 10--- looking through 2276 candidates of size 11--- looking through 6273 candidates of size 12+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 6 candidates of size 3+-- 10 candidates of size 4+-- 19 candidates of size 5+-- 32 candidates of size 6+-- 59 candidates of size 7+-- 124 candidates of size 8+-- 305 candidates of size 9+-- 822 candidates of size 10+-- 2276 candidates of size 11+-- 6273 candidates of size 12 -- tested 3956 candidates gps16_middle "" = "" gps16_middle (c:cs) = if length cs <= 1@@ -245,56 +245,56 @@ gps17_pds :: [Int] -> Int -- testing 5 combinations of argument values -- pruning with 29/40 rules--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 1 candidates of size 3--- looking through 1 candidates of size 4--- looking through 3 candidates of size 5+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4+-- 3 candidates of size 5 -- tested 8 candidates cannot conjure gps18_price :: [Double] -> [Double] -> Double -- testing 4 combinations of argument values -- pruning with 26/35 rules--- looking through 2 candidates of size 1--- looking through 8 candidates of size 2--- looking through 32 candidates of size 3--- looking through 74 candidates of size 4--- looking through 433 candidates of size 5--- looking through 1218 candidates of size 6+-- 2 candidates of size 1+-- 8 candidates of size 2+-- 32 candidates of size 3+-- 74 candidates of size 4+-- 433 candidates of size 5+-- 1218 candidates of size 6 -- tested 1767 candidates cannot conjure gps19_snowday :: Int -> Double -> Double -> Double -> Double -- testing 7 combinations of argument values -- pruning with 6/19 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 27 candidates of size 3--- looking through 138 candidates of size 4--- looking through 435 candidates of size 5--- looking through 2715 candidates of size 6+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 27 candidates of size 3+-- 138 candidates of size 4+-- 435 candidates of size 5+-- 2715 candidates of size 6 -- tested 3324 candidates cannot conjure gps20 :: [Char] -> Bool -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2+-- 0 candidates of size 1+-- 0 candidates of size 2 -- tested 0 candidates cannot conjure spin :: [Char] -> [Char] -- pruning with 6/6 rules -- reasoning produced 1 incorrect properties, please re-run with more tests for faster results--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 0 candidates of size 7--- looking through 4 candidates of size 8+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 4 candidates of size 8 -- tested 3 candidates spin cs = if length cs >= 5 then reverse cs@@ -303,70 +303,68 @@ gps21_spinwords :: [Char] -> [Char] -- pruning with 16/16 rules -- reasoning produced 2 incorrect properties, please re-run with more tests for faster results--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 2 candidates of size 3--- looking through 3 candidates of size 4--- looking through 5 candidates of size 5+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 2 candidates of size 3+-- 3 candidates of size 4+-- 5 candidates of size 5 -- tested 12 candidates gps21_spinwords cs = unwords (map spin (words cs)) digits :: Int -> [Int] -- testing 5 combinations of argument values -- pruning with 7/7 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 2 candidates of size 3--- looking through 3 candidates of size 4--- looking through 11 candidates of size 5--- looking through 13 candidates of size 6--- looking through 91 candidates of size 7--- looking through 104 candidates of size 8--- looking through 850 candidates of size 9--- looking through 923 candidates of size 10--- looking through 8902 candidates of size 11--- looking through 9662 candidates of size 12--- tested 20562 candidates+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 3 candidates of size 4+-- 11 candidates of size 5+-- 13 candidates of size 6+-- 91 candidates of size 7+-- 104 candidates of size 8+-- 850 candidates of size 9+-- 923 candidates of size 10+-- 8902 candidates of size 11+-- tested 10900 candidates cannot conjure gps22 :: Int -> [Char] -- pruning with 0/0 rules--- looking through 0 candidates of size 1+-- 0 candidates of size 1 -- tested 0 candidates cannot conjure gps23 :: [Char] -> [Char] -> [Char] -> [Char] -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 12 candidates of size 2--- looking through 33 candidates of size 3--- looking through 36 candidates of size 4--- looking through 127 candidates of size 5--- looking through 507 candidates of size 6--- looking through 839 candidates of size 7--- looking through 784 candidates of size 8--- looking through 600 candidates of size 9--- looking through 2722 candidates of size 10--- looking through 5292 candidates of size 11--- looking through 2832 candidates of size 12--- tested 13787 candidates+-- 3 candidates of size 1+-- 12 candidates of size 2+-- 33 candidates of size 3+-- 36 candidates of size 4+-- 127 candidates of size 5+-- 507 candidates of size 6+-- 839 candidates of size 7+-- 784 candidates of size 8+-- 600 candidates of size 9+-- 2722 candidates of size 10+-- 5292 candidates of size 11+-- tested 10955 candidates cannot conjure gps24 :: [Char] -> Twitter -- pruning with 4/8 rules -- reasoning produced 4 incorrect properties, please re-run with more tests for faster results--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 6 candidates of size 3--- looking through 6 candidates of size 4--- looking through 3 candidates of size 5--- looking through 5 candidates of size 6--- looking through 10 candidates of size 7--- looking through 48 candidates of size 8--- looking through 134 candidates of size 9--- looking through 224 candidates of size 10--- looking through 314 candidates of size 11--- looking through 479 candidates of size 12+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 6 candidates of size 3+-- 6 candidates of size 4+-- 3 candidates of size 5+-- 5 candidates of size 6+-- 10 candidates of size 7+-- 48 candidates of size 8+-- 134 candidates of size 9+-- 224 candidates of size 10+-- 314 candidates of size 11+-- 479 candidates of size 12 -- tested 908 candidates gps24 "" = Empty gps24 (c:cs) = if 140 > length cs@@ -376,12 +374,12 @@ gps25 :: [Double] -> [Double] -> Double -- testing 6 combinations of argument values -- pruning with 31/59 rules--- looking through 2 candidates of size 1--- looking through 9 candidates of size 2--- looking through 49 candidates of size 3--- looking through 200 candidates of size 4--- looking through 1104 candidates of size 5--- looking through 5170 candidates of size 6+-- 2 candidates of size 1+-- 9 candidates of size 2+-- 49 candidates of size 3+-- 200 candidates of size 4+-- 1104 candidates of size 5+-- 5170 candidates of size 6 -- tested 6534 candidates cannot conjure
bench/ill-hit.txt view
@@ -1,22 +1,22 @@ sum :: [Int] -> Int -- testing 4 combinations of argument values -- pruning with 14/25 rules--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 11 candidates of size 5+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 11 candidates of size 5 -- tested 14 candidates sum [] = 0 sum (x:xs) = x + sum xs sum :: [Int] -> Int -- pruning with 14/25 rules--- looking through 2 candidates of size 1--- looking through 5 candidates of size 2--- looking through 3 candidates of size 3--- looking through 10 candidates of size 4--- looking through 18 candidates of size 5+-- 2 candidates of size 1+-- 5 candidates of size 2+-- 3 candidates of size 3+-- 10 candidates of size 4+-- 18 candidates of size 5 -- tested 21 candidates sum [] = 0 sum (x:xs) = x + sum xs
bench/lowtests.hs view
@@ -55,7 +55,7 @@ replicates' [a,b,c] 3 = [a,a,a,b,b,b,c,c,c] as :: Args-as = args{showTheory = True}+as = args{showTheory = True, maxSize = 18} main :: IO () main = do
bench/lowtests.txt view
@@ -13,18 +13,24 @@ invalid: xs `isSubsequenceOf` sort xs == True -}--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 2 candidates of size 3--- looking through 4 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 10 candidates of size 7--- looking through 10 candidates of size 8--- looking through 0 candidates of size 9--- looking through 6 candidates of size 10--- looking through 20 candidates of size 11--- looking through 15 candidates of size 12+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 4 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 10 candidates of size 7+-- 10 candidates of size 8+-- 0 candidates of size 9+-- 6 candidates of size 10+-- 20 candidates of size 11+-- 15 candidates of size 12+-- 0 candidates of size 13+-- 0 candidates of size 14+-- 0 candidates of size 15+-- 0 candidates of size 16+-- 0 candidates of size 17+-- 0 candidates of size 18 -- tested 67 candidates cannot conjure @@ -38,11 +44,11 @@ sort xs `isSubsequenceOf` xs == xs `isSubsequenceOf` sort xs -}--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 2 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 2 candidates of size 5 -- tested 9 candidates subset xs ys = sort xs `isSubsequenceOf` sort ys @@ -55,19 +61,25 @@ transpose (transpose (transpose xss)) == transpose xss -}--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 1 candidates of size 7--- looking through 0 candidates of size 8--- looking through 0 candidates of size 9--- looking through 1 candidates of size 10--- looking through 0 candidates of size 11--- looking through 0 candidates of size 12--- tested 4 candidates+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 1 candidates of size 7+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 1 candidates of size 10+-- 0 candidates of size 11+-- 0 candidates of size 12+-- 1 candidates of size 13+-- 0 candidates of size 14+-- 0 candidates of size 15+-- 1 candidates of size 16+-- 0 candidates of size 17+-- 0 candidates of size 18+-- tested 6 candidates cannot conjure replicates :: [Char] -> Int -> [Char]@@ -79,11 +91,11 @@ replicate x (concat (transpose xss)) == replicate x (concat xss) -}--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 1 candidates of size 5+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 1 candidates of size 5 -- tested 3 candidates replicates cs x = concat (transpose (replicate x cs))
bench/p12.txt view
@@ -2,12 +2,12 @@ factorial :: Int -> Int -- testing 6 combinations of argument values -- pruning with 67/101 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 6 candidates of size 3--- looking through 13 candidates of size 4--- looking through 40 candidates of size 5--- looking through 138 candidates of size 6+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 6 candidates of size 3+-- 13 candidates of size 4+-- 40 candidates of size 5+-- 138 candidates of size 6 -- tested 69 candidates factorial 0 = 1 factorial x = x * factorial (dec x)
bench/runtime/lapmatrud/bench/candidates.runtime view
@@ -1,1 +1,1 @@-9.2+9.4
bench/runtime/lapmatrud/bench/erroneous.runtime view
@@ -1,1 +1,1 @@-2.7+2.8
bench/runtime/lapmatrud/bench/gps.runtime view
@@ -1,1 +1,1 @@-14.3+14.2
bench/runtime/lapmatrud/bench/gps2.runtime view
@@ -1,1 +1,1 @@-11.9+12.1
bench/runtime/lapmatrud/bench/lowtests.runtime view
@@ -1,1 +1,1 @@-0.2+0.3
bench/runtime/lapmatrud/bench/redundants.runtime view
@@ -1,1 +1,1 @@-2.8+2.9
bench/runtime/lapmatrud/bench/terpret.runtime view
@@ -1,1 +1,1 @@-7.7+7.5
bench/runtime/lapmatrud/bench/unique.runtime view
@@ -1,1 +1,1 @@-2.2+2.1
bench/runtime/lapmatrud/eg/arith.runtime view
@@ -1,1 +1,1 @@-1.0+0.9
bench/runtime/lapmatrud/eg/bits.runtime view
@@ -1,1 +1,1 @@-2.8+3.1
bench/runtime/lapmatrud/eg/bools.runtime view
@@ -1,1 +1,1 @@-1.4+1.3
bench/runtime/lapmatrud/eg/bst.runtime view
@@ -1,1 +1,1 @@-7.5+7.4
bench/runtime/lapmatrud/eg/count.runtime view
@@ -1,1 +1,1 @@-0.3+0.2
bench/runtime/lapmatrud/eg/dupos.runtime view
@@ -1,1 +1,1 @@-3.4+3.1
bench/runtime/lapmatrud/eg/factorial.runtime view
@@ -1,1 +1,1 @@-1.3+1.2
bench/runtime/lapmatrud/eg/fib01.runtime view
@@ -1,1 +1,1 @@-0.8+0.7
bench/runtime/lapmatrud/eg/fibonacci.runtime view
@@ -1,1 +1,1 @@-3.3+2.9
bench/runtime/lapmatrud/eg/list.runtime view
@@ -1,1 +1,1 @@-0.6+0.5
bench/runtime/lapmatrud/eg/maybe.runtime view
@@ -1,1 +1,1 @@-0.3+0.2
bench/runtime/lapmatrud/eg/oddeven.runtime view
@@ -1,1 +1,1 @@-1.6+1.4
+ bench/runtime/lapmatrud/eg/peano.runtime view
@@ -0,0 +1,1 @@+0.3
bench/runtime/lapmatrud/eg/pow.runtime view
@@ -1,1 +1,1 @@-4.1+3.8
bench/runtime/lapmatrud/eg/setelem.runtime view
@@ -1,1 +1,1 @@-0.8+0.7
bench/runtime/lapmatrud/eg/sort.runtime view
@@ -1,1 +1,1 @@-4.2+3.3
bench/runtime/lapmatrud/eg/subset.runtime view
@@ -1,1 +1,1 @@-0.5+0.4
bench/runtime/lapmatrud/eg/take-drop.runtime view
@@ -1,1 +1,1 @@-0.3+0.2
+ bench/runtime/lapmatrud/eg/these.runtime view
@@ -0,0 +1,1 @@+1.1
bench/runtime/lapmatrud/eg/tree.runtime view
@@ -1,1 +1,1 @@-1.4+1.3
bench/runtime/lapmatrud/eg/tri.runtime view
@@ -1,1 +1,1 @@-0.2+0.3
bench/runtime/zero/bench/candidates.runtime view
@@ -1,1 +1,1 @@-16.1+16.4
bench/runtime/zero/bench/erroneous.runtime view
@@ -1,1 +1,1 @@-4.8+4.9
bench/runtime/zero/bench/gps.runtime view
@@ -1,1 +1,1 @@-25.6+25.8
bench/runtime/zero/bench/gps2.runtime view
@@ -1,1 +1,1 @@-22.9+21.1
bench/runtime/zero/bench/lowtests.runtime view
@@ -1,1 +1,1 @@-0.4+0.5
bench/runtime/zero/bench/terpret.runtime view
@@ -1,1 +1,1 @@-13.6+13.5
bench/runtime/zero/bench/weird.runtime view
@@ -1,1 +1,1 @@-4.6+4.8
bench/runtime/zero/eg/bst.runtime view
@@ -1,1 +1,1 @@-13.8+8.8
bench/runtime/zero/eg/dupos.runtime view
@@ -1,1 +1,1 @@-6.2+6.3
bench/runtime/zero/eg/oddeven.runtime view
@@ -1,1 +1,1 @@-2.7+2.8
+ bench/runtime/zero/eg/peano.runtime view
@@ -0,0 +1,1 @@+0.5
bench/runtime/zero/eg/sort.runtime view
@@ -1,1 +1,1 @@-7.6+6.2
bench/runtime/zero/eg/subset.runtime view
@@ -1,1 +1,1 @@-0.9+0.8
+ bench/runtime/zero/eg/these.runtime view
@@ -0,0 +1,1 @@+1.3
bench/self.txt view
@@ -1,36 +1,36 @@ (?) :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 4 candidates of size 1--- looking through 16 candidates of size 2--- looking through 56 candidates of size 3+-- 4 candidates of size 1+-- 16 candidates of size 2+-- 56 candidates of size 3 -- tested 22 candidates x ? y = x + y (?) :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 4 candidates of size 1--- looking through 16 candidates of size 2--- looking through 56 candidates of size 3+-- 4 candidates of size 1+-- 16 candidates of size 2+-- 56 candidates of size 3 -- tested 34 candidates x ? y = x * y i :: Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 2 candidates of size 2--- looking through 13 candidates of size 3+-- 3 candidates of size 1+-- 2 candidates of size 2+-- 13 candidates of size 3 -- tested 8 candidates i x = x + 1 d :: Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 12 candidates of size 3+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 12 candidates of size 3 -- tested 18 candidates cannot conjure
bench/strategies.txt view
@@ -2,13 +2,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 23 candidates of size 5--- looking through 30 candidates of size 6--- looking through 82 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 23 candidates of size 5+-- 30 candidates of size 6+-- 82 candidates of size 7 -- tested 84 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -17,13 +17,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 28 candidates of size 5--- looking through 35 candidates of size 6--- looking through 167 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 35 candidates of size 6+-- 167 candidates of size 7 -- tested 95 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -32,13 +32,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 16 candidates of size 3--- looking through 17 candidates of size 4--- looking through 279 candidates of size 5--- looking through 313 candidates of size 6--- looking through 5763 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 16 candidates of size 3+-- 17 candidates of size 4+-- 279 candidates of size 5+-- 313 candidates of size 6+-- 5763 candidates of size 7 -- tested 656 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -47,13 +47,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 28 candidates of size 5--- looking through 35 candidates of size 6--- looking through 252 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 35 candidates of size 6+-- 252 candidates of size 7 -- tested 148 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -62,13 +62,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 12 candidates of size 3--- looking through 24 candidates of size 4--- looking through 37 candidates of size 5--- looking through 72 candidates of size 6--- looking through 196 candidates of size 7+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 12 candidates of size 3+-- 24 candidates of size 4+-- 37 candidates of size 5+-- 72 candidates of size 6+-- 196 candidates of size 7 -- tested 165 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -77,13 +77,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 12 candidates of size 3--- looking through 24 candidates of size 4--- looking through 47 candidates of size 5--- looking through 82 candidates of size 6--- looking through 342 candidates of size 7+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 12 candidates of size 3+-- 24 candidates of size 4+-- 47 candidates of size 5+-- 82 candidates of size 6+-- 342 candidates of size 7 -- tested 284 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -92,13 +92,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 21 candidates of size 3--- looking through 42 candidates of size 4--- looking through 302 candidates of size 5--- looking through 602 candidates of size 6--- looking through 6115 candidates of size 7+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 21 candidates of size 3+-- 42 candidates of size 4+-- 302 candidates of size 5+-- 602 candidates of size 6+-- 6115 candidates of size 7 -- tested 1001 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -107,13 +107,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 16 candidates of size 3--- looking through 17 candidates of size 4--- looking through 279 candidates of size 5--- looking through 313 candidates of size 6--- looking through 6281 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 16 candidates of size 3+-- 17 candidates of size 4+-- 279 candidates of size 5+-- 313 candidates of size 6+-- 6281 candidates of size 7 -- tested 1004 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -122,13 +122,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 21 candidates of size 3--- looking through 42 candidates of size 4--- looking through 330 candidates of size 5--- looking through 630 candidates of size 6--- looking through 7215 candidates of size 7+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 21 candidates of size 3+-- 42 candidates of size 4+-- 330 candidates of size 5+-- 630 candidates of size 6+-- 7215 candidates of size 7 -- tested 1945 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)
bench/terpret.hs view
@@ -108,7 +108,7 @@ t4c = do putStrLn "TerpreT benchmark #4: controlled shift\n" - conjure "cshift" t4p1 $ primitives123 +++ conjureWith args{target = 50400} "cshift" t4p1 $ primitives123 ++ [ prim ",," ((,,) :: Bool -> Bool -> Bool -> (Bool,Bool,Bool)) , prif (undefined :: (Bool,Bool,Bool)) ]
bench/terpret.txt view
@@ -3,12 +3,12 @@ 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 4 candidates of size 3--- looking through 10 candidates of size 4--- looking through 15 candidates of size 5--- looking through 41 candidates of size 6+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3+-- 10 candidates of size 4+-- 15 candidates of size 5+-- 41 candidates of size 6 -- tested 33 candidates invert [] = [] invert (p:ps) = not p:invert ps@@ -18,9 +18,9 @@ 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 4 candidates of size 3+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3 -- tested 4 candidates prependZero ps = False:ps @@ -29,15 +29,15 @@ 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 4 candidates of size 3--- looking through 10 candidates of size 4--- looking through 15 candidates of size 5--- looking through 41 candidates of size 6--- looking through 82 candidates of size 7--- looking through 202 candidates of size 8--- looking through 479 candidates of size 9+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3+-- 10 candidates of size 4+-- 15 candidates of size 5+-- 41 candidates of size 6+-- 82 candidates of size 7+-- 202 candidates of size 8+-- 479 candidates of size 9 -- tested 411 candidates decrement [] = [] decrement (p:ps) = not p:(if p then ps else decrement ps)@@ -48,17 +48,17 @@ -- 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 625 candidates of size 7--- looking through 1242 candidates of size 8--- looking through 3087 candidates of size 9--- looking through 8937 candidates of size 10--- looking through 102200 candidates of size 11+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 10 candidates of size 4+-- 125 candidates of size 5+-- 225 candidates of size 6+-- 625 candidates of size 7+-- 1242 candidates of size 8+-- 3087 candidates of size 9+-- 8937 candidates of size 10+-- 102200 candidates of size 11 -- tested 39710 candidates cshift (p,q,r) = if p then (p,r,q)@@ -68,14 +68,14 @@ -- 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 585 candidates of size 6--- looking through 1242 candidates of size 7--- looking through 15183 candidates of size 8+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 125 candidates of size 4+-- 225 candidates of size 5+-- 585 candidates of size 6+-- 1242 candidates of size 7+-- 15183 candidates of size 8 -- tested 15459 candidates cshift False p q = (False,p,q) cshift True p q = (True,q,p)@@ -85,14 +85,14 @@ 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 27 candidates of size 5--- looking through 72 candidates of size 6--- looking through 245 candidates of size 7--- looking through 663 candidates of size 8+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 9 candidates of size 3+-- 18 candidates of size 4+-- 27 candidates of size 5+-- 72 candidates of size 6+-- 245 candidates of size 7+-- 663 candidates of size 8 -- tested 1034 candidates fadder False False False = (False,False) fadder False False True = (False,True)@@ -109,12 +109,12 @@ -- 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+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 8 candidates of size 4+-- 128 candidates of size 5+-- 408 candidates of size 6 -- tested 544 candidates cannot conjure @@ -123,22 +123,22 @@ 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+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3 -- tested 1 candidates 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 1 candidates of size 3--- looking through 1 candidates of size 4--- looking through 6 candidates of size 5--- looking through 5 candidates of size 6--- looking through 19 candidates of size 7+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4+-- 6 candidates of size 5+-- 5 candidates of size 6+-- 19 candidates of size 7 -- tested 18 candidates [] `access` x = undefined (x:xs) `access` 0 = x@@ -149,13 +149,13 @@ 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 2 candidates of size 3--- looking through 7 candidates of size 4--- looking through 8 candidates of size 5--- looking through 29 candidates of size 6--- looking through 39 candidates of size 7+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 7 candidates of size 4+-- 8 candidates of size 5+-- 29 candidates of size 6+-- 39 candidates of size 7 -- tested 51 candidates decrelements [] = [] decrelements (x:xs) = x - 1:decrelements xs@@ -163,10 +163,10 @@ 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 2 candidates of size 3--- looking through 8 candidates of size 4+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 8 candidates of size 4 -- tested 7 candidates decrelements xs = map (subtract 1) xs
bench/weird.txt view
@@ -1,9 +1,9 @@ (^^^) :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 56/91 rules--- looking through 4 candidates of size 1--- looking through 16 candidates of size 2--- looking through 40 candidates of size 3+-- 4 candidates of size 1+-- 16 candidates of size 2+-- 40 candidates of size 3 -- tested 37 candidates 0 ^^^ x = x x ^^^ 0 = x@@ -12,16 +12,16 @@ (^^^) :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 56/91 rules--- looking through 4 candidates of size 1--- looking through 0 candidates of size 2--- looking through 9 candidates of size 3--- looking through 0 candidates of size 4--- looking through 39 candidates of size 5--- looking through 60 candidates of size 6--- looking through 222 candidates of size 7--- looking through 996 candidates of size 8--- looking through 1266 candidates of size 9--- looking through 11700 candidates of size 10+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 9 candidates of size 3+-- 0 candidates of size 4+-- 39 candidates of size 5+-- 60 candidates of size 6+-- 222 candidates of size 7+-- 996 candidates of size 8+-- 1266 candidates of size 9+-- 11700 candidates of size 10 -- tested 6683 candidates x ^^^ y = if 0 == x * y then x + y
changelog.md view
@@ -2,6 +2,18 @@ ============================ +v0.6.4 (February 2025)+----------------------++* Create `Args.target` as the main setting to configure+ a target number of candidates to explore.+ This should relate more closely with runtime.+ `target = 10080` is the default.+* relax `maxSize=12` to `maxSize=24` by default.+* show runtime in the output by default+* some internal refactoring++ v0.6.2 (February 2025) ----------------------
code-conjure.cabal view
@@ -3,7 +3,7 @@ -- Copyright (C) 2021-2025 Rudy Matela -- Distributed under the 3-Clause BSD licence (see the file LICENSE). name: code-conjure-version: 0.6.2+version: 0.6.4 synopsis: synthesize Haskell functions out of partial definitions description: Conjure is a tool that synthesizes Haskell functions out of partial definitions.@@ -30,6 +30,7 @@ , eg/*.hs , eg/*.txt , eg/colin/*.hs+ , eg/colin/*.txt , proto/*.hs , proto/*.txt , mk/All.hs@@ -68,7 +69,7 @@ source-repository this type: git location: https://github.com/rudymatela/conjure- tag: v0.6.2+ tag: v0.6.4 library exposed-modules: Conjure
eg/arith.txt view
@@ -1,62 +1,62 @@ double :: Int -> Int -- testing 4 combinations of argument values -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 1 candidates of size 2--- looking through 6 candidates of size 3+-- 3 candidates of size 1+-- 1 candidates of size 2+-- 6 candidates of size 3 -- tested 5 candidates double x = x + x triple :: Int -> Int -- testing 4 combinations of argument values -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 1 candidates of size 2--- looking through 6 candidates of size 3--- looking through 2 candidates of size 4--- looking through 11 candidates of size 5+-- 3 candidates of size 1+-- 1 candidates of size 2+-- 6 candidates of size 3+-- 2 candidates of size 4+-- 11 candidates of size 5 -- tested 13 candidates triple x = x + (x + x) add :: Int -> Int -> Int -- testing 4 combinations of argument values -- pruning with 14/25 rules--- looking through 4 candidates of size 1--- looking through 16 candidates of size 2--- looking through 40 candidates of size 3+-- 4 candidates of size 1+-- 16 candidates of size 2+-- 40 candidates of size 3 -- tested 22 candidates add x y = x + y square :: Int -> Int -- testing 3 combinations of argument values -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 1 candidates of size 2--- looking through 4 candidates of size 3+-- 3 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3 -- tested 7 candidates square x = x * x cube :: Int -> Int -- testing 3 combinations of argument values -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 1 candidates of size 2--- looking through 4 candidates of size 3--- looking through 1 candidates of size 4--- looking through 10 candidates of size 5+-- 3 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3+-- 1 candidates of size 4+-- 10 candidates of size 5 -- tested 17 candidates cube x = x * (x * x) tnpo :: Int -> Int -- testing 3 combinations of argument values -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 2 candidates of size 2--- looking through 6 candidates of size 3--- looking through 4 candidates of size 4--- looking through 11 candidates of size 5--- looking through 7 candidates of size 6--- looking through 35 candidates of size 7+-- 3 candidates of size 1+-- 2 candidates of size 2+-- 6 candidates of size 3+-- 4 candidates of size 4+-- 11 candidates of size 5+-- 7 candidates of size 6+-- 35 candidates of size 7 -- tested 35 candidates tnpo x = x + (x + (x + 1))
eg/bits.txt view
@@ -1,13 +1,13 @@ bitsum :: Int -> Int -- testing 8 combinations of argument values -- pruning with 21/25 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 5 candidates of size 3--- looking through 10 candidates of size 4--- looking through 26 candidates of size 5--- looking through 68 candidates of size 6--- looking through 182 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 5 candidates of size 3+-- 10 candidates of size 4+-- 26 candidates of size 5+-- 68 candidates of size 6+-- 182 candidates of size 7 -- tested 145 candidates bitsum 0 = 0 bitsum x = bitsum (halve x) + parity x@@ -15,15 +15,15 @@ bitsum :: Int -> Int -- testing 8 combinations of argument values -- pruning with 27/32 rules--- looking through 4 candidates of size 1--- looking through 2 candidates of size 2--- looking through 17 candidates of size 3--- looking through 16 candidates of size 4--- looking through 246 candidates of size 5--- looking through 239 candidates of size 6--- looking through 4504 candidates of size 7--- looking through 4542 candidates of size 8--- looking through 89215 candidates of size 9+-- 4 candidates of size 1+-- 2 candidates of size 2+-- 17 candidates of size 3+-- 16 candidates of size 4+-- 246 candidates of size 5+-- 239 candidates of size 6+-- 4504 candidates of size 7+-- 4542 candidates of size 8+-- 89215 candidates of size 9 -- tested 10191 candidates bitsum 0 = 0 bitsum x = bitsum (x `div` 2) + x `mod` 2
eg/bools.txt view
@@ -1,11 +1,11 @@ and :: [Bool] -> Bool -- testing 14 combinations of argument values -- pruning with 37/47 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 2 candidates of size 3--- looking through 2 candidates of size 4--- looking through 4 candidates of size 5+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 2 candidates of size 3+-- 2 candidates of size 4+-- 4 candidates of size 5 -- tested 14 candidates and [] = True and (p:ps) = p && and ps@@ -13,11 +13,11 @@ or :: [Bool] -> Bool -- testing 14 combinations of argument values -- pruning with 37/47 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 2 candidates of size 3--- looking through 2 candidates of size 4--- looking through 4 candidates of size 5+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 2 candidates of size 3+-- 2 candidates of size 4+-- 4 candidates of size 5 -- tested 11 candidates or [] = False or (p:ps) = p || or ps@@ -25,20 +25,20 @@ and :: [Bool] -> Bool -- testing 14 combinations of argument values -- pruning with 39/49 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 2 candidates of size 3--- looking through 4 candidates of size 4+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 2 candidates of size 3+-- 4 candidates of size 4 -- tested 12 candidates and ps = foldr (&&) True ps or :: [Bool] -> Bool -- testing 14 combinations of argument values -- pruning with 39/49 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 2 candidates of size 3--- looking through 4 candidates of size 4+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 2 candidates of size 3+-- 4 candidates of size 4 -- tested 11 candidates or ps = foldr (||) False ps
eg/bst.hs view
@@ -103,6 +103,9 @@ instance Name Tree where name _ = "t1" +-- the following instance could have been derived with:+-- deriveConjurable ''Tree+ instance Conjurable Tree where conjureExpress = reifyExpress conjureEquality = reifyEquality@@ -118,7 +121,7 @@ main :: IO () main = do- conjureWithMaxSize 15 "mem" mem+ conjure "mem" mem [ pr False , prim "||" (||) , prim "==" ((==) :: Int -> Int -> Bool)
eg/bst.txt view
@@ -1,18 +1,18 @@ mem :: Int -> Tree -> Bool -- testing 360 combinations of argument values -- pruning with 20/30 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 3 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 0 candidates of size 7--- looking through 31 candidates of size 8--- looking through 92 candidates of size 9--- looking through 0 candidates of size 10--- looking through 304 candidates of size 11--- looking through 151 candidates of size 12+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 3 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 31 candidates of size 8+-- 92 candidates of size 9+-- 0 candidates of size 10+-- 304 candidates of size 11+-- 151 candidates of size 12 -- tested 497 candidates mem x Leaf = False mem x (Node t1 y t2) = mem x t1 || (mem x t2 || x == y)@@ -20,18 +20,18 @@ mem :: Int -> Tree -> Bool -- testing 360 combinations of argument values -- pruning with 1/2 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 6 candidates of size 7--- looking through 24 candidates of size 8--- looking through 0 candidates of size 9--- looking through 192 candidates of size 10--- looking through 0 candidates of size 11--- looking through 384 candidates of size 12+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 6 candidates of size 7+-- 24 candidates of size 8+-- 0 candidates of size 9+-- 192 candidates of size 10+-- 0 candidates of size 11+-- 384 candidates of size 12 -- tested 371 candidates mem x Leaf = False mem x (Node t1 y t2) = case x `compare` y of@@ -42,84 +42,83 @@ insert :: Int -> Tree -> Tree -- testing 360 combinations of argument values -- pruning with 2/3 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 4 candidates of size 4--- looking through 21 candidates of size 5--- looking through 0 candidates of size 6--- looking through 74 candidates of size 7--- looking through 335 candidates of size 8--- looking through 32 candidates of size 9--- looking through 1504 candidates of size 10--- looking through 6708 candidates of size 11--- looking through 1760 candidates of size 12+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 4 candidates of size 4+-- 21 candidates of size 5+-- 0 candidates of size 6+-- 74 candidates of size 7+-- 335 candidates of size 8+-- 32 candidates of size 9+-- 1504 candidates of size 10+-- 6708 candidates of size 11+-- 1760 candidates of size 12 -- tested 10442 candidates cannot conjure before :: Int -> Tree -> Tree -- pruning with 5/6 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 4 candidates of size 4--- looking through 21 candidates of size 5--- looking through 0 candidates of size 6--- looking through 86 candidates of size 7--- looking through 239 candidates of size 8--- looking through 104 candidates of size 9--- looking through 1558 candidates of size 10--- looking through 3555 candidates of size 11--- looking through 4028 candidates of size 12+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 4 candidates of size 4+-- 21 candidates of size 5+-- 0 candidates of size 6+-- 86 candidates of size 7+-- 239 candidates of size 8+-- 104 candidates of size 9+-- 1558 candidates of size 10+-- 3555 candidates of size 11+-- 4028 candidates of size 12 -- tested 9599 candidates cannot conjure before :: Int -> Tree -> Tree -- pruning with 2/4 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 4 candidates of size 4--- looking through 21 candidates of size 5--- looking through 0 candidates of size 6--- looking through 68 candidates of size 7--- looking through 287 candidates of size 8--- looking through 32 candidates of size 9--- looking through 1216 candidates of size 10--- looking through 5103 candidates of size 11--- looking through 1472 candidates of size 12+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 4 candidates of size 4+-- 21 candidates of size 5+-- 0 candidates of size 6+-- 68 candidates of size 7+-- 287 candidates of size 8+-- 32 candidates of size 9+-- 1216 candidates of size 10+-- 5103 candidates of size 11+-- 1472 candidates of size 12 -- tested 8207 candidates cannot conjure beyond :: Int -> Tree -> Tree -- pruning with 2/4 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 4 candidates of size 4--- looking through 21 candidates of size 5--- looking through 0 candidates of size 6--- looking through 68 candidates of size 7--- looking through 287 candidates of size 8--- looking through 32 candidates of size 9--- looking through 1216 candidates of size 10--- looking through 5103 candidates of size 11--- looking through 1472 candidates of size 12+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 4 candidates of size 4+-- 21 candidates of size 5+-- 0 candidates of size 6+-- 68 candidates of size 7+-- 287 candidates of size 8+-- 32 candidates of size 9+-- 1216 candidates of size 10+-- 5103 candidates of size 11+-- 1472 candidates of size 12 -- tested 8207 candidates cannot conjure union :: Tree -> Tree -> Tree -- testing 360 combinations of argument values -- pruning with 6/8 rules--- looking through 3 candidates of size 1--- looking through 12 candidates of size 2--- looking through 32 candidates of size 3--- looking through 58 candidates of size 4--- looking through 434 candidates of size 5--- looking through 922 candidates of size 6--- looking through 3088 candidates of size 7--- looking through 14022 candidates of size 8--- looking through 31810 candidates of size 9--- tested 50381 candidates+-- 3 candidates of size 1+-- 12 candidates of size 2+-- 32 candidates of size 3+-- 58 candidates of size 4+-- 434 candidates of size 5+-- 922 candidates of size 6+-- 3088 candidates of size 7+-- 14022 candidates of size 8+-- tested 18571 candidates cannot conjure
eg/colin/ListFuns.hs view
@@ -1,147 +1,153 @@--- 2021 Colin Runciman--- updated in 2024 to use the recent interface of Conjure+--- 2021, 2025 Colin Runciman import Conjure import Prelude hiding (sum, take, drop) -sumSpec :: ([Int] -> Int) -> Bool-sumSpec sum = and [ sum [] == 0- , sum [0,1] == 1- , sum [1,0,1] == 2 ]+sum :: [Int] -> Int+sum [] = 0+sum [0,1] = 1+sum [1,0,1] = 2 -- hoping for something like--- sum xs = if null xs then 0 else head xs + sum (tail xs)+-- sum [] = 0+-- sum (x:xs) = x + sum xs -sumPrimitives :: [Prim]-sumPrimitives =- [ prim "null" (null :: [Int] -> Bool)- , pr (0::Int)- , prim "+" ((+) :: Int -> Int -> Int)- , prim "head" (head :: [Int] -> Int)- , prim "tail" (tail :: [Int] -> [Int])+sumBackground :: [Prim]+sumBackground =+ [ pr (0::Int)+ , prim "+" ((+) :: Int -> Int -> Int) ] -appSpec :: ([Int] -> [Int] -> [Int]) -> Bool-appSpec (++) = and [ [] ++ [0,1] == [0,1]- , [0,1] ++ [] == [0,1]- , [0,1] ++ [0,1] == [0,1,0,1] ]+app :: [Int] -> [Int] -> [Int]+app [] [0,1] = [0,1]+app [0,1] [] = [0,1]+app [0,1] [0,1] = [0,1,0,1] -- hoping for something like--- app xs ys = if null xs then ys else head xs : app (tail xs) ys+-- app [] ys = ys+-- app (x:xs) ys = x : app xs ys -appPrimitives :: [Prim]-appPrimitives =- [ prim "null" (null :: [Int] -> Bool)- , prim ":" ((:) :: Int -> [Int] -> [Int])- , prim "head" (head :: [Int] -> Int)- , prim "tail" (tail :: [Int] -> [Int])+appBackground :: [Prim]+appBackground =+ [ prim ":" ((:) :: Int -> [Int] -> [Int]) ] -memSpec :: (Int -> [Int] -> Bool) -> Bool-memSpec mem = and [ 0 `mem` [] == False- , 0 `mem` [0,1,1] == True- , 0 `mem` [1,0,1] == True- , 0 `mem` [1,1,0] == True- , 0 `mem` [1,1,1] == False ]+mem :: Int -> [Int] -> Bool+mem 0 [] = False+mem 0 [0,1,1] = True+mem 0 [1,0,1] = True+mem 0 [1,1,0] = True+mem 0 [1,1,1] = False -- hoping for something like--- mem x xs = not (null xs) && (x == head xs || mem x (tail xs))+-- mem x [] = False+-- mem x (y:ys) = x == y || mem x ys -memPrimitives :: [Prim]-memPrimitives =+memBackground :: [Prim]+memBackground = [ pr False- , pr True- , pr ([] :: [Int])- , prim ":" ((:) :: Int -> [Int] -> [Int])- , prim "null" (null :: [Int] -> Bool) , prim "==" ((==) :: Int -> Int -> Bool)- , prim "not" (not :: Bool -> Bool) , prim "&&" ((&&) :: Bool -> Bool -> Bool) , prim "||" ((||) :: Bool -> Bool -> Bool)- , prim "head" (head :: [Int] -> Int)- , prim "tail" (tail :: [Int] -> [Int]) ] -setSpec :: ([Int] -> Bool) -> Bool-setSpec set = and [ set [] == True- , set [0] == True- , set [0,0] == False- , set [0,1] == True- , set [0,1,2] == True- , set [0,0,1] == False- , set [0,1,0] == False- , set [0,1,1] == False ]+sub :: [Int] -> [Int] -> Bool+sub [] [] = True+sub [] [0,1] = True+sub [0] [0,1] = True+sub [1] [0,1] = True+sub [2] [0,1] = False+sub [0,1] [0,1] = True+sub [1,0] [0,1] = False+sub [0,2] [0,1] = False+sub [2,0] [0,1] = False --- hoping for something like--- set xs = null xs || not (elem (head xs) (tail xs)) && set (tail xs)+-- Hoping for something like:+-- sub :: [Int] -> [Int] -> Bool+-- sub [] _ = True+-- sub _ [] = False+-- sub (x:xs) (y:ys) = x == y && sub xs ys || sub (x:xs) ys -setPrimitives :: [Prim]-setPrimitives =- [ prim "null" (null :: [Int] -> Bool)+subBackground :: [Prim]+subBackground =+ [ pr True , pr False- , pr True- , pr ([] :: [Int]) , prim ":" ((:) :: Int -> [Int] -> [Int])- , prim "not" (not :: Bool -> Bool)+ , prim "==" ((==) :: Int -> Int -> Bool) , prim "&&" ((&&) :: Bool -> Bool -> Bool) , prim "||" ((||) :: Bool -> Bool -> Bool)- , prim "head" (head :: [Int] -> Int)- , prim "tail" (tail :: [Int] -> [Int])+ ]++set :: [Int] -> Bool+set [] = True+set [0] = True+set [0,0] = False+set [0,1] = True+set [0,1,2] = True+set [0,0,1] = False+set [0,1,0] = False+set [0,1,1] = False++-- hoping for something like+-- set [] = True+-- set (x:xs) = not (elem x xs) && set xs++setBackground :: [Prim]+setBackground =+ [ prim "not" (not :: Bool -> Bool)+ , prim "&&" ((&&) :: Bool -> Bool -> Bool) , prim "elem" (elem :: Int -> [Int] -> Bool) ] -takeSpec :: (Int -> [Int] -> [Int]) -> Bool-takeSpec take = and [ take 0 [] == []- , take 1 [] == []- , take 0 [0,1] == []- , take 1 [0,1] == [0]- , take 2 [0,1] == [0,1]- , take 3 [0,1] == [0,1] ]+take :: Int -> [A] -> [A]+take 0 [] = []+take 1 [] = []+take 0 [x,y] = []+take 1 [x,y] = [x]+take 2 [x,y] = [x,y]+take 3 [x,y] = [x,y] -- hoping for something like--- take n xs = if n==0 || null xs then [] else head xs : take (dec n) (tail xs)+-- take 0 xs = []+-- take x [] = []+-- take x (y:ys) = y : take (x-1) ys -takePrimitives :: [Prim]-takePrimitives =+takeBackground :: [Prim]+takeBackground = [ pr (0 :: Int)- , pr ([] :: [Int])- , prim "null" (null :: [Int] -> Bool)- , prim "==" ((==) :: Int -> Int -> Bool)- , prim "||" ((||) :: Bool -> Bool -> Bool)- , prim "dec" ((\n -> n-1) :: Int -> Int)- , prim ":" ((:) :: Int -> [Int] -> [Int])- , prim "head" (head :: [Int] -> Int)- , prim "tail" (tail :: [Int] -> [Int])+ , pr (1 :: Int)+ , pr ([] :: [A])+ , prim "-" ((-) :: Int -> Int -> Int)+ , prim ":" ((:) :: A -> [A] -> [A]) ] -dropSpec :: (Int -> [Int] -> [Int]) -> Bool-dropSpec drop = and [ drop 0 [] == []- , drop 1 [] == []- , drop 0 [0,1] == [0,1]- , drop 1 [0,1] == [1]- , drop 2 [0,1] == []- , drop 3 [0,1] == [] ]+drop :: Int -> [A] -> [A]+drop 0 [] = []+drop 1 [] = []+drop 0 [x,y] = [x,y]+drop 1 [x,y] = [y]+drop 2 [x,y] = []+drop 3 [x,y] = [] -- hoping for something like--- drop n xs = if n==0 || null xs then xs else drop (dec n) (tail xs)+-- drop 0 xs = xs+-- drop x [] = []+-- drop x (y:ys) = drop (x-1) ys -dropPrimitives :: [Prim]-dropPrimitives =+dropBackground :: [Prim]+dropBackground = [ pr (0 :: Int)- , pr ([] :: [Int])- , prim ":" ((:) :: Int -> [Int] -> [Int])- , prim "null" (null :: [Int] -> Bool)- , prim "==" ((==) :: Int -> Int -> Bool)- , prim "||" ((||) :: Bool -> Bool -> Bool)- , prim "dec" ((\n -> n-1) :: Int -> Int)- , prim "tail" (tail :: [Int] -> [Int])+ , pr (1 :: Int)+ , pr ([] :: [A])+ , prim "-" ((-) :: Int -> Int -> Int) ] main :: IO () main = do- conjureFromSpecWith args{maxSize=15} "sum" sumSpec sumPrimitives- conjureFromSpecWith args{maxSize=15} "app" appSpec appPrimitives- conjureFromSpecWith args{maxSize=15} "mem" memSpec memPrimitives- conjureFromSpecWith args{maxSize=15} "set" setSpec setPrimitives- conjureFromSpecWith args{maxSize=20} "take" takeSpec takePrimitives- conjureFromSpecWith args{maxSize=15} "drop" dropSpec dropPrimitives+ conjure "sum" sum sumBackground+ conjure "app" app appBackground+ conjure "mem" mem memBackground+ conjureWith args{maxSize=15,showCandidates=False} "sub" sub subBackground+ conjure "set" set setBackground+ conjure "take" take takeBackground+ conjure "drop" drop dropBackground
+ eg/colin/ListFuns.txt view
@@ -0,0 +1,110 @@+sum :: [Int] -> Int+-- testing 3 combinations of argument values+-- pruning with 4/8 rules+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 1 candidates of size 5+-- tested 4 candidates+sum [] = 0+sum (x:xs) = x + sum xs++app :: [Int] -> [Int] -> [Int]+-- testing 3 combinations of argument values+-- pruning with 0/0 rules+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 1 candidates of size 3+-- 10 candidates of size 4+-- 12 candidates of size 5+-- 14 candidates of size 6+-- tested 32 candidates+app xs [] = xs+app xs (x:ys) = x:app xs ys++mem :: Int -> [Int] -> Bool+-- testing 5 combinations of argument values+-- pruning with 29/42 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 12 candidates of size 8+-- tested 13 candidates+mem x [] = False+mem x (y:xs) = mem x xs || x == y++sub :: [Int] -> [Int] -> Bool+-- testing 9 combinations of argument values+-- pruning with 29/42 rules+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 6 candidates of size 3+-- 1 candidates of size 4+-- 18 candidates of size 5+-- 7 candidates of size 6+-- 26 candidates of size 7+-- 95 candidates of size 8+-- 228 candidates of size 9+-- 191 candidates of size 10+-- 954 candidates of size 11+-- 957 candidates of size 12+-- 4260 candidates of size 13+-- 2687 candidates of size 14+-- 17846 candidates of size 15+-- tested 25802 candidates+sub [] xs = True+sub (x:xs) [] = False+sub (x:xs) (y:ys) = sub xs ys && (sub (x:xs) ys || x == y)++set :: [Int] -> Bool+-- testing 8 combinations of argument values+-- pruning with 15/19 rules+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 1 candidates of size 5+-- 1 candidates of size 6+-- 3 candidates of size 7+-- 5 candidates of size 8+-- tested 11 candidates+set [] = True+set (x:xs) = set xs && not (elem x xs)++take :: Int -> [A] -> [A]+-- testing 143 combinations of argument values+-- pruning with 4/7 rules+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 4 candidates of size 3+-- 6 candidates of size 4+-- 8 candidates of size 5+-- 13 candidates of size 6+-- 24 candidates of size 7+-- 31 candidates of size 8+-- 59 candidates of size 9+-- tested 111 candidates+take 0 xs = []+take x [] = []+take x (y:xs) = y:take (x - 1) xs++drop :: Int -> [A] -> [A]+-- testing 143 combinations of argument values+-- pruning with 4/7 rules+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 4 candidates of size 3+-- 4 candidates of size 4+-- 4 candidates of size 5+-- 4 candidates of size 6+-- 12 candidates of size 7+-- tested 24 candidates+drop 0 xs = xs+drop x [] = []+drop x (y:xs) = drop (x - 1) xs+
eg/count.txt view
@@ -1,28 +1,28 @@ count :: A -> [A] -> Int -- testing 13 combinations of argument values -- pruning with 1/2 rules--- looking through 0 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 1 candidates of size 5+-- 0 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 1 candidates of size 5 -- tested 2 candidates count x xs = length (filter (x ==) xs) count :: A -> [A] -> Int -- testing 13 combinations of argument values -- pruning with 8/13 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 4 candidates of size 6--- looking through 4 candidates of size 7--- looking through 12 candidates of size 8--- looking through 20 candidates of size 9--- looking through 20 candidates of size 10--- looking through 52 candidates of size 11+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 4 candidates of size 6+-- 4 candidates of size 7+-- 12 candidates of size 8+-- 20 candidates of size 9+-- 20 candidates of size 10+-- 52 candidates of size 11 -- tested 79 candidates count x [] = 0 count x (y:xs) = count x xs + (if x == y then 1 else 0)
eg/dupos.hs view
@@ -52,7 +52,7 @@ -- then x : duplicates xs -- 15 -- else duplicates xs -- 17 -- within reach performance wise.- conjureWith args{maxSize=18} "duplicates" duplicates'+ conjure "duplicates" duplicates' [ pr ([] :: [Int]) , prim "not" not , prim "&&" (&&)@@ -61,7 +61,7 @@ , prif (undefined :: [Int]) ] - conjureFromSpecWith args{maxSize=18} "duplicates" duplicatesSpec+ conjureFromSpec "duplicates" duplicatesSpec [ pr ([] :: [Int]) , prim "not" not , prim "&&" (&&)@@ -70,8 +70,7 @@ , prif (undefined :: [Int]) ] - -- found!- conjureWithMaxSize 14 "positionsFrom" positionsFrom'+ conjure "positionsFrom" positionsFrom' [ pr ([] :: [Int]) , pr (1 :: Int) , prim "+" ((+) :: Int -> Int -> Int)
eg/dupos.txt view
@@ -1,23 +1,23 @@ duplicates :: [Int] -> [Int] -- testing 6 combinations of argument values -- pruning with 21/26 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 1 candidates of size 5--- looking through 2 candidates of size 6--- looking through 3 candidates of size 7--- looking through 8 candidates of size 8--- looking through 16 candidates of size 9--- looking through 25 candidates of size 10--- looking through 36 candidates of size 11--- looking through 63 candidates of size 12--- looking through 133 candidates of size 13--- looking through 299 candidates of size 14--- looking through 602 candidates of size 15--- looking through 1116 candidates of size 16--- looking through 2031 candidates of size 17+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 1 candidates of size 5+-- 2 candidates of size 6+-- 3 candidates of size 7+-- 8 candidates of size 8+-- 16 candidates of size 9+-- 25 candidates of size 10+-- 36 candidates of size 11+-- 63 candidates of size 12+-- 133 candidates of size 13+-- 299 candidates of size 14+-- 602 candidates of size 15+-- 1116 candidates of size 16+-- 2031 candidates of size 17 -- tested 2450 candidates duplicates [] = [] duplicates (x:xs) = if elem x xs && not (elem x (duplicates xs))@@ -26,23 +26,23 @@ duplicates :: [Int] -> [Int] -- pruning with 21/26 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 1 candidates of size 5--- looking through 2 candidates of size 6--- looking through 3 candidates of size 7--- looking through 8 candidates of size 8--- looking through 16 candidates of size 9--- looking through 25 candidates of size 10--- looking through 36 candidates of size 11--- looking through 63 candidates of size 12--- looking through 133 candidates of size 13--- looking through 299 candidates of size 14--- looking through 602 candidates of size 15--- looking through 1116 candidates of size 16--- looking through 2031 candidates of size 17+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 1 candidates of size 5+-- 2 candidates of size 6+-- 3 candidates of size 7+-- 8 candidates of size 8+-- 16 candidates of size 9+-- 25 candidates of size 10+-- 36 candidates of size 11+-- 63 candidates of size 12+-- 133 candidates of size 13+-- 299 candidates of size 14+-- 602 candidates of size 15+-- 1116 candidates of size 16+-- 2031 candidates of size 17 -- tested 2450 candidates duplicates [] = [] duplicates (x:xs) = if elem x xs && not (elem x (duplicates xs))@@ -52,20 +52,20 @@ positionsFrom :: Int -> A -> [A] -> [Int] -- testing 360 combinations of argument values -- pruning with 5/10 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 2 candidates of size 3--- looking through 5 candidates of size 4--- looking through 9 candidates of size 5--- looking through 16 candidates of size 6--- looking through 43 candidates of size 7--- looking through 73 candidates of size 8--- looking through 185 candidates of size 9--- looking through 285 candidates of size 10--- looking through 722 candidates of size 11--- looking through 1157 candidates of size 12--- looking through 2847 candidates of size 13--- looking through 4505 candidates of size 14+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 5 candidates of size 4+-- 9 candidates of size 5+-- 16 candidates of size 6+-- 43 candidates of size 7+-- 73 candidates of size 8+-- 185 candidates of size 9+-- 285 candidates of size 10+-- 722 candidates of size 11+-- 1157 candidates of size 12+-- 2847 candidates of size 13+-- 4505 candidates of size 14 -- tested 5484 candidates positionsFrom x y [] = [] positionsFrom x y (z:xs) = (if y == z then (x :) else id) (positionsFrom (x + 1) y xs)
eg/either.txt view
@@ -1,8 +1,8 @@ isLeft :: Either A A -> Bool -- testing 4 combinations of argument values -- pruning with 0/0 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2+-- 2 candidates of size 1+-- 2 candidates of size 2 -- tested 4 candidates isLeft (Left x) = True isLeft (Right x) = False@@ -10,8 +10,8 @@ isRight :: Either A A -> Bool -- testing 4 combinations of argument values -- pruning with 0/0 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2+-- 2 candidates of size 1+-- 2 candidates of size 2 -- tested 3 candidates isRight (Left x) = False isRight (Right x) = True@@ -19,8 +19,8 @@ fromLeft :: A -> Either A A -> A -- testing 5 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 3 candidates of size 2+-- 1 candidates of size 1+-- 3 candidates of size 2 -- tested 3 candidates fromLeft x (Left y) = y fromLeft x (Right y) = x@@ -28,18 +28,18 @@ fromLeft :: A -> Either A A -> A -- testing 5 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 3 candidates of size 2+-- 1 candidates of size 1+-- 3 candidates of size 2 -- tested 2 candidates fromLeft x (Left y) = x fromLeft x (Right y) = y either :: (A -> A) -> (A -> A) -> Either A A -> A -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 1 candidates of size 2--- looking through 4 candidates of size 3--- looking through 12 candidates of size 4+-- 0 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3+-- 12 candidates of size 4 -- tested 11 candidates either f g (Left x) = f x either f g (Right x) = g x@@ -47,8 +47,8 @@ lefts :: [Either A A] -> [A] -- testing 5 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2+-- 1 candidates of size 1+-- 0 candidates of size 2 -- tested 1 candidates cannot conjure
eg/factorial.txt view
@@ -1,13 +1,13 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 28 candidates of size 5--- looking through 35 candidates of size 6--- looking through 167 candidates of size 7+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 35 candidates of size 6+-- 167 candidates of size 7 -- tested 95 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)@@ -15,12 +15,12 @@ factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 32/72 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 7 candidates of size 3--- looking through 8 candidates of size 4--- looking through 28 candidates of size 5--- looking through 75 candidates of size 6+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 7 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 75 candidates of size 6 -- tested 74 candidates factorial x = foldr (*) 1 [1..x]
eg/fib01.txt view
@@ -1,18 +1,18 @@ fib01 :: Int -> Int -> Int -> Int -- testing 8 combinations of argument values -- pruning with 6/10 rules--- looking through 4 candidates of size 1--- looking through 27 candidates of size 2--- looking through 117 candidates of size 3--- looking through 464 candidates of size 4--- looking through 1564 candidates of size 5+-- 4 candidates of size 1+-- 27 candidates of size 2+-- 117 candidates of size 3+-- 464 candidates of size 4+-- 1564 candidates of size 5 -- tested 2176 candidates cannot conjure fib01 :: Int -> Int -> Int -> Int -- testing 8 combinations of argument values -- pruning with 21/41 rules--- looking through 4 candidates of size 1+-- 4 candidates of size 1 -- tested 4 candidates cannot conjure
eg/fibonacci.txt view
@@ -1,18 +1,18 @@ fibonacci :: Int -> Int -- testing 7 combinations of argument values -- pruning with 21/44 rules--- looking through 4 candidates of size 1--- looking through 3 candidates of size 2--- looking through 9 candidates of size 3--- looking through 9 candidates of size 4--- looking through 26 candidates of size 5--- looking through 27 candidates of size 6--- looking through 116 candidates of size 7--- looking through 120 candidates of size 8--- looking through 552 candidates of size 9--- looking through 540 candidates of size 10--- looking through 2663 candidates of size 11--- looking through 2675 candidates of size 12+-- 4 candidates of size 1+-- 3 candidates of size 2+-- 9 candidates of size 3+-- 9 candidates of size 4+-- 26 candidates of size 5+-- 27 candidates of size 6+-- 116 candidates of size 7+-- 120 candidates of size 8+-- 552 candidates of size 9+-- 540 candidates of size 10+-- 2663 candidates of size 11+-- 2675 candidates of size 12 -- tested 4147 candidates fibonacci 0 = 1 fibonacci 1 = 1
eg/gcd.txt view
@@ -1,12 +1,12 @@ gcd :: Int -> Int -> Int -- testing 11 combinations of argument values -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 6 candidates of size 2--- looking through 11 candidates of size 3--- looking through 50 candidates of size 4--- looking through 98 candidates of size 5--- looking through 330 candidates of size 6+-- 3 candidates of size 1+-- 6 candidates of size 2+-- 11 candidates of size 3+-- 50 candidates of size 4+-- 98 candidates of size 5+-- 330 candidates of size 6 -- tested 172 candidates gcd x 0 = x gcd x y = gcd y (x `mod` y)
eg/higher.txt view
@@ -1,66 +1,66 @@ ($) :: (Int -> Int) -> Int -> Int -- pruning with 3/3 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2+-- 1 candidates of size 1+-- 1 candidates of size 2 -- tested 2 candidates f $ x = f x (.) :: (Int -> Int) -> (Int -> Int) -> Int -> Int -- pruning with 3/3 rules--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 4 candidates of size 3+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 4 candidates of size 3 -- tested 5 candidates (f . g) x = f (g x) flip :: (Int -> Int -> Int) -> Int -> Int -> Int -- pruning with 3/3 rules--- looking through 2 candidates of size 1--- looking through 0 candidates of size 2--- looking through 4 candidates of size 3+-- 2 candidates of size 1+-- 0 candidates of size 2+-- 4 candidates of size 3 -- tested 5 candidates flip f x y = f y x map :: (Int -> Int) -> [Int] -> [Int] -- pruning with 3/3 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 2 candidates of size 5--- looking through 5 candidates of size 6--- looking through 7 candidates of size 7+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 2 candidates of size 5+-- 5 candidates of size 6+-- 7 candidates of size 7 -- tested 13 candidates map f [] = [] map f (x:xs) = f x:map f xs fold :: (Int -> Int -> Int) -> Int -> [Int] -> Int -- pruning with 3/3 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 6 candidates of size 4--- looking through 4 candidates of size 5--- looking through 23 candidates of size 6--- looking through 19 candidates of size 7+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 6 candidates of size 4+-- 4 candidates of size 5+-- 23 candidates of size 6+-- 19 candidates of size 7 -- tested 38 candidates fold f x [] = x fold f x (y:xs) = fold f (f x y) xs filter :: (Int -> Bool) -> [Int] -> [Int] -- pruning with 3/3 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 0 candidates of size 5--- looking through 5 candidates of size 6--- looking through 0 candidates of size 7--- looking through 17 candidates of size 8--- looking through 0 candidates of size 9--- looking through 44 candidates of size 10--- looking through 0 candidates of size 11--- looking through 142 candidates of size 12+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 0 candidates of size 5+-- 5 candidates of size 6+-- 0 candidates of size 7+-- 17 candidates of size 8+-- 0 candidates of size 9+-- 44 candidates of size 10+-- 0 candidates of size 11+-- 142 candidates of size 12 -- tested 72 candidates filter f [] = [] filter f (x:xs) = if f x
eg/id.txt view
@@ -1,14 +1,14 @@ id :: Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1+-- 1 candidates of size 1 -- tested 1 candidates id x = x const :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 2 candidates of size 1+-- 2 candidates of size 1 -- tested 1 candidates const x y = x
eg/ints.txt view
@@ -1,30 +1,30 @@ second :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3+-- 0 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3 -- tested 2 candidates second xs = head (tail xs) third :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 0 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 1 candidates of size 4+-- 0 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4 -- tested 3 candidates third xs = head (tail (tail xs)) sum :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 14/25 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 0 candidates of size 3--- looking through 6 candidates of size 4--- looking through 6 candidates of size 5+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 0 candidates of size 3+-- 6 candidates of size 4+-- 6 candidates of size 5 -- tested 13 candidates sum [] = 0 sum (x:xs) = x + sum xs@@ -32,11 +32,11 @@ product :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 14/25 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 0 candidates of size 3--- looking through 6 candidates of size 4--- looking through 6 candidates of size 5+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 0 candidates of size 3+-- 6 candidates of size 4+-- 6 candidates of size 5 -- tested 18 candidates product [] = 1 product (x:xs) = x * product xs@@ -44,20 +44,20 @@ sum :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 15/26 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 0 candidates of size 3--- looking through 9 candidates of size 4+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 0 candidates of size 3+-- 9 candidates of size 4 -- tested 7 candidates sum xs = foldr (+) 0 xs product :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 15/26 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 0 candidates of size 3--- looking through 9 candidates of size 4+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 0 candidates of size 3+-- 9 candidates of size 4 -- tested 9 candidates product xs = foldr (*) 1 xs
eg/list.txt view
@@ -1,11 +1,11 @@ length :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 4/8 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 2 candidates of size 5+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 2 candidates of size 5 -- tested 8 candidates length [] = 0 length (x:xs) = length xs + 1@@ -13,13 +13,13 @@ reverse :: [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 4/4 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 3 candidates of size 4--- looking through 4 candidates of size 5--- looking through 7 candidates of size 6--- looking through 10 candidates of size 7+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 3 candidates of size 4+-- 4 candidates of size 5+-- 7 candidates of size 6+-- 10 candidates of size 7 -- tested 26 candidates reverse [] = [] reverse (x:xs) = reverse xs ++ [x]@@ -27,12 +27,12 @@ (++) :: [Int] -> [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 8 candidates of size 2--- looking through 11 candidates of size 3--- looking through 23 candidates of size 4--- looking through 86 candidates of size 5--- looking through 72 candidates of size 6+-- 3 candidates of size 1+-- 8 candidates of size 2+-- 11 candidates of size 3+-- 23 candidates of size 4+-- 86 candidates of size 5+-- 72 candidates of size 6 -- tested 149 candidates [] ++ xs = xs (x:xs) ++ ys = x:(xs ++ ys)@@ -40,23 +40,23 @@ (++) :: [Int] -> [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 2/2 rules--- looking through 3 candidates of size 1--- looking through 8 candidates of size 2--- looking through 11 candidates of size 3--- looking through 27 candidates of size 4+-- 3 candidates of size 1+-- 8 candidates of size 2+-- 11 candidates of size 3+-- 27 candidates of size 4 -- tested 35 candidates xs ++ ys = foldr (:) ys xs last :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 5/5 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 2 candidates of size 6--- looking through 4 candidates of size 7+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 2 candidates of size 6+-- 4 candidates of size 7 -- tested 5 candidates last [] = undefined last (x:xs) = if null xs@@ -66,15 +66,15 @@ zip :: [Int] -> [Int] -> [(Int,Int)] -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 2 candidates of size 6--- looking through 6 candidates of size 7--- looking through 6 candidates of size 8--- looking through 30 candidates of size 9+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 2 candidates of size 6+-- 6 candidates of size 7+-- 6 candidates of size 8+-- 30 candidates of size 9 -- tested 25 candidates zip [] xs = [] zip (x:xs) [] = []@@ -83,12 +83,12 @@ (\/) :: [Int] -> [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 3 candidates of size 1--- looking through 8 candidates of size 2--- looking through 11 candidates of size 3--- looking through 23 candidates of size 4--- looking through 86 candidates of size 5--- looking through 72 candidates of size 6+-- 3 candidates of size 1+-- 8 candidates of size 2+-- 11 candidates of size 3+-- 23 candidates of size 4+-- 86 candidates of size 5+-- 72 candidates of size 6 -- tested 151 candidates [] \/ xs = xs (x:xs) \/ ys = x:ys \/ xs@@ -96,17 +96,17 @@ ordered :: [Int] -> Bool -- testing 360 combinations of argument values -- pruning with 29/39 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 2 candidates of size 3--- looking through 2 candidates of size 4--- looking through 4 candidates of size 5--- looking through 12 candidates of size 6--- looking through 20 candidates of size 7--- looking through 30 candidates of size 8--- looking through 56 candidates of size 9--- looking through 112 candidates of size 10--- looking through 200 candidates of size 11+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 2 candidates of size 3+-- 2 candidates of size 4+-- 4 candidates of size 5+-- 12 candidates of size 6+-- 20 candidates of size 7+-- 30 candidates of size 8+-- 56 candidates of size 9+-- 112 candidates of size 10+-- 200 candidates of size 11 -- tested 319 candidates ordered [] = True ordered (x:xs) = ordered xs && (null xs || x <= head xs)
eg/maybe.txt view
@@ -1,8 +1,8 @@ isNothing :: Maybe A -> Bool -- testing 3 combinations of argument values -- pruning with 0/0 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2+-- 2 candidates of size 1+-- 1 candidates of size 2 -- tested 3 candidates isNothing Nothing = True isNothing (Just x) = False@@ -10,8 +10,8 @@ isJust :: Maybe A -> Bool -- testing 3 combinations of argument values -- pruning with 0/0 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2+-- 2 candidates of size 1+-- 1 candidates of size 2 -- tested 3 candidates isJust Nothing = False isJust (Just x) = True@@ -19,17 +19,17 @@ fromMaybe :: A -> Maybe A -> A -- testing 4 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2+-- 1 candidates of size 1+-- 1 candidates of size 2 -- tested 2 candidates fromMaybe x Nothing = x fromMaybe x (Just y) = y maybe :: A -> (A -> A) -> Maybe A -> A -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 5 candidates of size 3+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 5 candidates of size 3 -- tested 6 candidates maybe x f Nothing = x maybe x f (Just y) = f y@@ -37,9 +37,9 @@ listToMaybe :: [A] -> Maybe A -- testing 4 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 1 candidates of size 3+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3 -- tested 2 candidates listToMaybe [] = Nothing listToMaybe (x:xs) = Just x@@ -47,10 +47,10 @@ maybeToList :: Maybe A -> [A] -- testing 4 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4 -- tested 2 candidates maybeToList Nothing = [] maybeToList (Just x) = [x]@@ -58,8 +58,8 @@ catMaybes :: [Maybe A] -> [A] -- testing 44 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2+-- 1 candidates of size 1+-- 0 candidates of size 2 -- tested 1 candidates cannot conjure
eg/oddeven.txt view
@@ -1,13 +1,13 @@ odd :: Int -> Bool -- testing 6 combinations of argument values -- pruning with 21/44 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 1 candidates of size 4--- looking through 1 candidates of size 5--- looking through 0 candidates of size 6--- looking through 2 candidates of size 7+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4+-- 1 candidates of size 5+-- 0 candidates of size 6+-- 2 candidates of size 7 -- tested 8 candidates odd 0 = False odd 1 = True@@ -16,13 +16,13 @@ even :: Int -> Bool -- testing 6 combinations of argument values -- pruning with 21/44 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 1 candidates of size 4--- looking through 1 candidates of size 5--- looking through 0 candidates of size 6--- looking through 2 candidates of size 7+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4+-- 1 candidates of size 5+-- 0 candidates of size 6+-- 2 candidates of size 7 -- tested 8 candidates even 0 = True even 1 = False@@ -31,22 +31,22 @@ odd :: Int -> Bool -- testing 6 combinations of argument values -- pruning with 36/55 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 3 candidates of size 3--- looking through 1 candidates of size 4--- looking through 46 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 1 candidates of size 4+-- 46 candidates of size 5 -- tested 31 candidates odd x = 1 == x `mod` 2 even :: Int -> Bool -- testing 6 combinations of argument values -- pruning with 36/55 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 3 candidates of size 3--- looking through 2 candidates of size 4--- looking through 45 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 2 candidates of size 4+-- 45 candidates of size 5 -- tested 22 candidates even x = 0 == x `mod` 2
+ eg/peano.hs view
@@ -0,0 +1,50 @@+-- peano.hs: conjuring functions over peano naturals+--+-- This is a minimal example demonstrating+-- the use of user-defined data types with Conjure.+--+-- Copyright (C) 2025 Rudy Matela+-- Distributed under the 3-Clause BSD licence (see the file LICENSE).+{-# LANGUAGE TemplateHaskell #-}+import Conjure+import Test.LeanCheck++data Peano = Z | S Peano+ deriving (Show, Eq)++-- The following not only derives a Conjurable instance+-- but also the needed Listable, Express and Name instances.+deriveConjurable ''Peano++plus :: Peano -> Peano -> Peano+plus Z Z = Z+plus Z (S Z) = S Z+plus (S Z) Z = S Z+plus (S Z) (S Z) = S (S Z)+plus (S (S Z)) (S Z) = S (S (S Z))+plus (S Z) (S (S Z)) = S (S (S Z))++main :: IO ()+main = do+ conjure "+" plus+ [ pr Z+ , prim "S" S+ ]++ -- use + to conjure *+ conjure "*" times+ [ pr Z+ , prim "S" S+ , prim "+" (let p + Z = p+ p + S q = S p + q+ in (+))+ ]++times :: Peano -> Peano -> Peano+times Z Z = Z+times Z (S Z) = Z+times (S Z) Z = Z+times (S Z) (S Z) = S Z+times (S (S Z)) (S Z) = (S (S Z))+times (S Z) (S (S Z)) = (S (S Z))+times (S (S Z)) (S (S Z)) = (S (S (S (S Z))))
+ eg/peano.txt view
@@ -0,0 +1,25 @@+(+) :: Peano -> Peano -> Peano+-- testing 6 combinations of argument values+-- pruning with 0/0 rules+-- 3 candidates of size 1+-- 11 candidates of size 2+-- 38 candidates of size 3+-- 87 candidates of size 4+-- 218 candidates of size 5+-- tested 140 candidates+p + Z = p+p + S q = S p + q++(*) :: Peano -> Peano -> Peano+-- testing 7 combinations of argument values+-- pruning with 6/10 rules+-- 3 candidates of size 1+-- 11 candidates of size 2+-- 41 candidates of size 3+-- 108 candidates of size 4+-- 291 candidates of size 5+-- 746 candidates of size 6+-- tested 537 candidates+p * Z = Z+p * S q = p + p * q+
eg/pow.txt view
@@ -1,14 +1,14 @@ pow :: Int -> Int -> Int -- testing 5 combinations of argument values -- pruning with 14/30 rules--- looking through 4 candidates of size 1--- looking through 16 candidates of size 2--- looking through 46 candidates of size 3--- looking through 159 candidates of size 4--- looking through 433 candidates of size 5--- looking through 1382 candidates of size 6--- looking through 4136 candidates of size 7--- looking through 13292 candidates of size 8+-- 4 candidates of size 1+-- 16 candidates of size 2+-- 46 candidates of size 3+-- 159 candidates of size 4+-- 433 candidates of size 5+-- 1382 candidates of size 6+-- 4136 candidates of size 7+-- 13292 candidates of size 8 -- tested 6383 candidates pow x 0 = 1 pow x y = x * pow x (y - 1)@@ -16,12 +16,12 @@ pow :: Int -> Int -> Int -- testing 5 combinations of argument values -- pruning with 15/19 rules--- looking through 4 candidates of size 1--- looking through 18 candidates of size 2--- looking through 58 candidates of size 3--- looking through 174 candidates of size 4--- looking through 485 candidates of size 5--- looking through 1387 candidates of size 6+-- 4 candidates of size 1+-- 18 candidates of size 2+-- 58 candidates of size 3+-- 174 candidates of size 4+-- 485 candidates of size 5+-- 1387 candidates of size 6 -- tested 2126 candidates cannot conjure
eg/replicate.txt view
@@ -1,14 +1,14 @@ replicate :: Int -> Char -> [Char] -- testing 360 combinations of argument values -- pruning with 4/7 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 1 candidates of size 3--- looking through 1 candidates of size 4--- looking through 3 candidates of size 5--- looking through 2 candidates of size 6--- looking through 3 candidates of size 7--- looking through 3 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3+-- 1 candidates of size 4+-- 3 candidates of size 5+-- 2 candidates of size 6+-- 3 candidates of size 7+-- 3 candidates of size 8 -- tested 12 candidates replicate 0 c = "" replicate x c = c:replicate (x - 1) c@@ -16,36 +16,36 @@ replicates :: [Char] -> Int -> [Char] -- testing 360 combinations of argument values -- pruning with 2/2 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 1 candidates of size 5+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 1 candidates of size 5 -- tested 3 candidates replicates cs x = concat (transpose (replicate x cs)) replicates :: [Char] -> Int -> [Char] -- testing 360 combinations of argument values -- pruning with 0/0 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 1 candidates of size 5+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 1 candidates of size 5 -- tested 2 candidates replicates cs x = concat (map (replicate x) cs) replicates :: [Char] -> Int -> [Char] -- testing 360 combinations of argument values -- pruning with 4/4 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 4 candidates of size 4--- looking through 1 candidates of size 5--- looking through 12 candidates of size 6--- looking through 1 candidates of size 7--- looking through 34 candidates of size 8+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 4 candidates of size 4+-- 1 candidates of size 5+-- 12 candidates of size 6+-- 1 candidates of size 7+-- 34 candidates of size 8 -- tested 24 candidates replicates "" x = "" replicates (c:cs) x = replicate x c ++ replicates cs x
eg/setelem.txt view
@@ -1,14 +1,14 @@ elem :: Int -> [Int] -> Bool -- testing 360 combinations of argument values -- pruning with 40/53 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 6 candidates of size 5--- looking through 0 candidates of size 6--- looking through 0 candidates of size 7--- looking through 24 candidates of size 8+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 6 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 24 candidates of size 8 -- tested 33 candidates elem x [] = False elem x (y:xs) = elem x xs || x == y@@ -16,14 +16,14 @@ set :: [Int] -> Bool -- testing 360 combinations of argument values -- pruning with 41/52 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 1 candidates of size 5--- looking through 2 candidates of size 6--- looking through 4 candidates of size 7--- looking through 6 candidates of size 8+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 1 candidates of size 5+-- 2 candidates of size 6+-- 4 candidates of size 7+-- 6 candidates of size 8 -- tested 15 candidates set [] = True set (x:xs) = set xs && not (elem x xs)
eg/sort.hs view
@@ -60,7 +60,7 @@ ] -- an insert function- conjureWithMaxSize 18 "insert" insert'+ conjureWith args{target=50400} "insert" insert' [ prim "[]" ([] :: [Int]) , prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "<=" ((<=) :: Int -> Int -> Bool)@@ -73,7 +73,7 @@ -- this one is not out of reach performance wise, -- but is not generated because of the deconstruction restriction. -- The following does generate a correct but inneficient version of qsort.- conjureWith args{maxSize=14} "qsort" sort'+ conjure "qsort" sort' [ pr ([] :: [Int]) , prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "++" ((++) :: [Int] -> [Int] -> [Int])@@ -84,7 +84,7 @@ -- if we disable the descent requirement, we get the efficient qsort -- though with a larger search space- conjureWith args{maxSize=14, requireDescent=False} "qsort" sort'+ conjureWith args{requireDescent=False} "qsort" sort' [ pr ([] :: [Int]) , prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "++" ((++) :: [Int] -> [Int] -> [Int])@@ -98,7 +98,7 @@ -- 2 3 4 5 678 9 10 11 12 13 14 15 16 17 18 19 -- OOM after size 17, out of reach performance wise -- update: cannot reach at size 19 on lapmatrud OOM- conjureWith args{maxSize=12} "merge" merge'+ conjureWith args{target=1080} "merge" merge' [ pr ([] :: [Int]) , prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "<=" ((<=) :: Int -> Int -> Bool)@@ -106,7 +106,7 @@ ] -- unreachable: needs about 26, but can only reach 16- conjureWithMaxSize 12 "merge" merge'+ conjureWith args{target=1080} "merge" merge' [ prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "compare" (compare :: Int -> Int -> Ordering) , primOrdCaseFor (undefined :: [Int])
eg/sort.txt view
@@ -1,11 +1,11 @@ sort :: [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 6/7 rules--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 4 candidates of size 3--- looking through 11 candidates of size 4--- looking through 23 candidates of size 5+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 4 candidates of size 3+-- 11 candidates of size 4+-- 23 candidates of size 5 -- tested 22 candidates sort [] = [] sort (x:xs) = insert x (sort xs)@@ -13,33 +13,33 @@ sort :: [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 1/2 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 4 candidates of size 4+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 4 candidates of size 4 -- tested 5 candidates sort xs = foldr insert [] xs insert :: Int -> [Int] -> [Int] -- testing 4 combinations of argument values -- pruning with 4/4 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 2 candidates of size 5--- looking through 19 candidates of size 6--- looking through 6 candidates of size 7--- looking through 44 candidates of size 8--- looking through 62 candidates of size 9--- looking through 91 candidates of size 10--- looking through 334 candidates of size 11--- looking through 220 candidates of size 12--- looking through 1358 candidates of size 13--- looking through 1019 candidates of size 14--- looking through 4638 candidates of size 15--- looking through 6332 candidates of size 16--- looking through 14550 candidates of size 17+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 2 candidates of size 5+-- 19 candidates of size 6+-- 6 candidates of size 7+-- 44 candidates of size 8+-- 62 candidates of size 9+-- 91 candidates of size 10+-- 334 candidates of size 11+-- 220 candidates of size 12+-- 1358 candidates of size 13+-- 1019 candidates of size 14+-- 4638 candidates of size 15+-- 6332 candidates of size 16+-- 14550 candidates of size 17 -- tested 14943 candidates insert x [] = [x] insert x (y:xs) = if x <= y@@ -49,20 +49,20 @@ qsort :: [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 8/8 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 3 candidates of size 4--- looking through 6 candidates of size 5--- looking through 9 candidates of size 6--- looking through 22 candidates of size 7--- looking through 37 candidates of size 8--- looking through 84 candidates of size 9--- looking through 169 candidates of size 10--- looking through 352 candidates of size 11--- looking through 767 candidates of size 12--- looking through 1600 candidates of size 13--- looking through 3499 candidates of size 14+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 3 candidates of size 4+-- 6 candidates of size 5+-- 9 candidates of size 6+-- 22 candidates of size 7+-- 37 candidates of size 8+-- 84 candidates of size 9+-- 169 candidates of size 10+-- 352 candidates of size 11+-- 767 candidates of size 12+-- 1600 candidates of size 13+-- 3499 candidates of size 14 -- tested 3667 candidates qsort [] = [] qsort (x:xs) = filter (x >) (qsort xs) ++ (x:filter (x <=) (qsort xs))@@ -70,20 +70,20 @@ qsort :: [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 8/8 rules--- looking through 2 candidates of size 1--- looking through 1 candidates of size 2--- looking through 1 candidates of size 3--- looking through 3 candidates of size 4--- looking through 6 candidates of size 5--- looking through 9 candidates of size 6--- looking through 28 candidates of size 7--- looking through 51 candidates of size 8--- looking through 128 candidates of size 9--- looking through 303 candidates of size 10--- looking through 648 candidates of size 11--- looking through 1621 candidates of size 12--- looking through 3592 candidates of size 13--- looking through 8475 candidates of size 14+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 1 candidates of size 3+-- 3 candidates of size 4+-- 6 candidates of size 5+-- 9 candidates of size 6+-- 28 candidates of size 7+-- 51 candidates of size 8+-- 128 candidates of size 9+-- 303 candidates of size 10+-- 648 candidates of size 11+-- 1621 candidates of size 12+-- 3592 candidates of size 13+-- 8475 candidates of size 14 -- tested 7794 candidates qsort [] = [] qsort (x:xs) = qsort (filter (x >) xs) ++ (x:qsort (filter (x <=) xs))@@ -91,36 +91,32 @@ merge :: [Int] -> [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 4/4 rules--- looking through 3 candidates of size 1--- looking through 8 candidates of size 2--- looking through 11 candidates of size 3--- looking through 23 candidates of size 4--- looking through 86 candidates of size 5--- looking through 72 candidates of size 6--- looking through 297 candidates of size 7--- looking through 322 candidates of size 8--- looking through 939 candidates of size 9--- looking through 1966 candidates of size 10--- looking through 2972 candidates of size 11--- looking through 11011 candidates of size 12--- tested 17710 candidates+-- 3 candidates of size 1+-- 8 candidates of size 2+-- 11 candidates of size 3+-- 23 candidates of size 4+-- 86 candidates of size 5+-- 72 candidates of size 6+-- 297 candidates of size 7+-- 322 candidates of size 8+-- 939 candidates of size 9+-- tested 1761 candidates cannot conjure merge :: [Int] -> [Int] -> [Int] -- testing 360 combinations of argument values -- pruning with 1/2 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 3 candidates of size 3--- looking through 10 candidates of size 4--- looking through 21 candidates of size 5--- looking through 26 candidates of size 6--- looking through 61 candidates of size 7--- looking through 92 candidates of size 8--- looking through 203 candidates of size 9--- looking through 430 candidates of size 10--- looking through 1086 candidates of size 11--- looking through 2068 candidates of size 12--- tested 4004 candidates+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 3 candidates of size 3+-- 10 candidates of size 4+-- 21 candidates of size 5+-- 26 candidates of size 6+-- 61 candidates of size 7+-- 92 candidates of size 8+-- 203 candidates of size 9+-- 430 candidates of size 10+-- 1086 candidates of size 11+-- tested 1936 candidates cannot conjure
eg/spec.txt view
@@ -1,38 +1,38 @@ square :: Int -> Int -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 6 candidates of size 3+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 6 candidates of size 3 -- tested 9 candidates square x = x * x square :: Int -> Int -- pruning with 14/25 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 6 candidates of size 3+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 6 candidates of size 3 -- tested 9 candidates square x = x * x sum :: [Int] -> Int -- pruning with 4/8 rules--- looking through 1 candidates of size 1--- looking through 2 candidates of size 2--- looking through 2 candidates of size 3--- looking through 3 candidates of size 4--- looking through 5 candidates of size 5+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 2 candidates of size 3+-- 3 candidates of size 4+-- 5 candidates of size 5 -- tested 9 candidates sum [] = 0 sum (x:xs) = x + sum xs (++) :: [Int] -> [Int] -> [Int] -- pruning with 3/3 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 11 candidates of size 3--- looking through 31 candidates of size 4--- looking through 94 candidates of size 5--- looking through 225 candidates of size 6+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 11 candidates of size 3+-- 31 candidates of size 4+-- 94 candidates of size 5+-- 225 candidates of size 6 -- tested 212 candidates [] ++ xs = xs (x:xs) ++ ys = x:(xs ++ ys)
eg/subset.txt view
@@ -1,14 +1,14 @@ subset :: [Int] -> [Int] -> Bool -- testing 44 combinations of argument values -- pruning with 29/39 rules--- looking through 2 candidates of size 1--- looking through 4 candidates of size 2--- looking through 8 candidates of size 3--- looking through 10 candidates of size 4--- looking through 64 candidates of size 5--- looking through 40 candidates of size 6--- looking through 64 candidates of size 7--- looking through 522 candidates of size 8+-- 2 candidates of size 1+-- 4 candidates of size 2+-- 8 candidates of size 3+-- 10 candidates of size 4+-- 64 candidates of size 5+-- 40 candidates of size 6+-- 64 candidates of size 7+-- 522 candidates of size 8 -- tested 553 candidates subset [] xs = True subset (x:xs) ys = subset xs ys && elem x ys@@ -16,11 +16,11 @@ subset :: [Int] -> [Int] -> Bool -- testing 44 combinations of argument values -- pruning with 3/3 rules--- looking through 0 candidates of size 1--- looking through 0 candidates of size 2--- looking through 2 candidates of size 3--- looking through 6 candidates of size 4--- looking through 2 candidates of size 5+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 6 candidates of size 4+-- 2 candidates of size 5 -- tested 9 candidates subset xs ys = sort xs `isSubsequenceOf` sort ys
eg/take-drop.txt view
@@ -1,13 +1,13 @@ drop :: Int -> [A] -> [A] -- testing 360 combinations of argument values -- pruning with 4/7 rules--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 4 candidates of size 3--- looking through 6 candidates of size 4--- looking through 8 candidates of size 5--- looking through 13 candidates of size 6--- looking through 24 candidates of size 7+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 4 candidates of size 3+-- 6 candidates of size 4+-- 8 candidates of size 5+-- 13 candidates of size 6+-- 24 candidates of size 7 -- tested 39 candidates drop 0 xs = xs drop x [] = []@@ -16,15 +16,15 @@ take :: Int -> [A] -> [A] -- testing 153 combinations of argument values -- pruning with 4/7 rules--- looking through 2 candidates of size 1--- looking through 3 candidates of size 2--- looking through 4 candidates of size 3--- looking through 6 candidates of size 4--- looking through 8 candidates of size 5--- looking through 13 candidates of size 6--- looking through 24 candidates of size 7--- looking through 31 candidates of size 8--- looking through 59 candidates of size 9+-- 2 candidates of size 1+-- 3 candidates of size 2+-- 4 candidates of size 3+-- 6 candidates of size 4+-- 8 candidates of size 5+-- 13 candidates of size 6+-- 24 candidates of size 7+-- 31 candidates of size 8+-- 59 candidates of size 9 -- tested 111 candidates take 0 xs = [] take x [] = []
eg/tapps.txt view
@@ -1,21 +1,21 @@ third :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 14/25 rules--- looking through 2 candidates of size 1--- looking through 5 candidates of size 2--- looking through 3 candidates of size 3--- looking through 10 candidates of size 4+-- 2 candidates of size 1+-- 5 candidates of size 2+-- 3 candidates of size 3+-- 10 candidates of size 4 -- tested 12 candidates third xs = head (tail (tail xs)) product :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 14/25 rules--- looking through 2 candidates of size 1--- looking through 5 candidates of size 2--- looking through 3 candidates of size 3--- looking through 10 candidates of size 4--- looking through 18 candidates of size 5+-- 2 candidates of size 1+-- 5 candidates of size 2+-- 3 candidates of size 3+-- 10 candidates of size 4+-- 18 candidates of size 5 -- tested 26 candidates product [] = 1 product (x:xs) = x * product xs@@ -23,10 +23,10 @@ product :: [Int] -> Int -- testing 360 combinations of argument values -- pruning with 15/26 rules--- looking through 2 candidates of size 1--- looking through 5 candidates of size 2--- looking through 3 candidates of size 3--- looking through 13 candidates of size 4+-- 2 candidates of size 1+-- 5 candidates of size 2+-- 3 candidates of size 3+-- 13 candidates of size 4 -- tested 14 candidates product xs = foldr (*) 1 xs
+ eg/these.hs view
@@ -0,0 +1,110 @@+-- Example+{-# LANGUAGE TemplateHaskell #-}++import Conjure+import Test.LeanCheck+++-- This was inspired by the These datatype from the cathis package.+-- https://hackage.haskell.org/package/cathis+-- This is an extension of the type there with the added None constructor.+data These a b = None | This a | That b | These a b+ deriving (Eq, Ord, Show, Read)++isThis :: These a b -> Bool+isThis (This _) = True+isThis (These _ _) = True+isThis _ = False++fromThis :: These a b -> a+fromThis (This x) = x+fromThis (These x _) = x++isThat :: These a b -> Bool+isThat (That _) = True+isThat (These _ _) = True+isThat _ = False++fromThat :: These a b -> b+fromThat (That y) = y+fromThat (These _ y) = y+++deriveConjurable ''These+++fromThese' :: A -> B -> These A B -> (A, B)+fromThese' 0 1 None = (0, 1)+fromThese' 0 1 (This 2) = (2,1)+fromThese' 0 1 (That 2) = (0,2)+fromThese' 0 1 (These 1 0) = (1,0)++listhese' :: These A A -> [A]+listhese' (These 1 2) = [1,2]+listhese' (This 1) = [1]+listhese' (That 2) = [2]++cathis' :: [These A B] -> [A]+cathis' [This 0, This 1] = [0,1]+cathis' [None, That 0] = []+cathis' [This 0, None, That 1] = [0]+cathis' [This 0, These 0 1] = [0,0]+cathis' [These 0 1, None, This 0] = [0,0]++cathat' :: [These A B] -> [B]+cathat' [This 0, This 1] = []+cathat' [None, That 0] = [0]+cathat' [This 0, None, That 1] = [1]+cathat' [That 0, These 0 1] = [0,1]++cathese' :: [These A A] -> [A]+cathese' [This 0, This 1] = [0,1]+cathese' [None, That 0] = [0]+cathese' [This 0, None, That 1] = [0,1]+cathese' [This 0, These 0 1] = [0,0,1]+cathese' [These 0 1, That 2] = [0,1,2]++main :: IO ()+main = do+ conjure "fromThese" fromThese'+ [ prim "," ((,) :: A -> B -> (A,B))+ ]++ conjure "listhese" listhese'+ [ pr ([] :: [A])+ , prim ":" ((:) :: A -> [A] -> [A])+ ]++ conjure "cathis" cathis'+ [ pr ([] :: [A])+ , prim ":" ((:) :: A -> [A] -> [A])+ , prim "isThis" (isThis :: These A B -> Bool)+ , prim "fromThis" (fromThis :: These A B -> A)+ , prif (undefined :: [A])+ ]++ conjure "cathat" cathat'+ [ pr ([] :: [B])+ , prim ":" ((:) :: B -> [B] -> [B])+ , prim "isThat" (isThat :: These A B -> Bool)+ , prim "fromThat" (fromThat :: These A B -> B)+ , prif (undefined :: [B])+ ]++ -- couldn't make this reachable, I didn't try much...+ conjureWith args{target = 1080} "cathese" cathese'+ [ pr ([] :: [A])+ , prim ":" ((:) :: A -> [A] -> [A])+ , prim "++" ((++) :: [A] -> [A] -> [A])+ , prim "isThis" (isThis :: These A A -> Bool)+ , prim "fromThis" (fromThis :: These A A -> A)+ , prim "isThat" (isThat :: These A A -> Bool)+ , prim "fromThat" (fromThat :: These A A -> A)+ -- , prif (undefined :: A)+ , prif (undefined :: [A])+ ]+ -- expected functionality+ -- these [] = []+ -- these (This x : ts) = x : these ts+ -- these (That y : ts) = y : these ts+ -- these (These x y : ts) = x : y : these ts
+ eg/these.txt view
@@ -0,0 +1,99 @@+fromThese :: A -> B -> These A B -> (A,B)+-- testing 4 combinations of argument values+-- pruning with 0/0 rules+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 15 candidates of size 10+-- tested 16 candidates+fromThese x y None = (x,y)+fromThese x y (This z) = (z,y)+fromThese x y (That z) = (x,z)+fromThese x y (These z x') = (z,x')++listhese :: These A A -> [A]+-- testing 3 combinations of argument values+-- pruning with 0/0 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 4 candidates of size 4+-- 0 candidates of size 5+-- 11 candidates of size 6+-- 0 candidates of size 7+-- 26 candidates of size 8+-- 0 candidates of size 9+-- 57 candidates of size 10+-- tested 83 candidates+listhese None = []+listhese (This x) = [x]+listhese (That x) = [x]+listhese (These x y) = [x,y]++cathis :: [These A B] -> [A]+-- testing 5 combinations of argument values+-- pruning with 3/3 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 1 candidates of size 5+-- 1 candidates of size 6+-- 2 candidates of size 7+-- 2 candidates of size 8+-- 3 candidates of size 9+-- 6 candidates of size 10+-- 8 candidates of size 11+-- tested 17 candidates+cathis [] = []+cathis (t:ts) = if isThis t+ then fromThis t:cathis ts+ else cathis ts++cathat :: [These A B] -> [B]+-- testing 4 combinations of argument values+-- pruning with 3/3 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 1 candidates of size 5+-- 1 candidates of size 6+-- 2 candidates of size 7+-- 2 candidates of size 8+-- 3 candidates of size 9+-- 6 candidates of size 10+-- 8 candidates of size 11+-- tested 17 candidates+cathat [] = []+cathat (t:ts) = if isThat t+ then fromThat t:cathat ts+ else cathat ts++cathese :: [These A A] -> [A]+-- testing 5 combinations of argument values+-- pruning with 7/7 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 2 candidates of size 5+-- 3 candidates of size 6+-- 4 candidates of size 7+-- 8 candidates of size 8+-- 17 candidates of size 9+-- 36 candidates of size 10+-- 54 candidates of size 11+-- 119 candidates of size 12+-- 268 candidates of size 13+-- 490 candidates of size 14+-- 985 candidates of size 15+-- tested 1987 candidates+cannot conjure+
eg/tree.hs view
@@ -78,6 +78,9 @@ instance Name Tree where name _ = "t1" +-- the following instance could have been derived with:+-- deriveConjurable ''Tree+ instance Conjurable Tree where conjureExpress = reifyExpress conjureEquality = reifyEquality
eg/tree.txt view
@@ -1,13 +1,13 @@ leftmost :: Tree -> Int -- testing 360 combinations of argument values -- pruning with 3/3 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 4 candidates of size 6--- looking through 16 candidates of size 7+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 4 candidates of size 6+-- 16 candidates of size 7 -- tested 7 candidates leftmost Leaf = undefined leftmost (Node t1 x t2) = if nil t1@@ -17,13 +17,13 @@ rightmost :: Tree -> Int -- testing 360 combinations of argument values -- pruning with 3/3 rules--- looking through 1 candidates of size 1--- looking through 1 candidates of size 2--- looking through 0 candidates of size 3--- looking through 0 candidates of size 4--- looking through 0 candidates of size 5--- looking through 4 candidates of size 6--- looking through 16 candidates of size 7+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 4 candidates of size 6+-- 16 candidates of size 7 -- tested 16 candidates rightmost Leaf = undefined rightmost (Node t1 x t2) = if nil t2@@ -33,14 +33,14 @@ size :: Tree -> Int -- testing 360 combinations of argument values -- pruning with 4/8 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 0 candidates of size 3--- looking through 2 candidates of size 4--- looking through 4 candidates of size 5--- looking through 8 candidates of size 6--- looking through 12 candidates of size 7--- looking through 24 candidates of size 8+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 0 candidates of size 3+-- 2 candidates of size 4+-- 4 candidates of size 5+-- 8 candidates of size 6+-- 12 candidates of size 7+-- 24 candidates of size 8 -- tested 40 candidates size Leaf = 0 size (Node t1 x t2) = size t1 + (size t2 + 1)@@ -48,14 +48,14 @@ height :: Tree -> Int -- testing 360 combinations of argument values -- pruning with 49/65 rules--- looking through 3 candidates of size 1--- looking through 3 candidates of size 2--- looking through 0 candidates of size 3--- looking through 6 candidates of size 4--- looking through 14 candidates of size 5--- looking through 34 candidates of size 6--- looking through 98 candidates of size 7--- looking through 274 candidates of size 8+-- 3 candidates of size 1+-- 3 candidates of size 2+-- 0 candidates of size 3+-- 6 candidates of size 4+-- 14 candidates of size 5+-- 34 candidates of size 6+-- 98 candidates of size 7+-- 274 candidates of size 8 -- tested 200 candidates height Leaf = -1 height (Node t1 x t2) = 1 + max (height t1) (height t2)@@ -63,18 +63,18 @@ mem :: Int -> Tree -> Bool -- testing 360 combinations of argument values -- pruning with 11/17 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 0 candidates of size 5--- looking through 0 candidates of size 6--- looking through 0 candidates of size 7--- looking through 20 candidates of size 8--- looking through 0 candidates of size 9--- looking through 0 candidates of size 10--- looking through 0 candidates of size 11--- looking through 80 candidates of size 12+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 0 candidates of size 5+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 20 candidates of size 8+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 0 candidates of size 11+-- 80 candidates of size 12 -- tested 88 candidates mem x Leaf = False mem x (Node t1 y t2) = mem x t1 || (mem x t2 || x == y)@@ -82,41 +82,41 @@ ordered :: Tree -> Bool -- testing 360 combinations of argument values -- pruning with 29/39 rules--- looking through 2 candidates of size 1--- looking through 2 candidates of size 2--- looking through 2 candidates of size 3--- looking through 0 candidates of size 4--- looking through 10 candidates of size 5--- looking through 30 candidates of size 6--- looking through 0 candidates of size 7--- looking through 68 candidates of size 8--- looking through 216 candidates of size 9--- looking through 56 candidates of size 10--- looking through 802 candidates of size 11--- looking through 2077 candidates of size 12+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 2 candidates of size 3+-- 0 candidates of size 4+-- 10 candidates of size 5+-- 30 candidates of size 6+-- 0 candidates of size 7+-- 68 candidates of size 8+-- 216 candidates of size 9+-- 56 candidates of size 10+-- 802 candidates of size 11+-- 2077 candidates of size 12 -- tested 3265 candidates cannot conjure ordered :: Tree -> Bool -- testing 360 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+-- 0 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3 -- tested 1 candidates ordered t1 = strictlyOrdered (inorder t1) preorder :: Tree -> [Int] -- testing 360 combinations of argument values -- pruning with 4/4 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 2 candidates of size 5--- looking through 5 candidates of size 6--- looking through 4 candidates of size 7--- looking through 9 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 2 candidates of size 5+-- 5 candidates of size 6+-- 4 candidates of size 7+-- 9 candidates of size 8 -- tested 15 candidates preorder Leaf = [] preorder (Node t1 x t2) = x:(preorder t1 ++ preorder t2)@@ -124,14 +124,14 @@ inorder :: Tree -> [Int] -- testing 360 combinations of argument values -- pruning with 4/4 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 2 candidates of size 5--- looking through 5 candidates of size 6--- looking through 4 candidates of size 7--- looking through 9 candidates of size 8+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 2 candidates of size 5+-- 5 candidates of size 6+-- 4 candidates of size 7+-- 9 candidates of size 8 -- tested 19 candidates inorder Leaf = [] inorder (Node t1 x t2) = inorder t1 ++ (x:inorder t2)@@ -139,16 +139,16 @@ posorder :: Tree -> [Int] -- testing 360 combinations of argument values -- pruning with 4/4 rules--- looking through 1 candidates of size 1--- looking through 0 candidates of size 2--- looking through 0 candidates of size 3--- looking through 1 candidates of size 4--- looking through 2 candidates of size 5--- looking through 5 candidates of size 6--- looking through 4 candidates of size 7--- looking through 9 candidates of size 8--- looking through 14 candidates of size 9--- looking through 17 candidates of size 10+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 2 candidates of size 5+-- 5 candidates of size 6+-- 4 candidates of size 7+-- 9 candidates of size 8+-- 14 candidates of size 9+-- 17 candidates of size 10 -- tested 50 candidates posorder Leaf = [] posorder (Node t1 x t2) = posorder t1 ++ (posorder t2 ++ [x])
eg/tri.txt view
@@ -1,13 +1,13 @@ tri :: Int -> Int -- testing 4 combinations of argument values -- pruning with 11/33 rules--- looking through 2 candidates of size 1--- looking through 0 candidates of size 2--- looking through 5 candidates of size 3--- looking through 5 candidates of size 4--- looking through 10 candidates of size 5--- looking through 8 candidates of size 6--- looking through 41 candidates of size 7+-- 2 candidates of size 1+-- 0 candidates of size 2+-- 5 candidates of size 3+-- 5 candidates of size 4+-- 10 candidates of size 5+-- 8 candidates of size 6+-- 41 candidates of size 7 -- tested 31 candidates tri 1 = 1 tri x = x + tri (x - 1)
mk/depend.mk view
@@ -598,6 +598,23 @@ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \ eg/oddeven.hs+eg/peano: \+ eg/peano.hs \+ mk/toplibs+eg/peano.o: \+ src/Conjure/Utils.hs \+ src/Conjure/Red.hs \+ src/Conjure/Reason.hs \+ src/Conjure/Prim.hs \+ src/Conjure.hs \+ src/Conjure/Expr.hs \+ src/Conjure/Engine.hs \+ src/Conjure/Defn/Test.hs \+ src/Conjure/Defn/Redundancy.hs \+ src/Conjure/Defn.hs \+ src/Conjure/Conjurable.hs \+ src/Conjure/Conjurable/Derive.hs \+ eg/peano.hs eg/pow: \ eg/pow.hs \ mk/toplibs@@ -734,6 +751,23 @@ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \ eg/tapps.hs+eg/these: \+ eg/these.hs \+ mk/toplibs+eg/these.o: \+ src/Conjure/Utils.hs \+ src/Conjure/Red.hs \+ src/Conjure/Reason.hs \+ src/Conjure/Prim.hs \+ src/Conjure.hs \+ src/Conjure/Expr.hs \+ src/Conjure/Engine.hs \+ src/Conjure/Defn/Test.hs \+ src/Conjure/Defn/Redundancy.hs \+ src/Conjure/Defn.hs \+ src/Conjure/Conjurable.hs \+ src/Conjure/Conjurable/Derive.hs \+ eg/these.hs eg/tree: \ eg/tree.hs \ mk/toplibs
src/Conjure/Conjurable.hs view
@@ -41,6 +41,7 @@ , Express (..) , conjureArgumentPats , conjureMostGeneralCanonicalVariation+ , conjureCasesFor ) where @@ -67,9 +68,9 @@ -- 2. the '==' function encoded as an 'Expr' when available; -- 3. 'tiers' of enumerated test values encoded as 'Expr's when available; -- 4. infinite list of potential variable names;--- 5. boolean indicating whether the type is atomic;+-- 5. pattern (breakdown) cases for that type -- 6. the 'conjureSize' function encoded as an 'Expr'.-type Reification1 = (Expr, Maybe Expr, Maybe [[Expr]], [String], Bool, Expr)+type Reification1 = (Expr, Maybe Expr, Maybe [[Expr]], [String], [Expr], Expr) -- | A reification over a collection of types. --@@ -186,7 +187,7 @@ -- -- This is used in the implementation of 'conjureReification'. conjureReification1 :: Conjurable a => a -> Reification1-conjureReification1 x = (hole x, conjureEquality x, conjureTiers x, names x, null $ conjureCases x, value "conjureSize" (conjureSize -:> x))+conjureReification1 x = (hole x, conjureEquality x, conjureTiers x, names x, conjureCases x, value "conjureSize" (conjureSize -:> x)) -- | Conjures a list of 'Reification1' -- for a 'Conjurable' type, its subtypes and 'Bool'.@@ -336,8 +337,7 @@ -- | Checks if an 'Expr' is of an unbreakable type. conjureIsUnbreakable :: Conjurable f => f -> Expr -> Bool-conjureIsUnbreakable f e = head- [is | (h,_,_,_,is,_) <- conjureReification f, typ h == typ e]+conjureIsUnbreakable f = null . conjureCasesFor f instance Conjurable () where conjureExpress = reifyExpress@@ -655,6 +655,22 @@ -- deal with types that have cases, such as lists, maybes, etc. mk h cs = [[[h]], [cs]] +-- | Conjures cases for the given typed hole.+--+-- > > conjureCasesFor (undefined :: [Maybe Int] -> [Int]) is_+-- > [ [] :: [Int], _:_ :: [Int] ]+--+-- > > conjureCasesFor (undefined :: [Maybe Int] -> [Int]) nothingInt+-- > [ Nothing :: Maybe Int, Just _ :: Maybe Int ]+conjureCasesFor :: Conjurable f => f -> Expr -> [Expr]+conjureCasesFor f eh =+ case [ces | (eh',_,_,_,ces,_) <- conjureReification f, typ eh == typ eh'] of+ (ces:_) -> ces+ _ -> error $ "Conjure.conjureCasesFor: could not find cases for " ++ show eh+-- NOTE: the conjureCasesFor function is currently unused,+-- but may be useful in the future if we decide to handle+-- non-top-level case breakdowns.+-- It can be used in building a replacement for conjureArgumentPats -- -- -- other Conjurable instances -- -- --
src/Conjure/Conjurable/Derive.hs view
@@ -25,7 +25,8 @@ -- | Derives an 'Conjurable' instance for the given type 'Name'. ----- This function needs the @TemplateHaskell@ extension.+-- If not already present,+-- this also derives 'Listable', 'Express' and 'Name' instances. -- -- If the "Data.Express"' type binding operators -- ('Data.Express.-:',@@ -33,6 +34,22 @@ -- 'Data.Express.->>:') -- are not in scope, -- this derives them as well.+--+-- This function needs the @TemplateHaskell@ extension.+-- You can place the following at the top of the file:+--+-- > {-# LANGUAGE TemplateHaskell #-}+-- > import Conjure+-- > import Test.LeanCheck+--+-- Then just call 'deriveConjurable' after your data type declaration:+--+-- > data Peano = Z | S Peano deriving (Show, Eq)+-- >+-- > deriveConjurable ''Peano+--+-- 'deriveConjurable' expects the argument type to be+-- an instance of 'Show' and 'Eq'. deriveConjurable :: Name -> DecsQ deriveConjurable = deriveWhenNeededOrWarn ''Conjurable reallyDerive where
src/Conjure/Engine.hs view
@@ -56,7 +56,9 @@ import Conjure.Red import Conjure.Reason +import System.CPUTime (getCPUTime) + -- | Conjures an implementation of a partially defined function. -- -- Takes a 'String' with the name of a function,@@ -187,16 +189,19 @@ data Args = Args { maxTests :: Int -- ^ maximum number of tests to each candidate , maxSize :: Int -- ^ maximum size of candidate bodies+ , target :: Int -- ^ enumerate further sizes of candidates until this target , maxEvalRecursions :: Int -- ^ maximum number of recursive evaluations when testing candidates , maxEquationSize :: Int -- ^ maximum size of equation operands , maxSearchTests :: Int -- ^ maximum number of tests to search for defined values , maxDeconstructionSize :: Int -- ^ maximum size of deconstructions (e.g.: @_ - 1@) , maxConstantSize :: Int -- ^ maximum size of constants (0 for no limit)+ , maxPatternSize :: Int -- ^ maximum size of patterns (0 for no limit) -- advanced & debug options -- , carryOn :: Bool -- ^ whether to carry on after finding a suitable candidate , showTheory :: Bool -- ^ show theory discovered by Speculate used in pruning , usePatterns :: Bool -- ^ use pattern matching to create (recursive) candidates+ , showRuntime :: Bool -- ^ show runtime , showCandidates :: Bool -- ^ (debug) show candidates -- warning: wall of text , showTests :: Bool -- ^ (debug) show tests , showPatterns :: Bool -- ^ (debug) show possible LHS patterns@@ -216,7 +221,8 @@ -- | Default arguments to conjure. -- -- * 60 tests--- * functions of up to 12 symbols+-- * functions of up to 24 symbols+-- * target testing over 50400 candidates -- * maximum of one recursive call allowed in candidate bodies -- * maximum evaluation of up to 60 recursions -- * pruning with equations up to size 5@@ -228,17 +234,20 @@ args :: Args args = Args { maxTests = 360- , maxSize = 12+ , maxSize = 24+ , target = 10080 , maxEvalRecursions = 60 , maxEquationSize = 5 , maxSearchTests = 100000 , maxDeconstructionSize = 4 , maxConstantSize = 0 -- unlimited+ , maxPatternSize = 0 -- unlimited -- advanced & debug options -- , carryOn = False , showTheory = False , usePatterns = True+ , showRuntime = True , showCandidates = False , showTests = False , showDeconstructions = False@@ -272,14 +281,20 @@ -- | Like 'conjure0' but allows setting options through 'Args'/'args'. conjure0With :: Conjurable f => Args -> String -> f -> (f -> Bool) -> [Prim] -> IO () conjure0With args nm f p es = do+ -- the code section below became quite ugly with time and patches.+ -- it is still maintainable and readable as it is, but perhaps+ -- needs to be cleaned up and simplified+ t0 <- if showRuntime args+ then getCPUTime+ else return (-1) print (var (head $ words nm) f) when (length ts > 0) $ do- putStrLn $ "-- testing " ++ show (length ts) ++ " combinations of argument values"+ putWithTimeSince t0 $ "testing " ++ show (length ts) ++ " combinations of argument values" when (showTests args) $ do putStrLn $ "{-" putStr $ unlines $ map show ts putStrLn $ "-}"- putStrLn $ "-- pruning with " ++ show nRules ++ "/" ++ show nREs ++ " rules"+ putWithTimeSince t0 $ "pruning with " ++ show nRules ++ "/" ++ show nREs ++ " rules" when (showTheory args) $ do putStrLn $ "{-" printThy thy@@ -294,33 +309,37 @@ putStr $ unlines $ map showEq $ invalid thy putStrLn $ "-}" when (showPatterns args) $ do- putStr $ unlines $ zipWith (\i -> (("-- allowed patterns of size " ++ show i ++ "\n{-\n") ++) . (++ "-}") . unlines) [1..] $ mapT showDefn $ patternss results+ putStr $ unlines+ $ zipWith (\i -> (("-- allowed patterns of size " ++ show i ++ "\n{-\n") ++) . (++ "-}") . unlines) [1..]+ $ mapT showDefn+ $ patternss results when (showDeconstructions args) $ do putStrLn $ "{- List of allowed deconstructions:" putStr $ unlines $ map show $ deconstructions results putStrLn $ "-}"- pr 1 0 rs+ pr t0 1 0 rs where showEq eq = showExpr (fst eq) ++ " == " ++ showExpr (snd eq)- pr :: Int -> Int -> [([Defn], [Defn])] -> IO ()- pr n t [] = do putStrLn $ "-- tested " ++ show t ++ " candidates"- putStrLn $ "cannot conjure\n"- pr n t ((is,cs):rs) = do+ pr :: Integer -> Int -> Int -> [([Defn], [Defn])] -> IO ()+ pr t0 n t [] = do putWithTimeSince t0 $ "tested " ++ show t ++ " candidates"+ putStrLn $ "cannot conjure\n"+ pr t0 n t ((is,cs):rs) = do let nc = length cs- putStrLn $ "-- looking through " ++ show nc ++ " candidates of size " ++ show n+ putWithTimeSince t0 $ show nc ++ " candidates of size " ++ show n when (showCandidates args) $ putStr $ unlines $ ["{-"] ++ map showDefn cs ++ ["-}"] case is of- [] -> pr (n+1) (t+nc) rs+ [] -> pr t0 (n+1) (t+nc) rs (_:_) -> do pr1 t is cs- when (carryOn args) $ pr (n+1) (t+nc) rs- pr1 t [] cs = return ()- pr1 t (i:is) cs = do- let (cs',cs'') = break (i==) cs- let t' = t + length cs' + 1- putStrLn $ "-- tested " ++ show t' ++ " candidates"- putStrLn $ showDefn i- when (carryOn args) $ pr1 t' is (drop 1 cs'')+ when (carryOn args) $ pr t0 (n+1) (t+nc) rs+ where+ pr1 t [] cs = return ()+ pr1 t (i:is) cs = do+ let (cs',cs'') = break (i==) cs+ let t' = t + length cs' + 1+ putWithTimeSince t0 $ "tested " ++ show t' ++ " candidates"+ putStrLn $ showDefn i+ when (carryOn args) $ pr1 t' is (drop 1 cs'') rs = zip iss css results = conjpure0With args nm f p es iss = implementationss results@@ -389,7 +408,9 @@ && requal fx ffxx vffxx && errorToFalse (p (cevl maxEvalRecursions fx)) candidatesT = (if uniqueCandidates then nubCandidates args nm f else id)- $ take maxSize candidatesTT+ $ (if target > 0 then targetiers target else id)+ $ (if maxSize > 0 then take maxSize else id)+ $ candidatesTT (candidatesTT, thy, patternss, deconstructions) = candidateDefns args nm f es ffxx = conjureApplication nm f vffxx = conjureVarApplication nm f@@ -511,7 +532,8 @@ , deconstructions ) where- pats = conjurePats es nm f+ pats | maxPatternSize > 0 = take maxPatternSize $ conjurePats es nm f+ | otherwise = conjurePats es nm f fss = concatMapT ps2fss pats es = map fst ps @@ -543,8 +565,9 @@ ps2fss :: [Expr] -> [[Defn]] ps2fss pats = discardT isRedundant- . products+ . products -- alt: use delayedProducts $ map p2eess pats+ -- delayedProducts makes the number of patterns counts as the size+1. where p2eess :: Expr -> [[Bndn]] -- the following guarded line is an optional optimization@@ -688,12 +711,40 @@ productsWith f = mapT f . products -- TODO: move productsWith to LeanCheck? +delayedProducts :: [ [[a]] ] -> [[ [a] ]]+delayedProducts xsss = products xsss `addWeight` (length xsss - 1)+-- TODO: move delayedProducts to LeanCheck?+ delayedProductsWith :: ([a] -> a) -> [ [[a]] ] -> [[a]] delayedProductsWith f xsss = productsWith f xsss `addWeight` length xsss -- TODO: move delayedProductsWith to LeanCheck? foldAppProducts :: Expr -> [ [[Expr]] ] -> [[Expr]] foldAppProducts ef = delayedProductsWith (foldApp . (ef:))++-- show time in seconds rounded to one decimal place+-- the argument is expected to be in picoseconds+showTime :: Integer -> String+showTime ps = show s ++ "s"+ where+ s = fromIntegral ds / 10.0 -- seconds+ ds = ps `div` 100000000000 -- deciseconds, * 10 / 1 000 000 000 000++-- beware of lazyness, this computes the time for evaluating msg!+putWithTimeSince :: Integer -> String -> IO ()+putWithTimeSince start msg+ | start < 0 = putStrLn $ "-- " ++ msg -- negative start time indicates omit runtime+ | msg == msg = do -- forces evaluation of msg!+ end <- getCPUTime+ putStrLn $ "-- " ++ showTime (end - start) ++ ", " ++ msg+ | otherwise = error "putWithTimeSince: the impossible happened (GHC/Compiler/Interpreter bug?!)"++-- consume tiers until a target is reached, then stop+targetiers :: Int -> [[a]] -> [[a]]+targetiers n xss+ | n <= 0 = []+ | otherwise = case xss of [] -> []+ (xs:xss) -> xs : targetiers (n - length xs) xss boolTy :: TypeRep boolTy = typ b_