code-conjure 0.7.4 → 0.7.6
raw patch · 186 files changed
+9053/−8392 lines, 186 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Conjure: omitEarlyTests :: Ingredient
- Conjure.Engine: omitEarlyTests :: Ingredient
- Conjure.Settings: earlyTestsI :: [Ingredient] -> Bool
- Conjure.Settings: omitEarlyTests :: Ingredient
- Conjure.Utils: sets :: [a] -> [[a]]
+ Conjure: maxEarlyTests :: Int -> Ingredient
+ Conjure.Conjurable: conjureResultHole :: Conjurable a => a -> Expr
+ Conjure.Engine: maxEarlyTests :: Int -> Ingredient
+ Conjure.Expr: mappArgs :: (Expr -> Expr) -> Expr -> Expr
+ Conjure.Expr: mappFun :: (Expr -> Expr) -> Expr -> Expr
+ Conjure.Settings: maxEarlyTests :: Int -> Ingredient
+ Conjure.Settings: maxEarlyTestsI :: [Ingredient] -> Int
Files
- .gitignore +5/−3
- Makefile +5/−3
- README.md +6/−6
- TODO.md +18/−35
- bench/candidates.hs +10/−10
- bench/candidates.txt +5414/−5414
- bench/carry-on.hs +2/−2
- bench/carry-on.txt +18/−18
- bench/erroneous.hs +10/−10
- bench/erroneous.txt +24/−24
- bench/gps.hs +197/−113
- bench/gps.txt +229/−139
- bench/gps2.hs +0/−784
- bench/gps2.txt +0/−367
- bench/i12.hs +71/−0
- bench/i12.txt +13/−0
- bench/i30.hs +87/−0
- bench/i30.txt +2/−0
- bench/ill-hit.hs +2/−2
- bench/ill-hit.txt +2/−2
- bench/p12.hs +0/−71
- bench/p12.txt +0/−14
- bench/p30.hs +0/−87
- bench/p30.txt +0/−2
- bench/psb2.hs +851/−0
- bench/psb2.txt +388/−0
- bench/redundants.hs +10/−10
- bench/redundants.txt +43/−43
- bench/runtime/lapmatrud/bench/candidates.runtime +1/−1
- bench/runtime/lapmatrud/bench/carry-on.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/ill-hit.runtime +1/−1
- bench/runtime/lapmatrud/bench/lowtests.runtime +1/−1
- bench/runtime/lapmatrud/bench/p12.runtime +1/−1
- bench/runtime/lapmatrud/bench/redundants.runtime +1/−1
- bench/runtime/lapmatrud/bench/strategies.runtime +1/−1
- bench/runtime/lapmatrud/bench/terpret.runtime +1/−1
- bench/runtime/lapmatrud/bench/unique.runtime +1/−1
- bench/runtime/lapmatrud/bench/weird.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/conditionals.runtime +1/−0
- bench/runtime/lapmatrud/eg/count.runtime +1/−1
- bench/runtime/lapmatrud/eg/digits.runtime +1/−0
- 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/gcd.runtime +1/−1
- bench/runtime/lapmatrud/eg/higher.runtime +1/−1
- bench/runtime/lapmatrud/eg/ints.runtime +1/−1
- bench/runtime/lapmatrud/eg/list.runtime +1/−1
- bench/runtime/lapmatrud/eg/oddeven.runtime +1/−1
- 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/these.runtime +1/−1
- bench/runtime/lapmatrud/eg/tri.runtime +1/−1
- bench/runtime/lapmatrud/eg/tuple.runtime +1/−1
- bench/runtime/zero/bench/candidates.runtime +1/−1
- bench/runtime/zero/bench/carry-on.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/ill-hit.runtime +1/−1
- bench/runtime/zero/bench/lowtests.runtime +1/−1
- bench/runtime/zero/bench/p12.runtime +1/−1
- bench/runtime/zero/bench/redundants.runtime +1/−1
- bench/runtime/zero/bench/strategies.runtime +1/−1
- bench/runtime/zero/bench/terpret.runtime +1/−1
- bench/runtime/zero/bench/unique.runtime +1/−1
- bench/runtime/zero/bench/weird.runtime +1/−1
- bench/runtime/zero/eg/arith.runtime +1/−1
- bench/runtime/zero/eg/bits.runtime +1/−1
- bench/runtime/zero/eg/bools.runtime +1/−1
- bench/runtime/zero/eg/conditionals.runtime +1/−0
- bench/runtime/zero/eg/count.runtime +1/−1
- bench/runtime/zero/eg/digits.runtime +1/−0
- bench/runtime/zero/eg/dupos.runtime +1/−1
- bench/runtime/zero/eg/either.runtime +1/−1
- bench/runtime/zero/eg/factorial.runtime +1/−1
- bench/runtime/zero/eg/fib01.runtime +1/−1
- bench/runtime/zero/eg/fibonacci.runtime +1/−1
- bench/runtime/zero/eg/higher.runtime +1/−1
- bench/runtime/zero/eg/ints.runtime +1/−1
- bench/runtime/zero/eg/list.runtime +1/−1
- bench/runtime/zero/eg/oddeven.runtime +1/−1
- bench/runtime/zero/eg/pow.runtime +1/−1
- bench/runtime/zero/eg/replicate.runtime +1/−1
- bench/runtime/zero/eg/setelem.runtime +1/−1
- bench/runtime/zero/eg/sort.runtime +1/−1
- bench/runtime/zero/eg/spec.runtime +1/−1
- bench/runtime/zero/eg/take-drop.runtime +1/−1
- bench/runtime/zero/eg/tapps.runtime +1/−1
- bench/runtime/zero/eg/these.runtime +1/−1
- bench/runtime/zero/eg/tree.runtime +1/−1
- bench/runtime/zero/proto/u-conjure.runtime +1/−1
- bench/self.hs +2/−2
- bench/self.txt +12/−12
- bench/strategies.hs +6/−6
- bench/strategies.txt +65/−65
- bench/terpret.hs +16/−19
- bench/terpret.txt +42/−39
- bench/unique.hs +9/−9
- bench/unique.txt +299/−299
- bench/weird.hs +13/−2
- bench/weird.txt +21/−4
- changelog.md +13/−0
- code-conjure.cabal +2/−3
- eg/arith.hs +2/−2
- eg/arith.txt +26/−26
- eg/bits.hs +5/−5
- eg/bits.txt +16/−16
- eg/bools.hs +2/−2
- eg/bools.txt +5/−5
- eg/bst.hs +9/−9
- eg/bst.txt +13/−13
- eg/colin/IntFuns.hs +4/−4
- eg/colin/ListFuns.hs +14/−14
- eg/conditionals.hs +105/−0
- eg/conditionals.txt +109/−0
- eg/count.hs +4/−4
- eg/count.txt +2/−2
- eg/digits.hs +68/−0
- eg/digits.txt +64/−0
- eg/dupos.hs +4/−4
- eg/dupos.txt +26/−26
- eg/either.hs +3/−3
- eg/factorial.hs +4/−4
- eg/factorial.txt +13/−13
- eg/fib01.hs +2/−2
- eg/fib01.txt +5/−5
- eg/fibonacci.hs +3/−3
- eg/fibonacci.txt +12/−12
- eg/gcd.hs +1/−1
- eg/gcd.txt +6/−6
- eg/higher.hs +1/−1
- eg/higher.txt +6/−6
- eg/ints.hs +6/−6
- eg/list.hs +11/−11
- eg/list.txt +15/−15
- eg/maybe.hs +4/−4
- eg/maybe.txt +1/−1
- eg/oddeven.hs +8/−8
- eg/oddeven.txt +16/−16
- eg/peano.hs +2/−2
- eg/peano.txt +5/−5
- eg/pow.hs +4/−4
- eg/pow.txt +14/−14
- eg/replicate.hs +4/−4
- eg/replicate.txt +8/−8
- eg/setelem.hs +4/−4
- eg/setelem.txt +1/−1
- eg/sort.hs +43/−74
- eg/sort.txt +58/−97
- eg/spec.hs +3/−3
- eg/spec.txt +2/−2
- eg/subset.hs +3/−3
- eg/subset.txt +1/−1
- eg/take-drop.hs +6/−6
- eg/take-drop.txt +8/−8
- eg/tapps.hs +2/−2
- eg/tapps.txt +2/−2
- eg/these.hs +6/−6
- eg/these.txt +25/−25
- eg/tree.hs +11/−11
- eg/tree.txt +17/−17
- eg/tri.hs +1/−1
- eg/tri.txt +3/−3
- eg/tuple.txt +21/−21
- mk/depend.mk +64/−28
- src/Conjure.hs +8/−8
- src/Conjure/Conjurable.hs +8/−0
- src/Conjure/Defn.hs +11/−8
- src/Conjure/Defn/Redundancy.hs +10/−0
- src/Conjure/Engine.hs +63/−35
- src/Conjure/Expr.hs +22/−2
- src/Conjure/Ingredient.hs +25/−25
- src/Conjure/Settings.hs +11/−8
- src/Conjure/Utils.hs +0/−10
- test/factorial.hs +2/−2
- test/utils.hs +0/−5
.gitignore view
@@ -60,21 +60,23 @@ eg/colin/*Funs eg/tri eg/bits+eg/digits eg/peano eg/these eg/tuple+eg/conditionals bench/carry-on bench/strategies bench/self bench/longshot bench/ill-hit-bench/p12-bench/p30+bench/i12+bench/i30 bench/candidates bench/redundants bench/erroneous bench/gps-bench/gps2+bench/psb2 bench/lowtests bench/terpret bench/weird
Makefile view
@@ -43,9 +43,11 @@ eg/bst \ eg/tri \ eg/bits \+ eg/digits \ eg/peano \ eg/these \ eg/tuple \+ eg/conditionals \ bench/candidates \ bench/redundants \ bench/erroneous \@@ -55,10 +57,10 @@ bench/strategies \ bench/self \ bench/carry-on \- bench/p12 \- bench/p30 \+ bench/i12 \+ bench/i30 \ bench/gps \- bench/gps2 \+ bench/psb2 \ bench/terpret \ bench/unique \ bench/weird \
README.md view
@@ -64,8 +64,8 @@ addition, multiplication, subtraction and their neutral elements: ingredients :: [Ingredient]- ingredients = [ unfun (0::Int)- , unfun (1::Int)+ ingredients = [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)@@ -121,9 +121,9 @@ given list constructors, zero, one and subtraction: > conjure "take" (take' :: Int -> [A] -> [A])- > [ unfun (0 :: Int)- > , unfun (1 :: Int)- > , unfun ([] :: [A])+ > [ con (0 :: Int)+ > , con (1 :: Int)+ > , con ([] :: [A]) > , fun ":" ((:) :: A -> [A] -> [A]) > , fun "-" ((-) :: Int -> Int -> Int) > ]@@ -176,7 +176,7 @@ with the following call: conjureFromSpec "duplicates" duplicatesSpec- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun "not" not , fun "&&" (&&) , fun ":" ((:) :: Int -> [Int] -> [Int])
TODO.md view
@@ -7,14 +7,9 @@ constructors that are not recursive. This change will need to be done in LeanCheck itself. -* Detail two new proposed pruning rules from Colin.- (email from Feb 24 and follow-up in meeting)- * Allow timeout setting? -* Rethink Conjurable typeclass?--* Allow chains of guards (see below).+* Find most efficient of a given size (see below). * Better error reporting when `Listable` is out-of-scope when using `deriveConjurable`. This needs to be implemented on LeanCheck itself.@@ -25,36 +20,11 @@ (qsort example) -## Allow chains of guards--With the use of `guard` right now,-Conjure can generate functions such as the following:-- function x y z- | x < 123 = ...- | otherwise = ...--We should probably allow chains of guards such as the following:-- function x y z- | x < 123 = ...- | x == 321 = ...- | y == 12 = ...- | otherwise = ...--Internally, these are just chains of if-then-else applications:-- function x y z = if x < 123- then ...- else if x == 321- then ...- else if y == 12- then ...- else ...+## Find the most efficient of a given size -This change shouldn't be so complicated to introduce-requiring a change in `enumerateAppsFor` relaxing `ufor hx`-depending on what we have on the left...+While evaluating candidates, we can count the number of matches in order to+select the most efficient. When actually conjuring, we always wait until the+end of the current size to select the candidate with least evaluations. ## Forbid recursion into negatives@@ -78,6 +48,19 @@ This may require changing the format definitions themselves... 2. use this on `showDefn` somehow 3. use this on `toDynamicWithDefn` somehow++Alternative: include the guard as part of the pattern "internally". As if we+had a n+k pattern. Like so:++ tri 1 = 1+ tri x@(_ + 2) = x + tri (x - 1)++When displaying of course, we remove the n+k pattern.++This can be done as early as enumerating the possible patterns and should make+things easier in `keepB`. The matching engine would have to be customized+somehow. Maybe an `@`-named operator can adopt a special meaning in `Express`?+ This file is part of Conjure,
bench/candidates.hs view
@@ -40,43 +40,43 @@ main :: IO () main = do printCandidates 9 6 "foo" (undefined :: Int -> Int)- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ] printCandidates 9 5 "?" (undefined :: Int -> Int -> Int)- [ unfun (0 :: Int)+ [ con (0 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "dec" (subtract 1 :: Int -> Int) ] printCandidates 9 6 "goo" (undefined :: [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printCandidates 9 6 "??" (undefined :: [Int] -> [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printCandidates 9 6 "ton" (undefined :: Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not ] printCandidates 9 6 "&|" (undefined :: Bool -> Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not@@ -88,6 +88,6 @@ -- nevertheless useful for observing candidate filtering -- through other means printCandidates 9 6 "gcd" (undefined :: Int -> Int -> Int)- [ unfun (0::Int)+ [ con (0::Int) , fun "`mod`" (mod :: Int -> Int -> Int) ]
bench/candidates.txt view
@@ -95,5420 +95,5420 @@ foo x = 1 - x -foo x = x * x - 1--foo x = x + (x + x)--foo x = x + (x + 1)--foo x = x + (1 + 1)--foo x = x + x * x--foo x = x + (x - 1)--foo x = x + (0 - 1)--foo x = 1 + (x + x)--foo x = 1 + (x + 1)--foo x = 1 + (1 + 1)--foo x = 1 + x * x--foo x = 1 + (0 - x)--foo x = 1 + (1 - x)--foo x = x * (x + x)--foo x = x * (x * x)--foo x = x * (x - 1)--foo x = x * (0 - x)--foo x = x * (0 - 1)--foo x = x * (1 - x)--foo x = x - (x + x)--foo x = x - (x + 1)--foo x = x - (1 + 1)--foo x = x - x * x--foo x = 0 - (x + x)--foo x = 0 - (x + 1)--foo x = 0 - (1 + 1)--foo x = 1 - (x + x)--foo x = 1 - (x + 1)--foo x = 1 - (1 + 1)--foo x = 1 - x * x---pattern candidates:--foo x = x--foo x = 0--foo x = 1--foo 0 = 0-foo x = 1--foo 0 = 1-foo x = x--foo 0 = 1-foo x = 0--foo x = x + x--foo x = x + 1--foo x = x * x--foo x = x - 1--foo x = 0 - x--foo x = 1 - x--foo 1 = 0-foo x = x--foo 1 = 0-foo x = 1--foo 1 = 1-foo x = 0--foo 0 = 0-foo x = x + 1--foo 0 = 0-foo x = x - 1--foo 0 = 0-foo x = 1 - x--foo 0 = 1-foo x = x + x--foo 0 = 1-foo x = x * x--foo 0 = 1-foo x = x - 1--foo 0 = 1-foo x = 0 - x--foo 0 = 0-foo 1 = 0-foo x = 1--foo 0 = 1-foo 1 = 0-foo x = x--foo 0 = 1-foo 1 = 1-foo x = 0--foo x = x * x - 1--foo x = x + (x + x)--foo x = x + (x + 1)--foo x = x + x * x--foo x = x + (x - 1)--foo x = 1 + (x + x)--foo x = 1 + (x + 1)--foo x = 1 + x * x--foo x = 1 + (0 - x)--foo x = 1 + (1 - x)--foo x = x * (x + x)--foo x = x * (x * x)--foo x = x * (x - 1)--foo x = x * (0 - x)--foo x = x * (1 - x)--foo x = x - (x + x)--foo x = x - (x + 1)--foo x = x - x * x--foo x = 0 - (x + x)--foo x = 0 - (x + 1)--foo x = 1 - (x + x)--foo x = 1 - (x + 1)--foo x = 1 - x * x--foo 1 = 0-foo x = x + x--foo 1 = 0-foo x = x + 1--foo 1 = 0-foo x = x * x--foo 1 = 0-foo x = 0 - x--foo 1 = 1-foo x = x + x--foo 1 = 1-foo x = x + 1--foo 1 = 1-foo x = x - 1--foo 1 = 1-foo x = 0 - x--foo 1 = 1-foo x = 1 - x--foo 0 = 0-foo x = x * x - 1--foo 0 = 0-foo x = x + (x + 1)--foo 0 = 0-foo x = x + (x - 1)--foo 0 = 0-foo x = 1 + (x + x)--foo 0 = 0-foo x = 1 + (x + 1)--foo 0 = 0-foo x = 1 + x * x--foo 0 = 0-foo x = 1 + (0 - x)--foo 0 = 0-foo x = 1 + (1 - x)--foo 0 = 0-foo x = x - (x + 1)--foo 0 = 0-foo x = 0 - (x + 1)--foo 0 = 0-foo x = 1 - (x + x)--foo 0 = 0-foo x = 1 - x * x--foo 0 = 1-foo x = x * x - 1--foo 0 = 1-foo x = x + (x + x)--foo 0 = 1-foo x = x + x * x--foo 0 = 1-foo x = x + (x - 1)--foo 0 = 1-foo x = 1 + (x + 1)--foo 0 = 1-foo x = 1 + (1 - x)--foo 0 = 1-foo x = x * (x + x)--foo 0 = 1-foo x = x * (x * x)--foo 0 = 1-foo x = x * (x - 1)--foo 0 = 1-foo x = x * (0 - x)--foo 0 = 1-foo x = x * (1 - x)--foo 0 = 1-foo x = x - (x + x)--foo 0 = 1-foo x = x - (x + 1)--foo 0 = 1-foo x = x - x * x--foo 0 = 1-foo x = 0 - (x + x)--foo 0 = 1-foo x = 0 - (x + 1)--foo 0 = 1-foo x = 1 - (x + 1)--foo 0 = 0-foo 1 = 0-foo x = x + 1--foo 0 = 0-foo 1 = 1-foo x = x + 1--foo 0 = 0-foo 1 = 1-foo x = x - 1--foo 0 = 0-foo 1 = 1-foo x = 1 - x--foo 0 = 1-foo 1 = 0-foo x = x + x--foo 0 = 1-foo 1 = 0-foo x = x * x--foo 0 = 1-foo 1 = 0-foo x = 0 - x--foo 0 = 1-foo 1 = 1-foo x = x + x--foo 0 = 1-foo 1 = 1-foo x = x - 1--foo 0 = 1-foo 1 = 1-foo x = 0 - x----allowed patterns:--foo x = _---foo 0 = _-foo x = _---foo 1 = _-foo x = _---foo 0 = _-foo 1 = _-foo x = _-----allowed deconstructions:--_ - 1 :: Int--Candidates for: ? :: Int -> Int -> Int- pruning with 13/34 rules- [3,3,9,18,60,162,489,1475,4619] direct candidates, 0 duplicates- [3,8,25,71,205,632,1957,5906,18303] pattern candidates, 0 duplicates--rules:-x * 0 == 0-0 * x == 0-x + 0 == x-0 + x == x-dec (x + y) == x + dec y-dec (x + y) == y + dec x-dec (x + y) == dec x + y-dec (x + y) == dec y + x-(x * y) * z == x * (y * z)-(x * y) * z == y * (x * z)-(x + y) + z == x + (y + z)-(x + y) + z == y + (x + z)-(x + x) * y == x * (y + y)-equations:-y * x == x * y-y + x == x + y-y + dec x == x + dec y-dec x + y == x + dec y-dec y + x == dec x + y-x + dec 0 == dec x-dec 0 + x == dec x-y * (x * z) == x * (y * z)-z * (x * y) == x * (y * z)-z * (y * x) == x * (y * z)-y + (x + z) == x + (y + z)-z + (x + y) == x + (y + z)-z + (y + x) == x + (y + z)-(z + y) * x == x * (y + z)-z * y + x == x + y * z-y * (x + x) == x * (y + y)-y + dec (dec x) == x + dec (dec y)-dec (dec x) + y == x + dec (dec y)-dec (dec y) + x == dec (dec x) + y-x + dec (dec 0) == dec (dec x)-dec (dec 0) + x == dec (dec x)--direct candidates:--x ? y = x--x ? y = y--x ? y = 0--x ? y = dec x--x ? y = dec y--x ? y = dec 0--x ? y = x + x--x ? y = x + y--x ? y = y + y--x ? y = x * x--x ? y = x * y--x ? y = y * y--x ? y = dec (dec x)--x ? y = dec (dec y)--x ? y = dec (dec 0)--x ? y = dec (x * x)--x ? y = dec (x * y)--x ? y = dec (y * y)--x ? y = dec (dec (dec x))--x ? y = dec (dec (dec y))--x ? y = dec (dec (dec 0))--x ? y = x + dec x--x ? y = x + dec y--x ? y = x + dec 0--x ? y = y + dec x--x ? y = y + dec y--x ? y = y + dec 0--x ? y = x * dec x--x ? y = x * dec y--x ? y = x * dec 0--x ? y = y * dec x--x ? y = y * dec y--x ? y = y * dec 0--x ? y = dec (dec (x * x))--x ? y = dec (dec (x * y))--x ? y = dec (dec (y * y))--x ? y = dec (dec (dec (dec x)))--x ? y = dec (dec (dec (dec y)))--x ? y = dec (dec (dec (dec 0)))--x ? y = dec (x * dec x)--x ? y = dec (x * dec y)--x ? y = dec (x * dec 0)--x ? y = dec (y * dec x)--x ? y = dec (y * dec y)--x ? y = dec (y * dec 0)--x ? y = x + (x + x)--x ? y = x + (x + y)--x ? y = x + (y + y)--x ? y = x + x * x--x ? y = x + x * y--x ? y = x + y * y--x ? y = x + dec (dec x)--x ? y = x + dec (dec y)--x ? y = x + dec (dec 0)--x ? y = y + (x + x)--x ? y = y + (x + y)--x ? y = y + (y + y)--x ? y = y + x * x--x ? y = y + x * y--x ? y = y + y * y--x ? y = y + dec (dec x)--x ? y = y + dec (dec y)--x ? y = y + dec (dec 0)--x ? y = x * (x + x)--x ? y = x * (x + y)--x ? y = x * (y + y)--x ? y = x * (x * x)--x ? y = x * (x * y)--x ? y = x * (y * y)--x ? y = x * dec (dec x)--x ? y = x * dec (dec y)--x ? y = x * dec (dec 0)--x ? y = y * (x + x)--x ? y = y * (x + y)--x ? y = y * (y + y)--x ? y = y * (x * x)--x ? y = y * (x * y)--x ? y = y * (y * y)--x ? y = y * dec (dec x)--x ? y = y * dec (dec y)--x ? y = y * dec (dec 0)--x ? y = dec x + dec x--x ? y = dec x + dec y--x ? y = dec x + dec 0--x ? y = dec y + dec y--x ? y = dec y + dec 0--x ? y = dec 0 + dec 0--x ? y = dec x * dec x--x ? y = dec x * dec y--x ? y = dec x * dec 0--x ? y = dec y * dec y--x ? y = dec y * dec 0--x ? y = dec 0 * dec 0---pattern candidates:--x ? y = x--x ? y = y--x ? y = 0--x ? y = dec x--x ? y = dec y--x ? 0 = x-x ? y = y--x ? 0 = x-x ? y = 0--x ? 0 = 0-x ? y = x--0 ? x = x-x ? y = x--0 ? x = x-x ? y = 0--0 ? x = 0-x ? y = y--x ? y = x + x--x ? y = x + y--x ? y = y + y--x ? y = x * x--x ? y = x * y--x ? y = y * y--x ? y = dec (dec x)--x ? y = dec (dec y)--x ? 0 = x-x ? y = dec x--x ? 0 = x-x ? y = dec y--x ? 0 = 0-x ? y = dec x--x ? 0 = 0-x ? y = dec y--x ? 0 = dec x-x ? y = x--x ? 0 = dec x-x ? y = y--x ? 0 = dec x-x ? y = 0--0 ? x = x-x ? y = dec x--0 ? x = x-x ? y = dec y--0 ? x = 0-x ? y = dec x--0 ? x = 0-x ? y = dec y--0 ? x = dec x-x ? y = x--0 ? x = dec x-x ? y = y--0 ? x = dec x-x ? y = 0--0 ? x = x-x ? 0 = x-x ? y = 0--0 ? x = x-x ? 0 = 0-x ? y = x--0 ? x = 0-x ? 0 = x-x ? y = y--x ? y = dec (x * x)--x ? y = dec (x * y)--x ? y = dec (y * y)--x ? y = dec (dec (dec x))--x ? y = dec (dec (dec y))--x ? y = x + dec x--x ? y = x + dec y--x ? y = y + dec x--x ? y = y + dec y--x ? y = x * dec x--x ? y = x * dec y--x ? y = y * dec x--x ? y = y * dec y--x ? 0 = x-x ? y = x + x--x ? 0 = x-x ? y = y + y--x ? 0 = x-x ? y = x * x--x ? 0 = x-x ? y = x * y--x ? 0 = x-x ? y = y * y--x ? 0 = x-x ? y = dec (dec x)--x ? 0 = x-x ? y = dec (dec y)--x ? 0 = 0-x ? y = x + x--x ? 0 = 0-x ? y = x + y--x ? 0 = 0-x ? y = x * x--x ? 0 = 0-x ? y = dec (dec x)--x ? 0 = 0-x ? y = dec (dec y)--x ? 0 = dec x-x ? y = dec y--x ? 0 = x + x-x ? y = x--x ? 0 = x + x-x ? y = y--x ? 0 = x + x-x ? y = 0--x ? 0 = x * x-x ? y = x--x ? 0 = x * x-x ? y = y--x ? 0 = x * x-x ? y = 0--x ? 0 = dec (dec x)-x ? y = x--x ? 0 = dec (dec x)-x ? y = y--x ? 0 = dec (dec x)-x ? y = 0--0 ? x = x-x ? y = x + x--0 ? x = x-x ? y = y + y--0 ? x = x-x ? y = x * x--0 ? x = x-x ? y = x * y--0 ? x = x-x ? y = y * y--0 ? x = x-x ? y = dec (dec x)--0 ? x = x-x ? y = dec (dec y)--0 ? x = 0-x ? y = x + y--0 ? x = 0-x ? y = y + y--0 ? x = 0-x ? y = y * y--0 ? x = 0-x ? y = dec (dec x)--0 ? x = 0-x ? y = dec (dec y)--0 ? x = dec x-x ? y = dec x--0 ? x = x + x-x ? y = x--0 ? x = x + x-x ? y = y--0 ? x = x + x-x ? y = 0--0 ? x = x * x-x ? y = x--0 ? x = x * x-x ? y = y--0 ? x = x * x-x ? y = 0--0 ? x = dec (dec x)-x ? y = x--0 ? x = dec (dec x)-x ? y = y--0 ? x = dec (dec x)-x ? y = 0--0 ? x = x-x ? 0 = x-x ? y = dec x--0 ? x = x-x ? 0 = x-x ? y = dec y--0 ? x = x-x ? 0 = 0-x ? y = dec x--0 ? x = x-x ? 0 = 0-x ? y = dec y--0 ? x = x-x ? 0 = dec x-x ? y = x--0 ? x = x-x ? 0 = dec x-x ? y = 0--0 ? x = 0-x ? 0 = x-x ? y = dec x--0 ? x = 0-x ? 0 = x-x ? y = dec y--0 ? x = 0-x ? 0 = 0-x ? y = dec x--0 ? x = 0-x ? 0 = 0-x ? y = dec y--0 ? x = 0-x ? 0 = dec x-x ? y = y--0 ? x = dec x-x ? 0 = x-x ? y = y--0 ? x = dec x-x ? 0 = x-x ? y = 0--0 ? x = dec x-x ? 0 = 0-x ? y = x--x ? 0 = x-x ? y = x ? dec y--x ? 0 = x-x ? y = y ? dec x--x ? 0 = x-x ? y = y ? dec y--x ? 0 = x-x ? y = 0 ? dec y--x ? 0 = x-x ? y = dec x ? x--x ? 0 = x-x ? y = dec x ? y--x ? 0 = x-x ? y = dec y ? x--0 ? x = x-x ? y = x ? dec y--0 ? x = x-x ? y = y ? dec x--0 ? x = x-x ? y = y ? dec y--0 ? x = x-x ? y = dec x ? x--0 ? x = x-x ? y = dec x ? y--0 ? x = x-x ? y = dec x ? 0--0 ? x = x-x ? y = dec y ? x--x ? y = dec (dec (x * x))--x ? y = dec (dec (x * y))--x ? y = dec (dec (y * y))--x ? y = dec (dec (dec (dec x)))--x ? y = dec (dec (dec (dec y)))--x ? y = dec (x * dec x)--x ? y = dec (x * dec y)--x ? y = dec (y * dec x)--x ? y = dec (y * dec y)--x ? y = x + (x + x)--x ? y = x + (x + y)--x ? y = x + (y + y)--x ? y = x + x * x--x ? y = x + x * y--x ? y = x + y * y--x ? y = x + dec (dec x)--x ? y = x + dec (dec y)--x ? y = y + (x + x)--x ? y = y + (x + y)--x ? y = y + (y + y)--x ? y = y + x * x--x ? y = y + x * y--x ? y = y + y * y--x ? y = y + dec (dec x)--x ? y = y + dec (dec y)--x ? y = x * (x + x)--x ? y = x * (x + y)--x ? y = x * (y + y)--x ? y = x * (x * x)--x ? y = x * (x * y)--x ? y = x * (y * y)--x ? y = x * dec (dec x)--x ? y = x * dec (dec y)--x ? y = y * (x + x)--x ? y = y * (x + y)--x ? y = y * (y + y)--x ? y = y * (x * x)--x ? y = y * (x * y)--x ? y = y * (y * y)--x ? y = y * dec (dec x)--x ? y = y * dec (dec y)--x ? y = dec x + dec x--x ? y = dec x + dec y--x ? y = dec y + dec y--x ? y = dec x * dec x--x ? y = dec x * dec y--x ? y = dec y * dec y--x ? 0 = x-x ? y = dec (x * x)--x ? 0 = x-x ? y = dec (x * y)--x ? 0 = x-x ? y = dec (y * y)--x ? 0 = x-x ? y = dec (dec (dec x))--x ? 0 = x-x ? y = dec (dec (dec y))--x ? 0 = x-x ? y = x + dec x--x ? 0 = x-x ? y = x + dec y--x ? 0 = x-x ? y = y + dec x--x ? 0 = x-x ? y = y + dec y--x ? 0 = x-x ? y = x * dec x--x ? 0 = x-x ? y = x * dec y--x ? 0 = x-x ? y = y * dec x--x ? 0 = x-x ? y = y * dec y--x ? 0 = 0-x ? y = dec (x * x)--x ? 0 = 0-x ? y = dec (x * y)--x ? 0 = 0-x ? y = dec (y * y)--x ? 0 = 0-x ? y = dec (dec (dec x))--x ? 0 = 0-x ? y = dec (dec (dec y))--x ? 0 = 0-x ? y = x + dec x--x ? 0 = 0-x ? y = x + dec y--x ? 0 = 0-x ? y = y + dec x--x ? 0 = 0-x ? y = y + dec y--x ? 0 = 0-x ? y = x * dec x--x ? 0 = 0-x ? y = x * dec y--x ? 0 = dec x-x ? y = x + x--x ? 0 = dec x-x ? y = x + y--x ? 0 = dec x-x ? y = y + y--x ? 0 = dec x-x ? y = x * x--x ? 0 = dec x-x ? y = x * y--x ? 0 = dec x-x ? y = y * y--x ? 0 = dec x-x ? y = dec (dec x)--x ? 0 = dec x-x ? y = dec (dec y)--x ? 0 = x + x-x ? y = dec x--x ? 0 = x + x-x ? y = dec y--x ? 0 = x * x-x ? y = dec x--x ? 0 = x * x-x ? y = dec y--x ? 0 = dec (dec x)-x ? y = dec x--x ? 0 = dec (dec x)-x ? y = dec y--x ? 0 = dec (x * x)-x ? y = x--x ? 0 = dec (x * x)-x ? y = y--x ? 0 = dec (x * x)-x ? y = 0--x ? 0 = dec (dec (dec x))-x ? y = x--x ? 0 = dec (dec (dec x))-x ? y = y--x ? 0 = dec (dec (dec x))-x ? y = 0--x ? 0 = x + dec x-x ? y = x--x ? 0 = x + dec x-x ? y = y--x ? 0 = x + dec x-x ? y = 0--x ? 0 = x * dec x-x ? y = x--x ? 0 = x * dec x-x ? y = y--x ? 0 = x * dec x-x ? y = 0--0 ? x = x-x ? y = dec (x * x)--0 ? x = x-x ? y = dec (x * y)--0 ? x = x-x ? y = dec (y * y)--0 ? x = x-x ? y = dec (dec (dec x))--0 ? x = x-x ? y = dec (dec (dec y))--0 ? x = x-x ? y = x + dec x--0 ? x = x-x ? y = x + dec y--0 ? x = x-x ? y = y + dec x--0 ? x = x-x ? y = y + dec y--0 ? x = x-x ? y = x * dec x--0 ? x = x-x ? y = x * dec y--0 ? x = x-x ? y = y * dec x--0 ? x = x-x ? y = y * dec y--0 ? x = 0-x ? y = dec (x * x)--0 ? x = 0-x ? y = dec (x * y)--0 ? x = 0-x ? y = dec (y * y)--0 ? x = 0-x ? y = dec (dec (dec x))--0 ? x = 0-x ? y = dec (dec (dec y))--0 ? x = 0-x ? y = x + dec x--0 ? x = 0-x ? y = x + dec y--0 ? x = 0-x ? y = y + dec x--0 ? x = 0-x ? y = y + dec y--0 ? x = 0-x ? y = y * dec x--0 ? x = 0-x ? y = y * dec y--0 ? x = dec x-x ? y = x + x--0 ? x = dec x-x ? y = x + y--0 ? x = dec x-x ? y = y + y--0 ? x = dec x-x ? y = x * x--0 ? x = dec x-x ? y = x * y--0 ? x = dec x-x ? y = y * y--0 ? x = dec x-x ? y = dec (dec x)--0 ? x = dec x-x ? y = dec (dec y)--0 ? x = x + x-x ? y = dec x--0 ? x = x + x-x ? y = dec y--0 ? x = x * x-x ? y = dec x--0 ? x = x * x-x ? y = dec y--0 ? x = dec (dec x)-x ? y = dec x--0 ? x = dec (dec x)-x ? y = dec y--0 ? x = dec (x * x)-x ? y = x--0 ? x = dec (x * x)-x ? y = y--0 ? x = dec (x * x)-x ? y = 0--0 ? x = dec (dec (dec x))-x ? y = x--0 ? x = dec (dec (dec x))-x ? y = y--0 ? x = dec (dec (dec x))-x ? y = 0--0 ? x = x + dec x-x ? y = x--0 ? x = x + dec x-x ? y = y--0 ? x = x + dec x-x ? y = 0--0 ? x = x * dec x-x ? y = x--0 ? x = x * dec x-x ? y = y--0 ? x = x * dec x-x ? y = 0--0 ? x = x-x ? 0 = x-x ? y = x + x--0 ? x = x-x ? 0 = x-x ? y = y + y--0 ? x = x-x ? 0 = x-x ? y = x * x--0 ? x = x-x ? 0 = x-x ? y = x * y--0 ? x = x-x ? 0 = x-x ? y = y * y--0 ? x = x-x ? 0 = x-x ? y = dec (dec x)--0 ? x = x-x ? 0 = x-x ? y = dec (dec y)--0 ? x = x-x ? 0 = 0-x ? y = x + x--0 ? x = x-x ? 0 = 0-x ? y = x * x--0 ? x = x-x ? 0 = 0-x ? y = dec (dec x)--0 ? x = x-x ? 0 = 0-x ? y = dec (dec y)--0 ? x = x-x ? 0 = dec x-x ? y = dec y--0 ? x = x-x ? 0 = x + x-x ? y = x--0 ? x = x-x ? 0 = x + x-x ? y = 0--0 ? x = x-x ? 0 = x * x-x ? y = x--0 ? x = x-x ? 0 = x * x-x ? y = 0--0 ? x = x-x ? 0 = dec (dec x)-x ? y = x--0 ? x = x-x ? 0 = dec (dec x)-x ? y = 0--0 ? x = 0-x ? 0 = x-x ? y = y + y--0 ? x = 0-x ? 0 = x-x ? y = y * y--0 ? x = 0-x ? 0 = x-x ? y = dec (dec x)--0 ? x = 0-x ? 0 = x-x ? y = dec (dec y)--0 ? x = 0-x ? 0 = 0-x ? y = x + y--0 ? x = 0-x ? 0 = 0-x ? y = dec (dec x)--0 ? x = 0-x ? 0 = 0-x ? y = dec (dec y)--0 ? x = 0-x ? 0 = dec x-x ? y = dec y--0 ? x = 0-x ? 0 = x + x-x ? y = y--0 ? x = 0-x ? 0 = x * x-x ? y = y--0 ? x = 0-x ? 0 = dec (dec x)-x ? y = y--0 ? x = dec x-x ? 0 = x-x ? y = dec x--0 ? x = dec x-x ? 0 = 0-x ? y = dec x--0 ? x = dec x-x ? 0 = dec x-x ? y = x--0 ? x = dec x-x ? 0 = dec x-x ? y = y--0 ? x = dec x-x ? 0 = dec x-x ? y = 0--0 ? x = x + x-x ? 0 = x-x ? y = y--0 ? x = x + x-x ? 0 = x-x ? y = 0--0 ? x = x + x-x ? 0 = 0-x ? y = x--0 ? x = x * x-x ? 0 = x-x ? y = y--0 ? x = x * x-x ? 0 = x-x ? y = 0--0 ? x = x * x-x ? 0 = 0-x ? y = x--0 ? x = dec (dec x)-x ? 0 = x-x ? y = y--0 ? x = dec (dec x)-x ? 0 = x-x ? y = 0--0 ? x = dec (dec x)-x ? 0 = 0-x ? y = x--0 ? 0 = 0-0 ? x = dec x-x ? y = dec x----allowed patterns:--x ? y = _---x ? 0 = _-x ? y = _--0 ? x = _-x ? y = _---0 ? x = _-x ? 0 = _-x ? y = _--0 ? 0 = _-0 ? x = _-x ? y = _---0 ? 0 = _-0 ? x = _-x ? 0 = _-x ? y = _-----allowed deconstructions:--dec _ :: Int-dec (dec _) :: Int-dec (dec (dec _)) :: Int--Candidates for: goo :: [Int] -> [Int]- pruning with 4/4 rules- [2,0,1,0,1,0,1,0,1] direct candidates, 0 duplicates- [2,1,1,3,4,7,10,17,26] pattern candidates, 0 duplicates--rules:-xs ++ [] == xs-[] ++ xs == xs-(xs ++ ys) ++ zs == xs ++ (ys ++ zs)-(x:xs) ++ ys == x:(xs ++ ys)--direct candidates:--goo xs = xs--goo xs = []--goo xs = xs ++ xs--goo xs = xs ++ (xs ++ xs)---pattern candidates:--goo xs = xs--goo xs = []--goo [] = []-goo (x:xs) = xs--goo xs = xs ++ xs--goo [] = []-goo (x:xs) = x:xs--goo [] = []-goo (x:xs) = [x]--goo [] = []-goo (x:xs) = xs ++ xs--goo [] = []-goo (x:xs) = x:goo xs--goo [] = []-goo (x:xs) = xs ++ goo xs--goo [] = []-goo (x:xs) = goo xs ++ xs--goo xs = xs ++ (xs ++ xs)--goo [] = []-goo (x:xs) = goo xs ++ goo xs--goo [] = []-goo (x:xs) = x:x:xs--goo [] = []-goo (x:xs) = [x,x]--goo [] = []-goo (x:xs) = x:(xs ++ xs)--goo [] = []-goo (x:xs) = xs ++ (x:xs)--goo [] = []-goo (x:xs) = xs ++ [x]--goo [] = []-goo (x:xs) = xs ++ (xs ++ xs)----allowed patterns:--goo xs = _---goo [] = _-goo (x:xs) = _-----allowed deconstructions:---Candidates for: ?? :: [Int] -> [Int] -> [Int]- pruning with 4/4 rules- [3,0,4,0,8,0,16,0,32] direct candidates, 0 duplicates- [3,8,15,45,127,268,845,1565,5692] pattern candidates, 0 duplicates--rules:-xs ++ [] == xs-[] ++ xs == xs-(xs ++ ys) ++ zs == xs ++ (ys ++ zs)-(x:xs) ++ ys == x:(xs ++ ys)--direct candidates:--xs ?? ys = xs--xs ?? ys = ys--xs ?? ys = []--xs ?? ys = xs ++ xs--xs ?? ys = xs ++ ys--xs ?? ys = ys ++ xs--xs ?? ys = ys ++ ys--xs ?? ys = xs ++ (xs ++ xs)--xs ?? ys = xs ++ (xs ++ ys)--xs ?? ys = xs ++ (ys ++ xs)--xs ?? ys = xs ++ (ys ++ ys)--xs ?? ys = ys ++ (xs ++ xs)--xs ?? ys = ys ++ (xs ++ ys)--xs ?? ys = ys ++ (ys ++ xs)--xs ?? ys = ys ++ (ys ++ ys)---pattern candidates:--xs ?? ys = xs--xs ?? ys = ys--xs ?? ys = []--xs ?? [] = xs-xs ?? (x:ys) = ys--xs ?? [] = xs-xs ?? (x:ys) = []--xs ?? [] = []-xs ?? (x:ys) = xs--xs ?? [] = []-xs ?? (x:ys) = ys--[] ?? xs = xs-(x:xs) ?? ys = xs--[] ?? xs = xs-(x:xs) ?? ys = []--[] ?? xs = []-(x:xs) ?? ys = xs--[] ?? xs = []-(x:xs) ?? ys = ys--xs ?? ys = xs ++ xs--xs ?? ys = xs ++ ys--xs ?? ys = ys ++ xs--xs ?? ys = ys ++ ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = []--xs ?? [] = xs-xs ?? (x:ys) = xs ?? ys--xs ?? [] = xs-xs ?? (x:ys) = ys ?? xs--xs ?? [] = xs-xs ?? (x:ys) = ys ?? ys--xs ?? [] = xs-xs ?? (x:ys) = [] ?? xs--xs ?? [] = xs-xs ?? (x:ys) = [] ?? ys--[] ?? xs = xs-(x:xs) ?? ys = xs ?? xs--[] ?? xs = xs-(x:xs) ?? ys = xs ?? ys--[] ?? xs = xs-(x:xs) ?? ys = xs ?? []--[] ?? xs = xs-(x:xs) ?? ys = ys ?? xs--[] ?? xs = xs-(x:xs) ?? ys = ys ?? []--xs ?? [] = xs-xs ?? (x:ys) = x:xs--xs ?? [] = xs-xs ?? (x:ys) = x:ys--xs ?? [] = xs-xs ?? (x:ys) = [x]--xs ?? [] = xs-xs ?? (x:ys) = xs ++ xs--xs ?? [] = xs-xs ?? (x:ys) = xs ++ ys--xs ?? [] = xs-xs ?? (x:ys) = ys ++ xs--xs ?? [] = xs-xs ?? (x:ys) = ys ++ ys--xs ?? [] = []-xs ?? (x:ys) = x:xs--xs ?? [] = []-xs ?? (x:ys) = x:ys--xs ?? [] = []-xs ?? (x:ys) = [x]--xs ?? [] = []-xs ?? (x:ys) = xs ++ xs--xs ?? [] = []-xs ?? (x:ys) = xs ++ ys--xs ?? [] = []-xs ?? (x:ys) = ys ++ xs--xs ?? [] = []-xs ?? (x:ys) = ys ++ ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = xs--xs ?? [] = xs ++ xs-xs ?? (x:ys) = ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = []--[] ?? xs = xs-(x:xs) ?? ys = x:xs--[] ?? xs = xs-(x:xs) ?? ys = x:ys--[] ?? xs = xs-(x:xs) ?? ys = [x]--[] ?? xs = xs-(x:xs) ?? ys = xs ++ xs--[] ?? xs = xs-(x:xs) ?? ys = xs ++ ys--[] ?? xs = xs-(x:xs) ?? ys = ys ++ xs--[] ?? xs = xs-(x:xs) ?? ys = ys ++ ys--[] ?? xs = []-(x:xs) ?? ys = x:xs--[] ?? xs = []-(x:xs) ?? ys = x:ys--[] ?? xs = []-(x:xs) ?? ys = [x]--[] ?? xs = []-(x:xs) ?? ys = xs ++ xs--[] ?? xs = []-(x:xs) ?? ys = xs ++ ys--[] ?? xs = []-(x:xs) ?? ys = ys ++ xs--[] ?? xs = []-(x:xs) ?? ys = ys ++ ys--[] ?? xs = xs ++ xs-(x:xs) ?? ys = xs--[] ?? xs = xs ++ xs-(x:xs) ?? ys = ys--[] ?? xs = xs ++ xs-(x:xs) ?? ys = []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? []--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? []--[] ?? xs = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = []--[] ?? xs = xs-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = []--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ?? xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ?? ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ?? []--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ?? ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ?? []--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? []--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? []--[] ?? xs = []-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = []-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = xs ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = xs ?? ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = xs ?? []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = ys ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = ys ?? []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = [] ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = [] ?? ys--[] ?? [] = []-[] ?? (x:xs) = xs ?? xs-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = xs ?? []-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = [] ?? xs-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = xs ?? xs-(x:xs) ?? ys = ys--[] ?? [] = []-[] ?? (x:xs) = xs ?? []-(x:xs) ?? ys = ys--[] ?? [] = []-[] ?? (x:xs) = [] ?? xs-(x:xs) ?? ys = ys--xs ?? ys = xs ++ (xs ++ xs)--xs ?? ys = xs ++ (xs ++ ys)--xs ?? ys = xs ++ (ys ++ xs)--xs ?? ys = xs ++ (ys ++ ys)--xs ?? ys = ys ++ (xs ++ xs)--xs ?? ys = ys ++ (xs ++ ys)--xs ?? ys = ys ++ (ys ++ xs)--xs ?? ys = ys ++ (ys ++ ys)--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = x:xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = x:ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [x]--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = y:xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = y:ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [y]--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ++ xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ++ ys--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ++ xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ++ ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = x:xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = x:ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = [x]--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = y:xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = y:ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = [y]--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ++ xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ++ ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ++ xs--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ++ ys--[] ?? xs = xs-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = []--[] ?? xs = xs-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = []--[] ?? xs = xs-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = []--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = x:xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = x:ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [x]--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = y:xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = y:ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [y]--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ++ xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ++ ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ++ xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ++ ys--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = x:xs--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = x:ys--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = [x]--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = y:xs--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = y:ys--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = [y]--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ++ xs--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ++ ys--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ++ xs--[] ?? xs = []-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ++ ys--[] ?? xs = []-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = []-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = []--[] ?? xs = []-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = ys--[] ?? xs = []-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = []--[] ?? xs = []-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = []-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = []--[] ?? xs = xs ++ xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs ++ xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? xs = xs ++ xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs ++ xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = x:xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = x:ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = [x]--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = xs ++ xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = xs ++ ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = ys ++ xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = ys ++ ys--[] ?? [] = []-[] ?? (x:xs) = x:xs-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = x:xs-(x:xs) ?? ys = ys--[] ?? [] = []-[] ?? (x:xs) = x:xs-(x:xs) ?? ys = []--[] ?? [] = []-[] ?? (x:xs) = [x]-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = [x]-(x:xs) ?? ys = ys--[] ?? [] = []-[] ?? (x:xs) = [x]-(x:xs) ?? ys = []--[] ?? [] = []-[] ?? (x:xs) = xs ++ xs-(x:xs) ?? ys = xs--[] ?? [] = []-[] ?? (x:xs) = xs ++ xs-(x:xs) ?? ys = ys--[] ?? [] = []-[] ?? (x:xs) = xs ++ xs-(x:xs) ?? ys = []--xs ?? [] = xs-xs ?? (x:ys) = (x:xs) ?? ys--xs ?? [] = xs-xs ?? (x:ys) = (x:ys) ?? ys--xs ?? [] = xs-xs ?? (x:ys) = [x] ?? ys--xs ?? [] = xs-xs ?? (x:ys) = (xs ++ xs) ?? ys--xs ?? [] = xs-xs ?? (x:ys) = (xs ++ ys) ?? ys--xs ?? [] = xs-xs ?? (x:ys) = (ys ++ xs) ?? ys--xs ?? [] = xs-xs ?? (x:ys) = (ys ++ ys) ?? ys--[] ?? xs = xs-(x:xs) ?? ys = xs ?? (x:xs)--[] ?? xs = xs-(x:xs) ?? ys = xs ?? (x:ys)--[] ?? xs = xs-(x:xs) ?? ys = xs ?? [x]--[] ?? xs = xs-(x:xs) ?? ys = xs ?? (xs ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = xs ?? (xs ++ ys)--[] ?? xs = xs-(x:xs) ?? ys = xs ?? (ys ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = xs ?? (ys ++ ys)--xs ?? [] = xs-xs ?? (x:ys) = x:xs ?? ys--xs ?? [] = xs-xs ?? (x:ys) = x:ys ?? xs--xs ?? [] = xs-xs ?? (x:ys) = x:ys ?? ys--xs ?? [] = xs-xs ?? (x:ys) = x:[] ?? xs--xs ?? [] = xs-xs ?? (x:ys) = x:[] ?? ys--xs ?? [] = xs-xs ?? (x:ys) = xs ++ xs ?? ys--xs ?? [] = xs-xs ?? (x:ys) = xs ++ ys ?? xs--xs ?? [] = xs-xs ?? (x:ys) = xs ++ ys ?? ys--xs ?? [] = xs-xs ?? (x:ys) = xs ++ [] ?? xs--xs ?? [] = xs-xs ?? (x:ys) = xs ++ [] ?? ys--xs ?? [] = xs-xs ?? (x:ys) = ys ++ xs ?? ys--xs ?? [] = xs-xs ?? (x:ys) = ys ++ ys ?? xs--xs ?? [] = xs-xs ?? (x:ys) = ys ++ ys ?? ys--xs ?? [] = xs-xs ?? (x:ys) = ys ++ [] ?? xs--xs ?? [] = xs-xs ?? (x:ys) = ys ++ [] ?? ys--xs ?? [] = xs-xs ?? (x:ys) = xs ?? ys ++ xs--xs ?? [] = xs-xs ?? (x:ys) = ys ?? xs ++ xs--xs ?? [] = xs-xs ?? (x:ys) = ys ?? ys ++ xs--xs ?? [] = xs-xs ?? (x:ys) = [] ?? xs ++ xs--xs ?? [] = xs-xs ?? (x:ys) = [] ?? ys ++ xs--xs ?? [] = xs-xs ?? (x:ys) = xs ?? ys ++ ys--xs ?? [] = xs-xs ?? (x:ys) = ys ?? xs ++ ys--xs ?? [] = xs-xs ?? (x:ys) = ys ?? ys ++ ys--xs ?? [] = xs-xs ?? (x:ys) = [] ?? xs ++ ys--xs ?? [] = xs-xs ?? (x:ys) = [] ?? ys ++ ys--xs ?? [] = []-xs ?? (x:ys) = x:xs ?? ys--xs ?? [] = []-xs ?? (x:ys) = x:ys ?? xs--xs ?? [] = []-xs ?? (x:ys) = x:ys ?? ys--xs ?? [] = []-xs ?? (x:ys) = x:[] ?? xs--xs ?? [] = []-xs ?? (x:ys) = x:[] ?? ys--xs ?? [] = []-xs ?? (x:ys) = xs ++ xs ?? ys--xs ?? [] = []-xs ?? (x:ys) = xs ++ ys ?? xs--xs ?? [] = []-xs ?? (x:ys) = xs ++ ys ?? ys--xs ?? [] = []-xs ?? (x:ys) = xs ++ [] ?? xs--xs ?? [] = []-xs ?? (x:ys) = xs ++ [] ?? ys--xs ?? [] = []-xs ?? (x:ys) = ys ++ xs ?? ys--xs ?? [] = []-xs ?? (x:ys) = ys ++ ys ?? xs--xs ?? [] = []-xs ?? (x:ys) = ys ++ ys ?? ys--xs ?? [] = []-xs ?? (x:ys) = ys ++ [] ?? xs--xs ?? [] = []-xs ?? (x:ys) = ys ++ [] ?? ys--xs ?? [] = []-xs ?? (x:ys) = xs ?? ys ++ xs--xs ?? [] = []-xs ?? (x:ys) = ys ?? xs ++ xs--xs ?? [] = []-xs ?? (x:ys) = ys ?? ys ++ xs--xs ?? [] = []-xs ?? (x:ys) = [] ?? xs ++ xs--xs ?? [] = []-xs ?? (x:ys) = [] ?? ys ++ xs--xs ?? [] = []-xs ?? (x:ys) = xs ?? ys ++ ys--xs ?? [] = []-xs ?? (x:ys) = ys ?? xs ++ ys--xs ?? [] = []-xs ?? (x:ys) = ys ?? ys ++ ys--xs ?? [] = []-xs ?? (x:ys) = [] ?? xs ++ ys--xs ?? [] = []-xs ?? (x:ys) = [] ?? ys ++ ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = xs ?? ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = ys ?? xs--xs ?? [] = xs ++ xs-xs ?? (x:ys) = ys ?? ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = [] ?? xs--xs ?? [] = xs ++ xs-xs ?? (x:ys) = [] ?? ys--[] ?? xs = xs-(x:xs) ?? ys = x:xs ?? xs--[] ?? xs = xs-(x:xs) ?? ys = x:xs ?? ys--[] ?? xs = xs-(x:xs) ?? ys = x:xs ?? []--[] ?? xs = xs-(x:xs) ?? ys = x:ys ?? xs--[] ?? xs = xs-(x:xs) ?? ys = x:ys ?? []--[] ?? xs = xs-(x:xs) ?? ys = xs ++ xs ?? xs--[] ?? xs = xs-(x:xs) ?? ys = xs ++ xs ?? ys--[] ?? xs = xs-(x:xs) ?? ys = xs ++ xs ?? []--[] ?? xs = xs-(x:xs) ?? ys = xs ++ ys ?? xs--[] ?? xs = xs-(x:xs) ?? ys = xs ++ ys ?? []--[] ?? xs = xs-(x:xs) ?? ys = ys ++ xs ?? xs--[] ?? xs = xs-(x:xs) ?? ys = ys ++ xs ?? ys--[] ?? xs = xs-(x:xs) ?? ys = ys ++ xs ?? []--[] ?? xs = xs-(x:xs) ?? ys = ys ++ ys ?? xs--[] ?? xs = xs-(x:xs) ?? ys = ys ++ ys ?? []--[] ?? xs = xs-(x:xs) ?? ys = xs ?? xs ++ xs--[] ?? xs = xs-(x:xs) ?? ys = xs ?? ys ++ xs--[] ?? xs = xs-(x:xs) ?? ys = xs ?? [] ++ xs--[] ?? xs = xs-(x:xs) ?? ys = ys ?? xs ++ xs--[] ?? xs = xs-(x:xs) ?? ys = ys ?? [] ++ xs--[] ?? xs = xs-(x:xs) ?? ys = xs ?? xs ++ ys--[] ?? xs = xs-(x:xs) ?? ys = xs ?? ys ++ ys--[] ?? xs = xs-(x:xs) ?? ys = xs ?? [] ++ ys--[] ?? xs = xs-(x:xs) ?? ys = ys ?? xs ++ ys--[] ?? xs = xs-(x:xs) ?? ys = ys ?? [] ++ ys--[] ?? xs = []-(x:xs) ?? ys = x:xs ?? xs--[] ?? xs = []-(x:xs) ?? ys = x:xs ?? ys--[] ?? xs = []-(x:xs) ?? ys = x:xs ?? []--[] ?? xs = []-(x:xs) ?? ys = x:ys ?? xs--[] ?? xs = []-(x:xs) ?? ys = x:ys ?? []--[] ?? xs = []-(x:xs) ?? ys = xs ++ xs ?? xs--[] ?? xs = []-(x:xs) ?? ys = xs ++ xs ?? ys--[] ?? xs = []-(x:xs) ?? ys = xs ++ xs ?? []--[] ?? xs = []-(x:xs) ?? ys = xs ++ ys ?? xs--[] ?? xs = []-(x:xs) ?? ys = xs ++ ys ?? []--[] ?? xs = []-(x:xs) ?? ys = ys ++ xs ?? xs--[] ?? xs = []-(x:xs) ?? ys = ys ++ xs ?? ys--[] ?? xs = []-(x:xs) ?? ys = ys ++ xs ?? []--[] ?? xs = []-(x:xs) ?? ys = ys ++ ys ?? xs--[] ?? xs = []-(x:xs) ?? ys = ys ++ ys ?? []--[] ?? xs = []-(x:xs) ?? ys = xs ?? xs ++ xs--[] ?? xs = []-(x:xs) ?? ys = xs ?? ys ++ xs--[] ?? xs = []-(x:xs) ?? ys = xs ?? [] ++ xs--[] ?? xs = []-(x:xs) ?? ys = ys ?? xs ++ xs--[] ?? xs = []-(x:xs) ?? ys = ys ?? [] ++ xs--[] ?? xs = []-(x:xs) ?? ys = xs ?? xs ++ ys--[] ?? xs = []-(x:xs) ?? ys = xs ?? ys ++ ys--[] ?? xs = []-(x:xs) ?? ys = xs ?? [] ++ ys--[] ?? xs = []-(x:xs) ?? ys = ys ?? xs ++ ys--[] ?? xs = []-(x:xs) ?? ys = ys ?? [] ++ ys--[] ?? xs = xs ++ xs-(x:xs) ?? ys = xs ?? xs--[] ?? xs = xs ++ xs-(x:xs) ?? ys = xs ?? ys--[] ?? xs = xs ++ xs-(x:xs) ?? ys = xs ?? []--[] ?? xs = xs ++ xs-(x:xs) ?? ys = ys ?? xs--[] ?? xs = xs ++ xs-(x:xs) ?? ys = ys ?? []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [] ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [] ?? ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = [] ?? xs-(x:xs) ?? (y:ys) = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs ?? []-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = [] ?? xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs ?? xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs ?? []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = [] ?? xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs ?? xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs ?? []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = [] ?? xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--xs ?? [] = xs-xs ?? (x:ys) = x:x:xs--xs ?? [] = xs-xs ?? (x:ys) = x:x:ys--xs ?? [] = xs-xs ?? (x:ys) = [x,x]--xs ?? [] = xs-xs ?? (x:ys) = x:(xs ++ xs)--xs ?? [] = xs-xs ?? (x:ys) = x:(xs ++ ys)--xs ?? [] = xs-xs ?? (x:ys) = x:(ys ++ xs)--xs ?? [] = xs-xs ?? (x:ys) = x:(ys ++ ys)--xs ?? [] = xs-xs ?? (x:ys) = xs ++ (x:xs)--xs ?? [] = xs-xs ?? (x:ys) = xs ++ (x:ys)--xs ?? [] = xs-xs ?? (x:ys) = xs ++ [x]--xs ?? [] = xs-xs ?? (x:ys) = xs ++ (xs ++ xs)--xs ?? [] = xs-xs ?? (x:ys) = xs ++ (xs ++ ys)--xs ?? [] = xs-xs ?? (x:ys) = xs ++ (ys ++ xs)--xs ?? [] = xs-xs ?? (x:ys) = xs ++ (ys ++ ys)--xs ?? [] = xs-xs ?? (x:ys) = ys ++ (x:xs)--xs ?? [] = xs-xs ?? (x:ys) = ys ++ (x:ys)--xs ?? [] = xs-xs ?? (x:ys) = ys ++ [x]--xs ?? [] = xs-xs ?? (x:ys) = ys ++ (xs ++ xs)--xs ?? [] = xs-xs ?? (x:ys) = ys ++ (xs ++ ys)--xs ?? [] = xs-xs ?? (x:ys) = ys ++ (ys ++ xs)--xs ?? [] = xs-xs ?? (x:ys) = ys ++ (ys ++ ys)--xs ?? [] = []-xs ?? (x:ys) = x:x:xs--xs ?? [] = []-xs ?? (x:ys) = x:x:ys--xs ?? [] = []-xs ?? (x:ys) = [x,x]--xs ?? [] = []-xs ?? (x:ys) = x:(xs ++ xs)--xs ?? [] = []-xs ?? (x:ys) = x:(xs ++ ys)--xs ?? [] = []-xs ?? (x:ys) = x:(ys ++ xs)--xs ?? [] = []-xs ?? (x:ys) = x:(ys ++ ys)--xs ?? [] = []-xs ?? (x:ys) = xs ++ (x:xs)--xs ?? [] = []-xs ?? (x:ys) = xs ++ (x:ys)--xs ?? [] = []-xs ?? (x:ys) = xs ++ [x]--xs ?? [] = []-xs ?? (x:ys) = xs ++ (xs ++ xs)--xs ?? [] = []-xs ?? (x:ys) = xs ++ (xs ++ ys)--xs ?? [] = []-xs ?? (x:ys) = xs ++ (ys ++ xs)--xs ?? [] = []-xs ?? (x:ys) = xs ++ (ys ++ ys)--xs ?? [] = []-xs ?? (x:ys) = ys ++ (x:xs)--xs ?? [] = []-xs ?? (x:ys) = ys ++ (x:ys)--xs ?? [] = []-xs ?? (x:ys) = ys ++ [x]--xs ?? [] = []-xs ?? (x:ys) = ys ++ (xs ++ xs)--xs ?? [] = []-xs ?? (x:ys) = ys ++ (xs ++ ys)--xs ?? [] = []-xs ?? (x:ys) = ys ++ (ys ++ xs)--xs ?? [] = []-xs ?? (x:ys) = ys ++ (ys ++ ys)--xs ?? [] = xs ++ xs-xs ?? (x:ys) = x:xs--xs ?? [] = xs ++ xs-xs ?? (x:ys) = x:ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = [x]--xs ?? [] = xs ++ xs-xs ?? (x:ys) = xs ++ ys--xs ?? [] = xs ++ xs-xs ?? (x:ys) = ys ++ xs--xs ?? [] = xs ++ xs-xs ?? (x:ys) = ys ++ ys--xs ?? [] = xs ++ (xs ++ xs)-xs ?? (x:ys) = xs--xs ?? [] = xs ++ (xs ++ xs)-xs ?? (x:ys) = ys--xs ?? [] = xs ++ (xs ++ xs)-xs ?? (x:ys) = []--[] ?? xs = xs-(x:xs) ?? ys = x:x:xs--[] ?? xs = xs-(x:xs) ?? ys = x:x:ys--[] ?? xs = xs-(x:xs) ?? ys = [x,x]--[] ?? xs = xs-(x:xs) ?? ys = x:(xs ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = x:(xs ++ ys)--[] ?? xs = xs-(x:xs) ?? ys = x:(ys ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = x:(ys ++ ys)--[] ?? xs = xs-(x:xs) ?? ys = xs ++ (x:xs)--[] ?? xs = xs-(x:xs) ?? ys = xs ++ (x:ys)--[] ?? xs = xs-(x:xs) ?? ys = xs ++ [x]--[] ?? xs = xs-(x:xs) ?? ys = xs ++ (xs ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = xs ++ (xs ++ ys)--[] ?? xs = xs-(x:xs) ?? ys = xs ++ (ys ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = xs ++ (ys ++ ys)--[] ?? xs = xs-(x:xs) ?? ys = ys ++ (x:xs)--[] ?? xs = xs-(x:xs) ?? ys = ys ++ (x:ys)--[] ?? xs = xs-(x:xs) ?? ys = ys ++ [x]--[] ?? xs = xs-(x:xs) ?? ys = ys ++ (xs ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = ys ++ (xs ++ ys)--[] ?? xs = xs-(x:xs) ?? ys = ys ++ (ys ++ xs)--[] ?? xs = xs-(x:xs) ?? ys = ys ++ (ys ++ ys)--[] ?? xs = []-(x:xs) ?? ys = x:x:xs--[] ?? xs = []-(x:xs) ?? ys = x:x:ys--[] ?? xs = []-(x:xs) ?? ys = [x,x]--[] ?? xs = []-(x:xs) ?? ys = x:(xs ++ xs)--[] ?? xs = []-(x:xs) ?? ys = x:(xs ++ ys)--[] ?? xs = []-(x:xs) ?? ys = x:(ys ++ xs)--[] ?? xs = []-(x:xs) ?? ys = x:(ys ++ ys)--[] ?? xs = []-(x:xs) ?? ys = xs ++ (x:xs)--[] ?? xs = []-(x:xs) ?? ys = xs ++ (x:ys)--[] ?? xs = []-(x:xs) ?? ys = xs ++ [x]--[] ?? xs = []-(x:xs) ?? ys = xs ++ (xs ++ xs)--[] ?? xs = []-(x:xs) ?? ys = xs ++ (xs ++ ys)--[] ?? xs = []-(x:xs) ?? ys = xs ++ (ys ++ xs)--[] ?? xs = []-(x:xs) ?? ys = xs ++ (ys ++ ys)--[] ?? xs = []-(x:xs) ?? ys = ys ++ (x:xs)--[] ?? xs = []-(x:xs) ?? ys = ys ++ (x:ys)--[] ?? xs = []-(x:xs) ?? ys = ys ++ [x]--[] ?? xs = []-(x:xs) ?? ys = ys ++ (xs ++ xs)--[] ?? xs = []-(x:xs) ?? ys = ys ++ (xs ++ ys)--[] ?? xs = []-(x:xs) ?? ys = ys ++ (ys ++ xs)--[] ?? xs = []-(x:xs) ?? ys = ys ++ (ys ++ ys)--[] ?? xs = xs ++ xs-(x:xs) ?? ys = x:xs--[] ?? xs = xs ++ xs-(x:xs) ?? ys = x:ys--[] ?? xs = xs ++ xs-(x:xs) ?? ys = [x]--[] ?? xs = xs ++ xs-(x:xs) ?? ys = xs ++ xs--[] ?? xs = xs ++ xs-(x:xs) ?? ys = xs ++ ys--[] ?? xs = xs ++ xs-(x:xs) ?? ys = ys ++ xs--[] ?? xs = xs ++ (xs ++ xs)-(x:xs) ?? ys = xs--[] ?? xs = xs ++ (xs ++ xs)-(x:xs) ?? ys = ys--[] ?? xs = xs ++ (xs ++ xs)-(x:xs) ?? ys = []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = x:xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = x:ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [x]--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = y:xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = y:ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = [y]--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ++ xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ++ ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ++ xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ++ ys--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = x:xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = [x]-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = xs--[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? [] = xs ++ xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = x:xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = x:xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = [x]-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = [x]-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []--[] ?? [] = []-[] ?? (x:xs) = xs ++ xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs ++ xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = []----allowed patterns:--xs ?? ys = _---xs ?? [] = _-xs ?? (x:ys) = _--[] ?? xs = _-(x:xs) ?? ys = _---[] ?? xs = _-(x:xs) ?? [] = _-(x:xs) ?? (y:ys) = _--[] ?? [] = _-[] ?? (x:xs) = _-(x:xs) ?? ys = _---[] ?? [] = _-[] ?? (x:xs) = _-(x:xs) ?? [] = _-(x:xs) ?? (y:ys) = _-----allowed deconstructions:---Candidates for: ton :: Bool -> Bool- pruning with 39/49 rules- [3,1,0,0,0,0,0,0,0] direct candidates, 0 duplicates- [3,3,0,0,0,0,0,0,0] pattern candidates, 0 duplicates--rules:-not False == True-not True == False-p && p == p-p || p == p-not (not p) == p-p && False == False-p && True == p-False && p == False-True && p == p-p || False == p-p || True == True-False || p == p-True || p == True-not (p && q) == not p || not q-not (p && q) == not q || not p-not (p || q) == not p && not q-not (p || q) == not q && not p-p && not p == False-not p && p == False-p || not p == True-not p || p == True-(p && q) && r == p && (q && r)-(p && q) && r == q && (p && r)-(p || q) || r == p || (q || r)-(p || q) || r == q || (p || r)-p && (p && q) == p && q-p && (q && p) == p && q-p && (q && p) == q && p-p || (p || q) == p || q-p || (q || p) == p || q-p || (q || p) == q || p-p && (p || q) == p-p && (q || p) == p-(p || q) && p == p-(p || q) && q == q-p || p && q == p-p || q && p == p-p && q || p == p-p && q || q == q-equations:-q && p == p && q-q || p == p || q-q && (p && r) == p && (q && r)-r && (p && q) == p && (q && r)-r && (q && p) == p && (q && r)-q || (p || r) == p || (q || r)-r || (p || q) == p || (q || r)-r || (q || p) == p || (q || r)-(r || q) && p == p && (q || r)-r && q || p == p || q && r--direct candidates:--ton p = p--ton p = False--ton p = True--ton p = not p---pattern candidates:--ton p = p--ton p = False--ton p = True--ton p = not p--ton False = False-ton True = True--ton False = True-ton True = False----allowed patterns:--ton p = _---ton False = _-ton True = _-----allowed deconstructions:---Candidates for: &| :: Bool -> Bool -> Bool- pruning with 39/49 rules- [4,2,2,4,2,16,17,56,110] direct candidates, 0 duplicates- [4,14,26,10,2,16,17,56,110] pattern candidates, 0 duplicates--rules:-not False == True-not True == False-p && p == p-p || p == p-not (not p) == p-p && False == False-p && True == p-False && p == False-True && p == p-p || False == p-p || True == True-False || p == p-True || p == True-not (p && q) == not p || not q-not (p && q) == not q || not p-not (p || q) == not p && not q-not (p || q) == not q && not p-p && not p == False-not p && p == False-p || not p == True-not p || p == True-(p && q) && r == p && (q && r)-(p && q) && r == q && (p && r)-(p || q) || r == p || (q || r)-(p || q) || r == q || (p || r)-p && (p && q) == p && q-p && (q && p) == p && q-p && (q && p) == q && p-p || (p || q) == p || q-p || (q || p) == p || q-p || (q || p) == q || p-p && (p || q) == p-p && (q || p) == p-(p || q) && p == p-(p || q) && q == q-p || p && q == p-p || q && p == p-p && q || p == p-p && q || q == q-equations:-q && p == p && q-q || p == p || q-q && (p && r) == p && (q && r)-r && (p && q) == p && (q && r)-r && (q && p) == p && (q && r)-q || (p || r) == p || (q || r)-r || (p || q) == p || (q || r)-r || (q || p) == p || (q || r)-(r || q) && p == p && (q || r)-r && q || p == p || q && r--direct candidates:--p &| q = p--p &| q = q--p &| q = False--p &| q = True--p &| q = not p--p &| q = not q--p &| q = p && q--p &| q = p || q--p &| q = p && not q--p &| q = q && not p--p &| q = p || not q--p &| q = q || not p--p &| q = not p && not q--p &| q = not p || not q--p &| q = p && (q && not p)--p &| q = p && (q || not p)--p &| q = q && (p && not q)--p &| q = q && (p || not q)--p &| q = p || q && not p--p &| q = p || (q || not p)--p &| q = q || p && not q--p &| q = q || (p || not q)--p &| q = not p && (p && q)--p &| q = not p && (p || q)--p &| q = not q && (p && q)--p &| q = not q && (p || q)--p &| q = not p || p && q--p &| q = not p || (p || q)--p &| q = not q || p && q--p &| q = not q || (p || q)---pattern candidates:--p &| q = p--p &| q = q--p &| q = False--p &| q = True--p &| q = not p--p &| q = not q--p &| False = p-p &| True = False--p &| False = p-p &| True = True--p &| False = False-p &| True = p--p &| False = False-p &| True = True--p &| False = True-p &| True = p--p &| False = True-p &| True = False--False &| p = p-True &| p = False--False &| p = p-True &| p = True--False &| p = False-True &| p = p--False &| p = False-True &| p = True--False &| p = True-True &| p = p--False &| p = True-True &| p = False--p &| q = p && q--p &| q = p || q--p &| False = p-p &| True = not p--p &| False = False-p &| True = not p--p &| False = True-p &| True = not p--p &| False = not p-p &| True = p--p &| False = not p-p &| True = False--p &| False = not p-p &| True = True--False &| p = p-True &| p = not p--False &| p = False-True &| p = not p--False &| p = True-True &| p = not p--False &| p = not p-True &| p = p--False &| p = not p-True &| p = False--False &| p = not p-True &| p = True--False &| p = p-True &| False = False-True &| True = True--False &| p = p-True &| False = True-True &| True = False--False &| p = False-True &| False = False-True &| True = True--False &| p = False-True &| False = True-True &| True = False--False &| p = True-True &| False = False-True &| True = True--False &| p = True-True &| False = True-True &| True = False--False &| False = False-False &| True = True-True &| p = p--False &| False = False-False &| True = True-True &| p = False--False &| False = False-False &| True = True-True &| p = True--False &| False = True-False &| True = False-True &| p = p--False &| False = True-False &| True = False-True &| p = False--False &| False = True-False &| True = False-True &| p = True--p &| q = p && not q--p &| q = q && not p--p &| q = p || not q--p &| q = q || not p--False &| p = not p-True &| False = False-True &| True = True--False &| p = not p-True &| False = True-True &| True = False--False &| False = False-False &| True = True-True &| p = not p--False &| False = True-False &| True = False-True &| p = not p--False &| False = False-False &| True = True-True &| False = True-True &| True = False--False &| False = True-False &| True = False-True &| False = False-True &| True = True--p &| q = not p && not q--p &| q = not p || not q--p &| q = p && (q && not p)--p &| q = p && (q || not p)--p &| q = q && (p && not q)--p &| q = q && (p || not q)--p &| q = p || q && not p--p &| q = p || (q || not p)--p &| q = q || p && not q--p &| q = q || (p || not q)--p &| q = not p && (p && q)--p &| q = not p && (p || q)--p &| q = not q && (p && q)--p &| q = not q && (p || q)--p &| q = not p || p && q--p &| q = not p || (p || q)--p &| q = not q || p && q--p &| q = not q || (p || q)----allowed patterns:--p &| q = _---p &| False = _-p &| True = _--False &| p = _-True &| p = _---False &| p = _-True &| False = _-True &| True = _--False &| False = _-False &| True = _-True &| p = _---False &| False = _-False &| True = _-True &| False = _-True &| True = _-----allowed deconstructions:---Candidates for: gcd :: Int -> Int -> Int- pruning with 0/0 rules- [3,0,9,0,54,0,405,0,3402] direct candidates, 0 duplicates- [3,6,11,50,98,330,774,2714,6660] pattern candidates, 0 duplicates--no rules.--direct candidates:--gcd x y = x--gcd x y = y--gcd x y = 0--gcd x y = x `mod` x--gcd x y = x `mod` y--gcd x y = x `mod` 0--gcd x y = y `mod` x--gcd x y = y `mod` y--gcd x y = y `mod` 0--gcd x y = 0 `mod` x--gcd x y = 0 `mod` y--gcd x y = 0 `mod` 0--gcd x y = (x `mod` x) `mod` x--gcd x y = (x `mod` x) `mod` y--gcd x y = (x `mod` x) `mod` 0--gcd x y = (x `mod` y) `mod` x--gcd x y = (x `mod` y) `mod` y--gcd x y = (x `mod` y) `mod` 0--gcd x y = (x `mod` 0) `mod` x--gcd x y = (x `mod` 0) `mod` y--gcd x y = (x `mod` 0) `mod` 0--gcd x y = (y `mod` x) `mod` x--gcd x y = (y `mod` x) `mod` y--gcd x y = (y `mod` x) `mod` 0--gcd x y = (y `mod` y) `mod` x--gcd x y = (y `mod` y) `mod` y--gcd x y = (y `mod` y) `mod` 0--gcd x y = (y `mod` 0) `mod` x--gcd x y = (y `mod` 0) `mod` y--gcd x y = (y `mod` 0) `mod` 0--gcd x y = (0 `mod` x) `mod` x--gcd x y = (0 `mod` x) `mod` y--gcd x y = (0 `mod` x) `mod` 0--gcd x y = (0 `mod` y) `mod` x--gcd x y = (0 `mod` y) `mod` y--gcd x y = (0 `mod` y) `mod` 0--gcd x y = (0 `mod` 0) `mod` x--gcd x y = (0 `mod` 0) `mod` y--gcd x y = (0 `mod` 0) `mod` 0--gcd x y = x `mod` (x `mod` x)--gcd x y = x `mod` (x `mod` y)--gcd x y = x `mod` (x `mod` 0)--gcd x y = x `mod` (y `mod` x)--gcd x y = x `mod` (y `mod` y)--gcd x y = x `mod` (y `mod` 0)--gcd x y = x `mod` (0 `mod` x)--gcd x y = x `mod` (0 `mod` y)--gcd x y = x `mod` (0 `mod` 0)--gcd x y = y `mod` (x `mod` x)--gcd x y = y `mod` (x `mod` y)--gcd x y = y `mod` (x `mod` 0)--gcd x y = y `mod` (y `mod` x)--gcd x y = y `mod` (y `mod` y)--gcd x y = y `mod` (y `mod` 0)--gcd x y = y `mod` (0 `mod` x)--gcd x y = y `mod` (0 `mod` y)--gcd x y = y `mod` (0 `mod` 0)--gcd x y = 0 `mod` (x `mod` x)--gcd x y = 0 `mod` (x `mod` y)--gcd x y = 0 `mod` (x `mod` 0)--gcd x y = 0 `mod` (y `mod` x)--gcd x y = 0 `mod` (y `mod` y)--gcd x y = 0 `mod` (y `mod` 0)--gcd x y = 0 `mod` (0 `mod` x)--gcd x y = 0 `mod` (0 `mod` y)--gcd x y = 0 `mod` (0 `mod` 0)---pattern candidates:--gcd x y = x--gcd x y = y--gcd x y = 0--gcd x 0 = x-gcd x y = y--gcd x 0 = x-gcd x y = 0--gcd x 0 = 0-gcd x y = x--gcd 0 x = x-gcd x y = x--gcd 0 x = x-gcd x y = 0--gcd 0 x = 0-gcd x y = y--gcd x y = x `mod` x--gcd x y = x `mod` y--gcd x y = x `mod` 0--gcd x y = y `mod` x--gcd x y = y `mod` y--gcd x y = y `mod` 0--gcd x y = 0 `mod` x--gcd x y = 0 `mod` y--gcd 0 x = x-gcd x 0 = x-gcd x y = 0--gcd 0 x = x-gcd x 0 = 0-gcd x y = x--gcd 0 x = 0-gcd x 0 = x-gcd x y = y--gcd x 0 = x-gcd x y = x `mod` x--gcd x 0 = x-gcd x y = x `mod` y--gcd x 0 = x-gcd x y = x `mod` 0--gcd x 0 = x-gcd x y = y `mod` x--gcd x 0 = x-gcd x y = y `mod` y--gcd x 0 = x-gcd x y = y `mod` 0--gcd x 0 = x-gcd x y = 0 `mod` x--gcd x 0 = x-gcd x y = 0 `mod` y--gcd x 0 = 0-gcd x y = x `mod` x--gcd x 0 = 0-gcd x y = x `mod` y--gcd x 0 = 0-gcd x y = x `mod` 0--gcd x 0 = 0-gcd x y = y `mod` x--gcd x 0 = 0-gcd x y = y `mod` y--gcd x 0 = 0-gcd x y = y `mod` 0--gcd x 0 = 0-gcd x y = 0 `mod` x--gcd x 0 = 0-gcd x y = 0 `mod` y--gcd x 0 = x `mod` x-gcd x y = x--gcd x 0 = x `mod` x-gcd x y = y--gcd x 0 = x `mod` x-gcd x y = 0--gcd x 0 = x `mod` 0-gcd x y = x--gcd x 0 = x `mod` 0-gcd x y = y--gcd x 0 = x `mod` 0-gcd x y = 0--gcd x 0 = 0 `mod` x-gcd x y = x--gcd x 0 = 0 `mod` x-gcd x y = y--gcd x 0 = 0 `mod` x-gcd x y = 0--gcd 0 x = x-gcd x y = x `mod` x--gcd 0 x = x-gcd x y = x `mod` y--gcd 0 x = x-gcd x y = x `mod` 0--gcd 0 x = x-gcd x y = y `mod` x--gcd 0 x = x-gcd x y = y `mod` y--gcd 0 x = x-gcd x y = y `mod` 0--gcd 0 x = x-gcd x y = 0 `mod` x--gcd 0 x = x-gcd x y = 0 `mod` y--gcd 0 x = 0-gcd x y = x `mod` x--gcd 0 x = 0-gcd x y = x `mod` y--gcd 0 x = 0-gcd x y = x `mod` 0--gcd 0 x = 0-gcd x y = y `mod` x--gcd 0 x = 0-gcd x y = y `mod` y--gcd 0 x = 0-gcd x y = y `mod` 0--gcd 0 x = 0-gcd x y = 0 `mod` x--gcd 0 x = 0-gcd x y = 0 `mod` y--gcd 0 x = x `mod` x-gcd x y = x--gcd 0 x = x `mod` x-gcd x y = y--gcd 0 x = x `mod` x-gcd x y = 0--gcd 0 x = x `mod` 0-gcd x y = x--gcd 0 x = x `mod` 0-gcd x y = y--gcd 0 x = x `mod` 0-gcd x y = 0--gcd 0 x = 0 `mod` x-gcd x y = x--gcd 0 x = 0 `mod` x-gcd x y = y--gcd 0 x = 0 `mod` x-gcd x y = 0--gcd x y = (x `mod` x) `mod` x--gcd x y = (x `mod` x) `mod` y--gcd x y = (x `mod` x) `mod` 0--gcd x y = (x `mod` y) `mod` x--gcd x y = (x `mod` y) `mod` y--gcd x y = (x `mod` y) `mod` 0--gcd x y = (x `mod` 0) `mod` x--gcd x y = (x `mod` 0) `mod` y--gcd x y = (x `mod` 0) `mod` 0--gcd x y = (y `mod` x) `mod` x--gcd x y = (y `mod` x) `mod` y--gcd x y = (y `mod` x) `mod` 0--gcd x y = (y `mod` y) `mod` x--gcd x y = (y `mod` y) `mod` y--gcd x y = (y `mod` y) `mod` 0--gcd x y = (y `mod` 0) `mod` x--gcd x y = (y `mod` 0) `mod` y--gcd x y = (y `mod` 0) `mod` 0--gcd x y = (0 `mod` x) `mod` x--gcd x y = (0 `mod` x) `mod` y--gcd x y = (0 `mod` x) `mod` 0--gcd x y = (0 `mod` y) `mod` x--gcd x y = (0 `mod` y) `mod` y--gcd x y = (0 `mod` y) `mod` 0--gcd x y = x `mod` (x `mod` x)--gcd x y = x `mod` (x `mod` y)--gcd x y = x `mod` (x `mod` 0)--gcd x y = x `mod` (y `mod` x)--gcd x y = x `mod` (y `mod` y)--gcd x y = x `mod` (y `mod` 0)--gcd x y = x `mod` (0 `mod` x)--gcd x y = x `mod` (0 `mod` y)--gcd x y = y `mod` (x `mod` x)--gcd x y = y `mod` (x `mod` y)--gcd x y = y `mod` (x `mod` 0)--gcd x y = y `mod` (y `mod` x)--gcd x y = y `mod` (y `mod` y)--gcd x y = y `mod` (y `mod` 0)--gcd x y = y `mod` (0 `mod` x)--gcd x y = y `mod` (0 `mod` y)--gcd x y = 0 `mod` (x `mod` x)--gcd x y = 0 `mod` (x `mod` y)--gcd x y = 0 `mod` (x `mod` 0)--gcd x y = 0 `mod` (y `mod` x)--gcd x y = 0 `mod` (y `mod` y)--gcd x y = 0 `mod` (y `mod` 0)--gcd x y = 0 `mod` (0 `mod` x)--gcd x y = 0 `mod` (0 `mod` y)--gcd 0 x = x-gcd x 0 = x-gcd x y = x `mod` x--gcd 0 x = x-gcd x 0 = x-gcd x y = x `mod` y--gcd 0 x = x-gcd x 0 = x-gcd x y = x `mod` 0--gcd 0 x = x-gcd x 0 = x-gcd x y = y `mod` x--gcd 0 x = x-gcd x 0 = x-gcd x y = y `mod` y--gcd 0 x = x-gcd x 0 = x-gcd x y = y `mod` 0--gcd 0 x = x-gcd x 0 = x-gcd x y = 0 `mod` x--gcd 0 x = x-gcd x 0 = x-gcd x y = 0 `mod` y--gcd 0 x = x-gcd x 0 = 0-gcd x y = x `mod` x--gcd 0 x = x-gcd x 0 = 0-gcd x y = x `mod` y--gcd 0 x = x-gcd x 0 = 0-gcd x y = x `mod` 0--gcd 0 x = x-gcd x 0 = 0-gcd x y = y `mod` x--gcd 0 x = x-gcd x 0 = 0-gcd x y = y `mod` y--gcd 0 x = x-gcd x 0 = 0-gcd x y = y `mod` 0--gcd 0 x = x-gcd x 0 = 0-gcd x y = 0 `mod` x--gcd 0 x = x-gcd x 0 = 0-gcd x y = 0 `mod` y--gcd 0 x = x-gcd x 0 = x `mod` x-gcd x y = x--gcd 0 x = x-gcd x 0 = x `mod` x-gcd x y = 0--gcd 0 x = x-gcd x 0 = x `mod` 0-gcd x y = x--gcd 0 x = x-gcd x 0 = x `mod` 0-gcd x y = 0--gcd 0 x = x-gcd x 0 = 0 `mod` x-gcd x y = x--gcd 0 x = x-gcd x 0 = 0 `mod` x-gcd x y = 0--gcd 0 x = 0-gcd x 0 = x-gcd x y = x `mod` x--gcd 0 x = 0-gcd x 0 = x-gcd x y = x `mod` y--gcd 0 x = 0-gcd x 0 = x-gcd x y = x `mod` 0--gcd 0 x = 0-gcd x 0 = x-gcd x y = y `mod` x--gcd 0 x = 0-gcd x 0 = x-gcd x y = y `mod` y--gcd 0 x = 0-gcd x 0 = x-gcd x y = y `mod` 0--gcd 0 x = 0-gcd x 0 = x-gcd x y = 0 `mod` x--gcd 0 x = 0-gcd x 0 = x-gcd x y = 0 `mod` y--gcd 0 x = 0-gcd x 0 = 0-gcd x y = x `mod` x--gcd 0 x = 0-gcd x 0 = 0-gcd x y = x `mod` y--gcd 0 x = 0-gcd x 0 = 0-gcd x y = x `mod` 0--gcd 0 x = 0-gcd x 0 = 0-gcd x y = y `mod` x--gcd 0 x = 0-gcd x 0 = 0-gcd x y = y `mod` y--gcd 0 x = 0-gcd x 0 = 0-gcd x y = y `mod` 0--gcd 0 x = 0-gcd x 0 = 0-gcd x y = 0 `mod` x--gcd 0 x = 0-gcd x 0 = 0-gcd x y = 0 `mod` y--gcd 0 x = 0-gcd x 0 = x `mod` x-gcd x y = y--gcd 0 x = 0-gcd x 0 = x `mod` 0-gcd x y = y--gcd 0 x = 0-gcd x 0 = 0 `mod` x-gcd x y = y--gcd 0 x = x `mod` x-gcd x 0 = x-gcd x y = y--gcd 0 x = x `mod` x-gcd x 0 = x-gcd x y = 0--gcd 0 x = x `mod` x-gcd x 0 = 0-gcd x y = x--gcd 0 x = x `mod` 0-gcd x 0 = x-gcd x y = y--gcd 0 x = x `mod` 0-gcd x 0 = x-gcd x y = 0--gcd 0 x = x `mod` 0-gcd x 0 = 0-gcd x y = x--gcd 0 x = 0 `mod` x-gcd x 0 = x-gcd x y = y--gcd 0 x = 0 `mod` x-gcd x 0 = x-gcd x y = 0--gcd 0 x = 0 `mod` x-gcd x 0 = 0-gcd x y = x--gcd x 0 = x-gcd x y = gcd x (x `mod` y)--gcd x 0 = x-gcd x y = gcd x (y `mod` y)--gcd x 0 = x-gcd x y = gcd y (x `mod` x)--gcd x 0 = x-gcd x y = gcd y (x `mod` y)--gcd x 0 = x-gcd x y = gcd y (y `mod` x)--gcd x 0 = x-gcd x y = gcd y (y `mod` y)--gcd x 0 = x-gcd x y = gcd 0 (x `mod` y)--gcd x 0 = x-gcd x y = gcd 0 (y `mod` y)--gcd x 0 = x-gcd x y = gcd (x `mod` x) x--gcd x 0 = x-gcd x y = gcd (x `mod` x) y--gcd x 0 = x-gcd x y = gcd (x `mod` y) x--gcd x 0 = x-gcd x y = gcd (y `mod` x) x--gcd x 0 = x-gcd x y = gcd (y `mod` x) y--gcd x 0 = x-gcd x y = gcd (y `mod` y) x--gcd 0 x = x-gcd x y = gcd x (x `mod` y)--gcd 0 x = x-gcd x y = gcd x (y `mod` y)--gcd 0 x = x-gcd x y = gcd y (x `mod` x)--gcd 0 x = x-gcd x y = gcd y (x `mod` y)--gcd 0 x = x-gcd x y = gcd y (y `mod` x)--gcd 0 x = x-gcd x y = gcd y (y `mod` y)--gcd 0 x = x-gcd x y = gcd (x `mod` x) x--gcd 0 x = x-gcd x y = gcd (x `mod` x) y--gcd 0 x = x-gcd x y = gcd (x `mod` x) 0--gcd 0 x = x-gcd x y = gcd (x `mod` y) x--gcd 0 x = x-gcd x y = gcd (y `mod` x) x--gcd 0 x = x-gcd x y = gcd (y `mod` x) y--gcd 0 x = x-gcd x y = gcd (y `mod` x) 0--gcd 0 x = x-gcd x y = gcd (y `mod` y) x--gcd x 0 = x-gcd x y = (x `mod` x) `mod` x--gcd x 0 = x-gcd x y = (x `mod` x) `mod` y--gcd x 0 = x-gcd x y = (x `mod` x) `mod` 0--gcd x 0 = x-gcd x y = (x `mod` y) `mod` x--gcd x 0 = x-gcd x y = (x `mod` y) `mod` y--gcd x 0 = x-gcd x y = (x `mod` y) `mod` 0--gcd x 0 = x-gcd x y = (x `mod` 0) `mod` x--gcd x 0 = x-gcd x y = (x `mod` 0) `mod` y--gcd x 0 = x-gcd x y = (x `mod` 0) `mod` 0--gcd x 0 = x-gcd x y = (y `mod` x) `mod` x--gcd x 0 = x-gcd x y = (y `mod` x) `mod` y--gcd x 0 = x-gcd x y = (y `mod` x) `mod` 0--gcd x 0 = x-gcd x y = (y `mod` y) `mod` x--gcd x 0 = x-gcd x y = (y `mod` y) `mod` y--gcd x 0 = x-gcd x y = (y `mod` y) `mod` 0--gcd x 0 = x-gcd x y = (y `mod` 0) `mod` x--gcd x 0 = x-gcd x y = (y `mod` 0) `mod` y--gcd x 0 = x-gcd x y = (y `mod` 0) `mod` 0--gcd x 0 = x-gcd x y = (0 `mod` x) `mod` x--gcd x 0 = x-gcd x y = (0 `mod` x) `mod` y--gcd x 0 = x-gcd x y = (0 `mod` x) `mod` 0--gcd x 0 = x-gcd x y = (0 `mod` y) `mod` x--gcd x 0 = x-gcd x y = (0 `mod` y) `mod` y--gcd x 0 = x-gcd x y = (0 `mod` y) `mod` 0--gcd x 0 = x-gcd x y = x `mod` (x `mod` x)--gcd x 0 = x-gcd x y = x `mod` (x `mod` y)--gcd x 0 = x-gcd x y = x `mod` (x `mod` 0)--gcd x 0 = x-gcd x y = x `mod` (y `mod` x)--gcd x 0 = x-gcd x y = x `mod` (y `mod` y)--gcd x 0 = x-gcd x y = x `mod` (y `mod` 0)--gcd x 0 = x-gcd x y = x `mod` (0 `mod` x)--gcd x 0 = x-gcd x y = x `mod` (0 `mod` y)--gcd x 0 = x-gcd x y = y `mod` (x `mod` x)--gcd x 0 = x-gcd x y = y `mod` (x `mod` y)--gcd x 0 = x-gcd x y = y `mod` (x `mod` 0)--gcd x 0 = x-gcd x y = y `mod` (y `mod` x)--gcd x 0 = x-gcd x y = y `mod` (y `mod` y)--gcd x 0 = x-gcd x y = y `mod` (y `mod` 0)--gcd x 0 = x-gcd x y = y `mod` (0 `mod` x)--gcd x 0 = x-gcd x y = y `mod` (0 `mod` y)--gcd x 0 = x-gcd x y = 0 `mod` (x `mod` x)--gcd x 0 = x-gcd x y = 0 `mod` (x `mod` y)--gcd x 0 = x-gcd x y = 0 `mod` (x `mod` 0)--gcd x 0 = x-gcd x y = 0 `mod` (y `mod` x)--gcd x 0 = x-gcd x y = 0 `mod` (y `mod` y)--gcd x 0 = x-gcd x y = 0 `mod` (y `mod` 0)--gcd x 0 = x-gcd x y = 0 `mod` (0 `mod` x)--gcd x 0 = x-gcd x y = 0 `mod` (0 `mod` y)--gcd x 0 = 0-gcd x y = (x `mod` x) `mod` x--gcd x 0 = 0-gcd x y = (x `mod` x) `mod` y--gcd x 0 = 0-gcd x y = (x `mod` x) `mod` 0--gcd x 0 = 0-gcd x y = (x `mod` y) `mod` x--gcd x 0 = 0-gcd x y = (x `mod` y) `mod` y--gcd x 0 = 0-gcd x y = (x `mod` y) `mod` 0--gcd x 0 = 0-gcd x y = (x `mod` 0) `mod` x--gcd x 0 = 0-gcd x y = (x `mod` 0) `mod` y--gcd x 0 = 0-gcd x y = (x `mod` 0) `mod` 0--gcd x 0 = 0-gcd x y = (y `mod` x) `mod` x--gcd x 0 = 0-gcd x y = (y `mod` x) `mod` y--gcd x 0 = 0-gcd x y = (y `mod` x) `mod` 0--gcd x 0 = 0-gcd x y = (y `mod` y) `mod` x--gcd x 0 = 0-gcd x y = (y `mod` y) `mod` y--gcd x 0 = 0-gcd x y = (y `mod` y) `mod` 0--gcd x 0 = 0-gcd x y = (y `mod` 0) `mod` x--gcd x 0 = 0-gcd x y = (y `mod` 0) `mod` y--gcd x 0 = 0-gcd x y = (y `mod` 0) `mod` 0--gcd x 0 = 0-gcd x y = (0 `mod` x) `mod` x--gcd x 0 = 0-gcd x y = (0 `mod` x) `mod` y--gcd x 0 = 0-gcd x y = (0 `mod` x) `mod` 0--gcd x 0 = 0-gcd x y = (0 `mod` y) `mod` x--gcd x 0 = 0-gcd x y = (0 `mod` y) `mod` y--gcd x 0 = 0-gcd x y = (0 `mod` y) `mod` 0--gcd x 0 = 0-gcd x y = x `mod` (x `mod` x)--gcd x 0 = 0-gcd x y = x `mod` (x `mod` y)--gcd x 0 = 0-gcd x y = x `mod` (x `mod` 0)--gcd x 0 = 0-gcd x y = x `mod` (y `mod` x)--gcd x 0 = 0-gcd x y = x `mod` (y `mod` y)--gcd x 0 = 0-gcd x y = x `mod` (y `mod` 0)--gcd x 0 = 0-gcd x y = x `mod` (0 `mod` x)--gcd x 0 = 0-gcd x y = x `mod` (0 `mod` y)--gcd x 0 = 0-gcd x y = y `mod` (x `mod` x)--gcd x 0 = 0-gcd x y = y `mod` (x `mod` y)--gcd x 0 = 0-gcd x y = y `mod` (x `mod` 0)--gcd x 0 = 0-gcd x y = y `mod` (y `mod` x)--gcd x 0 = 0-gcd x y = y `mod` (y `mod` y)--gcd x 0 = 0-gcd x y = y `mod` (y `mod` 0)--gcd x 0 = 0-gcd x y = y `mod` (0 `mod` x)--gcd x 0 = 0-gcd x y = y `mod` (0 `mod` y)--gcd x 0 = 0-gcd x y = 0 `mod` (x `mod` x)--gcd x 0 = 0-gcd x y = 0 `mod` (x `mod` y)--gcd x 0 = 0-gcd x y = 0 `mod` (x `mod` 0)--gcd x 0 = 0-gcd x y = 0 `mod` (y `mod` x)--gcd x 0 = 0-gcd x y = 0 `mod` (y `mod` y)--gcd x 0 = 0-gcd x y = 0 `mod` (y `mod` 0)--gcd x 0 = 0-gcd x y = 0 `mod` (0 `mod` x)--gcd x 0 = 0-gcd x y = 0 `mod` (0 `mod` y)--gcd x 0 = x `mod` x-gcd x y = x `mod` y--gcd x 0 = x `mod` x-gcd x y = x `mod` 0--gcd x 0 = x `mod` x-gcd x y = y `mod` x--gcd x 0 = x `mod` x-gcd x y = y `mod` y--gcd x 0 = x `mod` x-gcd x y = y `mod` 0--gcd x 0 = x `mod` x-gcd x y = 0 `mod` x--gcd x 0 = x `mod` x-gcd x y = 0 `mod` y--gcd x 0 = x `mod` 0-gcd x y = x `mod` x--gcd x 0 = x `mod` 0-gcd x y = y `mod` x--gcd x 0 = x `mod` 0-gcd x y = y `mod` y--gcd x 0 = x `mod` 0-gcd x y = y `mod` 0--gcd x 0 = x `mod` 0-gcd x y = 0 `mod` x--gcd x 0 = x `mod` 0-gcd x y = 0 `mod` y--gcd x 0 = 0 `mod` x-gcd x y = x `mod` x--gcd x 0 = 0 `mod` x-gcd x y = x `mod` y--gcd x 0 = 0 `mod` x-gcd x y = x `mod` 0--gcd x 0 = 0 `mod` x-gcd x y = y `mod` y--gcd x 0 = 0 `mod` x-gcd x y = y `mod` 0--gcd x 0 = 0 `mod` x-gcd x y = 0 `mod` y--gcd x 0 = (x `mod` x) `mod` x-gcd x y = x--gcd x 0 = (x `mod` x) `mod` x-gcd x y = y--gcd x 0 = (x `mod` x) `mod` x-gcd x y = 0--gcd x 0 = (x `mod` x) `mod` 0-gcd x y = x--gcd x 0 = (x `mod` x) `mod` 0-gcd x y = y--gcd x 0 = (x `mod` x) `mod` 0-gcd x y = 0--gcd x 0 = (x `mod` 0) `mod` x-gcd x y = x--gcd x 0 = (x `mod` 0) `mod` x-gcd x y = y--gcd x 0 = (x `mod` 0) `mod` x-gcd x y = 0--gcd x 0 = (x `mod` 0) `mod` 0-gcd x y = x--gcd x 0 = (x `mod` 0) `mod` 0-gcd x y = y--gcd x 0 = (x `mod` 0) `mod` 0-gcd x y = 0--gcd x 0 = (0 `mod` x) `mod` x-gcd x y = x--gcd x 0 = (0 `mod` x) `mod` x-gcd x y = y--gcd x 0 = (0 `mod` x) `mod` x-gcd x y = 0--gcd x 0 = (0 `mod` x) `mod` 0-gcd x y = x--gcd x 0 = (0 `mod` x) `mod` 0-gcd x y = y--gcd x 0 = (0 `mod` x) `mod` 0-gcd x y = 0--gcd x 0 = x `mod` (x `mod` x)-gcd x y = x--gcd x 0 = x `mod` (x `mod` x)-gcd x y = y--gcd x 0 = x `mod` (x `mod` x)-gcd x y = 0--gcd x 0 = x `mod` (x `mod` 0)-gcd x y = x--gcd x 0 = x `mod` (x `mod` 0)-gcd x y = y--gcd x 0 = x `mod` (x `mod` 0)-gcd x y = 0--gcd x 0 = x `mod` (0 `mod` x)-gcd x y = x--gcd x 0 = x `mod` (0 `mod` x)-gcd x y = y--gcd x 0 = x `mod` (0 `mod` x)-gcd x y = 0--gcd x 0 = 0 `mod` (x `mod` x)-gcd x y = x--gcd x 0 = 0 `mod` (x `mod` x)-gcd x y = y--gcd x 0 = 0 `mod` (x `mod` x)-gcd x y = 0--gcd x 0 = 0 `mod` (x `mod` 0)-gcd x y = x--gcd x 0 = 0 `mod` (x `mod` 0)-gcd x y = y--gcd x 0 = 0 `mod` (x `mod` 0)-gcd x y = 0--gcd x 0 = 0 `mod` (0 `mod` x)-gcd x y = x--gcd x 0 = 0 `mod` (0 `mod` x)-gcd x y = y--gcd x 0 = 0 `mod` (0 `mod` x)-gcd x y = 0--gcd 0 x = x-gcd x y = (x `mod` x) `mod` x--gcd 0 x = x-gcd x y = (x `mod` x) `mod` y--gcd 0 x = x-gcd x y = (x `mod` x) `mod` 0--gcd 0 x = x-gcd x y = (x `mod` y) `mod` x--gcd 0 x = x-gcd x y = (x `mod` y) `mod` y--gcd 0 x = x-gcd x y = (x `mod` y) `mod` 0--gcd 0 x = x-gcd x y = (x `mod` 0) `mod` x--gcd 0 x = x-gcd x y = (x `mod` 0) `mod` y--gcd 0 x = x-gcd x y = (x `mod` 0) `mod` 0--gcd 0 x = x-gcd x y = (y `mod` x) `mod` x--gcd 0 x = x-gcd x y = (y `mod` x) `mod` y--gcd 0 x = x-gcd x y = (y `mod` x) `mod` 0--gcd 0 x = x-gcd x y = (y `mod` y) `mod` x--gcd 0 x = x-gcd x y = (y `mod` y) `mod` y--gcd 0 x = x-gcd x y = (y `mod` y) `mod` 0--gcd 0 x = x-gcd x y = (y `mod` 0) `mod` x--gcd 0 x = x-gcd x y = (y `mod` 0) `mod` y--gcd 0 x = x-gcd x y = (y `mod` 0) `mod` 0--gcd 0 x = x-gcd x y = (0 `mod` x) `mod` x--gcd 0 x = x-gcd x y = (0 `mod` x) `mod` y--gcd 0 x = x-gcd x y = (0 `mod` x) `mod` 0--gcd 0 x = x-gcd x y = (0 `mod` y) `mod` x--gcd 0 x = x-gcd x y = (0 `mod` y) `mod` y--gcd 0 x = x-gcd x y = (0 `mod` y) `mod` 0--gcd 0 x = x-gcd x y = x `mod` (x `mod` x)--gcd 0 x = x-gcd x y = x `mod` (x `mod` y)--gcd 0 x = x-gcd x y = x `mod` (x `mod` 0)--gcd 0 x = x-gcd x y = x `mod` (y `mod` x)--gcd 0 x = x-gcd x y = x `mod` (y `mod` y)--gcd 0 x = x-gcd x y = x `mod` (y `mod` 0)--gcd 0 x = x-gcd x y = x `mod` (0 `mod` x)--gcd 0 x = x-gcd x y = x `mod` (0 `mod` y)--gcd 0 x = x-gcd x y = y `mod` (x `mod` x)--gcd 0 x = x-gcd x y = y `mod` (x `mod` y)--gcd 0 x = x-gcd x y = y `mod` (x `mod` 0)--gcd 0 x = x-gcd x y = y `mod` (y `mod` x)--gcd 0 x = x-gcd x y = y `mod` (y `mod` y)--gcd 0 x = x-gcd x y = y `mod` (y `mod` 0)--gcd 0 x = x-gcd x y = y `mod` (0 `mod` x)--gcd 0 x = x-gcd x y = y `mod` (0 `mod` y)--gcd 0 x = x-gcd x y = 0 `mod` (x `mod` x)--gcd 0 x = x-gcd x y = 0 `mod` (x `mod` y)--gcd 0 x = x-gcd x y = 0 `mod` (x `mod` 0)--gcd 0 x = x-gcd x y = 0 `mod` (y `mod` x)--gcd 0 x = x-gcd x y = 0 `mod` (y `mod` y)--gcd 0 x = x-gcd x y = 0 `mod` (y `mod` 0)--gcd 0 x = x-gcd x y = 0 `mod` (0 `mod` x)--gcd 0 x = x-gcd x y = 0 `mod` (0 `mod` y)--gcd 0 x = 0-gcd x y = (x `mod` x) `mod` x--gcd 0 x = 0-gcd x y = (x `mod` x) `mod` y--gcd 0 x = 0-gcd x y = (x `mod` x) `mod` 0--gcd 0 x = 0-gcd x y = (x `mod` y) `mod` x--gcd 0 x = 0-gcd x y = (x `mod` y) `mod` y--gcd 0 x = 0-gcd x y = (x `mod` y) `mod` 0--gcd 0 x = 0-gcd x y = (x `mod` 0) `mod` x--gcd 0 x = 0-gcd x y = (x `mod` 0) `mod` y--gcd 0 x = 0-gcd x y = (x `mod` 0) `mod` 0--gcd 0 x = 0-gcd x y = (y `mod` x) `mod` x--gcd 0 x = 0-gcd x y = (y `mod` x) `mod` y--gcd 0 x = 0-gcd x y = (y `mod` x) `mod` 0--gcd 0 x = 0-gcd x y = (y `mod` y) `mod` x--gcd 0 x = 0-gcd x y = (y `mod` y) `mod` y--gcd 0 x = 0-gcd x y = (y `mod` y) `mod` 0--gcd 0 x = 0-gcd x y = (y `mod` 0) `mod` x--gcd 0 x = 0-gcd x y = (y `mod` 0) `mod` y--gcd 0 x = 0-gcd x y = (y `mod` 0) `mod` 0--gcd 0 x = 0-gcd x y = (0 `mod` x) `mod` x--gcd 0 x = 0-gcd x y = (0 `mod` x) `mod` y--gcd 0 x = 0-gcd x y = (0 `mod` x) `mod` 0--gcd 0 x = 0-gcd x y = (0 `mod` y) `mod` x--gcd 0 x = 0-gcd x y = (0 `mod` y) `mod` y--gcd 0 x = 0-gcd x y = (0 `mod` y) `mod` 0--gcd 0 x = 0-gcd x y = x `mod` (x `mod` x)--gcd 0 x = 0-gcd x y = x `mod` (x `mod` y)--gcd 0 x = 0-gcd x y = x `mod` (x `mod` 0)--gcd 0 x = 0-gcd x y = x `mod` (y `mod` x)--gcd 0 x = 0-gcd x y = x `mod` (y `mod` y)--gcd 0 x = 0-gcd x y = x `mod` (y `mod` 0)--gcd 0 x = 0-gcd x y = x `mod` (0 `mod` x)--gcd 0 x = 0-gcd x y = x `mod` (0 `mod` y)--gcd 0 x = 0-gcd x y = y `mod` (x `mod` x)--gcd 0 x = 0-gcd x y = y `mod` (x `mod` y)--gcd 0 x = 0-gcd x y = y `mod` (x `mod` 0)--gcd 0 x = 0-gcd x y = y `mod` (y `mod` x)--gcd 0 x = 0-gcd x y = y `mod` (y `mod` y)--gcd 0 x = 0-gcd x y = y `mod` (y `mod` 0)--gcd 0 x = 0-gcd x y = y `mod` (0 `mod` x)--gcd 0 x = 0-gcd x y = y `mod` (0 `mod` y)--gcd 0 x = 0-gcd x y = 0 `mod` (x `mod` x)--gcd 0 x = 0-gcd x y = 0 `mod` (x `mod` y)--gcd 0 x = 0-gcd x y = 0 `mod` (x `mod` 0)--gcd 0 x = 0-gcd x y = 0 `mod` (y `mod` x)--gcd 0 x = 0-gcd x y = 0 `mod` (y `mod` y)--gcd 0 x = 0-gcd x y = 0 `mod` (y `mod` 0)--gcd 0 x = 0-gcd x y = 0 `mod` (0 `mod` x)--gcd 0 x = 0-gcd x y = 0 `mod` (0 `mod` y)--gcd 0 x = x `mod` x-gcd x y = x `mod` x--gcd 0 x = x `mod` x-gcd x y = x `mod` y--gcd 0 x = x `mod` x-gcd x y = x `mod` 0--gcd 0 x = x `mod` x-gcd x y = y `mod` x--gcd 0 x = x `mod` x-gcd x y = y `mod` 0--gcd 0 x = x `mod` x-gcd x y = 0 `mod` x--gcd 0 x = x `mod` x-gcd x y = 0 `mod` y--gcd 0 x = x `mod` 0-gcd x y = x `mod` x--gcd 0 x = x `mod` 0-gcd x y = x `mod` y--gcd 0 x = x `mod` 0-gcd x y = x `mod` 0--gcd 0 x = x `mod` 0-gcd x y = y `mod` y--gcd 0 x = x `mod` 0-gcd x y = 0 `mod` x--gcd 0 x = x `mod` 0-gcd x y = 0 `mod` y--gcd 0 x = 0 `mod` x-gcd x y = x `mod` x--gcd 0 x = 0 `mod` x-gcd x y = x `mod` 0--gcd 0 x = 0 `mod` x-gcd x y = y `mod` x--gcd 0 x = 0 `mod` x-gcd x y = y `mod` y--gcd 0 x = 0 `mod` x-gcd x y = y `mod` 0--gcd 0 x = 0 `mod` x-gcd x y = 0 `mod` x--gcd 0 x = (x `mod` x) `mod` x-gcd x y = x--gcd 0 x = (x `mod` x) `mod` x-gcd x y = y--gcd 0 x = (x `mod` x) `mod` x-gcd x y = 0--gcd 0 x = (x `mod` x) `mod` 0-gcd x y = x--gcd 0 x = (x `mod` x) `mod` 0-gcd x y = y--gcd 0 x = (x `mod` x) `mod` 0-gcd x y = 0--gcd 0 x = (x `mod` 0) `mod` x-gcd x y = x--gcd 0 x = (x `mod` 0) `mod` x-gcd x y = y--gcd 0 x = (x `mod` 0) `mod` x-gcd x y = 0--gcd 0 x = (x `mod` 0) `mod` 0-gcd x y = x--gcd 0 x = (x `mod` 0) `mod` 0-gcd x y = y--gcd 0 x = (x `mod` 0) `mod` 0-gcd x y = 0--gcd 0 x = (0 `mod` x) `mod` x-gcd x y = x--gcd 0 x = (0 `mod` x) `mod` x-gcd x y = y--gcd 0 x = (0 `mod` x) `mod` x-gcd x y = 0--gcd 0 x = (0 `mod` x) `mod` 0-gcd x y = x--gcd 0 x = (0 `mod` x) `mod` 0-gcd x y = y--gcd 0 x = (0 `mod` x) `mod` 0-gcd x y = 0--gcd 0 x = x `mod` (x `mod` x)-gcd x y = x--gcd 0 x = x `mod` (x `mod` x)-gcd x y = y--gcd 0 x = x `mod` (x `mod` x)-gcd x y = 0--gcd 0 x = x `mod` (x `mod` 0)-gcd x y = x--gcd 0 x = x `mod` (x `mod` 0)-gcd x y = y--gcd 0 x = x `mod` (x `mod` 0)-gcd x y = 0--gcd 0 x = x `mod` (0 `mod` x)-gcd x y = x--gcd 0 x = x `mod` (0 `mod` x)-gcd x y = y--gcd 0 x = x `mod` (0 `mod` x)-gcd x y = 0--gcd 0 x = 0 `mod` (x `mod` x)-gcd x y = x--gcd 0 x = 0 `mod` (x `mod` x)-gcd x y = y--gcd 0 x = 0 `mod` (x `mod` x)-gcd x y = 0--gcd 0 x = 0 `mod` (x `mod` 0)-gcd x y = x--gcd 0 x = 0 `mod` (x `mod` 0)-gcd x y = y--gcd 0 x = 0 `mod` (x `mod` 0)-gcd x y = 0--gcd 0 x = 0 `mod` (0 `mod` x)-gcd x y = x--gcd 0 x = 0 `mod` (0 `mod` x)-gcd x y = y--gcd 0 x = 0 `mod` (0 `mod` x)-gcd x y = 0+foo x = x + (x + x)++foo x = x + (x + 1)++foo x = x + (1 + 1)++foo x = x + x * x++foo x = x + (x - 1)++foo x = x + (0 - 1)++foo x = 1 + (x + x)++foo x = 1 + (x + 1)++foo x = 1 + (1 + 1)++foo x = 1 + x * x++foo x = 1 + (0 - x)++foo x = 1 + (1 - x)++foo x = x * (x + x)++foo x = x * (x * x)++foo x = x * (x - 1)++foo x = x * (0 - x)++foo x = x * (0 - 1)++foo x = x * (1 - x)++foo x = x - (x + x)++foo x = x - (x + 1)++foo x = x - (1 + 1)++foo x = x - x * x++foo x = 0 - (x + x)++foo x = 0 - (x + 1)++foo x = 0 - (1 + 1)++foo x = 1 - (x + x)++foo x = 1 - (x + 1)++foo x = 1 - (1 + 1)++foo x = 1 - x * x++foo x = x * x - 1+++pattern candidates:++foo x = x++foo x = 0++foo x = 1++foo 0 = 0+foo x = 1++foo 0 = 1+foo x = x++foo 0 = 1+foo x = 0++foo x = x + x++foo x = x + 1++foo x = x * x++foo x = x - 1++foo x = 0 - x++foo x = 1 - x++foo 1 = 0+foo x = x++foo 1 = 0+foo x = 1++foo 1 = 1+foo x = 0++foo 0 = 0+foo x = x + 1++foo 0 = 0+foo x = x - 1++foo 0 = 0+foo x = 1 - x++foo 0 = 1+foo x = x + x++foo 0 = 1+foo x = x * x++foo 0 = 1+foo x = x - 1++foo 0 = 1+foo x = 0 - x++foo 0 = 0+foo 1 = 0+foo x = 1++foo 0 = 1+foo 1 = 0+foo x = x++foo 0 = 1+foo 1 = 1+foo x = 0++foo x = x + (x + x)++foo x = x + (x + 1)++foo x = x + x * x++foo x = x + (x - 1)++foo x = 1 + (x + x)++foo x = 1 + (x + 1)++foo x = 1 + x * x++foo x = 1 + (0 - x)++foo x = 1 + (1 - x)++foo x = x * (x + x)++foo x = x * (x * x)++foo x = x * (x - 1)++foo x = x * (0 - x)++foo x = x * (1 - x)++foo x = x - (x + x)++foo x = x - (x + 1)++foo x = x - x * x++foo x = 0 - (x + x)++foo x = 0 - (x + 1)++foo x = 1 - (x + x)++foo x = 1 - (x + 1)++foo x = 1 - x * x++foo x = x * x - 1++foo 1 = 0+foo x = x + x++foo 1 = 0+foo x = x + 1++foo 1 = 0+foo x = x * x++foo 1 = 0+foo x = 0 - x++foo 1 = 1+foo x = x + x++foo 1 = 1+foo x = x + 1++foo 1 = 1+foo x = x - 1++foo 1 = 1+foo x = 0 - x++foo 1 = 1+foo x = 1 - x++foo 0 = 0+foo x = x + (x + 1)++foo 0 = 0+foo x = x + (x - 1)++foo 0 = 0+foo x = 1 + (x + x)++foo 0 = 0+foo x = 1 + (x + 1)++foo 0 = 0+foo x = 1 + x * x++foo 0 = 0+foo x = 1 + (0 - x)++foo 0 = 0+foo x = 1 + (1 - x)++foo 0 = 0+foo x = x - (x + 1)++foo 0 = 0+foo x = 0 - (x + 1)++foo 0 = 0+foo x = 1 - (x + x)++foo 0 = 0+foo x = 1 - x * x++foo 0 = 0+foo x = x * x - 1++foo 0 = 1+foo x = x + (x + x)++foo 0 = 1+foo x = x + x * x++foo 0 = 1+foo x = x + (x - 1)++foo 0 = 1+foo x = 1 + (x + 1)++foo 0 = 1+foo x = 1 + (1 - x)++foo 0 = 1+foo x = x * (x + x)++foo 0 = 1+foo x = x * (x * x)++foo 0 = 1+foo x = x * (x - 1)++foo 0 = 1+foo x = x * (0 - x)++foo 0 = 1+foo x = x * (1 - x)++foo 0 = 1+foo x = x - (x + x)++foo 0 = 1+foo x = x - (x + 1)++foo 0 = 1+foo x = x - x * x++foo 0 = 1+foo x = 0 - (x + x)++foo 0 = 1+foo x = 0 - (x + 1)++foo 0 = 1+foo x = 1 - (x + 1)++foo 0 = 1+foo x = x * x - 1++foo 0 = 0+foo 1 = 0+foo x = x + 1++foo 0 = 0+foo 1 = 1+foo x = x + 1++foo 0 = 0+foo 1 = 1+foo x = x - 1++foo 0 = 0+foo 1 = 1+foo x = 1 - x++foo 0 = 1+foo 1 = 0+foo x = x + x++foo 0 = 1+foo 1 = 0+foo x = x * x++foo 0 = 1+foo 1 = 0+foo x = 0 - x++foo 0 = 1+foo 1 = 1+foo x = x + x++foo 0 = 1+foo 1 = 1+foo x = x - 1++foo 0 = 1+foo 1 = 1+foo x = 0 - x++++allowed patterns:++foo x = _+++foo 0 = _+foo x = _+++foo 1 = _+foo x = _+++foo 0 = _+foo 1 = _+foo x = _+++++allowed deconstructions:++_ - 1 :: Int++Candidates for: ? :: Int -> Int -> Int+ pruning with 13/34 rules+ [3,3,9,18,60,162,489,1475,4619] direct candidates, 0 duplicates+ [3,8,25,71,205,632,1957,5906,18303] pattern candidates, 0 duplicates++rules:+x * 0 == 0+0 * x == 0+x + 0 == x+0 + x == x+dec (x + y) == x + dec y+dec (x + y) == y + dec x+dec (x + y) == dec x + y+dec (x + y) == dec y + x+(x * y) * z == x * (y * z)+(x * y) * z == y * (x * z)+(x + y) + z == x + (y + z)+(x + y) + z == y + (x + z)+(x + x) * y == x * (y + y)+equations:+y * x == x * y+y + x == x + y+y + dec x == x + dec y+dec x + y == x + dec y+dec y + x == dec x + y+x + dec 0 == dec x+dec 0 + x == dec x+y * (x * z) == x * (y * z)+z * (x * y) == x * (y * z)+z * (y * x) == x * (y * z)+y + (x + z) == x + (y + z)+z + (x + y) == x + (y + z)+z + (y + x) == x + (y + z)+(z + y) * x == x * (y + z)+z * y + x == x + y * z+y * (x + x) == x * (y + y)+y + dec (dec x) == x + dec (dec y)+dec (dec x) + y == x + dec (dec y)+dec (dec y) + x == dec (dec x) + y+x + dec (dec 0) == dec (dec x)+dec (dec 0) + x == dec (dec x)++direct candidates:++x ? y = x++x ? y = y++x ? y = 0++x ? y = dec x++x ? y = dec y++x ? y = dec 0++x ? y = dec (dec x)++x ? y = dec (dec y)++x ? y = dec (dec 0)++x ? y = x + x++x ? y = x + y++x ? y = y + y++x ? y = x * x++x ? y = x * y++x ? y = y * y++x ? y = dec (dec (dec x))++x ? y = dec (dec (dec y))++x ? y = dec (dec (dec 0))++x ? y = dec (x * x)++x ? y = dec (x * y)++x ? y = dec (y * y)++x ? y = x + dec x++x ? y = x + dec y++x ? y = x + dec 0++x ? y = y + dec x++x ? y = y + dec y++x ? y = y + dec 0++x ? y = x * dec x++x ? y = x * dec y++x ? y = x * dec 0++x ? y = y * dec x++x ? y = y * dec y++x ? y = y * dec 0++x ? y = dec (dec (dec (dec x)))++x ? y = dec (dec (dec (dec y)))++x ? y = dec (dec (dec (dec 0)))++x ? y = dec (dec (x * x))++x ? y = dec (dec (x * y))++x ? y = dec (dec (y * y))++x ? y = dec (x * dec x)++x ? y = dec (x * dec y)++x ? y = dec (x * dec 0)++x ? y = dec (y * dec x)++x ? y = dec (y * dec y)++x ? y = dec (y * dec 0)++x ? y = x + dec (dec x)++x ? y = x + dec (dec y)++x ? y = x + dec (dec 0)++x ? y = x + (x + x)++x ? y = x + (x + y)++x ? y = x + (y + y)++x ? y = x + x * x++x ? y = x + x * y++x ? y = x + y * y++x ? y = y + dec (dec x)++x ? y = y + dec (dec y)++x ? y = y + dec (dec 0)++x ? y = y + (x + x)++x ? y = y + (x + y)++x ? y = y + (y + y)++x ? y = y + x * x++x ? y = y + x * y++x ? y = y + y * y++x ? y = x * dec (dec x)++x ? y = x * dec (dec y)++x ? y = x * dec (dec 0)++x ? y = x * (x + x)++x ? y = x * (x + y)++x ? y = x * (y + y)++x ? y = x * (x * x)++x ? y = x * (x * y)++x ? y = x * (y * y)++x ? y = y * dec (dec x)++x ? y = y * dec (dec y)++x ? y = y * dec (dec 0)++x ? y = y * (x + x)++x ? y = y * (x + y)++x ? y = y * (y + y)++x ? y = y * (x * x)++x ? y = y * (x * y)++x ? y = y * (y * y)++x ? y = dec x + dec x++x ? y = dec x + dec y++x ? y = dec x + dec 0++x ? y = dec y + dec y++x ? y = dec y + dec 0++x ? y = dec 0 + dec 0++x ? y = dec x * dec x++x ? y = dec x * dec y++x ? y = dec x * dec 0++x ? y = dec y * dec y++x ? y = dec y * dec 0++x ? y = dec 0 * dec 0+++pattern candidates:++x ? y = x++x ? y = y++x ? y = 0++x ? y = dec x++x ? y = dec y++x ? 0 = x+x ? y = y++x ? 0 = x+x ? y = 0++x ? 0 = 0+x ? y = x++0 ? x = x+x ? y = x++0 ? x = x+x ? y = 0++0 ? x = 0+x ? y = y++x ? y = dec (dec x)++x ? y = dec (dec y)++x ? y = x + x++x ? y = x + y++x ? y = y + y++x ? y = x * x++x ? y = x * y++x ? y = y * y++x ? 0 = x+x ? y = dec x++x ? 0 = x+x ? y = dec y++x ? 0 = 0+x ? y = dec x++x ? 0 = 0+x ? y = dec y++x ? 0 = dec x+x ? y = x++x ? 0 = dec x+x ? y = y++x ? 0 = dec x+x ? y = 0++0 ? x = x+x ? y = dec x++0 ? x = x+x ? y = dec y++0 ? x = 0+x ? y = dec x++0 ? x = 0+x ? y = dec y++0 ? x = dec x+x ? y = x++0 ? x = dec x+x ? y = y++0 ? x = dec x+x ? y = 0++0 ? x = x+x ? 0 = x+x ? y = 0++0 ? x = x+x ? 0 = 0+x ? y = x++0 ? x = 0+x ? 0 = x+x ? y = y++x ? y = dec (dec (dec x))++x ? y = dec (dec (dec y))++x ? y = dec (x * x)++x ? y = dec (x * y)++x ? y = dec (y * y)++x ? y = x + dec x++x ? y = x + dec y++x ? y = y + dec x++x ? y = y + dec y++x ? y = x * dec x++x ? y = x * dec y++x ? y = y * dec x++x ? y = y * dec y++x ? 0 = x+x ? y = dec (dec x)++x ? 0 = x+x ? y = dec (dec y)++x ? 0 = x+x ? y = x + x++x ? 0 = x+x ? y = y + y++x ? 0 = x+x ? y = x * x++x ? 0 = x+x ? y = x * y++x ? 0 = x+x ? y = y * y++x ? 0 = 0+x ? y = dec (dec x)++x ? 0 = 0+x ? y = dec (dec y)++x ? 0 = 0+x ? y = x + x++x ? 0 = 0+x ? y = x + y++x ? 0 = 0+x ? y = x * x++x ? 0 = dec x+x ? y = dec y++x ? 0 = dec (dec x)+x ? y = x++x ? 0 = dec (dec x)+x ? y = y++x ? 0 = dec (dec x)+x ? y = 0++x ? 0 = x + x+x ? y = x++x ? 0 = x + x+x ? y = y++x ? 0 = x + x+x ? y = 0++x ? 0 = x * x+x ? y = x++x ? 0 = x * x+x ? y = y++x ? 0 = x * x+x ? y = 0++0 ? x = x+x ? y = dec (dec x)++0 ? x = x+x ? y = dec (dec y)++0 ? x = x+x ? y = x + x++0 ? x = x+x ? y = y + y++0 ? x = x+x ? y = x * x++0 ? x = x+x ? y = x * y++0 ? x = x+x ? y = y * y++0 ? x = 0+x ? y = dec (dec x)++0 ? x = 0+x ? y = dec (dec y)++0 ? x = 0+x ? y = x + y++0 ? x = 0+x ? y = y + y++0 ? x = 0+x ? y = y * y++0 ? x = dec x+x ? y = dec x++0 ? x = dec (dec x)+x ? y = x++0 ? x = dec (dec x)+x ? y = y++0 ? x = dec (dec x)+x ? y = 0++0 ? x = x + x+x ? y = x++0 ? x = x + x+x ? y = y++0 ? x = x + x+x ? y = 0++0 ? x = x * x+x ? y = x++0 ? x = x * x+x ? y = y++0 ? x = x * x+x ? y = 0++0 ? x = x+x ? 0 = x+x ? y = dec x++0 ? x = x+x ? 0 = x+x ? y = dec y++0 ? x = x+x ? 0 = 0+x ? y = dec x++0 ? x = x+x ? 0 = 0+x ? y = dec y++0 ? x = x+x ? 0 = dec x+x ? y = x++0 ? x = x+x ? 0 = dec x+x ? y = 0++0 ? x = 0+x ? 0 = x+x ? y = dec x++0 ? x = 0+x ? 0 = x+x ? y = dec y++0 ? x = 0+x ? 0 = 0+x ? y = dec x++0 ? x = 0+x ? 0 = 0+x ? y = dec y++0 ? x = 0+x ? 0 = dec x+x ? y = y++0 ? x = dec x+x ? 0 = x+x ? y = y++0 ? x = dec x+x ? 0 = x+x ? y = 0++0 ? x = dec x+x ? 0 = 0+x ? y = x++x ? y = dec (dec (dec (dec x)))++x ? y = dec (dec (dec (dec y)))++x ? y = dec (dec (x * x))++x ? y = dec (dec (x * y))++x ? y = dec (dec (y * y))++x ? y = dec (x * dec x)++x ? y = dec (x * dec y)++x ? y = dec (y * dec x)++x ? y = dec (y * dec y)++x ? y = x + dec (dec x)++x ? y = x + dec (dec y)++x ? y = x + (x + x)++x ? y = x + (x + y)++x ? y = x + (y + y)++x ? y = x + x * x++x ? y = x + x * y++x ? y = x + y * y++x ? y = y + dec (dec x)++x ? y = y + dec (dec y)++x ? y = y + (x + x)++x ? y = y + (x + y)++x ? y = y + (y + y)++x ? y = y + x * x++x ? y = y + x * y++x ? y = y + y * y++x ? y = x * dec (dec x)++x ? y = x * dec (dec y)++x ? y = x * (x + x)++x ? y = x * (x + y)++x ? y = x * (y + y)++x ? y = x * (x * x)++x ? y = x * (x * y)++x ? y = x * (y * y)++x ? y = y * dec (dec x)++x ? y = y * dec (dec y)++x ? y = y * (x + x)++x ? y = y * (x + y)++x ? y = y * (y + y)++x ? y = y * (x * x)++x ? y = y * (x * y)++x ? y = y * (y * y)++x ? y = dec x + dec x++x ? y = dec x + dec y++x ? y = dec y + dec y++x ? y = dec x * dec x++x ? y = dec x * dec y++x ? y = dec y * dec y++x ? 0 = x+x ? y = dec (dec (dec x))++x ? 0 = x+x ? y = dec (dec (dec y))++x ? 0 = x+x ? y = dec (x * x)++x ? 0 = x+x ? y = dec (x * y)++x ? 0 = x+x ? y = dec (y * y)++x ? 0 = x+x ? y = x + dec x++x ? 0 = x+x ? y = x + dec y++x ? 0 = x+x ? y = y + dec x++x ? 0 = x+x ? y = y + dec y++x ? 0 = x+x ? y = x * dec x++x ? 0 = x+x ? y = x * dec y++x ? 0 = x+x ? y = y * dec x++x ? 0 = x+x ? y = y * dec y++x ? 0 = 0+x ? y = dec (dec (dec x))++x ? 0 = 0+x ? y = dec (dec (dec y))++x ? 0 = 0+x ? y = dec (x * x)++x ? 0 = 0+x ? y = dec (x * y)++x ? 0 = 0+x ? y = dec (y * y)++x ? 0 = 0+x ? y = x + dec x++x ? 0 = 0+x ? y = x + dec y++x ? 0 = 0+x ? y = y + dec x++x ? 0 = 0+x ? y = y + dec y++x ? 0 = 0+x ? y = x * dec x++x ? 0 = 0+x ? y = x * dec y++x ? 0 = dec x+x ? y = dec (dec x)++x ? 0 = dec x+x ? y = dec (dec y)++x ? 0 = dec x+x ? y = x + x++x ? 0 = dec x+x ? y = x + y++x ? 0 = dec x+x ? y = y + y++x ? 0 = dec x+x ? y = x * x++x ? 0 = dec x+x ? y = x * y++x ? 0 = dec x+x ? y = y * y++x ? 0 = dec (dec x)+x ? y = dec x++x ? 0 = dec (dec x)+x ? y = dec y++x ? 0 = x + x+x ? y = dec x++x ? 0 = x + x+x ? y = dec y++x ? 0 = x * x+x ? y = dec x++x ? 0 = x * x+x ? y = dec y++x ? 0 = dec (dec (dec x))+x ? y = x++x ? 0 = dec (dec (dec x))+x ? y = y++x ? 0 = dec (dec (dec x))+x ? y = 0++x ? 0 = dec (x * x)+x ? y = x++x ? 0 = dec (x * x)+x ? y = y++x ? 0 = dec (x * x)+x ? y = 0++x ? 0 = x + dec x+x ? y = x++x ? 0 = x + dec x+x ? y = y++x ? 0 = x + dec x+x ? y = 0++x ? 0 = x * dec x+x ? y = x++x ? 0 = x * dec x+x ? y = y++x ? 0 = x * dec x+x ? y = 0++0 ? x = x+x ? y = dec (dec (dec x))++0 ? x = x+x ? y = dec (dec (dec y))++0 ? x = x+x ? y = dec (x * x)++0 ? x = x+x ? y = dec (x * y)++0 ? x = x+x ? y = dec (y * y)++0 ? x = x+x ? y = x + dec x++0 ? x = x+x ? y = x + dec y++0 ? x = x+x ? y = y + dec x++0 ? x = x+x ? y = y + dec y++0 ? x = x+x ? y = x * dec x++0 ? x = x+x ? y = x * dec y++0 ? x = x+x ? y = y * dec x++0 ? x = x+x ? y = y * dec y++0 ? x = 0+x ? y = dec (dec (dec x))++0 ? x = 0+x ? y = dec (dec (dec y))++0 ? x = 0+x ? y = dec (x * x)++0 ? x = 0+x ? y = dec (x * y)++0 ? x = 0+x ? y = dec (y * y)++0 ? x = 0+x ? y = x + dec x++0 ? x = 0+x ? y = x + dec y++0 ? x = 0+x ? y = y + dec x++0 ? x = 0+x ? y = y + dec y++0 ? x = 0+x ? y = y * dec x++0 ? x = 0+x ? y = y * dec y++0 ? x = dec x+x ? y = dec (dec x)++0 ? x = dec x+x ? y = dec (dec y)++0 ? x = dec x+x ? y = x + x++0 ? x = dec x+x ? y = x + y++0 ? x = dec x+x ? y = y + y++0 ? x = dec x+x ? y = x * x++0 ? x = dec x+x ? y = x * y++0 ? x = dec x+x ? y = y * y++0 ? x = dec (dec x)+x ? y = dec x++0 ? x = dec (dec x)+x ? y = dec y++0 ? x = x + x+x ? y = dec x++0 ? x = x + x+x ? y = dec y++0 ? x = x * x+x ? y = dec x++0 ? x = x * x+x ? y = dec y++0 ? x = dec (dec (dec x))+x ? y = x++0 ? x = dec (dec (dec x))+x ? y = y++0 ? x = dec (dec (dec x))+x ? y = 0++0 ? x = dec (x * x)+x ? y = x++0 ? x = dec (x * x)+x ? y = y++0 ? x = dec (x * x)+x ? y = 0++0 ? x = x + dec x+x ? y = x++0 ? x = x + dec x+x ? y = y++0 ? x = x + dec x+x ? y = 0++0 ? x = x * dec x+x ? y = x++0 ? x = x * dec x+x ? y = y++0 ? x = x * dec x+x ? y = 0++0 ? x = x+x ? 0 = x+x ? y = dec (dec x)++0 ? x = x+x ? 0 = x+x ? y = dec (dec y)++0 ? x = x+x ? 0 = x+x ? y = x + x++0 ? x = x+x ? 0 = x+x ? y = y + y++0 ? x = x+x ? 0 = x+x ? y = x * x++0 ? x = x+x ? 0 = x+x ? y = x * y++0 ? x = x+x ? 0 = x+x ? y = y * y++0 ? x = x+x ? 0 = 0+x ? y = dec (dec x)++0 ? x = x+x ? 0 = 0+x ? y = dec (dec y)++0 ? x = x+x ? 0 = 0+x ? y = x + x++0 ? x = x+x ? 0 = 0+x ? y = x * x++0 ? x = x+x ? 0 = dec x+x ? y = dec y++0 ? x = x+x ? 0 = dec (dec x)+x ? y = x++0 ? x = x+x ? 0 = dec (dec x)+x ? y = 0++0 ? x = x+x ? 0 = x + x+x ? y = x++0 ? x = x+x ? 0 = x + x+x ? y = 0++0 ? x = x+x ? 0 = x * x+x ? y = x++0 ? x = x+x ? 0 = x * x+x ? y = 0++0 ? x = 0+x ? 0 = x+x ? y = dec (dec x)++0 ? x = 0+x ? 0 = x+x ? y = dec (dec y)++0 ? x = 0+x ? 0 = x+x ? y = y + y++0 ? x = 0+x ? 0 = x+x ? y = y * y++0 ? x = 0+x ? 0 = 0+x ? y = dec (dec x)++0 ? x = 0+x ? 0 = 0+x ? y = dec (dec y)++0 ? x = 0+x ? 0 = 0+x ? y = x + y++0 ? x = 0+x ? 0 = dec x+x ? y = dec y++0 ? x = 0+x ? 0 = dec (dec x)+x ? y = y++0 ? x = 0+x ? 0 = x + x+x ? y = y++0 ? x = 0+x ? 0 = x * x+x ? y = y++0 ? x = dec x+x ? 0 = x+x ? y = dec x++0 ? x = dec x+x ? 0 = 0+x ? y = dec x++0 ? x = dec x+x ? 0 = dec x+x ? y = x++0 ? x = dec x+x ? 0 = dec x+x ? y = y++0 ? x = dec x+x ? 0 = dec x+x ? y = 0++0 ? x = dec (dec x)+x ? 0 = x+x ? y = y++0 ? x = dec (dec x)+x ? 0 = x+x ? y = 0++0 ? x = dec (dec x)+x ? 0 = 0+x ? y = x++0 ? x = x + x+x ? 0 = x+x ? y = y++0 ? x = x + x+x ? 0 = x+x ? y = 0++0 ? x = x + x+x ? 0 = 0+x ? y = x++0 ? x = x * x+x ? 0 = x+x ? y = y++0 ? x = x * x+x ? 0 = x+x ? y = 0++0 ? x = x * x+x ? 0 = 0+x ? y = x++0 ? 0 = 0+0 ? x = dec x+x ? y = dec x++x ? 0 = x+x ? y = x ? dec y++x ? 0 = x+x ? y = y ? dec x++x ? 0 = x+x ? y = y ? dec y++x ? 0 = x+x ? y = 0 ? dec y++x ? 0 = x+x ? y = dec x ? x++x ? 0 = x+x ? y = dec x ? y++x ? 0 = x+x ? y = dec y ? x++0 ? x = x+x ? y = x ? dec y++0 ? x = x+x ? y = y ? dec x++0 ? x = x+x ? y = y ? dec y++0 ? x = x+x ? y = dec x ? x++0 ? x = x+x ? y = dec x ? y++0 ? x = x+x ? y = dec x ? 0++0 ? x = x+x ? y = dec y ? x++++allowed patterns:++x ? y = _+++x ? 0 = _+x ? y = _++0 ? x = _+x ? y = _+++0 ? x = _+x ? 0 = _+x ? y = _++0 ? 0 = _+0 ? x = _+x ? y = _+++0 ? 0 = _+0 ? x = _+x ? 0 = _+x ? y = _+++++allowed deconstructions:++dec _ :: Int+dec (dec _) :: Int+dec (dec (dec _)) :: Int++Candidates for: goo :: [Int] -> [Int]+ pruning with 4/4 rules+ [2,0,1,0,1,0,1,0,1] direct candidates, 0 duplicates+ [2,1,1,3,4,7,10,17,26] pattern candidates, 0 duplicates++rules:+xs ++ [] == xs+[] ++ xs == xs+(xs ++ ys) ++ zs == xs ++ (ys ++ zs)+(x:xs) ++ ys == x:(xs ++ ys)++direct candidates:++goo xs = xs++goo xs = []++goo xs = xs ++ xs++goo xs = xs ++ (xs ++ xs)+++pattern candidates:++goo xs = xs++goo xs = []++goo [] = []+goo (x:xs) = xs++goo xs = xs ++ xs++goo [] = []+goo (x:xs) = x:xs++goo [] = []+goo (x:xs) = [x]++goo [] = []+goo (x:xs) = xs ++ xs++goo xs = xs ++ (xs ++ xs)++goo [] = []+goo (x:xs) = x:goo xs++goo [] = []+goo (x:xs) = xs ++ goo xs++goo [] = []+goo (x:xs) = goo xs ++ xs++goo [] = []+goo (x:xs) = x:x:xs++goo [] = []+goo (x:xs) = [x,x]++goo [] = []+goo (x:xs) = x:(xs ++ xs)++goo [] = []+goo (x:xs) = xs ++ (x:xs)++goo [] = []+goo (x:xs) = xs ++ [x]++goo [] = []+goo (x:xs) = xs ++ (xs ++ xs)++goo [] = []+goo (x:xs) = goo xs ++ goo xs++++allowed patterns:++goo xs = _+++goo [] = _+goo (x:xs) = _+++++allowed deconstructions:+++Candidates for: ?? :: [Int] -> [Int] -> [Int]+ pruning with 4/4 rules+ [3,0,4,0,8,0,16,0,32] direct candidates, 0 duplicates+ [3,8,15,45,127,268,845,1565,5692] pattern candidates, 0 duplicates++rules:+xs ++ [] == xs+[] ++ xs == xs+(xs ++ ys) ++ zs == xs ++ (ys ++ zs)+(x:xs) ++ ys == x:(xs ++ ys)++direct candidates:++xs ?? ys = xs++xs ?? ys = ys++xs ?? ys = []++xs ?? ys = xs ++ xs++xs ?? ys = xs ++ ys++xs ?? ys = ys ++ xs++xs ?? ys = ys ++ ys++xs ?? ys = xs ++ (xs ++ xs)++xs ?? ys = xs ++ (xs ++ ys)++xs ?? ys = xs ++ (ys ++ xs)++xs ?? ys = xs ++ (ys ++ ys)++xs ?? ys = ys ++ (xs ++ xs)++xs ?? ys = ys ++ (xs ++ ys)++xs ?? ys = ys ++ (ys ++ xs)++xs ?? ys = ys ++ (ys ++ ys)+++pattern candidates:++xs ?? ys = xs++xs ?? ys = ys++xs ?? ys = []++xs ?? [] = xs+xs ?? (x:ys) = ys++xs ?? [] = xs+xs ?? (x:ys) = []++xs ?? [] = []+xs ?? (x:ys) = xs++xs ?? [] = []+xs ?? (x:ys) = ys++[] ?? xs = xs+(x:xs) ?? ys = xs++[] ?? xs = xs+(x:xs) ?? ys = []++[] ?? xs = []+(x:xs) ?? ys = xs++[] ?? xs = []+(x:xs) ?? ys = ys++xs ?? ys = xs ++ xs++xs ?? ys = xs ++ ys++xs ?? ys = ys ++ xs++xs ?? ys = ys ++ ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = []++xs ?? [] = xs+xs ?? (x:ys) = x:xs++xs ?? [] = xs+xs ?? (x:ys) = x:ys++xs ?? [] = xs+xs ?? (x:ys) = [x]++xs ?? [] = xs+xs ?? (x:ys) = xs ++ xs++xs ?? [] = xs+xs ?? (x:ys) = xs ++ ys++xs ?? [] = xs+xs ?? (x:ys) = ys ++ xs++xs ?? [] = xs+xs ?? (x:ys) = ys ++ ys++xs ?? [] = []+xs ?? (x:ys) = x:xs++xs ?? [] = []+xs ?? (x:ys) = x:ys++xs ?? [] = []+xs ?? (x:ys) = [x]++xs ?? [] = []+xs ?? (x:ys) = xs ++ xs++xs ?? [] = []+xs ?? (x:ys) = xs ++ ys++xs ?? [] = []+xs ?? (x:ys) = ys ++ xs++xs ?? [] = []+xs ?? (x:ys) = ys ++ ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = xs++xs ?? [] = xs ++ xs+xs ?? (x:ys) = ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = []++[] ?? xs = xs+(x:xs) ?? ys = x:xs++[] ?? xs = xs+(x:xs) ?? ys = x:ys++[] ?? xs = xs+(x:xs) ?? ys = [x]++[] ?? xs = xs+(x:xs) ?? ys = xs ++ xs++[] ?? xs = xs+(x:xs) ?? ys = xs ++ ys++[] ?? xs = xs+(x:xs) ?? ys = ys ++ xs++[] ?? xs = xs+(x:xs) ?? ys = ys ++ ys++[] ?? xs = []+(x:xs) ?? ys = x:xs++[] ?? xs = []+(x:xs) ?? ys = x:ys++[] ?? xs = []+(x:xs) ?? ys = [x]++[] ?? xs = []+(x:xs) ?? ys = xs ++ xs++[] ?? xs = []+(x:xs) ?? ys = xs ++ ys++[] ?? xs = []+(x:xs) ?? ys = ys ++ xs++[] ?? xs = []+(x:xs) ?? ys = ys ++ ys++[] ?? xs = xs ++ xs+(x:xs) ?? ys = xs++[] ?? xs = xs ++ xs+(x:xs) ?? ys = ys++[] ?? xs = xs ++ xs+(x:xs) ?? ys = []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++xs ?? [] = xs+xs ?? (x:ys) = xs ?? ys++xs ?? [] = xs+xs ?? (x:ys) = ys ?? xs++xs ?? [] = xs+xs ?? (x:ys) = ys ?? ys++xs ?? [] = xs+xs ?? (x:ys) = [] ?? xs++xs ?? [] = xs+xs ?? (x:ys) = [] ?? ys++[] ?? xs = xs+(x:xs) ?? ys = xs ?? xs++[] ?? xs = xs+(x:xs) ?? ys = xs ?? ys++[] ?? xs = xs+(x:xs) ?? ys = xs ?? []++[] ?? xs = xs+(x:xs) ?? ys = ys ?? xs++[] ?? xs = xs+(x:xs) ?? ys = ys ?? []++xs ?? ys = xs ++ (xs ++ xs)++xs ?? ys = xs ++ (xs ++ ys)++xs ?? ys = xs ++ (ys ++ xs)++xs ?? ys = xs ++ (ys ++ ys)++xs ?? ys = ys ++ (xs ++ xs)++xs ?? ys = ys ++ (xs ++ ys)++xs ?? ys = ys ++ (ys ++ xs)++xs ?? ys = ys ++ (ys ++ ys)++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = x:xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = x:ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [x]++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = y:xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = y:ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [y]++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ++ xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ++ ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ++ xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ++ ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = x:xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = x:ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = [x]++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = y:xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = y:ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = [y]++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ++ xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ++ ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ++ xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ++ ys++[] ?? xs = xs+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = []++[] ?? xs = xs+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = []++[] ?? xs = xs+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = []++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = x:xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = x:ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [x]++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = y:xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = y:ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [y]++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ++ xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ++ ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ++ xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ++ ys++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = x:xs++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = x:ys++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = [x]++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = y:xs++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = y:ys++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = [y]++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ++ xs++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ++ ys++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ++ xs++[] ?? xs = []+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ++ ys++[] ?? xs = []+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = []+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = []++[] ?? xs = []+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = ys++[] ?? xs = []+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = []++[] ?? xs = []+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = []+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = []++[] ?? xs = xs ++ xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs ++ xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? xs = xs ++ xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs ++ xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = x:xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = x:ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = [x]++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = xs ++ xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = xs ++ ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = ys ++ xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = ys ++ ys++[] ?? [] = []+[] ?? (x:xs) = x:xs+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = x:xs+(x:xs) ?? ys = ys++[] ?? [] = []+[] ?? (x:xs) = x:xs+(x:xs) ?? ys = []++[] ?? [] = []+[] ?? (x:xs) = [x]+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = [x]+(x:xs) ?? ys = ys++[] ?? [] = []+[] ?? (x:xs) = [x]+(x:xs) ?? ys = []++[] ?? [] = []+[] ?? (x:xs) = xs ++ xs+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = xs ++ xs+(x:xs) ?? ys = ys++[] ?? [] = []+[] ?? (x:xs) = xs ++ xs+(x:xs) ?? ys = []++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? []++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? ys++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? []++[] ?? xs = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = []++[] ?? xs = xs+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = []++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ?? xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ?? ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ?? []++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ?? ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ?? []++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? []++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? []++[] ?? xs = []+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = []+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = xs ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = xs ?? ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = xs ?? []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = ys ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = ys ?? []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = [] ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = [] ?? ys++[] ?? [] = []+[] ?? (x:xs) = xs ?? xs+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = xs ?? []+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = [] ?? xs+(x:xs) ?? ys = xs++[] ?? [] = []+[] ?? (x:xs) = xs ?? xs+(x:xs) ?? ys = ys++[] ?? [] = []+[] ?? (x:xs) = xs ?? []+(x:xs) ?? ys = ys++[] ?? [] = []+[] ?? (x:xs) = [] ?? xs+(x:xs) ?? ys = ys++xs ?? [] = xs+xs ?? (x:ys) = x:x:xs++xs ?? [] = xs+xs ?? (x:ys) = x:x:ys++xs ?? [] = xs+xs ?? (x:ys) = [x,x]++xs ?? [] = xs+xs ?? (x:ys) = x:(xs ++ xs)++xs ?? [] = xs+xs ?? (x:ys) = x:(xs ++ ys)++xs ?? [] = xs+xs ?? (x:ys) = x:(ys ++ xs)++xs ?? [] = xs+xs ?? (x:ys) = x:(ys ++ ys)++xs ?? [] = xs+xs ?? (x:ys) = xs ++ (x:xs)++xs ?? [] = xs+xs ?? (x:ys) = xs ++ (x:ys)++xs ?? [] = xs+xs ?? (x:ys) = xs ++ [x]++xs ?? [] = xs+xs ?? (x:ys) = xs ++ (xs ++ xs)++xs ?? [] = xs+xs ?? (x:ys) = xs ++ (xs ++ ys)++xs ?? [] = xs+xs ?? (x:ys) = xs ++ (ys ++ xs)++xs ?? [] = xs+xs ?? (x:ys) = xs ++ (ys ++ ys)++xs ?? [] = xs+xs ?? (x:ys) = ys ++ (x:xs)++xs ?? [] = xs+xs ?? (x:ys) = ys ++ (x:ys)++xs ?? [] = xs+xs ?? (x:ys) = ys ++ [x]++xs ?? [] = xs+xs ?? (x:ys) = ys ++ (xs ++ xs)++xs ?? [] = xs+xs ?? (x:ys) = ys ++ (xs ++ ys)++xs ?? [] = xs+xs ?? (x:ys) = ys ++ (ys ++ xs)++xs ?? [] = xs+xs ?? (x:ys) = ys ++ (ys ++ ys)++xs ?? [] = []+xs ?? (x:ys) = x:x:xs++xs ?? [] = []+xs ?? (x:ys) = x:x:ys++xs ?? [] = []+xs ?? (x:ys) = [x,x]++xs ?? [] = []+xs ?? (x:ys) = x:(xs ++ xs)++xs ?? [] = []+xs ?? (x:ys) = x:(xs ++ ys)++xs ?? [] = []+xs ?? (x:ys) = x:(ys ++ xs)++xs ?? [] = []+xs ?? (x:ys) = x:(ys ++ ys)++xs ?? [] = []+xs ?? (x:ys) = xs ++ (x:xs)++xs ?? [] = []+xs ?? (x:ys) = xs ++ (x:ys)++xs ?? [] = []+xs ?? (x:ys) = xs ++ [x]++xs ?? [] = []+xs ?? (x:ys) = xs ++ (xs ++ xs)++xs ?? [] = []+xs ?? (x:ys) = xs ++ (xs ++ ys)++xs ?? [] = []+xs ?? (x:ys) = xs ++ (ys ++ xs)++xs ?? [] = []+xs ?? (x:ys) = xs ++ (ys ++ ys)++xs ?? [] = []+xs ?? (x:ys) = ys ++ (x:xs)++xs ?? [] = []+xs ?? (x:ys) = ys ++ (x:ys)++xs ?? [] = []+xs ?? (x:ys) = ys ++ [x]++xs ?? [] = []+xs ?? (x:ys) = ys ++ (xs ++ xs)++xs ?? [] = []+xs ?? (x:ys) = ys ++ (xs ++ ys)++xs ?? [] = []+xs ?? (x:ys) = ys ++ (ys ++ xs)++xs ?? [] = []+xs ?? (x:ys) = ys ++ (ys ++ ys)++xs ?? [] = xs ++ xs+xs ?? (x:ys) = x:xs++xs ?? [] = xs ++ xs+xs ?? (x:ys) = x:ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = [x]++xs ?? [] = xs ++ xs+xs ?? (x:ys) = xs ++ ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = ys ++ xs++xs ?? [] = xs ++ xs+xs ?? (x:ys) = ys ++ ys++xs ?? [] = xs ++ (xs ++ xs)+xs ?? (x:ys) = xs++xs ?? [] = xs ++ (xs ++ xs)+xs ?? (x:ys) = ys++xs ?? [] = xs ++ (xs ++ xs)+xs ?? (x:ys) = []++[] ?? xs = xs+(x:xs) ?? ys = x:x:xs++[] ?? xs = xs+(x:xs) ?? ys = x:x:ys++[] ?? xs = xs+(x:xs) ?? ys = [x,x]++[] ?? xs = xs+(x:xs) ?? ys = x:(xs ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = x:(xs ++ ys)++[] ?? xs = xs+(x:xs) ?? ys = x:(ys ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = x:(ys ++ ys)++[] ?? xs = xs+(x:xs) ?? ys = xs ++ (x:xs)++[] ?? xs = xs+(x:xs) ?? ys = xs ++ (x:ys)++[] ?? xs = xs+(x:xs) ?? ys = xs ++ [x]++[] ?? xs = xs+(x:xs) ?? ys = xs ++ (xs ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = xs ++ (xs ++ ys)++[] ?? xs = xs+(x:xs) ?? ys = xs ++ (ys ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = xs ++ (ys ++ ys)++[] ?? xs = xs+(x:xs) ?? ys = ys ++ (x:xs)++[] ?? xs = xs+(x:xs) ?? ys = ys ++ (x:ys)++[] ?? xs = xs+(x:xs) ?? ys = ys ++ [x]++[] ?? xs = xs+(x:xs) ?? ys = ys ++ (xs ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = ys ++ (xs ++ ys)++[] ?? xs = xs+(x:xs) ?? ys = ys ++ (ys ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = ys ++ (ys ++ ys)++[] ?? xs = []+(x:xs) ?? ys = x:x:xs++[] ?? xs = []+(x:xs) ?? ys = x:x:ys++[] ?? xs = []+(x:xs) ?? ys = [x,x]++[] ?? xs = []+(x:xs) ?? ys = x:(xs ++ xs)++[] ?? xs = []+(x:xs) ?? ys = x:(xs ++ ys)++[] ?? xs = []+(x:xs) ?? ys = x:(ys ++ xs)++[] ?? xs = []+(x:xs) ?? ys = x:(ys ++ ys)++[] ?? xs = []+(x:xs) ?? ys = xs ++ (x:xs)++[] ?? xs = []+(x:xs) ?? ys = xs ++ (x:ys)++[] ?? xs = []+(x:xs) ?? ys = xs ++ [x]++[] ?? xs = []+(x:xs) ?? ys = xs ++ (xs ++ xs)++[] ?? xs = []+(x:xs) ?? ys = xs ++ (xs ++ ys)++[] ?? xs = []+(x:xs) ?? ys = xs ++ (ys ++ xs)++[] ?? xs = []+(x:xs) ?? ys = xs ++ (ys ++ ys)++[] ?? xs = []+(x:xs) ?? ys = ys ++ (x:xs)++[] ?? xs = []+(x:xs) ?? ys = ys ++ (x:ys)++[] ?? xs = []+(x:xs) ?? ys = ys ++ [x]++[] ?? xs = []+(x:xs) ?? ys = ys ++ (xs ++ xs)++[] ?? xs = []+(x:xs) ?? ys = ys ++ (xs ++ ys)++[] ?? xs = []+(x:xs) ?? ys = ys ++ (ys ++ xs)++[] ?? xs = []+(x:xs) ?? ys = ys ++ (ys ++ ys)++[] ?? xs = xs ++ xs+(x:xs) ?? ys = x:xs++[] ?? xs = xs ++ xs+(x:xs) ?? ys = x:ys++[] ?? xs = xs ++ xs+(x:xs) ?? ys = [x]++[] ?? xs = xs ++ xs+(x:xs) ?? ys = xs ++ xs++[] ?? xs = xs ++ xs+(x:xs) ?? ys = xs ++ ys++[] ?? xs = xs ++ xs+(x:xs) ?? ys = ys ++ xs++[] ?? xs = xs ++ (xs ++ xs)+(x:xs) ?? ys = xs++[] ?? xs = xs ++ (xs ++ xs)+(x:xs) ?? ys = ys++[] ?? xs = xs ++ (xs ++ xs)+(x:xs) ?? ys = []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = x:xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = x:ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [x]++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = y:xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = y:ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [y]++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ++ xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ++ ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ++ xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ++ ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = x:xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = [x]+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs ++ xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = x:xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = x:xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = [x]+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = [x]+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs ++ xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs ++ xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++xs ?? [] = xs+xs ?? (x:ys) = x:xs ?? ys++xs ?? [] = xs+xs ?? (x:ys) = x:ys ?? xs++xs ?? [] = xs+xs ?? (x:ys) = x:ys ?? ys++xs ?? [] = xs+xs ?? (x:ys) = x:[] ?? xs++xs ?? [] = xs+xs ?? (x:ys) = x:[] ?? ys++xs ?? [] = xs+xs ?? (x:ys) = xs ++ xs ?? ys++xs ?? [] = xs+xs ?? (x:ys) = xs ++ ys ?? xs++xs ?? [] = xs+xs ?? (x:ys) = xs ++ ys ?? ys++xs ?? [] = xs+xs ?? (x:ys) = xs ++ [] ?? xs++xs ?? [] = xs+xs ?? (x:ys) = xs ++ [] ?? ys++xs ?? [] = xs+xs ?? (x:ys) = ys ++ xs ?? ys++xs ?? [] = xs+xs ?? (x:ys) = ys ++ ys ?? xs++xs ?? [] = xs+xs ?? (x:ys) = ys ++ ys ?? ys++xs ?? [] = xs+xs ?? (x:ys) = ys ++ [] ?? xs++xs ?? [] = xs+xs ?? (x:ys) = ys ++ [] ?? ys++xs ?? [] = xs+xs ?? (x:ys) = xs ?? ys ++ xs++xs ?? [] = xs+xs ?? (x:ys) = ys ?? xs ++ xs++xs ?? [] = xs+xs ?? (x:ys) = ys ?? ys ++ xs++xs ?? [] = xs+xs ?? (x:ys) = [] ?? xs ++ xs++xs ?? [] = xs+xs ?? (x:ys) = [] ?? ys ++ xs++xs ?? [] = xs+xs ?? (x:ys) = xs ?? ys ++ ys++xs ?? [] = xs+xs ?? (x:ys) = ys ?? xs ++ ys++xs ?? [] = xs+xs ?? (x:ys) = ys ?? ys ++ ys++xs ?? [] = xs+xs ?? (x:ys) = [] ?? xs ++ ys++xs ?? [] = xs+xs ?? (x:ys) = [] ?? ys ++ ys++xs ?? [] = []+xs ?? (x:ys) = x:xs ?? ys++xs ?? [] = []+xs ?? (x:ys) = x:ys ?? xs++xs ?? [] = []+xs ?? (x:ys) = x:ys ?? ys++xs ?? [] = []+xs ?? (x:ys) = x:[] ?? xs++xs ?? [] = []+xs ?? (x:ys) = x:[] ?? ys++xs ?? [] = []+xs ?? (x:ys) = xs ++ xs ?? ys++xs ?? [] = []+xs ?? (x:ys) = xs ++ ys ?? xs++xs ?? [] = []+xs ?? (x:ys) = xs ++ ys ?? ys++xs ?? [] = []+xs ?? (x:ys) = xs ++ [] ?? xs++xs ?? [] = []+xs ?? (x:ys) = xs ++ [] ?? ys++xs ?? [] = []+xs ?? (x:ys) = ys ++ xs ?? ys++xs ?? [] = []+xs ?? (x:ys) = ys ++ ys ?? xs++xs ?? [] = []+xs ?? (x:ys) = ys ++ ys ?? ys++xs ?? [] = []+xs ?? (x:ys) = ys ++ [] ?? xs++xs ?? [] = []+xs ?? (x:ys) = ys ++ [] ?? ys++xs ?? [] = []+xs ?? (x:ys) = xs ?? ys ++ xs++xs ?? [] = []+xs ?? (x:ys) = ys ?? xs ++ xs++xs ?? [] = []+xs ?? (x:ys) = ys ?? ys ++ xs++xs ?? [] = []+xs ?? (x:ys) = [] ?? xs ++ xs++xs ?? [] = []+xs ?? (x:ys) = [] ?? ys ++ xs++xs ?? [] = []+xs ?? (x:ys) = xs ?? ys ++ ys++xs ?? [] = []+xs ?? (x:ys) = ys ?? xs ++ ys++xs ?? [] = []+xs ?? (x:ys) = ys ?? ys ++ ys++xs ?? [] = []+xs ?? (x:ys) = [] ?? xs ++ ys++xs ?? [] = []+xs ?? (x:ys) = [] ?? ys ++ ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = xs ?? ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = ys ?? xs++xs ?? [] = xs ++ xs+xs ?? (x:ys) = ys ?? ys++xs ?? [] = xs ++ xs+xs ?? (x:ys) = [] ?? xs++xs ?? [] = xs ++ xs+xs ?? (x:ys) = [] ?? ys++[] ?? xs = xs+(x:xs) ?? ys = x:xs ?? xs++[] ?? xs = xs+(x:xs) ?? ys = x:xs ?? ys++[] ?? xs = xs+(x:xs) ?? ys = x:xs ?? []++[] ?? xs = xs+(x:xs) ?? ys = x:ys ?? xs++[] ?? xs = xs+(x:xs) ?? ys = x:ys ?? []++[] ?? xs = xs+(x:xs) ?? ys = xs ++ xs ?? xs++[] ?? xs = xs+(x:xs) ?? ys = xs ++ xs ?? ys++[] ?? xs = xs+(x:xs) ?? ys = xs ++ xs ?? []++[] ?? xs = xs+(x:xs) ?? ys = xs ++ ys ?? xs++[] ?? xs = xs+(x:xs) ?? ys = xs ++ ys ?? []++[] ?? xs = xs+(x:xs) ?? ys = ys ++ xs ?? xs++[] ?? xs = xs+(x:xs) ?? ys = ys ++ xs ?? ys++[] ?? xs = xs+(x:xs) ?? ys = ys ++ xs ?? []++[] ?? xs = xs+(x:xs) ?? ys = ys ++ ys ?? xs++[] ?? xs = xs+(x:xs) ?? ys = ys ++ ys ?? []++[] ?? xs = xs+(x:xs) ?? ys = xs ?? xs ++ xs++[] ?? xs = xs+(x:xs) ?? ys = xs ?? ys ++ xs++[] ?? xs = xs+(x:xs) ?? ys = xs ?? [] ++ xs++[] ?? xs = xs+(x:xs) ?? ys = ys ?? xs ++ xs++[] ?? xs = xs+(x:xs) ?? ys = ys ?? [] ++ xs++[] ?? xs = xs+(x:xs) ?? ys = xs ?? xs ++ ys++[] ?? xs = xs+(x:xs) ?? ys = xs ?? ys ++ ys++[] ?? xs = xs+(x:xs) ?? ys = xs ?? [] ++ ys++[] ?? xs = xs+(x:xs) ?? ys = ys ?? xs ++ ys++[] ?? xs = xs+(x:xs) ?? ys = ys ?? [] ++ ys++[] ?? xs = []+(x:xs) ?? ys = x:xs ?? xs++[] ?? xs = []+(x:xs) ?? ys = x:xs ?? ys++[] ?? xs = []+(x:xs) ?? ys = x:xs ?? []++[] ?? xs = []+(x:xs) ?? ys = x:ys ?? xs++[] ?? xs = []+(x:xs) ?? ys = x:ys ?? []++[] ?? xs = []+(x:xs) ?? ys = xs ++ xs ?? xs++[] ?? xs = []+(x:xs) ?? ys = xs ++ xs ?? ys++[] ?? xs = []+(x:xs) ?? ys = xs ++ xs ?? []++[] ?? xs = []+(x:xs) ?? ys = xs ++ ys ?? xs++[] ?? xs = []+(x:xs) ?? ys = xs ++ ys ?? []++[] ?? xs = []+(x:xs) ?? ys = ys ++ xs ?? xs++[] ?? xs = []+(x:xs) ?? ys = ys ++ xs ?? ys++[] ?? xs = []+(x:xs) ?? ys = ys ++ xs ?? []++[] ?? xs = []+(x:xs) ?? ys = ys ++ ys ?? xs++[] ?? xs = []+(x:xs) ?? ys = ys ++ ys ?? []++[] ?? xs = []+(x:xs) ?? ys = xs ?? xs ++ xs++[] ?? xs = []+(x:xs) ?? ys = xs ?? ys ++ xs++[] ?? xs = []+(x:xs) ?? ys = xs ?? [] ++ xs++[] ?? xs = []+(x:xs) ?? ys = ys ?? xs ++ xs++[] ?? xs = []+(x:xs) ?? ys = ys ?? [] ++ xs++[] ?? xs = []+(x:xs) ?? ys = xs ?? xs ++ ys++[] ?? xs = []+(x:xs) ?? ys = xs ?? ys ++ ys++[] ?? xs = []+(x:xs) ?? ys = xs ?? [] ++ ys++[] ?? xs = []+(x:xs) ?? ys = ys ?? xs ++ ys++[] ?? xs = []+(x:xs) ?? ys = ys ?? [] ++ ys++[] ?? xs = xs ++ xs+(x:xs) ?? ys = xs ?? xs++[] ?? xs = xs ++ xs+(x:xs) ?? ys = xs ?? ys++[] ?? xs = xs ++ xs+(x:xs) ?? ys = xs ?? []++[] ?? xs = xs ++ xs+(x:xs) ?? ys = ys ?? xs++[] ?? xs = xs ++ xs+(x:xs) ?? ys = ys ?? []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [] ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = [] ?? ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = [] ?? xs+(x:xs) ?? (y:ys) = xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = xs ?? []+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? [] = [] ?? xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs ?? xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs ?? []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = [] ?? xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs ?? xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = xs ?? []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++[] ?? [] = []+[] ?? (x:xs) = [] ?? xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = []++xs ?? [] = xs+xs ?? (x:ys) = (x:xs) ?? ys++xs ?? [] = xs+xs ?? (x:ys) = (x:ys) ?? ys++xs ?? [] = xs+xs ?? (x:ys) = [x] ?? ys++xs ?? [] = xs+xs ?? (x:ys) = (xs ++ xs) ?? ys++xs ?? [] = xs+xs ?? (x:ys) = (xs ++ ys) ?? ys++xs ?? [] = xs+xs ?? (x:ys) = (ys ++ xs) ?? ys++xs ?? [] = xs+xs ?? (x:ys) = (ys ++ ys) ?? ys++[] ?? xs = xs+(x:xs) ?? ys = xs ?? (x:xs)++[] ?? xs = xs+(x:xs) ?? ys = xs ?? (x:ys)++[] ?? xs = xs+(x:xs) ?? ys = xs ?? [x]++[] ?? xs = xs+(x:xs) ?? ys = xs ?? (xs ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = xs ?? (xs ++ ys)++[] ?? xs = xs+(x:xs) ?? ys = xs ?? (ys ++ xs)++[] ?? xs = xs+(x:xs) ?? ys = xs ?? (ys ++ ys)++++allowed patterns:++xs ?? ys = _+++xs ?? [] = _+xs ?? (x:ys) = _++[] ?? xs = _+(x:xs) ?? ys = _+++[] ?? xs = _+(x:xs) ?? [] = _+(x:xs) ?? (y:ys) = _++[] ?? [] = _+[] ?? (x:xs) = _+(x:xs) ?? ys = _+++[] ?? [] = _+[] ?? (x:xs) = _+(x:xs) ?? [] = _+(x:xs) ?? (y:ys) = _+++++allowed deconstructions:+++Candidates for: ton :: Bool -> Bool+ pruning with 39/49 rules+ [3,1,0,0,0,0,0,0,0] direct candidates, 0 duplicates+ [3,3,0,0,0,0,0,0,0] pattern candidates, 0 duplicates++rules:+not False == True+not True == False+p && p == p+p || p == p+not (not p) == p+p && False == False+p && True == p+False && p == False+True && p == p+p || False == p+p || True == True+False || p == p+True || p == True+not (p && q) == not p || not q+not (p && q) == not q || not p+not (p || q) == not p && not q+not (p || q) == not q && not p+p && not p == False+not p && p == False+p || not p == True+not p || p == True+(p && q) && r == p && (q && r)+(p && q) && r == q && (p && r)+(p || q) || r == p || (q || r)+(p || q) || r == q || (p || r)+p && (p && q) == p && q+p && (q && p) == p && q+p && (q && p) == q && p+p || (p || q) == p || q+p || (q || p) == p || q+p || (q || p) == q || p+p && (p || q) == p+p && (q || p) == p+(p || q) && p == p+(p || q) && q == q+p || p && q == p+p || q && p == p+p && q || p == p+p && q || q == q+equations:+q && p == p && q+q || p == p || q+q && (p && r) == p && (q && r)+r && (p && q) == p && (q && r)+r && (q && p) == p && (q && r)+q || (p || r) == p || (q || r)+r || (p || q) == p || (q || r)+r || (q || p) == p || (q || r)+(r || q) && p == p && (q || r)+r && q || p == p || q && r++direct candidates:++ton p = p++ton p = False++ton p = True++ton p = not p+++pattern candidates:++ton p = p++ton p = False++ton p = True++ton p = not p++ton False = False+ton True = True++ton False = True+ton True = False++++allowed patterns:++ton p = _+++ton False = _+ton True = _+++++allowed deconstructions:+++Candidates for: &| :: Bool -> Bool -> Bool+ pruning with 39/49 rules+ [4,2,2,4,2,16,17,56,110] direct candidates, 0 duplicates+ [4,14,26,10,2,16,17,56,110] pattern candidates, 0 duplicates++rules:+not False == True+not True == False+p && p == p+p || p == p+not (not p) == p+p && False == False+p && True == p+False && p == False+True && p == p+p || False == p+p || True == True+False || p == p+True || p == True+not (p && q) == not p || not q+not (p && q) == not q || not p+not (p || q) == not p && not q+not (p || q) == not q && not p+p && not p == False+not p && p == False+p || not p == True+not p || p == True+(p && q) && r == p && (q && r)+(p && q) && r == q && (p && r)+(p || q) || r == p || (q || r)+(p || q) || r == q || (p || r)+p && (p && q) == p && q+p && (q && p) == p && q+p && (q && p) == q && p+p || (p || q) == p || q+p || (q || p) == p || q+p || (q || p) == q || p+p && (p || q) == p+p && (q || p) == p+(p || q) && p == p+(p || q) && q == q+p || p && q == p+p || q && p == p+p && q || p == p+p && q || q == q+equations:+q && p == p && q+q || p == p || q+q && (p && r) == p && (q && r)+r && (p && q) == p && (q && r)+r && (q && p) == p && (q && r)+q || (p || r) == p || (q || r)+r || (p || q) == p || (q || r)+r || (q || p) == p || (q || r)+(r || q) && p == p && (q || r)+r && q || p == p || q && r++direct candidates:++p &| q = p++p &| q = q++p &| q = False++p &| q = True++p &| q = not p++p &| q = not q++p &| q = p && q++p &| q = p || q++p &| q = p && not q++p &| q = q && not p++p &| q = p || not q++p &| q = q || not p++p &| q = not p && not q++p &| q = not p || not q++p &| q = p && (q && not p)++p &| q = p && (q || not p)++p &| q = q && (p && not q)++p &| q = q && (p || not q)++p &| q = p || q && not p++p &| q = p || (q || not p)++p &| q = q || p && not q++p &| q = q || (p || not q)++p &| q = not p && (p && q)++p &| q = not p && (p || q)++p &| q = not q && (p && q)++p &| q = not q && (p || q)++p &| q = not p || p && q++p &| q = not p || (p || q)++p &| q = not q || p && q++p &| q = not q || (p || q)+++pattern candidates:++p &| q = p++p &| q = q++p &| q = False++p &| q = True++p &| q = not p++p &| q = not q++p &| False = p+p &| True = False++p &| False = p+p &| True = True++p &| False = False+p &| True = p++p &| False = False+p &| True = True++p &| False = True+p &| True = p++p &| False = True+p &| True = False++False &| p = p+True &| p = False++False &| p = p+True &| p = True++False &| p = False+True &| p = p++False &| p = False+True &| p = True++False &| p = True+True &| p = p++False &| p = True+True &| p = False++p &| q = p && q++p &| q = p || q++p &| False = p+p &| True = not p++p &| False = False+p &| True = not p++p &| False = True+p &| True = not p++p &| False = not p+p &| True = p++p &| False = not p+p &| True = False++p &| False = not p+p &| True = True++False &| p = p+True &| p = not p++False &| p = False+True &| p = not p++False &| p = True+True &| p = not p++False &| p = not p+True &| p = p++False &| p = not p+True &| p = False++False &| p = not p+True &| p = True++False &| p = p+True &| False = False+True &| True = True++False &| p = p+True &| False = True+True &| True = False++False &| p = False+True &| False = False+True &| True = True++False &| p = False+True &| False = True+True &| True = False++False &| p = True+True &| False = False+True &| True = True++False &| p = True+True &| False = True+True &| True = False++False &| False = False+False &| True = True+True &| p = p++False &| False = False+False &| True = True+True &| p = False++False &| False = False+False &| True = True+True &| p = True++False &| False = True+False &| True = False+True &| p = p++False &| False = True+False &| True = False+True &| p = False++False &| False = True+False &| True = False+True &| p = True++p &| q = p && not q++p &| q = q && not p++p &| q = p || not q++p &| q = q || not p++False &| p = not p+True &| False = False+True &| True = True++False &| p = not p+True &| False = True+True &| True = False++False &| False = False+False &| True = True+True &| p = not p++False &| False = True+False &| True = False+True &| p = not p++False &| False = False+False &| True = True+True &| False = True+True &| True = False++False &| False = True+False &| True = False+True &| False = False+True &| True = True++p &| q = not p && not q++p &| q = not p || not q++p &| q = p && (q && not p)++p &| q = p && (q || not p)++p &| q = q && (p && not q)++p &| q = q && (p || not q)++p &| q = p || q && not p++p &| q = p || (q || not p)++p &| q = q || p && not q++p &| q = q || (p || not q)++p &| q = not p && (p && q)++p &| q = not p && (p || q)++p &| q = not q && (p && q)++p &| q = not q && (p || q)++p &| q = not p || p && q++p &| q = not p || (p || q)++p &| q = not q || p && q++p &| q = not q || (p || q)++++allowed patterns:++p &| q = _+++p &| False = _+p &| True = _++False &| p = _+True &| p = _+++False &| p = _+True &| False = _+True &| True = _++False &| False = _+False &| True = _+True &| p = _+++False &| False = _+False &| True = _+True &| False = _+True &| True = _+++++allowed deconstructions:+++Candidates for: gcd :: Int -> Int -> Int+ pruning with 0/0 rules+ [3,0,9,0,54,0,405,0,3402] direct candidates, 0 duplicates+ [3,6,11,50,98,330,774,2714,6660] pattern candidates, 0 duplicates++no rules.++direct candidates:++gcd x y = x++gcd x y = y++gcd x y = 0++gcd x y = x `mod` x++gcd x y = x `mod` y++gcd x y = x `mod` 0++gcd x y = y `mod` x++gcd x y = y `mod` y++gcd x y = y `mod` 0++gcd x y = 0 `mod` x++gcd x y = 0 `mod` y++gcd x y = 0 `mod` 0++gcd x y = x `mod` (x `mod` x)++gcd x y = x `mod` (x `mod` y)++gcd x y = x `mod` (x `mod` 0)++gcd x y = x `mod` (y `mod` x)++gcd x y = x `mod` (y `mod` y)++gcd x y = x `mod` (y `mod` 0)++gcd x y = x `mod` (0 `mod` x)++gcd x y = x `mod` (0 `mod` y)++gcd x y = x `mod` (0 `mod` 0)++gcd x y = y `mod` (x `mod` x)++gcd x y = y `mod` (x `mod` y)++gcd x y = y `mod` (x `mod` 0)++gcd x y = y `mod` (y `mod` x)++gcd x y = y `mod` (y `mod` y)++gcd x y = y `mod` (y `mod` 0)++gcd x y = y `mod` (0 `mod` x)++gcd x y = y `mod` (0 `mod` y)++gcd x y = y `mod` (0 `mod` 0)++gcd x y = 0 `mod` (x `mod` x)++gcd x y = 0 `mod` (x `mod` y)++gcd x y = 0 `mod` (x `mod` 0)++gcd x y = 0 `mod` (y `mod` x)++gcd x y = 0 `mod` (y `mod` y)++gcd x y = 0 `mod` (y `mod` 0)++gcd x y = 0 `mod` (0 `mod` x)++gcd x y = 0 `mod` (0 `mod` y)++gcd x y = 0 `mod` (0 `mod` 0)++gcd x y = (x `mod` x) `mod` x++gcd x y = (x `mod` x) `mod` y++gcd x y = (x `mod` x) `mod` 0++gcd x y = (x `mod` y) `mod` x++gcd x y = (x `mod` y) `mod` y++gcd x y = (x `mod` y) `mod` 0++gcd x y = (x `mod` 0) `mod` x++gcd x y = (x `mod` 0) `mod` y++gcd x y = (x `mod` 0) `mod` 0++gcd x y = (y `mod` x) `mod` x++gcd x y = (y `mod` x) `mod` y++gcd x y = (y `mod` x) `mod` 0++gcd x y = (y `mod` y) `mod` x++gcd x y = (y `mod` y) `mod` y++gcd x y = (y `mod` y) `mod` 0++gcd x y = (y `mod` 0) `mod` x++gcd x y = (y `mod` 0) `mod` y++gcd x y = (y `mod` 0) `mod` 0++gcd x y = (0 `mod` x) `mod` x++gcd x y = (0 `mod` x) `mod` y++gcd x y = (0 `mod` x) `mod` 0++gcd x y = (0 `mod` y) `mod` x++gcd x y = (0 `mod` y) `mod` y++gcd x y = (0 `mod` y) `mod` 0++gcd x y = (0 `mod` 0) `mod` x++gcd x y = (0 `mod` 0) `mod` y++gcd x y = (0 `mod` 0) `mod` 0+++pattern candidates:++gcd x y = x++gcd x y = y++gcd x y = 0++gcd x 0 = x+gcd x y = y++gcd x 0 = x+gcd x y = 0++gcd x 0 = 0+gcd x y = x++gcd 0 x = x+gcd x y = x++gcd 0 x = x+gcd x y = 0++gcd 0 x = 0+gcd x y = y++gcd x y = x `mod` x++gcd x y = x `mod` y++gcd x y = x `mod` 0++gcd x y = y `mod` x++gcd x y = y `mod` y++gcd x y = y `mod` 0++gcd x y = 0 `mod` x++gcd x y = 0 `mod` y++gcd 0 x = x+gcd x 0 = x+gcd x y = 0++gcd 0 x = x+gcd x 0 = 0+gcd x y = x++gcd 0 x = 0+gcd x 0 = x+gcd x y = y++gcd x 0 = x+gcd x y = x `mod` x++gcd x 0 = x+gcd x y = x `mod` y++gcd x 0 = x+gcd x y = x `mod` 0++gcd x 0 = x+gcd x y = y `mod` x++gcd x 0 = x+gcd x y = y `mod` y++gcd x 0 = x+gcd x y = y `mod` 0++gcd x 0 = x+gcd x y = 0 `mod` x++gcd x 0 = x+gcd x y = 0 `mod` y++gcd x 0 = 0+gcd x y = x `mod` x++gcd x 0 = 0+gcd x y = x `mod` y++gcd x 0 = 0+gcd x y = x `mod` 0++gcd x 0 = 0+gcd x y = y `mod` x++gcd x 0 = 0+gcd x y = y `mod` y++gcd x 0 = 0+gcd x y = y `mod` 0++gcd x 0 = 0+gcd x y = 0 `mod` x++gcd x 0 = 0+gcd x y = 0 `mod` y++gcd x 0 = x `mod` x+gcd x y = x++gcd x 0 = x `mod` x+gcd x y = y++gcd x 0 = x `mod` x+gcd x y = 0++gcd x 0 = x `mod` 0+gcd x y = x++gcd x 0 = x `mod` 0+gcd x y = y++gcd x 0 = x `mod` 0+gcd x y = 0++gcd x 0 = 0 `mod` x+gcd x y = x++gcd x 0 = 0 `mod` x+gcd x y = y++gcd x 0 = 0 `mod` x+gcd x y = 0++gcd 0 x = x+gcd x y = x `mod` x++gcd 0 x = x+gcd x y = x `mod` y++gcd 0 x = x+gcd x y = x `mod` 0++gcd 0 x = x+gcd x y = y `mod` x++gcd 0 x = x+gcd x y = y `mod` y++gcd 0 x = x+gcd x y = y `mod` 0++gcd 0 x = x+gcd x y = 0 `mod` x++gcd 0 x = x+gcd x y = 0 `mod` y++gcd 0 x = 0+gcd x y = x `mod` x++gcd 0 x = 0+gcd x y = x `mod` y++gcd 0 x = 0+gcd x y = x `mod` 0++gcd 0 x = 0+gcd x y = y `mod` x++gcd 0 x = 0+gcd x y = y `mod` y++gcd 0 x = 0+gcd x y = y `mod` 0++gcd 0 x = 0+gcd x y = 0 `mod` x++gcd 0 x = 0+gcd x y = 0 `mod` y++gcd 0 x = x `mod` x+gcd x y = x++gcd 0 x = x `mod` x+gcd x y = y++gcd 0 x = x `mod` x+gcd x y = 0++gcd 0 x = x `mod` 0+gcd x y = x++gcd 0 x = x `mod` 0+gcd x y = y++gcd 0 x = x `mod` 0+gcd x y = 0++gcd 0 x = 0 `mod` x+gcd x y = x++gcd 0 x = 0 `mod` x+gcd x y = y++gcd 0 x = 0 `mod` x+gcd x y = 0++gcd x y = x `mod` (x `mod` x)++gcd x y = x `mod` (x `mod` y)++gcd x y = x `mod` (x `mod` 0)++gcd x y = x `mod` (y `mod` x)++gcd x y = x `mod` (y `mod` y)++gcd x y = x `mod` (y `mod` 0)++gcd x y = x `mod` (0 `mod` x)++gcd x y = x `mod` (0 `mod` y)++gcd x y = y `mod` (x `mod` x)++gcd x y = y `mod` (x `mod` y)++gcd x y = y `mod` (x `mod` 0)++gcd x y = y `mod` (y `mod` x)++gcd x y = y `mod` (y `mod` y)++gcd x y = y `mod` (y `mod` 0)++gcd x y = y `mod` (0 `mod` x)++gcd x y = y `mod` (0 `mod` y)++gcd x y = 0 `mod` (x `mod` x)++gcd x y = 0 `mod` (x `mod` y)++gcd x y = 0 `mod` (x `mod` 0)++gcd x y = 0 `mod` (y `mod` x)++gcd x y = 0 `mod` (y `mod` y)++gcd x y = 0 `mod` (y `mod` 0)++gcd x y = 0 `mod` (0 `mod` x)++gcd x y = 0 `mod` (0 `mod` y)++gcd x y = (x `mod` x) `mod` x++gcd x y = (x `mod` x) `mod` y++gcd x y = (x `mod` x) `mod` 0++gcd x y = (x `mod` y) `mod` x++gcd x y = (x `mod` y) `mod` y++gcd x y = (x `mod` y) `mod` 0++gcd x y = (x `mod` 0) `mod` x++gcd x y = (x `mod` 0) `mod` y++gcd x y = (x `mod` 0) `mod` 0++gcd x y = (y `mod` x) `mod` x++gcd x y = (y `mod` x) `mod` y++gcd x y = (y `mod` x) `mod` 0++gcd x y = (y `mod` y) `mod` x++gcd x y = (y `mod` y) `mod` y++gcd x y = (y `mod` y) `mod` 0++gcd x y = (y `mod` 0) `mod` x++gcd x y = (y `mod` 0) `mod` y++gcd x y = (y `mod` 0) `mod` 0++gcd x y = (0 `mod` x) `mod` x++gcd x y = (0 `mod` x) `mod` y++gcd x y = (0 `mod` x) `mod` 0++gcd x y = (0 `mod` y) `mod` x++gcd x y = (0 `mod` y) `mod` y++gcd x y = (0 `mod` y) `mod` 0++gcd 0 x = x+gcd x 0 = x+gcd x y = x `mod` x++gcd 0 x = x+gcd x 0 = x+gcd x y = x `mod` y++gcd 0 x = x+gcd x 0 = x+gcd x y = x `mod` 0++gcd 0 x = x+gcd x 0 = x+gcd x y = y `mod` x++gcd 0 x = x+gcd x 0 = x+gcd x y = y `mod` y++gcd 0 x = x+gcd x 0 = x+gcd x y = y `mod` 0++gcd 0 x = x+gcd x 0 = x+gcd x y = 0 `mod` x++gcd 0 x = x+gcd x 0 = x+gcd x y = 0 `mod` y++gcd 0 x = x+gcd x 0 = 0+gcd x y = x `mod` x++gcd 0 x = x+gcd x 0 = 0+gcd x y = x `mod` y++gcd 0 x = x+gcd x 0 = 0+gcd x y = x `mod` 0++gcd 0 x = x+gcd x 0 = 0+gcd x y = y `mod` x++gcd 0 x = x+gcd x 0 = 0+gcd x y = y `mod` y++gcd 0 x = x+gcd x 0 = 0+gcd x y = y `mod` 0++gcd 0 x = x+gcd x 0 = 0+gcd x y = 0 `mod` x++gcd 0 x = x+gcd x 0 = 0+gcd x y = 0 `mod` y++gcd 0 x = x+gcd x 0 = x `mod` x+gcd x y = x++gcd 0 x = x+gcd x 0 = x `mod` x+gcd x y = 0++gcd 0 x = x+gcd x 0 = x `mod` 0+gcd x y = x++gcd 0 x = x+gcd x 0 = x `mod` 0+gcd x y = 0++gcd 0 x = x+gcd x 0 = 0 `mod` x+gcd x y = x++gcd 0 x = x+gcd x 0 = 0 `mod` x+gcd x y = 0++gcd 0 x = 0+gcd x 0 = x+gcd x y = x `mod` x++gcd 0 x = 0+gcd x 0 = x+gcd x y = x `mod` y++gcd 0 x = 0+gcd x 0 = x+gcd x y = x `mod` 0++gcd 0 x = 0+gcd x 0 = x+gcd x y = y `mod` x++gcd 0 x = 0+gcd x 0 = x+gcd x y = y `mod` y++gcd 0 x = 0+gcd x 0 = x+gcd x y = y `mod` 0++gcd 0 x = 0+gcd x 0 = x+gcd x y = 0 `mod` x++gcd 0 x = 0+gcd x 0 = x+gcd x y = 0 `mod` y++gcd 0 x = 0+gcd x 0 = 0+gcd x y = x `mod` x++gcd 0 x = 0+gcd x 0 = 0+gcd x y = x `mod` y++gcd 0 x = 0+gcd x 0 = 0+gcd x y = x `mod` 0++gcd 0 x = 0+gcd x 0 = 0+gcd x y = y `mod` x++gcd 0 x = 0+gcd x 0 = 0+gcd x y = y `mod` y++gcd 0 x = 0+gcd x 0 = 0+gcd x y = y `mod` 0++gcd 0 x = 0+gcd x 0 = 0+gcd x y = 0 `mod` x++gcd 0 x = 0+gcd x 0 = 0+gcd x y = 0 `mod` y++gcd 0 x = 0+gcd x 0 = x `mod` x+gcd x y = y++gcd 0 x = 0+gcd x 0 = x `mod` 0+gcd x y = y++gcd 0 x = 0+gcd x 0 = 0 `mod` x+gcd x y = y++gcd 0 x = x `mod` x+gcd x 0 = x+gcd x y = y++gcd 0 x = x `mod` x+gcd x 0 = x+gcd x y = 0++gcd 0 x = x `mod` x+gcd x 0 = 0+gcd x y = x++gcd 0 x = x `mod` 0+gcd x 0 = x+gcd x y = y++gcd 0 x = x `mod` 0+gcd x 0 = x+gcd x y = 0++gcd 0 x = x `mod` 0+gcd x 0 = 0+gcd x y = x++gcd 0 x = 0 `mod` x+gcd x 0 = x+gcd x y = y++gcd 0 x = 0 `mod` x+gcd x 0 = x+gcd x y = 0++gcd 0 x = 0 `mod` x+gcd x 0 = 0+gcd x y = x++gcd x 0 = x+gcd x y = x `mod` (x `mod` x)++gcd x 0 = x+gcd x y = x `mod` (x `mod` y)++gcd x 0 = x+gcd x y = x `mod` (x `mod` 0)++gcd x 0 = x+gcd x y = x `mod` (y `mod` x)++gcd x 0 = x+gcd x y = x `mod` (y `mod` y)++gcd x 0 = x+gcd x y = x `mod` (y `mod` 0)++gcd x 0 = x+gcd x y = x `mod` (0 `mod` x)++gcd x 0 = x+gcd x y = x `mod` (0 `mod` y)++gcd x 0 = x+gcd x y = y `mod` (x `mod` x)++gcd x 0 = x+gcd x y = y `mod` (x `mod` y)++gcd x 0 = x+gcd x y = y `mod` (x `mod` 0)++gcd x 0 = x+gcd x y = y `mod` (y `mod` x)++gcd x 0 = x+gcd x y = y `mod` (y `mod` y)++gcd x 0 = x+gcd x y = y `mod` (y `mod` 0)++gcd x 0 = x+gcd x y = y `mod` (0 `mod` x)++gcd x 0 = x+gcd x y = y `mod` (0 `mod` y)++gcd x 0 = x+gcd x y = 0 `mod` (x `mod` x)++gcd x 0 = x+gcd x y = 0 `mod` (x `mod` y)++gcd x 0 = x+gcd x y = 0 `mod` (x `mod` 0)++gcd x 0 = x+gcd x y = 0 `mod` (y `mod` x)++gcd x 0 = x+gcd x y = 0 `mod` (y `mod` y)++gcd x 0 = x+gcd x y = 0 `mod` (y `mod` 0)++gcd x 0 = x+gcd x y = 0 `mod` (0 `mod` x)++gcd x 0 = x+gcd x y = 0 `mod` (0 `mod` y)++gcd x 0 = x+gcd x y = (x `mod` x) `mod` x++gcd x 0 = x+gcd x y = (x `mod` x) `mod` y++gcd x 0 = x+gcd x y = (x `mod` x) `mod` 0++gcd x 0 = x+gcd x y = (x `mod` y) `mod` x++gcd x 0 = x+gcd x y = (x `mod` y) `mod` y++gcd x 0 = x+gcd x y = (x `mod` y) `mod` 0++gcd x 0 = x+gcd x y = (x `mod` 0) `mod` x++gcd x 0 = x+gcd x y = (x `mod` 0) `mod` y++gcd x 0 = x+gcd x y = (x `mod` 0) `mod` 0++gcd x 0 = x+gcd x y = (y `mod` x) `mod` x++gcd x 0 = x+gcd x y = (y `mod` x) `mod` y++gcd x 0 = x+gcd x y = (y `mod` x) `mod` 0++gcd x 0 = x+gcd x y = (y `mod` y) `mod` x++gcd x 0 = x+gcd x y = (y `mod` y) `mod` y++gcd x 0 = x+gcd x y = (y `mod` y) `mod` 0++gcd x 0 = x+gcd x y = (y `mod` 0) `mod` x++gcd x 0 = x+gcd x y = (y `mod` 0) `mod` y++gcd x 0 = x+gcd x y = (y `mod` 0) `mod` 0++gcd x 0 = x+gcd x y = (0 `mod` x) `mod` x++gcd x 0 = x+gcd x y = (0 `mod` x) `mod` y++gcd x 0 = x+gcd x y = (0 `mod` x) `mod` 0++gcd x 0 = x+gcd x y = (0 `mod` y) `mod` x++gcd x 0 = x+gcd x y = (0 `mod` y) `mod` y++gcd x 0 = x+gcd x y = (0 `mod` y) `mod` 0++gcd x 0 = 0+gcd x y = x `mod` (x `mod` x)++gcd x 0 = 0+gcd x y = x `mod` (x `mod` y)++gcd x 0 = 0+gcd x y = x `mod` (x `mod` 0)++gcd x 0 = 0+gcd x y = x `mod` (y `mod` x)++gcd x 0 = 0+gcd x y = x `mod` (y `mod` y)++gcd x 0 = 0+gcd x y = x `mod` (y `mod` 0)++gcd x 0 = 0+gcd x y = x `mod` (0 `mod` x)++gcd x 0 = 0+gcd x y = x `mod` (0 `mod` y)++gcd x 0 = 0+gcd x y = y `mod` (x `mod` x)++gcd x 0 = 0+gcd x y = y `mod` (x `mod` y)++gcd x 0 = 0+gcd x y = y `mod` (x `mod` 0)++gcd x 0 = 0+gcd x y = y `mod` (y `mod` x)++gcd x 0 = 0+gcd x y = y `mod` (y `mod` y)++gcd x 0 = 0+gcd x y = y `mod` (y `mod` 0)++gcd x 0 = 0+gcd x y = y `mod` (0 `mod` x)++gcd x 0 = 0+gcd x y = y `mod` (0 `mod` y)++gcd x 0 = 0+gcd x y = 0 `mod` (x `mod` x)++gcd x 0 = 0+gcd x y = 0 `mod` (x `mod` y)++gcd x 0 = 0+gcd x y = 0 `mod` (x `mod` 0)++gcd x 0 = 0+gcd x y = 0 `mod` (y `mod` x)++gcd x 0 = 0+gcd x y = 0 `mod` (y `mod` y)++gcd x 0 = 0+gcd x y = 0 `mod` (y `mod` 0)++gcd x 0 = 0+gcd x y = 0 `mod` (0 `mod` x)++gcd x 0 = 0+gcd x y = 0 `mod` (0 `mod` y)++gcd x 0 = 0+gcd x y = (x `mod` x) `mod` x++gcd x 0 = 0+gcd x y = (x `mod` x) `mod` y++gcd x 0 = 0+gcd x y = (x `mod` x) `mod` 0++gcd x 0 = 0+gcd x y = (x `mod` y) `mod` x++gcd x 0 = 0+gcd x y = (x `mod` y) `mod` y++gcd x 0 = 0+gcd x y = (x `mod` y) `mod` 0++gcd x 0 = 0+gcd x y = (x `mod` 0) `mod` x++gcd x 0 = 0+gcd x y = (x `mod` 0) `mod` y++gcd x 0 = 0+gcd x y = (x `mod` 0) `mod` 0++gcd x 0 = 0+gcd x y = (y `mod` x) `mod` x++gcd x 0 = 0+gcd x y = (y `mod` x) `mod` y++gcd x 0 = 0+gcd x y = (y `mod` x) `mod` 0++gcd x 0 = 0+gcd x y = (y `mod` y) `mod` x++gcd x 0 = 0+gcd x y = (y `mod` y) `mod` y++gcd x 0 = 0+gcd x y = (y `mod` y) `mod` 0++gcd x 0 = 0+gcd x y = (y `mod` 0) `mod` x++gcd x 0 = 0+gcd x y = (y `mod` 0) `mod` y++gcd x 0 = 0+gcd x y = (y `mod` 0) `mod` 0++gcd x 0 = 0+gcd x y = (0 `mod` x) `mod` x++gcd x 0 = 0+gcd x y = (0 `mod` x) `mod` y++gcd x 0 = 0+gcd x y = (0 `mod` x) `mod` 0++gcd x 0 = 0+gcd x y = (0 `mod` y) `mod` x++gcd x 0 = 0+gcd x y = (0 `mod` y) `mod` y++gcd x 0 = 0+gcd x y = (0 `mod` y) `mod` 0++gcd x 0 = x `mod` x+gcd x y = x `mod` y++gcd x 0 = x `mod` x+gcd x y = x `mod` 0++gcd x 0 = x `mod` x+gcd x y = y `mod` x++gcd x 0 = x `mod` x+gcd x y = y `mod` y++gcd x 0 = x `mod` x+gcd x y = y `mod` 0++gcd x 0 = x `mod` x+gcd x y = 0 `mod` x++gcd x 0 = x `mod` x+gcd x y = 0 `mod` y++gcd x 0 = x `mod` 0+gcd x y = x `mod` x++gcd x 0 = x `mod` 0+gcd x y = y `mod` x++gcd x 0 = x `mod` 0+gcd x y = y `mod` y++gcd x 0 = x `mod` 0+gcd x y = y `mod` 0++gcd x 0 = x `mod` 0+gcd x y = 0 `mod` x++gcd x 0 = x `mod` 0+gcd x y = 0 `mod` y++gcd x 0 = 0 `mod` x+gcd x y = x `mod` x++gcd x 0 = 0 `mod` x+gcd x y = x `mod` y++gcd x 0 = 0 `mod` x+gcd x y = x `mod` 0++gcd x 0 = 0 `mod` x+gcd x y = y `mod` y++gcd x 0 = 0 `mod` x+gcd x y = y `mod` 0++gcd x 0 = 0 `mod` x+gcd x y = 0 `mod` y++gcd x 0 = x `mod` (x `mod` x)+gcd x y = x++gcd x 0 = x `mod` (x `mod` x)+gcd x y = y++gcd x 0 = x `mod` (x `mod` x)+gcd x y = 0++gcd x 0 = x `mod` (x `mod` 0)+gcd x y = x++gcd x 0 = x `mod` (x `mod` 0)+gcd x y = y++gcd x 0 = x `mod` (x `mod` 0)+gcd x y = 0++gcd x 0 = x `mod` (0 `mod` x)+gcd x y = x++gcd x 0 = x `mod` (0 `mod` x)+gcd x y = y++gcd x 0 = x `mod` (0 `mod` x)+gcd x y = 0++gcd x 0 = 0 `mod` (x `mod` x)+gcd x y = x++gcd x 0 = 0 `mod` (x `mod` x)+gcd x y = y++gcd x 0 = 0 `mod` (x `mod` x)+gcd x y = 0++gcd x 0 = 0 `mod` (x `mod` 0)+gcd x y = x++gcd x 0 = 0 `mod` (x `mod` 0)+gcd x y = y++gcd x 0 = 0 `mod` (x `mod` 0)+gcd x y = 0++gcd x 0 = 0 `mod` (0 `mod` x)+gcd x y = x++gcd x 0 = 0 `mod` (0 `mod` x)+gcd x y = y++gcd x 0 = 0 `mod` (0 `mod` x)+gcd x y = 0++gcd x 0 = (x `mod` x) `mod` x+gcd x y = x++gcd x 0 = (x `mod` x) `mod` x+gcd x y = y++gcd x 0 = (x `mod` x) `mod` x+gcd x y = 0++gcd x 0 = (x `mod` x) `mod` 0+gcd x y = x++gcd x 0 = (x `mod` x) `mod` 0+gcd x y = y++gcd x 0 = (x `mod` x) `mod` 0+gcd x y = 0++gcd x 0 = (x `mod` 0) `mod` x+gcd x y = x++gcd x 0 = (x `mod` 0) `mod` x+gcd x y = y++gcd x 0 = (x `mod` 0) `mod` x+gcd x y = 0++gcd x 0 = (x `mod` 0) `mod` 0+gcd x y = x++gcd x 0 = (x `mod` 0) `mod` 0+gcd x y = y++gcd x 0 = (x `mod` 0) `mod` 0+gcd x y = 0++gcd x 0 = (0 `mod` x) `mod` x+gcd x y = x++gcd x 0 = (0 `mod` x) `mod` x+gcd x y = y++gcd x 0 = (0 `mod` x) `mod` x+gcd x y = 0++gcd x 0 = (0 `mod` x) `mod` 0+gcd x y = x++gcd x 0 = (0 `mod` x) `mod` 0+gcd x y = y++gcd x 0 = (0 `mod` x) `mod` 0+gcd x y = 0++gcd 0 x = x+gcd x y = x `mod` (x `mod` x)++gcd 0 x = x+gcd x y = x `mod` (x `mod` y)++gcd 0 x = x+gcd x y = x `mod` (x `mod` 0)++gcd 0 x = x+gcd x y = x `mod` (y `mod` x)++gcd 0 x = x+gcd x y = x `mod` (y `mod` y)++gcd 0 x = x+gcd x y = x `mod` (y `mod` 0)++gcd 0 x = x+gcd x y = x `mod` (0 `mod` x)++gcd 0 x = x+gcd x y = x `mod` (0 `mod` y)++gcd 0 x = x+gcd x y = y `mod` (x `mod` x)++gcd 0 x = x+gcd x y = y `mod` (x `mod` y)++gcd 0 x = x+gcd x y = y `mod` (x `mod` 0)++gcd 0 x = x+gcd x y = y `mod` (y `mod` x)++gcd 0 x = x+gcd x y = y `mod` (y `mod` y)++gcd 0 x = x+gcd x y = y `mod` (y `mod` 0)++gcd 0 x = x+gcd x y = y `mod` (0 `mod` x)++gcd 0 x = x+gcd x y = y `mod` (0 `mod` y)++gcd 0 x = x+gcd x y = 0 `mod` (x `mod` x)++gcd 0 x = x+gcd x y = 0 `mod` (x `mod` y)++gcd 0 x = x+gcd x y = 0 `mod` (x `mod` 0)++gcd 0 x = x+gcd x y = 0 `mod` (y `mod` x)++gcd 0 x = x+gcd x y = 0 `mod` (y `mod` y)++gcd 0 x = x+gcd x y = 0 `mod` (y `mod` 0)++gcd 0 x = x+gcd x y = 0 `mod` (0 `mod` x)++gcd 0 x = x+gcd x y = 0 `mod` (0 `mod` y)++gcd 0 x = x+gcd x y = (x `mod` x) `mod` x++gcd 0 x = x+gcd x y = (x `mod` x) `mod` y++gcd 0 x = x+gcd x y = (x `mod` x) `mod` 0++gcd 0 x = x+gcd x y = (x `mod` y) `mod` x++gcd 0 x = x+gcd x y = (x `mod` y) `mod` y++gcd 0 x = x+gcd x y = (x `mod` y) `mod` 0++gcd 0 x = x+gcd x y = (x `mod` 0) `mod` x++gcd 0 x = x+gcd x y = (x `mod` 0) `mod` y++gcd 0 x = x+gcd x y = (x `mod` 0) `mod` 0++gcd 0 x = x+gcd x y = (y `mod` x) `mod` x++gcd 0 x = x+gcd x y = (y `mod` x) `mod` y++gcd 0 x = x+gcd x y = (y `mod` x) `mod` 0++gcd 0 x = x+gcd x y = (y `mod` y) `mod` x++gcd 0 x = x+gcd x y = (y `mod` y) `mod` y++gcd 0 x = x+gcd x y = (y `mod` y) `mod` 0++gcd 0 x = x+gcd x y = (y `mod` 0) `mod` x++gcd 0 x = x+gcd x y = (y `mod` 0) `mod` y++gcd 0 x = x+gcd x y = (y `mod` 0) `mod` 0++gcd 0 x = x+gcd x y = (0 `mod` x) `mod` x++gcd 0 x = x+gcd x y = (0 `mod` x) `mod` y++gcd 0 x = x+gcd x y = (0 `mod` x) `mod` 0++gcd 0 x = x+gcd x y = (0 `mod` y) `mod` x++gcd 0 x = x+gcd x y = (0 `mod` y) `mod` y++gcd 0 x = x+gcd x y = (0 `mod` y) `mod` 0++gcd 0 x = 0+gcd x y = x `mod` (x `mod` x)++gcd 0 x = 0+gcd x y = x `mod` (x `mod` y)++gcd 0 x = 0+gcd x y = x `mod` (x `mod` 0)++gcd 0 x = 0+gcd x y = x `mod` (y `mod` x)++gcd 0 x = 0+gcd x y = x `mod` (y `mod` y)++gcd 0 x = 0+gcd x y = x `mod` (y `mod` 0)++gcd 0 x = 0+gcd x y = x `mod` (0 `mod` x)++gcd 0 x = 0+gcd x y = x `mod` (0 `mod` y)++gcd 0 x = 0+gcd x y = y `mod` (x `mod` x)++gcd 0 x = 0+gcd x y = y `mod` (x `mod` y)++gcd 0 x = 0+gcd x y = y `mod` (x `mod` 0)++gcd 0 x = 0+gcd x y = y `mod` (y `mod` x)++gcd 0 x = 0+gcd x y = y `mod` (y `mod` y)++gcd 0 x = 0+gcd x y = y `mod` (y `mod` 0)++gcd 0 x = 0+gcd x y = y `mod` (0 `mod` x)++gcd 0 x = 0+gcd x y = y `mod` (0 `mod` y)++gcd 0 x = 0+gcd x y = 0 `mod` (x `mod` x)++gcd 0 x = 0+gcd x y = 0 `mod` (x `mod` y)++gcd 0 x = 0+gcd x y = 0 `mod` (x `mod` 0)++gcd 0 x = 0+gcd x y = 0 `mod` (y `mod` x)++gcd 0 x = 0+gcd x y = 0 `mod` (y `mod` y)++gcd 0 x = 0+gcd x y = 0 `mod` (y `mod` 0)++gcd 0 x = 0+gcd x y = 0 `mod` (0 `mod` x)++gcd 0 x = 0+gcd x y = 0 `mod` (0 `mod` y)++gcd 0 x = 0+gcd x y = (x `mod` x) `mod` x++gcd 0 x = 0+gcd x y = (x `mod` x) `mod` y++gcd 0 x = 0+gcd x y = (x `mod` x) `mod` 0++gcd 0 x = 0+gcd x y = (x `mod` y) `mod` x++gcd 0 x = 0+gcd x y = (x `mod` y) `mod` y++gcd 0 x = 0+gcd x y = (x `mod` y) `mod` 0++gcd 0 x = 0+gcd x y = (x `mod` 0) `mod` x++gcd 0 x = 0+gcd x y = (x `mod` 0) `mod` y++gcd 0 x = 0+gcd x y = (x `mod` 0) `mod` 0++gcd 0 x = 0+gcd x y = (y `mod` x) `mod` x++gcd 0 x = 0+gcd x y = (y `mod` x) `mod` y++gcd 0 x = 0+gcd x y = (y `mod` x) `mod` 0++gcd 0 x = 0+gcd x y = (y `mod` y) `mod` x++gcd 0 x = 0+gcd x y = (y `mod` y) `mod` y++gcd 0 x = 0+gcd x y = (y `mod` y) `mod` 0++gcd 0 x = 0+gcd x y = (y `mod` 0) `mod` x++gcd 0 x = 0+gcd x y = (y `mod` 0) `mod` y++gcd 0 x = 0+gcd x y = (y `mod` 0) `mod` 0++gcd 0 x = 0+gcd x y = (0 `mod` x) `mod` x++gcd 0 x = 0+gcd x y = (0 `mod` x) `mod` y++gcd 0 x = 0+gcd x y = (0 `mod` x) `mod` 0++gcd 0 x = 0+gcd x y = (0 `mod` y) `mod` x++gcd 0 x = 0+gcd x y = (0 `mod` y) `mod` y++gcd 0 x = 0+gcd x y = (0 `mod` y) `mod` 0++gcd 0 x = x `mod` x+gcd x y = x `mod` x++gcd 0 x = x `mod` x+gcd x y = x `mod` y++gcd 0 x = x `mod` x+gcd x y = x `mod` 0++gcd 0 x = x `mod` x+gcd x y = y `mod` x++gcd 0 x = x `mod` x+gcd x y = y `mod` 0++gcd 0 x = x `mod` x+gcd x y = 0 `mod` x++gcd 0 x = x `mod` x+gcd x y = 0 `mod` y++gcd 0 x = x `mod` 0+gcd x y = x `mod` x++gcd 0 x = x `mod` 0+gcd x y = x `mod` y++gcd 0 x = x `mod` 0+gcd x y = x `mod` 0++gcd 0 x = x `mod` 0+gcd x y = y `mod` y++gcd 0 x = x `mod` 0+gcd x y = 0 `mod` x++gcd 0 x = x `mod` 0+gcd x y = 0 `mod` y++gcd 0 x = 0 `mod` x+gcd x y = x `mod` x++gcd 0 x = 0 `mod` x+gcd x y = x `mod` 0++gcd 0 x = 0 `mod` x+gcd x y = y `mod` x++gcd 0 x = 0 `mod` x+gcd x y = y `mod` y++gcd 0 x = 0 `mod` x+gcd x y = y `mod` 0++gcd 0 x = 0 `mod` x+gcd x y = 0 `mod` x++gcd 0 x = x `mod` (x `mod` x)+gcd x y = x++gcd 0 x = x `mod` (x `mod` x)+gcd x y = y++gcd 0 x = x `mod` (x `mod` x)+gcd x y = 0++gcd 0 x = x `mod` (x `mod` 0)+gcd x y = x++gcd 0 x = x `mod` (x `mod` 0)+gcd x y = y++gcd 0 x = x `mod` (x `mod` 0)+gcd x y = 0++gcd 0 x = x `mod` (0 `mod` x)+gcd x y = x++gcd 0 x = x `mod` (0 `mod` x)+gcd x y = y++gcd 0 x = x `mod` (0 `mod` x)+gcd x y = 0++gcd 0 x = 0 `mod` (x `mod` x)+gcd x y = x++gcd 0 x = 0 `mod` (x `mod` x)+gcd x y = y++gcd 0 x = 0 `mod` (x `mod` x)+gcd x y = 0++gcd 0 x = 0 `mod` (x `mod` 0)+gcd x y = x++gcd 0 x = 0 `mod` (x `mod` 0)+gcd x y = y++gcd 0 x = 0 `mod` (x `mod` 0)+gcd x y = 0++gcd 0 x = 0 `mod` (0 `mod` x)+gcd x y = x++gcd 0 x = 0 `mod` (0 `mod` x)+gcd x y = y++gcd 0 x = 0 `mod` (0 `mod` x)+gcd x y = 0++gcd 0 x = (x `mod` x) `mod` x+gcd x y = x++gcd 0 x = (x `mod` x) `mod` x+gcd x y = y++gcd 0 x = (x `mod` x) `mod` x+gcd x y = 0++gcd 0 x = (x `mod` x) `mod` 0+gcd x y = x++gcd 0 x = (x `mod` x) `mod` 0+gcd x y = y++gcd 0 x = (x `mod` x) `mod` 0+gcd x y = 0++gcd 0 x = (x `mod` 0) `mod` x+gcd x y = x++gcd 0 x = (x `mod` 0) `mod` x+gcd x y = y++gcd 0 x = (x `mod` 0) `mod` x+gcd x y = 0++gcd 0 x = (x `mod` 0) `mod` 0+gcd x y = x++gcd 0 x = (x `mod` 0) `mod` 0+gcd x y = y++gcd 0 x = (x `mod` 0) `mod` 0+gcd x y = 0++gcd 0 x = (0 `mod` x) `mod` x+gcd x y = x++gcd 0 x = (0 `mod` x) `mod` x+gcd x y = y++gcd 0 x = (0 `mod` x) `mod` x+gcd x y = 0++gcd 0 x = (0 `mod` x) `mod` 0+gcd x y = x++gcd 0 x = (0 `mod` x) `mod` 0+gcd x y = y++gcd 0 x = (0 `mod` x) `mod` 0+gcd x y = 0++gcd x 0 = x+gcd x y = gcd x (x `mod` y)++gcd x 0 = x+gcd x y = gcd x (y `mod` y)++gcd x 0 = x+gcd x y = gcd y (x `mod` x)++gcd x 0 = x+gcd x y = gcd y (x `mod` y)++gcd x 0 = x+gcd x y = gcd y (y `mod` x)++gcd x 0 = x+gcd x y = gcd y (y `mod` y)++gcd x 0 = x+gcd x y = gcd 0 (x `mod` y)++gcd x 0 = x+gcd x y = gcd 0 (y `mod` y)++gcd x 0 = x+gcd x y = gcd (x `mod` x) x++gcd x 0 = x+gcd x y = gcd (x `mod` x) y++gcd x 0 = x+gcd x y = gcd (x `mod` y) x++gcd x 0 = x+gcd x y = gcd (y `mod` x) x++gcd x 0 = x+gcd x y = gcd (y `mod` x) y++gcd x 0 = x+gcd x y = gcd (y `mod` y) x++gcd 0 x = x+gcd x y = gcd x (x `mod` y)++gcd 0 x = x+gcd x y = gcd x (y `mod` y)++gcd 0 x = x+gcd x y = gcd y (x `mod` x)++gcd 0 x = x+gcd x y = gcd y (x `mod` y)++gcd 0 x = x+gcd x y = gcd y (y `mod` x)++gcd 0 x = x+gcd x y = gcd y (y `mod` y)++gcd 0 x = x+gcd x y = gcd (x `mod` x) x++gcd 0 x = x+gcd x y = gcd (x `mod` x) y++gcd 0 x = x+gcd x y = gcd (x `mod` x) 0++gcd 0 x = x+gcd x y = gcd (x `mod` y) x++gcd 0 x = x+gcd x y = gcd (y `mod` x) x++gcd 0 x = x+gcd x y = gcd (y `mod` x) y++gcd 0 x = x+gcd x y = gcd (y `mod` x) 0++gcd 0 x = x+gcd x y = gcd (y `mod` y) x
bench/carry-on.hs view
@@ -15,8 +15,8 @@ main = do -- carry on Conjuring larger implementations conjure "factorial n" factorial- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)
bench/carry-on.txt view
@@ -2,46 +2,46 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 23 candidates of size 5+-- 0 candidates of size 6+-- 147 candidates of size 7+-- tested 173 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) --- 203 candidates of size 8--- tested 254 candidates+-- 8 candidates of size 8+-- tested 182 candidates factorial 1 = 1 factorial x = x * factorial (x - 1) --- 1048 candidates of size 9--- tested 547 candidates+-- 941 candidates of size 9+-- tested 1115 candidates factorial 0 = 0 factorial 1 = 1 factorial x = x * factorial (x - 1) --- tested 555 candidates+-- tested 1123 candidates factorial 0 = 1 factorial 1 = 1 factorial x = x * factorial (x - 1) --- 1299 candidates of size 10--- 7200 candidates of size 11--- tested 3213 candidates+-- 49 candidates of size 10+-- 6490 candidates of size 11+-- tested 7239 candidates factorial 0 = 1 factorial x = x + x * (factorial (x - 1) - 1) --- tested 3393 candidates+-- tested 7421 candidates factorial 0 = 1 factorial x = x - x * (1 - factorial (x - 1)) --- tested 3516 candidates+-- tested 7544 candidates factorial 0 = 1 factorial x = (0 - x) * (0 - factorial (x - 1)) --- tested 10001 candidates+-- tested 7667 candidates factorial n = undefined -- search exhausted
bench/erroneous.hs view
@@ -58,44 +58,44 @@ let n = 6 printErroneousCandidates (n+1) "foo" (undefined :: Int -> Int)- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (2 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int)+ , con (2 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ] printErroneousCandidates n "?" (undefined :: Int -> Int -> Int)- [ unfun (0 :: Int)+ [ con (0 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "dec" (subtract 1 :: Int -> Int) ] printErroneousCandidates (n+1) "goo" (undefined :: [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printErroneousCandidates n "??" (undefined :: [Int] -> [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printErroneousCandidates n "ton" (undefined :: Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not ] printErroneousCandidates n "&|" (undefined :: Bool -> Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not
bench/erroneous.txt view
@@ -138,6 +138,30 @@ -- 1 ? 0 = bottom -- and 16 other errors x ? 0 = x+x ? y = dec (dec x ? y)+-- 0 ? 1 = bottom -- and 16 other errors++x ? 0 = 0+x ? y = dec (dec x ? y)+-- 0 ? 1 = bottom -- and 16 other errors++x ? 0 = dec x+x ? y = dec x ? y+-- 0 ? 1 = bottom -- and 16 other errors++0 ? x = x+x ? y = dec (x ? dec y)+-- 1 ? 0 = bottom -- and 16 other errors++0 ? x = 0+x ? y = dec (x ? dec y)+-- 1 ? 0 = bottom -- and 16 other errors++0 ? x = dec x+x ? y = x ? dec y+-- 1 ? 0 = bottom -- and 16 other errors++x ? 0 = x x ? y = x ? dec (dec y) -- 0 ? 1 = bottom -- and 9 other errors @@ -208,30 +232,6 @@ 0 ? x = x x ? y = dec (dec y) ? x -- 1 ? 0 = bottom -- and 6 other errors--x ? 0 = x-x ? y = dec (dec x ? y)--- 0 ? 1 = bottom -- and 16 other errors--x ? 0 = 0-x ? y = dec (dec x ? y)--- 0 ? 1 = bottom -- and 16 other errors--x ? 0 = dec x-x ? y = dec x ? y--- 0 ? 1 = bottom -- and 16 other errors--0 ? x = x-x ? y = dec (x ? dec y)--- 1 ? 0 = bottom -- and 16 other errors--0 ? x = 0-x ? y = dec (x ? dec y)--- 1 ? 0 = bottom -- and 16 other errors--0 ? x = dec x-x ? y = x ? dec y--- 1 ? 0 = bottom -- and 16 other errors Erroneous candidates for: goo :: [Int] -> [Int]
bench/gps.hs view
@@ -44,10 +44,10 @@ gps1c30p :: IO () gps1c30p = conjure "gps1" gps1p- [ unfun (0 :: Float)- , unfun (1 :: Float)- , unfun (1/2 :: Float)- , unfun (-1 :: Float)+ [ con (0 :: Float)+ , con (1 :: Float)+ , con (1/2 :: Float)+ , con (-1 :: Float) , fun "+" ((+) :: Float -> Float -> Float) , fun "*" ((*) :: Float -> Float -> Float) , fun "-" ((-) :: Float -> Float -> Float)@@ -56,9 +56,9 @@ , fun "id" (id :: Float -> Float) , fun "fromIntegral" (fromIntegral :: Int -> Float) - , unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (-1 :: Int)+ , con (0 :: Int)+ , con (1 :: Int)+ , con (-1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)@@ -71,8 +71,8 @@ , fun "round" (round :: Float -> Int) , fun "truncate" (truncate :: Float -> Int) - , unfun False- , unfun True+ , con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not@@ -95,17 +95,16 @@ gps2c :: IO () gps2c = conjure "gps2" gps2p- [ unfun "small"- , unfun "large"- , unfun (1000 :: Int)- , unfun (2000 :: Int)+ [ con "small"+ , con "large"+ , con (1000 :: Int)+ , con (2000 :: Int) , fun "Just" (Just :: String -> Maybe String) , fun "Nothing" (Nothing :: Maybe String) , fun "<=" ((<=) :: Int -> Int -> Bool) , fun "<" ((<) :: Int -> Int -> Bool)- , iif (undefined :: Maybe String)+ , guard , maxTests 5040- , maxSize 30 ] @@ -117,27 +116,28 @@ gps3g1 start end step = enumFromThenTo start (step+start) (end-1) gps3g2 :: Int -> Int -> Int -> [Int]-gps3g2 start end step = if start < end- then start : gps3g2 (start+step) end step- else []+gps3g2 start end step+ | start < end = start : gps3g2 (start+step) end step -- 11+ | otherwise = [] -- 12 gps3c :: IO () gps3c = do conjure "gps3" gps3p- [ unfun (1 :: Int)+ [ con (1 :: Int) , fun "enumFromThenTo" ((\x y z -> take 720 $ enumFromThenTo x y z) :: Int -> Int -> Int -> [Int]) , fun "+" ((+) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ] -- not possible, no recursive descent- conjure "gps3" gps3p- [ unfun ([] :: [Int])+ conjure "gps3_alt" gps3p+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "+" ((+) :: Int -> Int -> Int) , fun "<" ((<) :: Int -> Int -> Bool)- , iif (undefined :: [Int])- , maxSize 8+ , guard+ , dontRequireDescent+ -- TODO: shouldn't a solution appear here? ] @@ -170,27 +170,43 @@ gps5p " " = " " gps5p "!" = "!!!" gps5p "aa" = "aaaa"+gps5p " a" = " aa"+gps5p "!a" = "!!!aa" gps5g :: String -> String-gps5g [] = []+gps5g "" = "" gps5g (c:cs) | isLetter c = c:c:gps5g cs | c == '!' = c:c:c:gps5g cs | otherwise = c:gps5g cs gps5c :: IO ()-gps5c = conjure "gps5" gps5p -- can't find- [ unfun ""+gps5c = conjure "gps5" gps5p+ [ con "" , fun ":" ((:) :: Char -> String -> String)- , unfun '!'+ , con '!' , fun "==" ((==) :: Char -> Char -> Bool) , fun "isLetter" (isLetter :: Char -> Bool)- , iif (undefined :: String -> String)- , maxSize 6+ , guard+ -- BENCHMARK: increase to 26 to find+ , maxSize 12 -- 26 ]+ -- found (lapmatrud unplugged):+ -- -- 65.5s, 10856 candidates of size 26+ -- -- 65.5s, tested 20317 candidates+ -- gps5 "" = ""+ -- gps5 (c:cs)+ -- | isLetter c = c:c:gps5 cs+ -- | c == '!' = c:c:c:gps5 cs+ -- | otherwise = c:gps5 cs + -- GPS Benchmark #6 -- Collatz/Hailstone numbers --+-- Given an integer, find the number of terms in the Collatz (hailstone)+-- sequence starting from that integer.+-- NOTE: The sequence is actually always infinite,+-- so I assume it is the count until reaching 1. gps6p :: Int -> Int gps6p 1 = 1@@ -212,26 +228,71 @@ then n `div` 2 -- 10 else 3*n + 1) -- 15 --- This one is out of reach performance wise:--- Speculate hangs with this background.--- Removing three or setting maxEqSize to 4 makes it unhang.--- But a size of 15 or 17 is simplyl out of our reach.+nextCollatz' :: Int -> Int+nextCollatz' 1 = 4+nextCollatz' 2 = 1+nextCollatz' 3 = 10+nextCollatz' 4 = 2+nextCollatz' 5 = 16+nextCollatz' 6 = 3++nextCollatz :: Int -> Int+nextCollatz n+ | even n = n `div` 2+ | otherwise = 3*n + 1+ gps6c :: IO ()-gps6c = conjure "gps6" gps6p- [ unfun (1 :: Int)- , unfun (2 :: Int)- , unfun (3 :: Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun "*" ((*) :: Int -> Int -> Int)- , fun "`div`" (div :: Int -> Int -> Int)- , fun "even" (even :: Int -> Bool)- , iif (undefined :: Int)- , maxSize 6- , maxEquationSize 3- ]+gps6c = do+ -- This one is out of reach performance wise:+ -- Speculate hangs with this background.+ -- Removing three or setting maxEqSize to 4 makes it unhang.+ -- But a size of 15 or 17 is simplyl out of our reach.+ conjure "gps6direct" gps6p+ [ con (1 :: Int)+ , con (2 :: Int)+ , con (3 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "*" ((*) :: Int -> Int -> Int)+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "even" (even :: Int -> Bool)+ , iif (undefined :: Int)+ , maxSize 6+ , maxEquationSize 3 -- degenerate case in Speculate+ ] + conjure "gps6step" gps6p+ [ con (1 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "nextCollatz" nextCollatz+ , dontRequireDescent+ ] + conjure "nextCollatz" nextCollatz+ [ con (1 :: Int)+ , con (2 :: Int)+ , con (3 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "*" ((*) :: Int -> Int -> Int)+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "even" (even :: Int -> Bool)+ , guard+ , target 720720+ , maxEquationSize 3 -- degenerate case in Speculate+ -- BENCHMARK: set maxSize 11+ , maxSize 6 -- 11+ ]+ -- -- on lapmatrud (2025-08), found after+ -- -- 18.5s, 754952 candidates of size 11+ -- -- 19.4s, tested 568616 candidates+ -- nextCollatz x+ -- | even x = x `div` 2+ -- | otherwise = 1 + x * 3++ -- GPS Benchmark #7 -- Replace Space with Newline (P 4.3)+-- Given a string input, print the string, replacing spaces with newlines.+-- Also, return the integer count of the non-whitespace characters.+-- The input string will not have tabs or newlines. gps7p :: String -> (String, Int) gps7p "a" = ("a", 1)@@ -301,7 +362,7 @@ gps9c :: IO () gps9c = conjure "gps9" gps9p- [ unfun (1 :: Int)+ [ con (1 :: Int) , fun "map" (map :: (Int -> Int) -> [Int] -> [Int]) , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int]) , fun ".." (enumFromTo :: Int -> Int -> [Int])@@ -353,31 +414,31 @@ gps10c :: IO () gps10c = do conjure "wallisNext" wallisNextP- [ unfun (1 :: Integer)- , unfun (2 :: Integer)+ [ con (1 :: Integer)+ , con (2 :: Integer) , fun "+" ((+) :: Integer -> Integer -> Integer) , fun "*" ((*) :: Integer -> Integer -> Integer) , fun "%" ((%) :: Integer -> Integer -> Rational) , fun "<" ((<) :: Integer -> Integer -> Bool) -- , fun "numerator" (numerator :: Rational -> Integer) -- , fun "denominator" (denominator :: Rational -> Integer)- , iif (undefined :: Rational)+ , guard ] -- simplified background conjure "wallisNext" wallisNextP- [ unfun (0 :: Integer)- , unfun (1 :: Integer)+ [ con (0 :: Integer)+ , con (1 :: Integer) , fun "+" ((+) :: Integer -> Integer -> Integer) , fun "*" ((*) :: Integer -> Integer -> Integer) , fun "%" ((%) :: Integer -> Integer -> Rational) ] conjure "gps10" gps10p- [ unfun (2 :: Integer)- , unfun (3 :: Integer)+ [ con (2 :: Integer)+ , con (3 :: Integer) , fun "%" ((%) :: Integer -> Integer -> Rational)--- , unfun (2/3 :: Rational)+-- , con (2/3 :: Rational) , fun "product" (product :: [Rational] -> Rational) , fun "take" (take :: Int -> [Rational] -> [Rational]) , fun "iterate" ((\f -> take 720 . iterate f) :: (Rational -> Rational) -> Rational -> [Rational])@@ -409,7 +470,7 @@ ] conjure "gps11" gps11p- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) , fun "length" (length :: String -> Int)@@ -438,8 +499,8 @@ , fun "fromJust" (fromJust :: Maybe Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) , fun "==" ((==) :: Int -> Int -> Bool)- , unfun (0 :: Int)- , unfun (1 :: Int)+ , con (0 :: Int)+ , con (1 :: Int) , maxSize 11 ] @@ -496,9 +557,9 @@ gps14c :: IO () gps14c = do conjure "odd" odd'- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (2 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int)+ , con (2 :: Int) , fun "`mod`" (mod :: Int -> Int -> Int) , fun "/=" ((/=) :: Int -> Int -> Bool) ]@@ -513,13 +574,13 @@ -- gps14 [] = 0 -- gps14 (x:xs) = x `mod` 2 + gps14 xs conjure "gps14" gps14p- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (2 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int)+ , con (2 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "`mod`" (mod :: Int -> Int -> Int) , fun "==" ((==) :: Int -> Int -> Bool)- , iif (undefined :: Int)+ , guard ] @@ -577,8 +638,8 @@ gps17c :: IO () gps17c = conjure "gps17" gps17p- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)@@ -602,7 +663,7 @@ gps18c :: IO () gps18c = do conjure "gps18" gps18p- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun "+" ((+) :: Int -> Int -> Int) , fun ":" ((:) :: Int -> [Int] -> [Int]) ]@@ -692,19 +753,19 @@ gps20c :: IO () gps20c = do conjure "isVowel" isVowel'- [ unfun 'a'- , unfun 'e'- , unfun 'i'- , unfun 'o'- , unfun 'u'- , unfun 'y'- , unfun True- , unfun False+ [ con 'a'+ , con 'e'+ , con 'i'+ , con 'o'+ , con 'u'+ , con 'y'+ , con True+ , con False ] conjureFromSpec "pig1" pig1Spec- [ unfun "ay"- , iif (undefined :: String)+ [ con "ay"+ , guard , fun "isVowel" isVowel , fun "++" ((++) :: String -> String -> String) , fun ":" ((:) :: Char -> String -> String)@@ -727,6 +788,7 @@ gps21p [-1] = [0] gps21p [1,-1] = [1,0] gps21p [-1,1] = [0,1]+gps21p [-1,-1] = [0,0] gps21g :: [Int] -> [Int] gps21g [] = []@@ -734,11 +796,11 @@ gps21c :: IO () gps21c = conjure "gps21" gps21p- [ unfun ([] :: [Int])- , unfun (0 :: Int)+ [ con ([] :: [Int])+ , con (0 :: Int) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "<" ((<) :: Int -> Int -> Bool)- , iif (undefined :: Int)+ , guard ] @@ -778,8 +840,16 @@ gps22c :: IO () gps22c = do+ conjure "scrabble1" scrabble1 $+ [ con (1 :: Int)+ -- comment-out the following to find function+ -- at size 137 after 1025 candidates in 6.0s+ -- limited here for faster runtimes+ , maxSize 13+ ] ++ map con "dgbcmpfhvwykjxqz"+ conjureFromSpec "gps22" gps22s- [ unfun (0 :: Int)+ [ con (0 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "map" (map :: (Int -> Int) -> [Int] -> [Int]) , fun "scrabble1" scrabble1@@ -808,14 +878,19 @@ gps24c :: IO () gps24c = conjure "gps24" gps24p- [ unfun ' '- , unfun (64 :: Int)+ [ con ' '+ , con (64 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "`mod`" (mod :: Int -> Int -> Int) , fun "sum" (sum :: [Int] -> Int) , fun "ord" ord , fun "chr" chr , fun "map" (map :: (Char -> Int) -> String -> [Int])++ -- The following flag is here so behaviour is consistent between different+ -- GHC versions (8.8 and later). It makes no significant difference in+ -- runtime for this example.+ , maxEarlyTests 0 ] @@ -834,12 +909,12 @@ -- out of reach performance-wise gps25c :: IO ()-gps25c = conjure "gps25" gps25p $ take 0- [ unfun (0 :: Int)- , unfun (10 :: Int)- , unfun ([] :: [Int])+gps25c = conjure "gps25" gps25p+ [ con (0 :: Int)+ , con (10 :: Int)+ , con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int])- , iif (undefined :: [Int])+ , guard , fun "abs" (abs :: Int -> Int) , fun "<" ((<) :: Int -> Int -> Bool) , fun "rem" (rem :: Int -> Int -> Int)@@ -858,48 +933,57 @@ gps26g :: Int -> Int -> Int -> Int -> Int -> Char gps26g a b c d x- | x >= a = 'A'- | x >= b = 'B'- | x >= c = 'C'- | x >= d = 'D'- | otherwise = 'F'+ | x >= a = 'A' -- 5+ | x >= b = 'B' -- 10+ | x >= c = 'C' -- 15+ | x >= d = 'D' -- 20+ | otherwise = 'F' -- 21 --- out of reach performance-wise+-- out of reach performance-wise, OOM at size 21, see:+-- -- 20.6s, 4000000 candidates of size 16+-- -- 38.2s, 0 candidates of size 20+-- gps: out of memory+ gps26c :: IO () gps26c = conjure "gps26" gps26p- [ unfun 'A'- , unfun 'B'- , unfun 'C'- , unfun 'D'- , unfun 'F'- , iif (undefined :: Char)+ [ con 'A'+ , con 'B'+ , con 'C'+ , con 'D'+ , con 'F'+ , guard , fun ">=" ((>=) :: Int -> Int -> Bool)- , maxSize 2 ] -- GPS Benchmark #27 -- Median --+-- Given three integers, print their median. gps27p :: Int -> Int -> Int -> Int gps27p 0 1 2 = 1+gps27p 0 2 1 = 1+gps27p 2 3 1 = 2 gps27p 1 0 2 = 1-gps27p (-1) 1 0 = 0+gps27p 4 3 1 = 3+gps27p 4 1 3 = 3 gps27g :: Int -> Int -> Int -> Int gps27g x y z- | y < x && x < z = x -- 8- | x < y && y < z = y -- 16- | otherwise = z -- 17--- Conjure found a smaller implementation!+ | y <= x && x <= z || z <= x && x <= y = x -- 16+ | x <= y && y <= z || z <= y && y <= x = y -- 32+ | otherwise = z -- 33 gps27c :: IO () gps27c = do- conjure "gps27" gps27p- [ fun "<" ((<) :: Int -> Int -> Bool)+ -- simply unreachable performance-wise+ -- it gets OOM at size 25 after >83s.+ conjure "gps27_median" gps27p+ [ fun "<=" ((<=) :: Int -> Int -> Bool) , fun "&&" (&&)- , iif (undefined :: Int)+ , fun "||" (||)+ , guard ] - conjure "gps27b" gps27p+ conjure "gps27b_median" gps27p [ fun "min" (min :: Int -> Int -> Int) , fun "max" (max :: Int -> Int -> Int) ]@@ -938,10 +1022,10 @@ gps29c :: IO () gps29c = conjureFromSpec "gps29" gps29s- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int->Int->Int)- , iif (undefined :: Int)+ , guard , fun "isVowel" isVowel ]
bench/gps.txt view
@@ -6,28 +6,29 @@ -- 1 candidates of size 3 -- 2 candidates of size 4 -- tested 4 candidates-gps1 x y = fromIntegral x + y+gps1 x y = y + fromIntegral x gps2 :: Int -> Maybe [Char] -- testing 6 combinations of argument values -- pruning with 9/17 rules -- 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 3+-- 0 candidates of size 4+-- 0 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"- else if x < 1000 then Just "small" else Nothing+-- 16 candidates of size 8+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 0 candidates of size 11+-- 256 candidates of size 12+-- 640 candidates of size 13+-- tested 664 candidates+gps2 x+ | 2000 <= x = Just "large"+ | 1000 <= x = Nothing+ | otherwise = Just "small" gps3 :: Int -> Int -> Int -> [Int] -- testing 2 combinations of argument values@@ -39,11 +40,11 @@ -- 0 candidates of size 5 -- 1248 candidates of size 6 -- 0 candidates of size 7--- 17008 candidates of size 8--- tested 12358 candidates+-- 13680 candidates of size 8+-- tested 3238 candidates gps3 x y z = enumFromThenTo x (x + z) (y - 1) -gps3 :: Int -> Int -> Int -> [Int]+gps3_alt :: Int -> Int -> Int -> [Int] -- testing 2 combinations of argument values -- pruning with 6/18 rules -- 1 candidates of size 1@@ -54,8 +55,13 @@ -- 0 candidates of size 6 -- 81 candidates of size 7 -- 36 candidates of size 8--- tested 136 candidates-gps3 = undefined -- search exhausted+-- 441 candidates of size 9+-- 432 candidates of size 10+-- 2403 candidates of size 11+-- 3636 candidates of size 12+-- 13311 candidates of size 13+-- tested 20359 candidates+gps3_alt = undefined -- search exhausted gps4 :: [Char] -> [Char] -> [Char] -> Bool -- testing 9 combinations of argument values@@ -75,29 +81,60 @@ 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+-- testing 7 combinations of argument values+-- pruning with 5/6 rules -- 2 candidates of size 1 -- 0 candidates of size 2 -- 2 candidates of size 3 -- 0 candidates of size 4--- 4 candidates of size 5+-- 3 candidates of size 5 -- 0 candidates of size 6--- tested 8 candidates+-- 3 candidates of size 7+-- 0 candidates of size 8+-- 3 candidates of size 9+-- 2 candidates of size 10+-- 6 candidates of size 11+-- 5 candidates of size 12+-- tested 26 candidates gps5 = undefined -- search exhausted -gps6 :: Int -> Int+gps6direct :: Int -> Int -- testing 9 combinations of argument values -- pruning with 16/18 rules -- 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-gps6 = undefined -- search exhausted+-- 0 candidates of size 2+-- 12 candidates of size 3+-- 0 candidates of size 4+-- 172 candidates of size 5+-- 0 candidates of size 6+-- tested 188 candidates+gps6direct = undefined -- search exhausted +gps6step :: Int -> Int+-- testing 9 combinations of argument values+-- pruning with 4/8 rules+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 3 candidates of size 3+-- 4 candidates of size 4+-- 12 candidates of size 5+-- 27 candidates of size 6+-- tested 46 candidates+gps6step 1 = 1+gps6step x = 1 + gps6step (nextCollatz x)++nextCollatz :: Int -> Int+-- testing 360 combinations of argument values+-- pruning with 16/18 rules+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 12 candidates of size 3+-- 0 candidates of size 4+-- 172 candidates of size 5+-- 0 candidates of size 6+-- tested 188 candidates+nextCollatz = undefined -- search exhausted+ gps7 :: [Char] -> ([Char],Int) -- testing 4 combinations of argument values -- pruning with 5/10 rules@@ -112,7 +149,7 @@ -- 88 candidates of size 9 -- 201 candidates of size 10 -- 442 candidates of size 11--- tested 546 candidates+-- tested 553 candidates gps7 cs = (init (unlines (words cs)),length (filter (not . isSpace) cs)) gps8 :: [Char] -> [Char] -> [(Int,Char,Char)]@@ -135,10 +172,10 @@ -- 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+-- 69 candidates of size 8+-- 114 candidates of size 9+-- 212 candidates of size 10+-- tested 278 candidates gps9 x = filter even (filter (x >) (map sq [1..x])) wallisNext :: Ratio Integer -> Ratio Integer@@ -147,12 +184,12 @@ -- 1 candidates of size 1 -- 0 candidates of size 2 -- 3 candidates of size 3--- 0 candidates of size 4+-- 15 candidates of size 4 -- 4 candidates of size 5--- 0 candidates of size 6+-- 86 candidates of size 6 -- 5 candidates of size 7--- 1 candidates of size 8--- tested 14 candidates+-- 513 candidates of size 8+-- tested 368 candidates wallisNext (x % y) = (y + 1) % (x + 1) wallisNext :: Ratio Integer -> Ratio Integer@@ -161,12 +198,12 @@ -- 1 candidates of size 1 -- 0 candidates of size 2 -- 4 candidates of size 3--- 0 candidates of size 4+-- 16 candidates of size 4 -- 3 candidates of size 5--- 0 candidates of size 6+-- 71 candidates of size 6 -- 5 candidates of size 7--- 1 candidates of size 8--- tested 14 candidates+-- 393 candidates of size 8+-- tested 295 candidates wallisNext (x % y) = (y + 1) % (x + 1) gps10 :: Int -> Ratio Integer@@ -201,10 +238,10 @@ -- 0 candidates of size 3 -- 0 candidates of size 4 -- 0 candidates of size 5--- 2 candidates of size 6+-- 1 candidates of size 6 -- 0 candidates of size 7 -- 1 candidates of size 8--- tested 4 candidates+-- tested 3 candidates gps11 [] = [] gps11 (cs:css) = gps11 css ++ [length cs] @@ -222,8 +259,8 @@ -- 416 candidates of size 9 -- 956 candidates of size 10 -- 3073 candidates of size 11--- tested 4404 candidates-gps12 xs = (length xs - fromJust (findIndex (0 ==) (reverse xs))) - 1+-- tested 1713 candidates+gps12 xs = (length xs - 1) - fromJust (findIndex (0 ==) (reverse xs)) gps13 :: [Ratio Integer] -> Ratio Integer -- testing 3 combinations of argument values@@ -234,9 +271,9 @@ -- 2 candidates of size 4 -- 9 candidates of size 5 -- 12 candidates of size 6--- 67 candidates of size 7--- 97 candidates of size 8--- tested 179 candidates+-- 63 candidates of size 7+-- 95 candidates of size 8+-- tested 106 candidates gps13 qs = foldr (+) 0 qs / fromIntegral (length qs) odd :: Int -> Bool@@ -245,9 +282,9 @@ -- 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+-- 0 candidates of size 4+-- 35 candidates of size 5+-- tested 15 candidates odd x = 0 /= x `mod` 2 gps14 :: [Int] -> Int@@ -270,7 +307,7 @@ -- 30 candidates of size 5 -- 6 candidates of size 6 -- 345 candidates of size 7--- tested 83 candidates+-- tested 46 candidates gps14 [] = 0 gps14 (x:xs) = x + gps14 xs `mod` 2 @@ -299,15 +336,15 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 23 candidates of size 5+-- 0 candidates of size 6+-- 147 candidates of size 7+-- 8 candidates of size 8+-- 941 candidates of size 9+-- tested 1032 candidates gps17 0 = 0 gps17 x = x * x + gps17 (x - 1) @@ -319,11 +356,11 @@ -- 0 candidates of size 3 -- 10 candidates of size 4 -- 25 candidates of size 5--- 34 candidates of size 6--- 138 candidates of size 7--- 126 candidates of size 8--- 743 candidates of size 9--- tested 767 candidates+-- 24 candidates of size 6+-- 114 candidates of size 7+-- 72 candidates of size 8+-- 481 candidates of size 9+-- tested 250 candidates gps18 [] xs = xs gps18 (x:xs) [] = xs gps18 (x:xs) (y:ys) = x + y:gps18 xs ys@@ -335,7 +372,7 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 10 candidates of size 4--- tested 10 candidates+-- tested 4 candidates gps18 = zipWith (+) gps19 :: Int -> [Char] -> [Char]@@ -350,28 +387,28 @@ -- testing 12 combinations of argument values -- pruning with 0/0 rules -- 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+-- 0 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+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 0 candidates of size 11+-- 0 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+-- 0 candidates of size 19+-- 0 candidates of size 20+-- 0 candidates of size 21 -- 1 candidates of size 22--- tested 65 candidates+-- tested 3 candidates isVowel 'a' = True isVowel 'e' = True isVowel 'i' = True@@ -389,18 +426,18 @@ -- 13 candidates of size 5 -- 28 candidates of size 6 -- 46 candidates of size 7--- 125 candidates of size 8--- 200 candidates of size 9--- 625 candidates of size 10--- 1066 candidates of size 11--- 3459 candidates of size 12--- 6361 candidates of size 13--- 20207 candidates of size 14--- tested 27628 candidates+-- 115 candidates of size 8+-- 176 candidates of size 9+-- 441 candidates of size 10+-- 708 candidates of size 11+-- 1747 candidates of size 12+-- 2919 candidates of size 13+-- 6925 candidates of size 14+-- tested 8943 candidates pig1 "" = "ay"-pig1 (c:cs) = if isVowel c- then (c:cs) ++ "ay"- else cs ++ (c:"ay")+pig1 (c:cs)+ | isVowel c = (c:cs) ++ "ay"+ | otherwise = cs ++ (c:"ay") gps20c :: [Char] -> [Char] -- pruning with 1/1 rules@@ -413,22 +450,46 @@ gps20c cs = unwords (map pig1 (words cs)) gps21 :: [Int] -> [Int]--- testing 4 combinations of argument values+-- testing 5 combinations of argument values -- pruning with 4/4 rules -- 2 candidates of size 1 -- 0 candidates of size 2 -- 2 candidates of size 3 -- 0 candidates of size 4--- 4 candidates of size 5+-- 2 candidates of size 5 -- 0 candidates of size 6--- 8 candidates of size 7+-- 2 candidates of size 7 -- 0 candidates of size 8--- 16 candidates of size 9--- 4 candidates of size 10--- tested 34 candidates+-- 2 candidates of size 9+-- 0 candidates of size 10+-- 6 candidates of size 11+-- 0 candidates of size 12+-- 8 candidates of size 13+-- tested 19 candidates gps21 [] = []-gps21 (x:xs) = (if x < 0 then 0 else x):gps21 xs+gps21 (x:xs)+ | x < 0 = 0:gps21 xs+ | otherwise = x:gps21 xs +scrabble1 :: Char -> Int+-- testing 97 combinations of argument values+-- pruning with 0/0 rules+-- 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+-- 0 candidates of size 6+-- 0 candidates of size 7+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 0 candidates of size 11+-- 0 candidates of size 12+-- 0 candidates of size 13+-- tested 1 candidates+scrabble1 = undefined -- search exhausted+ gps22 :: [Char] -> Int -- pruning with 5/9 rules -- 1 candidates of size 1@@ -448,23 +509,33 @@ -- testing 4 combinations of argument values -- pruning with 15/19 rules -- 1 candidates of size 1--- 1 candidates of size 2--- 0 candidates of size 3+-- 2 candidates of size 2+-- 3 candidates of size 3 -- 2 candidates of size 4--- 2 candidates of size 5--- 2 candidates of size 6--- 14 candidates of size 7--- 25 candidates of size 8--- 71 candidates of size 9--- 176 candidates of size 10--- tested 245 candidates+-- 8 candidates of size 5+-- 13 candidates of size 6+-- 30 candidates of size 7+-- 75 candidates of size 8+-- 193 candidates of size 9+-- 469 candidates of size 10+-- tested 376 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--- 0 candidates of size 1--- tested 0 candidates+-- pruning with 32/37 rules+-- reasoning produced 1 incorrect properties, please re-run with more tests for faster results+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 1 candidates of size 4+-- 21 candidates of size 5+-- 30 candidates of size 6+-- 259 candidates of size 7+-- 695 candidates of size 8+-- 4225 candidates of size 9+-- 15042 candidates of size 10+-- tested 20277 candidates gps25 = undefined -- search exhausted gps26 :: Int -> Int -> Int -> Int -> Int -> Char@@ -472,12 +543,21 @@ -- pruning with 4/4 rules -- 5 candidates of size 1 -- 0 candidates of size 2--- tested 5 candidates+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 400 candidates of size 6+-- 0 candidates of size 7+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 40000 candidates of size 11+-- tested 40405 candidates gps26 = undefined -- search exhausted -gps27 :: Int -> Int -> Int -> Int--- testing 3 combinations of argument values--- pruning with 14/18 rules+gps27_median :: Int -> Int -> Int -> Int+-- testing 6 combinations of argument values+-- pruning with 32/42 rules -- 3 candidates of size 1 -- 0 candidates of size 2 -- 0 candidates of size 3@@ -487,23 +567,30 @@ -- 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- else x+-- 180 candidates of size 10+-- 648 candidates of size 11+-- 0 candidates of size 12+-- 0 candidates of size 13+-- 1440 candidates of size 14+-- 6480 candidates of size 15+-- 11664 candidates of size 16+-- tested 20451 candidates+gps27_median = undefined -- search exhausted -gps27b :: Int -> Int -> Int -> Int--- testing 3 combinations of argument values+gps27b_median :: Int -> Int -> Int -> Int+-- testing 6 combinations of argument values -- pruning with 20/30 rules -- 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)+-- 0 candidates of size 6+-- 63 candidates of size 7+-- 0 candidates of size 8+-- 342 candidates of size 9+-- tested 376 candidates+gps27b_median x y z = min (max x y) (max z (min x y)) gps28 :: Int -> Int -> Int -> Int -> Int -- testing 5 combinations of argument values@@ -527,9 +614,12 @@ -- 2 candidates of size 5 -- 6 candidates of size 6 -- 10 candidates of size 7--- 8 candidates of size 8--- 24 candidates of size 9--- tested 36 candidates+-- 4 candidates of size 8+-- 12 candidates of size 9+-- 26 candidates of size 10+-- tested 55 candidates gps29 "" = 0-gps29 (c:cs) = (if isVowel c then 1 else 0) + gps29 cs+gps29 (c:cs)+ | isVowel c = 1 + gps29 cs+ | otherwise = gps29 cs
− bench/gps2.hs
@@ -1,784 +0,0 @@--- gps2.hs: General Program Synthesis Benchmark Suite II------ Copyright (C) 2021-2025 Rudy Matela--- Distributed under the 3-Clause BSD licence (see the file LICENSE).-{-# LANGUAGE CPP, TemplateHaskell #-}-import Conjure-import System.Environment (getArgs)--import Data.List (findIndex, inits) -- for #1-import Data.Char (toUpper) -- for #4-import Data.Ratio ((%)) -- for #7-import Data.List (findIndices, tails, isPrefixOf) -- for #12-import Data.Maybe (fromJust) -- for #23-import Test.LeanCheck -- for #24-import Data.Express -- for #24---gps1p :: [Int] -> Maybe Int-gps1p [0,-1,2] = Just 1-gps1p [-1,0,1] = Just 0-gps1p [0,-1] = Just 1-gps1p [1,-1,-1] = Just 2--gps1g :: [Int] -> Maybe Int-gps1g xs = findIndex (0 >) (map sum (tail (inits xs)))--gps1p2 :: Int -> [Int] -> Int-gps1p2 0 [0,-1,2] = 1-gps1p2 0 [-1,0,1] = 0-gps1p2 0 [0,-1] = 1-gps1p2 0 [1,-1,-1] = 2-gps1p2 0 [0,0,0,-1] = 3-gps1p2 0 [1,0,0,-2] = 3---- efficient gps1, unreachable performance-wise-gps1g2 :: Int -> [Int] -> Int-gps1g2 t [] = undefined -- 1-gps1g2 t (x:xs) = if t + x < 0 -- 7- then 0 -- 8- else 1 + gps1g2 (t + x) xs -- 15--gps1c :: IO ()-gps1c = do- conjure "gps1" gps1p- [ unfun (0 :: Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun ">" ((>) :: Int -> Int -> Bool)- , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)- , fun "sum" (sum :: [Int] -> Int)- , fun "findIndex" (findIndex :: (Int -> Bool) -> [Int] -> Maybe Int)- , fun "map" (map :: ([Int] -> Int) -> [[Int]] -> [Int])- , fun "inits" (inits :: [Int] -> [[Int]])- , fun "tail" (tail :: [[Int]] -> [[Int]])- ]-- conjure "gps1" gps1p- [ unfun (0 :: Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun ">" ((>) :: Int -> Int -> Bool)- , fun "sum" (sum :: [Int] -> Int)- , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)- , fun "findIndex" (findIndex :: (Int -> Bool) -> [Int] -> Maybe Int)- , fun "map" (map :: ([Int] -> Int) -> [[Int]] -> [Int])- , fun "inits" (inits :: [Int] -> [[Int]])- , fun "tail" (tail :: [[Int]] -> [[Int]])- ]-- conjure "gps1" gps1p2- [ unfun (0 :: Int)- , unfun (1 :: Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun "<" ((<) :: Int -> Int -> Bool)- , iif (undefined :: Int)- , fun "undefined" (undefined :: Int)- , maxSize 4- , maxEquationSize 4- ]---gps2p :: Double -> Double -> Int -> Double-gps2p 2 1 1 = 2 + 1-gps2p 2 1 2 = 2 + 1 + 1 + 0.5-gps2p 2 1 3 = 2 + 1 + 1 + 0.5 + 0.5 + 0.25-gps2p 3 1 1 = 3 + 1-gps2p 3 1 2 = 3 + 1 + 1/3---- apex to apex-gps2g :: Double -> Double -> Int -> Double-gps2g h0 h1 0 = h0 + h1-gps2g h0 h1 n = h0 + h1 + gps2g h1 (h1 * (h1 / h0)) (n - 1)--- size 17, out of reach performance-wise--gps2c :: IO ()-gps2c = do- conjure "gps2" gps2p- [ unfun (0 :: Int)- , unfun (1 :: Int)- , fun "*" ((*) :: Double -> Double -> Double)- , fun "/" ((/) :: Double -> Double -> Double)- , fun "+" ((+) :: Double -> Double -> Double)- , fun "-" ((-) :: Double -> Double -> Double)- , maxSize 6- ]---gps3p :: String -> Int-gps3p "X X X X X X X X X XXX" = 300-gps3p "11 11 11 11 11 11 11 11 11 11" = 20---- unreachable performance wise--- I presume a correct solution would need around 30 symbols-gps3c :: IO ()-gps3c = conjure "gps3" gps3p []------ GPS #4: https://www.codewars.com/kata/517abf86da9663f1d2000003--- Here we're using the problem description as in the GPS2 paper--- considering we're getting input as kebab-case.--- Nevertheless, this one is out of reach performance-wise (and OOM-wise)--gps4s :: (String -> String) -> [Property]-gps4s g =- [ property $ g "the-stealth-warrior" == "theStealthWarrior"- , property $ g "camel-case" == "camelCase"- , property $ g "Kebab-Case" == "KebabCase"- ]--gps4g :: String -> String-gps4g "" = ""--- gps4g ('-':c:cs) = toUpper c : gps4g cs--- gps4g ('_':c:cs) = toUpper c : gps4g cs-gps4g (c:cs) = if c == '-' -- 5- then if null cs -- 8- then "" -- 9- else toUpper (head cs) : gps4g (tail cs) -- 16- else c : gps4g cs -- 19--gps4c :: IO ()-gps4c = do- conjureFromSpec "gps4" gps4s- [ unfun '-'- , unfun ("" :: String)- , fun ":" ((:) :: Char -> String -> String)- , fun "==" ((==) :: Char -> Char -> Bool)- , fun "head" (head :: String -> Char)- , fun "tail" (tail :: String -> String)- , iif (undefined :: Char)- , iif (undefined :: String)- , fun "toUpper" (toUpper :: Char -> Char)- , maxSize 6- ]----- GPS #5: Coin Sums--- https://projecteuler.net/problem=31------ The problem description is inconsistent with the one given in the paper.------ Paper: change-making problem in USD--- Euler: How many different ways can £2 be made using any number of coins?------ I'm considering the Paper to be canonical, as the one in Project Euler can be solved by a constant function:------ solution :: Int--- solution = 6378216738 -- <-- arbitrary example here, I didn't run the numbers-gps5p :: Int -> [Int]-gps5p 100 = [4, 0, 0, 0]-gps5p 50 = [2, 0, 0, 0]-gps5p 25 = [1, 0, 0, 0]-gps5p 30 = [1, 0, 1, 0]-gps5p 20 = [0, 2, 0, 0]-gps5p 3 = [0, 0, 0, 3]--gps5s :: ([Int] -> Int -> [Int]) -> [Property]-gps5s t =- [ property $ t [25, 10, 5, 1] 100 == [4, 0, 0, 0]- , property $ t [25, 10, 5, 1] 50 == [2, 0, 0, 0]- , property $ t [25, 10, 5, 1] 25 == [1, 0, 0, 0]- , property $ t [25, 10, 5, 1] 30 == [1, 0, 1, 0]- , property $ t [25, 10, 5, 1] 20 == [0, 2, 0, 0]- , property $ t [25, 10, 5, 1] 3 == [0, 0, 0, 3]- ]--coins :: [Int]-coins = [25, 10, 5, 1]--gps5g :: Int -> [Int]-gps5g = tell coins--tell :: [Int] -> Int -> [Int]-tell [] a = []-tell (n:ns) a = a `div` n : tell ns (a `mod` n)--gps5c :: IO ()-gps5c = do- -- cannot conjure directly due to needing to introduce a local definition- conjure "gps5" gps5p- [- ]-- conjureFromSpec "tell" gps5s- [ unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "`div`" (div :: Int -> Int -> Int)- , fun "`mod`" (mod :: Int -> Int -> Int)- ]-- conjure "gps5" gps5p- [ unfun coins- , fun "tell" tell- ]-- conjure "gps5" gps5p- [ unfun (1 :: Int)- , unfun (5 :: Int)- , unfun (10 :: Int)- , unfun (25 :: Int)- , unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "tell" tell- , target 50400- ]----- GPS2#6: Cut Vector-gps6g :: [Int] -> Int-gps6g xs = snd- $ minimum- [ (abs (sum xs0 - sum xs1), i)- | i <- [0 .. length xs]- , let (xs0, xs1) = splitAt i xs- ]---- not Conjurable due to needing local definition--- I conjecture it _perhaps-maybe_ this could be done in 3 steps,--- but I'll leave this as-is for now.-gps6c :: IO ()-gps6c =- conjure "gps6" gps6g []----- GPS2#7: Dice Game--- https://projecteuler.net/problem=31--- https://github.com/thelmuth/Clojush/blob/psb2-v1.0/src/clojush/problems/psb2/dice_game.clj--- again, paper and problem are inconsistent, going with paper-gps7p :: Integer -> Integer -> Rational-gps7p 4 6 = 1 % 4-gps7p 6 4 = 7 % 12-gps7p 2 4 = 1 % 8-gps7p 4 2 = 5 % 8-gps7p 2 6 = 1 % 12-gps7p 6 2 = 3 % 4--gps7g :: Integer -> Integer -> Rational-gps7g peter colin = sum (map (min colin) [0 .. (peter-1)]) % (colin*peter)---- out of reach performance-wise-gps7c :: IO ()-gps7c = do- conjure "gps7" gps7p $ take 0- [ unfun (0 :: Integer)- , unfun (1 :: Integer)- , fun "%" ((%) :: Integer -> Integer -> Rational)- , fun "+" ((+) :: Integer -> Integer -> Integer)- , fun "-" ((-) :: Integer -> Integer -> Integer)- , fun "*" ((*) :: Integer -> Integer -> Integer)- , fun "min" (min :: Integer -> Integer -> Integer)- , fun ".." (enumFromTo :: Integer -> Integer -> [Integer])- , fun "map" (map :: (Integer -> Integer) -> [Integer] -> [Integer])- , fun "sum" (sum :: [Integer] -> Integer)- , maxSize 6- ]---gps8p :: Int -> [Int] -> (Int,Int)-gps8p 2 [1,1,2] = (1,1)-gps8p 3 [1,1,2] = (1,2)-gps8p 2 [0,1,0,2] = (0,2)--gps8g :: Int -> [Int] -> (Int,Int)-gps8g x xs = head [(y,z) | y <- xs, z <- xs, y + z == x]--- this one could be generated but is a bit of a stretch...--- it is unintuitive to provide the given symbols--- gps8g :: Int -> [Int] -> (Int,Int)--- gps8g x xs = head $ filter ((x ==) . uncurry (+)) $ liftA2 (,) xs xs--gps8c :: IO ()-gps8c = conjure "gps8" gps8p []----- GPSB#9: Fizz Buzz (CW)-gps9p :: Int -> String-gps9p 3 = "Fizz"-gps9p 4 = "4"-gps9p 5 = "Buzz"-gps9p 6 = "Fizz"-gps9p 10 = "Buzz"-gps9p 15 = "FizzBuzz"-gps9p 17 = "17"--gps9g :: Int -> String-gps9g x- | x `div` 3 == 0 = "Fizz" -- 7- | x `div` 5 == 0 = "Buzz" -- 14- | x `div` 3 == 0 && x `div` 5 == 0 = "FizzBuzz" -- 27- | otherwise = show x -- 29---- probably unreachable performance-wise-gps9c :: IO ()-gps9c = conjure "gps9" gps9p []---gps10p :: [Int] -> Int-gps10p [0] = -2-gps10p [3] = -1-gps10p [6] = 0-gps10p [9] = 1-gps10p [0,3] = -3-gps10p [3,0] = -3-gps10p [3,2,1] = -5-gps10p [1,2,3] = -5-gps10p [10,20,30] = 13---- does not do rounding-gps10g :: [Int] -> Int-gps10g [] = 0-gps10g (x:xs) = (x `div` 3 - 2) + gps10g xs---- unreachable due to lambda-gps10c :: IO ()-gps10c = conjure "gps10" gps10p- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (2 :: Int)- , unfun (3 :: Int)- , fun "`div`" (div :: Int -> Int -> Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun "-" ((-) :: Int -> Int -> Int)- , target 50400- ]---gps11p :: Int -> Int -> Int-gps11p = gcd'- where- gcd' :: Int -> Int -> Int- gcd' 1 1 = 1- gcd' 1 2 = 1- gcd' 2 1 = 1- gcd' 2 2 = 2- gcd' 2 6 = 2- gcd' 6 2 = 2- gcd' 3 6 = 3- gcd' 6 3 = 3- gcd' 6 9 = 3- gcd' 9 6 = 3- gcd' 12 18 = 6--gps11c :: IO ()-gps11c = conjure "gcd a b" gps11p- [ unfun (0::Int)- , fun "`mod`" (mod :: Int -> Int -> Int)- ]- -- generated function:- -- gcd x 0 = x- -- gcd x y = gcd y (x `mod` y)---gps12p :: String -> String -> [Int]-gps12p "a" "a" = [0]-gps12p "aa" "a" = [0,1]-gps12p "aa" "aa" = [0]-gps12p "a a" "a" = [0,2]-gps12p "b" "a" = []--gps12g :: String -> String -> [Int]-gps12g s s' = findIndices (s' `isPrefixOf`) (tails s)--gps12c :: IO ()-gps12c = conjure "gps12" gps12p- [ fun "findIndices" (findIndices :: (String -> Bool) -> [String] -> [Int])- , fun "`isPrefixOf`" (isPrefixOf :: String -> String -> Bool)- , fun "tails" (tails :: String -> [String])- ]---gps13p :: [Int] -> [Int]-gps13p [0,1] = [1]-gps13p [1,0] = [1,0]-gps13p [2,0,1] = [2,1]-gps13p [1,0,1] = [1]--gps13g :: [Int] -> [Int]-gps13g = leaders- where- leaders [] = []- leaders (x:xs) = if all (x >) xs- then x : leaders xs- else leaders xs--gps13c :: IO ()-gps13c = conjure "gps13_leaders" gps13p- [ unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun ">" ((>) :: Int -> Int -> Bool)- , fun "all" (all :: (Int -> Bool) -> [Int] -> Bool)- , iif (undefined :: [Int])- ]---gps14p :: [Int] -> Int-gps14p = undefined---- 30 symbols-gps14g :: [Int] -> Int-gps14g = luhn- where- luhn :: [Int] -> Int- luhn xs = sum (firsts xs ++ map double9 (seconds xs))- where- double9 :: Int -> Int- double9 x = if xx > 9- then xx - 9- else xx- where- xx = x * 2- seconds :: [Int] -> [Int]- seconds [] = []- seconds (x:y:xs) = y : seconds xs- firsts :: [Int] -> [Int]- firsts [] = []- firsts (x:y:xs) = x : seconds xs---- cannot Conjure directly-gps14c :: IO ()-gps14c = conjure "gps14_luhn" gps14p- [- ]---gps15p :: () -> ()-gps15p = undefined---- skipped-gps15c :: IO ()-gps15c = conjure "gps15_mastermind" gps15p []---gps16p :: String -> String-gps16p "a" = "a"-gps16p "aaa" = "a"-gps16p "aa" = "aa"-gps16p "a a" = " "-gps16p " a " = "a"-gps16p "a a " = " a"-gps16p " a a " = " "--gps16g1 :: String -> String-gps16g1 s = if odd len- then take 1 (drop (len `div` 2) s)- else take 2 (drop (len `div` 2 - 1) s)- where- len = length s--gps16g2 :: String -> String-gps16g2 "" = ""-gps16g2 (c:cs) = if length cs <= 1- then c : cs- else gps16g2 (init cs)--gps16c :: IO ()-gps16c = conjure "gps16_middle" gps16p- [ unfun ""- , unfun (1 :: Int)- , fun "<=" ((<=) :: Int -> Int -> Bool)- , fun ":" ((:) :: Char -> String -> String)- , fun "length" (length :: String -> Int)- , fun "init" (init :: String -> String)- , iif (undefined :: String)- ]---gps17p :: [Int] -> Int-gps17p [0,1,0] = 0-gps17p [1,1] = 1-gps17p [1,1,0] = 1-gps17p [0,1,1] = 1-gps17p [1,1,1] = 2--gps17g :: [Int] -> Int-gps17g xs = pds xs- where- pds [] = 0- pds (x:xs) = if not (null xs) && x == head xs- then x + pds xs- else pds xs--- surprise:--- gps17_pds [] = 0--- gps17_pds (x:xs) = (if not (null xs) && head xs == x then x else 0) + gps17_pds xs----- can generate at size 15 in 18 seconds--- setting limit of 5 for faster automated tests--- BENCHMARK: increase maxSize from 5 to 18-gps17c :: IO ()-gps17c = conjure "gps17_pds" gps17p- [ unfun (0 :: Int)- , iif (undefined :: Int)- , fun "not" not- , fun "null" (null :: [Int] -> Bool)- , fun "==" ((==) :: Int -> Int -> Bool)- , fun "head" (head :: [Int] -> Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun "&&" (&&)- , maxSize 5- ]---gps18p :: [Double] -> [Double] -> Double-gps18p [1.0] [0.5] = 0.5-gps18p [2.0] [0.5] = 1.0-gps18p [1.0,1.0] [0.5,0.0] = 1.5-gps18p [1.0,1.0] [0.0,0.5] = 1.5--gps18g :: [Double] -> [Double] -> Double-gps18g prices discounts = foldr (+) 0 (zipWith (*) prices (map (1-) discounts))---- this was OOM'd-gps18c :: IO ()-gps18c = conjure "gps18_price" gps18p- [ unfun (0 :: Double)- , unfun (1 :: Double)- , fun "+" ((+) :: Double -> Double -> Double)- , fun "*" ((*) :: Double -> Double -> Double)- , fun "-" ((-) :: Double -> Double -> Double)--- , fun "foldr" (foldr :: (Double -> Double -> Double) -> Double -> [Double] -> Double)--- , fun "zipWith" (zipWith :: (Double -> Double -> Double) -> [Double] -> [Double] -> [Double])--- , fun "map" (map :: (Double -> Double) -> [Double] -> [Double])- , maxSize 6- ]---gps19p :: Int -> Double -> Double -> Double -> Double-gps19p 0 0 1.0 1.0 = 0-gps19p 1 0 1.0 1.0 = 0-gps19p 2 0 1.0 1.0 = 0-gps19p 1 0 1.0 2.0 = 1.0-gps19p 2 0 1.0 2.0 = 2.0-gps19p 1 0 0.5 1.0 = 0.5-gps19p 2 0 0.5 1.0 = 1.0--gps19g :: Int -> Double -> Double -> Double -> Double-gps19g 0 total melt fall = total-gps19g n total melt fall = gps19p (n-1) (max 0 (total-melt+fall)) melt fall--- size 14, out of reach performance wise.--gps19c :: IO ()-gps19c = conjure "gps19_snowday" gps19p- [ unfun (0 :: Int)- , unfun (1 :: Int)- , fun "max" (max :: Double -> Double -> Double)- , fun "+" ((+) :: Double -> Double -> Double)- , fun "-" ((-) :: Double -> Double -> Double)- , maxSize 6- ]---gps20p :: String -> Bool-gps20p = undefined--gps20c :: IO ()-gps20c = conjure "gps20" gps20p- [- ]---gps21s :: (String -> String) -> [Property]-gps21s s =- [ property $ s "word" == "word"- , property $ s "words" == "sdrow"- , property $ s "word words" == "word sdrow"- , property $ s "words word" == "sdrow word"- ]--spinSpec :: (String -> String) -> [Property]-spinSpec spin =- [ property $ spin "abc" == "abc"- , property $ spin "abcd" == "abcd"- , property $ spin "word" == "word"- , property $ spin "abcde" == "edcba"- , property $ spin "words" == "sdrow"- , property $ spin "hello" == "olleh"- , property $ spin "world" == "dlrow"- ]--spin :: String -> String-spin w = if length w >= 5- then reverse w- else w--gps21g :: String -> String-gps21g s = unwords (map spin (words s))--gps21c :: IO ()-gps21c = do- conjureFromSpec "spin" spinSpec- [ fun "length" (length :: String -> Int)- , fun "reverse" (reverse :: String -> String)- , iif (undefined :: String)- , fun ">=" ((>=) :: Int -> Int -> Bool)- , unfun (5 :: Int)- ]-- conjureFromSpec "gps21_spinwords" gps21s- [ fun "words" words- , fun "unwords" unwords- , fun "spin" (spin :: String -> String)- , fun "map" (map :: (String -> String) -> [String] -> [String])- , fun "length" (length :: String -> Int)- , fun "reverse" (reverse :: String -> String)- , iif (undefined :: String)- , fun ">=" ((>=) :: Int -> Int -> Bool)- , unfun (5 :: Int)- ]---digits :: Int -> [Int]-digits 0 = []-digits n = n `mod` 10 : digits (n `div` 10)--digits' :: Int -> [Int]-digits' 1 = [1]-digits' 12 = [2,1]-digits' 21 = [1,2]-digits' 123 = [3,2,1]-digits' 321 = [1,2,3]--gps22p :: Int -> String-gps22p = undefined--gps22c :: IO ()-gps22c = do- -- cannot conjure at size 13, maybe beyond?- conjure "digits" digits'- [ unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "`div`" (div :: Int -> Int -> Int)- , fun "`mod`" (mod :: Int -> Int -> Int)- , fun "div10" ((`div` 10) :: Int -> Int)- , unfun (10 :: Int)- , target 10080- ]-- conjure "gps22" gps22p- [- ]---gps23s :: (String -> String -> String -> String) -> [Property]-gps23s s =- [ property $ s "abcd" "abcd" "abcd" == "abcd"- , property $ s "abcd" "dcba" "abcd" == "dcba"- , property $ s "abcd" "1234" "abcd" == "1234"- , property $ s "abcd" "1234" "bacd" == "2134"- ]--gps23g :: String -> String -> String -> String--- gps23g f t s = map (\c -> fromJust $ c `lookup` zipWith (,) f t) s-gps23g f t s = map (fromJust . (`lookup` zipWith (,) f t)) s--gps23c :: IO ()-gps23c = do- -- cannot conjure, needs lambda- conjureFromSpec "gps23" gps23s- [- ]---data Twitter = Tweet Int- | TooMany- | Empty- deriving (Eq, Show)--deriveExpress ''Twitter-deriveListable ''Twitter-deriveName ''Twitter--instance Conjurable Twitter where- conjureExpress = reifyExpress- conjureEquality = reifyEquality- conjureTiers = reifyTiers--gps24g_twitter :: String -> Twitter-gps24g_twitter "" = Empty-gps24g_twitter s = if length s > 140- then TooMany- else Tweet (length s)--gps24s_twitter :: (String -> Twitter) -> [Property]-gps24s_twitter twitter =- [ property $ twitter "" == Empty- , property $ twitter "abcd" == Tweet 4- , property $ twitter "0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij" == Tweet 140- , property $ twitter "0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghijX" == TooMany- ]--gps24c :: IO ()-gps24c = do- conjureFromSpec "gps24" gps24s_twitter- [ unfun Empty- , unfun TooMany- , fun "Tweet" Tweet- , iif (undefined :: Twitter)- , unfun ""- , fun ":" ((:) :: Char -> String -> String)- , fun "length" (length :: String -> Int)- , unfun (140 :: Int)- , fun ">" ((>) :: Int -> Int -> Bool)- ]---gps25p :: [Double] -> [Double] -> Double-gps25p [0] [1] = 1-gps25p [1] [0] = 1-gps25p [-1] [1] = 2-gps25p [0,1] [1,0] = sqrt 2-gps25p [1,0] [0,1] = sqrt 2-gps25p [0,0,1] [1,0,0] = sqrt 2-gps25p [0,1,2] [1,2,3] = sqrt 3--gps25g :: [Double] -> [Double] -> Double-gps25g v1 v2 = sqrt (foldr (+) 0 (map (^2) (zipWith (-) v1 v2)))---- out of reach performance-wise-gps25c :: IO ()-gps25c = conjure "gps25" gps25p- [ unfun (0 :: Double)- , unfun (2 :: Double)- , fun "+" ((+) :: Double -> Double -> Double)- , fun "-" ((-) :: Double -> Double -> Double)- , fun "**" ((**) :: Double -> Double -> Double)- , fun "zipWith" (zipWith :: (Double -> Double -> Double) -> [Double] -> [Double] -> [Double])- , fun "map" (map :: (Double -> Double) -> [Double] -> [Double])- , fun "sqrt" (sqrt :: Double -> Double)- , maxSize 6- ]---main :: IO ()-main = do- as <- getArgs- case as of- [] -> sequence_ gpss- (n:_) -> gpss !! (read n - 1)---gpss :: [IO ()]-gpss = [ gps1c- , gps2c- , gps3c- , gps4c- , gps5c- , gps6c- , gps7c- , gps8c- , gps9c- , gps10c- , gps11c- , gps12c- , gps13c- , gps14c- , gps15c- , gps16c- , gps17c- , gps18c- , gps19c- , gps20c- , gps21c- , gps22c- , gps23c- , gps24c- , gps25c- ]
− bench/gps2.txt
@@ -1,367 +0,0 @@-gps1 :: [Int] -> Maybe Int--- testing 4 combinations of argument values--- pruning with 11/21 rules--- 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--- 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--- 4 candidates of size 1--- 0 candidates of size 2--- 11 candidates of size 3--- 29 candidates of size 4--- tested 44 candidates-gps1 = undefined -- search exhausted--gps2 :: Double -> Double -> Int -> Double--- testing 5 combinations of argument values--- pruning with 2/6 rules--- 2 candidates of size 1--- 2 candidates of size 2--- 16 candidates of size 3--- 64 candidates of size 4--- 256 candidates of size 5--- 1252 candidates of size 6--- tested 1592 candidates-gps2 = undefined -- search exhausted--gps3 :: [Char] -> Int-gps3 = error "could not reify specification, suggestion: conjureFromSpec"--gps4 :: [Char] -> [Char]--- pruning with 13/21 rules--- 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-gps4 = undefined -- search exhausted--gps5 :: Int -> [Int]--- testing 6 combinations of argument values--- pruning with 0/0 rules--- 0 candidates of size 1--- tested 0 candidates-gps5 = undefined -- search exhausted--tell :: [Int] -> Int -> [Int]--- pruning with 0/0 rules--- 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)--gps5 :: Int -> [Int]--- testing 6 combinations of argument values--- pruning with 0/0 rules--- 1 candidates of size 1--- 0 candidates of size 2--- 1 candidates of size 3--- tested 2 candidates-gps5 = tell [25,10,5,1]--gps5 :: Int -> [Int]--- testing 6 combinations of argument values--- pruning with 12/12 rules--- 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 = tell [25,10,5,1]--gps6 :: [Int] -> Int--- testing 360 combinations of argument values--- pruning with 0/0 rules--- 0 candidates of size 1--- 0 candidates of size 2--- tested 0 candidates-gps6 = undefined -- search exhausted--gps7 :: Integer -> Integer -> Ratio Integer--- testing 6 combinations of argument values--- pruning with 0/0 rules--- 0 candidates of size 1--- tested 0 candidates-gps7 = undefined -- search exhausted--gps8 :: Int -> [Int] -> (Int,Int)--- testing 3 combinations of argument values--- pruning with 0/0 rules--- 0 candidates of size 1--- 0 candidates of size 2--- tested 0 candidates-gps8 = undefined -- search exhausted--gps9 :: Int -> [Char]--- testing 7 combinations of argument values--- pruning with 0/0 rules--- 0 candidates of size 1--- tested 0 candidates-gps9 = undefined -- search exhausted--gps10 :: [Int] -> Int--- testing 7 combinations of argument values--- pruning with 67/100 rules--- 4 candidates of size 1--- 0 candidates of size 2--- 0 candidates of size 3--- 0 candidates of size 4--- 80 candidates of size 5--- 8 candidates of size 6--- 1428 candidates of size 7--- 432 candidates of size 8--- 30712 candidates of size 9--- tested 7064 candidates-gps10 [] = 0-gps10 (x:xs) = (x `div` 3 - 2) + gps10 xs--gcd :: Int -> Int -> Int--- testing 11 combinations of argument values--- pruning with 0/0 rules--- 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)--gps12 :: [Char] -> [Char] -> [Int]--- testing 5 combinations of argument values--- pruning with 1/2 rules--- 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--- 2 candidates of size 1--- 0 candidates of size 2--- 0 candidates of size 3--- 0 candidates of size 4--- 1 candidates of size 5--- 0 candidates of size 6--- 1 candidates of size 7--- 0 candidates of size 8--- 7 candidates of size 9--- 4 candidates of size 10--- 33 candidates of size 11--- 18 candidates of size 12--- tested 53 candidates-gps13_leaders [] = []-gps13_leaders (x:xs) = if all (x >) xs- then x:gps13_leaders xs- else gps13_leaders xs--gps14_luhn :: [Int] -> Int-gps14_luhn = error "could not reify specification, suggestion: conjureFromSpec"--gps15_mastermind :: () -> ()-gps15_mastermind = error "could not reify specification, suggestion: conjureFromSpec"--gps16_middle :: [Char] -> [Char]--- testing 7 combinations of argument values--- pruning with 10/11 rules--- 2 candidates of size 1--- 2 candidates of size 2--- 2 candidates of size 3--- 3 candidates of size 4--- 6 candidates of size 5--- 11 candidates of size 6--- 23 candidates of size 7--- 62 candidates of size 8--- 175 candidates of size 9--- 489 candidates of size 10--- 1346 candidates of size 11--- 3709 candidates of size 12--- tested 2390 candidates-gps16_middle "" = ""-gps16_middle (c:cs) = if length cs <= 1- then c:cs- else gps16_middle (init cs)--gps17_pds :: [Int] -> Int--- testing 5 combinations of argument values--- pruning with 29/40 rules--- 1 candidates of size 1--- 1 candidates of size 2--- 0 candidates of size 3--- 0 candidates of size 4--- 2 candidates of size 5--- tested 4 candidates-gps17_pds = undefined -- search exhausted--gps18_price :: [Double] -> [Double] -> Double--- testing 4 combinations of argument values--- pruning with 26/35 rules--- 2 candidates of size 1--- 0 candidates of size 2--- 2 candidates of size 3--- 0 candidates of size 4--- 33 candidates of size 5--- 176 candidates of size 6--- tested 213 candidates-gps18_price = undefined -- search exhausted--gps19_snowday :: Int -> Double -> Double -> Double -> Double--- testing 7 combinations of argument values--- pruning with 6/19 rules--- 3 candidates of size 1--- 2 candidates of size 2--- 21 candidates of size 3--- 39 candidates of size 4--- 312 candidates of size 5--- 659 candidates of size 6--- tested 1036 candidates-gps19_snowday = undefined -- search exhausted--gps20 :: [Char] -> Bool-gps20 = error "could not reify specification, suggestion: conjureFromSpec"--spin :: [Char] -> [Char]--- pruning with 6/6 rules--- reasoning produced 1 incorrect properties, please re-run with more tests for faster results--- 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- else cs--gps21_spinwords :: [Char] -> [Char]--- pruning with 16/16 rules--- reasoning produced 2 incorrect properties, please re-run with more tests for faster results--- 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--- 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-digits = undefined -- search exhausted--gps22 :: Int -> [Char]-gps22 = error "could not reify specification, suggestion: conjureFromSpec"--gps23 :: [Char] -> [Char] -> [Char] -> [Char]--- pruning with 0/0 rules--- 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-gps23 = undefined -- search exhausted--gps24 :: [Char] -> Twitter--- pruning with 4/8 rules--- reasoning produced 4 incorrect properties, please re-run with more tests for faster results--- 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--- 216 candidates of size 10--- 308 candidates of size 11--- 466 candidates of size 12--- tested 881 candidates-gps24 "" = Empty-gps24 (c:cs) = if 140 > length cs- then Tweet (length (c:cs))- else TooMany--gps25 :: [Double] -> [Double] -> Double--- testing 6 combinations of argument values--- pruning with 31/59 rules--- 2 candidates of size 1--- 1 candidates of size 2--- 5 candidates of size 3--- 10 candidates of size 4--- 76 candidates of size 5--- 438 candidates of size 6--- tested 532 candidates-gps25 = undefined -- search exhausted-
+ bench/i12.hs view
@@ -0,0 +1,71 @@+-- 12 background ingredients+--+-- Copyright (C) 2021-2025 Rudy Matela+-- Distributed under the 3-Clause BSD licence (see the file LICENSE).+import Conjure+import System.Environment++factorial :: Int -> Int+factorial 0 = 1+factorial 1 = 1+factorial 2 = 2+factorial 3 = 6+factorial 4 = 24+factorial 5 = 120++count' :: Int -> [Int] -> Int+count' 0 [0] = 1+count' 0 [1] = 0+count' 1 [0] = 0+count' 1 [1] = 1+count' 0 [0,0] = 2+count' 0 [0,1] = 1+count' 0 [1,2] = 0+count' 1 [0,0] = 0+count' 1 [0,1] = 1+count' 1 [1,2] = 1+count' 0 [0,0,0] = 3+count' 0 [0,0,1] = 2+count' 0 [1,0,0] = 2++main :: IO ()+main = do+ putStrLn $ "running with " ++ show (length ingredients) ++ " ingredients"+ as <- getArgs+ case as of+ ["factorial"] -> conjure "factorial n" factorial ingredients+ ["factorial","t"] -> conjure "factorial n" factorial $ ingredients ++ [maxSize 1]+ ["sum"] -> conjure "sum" (sum :: [Int] -> Int) ingredients+ ["sum","t"] -> conjure "sum" (sum :: [Int] -> Int) $ ingredients ++ [maxSize 1]+ ["product"] -> conjure "product" (product :: [Int] -> Int) ingredients+ ["product","t"] -> conjure "product" (product :: [Int] -> Int) $ ingredients ++ [maxSize 1]+ ["length"] -> conjure "length" (length :: [Int] -> Int) ingredients+ ["length","t"] -> conjure "length" (length :: [Int] -> Int) $ ingredients ++ [maxSize 1]+ ["count"] -> conjure "count" count' $ ingredients ++ primsCount+ ["count","t"] -> conjure "count" count' $ ingredients ++ primsCount ++ [maxSize 1]+ _ -> conjure "factorial n" factorial ingredients++ingredients :: [Ingredient]+ingredients =+ [ con (0::Int)+ , con (1::Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "*" ((*) :: Int -> Int -> Int)+ , fun "dec" (subtract 1 :: Int -> Int)++ , fun "==" ((==) :: Int -> Int -> Bool)++ , con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "head" (head :: [Int] -> Int)+ , fun "tail" (tail :: [Int] -> [Int])+ , fun "null" (null :: [Int] -> Bool)+ , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)+ , fun ".." (enumFromTo :: Int -> Int -> [Int])+ ]++primsCount :: [Ingredient]+primsCount =+ [ fun "length" (length :: [Int] -> Int)+ , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])+ ]
+ bench/i12.txt view
@@ -0,0 +1,13 @@+running with 13 ingredients+factorial :: Int -> Int+-- testing 6 combinations of argument values+-- pruning with 67/101 rules+-- 3 candidates of size 1+-- 1 candidates of size 2+-- 4 candidates of size 3+-- 8 candidates of size 4+-- 28 candidates of size 5+-- 109 candidates of size 6+-- tested 146 candidates+factorial x = foldr (*) 1 [1..x]+
+ bench/i30.hs view
@@ -0,0 +1,87 @@+-- 30 background ingredients, does Conjure scale?+--+-- Copyright (C) 2021-2025 Rudy Matela+-- Distributed under the 3-Clause BSD licence (see the file LICENSE).+import Conjure+import System.Environment++factorial :: Int -> Int+factorial 0 = 1+factorial 1 = 1+factorial 2 = 2+factorial 3 = 6+factorial 4 = 24+factorial 5 = 120++count' :: Int -> [Int] -> Int+count' 0 [0] = 1+count' 0 [1] = 0+count' 1 [0] = 0+count' 1 [1] = 1+count' 0 [0,0] = 2+count' 0 [0,1] = 1+count' 0 [1,2] = 0+count' 1 [0,0] = 0+count' 1 [0,1] = 1+count' 1 [1,2] = 1+count' 0 [0,0,0] = 3+count' 0 [0,0,1] = 2+count' 0 [1,0,0] = 2++main :: IO ()+main = do+ putStrLn $ "running with " ++ show (length ingredients) ++ " ingredients"+ as <- getArgs+ case as of+ ["factorial"] -> conjure "factorial n" factorial ingredients+ ["factorial","t"] -> conjure "factorial n" factorial $ ingredients ++ [maxSize 1]+ ["sum"] -> conjure "sum" (sum :: [Int] -> Int) ingredients+ ["sum","t"] -> conjure "sum" (sum :: [Int] -> Int) $ ingredients ++ [maxSize 1]+ ["product"] -> conjure "product" (product :: [Int] -> Int) ingredients+ ["product","t"] -> conjure "product" (product :: [Int] -> Int) $ ingredients ++ [maxSize 1]+ ["length"] -> conjure "length" (length :: [Int] -> Int) ingredients+ ["length","t"] -> conjure "length" (length :: [Int] -> Int) $ ingredients ++ [maxSize 1]+ ["count"] -> conjure "count" count' $ ingredients ++ primsLength+ ["count","t"] -> conjure "count" count' $ ingredients ++ primsLength ++ [maxSize 1]+ _ -> putStrLn "usage: p30 <factorial|sum|product|length|count> [t]"++ingredients :: [Ingredient]+ingredients =+ [ con False+ , con True+ , fun "&&" (&&)+ , fun "||" (||)+ , fun "not" not++ , con (0::Int)+ , con (1::Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "*" ((*) :: Int -> Int -> Int)+ , fun "dec" (subtract 1 :: Int -> Int)+ , fun "-" ((-) :: Int -> Int -> Int)++ , fun "==" ((==) :: Int -> Int -> Bool)+ , fun "<=" ((<=) :: Int -> Int -> Bool)+ , fun "<" ((<) :: Int -> Int -> Bool)++ , fun "const" (const :: Int -> Int -> Int)++ , con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "head" (head :: [Int] -> Int)+ , fun "tail" (tail :: [Int] -> [Int])+ , fun "null" (null :: [Int] -> Bool)+ , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)++ , fun "map" (map :: (Int -> Int) -> [Int] -> [Int])+ , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])+ , fun ".." (enumFromTo :: Int -> Int -> [Int])++ , fun "++" ((++) :: [Int] -> [Int] -> [Int])+ , fun "elem" (elem :: Int -> [Int] -> Bool)+ ]++primsLength :: [Ingredient]+primsLength =+ [ fun "length" (length :: [Int] -> Int)+ ]
+ bench/i30.txt view
@@ -0,0 +1,2 @@+running with 26 ingredients+usage: p30 <factorial|sum|product|length|count> [t]
bench/ill-hit.hs view
@@ -38,8 +38,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "null" (null :: [Int] -> Bool)
bench/ill-hit.txt view
@@ -9,7 +9,7 @@ -- 1 candidates of size 3 -- 2 candidates of size 4 -- 7 candidates of size 5--- tested 7 candidates+-- tested 11 candidates sum [] = 0 sum (x:xs) = x + sum xs @@ -20,7 +20,7 @@ -- 3 candidates of size 3 -- 10 candidates of size 4 -- 18 candidates of size 5--- tested 21 candidates+-- tested 33 candidates sum [] = 0 sum (x:xs) = x + sum xs
− bench/p12.hs
@@ -1,71 +0,0 @@--- 12 background ingredients------ Copyright (C) 2021-2025 Rudy Matela--- Distributed under the 3-Clause BSD licence (see the file LICENSE).-import Conjure-import System.Environment--factorial :: Int -> Int-factorial 0 = 1-factorial 1 = 1-factorial 2 = 2-factorial 3 = 6-factorial 4 = 24-factorial 5 = 120--count' :: Int -> [Int] -> Int-count' 0 [0] = 1-count' 0 [1] = 0-count' 1 [0] = 0-count' 1 [1] = 1-count' 0 [0,0] = 2-count' 0 [0,1] = 1-count' 0 [1,2] = 0-count' 1 [0,0] = 0-count' 1 [0,1] = 1-count' 1 [1,2] = 1-count' 0 [0,0,0] = 3-count' 0 [0,0,1] = 2-count' 0 [1,0,0] = 2--main :: IO ()-main = do- putStrLn $ "running with " ++ show (length ingredients) ++ " ingredients"- as <- getArgs- case as of- ["factorial"] -> conjure "factorial n" factorial ingredients- ["factorial","t"] -> conjure "factorial n" factorial $ ingredients ++ [maxSize 1]- ["sum"] -> conjure "sum" (sum :: [Int] -> Int) ingredients- ["sum","t"] -> conjure "sum" (sum :: [Int] -> Int) $ ingredients ++ [maxSize 1]- ["product"] -> conjure "product" (product :: [Int] -> Int) ingredients- ["product","t"] -> conjure "product" (product :: [Int] -> Int) $ ingredients ++ [maxSize 1]- ["length"] -> conjure "length" (length :: [Int] -> Int) ingredients- ["length","t"] -> conjure "length" (length :: [Int] -> Int) $ ingredients ++ [maxSize 1]- ["count"] -> conjure "count" count' $ ingredients ++ primsCount- ["count","t"] -> conjure "count" count' $ ingredients ++ primsCount ++ [maxSize 1]- _ -> conjure "factorial n" factorial ingredients--ingredients :: [Ingredient]-ingredients =- [ unfun (0::Int)- , unfun (1::Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun "*" ((*) :: Int -> Int -> Int)- , fun "dec" (subtract 1 :: Int -> Int)-- , fun "==" ((==) :: Int -> Int -> Bool)-- , unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "head" (head :: [Int] -> Int)- , fun "tail" (tail :: [Int] -> [Int])- , fun "null" (null :: [Int] -> Bool)- , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)- , fun ".." (enumFromTo :: Int -> Int -> [Int])- ]--primsCount :: [Ingredient]-primsCount =- [ fun "length" (length :: [Int] -> Int)- , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])- ]
− bench/p12.txt
@@ -1,14 +0,0 @@-running with 13 ingredients-factorial :: Int -> Int--- testing 6 combinations of argument values--- pruning with 67/101 rules--- 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/p30.hs
@@ -1,87 +0,0 @@--- 30 background ingredients, does Conjure scale?------ Copyright (C) 2021-2025 Rudy Matela--- Distributed under the 3-Clause BSD licence (see the file LICENSE).-import Conjure-import System.Environment--factorial :: Int -> Int-factorial 0 = 1-factorial 1 = 1-factorial 2 = 2-factorial 3 = 6-factorial 4 = 24-factorial 5 = 120--count' :: Int -> [Int] -> Int-count' 0 [0] = 1-count' 0 [1] = 0-count' 1 [0] = 0-count' 1 [1] = 1-count' 0 [0,0] = 2-count' 0 [0,1] = 1-count' 0 [1,2] = 0-count' 1 [0,0] = 0-count' 1 [0,1] = 1-count' 1 [1,2] = 1-count' 0 [0,0,0] = 3-count' 0 [0,0,1] = 2-count' 0 [1,0,0] = 2--main :: IO ()-main = do- putStrLn $ "running with " ++ show (length ingredients) ++ " ingredients"- as <- getArgs- case as of- ["factorial"] -> conjure "factorial n" factorial ingredients- ["factorial","t"] -> conjure "factorial n" factorial $ ingredients ++ [maxSize 1]- ["sum"] -> conjure "sum" (sum :: [Int] -> Int) ingredients- ["sum","t"] -> conjure "sum" (sum :: [Int] -> Int) $ ingredients ++ [maxSize 1]- ["product"] -> conjure "product" (product :: [Int] -> Int) ingredients- ["product","t"] -> conjure "product" (product :: [Int] -> Int) $ ingredients ++ [maxSize 1]- ["length"] -> conjure "length" (length :: [Int] -> Int) ingredients- ["length","t"] -> conjure "length" (length :: [Int] -> Int) $ ingredients ++ [maxSize 1]- ["count"] -> conjure "count" count' $ ingredients ++ primsLength- ["count","t"] -> conjure "count" count' $ ingredients ++ primsLength ++ [maxSize 1]- _ -> putStrLn "usage: p30 <factorial|sum|product|length|count> [t]"--ingredients :: [Ingredient]-ingredients =- [ unfun False- , unfun True- , fun "&&" (&&)- , fun "||" (||)- , fun "not" not-- , unfun (0::Int)- , unfun (1::Int)- , fun "+" ((+) :: Int -> Int -> Int)- , fun "*" ((*) :: Int -> Int -> Int)- , fun "dec" (subtract 1 :: Int -> Int)- , fun "-" ((-) :: Int -> Int -> Int)-- , fun "==" ((==) :: Int -> Int -> Bool)- , fun "<=" ((<=) :: Int -> Int -> Bool)- , fun "<" ((<) :: Int -> Int -> Bool)-- , fun "const" (const :: Int -> Int -> Int)-- , unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "head" (head :: [Int] -> Int)- , fun "tail" (tail :: [Int] -> [Int])- , fun "null" (null :: [Int] -> Bool)- , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)-- , fun "map" (map :: (Int -> Int) -> [Int] -> [Int])- , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])- , fun ".." (enumFromTo :: Int -> Int -> [Int])-- , fun "++" ((++) :: [Int] -> [Int] -> [Int])- , fun "elem" (elem :: Int -> [Int] -> Bool)- ]--primsLength :: [Ingredient]-primsLength =- [ fun "length" (length :: [Int] -> Int)- ]
− bench/p30.txt
@@ -1,2 +0,0 @@-running with 26 ingredients-usage: p30 <factorial|sum|product|length|count> [t]
+ bench/psb2.hs view
@@ -0,0 +1,851 @@+-- gps2.hs: General Program Synthesis Benchmark Suite II+--+-- Copyright (C) 2021-2025 Rudy Matela+-- Distributed under the 3-Clause BSD licence (see the file LICENSE).+{-# LANGUAGE CPP, TemplateHaskell #-}+import Conjure+import System.Environment (getArgs)++import Data.List (findIndex, inits) -- for #1+import Data.Char (toUpper) -- for #4+import Data.Ratio ((%)) -- for #7+import Data.List (findIndices, tails, isPrefixOf) -- for #12+import Data.Maybe (fromJust) -- for #23+import Test.LeanCheck -- for #24+import Data.Express -- for #24+++-- PSB2 #1 -- Basement (AoC) ---+-- Given a vector of integers, return the first index such that the sum of all+-- integers from the start of the vector to the index (inclusive) is negative++gps1p :: [Int] -> Maybe Int+gps1p [0,-1,2] = Just 1+gps1p [-1,0,1] = Just 0+gps1p [0,-1] = Just 1+gps1p [1,-1,-1] = Just 2++gps1g :: [Int] -> Maybe Int+gps1g xs = findIndex (0 >) (map sum (tail (inits xs)))++gps1p2 :: Int -> [Int] -> Int+gps1p2 0 [0,-1,2] = 1+gps1p2 0 [-1,0,1] = 0+gps1p2 0 [0,-1] = 1+gps1p2 0 [1,-1,-1] = 2+gps1p2 0 [0,0,0,-1] = 3+gps1p2 0 [1,0,0,-2] = 3++-- efficient gps1, unreachable performance-wise+gps1g2 :: Int -> [Int] -> Int+gps1g2 t [] = undefined -- 1+gps1g2 t (x:xs) = if t + x < 0 -- 7+ then 0 -- 8+ else 1 + gps1g2 (t + x) xs -- 15++gps1c :: IO ()+gps1c = do+ conjure "gps1" gps1p+ [ con (0 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun ">" ((>) :: Int -> Int -> Bool)+ , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)+ , fun "sum" (sum :: [Int] -> Int)+ , fun "findIndex" (findIndex :: (Int -> Bool) -> [Int] -> Maybe Int)+ , fun "map" (map :: ([Int] -> Int) -> [[Int]] -> [Int])+ , fun "inits" (inits :: [Int] -> [[Int]])+ , fun "tail" (tail :: [[Int]] -> [[Int]])+ ]++ conjure "gps1" gps1p+ [ con (0 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun ">" ((>) :: Int -> Int -> Bool)+ , fun "sum" (sum :: [Int] -> Int)+ , fun "foldr" (foldr :: (Int -> Int -> Int) -> Int -> [Int] -> Int)+ , fun "findIndex" (findIndex :: (Int -> Bool) -> [Int] -> Maybe Int)+ , fun "map" (map :: ([Int] -> Int) -> [[Int]] -> [Int])+ , fun "inits" (inits :: [Int] -> [[Int]])+ , fun "tail" (tail :: [[Int]] -> [[Int]])+ ]++ conjure "gps1" gps1p2+ [ con (0 :: Int)+ , con (1 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "<" ((<) :: Int -> Int -> Bool)+ , guard+ , fun "undefined" (undefined :: Int)+ , maxSize 4+ , maxEquationSize 4+ ]+++-- PSB2 #2 -- Bouncing Balls (CW) --++gps2p :: Double -> Double -> Int -> Double+gps2p 2 1 1 = 2 + 1+gps2p 2 1 2 = 2 + 1 + 1 + 0.5+gps2p 2 1 3 = 2 + 1 + 1 + 0.5 + 0.5 + 0.25+gps2p 3 1 1 = 3 + 1+gps2p 3 1 2 = 3 + 1 + 1/3++-- apex to apex+gps2g :: Double -> Double -> Int -> Double+gps2g h0 h1 0 = h0 + h1+gps2g h0 h1 n = h0 + h1 + gps2g h1 (h1 * (h1 / h0)) (n - 1)+-- size 17, out of reach performance-wise++gps2c :: IO ()+gps2c = do+ conjure "gps2" gps2p+ [ con (0 :: Int)+ , con (1 :: Int)+ , fun "*" ((*) :: Double -> Double -> Double)+ , fun "/" ((/) :: Double -> Double -> Double)+ , fun "+" ((+) :: Double -> Double -> Double)+ , fun "-" ((-) :: Double -> Double -> Double)+ , maxSize 6+ ]+++gps3p :: String -> Int+gps3p "X X X X X X X X X XXX" = 300+gps3p "11 11 11 11 11 11 11 11 11 11" = 20++-- unreachable performance wise+-- I presume a correct solution would need around 30 symbols+gps3c :: IO ()+gps3c = conjure "gps3" gps3p []++++-- PSB2 #4: https://www.codewars.com/kata/517abf86da9663f1d2000003+-- Here we're using the problem description as in the PSB2 paper+-- considering we're getting input as kebab-case.+-- Nevertheless, this one is out of reach performance-wise (and OOM-wise)++gps4s :: (String -> String) -> [Property]+gps4s g =+ [ property $ g "the-stealth-warrior" == "theStealthWarrior"+ , property $ g "camel-case" == "camelCase"+ , property $ g "Kebab-Case" == "KebabCase"+ ]++gps4g :: String -> String+gps4g "" = ""+-- gps4g ('-':c:cs) = toUpper c : gps4g cs+-- gps4g ('_':c:cs) = toUpper c : gps4g cs+gps4g (c:cs) = if c == '-' -- 5+ then if null cs -- 8+ then "" -- 9+ else toUpper (head cs) : gps4g (tail cs) -- 16+ else c : gps4g cs -- 19++gps4c :: IO ()+gps4c = do+ conjureFromSpec "gps4" gps4s+ [ con '-'+ , con ("" :: String)+ , fun ":" ((:) :: Char -> String -> String)+ , fun "==" ((==) :: Char -> Char -> Bool)+ , fun "head" (head :: String -> Char)+ , fun "tail" (tail :: String -> String)+ , iif (undefined :: Char)+ , iif (undefined :: String)+ , fun "toUpper" (toUpper :: Char -> Char)+ , maxSize 6+ ]+++-- PSB2 #5: Coin Sums+-- https://projecteuler.net/problem=31+--+-- The problem description is inconsistent with the one given in the paper.+--+-- Paper: change-making problem in USD+-- Euler: How many different ways can £2 be made using any number of coins?+--+-- I'm considering the Paper to be canonical, as the one in Project Euler can be solved by a constant function:+--+-- solution :: Int+-- solution = 6378216738 -- <-- arbitrary example here, I didn't run the numbers+gps5p :: Int -> [Int]+gps5p 100 = [4, 0, 0, 0]+gps5p 50 = [2, 0, 0, 0]+gps5p 25 = [1, 0, 0, 0]+gps5p 30 = [1, 0, 1, 0]+gps5p 20 = [0, 2, 0, 0]+gps5p 3 = [0, 0, 0, 3]++gps5s :: ([Int] -> Int -> [Int]) -> [Property]+gps5s t =+ [ property $ t [25, 10, 5, 1] 100 == [4, 0, 0, 0]+ , property $ t [25, 10, 5, 1] 50 == [2, 0, 0, 0]+ , property $ t [25, 10, 5, 1] 25 == [1, 0, 0, 0]+ , property $ t [25, 10, 5, 1] 30 == [1, 0, 1, 0]+ , property $ t [25, 10, 5, 1] 20 == [0, 2, 0, 0]+ , property $ t [25, 10, 5, 1] 3 == [0, 0, 0, 3]+ ]++coins :: [Int]+coins = [25, 10, 5, 1]++gps5g :: Int -> [Int]+gps5g = tell coins++tell :: [Int] -> Int -> [Int]+tell [] a = []+tell (n:ns) a = a `div` n : tell ns (a `mod` n)++gps5c :: IO ()+gps5c = do+ -- cannot conjure directly due to needing to introduce a local definition+ conjure "gps5" gps5p+ [+ ]++ conjureFromSpec "tell" gps5s+ [ con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "`mod`" (mod :: Int -> Int -> Int)+ ]++ conjure "gps5" gps5p+ [ con coins+ , fun "tell" tell+ ]++ conjure "gps5" gps5p+ [ con (1 :: Int)+ , con (5 :: Int)+ , con (10 :: Int)+ , con (25 :: Int)+ , con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "tell" tell+ , target 50400+ ]+++-- PSB2 #6: Cut Vector+gps6g :: [Int] -> Int+gps6g xs = snd+ $ minimum+ [ (abs (sum xs0 - sum xs1), i)+ | i <- [0 .. length xs]+ , let (xs0, xs1) = splitAt i xs+ ]++-- not Conjurable due to needing local definition+-- I conjecture it _perhaps-maybe_ this could be done in 3 steps,+-- but I'll leave this as-is for now.+gps6c :: IO ()+gps6c =+ conjure "gps6" gps6g []+++-- PSB2 #7: Dice Game+-- https://projecteuler.net/problem=31+-- https://github.com/thelmuth/Clojush/blob/psb2-v1.0/src/clojush/problems/psb2/dice_game.clj+-- again, paper and problem are inconsistent, going with paper+gps7p :: Integer -> Integer -> Rational+gps7p 4 6 = 1 % 4+gps7p 6 4 = 7 % 12+gps7p 2 4 = 1 % 8+gps7p 4 2 = 5 % 8+gps7p 2 6 = 1 % 12+gps7p 6 2 = 3 % 4++gps7g :: Integer -> Integer -> Rational+gps7g peter colin = sum (map (min colin) [0 .. (peter-1)]) % (colin*peter)++-- out of reach performance-wise+gps7c :: IO ()+gps7c = do+ conjure "gps7" gps7p $ take 0+ [ con (0 :: Integer)+ , con (1 :: Integer)+ , fun "%" ((%) :: Integer -> Integer -> Rational)+ , fun "+" ((+) :: Integer -> Integer -> Integer)+ , fun "-" ((-) :: Integer -> Integer -> Integer)+ , fun "*" ((*) :: Integer -> Integer -> Integer)+ , fun "min" (min :: Integer -> Integer -> Integer)+ , fun ".." (enumFromTo :: Integer -> Integer -> [Integer])+ , fun "map" (map :: (Integer -> Integer) -> [Integer] -> [Integer])+ , fun "sum" (sum :: [Integer] -> Integer)+ , maxSize 6+ ]+++gps8p :: Int -> [Int] -> (Int,Int)+gps8p 2 [1,1,2] = (1,1)+gps8p 3 [1,1,2] = (1,2)+gps8p 2 [0,1,0,2] = (0,2)++gps8g :: Int -> [Int] -> (Int,Int)+gps8g x xs = head [(y,z) | y <- xs, z <- xs, y + z == x]+-- this one could be generated but is a bit of a stretch...+-- it is unintuitive to provide the given symbols+-- gps8g :: Int -> [Int] -> (Int,Int)+-- gps8g x xs = head $ filter ((x ==) . uncurry (+)) $ liftA2 (,) xs xs++gps8c :: IO ()+gps8c = conjure "gps8" gps8p []+++-- PSB2 #9: Fizz Buzz (CW)+gps9p :: Int -> String+gps9p 3 = "Fizz"+gps9p 4 = "4"+gps9p 5 = "Buzz"+gps9p 6 = "Fizz"+gps9p 10 = "Buzz"+gps9p 15 = "FizzBuzz"+gps9p 17 = "17"++gps9g :: Int -> String+gps9g x+ | x `mod` 3 == 0 = "Fizz" -- 7+ | x `mod` 5 == 0 = "Buzz" -- 14+ | x `mod` 3 == 0 && x `mod` 5 == 0 = "FizzBuzz" -- 27+ | otherwise = show x -- 29++-- unreachable performance-wise:+-- too many candidates to sift through+-- even in two steps+gps9c :: IO ()+gps9c = conjure "gps9" gps9p+ [ con "Fizz"+ , con "Buzz"+ , con "FizzBuzz"+ , con (0 :: Int)+ , con (3 :: Int)+ , con (5 :: Int)+ , con False+ , con True+ , fun "`divBy`" divBy+--, fun "`mod`" (mod :: Int -> Int -> Int)+ , fun "&&" (&&)+--, fun "==" ((==) :: Int -> Int -> Bool)+ , fun "show" (show :: Int -> String)+ , iif (undefined :: String)+ , target 1080 -- so this fails quickly...+ ]+ where+ -- two-step try:+ divBy :: Int -> Int -> Bool+ x `divBy` 0 = False+ x `divBy` y = x `mod` y == 0+++gps10p :: [Int] -> Int+gps10p [0] = -2+gps10p [3] = -1+gps10p [6] = 0+gps10p [9] = 1+gps10p [0,3] = -3+gps10p [3,0] = -3+gps10p [3,2,1] = -5+gps10p [1,2,3] = -5+gps10p [10,20,30] = 13++-- does not do rounding+gps10g :: [Int] -> Int+gps10g [] = 0+gps10g (x:xs) = (x `div` 3 - 2) + gps10g xs++-- unreachable due to lambda+gps10c :: IO ()+gps10c = conjure "gps10" gps10p+ [ con (0 :: Int)+ , con (1 :: Int)+ , con (2 :: Int)+ , con (3 :: Int)+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "-" ((-) :: Int -> Int -> Int)+ , target 50400+ ]+++gps11p :: Int -> Int -> Int+gps11p = gcd'+ where+ gcd' :: Int -> Int -> Int+ gcd' 1 1 = 1+ gcd' 1 2 = 1+ gcd' 2 1 = 1+ gcd' 2 2 = 2+ gcd' 2 6 = 2+ gcd' 6 2 = 2+ gcd' 3 6 = 3+ gcd' 6 3 = 3+ gcd' 6 9 = 3+ gcd' 9 6 = 3+ gcd' 12 18 = 6++gps11c :: IO ()+gps11c = conjure "gcd a b" gps11p+ [ con (0::Int)+ , fun "`mod`" (mod :: Int -> Int -> Int)+ ]+ -- generated function:+ -- gcd x 0 = x+ -- gcd x y = gcd y (x `mod` y)+++gps12p :: String -> String -> [Int]+gps12p "a" "a" = [0]+gps12p "aa" "a" = [0,1]+gps12p "aa" "aa" = [0]+gps12p "a a" "a" = [0,2]+gps12p "b" "a" = []++gps12g :: String -> String -> [Int]+gps12g s s' = findIndices (s' `isPrefixOf`) (tails s)++gps12c :: IO ()+gps12c = conjure "gps12" gps12p+ [ fun "findIndices" (findIndices :: (String -> Bool) -> [String] -> [Int])+ , fun "`isPrefixOf`" (isPrefixOf :: String -> String -> Bool)+ , fun "tails" (tails :: String -> [String])+ ]+++gps13p :: [Int] -> [Int]+gps13p [0,1] = [1]+gps13p [1,0] = [1,0]+gps13p [2,0,1] = [2,1]+gps13p [1,0,1] = [1]++gps13g :: [Int] -> [Int]+gps13g = leaders+ where+ leaders [] = []+ leaders (x:xs) = if all (x >) xs+ then x : leaders xs+ else leaders xs++gps13c :: IO ()+gps13c = conjure "gps13_leaders" gps13p+ [ con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun ">" ((>) :: Int -> Int -> Bool)+ , fun "<" ((<) :: Int -> Int -> Bool)+ , fun "all" (all :: (Int -> Bool) -> [Int] -> Bool)+ , fun "any" (any :: (Int -> Bool) -> [Int] -> Bool)+ , guard+ ]+++gps14p :: [Int] -> Int+gps14p = undefined++-- 30 symbols+gps14g :: [Int] -> Int+gps14g = luhn+ where+ luhn :: [Int] -> Int+ luhn xs = sum (firsts xs ++ map double9 (seconds xs))+ where+ double9 :: Int -> Int+ double9 x = if xx > 9+ then xx - 9+ else xx+ where+ xx = x * 2+ seconds :: [Int] -> [Int]+ seconds [] = []+ seconds (x:y:xs) = y : seconds xs+ firsts :: [Int] -> [Int]+ firsts [] = []+ firsts (x:y:xs) = x : seconds xs++-- cannot Conjure directly+gps14c :: IO ()+gps14c = conjure "gps14_luhn" gps14p+ [+ ]+++gps15p :: () -> ()+gps15p = undefined++-- skipped+gps15c :: IO ()+gps15c = conjure "gps15_mastermind" gps15p []+++gps16p :: String -> String+gps16p "a" = "a"+gps16p "aaa" = "a"+gps16p "aa" = "aa"+gps16p "a a" = " "+gps16p " a " = "a"+gps16p "a a " = " a"+gps16p " a a " = " "+gps16p "aba" = "b"+gps16p "bab" = "a"+gps16p "abba" = "bb"+gps16p "aaaaa" = "a"++gps16g1 :: String -> String+gps16g1 s = if odd len+ then take 1 (drop (len `div` 2) s)+ else take 2 (drop (len `div` 2 - 1) s)+ where+ len = length s++gps16g2 :: String -> String+gps16g2 "" = ""+gps16g2 (c:cs) = if length cs <= 1+ then c : cs+ else gps16g2 (init cs)++gps16c :: IO ()+gps16c = conjure "gps16_middle" gps16p+ [ con ""+ , con (1 :: Int)+ , fun "<=" ((<=) :: Int -> Int -> Bool)+ , fun ":" ((:) :: Char -> String -> String)+ , fun "length" (length :: String -> Int)+ , fun "init" (init :: String -> String)+ , iif (undefined :: String) -- TODO: can't replace by guard, why? (July 2025)+ -- update: it is enumerated, but somehow does not passes the tests, why?+ ]+++-- PSB2 #17 -- Paired Digits (AoC) --+-- Given a string of digits,+-- return the sum of the digits+-- whose following digit are the same.+-- Originally called "Inverse Captcha":+-- https://adventofcode.com/2017/day/1++gps17p :: [Int] -> Int+gps17p [0,1,0] = 0+gps17p [1,1] = 1+gps17p [0,0,1,1] = 1+gps17p [1,1,0] = 1+gps17p [0,1,1] = 1+gps17p [1,1,1] = 2+gps17p [0,1,2] = 0+gps17p [1,1,2,2] = 3+gps17p [1,1,1,1] = 3 -- variation from advent+gps17p [1,2,3,4] = 0++gps17g :: [Int] -> Int+gps17g xs = pds xs+ where+ pds [] = 0+ pds (x:xs) = if not (null xs) && x == head xs+ then x + pds xs+ else pds xs+-- surprise:+-- gps17_pds [] = 0+-- gps17_pds (x:xs) = (if not (null xs) && head xs == x then x else 0) + gps17_pds xs+++-- can generate at size 15 in 6+-- setting limit of 5 for faster automated tests+-- BENCHMARK: increase maxSize from 6 to 18+gps17c :: IO ()+gps17c = do+ conjure "gps17_pds" gps17p+ [ con (0 :: Int)+ , guard+ , fun "not" not+ , fun "null" (null :: [Int] -> Bool)+ , fun "==" ((==) :: Int -> Int -> Bool)+ , fun "head" (head :: [Int] -> Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "&&" (&&)+ , maxSize 6 -- 18+ ]++ -- OOM after size 16, unreachable by increasing pattern depth+ conjure "gps17_pds" gps17p+ [ con (0 :: Int)+ , guard+ , fun "==" ((==) :: Int -> Int -> Bool)+ , fun "+" ((+) :: Int -> Int -> Int)+ , maxPatternDepth 2+ , maxSize 6 -- 18+ ]+++gps18p :: [Double] -> [Double] -> Double+gps18p [1.0] [0.5] = 0.5+gps18p [2.0] [0.5] = 1.0+gps18p [1.0,1.0] [0.5,0.0] = 1.5+gps18p [1.0,1.0] [0.0,0.5] = 1.5++gps18g :: [Double] -> [Double] -> Double+gps18g prices discounts = foldr (+) 0 (zipWith (*) prices (map (1-) discounts))++-- this was OOM'd+gps18c :: IO ()+gps18c = conjure "gps18_price" gps18p+ [ con (0 :: Double)+ , con (1 :: Double)+ , fun "+" ((+) :: Double -> Double -> Double)+ , fun "*" ((*) :: Double -> Double -> Double)+ , fun "-" ((-) :: Double -> Double -> Double)+-- , fun "foldr" (foldr :: (Double -> Double -> Double) -> Double -> [Double] -> Double)+-- , fun "zipWith" (zipWith :: (Double -> Double -> Double) -> [Double] -> [Double] -> [Double])+-- , fun "map" (map :: (Double -> Double) -> [Double] -> [Double])+ , maxSize 6+ ]+++gps19p :: Int -> Double -> Double -> Double -> Double+gps19p 0 0 1.0 1.0 = 0+gps19p 1 0 1.0 1.0 = 0+gps19p 2 0 1.0 1.0 = 0+gps19p 1 0 1.0 2.0 = 1.0+gps19p 2 0 1.0 2.0 = 2.0+gps19p 1 0 0.5 1.0 = 0.5+gps19p 2 0 0.5 1.0 = 1.0++gps19g :: Int -> Double -> Double -> Double -> Double+gps19g 0 total melt fall = total+gps19g n total melt fall = gps19p (n-1) (max 0 (total-melt+fall)) melt fall+-- size 14, out of reach performance wise.++gps19c :: IO ()+gps19c = conjure "gps19_snowday" gps19p+ [ con (0 :: Int)+ , con (1 :: Int)+ , fun "max" (max :: Double -> Double -> Double)+ , fun "+" ((+) :: Double -> Double -> Double)+ , fun "-" ((-) :: Double -> Double -> Double)+ , maxSize 6+ ]+++gps20p :: String -> Bool+gps20p = undefined++gps20c :: IO ()+gps20c = conjure "gps20" gps20p+ [+ ]+++gps21s :: (String -> String) -> [Property]+gps21s s =+ [ property $ s "word" == "word"+ , property $ s "words" == "sdrow"+ , property $ s "word words" == "word sdrow"+ , property $ s "words word" == "sdrow word"+ ]++spinSpec :: (String -> String) -> [Property]+spinSpec spin =+ [ property $ spin "abc" == "abc"+ , property $ spin "abcd" == "abcd"+ , property $ spin "word" == "word"+ , property $ spin "abcde" == "edcba"+ , property $ spin "words" == "sdrow"+ , property $ spin "hello" == "olleh"+ , property $ spin "world" == "dlrow"+ ]++spin :: String -> String+spin w = if length w >= 5+ then reverse w+ else w++gps21g :: String -> String+gps21g s = unwords (map spin (words s))++gps21c :: IO ()+gps21c = do+ conjureFromSpec "spin" spinSpec+ [ fun "length" (length :: String -> Int)+ , fun "reverse" (reverse :: String -> String)+ , guard+ , fun ">=" ((>=) :: Int -> Int -> Bool)+ , con (5 :: Int)+ ]++ conjureFromSpec "gps21_spinwords" gps21s+ [ fun "words" words+ , fun "unwords" unwords+ , fun "spin" (spin :: String -> String)+ , fun "map" (map :: (String -> String) -> [String] -> [String])+ , fun "length" (length :: String -> Int)+ , fun "reverse" (reverse :: String -> String)+ , guard+ , fun ">=" ((>=) :: Int -> Int -> Bool)+ , con (5 :: Int)+ ]+++-- PSB2 #22 -- Square Digits (CW) --+-- Given a positive integer, square each digit and+-- concatenate the squares into a returned string.++gps22p :: Int -> String+gps22p 1 = "1"+gps22p 12 = "14"+gps22p 21 = "41"+gps22p 123 = "149"+gps22p 321 = "941"+gps22p 1234 = "14916"+gps22p 4321 = "16941"++-- unreachable as-is+-- reachable with auxiliary functions: div10, mod10 and square+gps22g :: Int -> String+gps22g 0 = "" -- 1+gps22g x = gps22g (x `div` 10) ++ show (x `mod` 10 * x `mod` 10) -- 14+-- gps22g x = gps22g (x `div` 10) ++ show ((x `mod` 10) ^ 2) -- 12++gps22c :: IO ()+gps22c = do+ conjure "gps22" gps22p+ [ con (0 :: Int)++ -- uncomment the following four for the a runtime of 15s @ size 11+ -- , con (10 :: Int)+ -- , fun "`div`" (div :: Int -> Int -> Int)+ -- , fun "`mod`" (mod :: Int -> Int -> Int)+ -- , fun "square" ((^2) :: Int -> Int)+ , fun "div10" ((`div` 10) :: Int -> Int)+ , fun "mod10" ((`mod` 10) :: Int -> Int)+ , fun "*" ((*) :: Int -> Int -> Int)++ , fun "show" (show :: Int -> String)+ , con ""+ , fun "++" ((++) :: String -> String -> String)+ ]+++gps23s :: (String -> String -> String -> String) -> [Property]+gps23s s =+ [ property $ s "abcd" "abcd" "abcd" == "abcd"+ , property $ s "abcd" "dcba" "abcd" == "dcba"+ , property $ s "abcd" "1234" "abcd" == "1234"+ , property $ s "abcd" "1234" "bacd" == "2134"+ ]++gps23g :: String -> String -> String -> String+-- gps23g f t s = map (\c -> fromJust $ c `lookup` zipWith (,) f t) s+gps23g f t s = map (fromJust . (`lookup` zipWith (,) f t)) s++gps23c :: IO ()+gps23c = do+ -- cannot conjure, needs lambda+ conjureFromSpec "gps23" gps23s+ [+ ]+++data Twitter = Tweet Int+ | TooMany+ | Empty+ deriving (Eq, Show)++deriveExpress ''Twitter+deriveListable ''Twitter+deriveName ''Twitter++instance Conjurable Twitter where+ conjureExpress = reifyExpress+ conjureEquality = reifyEquality+ conjureTiers = reifyTiers++gps24g_twitter :: String -> Twitter+gps24g_twitter "" = Empty+gps24g_twitter s = if length s > 140+ then TooMany+ else Tweet (length s)++gps24s_twitter :: (String -> Twitter) -> [Property]+gps24s_twitter twitter =+ [ property $ twitter "" == Empty+ , property $ twitter "abcd" == Tweet 4+ , property $ twitter "0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij" == Tweet 140+ , property $ twitter "0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123456789abcdefghijX" == TooMany+ ]++gps24c :: IO ()+gps24c = do+ conjureFromSpec "gps24" gps24s_twitter+ [ con Empty+ , con TooMany+ , fun "Tweet" Tweet+ , guard+ , con ""+ , fun ":" ((:) :: Char -> String -> String)+ , fun "length" (length :: String -> Int)+ , con (140 :: Int)+ , fun ">" ((>) :: Int -> Int -> Bool)+ ]+++gps25p :: [Double] -> [Double] -> Double+gps25p [0] [1] = 1+gps25p [1] [0] = 1+gps25p [-1] [1] = 2+gps25p [0,1] [1,0] = sqrt 2+gps25p [1,0] [0,1] = sqrt 2+gps25p [0,0,1] [1,0,0] = sqrt 2+gps25p [0,1,2] [1,2,3] = sqrt 3++gps25g :: [Double] -> [Double] -> Double+gps25g v1 v2 = sqrt (foldr (+) 0 (map (^2) (zipWith (-) v1 v2)))++-- out of reach performance-wise+gps25c :: IO ()+gps25c = conjure "gps25" gps25p+ [ con (0 :: Double)+ , con (2 :: Double)+ , fun "+" ((+) :: Double -> Double -> Double)+ , fun "-" ((-) :: Double -> Double -> Double)+ , fun "**" ((**) :: Double -> Double -> Double)+ , fun "zipWith" (zipWith :: (Double -> Double -> Double) -> [Double] -> [Double] -> [Double])+ , fun "map" (map :: (Double -> Double) -> [Double] -> [Double])+ , fun "sqrt" (sqrt :: Double -> Double)+ , maxSize 6+ ]+++main :: IO ()+main = do+ as <- getArgs+ case as of+ [] -> sequence_ gpss+ (n:_) -> gpss !! (read n - 1)+++gpss :: [IO ()]+gpss = [ gps1c+ , gps2c+ , gps3c+ , gps4c+ , gps5c+ , gps6c+ , gps7c+ , gps8c+ , gps9c+ , gps10c+ , gps11c+ , gps12c+ , gps13c+ , gps14c+ , gps15c+ , gps16c+ , gps17c+ , gps18c+ , gps19c+ , gps20c+ , gps21c+ , gps22c+ , gps23c+ , gps24c+ , gps25c+ ]
+ bench/psb2.txt view
@@ -0,0 +1,388 @@+gps1 :: [Int] -> Maybe Int+-- testing 4 combinations of argument values+-- pruning with 11/21 rules+-- 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 4 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+-- 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 4 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+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 5 candidates of size 4+-- tested 12 candidates+gps1 = undefined -- search exhausted++gps2 :: Double -> Double -> Int -> Double+-- testing 5 combinations of argument values+-- pruning with 2/6 rules+-- 2 candidates of size 1+-- 0 candidates of size 2+-- 16 candidates of size 3+-- 0 candidates of size 4+-- 252 candidates of size 5+-- 0 candidates of size 6+-- tested 270 candidates+gps2 = undefined -- search exhausted++gps3 :: [Char] -> Int+gps3 = error "could not reify specification, suggestion: conjureFromSpec"++gps4 :: [Char] -> [Char]+-- pruning with 13/21 rules+-- 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+gps4 = undefined -- search exhausted++gps5 :: Int -> [Int]+-- testing 6 combinations of argument values+-- pruning with 0/0 rules+-- 0 candidates of size 1+-- tested 0 candidates+gps5 = undefined -- search exhausted++tell :: [Int] -> Int -> [Int]+-- pruning with 0/0 rules+-- 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 3476 candidates+tell [] x = []+tell (x:xs) y = y `div` x:tell xs (y `mod` x)++gps5 :: Int -> [Int]+-- testing 6 combinations of argument values+-- pruning with 0/0 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 1 candidates of size 3+-- tested 2 candidates+gps5 = tell [25,10,5,1]++gps5 :: Int -> [Int]+-- testing 6 combinations of argument values+-- pruning with 12/12 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 5 candidates of size 3+-- 0 candidates of size 4+-- 35 candidates of size 5+-- 0 candidates of size 6+-- 350 candidates of size 7+-- 0 candidates of size 8+-- 3500 candidates of size 9+-- 0 candidates of size 10+-- 35000 candidates of size 11+-- tested 21147 candidates+gps5 = tell [25,10,5,1]++gps6 :: [Int] -> Int+-- testing 360 combinations of argument values+-- pruning with 0/0 rules+-- 0 candidates of size 1+-- 0 candidates of size 2+-- tested 0 candidates+gps6 = undefined -- search exhausted++gps7 :: Integer -> Integer -> Ratio Integer+-- testing 6 combinations of argument values+-- pruning with 0/0 rules+-- 0 candidates of size 1+-- tested 0 candidates+gps7 = undefined -- search exhausted++gps8 :: Int -> [Int] -> (Int,Int)+-- testing 3 combinations of argument values+-- pruning with 0/0 rules+-- 0 candidates of size 1+-- 0 candidates of size 2+-- tested 0 candidates+gps8 = undefined -- search exhausted++gps9 :: Int -> [Char]+-- testing 7 combinations of argument values+-- pruning with 18/25 rules+-- 3 candidates of size 1+-- 4 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5+-- 48 candidates of size 6+-- 192 candidates of size 7+-- 96 candidates of size 8+-- 0 candidates of size 9+-- 168 candidates of size 10+-- 2976 candidates of size 11+-- tested 3487 candidates+gps9 = undefined -- search exhausted++gps10 :: [Int] -> Int+-- testing 7 combinations of argument values+-- pruning with 67/100 rules+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 80 candidates of size 5+-- 8 candidates of size 6+-- 1428 candidates of size 7+-- 432 candidates of size 8+-- 30712 candidates of size 9+-- tested 4552 candidates+gps10 [] = 0+gps10 (x:xs) = (x `div` 3 - 2) + gps10 xs++gcd :: Int -> Int -> Int+-- testing 11 combinations of argument values+-- pruning with 0/0 rules+-- 3 candidates of size 1+-- 0 candidates of size 2+-- 8 candidates of size 3+-- 0 candidates of size 4+-- 48 candidates of size 5+-- 28 candidates of size 6+-- tested 63 candidates+gcd x 0 = x+gcd x y = gcd y (x `mod` y)++gps12 :: [Char] -> [Char] -> [Int]+-- testing 5 combinations of argument values+-- pruning with 1/2 rules+-- 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 9/9 rules+-- 2 candidates of size 1+-- 0 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+-- 0 candidates of size 8+-- 11 candidates of size 9+-- 16 candidates of size 10+-- 53 candidates of size 11+-- 48 candidates of size 12+-- tested 101 candidates+gps13_leaders [] = []+gps13_leaders (x:xs)+ | all (x >) xs = x:gps13_leaders xs+ | otherwise = gps13_leaders xs++gps14_luhn :: [Int] -> Int+gps14_luhn = error "could not reify specification, suggestion: conjureFromSpec"++gps15_mastermind :: () -> ()+gps15_mastermind = error "could not reify specification, suggestion: conjureFromSpec"++gps16_middle :: [Char] -> [Char]+-- testing 11 combinations of argument values+-- pruning with 10/11 rules+-- 2 candidates of size 1+-- 2 candidates of size 2+-- 2 candidates of size 3+-- 3 candidates of size 4+-- 5 candidates of size 5+-- 8 candidates of size 6+-- 17 candidates of size 7+-- 50 candidates of size 8+-- 145 candidates of size 9+-- 391 candidates of size 10+-- 993 candidates of size 11+-- 2480 candidates of size 12+-- tested 3719 candidates+gps16_middle "" = ""+gps16_middle (c:cs) = if length cs <= 1+ then c:cs+ else gps16_middle (init cs)++gps17_pds :: [Int] -> Int+-- testing 9 combinations of argument values+-- pruning with 29/40 rules+-- 1 candidates of size 1+-- 1 candidates of size 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 2 candidates of size 5+-- 4 candidates of size 6+-- tested 8 candidates+gps17_pds = undefined -- search exhausted++gps17_pds :: [Int] -> Int+-- testing 9 combinations of argument values+-- pruning with 13/19 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 0 candidates of size 3+-- 1 candidates of size 4+-- 4 candidates of size 5+-- 8 candidates of size 6+-- tested 14 candidates+gps17_pds = undefined -- search exhausted++gps18_price :: [Double] -> [Double] -> Double+-- testing 4 combinations of argument values+-- pruning with 26/35 rules+-- 2 candidates of size 1+-- 0 candidates of size 2+-- 2 candidates of size 3+-- 0 candidates of size 4+-- 33 candidates of size 5+-- 176 candidates of size 6+-- tested 213 candidates+gps18_price = undefined -- search exhausted++gps19_snowday :: Int -> Double -> Double -> Double -> Double+-- testing 7 combinations of argument values+-- pruning with 6/19 rules+-- 3 candidates of size 1+-- 0 candidates of size 2+-- 21 candidates of size 3+-- 0 candidates of size 4+-- 309 candidates of size 5+-- 0 candidates of size 6+-- tested 333 candidates+gps19_snowday = undefined -- search exhausted++gps20 :: [Char] -> Bool+gps20 = error "could not reify specification, suggestion: conjureFromSpec"++spin :: [Char] -> [Char]+-- pruning with 6/6 rules+-- reasoning produced 1 incorrect properties, please re-run with more tests for faster results+-- 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 6 candidates+spin cs+ | length cs >= 5 = reverse cs+ | otherwise = cs++gps21_spinwords :: [Char] -> [Char]+-- pruning with 16/16 rules+-- reasoning produced 2 incorrect properties, please re-run with more tests for faster results+-- 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))++gps22 :: Int -> [Char]+-- testing 7 combinations of argument values+-- pruning with 13/17 rules+-- 1 candidates of size 1+-- 2 candidates of size 2+-- 2 candidates of size 3+-- 3 candidates of size 4+-- 10 candidates of size 5+-- 20 candidates of size 6+-- 45 candidates of size 7+-- 117 candidates of size 8+-- 273 candidates of size 9+-- 645 candidates of size 10+-- 1567 candidates of size 11+-- tested 2609 candidates+gps22 0 = ""+gps22 x = gps22 (div10 x) ++ show (mod10 x * mod10 x)++gps23 :: [Char] -> [Char] -> [Char] -> [Char]+-- pruning with 0/0 rules+-- 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+gps23 = undefined -- search exhausted++gps24 :: [Char] -> Twitter+-- pruning with 4/8 rules+-- reasoning produced 4 incorrect properties, please re-run with more tests for faster results+-- 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+-- 216 candidates of size 10+-- 308 candidates of size 11+-- 466 candidates of size 12+-- tested 803 candidates+gps24 "" = Empty+gps24 (c:cs)+ | 140 > length cs = Tweet (length (c:cs))+ | otherwise = TooMany++gps25 :: [Double] -> [Double] -> Double+-- testing 6 combinations of argument values+-- pruning with 31/59 rules+-- 2 candidates of size 1+-- 1 candidates of size 2+-- 5 candidates of size 3+-- 10 candidates of size 4+-- 76 candidates of size 5+-- 438 candidates of size 6+-- tested 532 candidates+gps25 = undefined -- search exhausted+
bench/redundants.hs view
@@ -66,43 +66,43 @@ -- We can also customize the n per-function below: printRedundantCandidates (n+1) "foo" (undefined :: Int -> Int)- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ] printRedundantCandidates n "?" (undefined :: Int -> Int -> Int)- [ unfun (0 :: Int)+ [ con (0 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "dec" (subtract 1 :: Int -> Int) ] printRedundantCandidates (n+1) "goo" (undefined :: [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printRedundantCandidates n "??" (undefined :: [Int] -> [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printRedundantCandidates (n+1) "ton" (undefined :: Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not ] printRedundantCandidates n "&|" (undefined :: Bool -> Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not@@ -115,7 +115,7 @@ -- through other means {- printRedundantCandidates n "gcd" (undefined :: Int -> Int -> Int)- [ unfun (0::Int)+ [ con (0::Int) , fun "`mod`" (mod :: Int -> Int -> Int) ] -}
bench/redundants.txt view
@@ -228,32 +228,32 @@ class of 2 equivalent candidates: - x ? y = x + (x + y)+ x ? y = x + dec (dec x) - x ? y = y + (x + x)+ x ? y = dec x + dec x -class of 2 equivalent candidates:+class of 3 equivalent candidates: - x ? y = x + (y + y)+ x ? y = x + dec (dec y) - x ? y = y + (x + y)+ x ? y = y + dec (dec x) + x ? y = dec x + dec y + class of 2 equivalent candidates: - x ? y = x + dec (dec x)+ x ? y = x + (x + y) - x ? y = dec x + dec x+ x ? y = y + (x + x) -class of 3 equivalent candidates:-- x ? y = x + dec (dec y)+class of 2 equivalent candidates: - x ? y = y + dec (dec x)+ x ? y = x + (y + y) - x ? y = dec x + dec y+ x ? y = y + (x + y) class of 2 equivalent candidates:@@ -600,55 +600,44 @@ class of 2 equivalent candidates: - [] ?? xs = []- (x:xs) ?? [] = xs- (x:xs) ?? (y:ys) = xs ?? ys-- [] ?? xs = []- (x:xs) ?? [] = xs- (x:xs) ?? (y:ys) = xs ?? []---class of 2 equivalent candidates:-- [] ?? xs = []+ [] ?? xs = xs (x:xs) ?? [] = xs- (x:xs) ?? (y:ys) = ys ?? xs+ (x:xs) ?? (y:ys) = xs ++ ys - [] ?? xs = []+ [] ?? xs = xs (x:xs) ?? [] = xs- (x:xs) ?? (y:ys) = ys ?? []+ (x:xs) ?? (y:ys) = ys ++ xs class of 2 equivalent candidates: - [] ?? [] = []- [] ?? (x:xs) = xs ?? xs- (x:xs) ?? ys = xs+ [] ?? xs = xs+ (x:xs) ?? [] = []+ (x:xs) ?? (y:ys) = xs ++ ys - [] ?? [] = []- [] ?? (x:xs) = xs ?? []- (x:xs) ?? ys = xs+ [] ?? xs = xs+ (x:xs) ?? [] = []+ (x:xs) ?? (y:ys) = ys ++ xs class of 2 equivalent candidates: - [] ?? xs = xs+ [] ?? xs = [] (x:xs) ?? [] = xs (x:xs) ?? (y:ys) = xs ++ ys - [] ?? xs = xs+ [] ?? xs = [] (x:xs) ?? [] = xs (x:xs) ?? (y:ys) = ys ++ xs class of 2 equivalent candidates: - [] ?? xs = xs+ [] ?? xs = [] (x:xs) ?? [] = [] (x:xs) ?? (y:ys) = xs ++ ys - [] ?? xs = xs+ [] ?? xs = [] (x:xs) ?? [] = [] (x:xs) ?? (y:ys) = ys ++ xs @@ -657,22 +646,33 @@ [] ?? xs = [] (x:xs) ?? [] = xs- (x:xs) ?? (y:ys) = xs ++ ys+ (x:xs) ?? (y:ys) = xs ?? ys [] ?? xs = [] (x:xs) ?? [] = xs- (x:xs) ?? (y:ys) = ys ++ xs+ (x:xs) ?? (y:ys) = xs ?? [] class of 2 equivalent candidates: [] ?? xs = []- (x:xs) ?? [] = []- (x:xs) ?? (y:ys) = xs ++ ys+ (x:xs) ?? [] = xs+ (x:xs) ?? (y:ys) = ys ?? xs [] ?? xs = []- (x:xs) ?? [] = []- (x:xs) ?? (y:ys) = ys ++ xs+ (x:xs) ?? [] = xs+ (x:xs) ?? (y:ys) = ys ?? []+++class of 2 equivalent candidates:++ [] ?? [] = []+ [] ?? (x:xs) = xs ?? xs+ (x:xs) ?? ys = xs++ [] ?? [] = []+ [] ?? (x:xs) = xs ?? []+ (x:xs) ?? ys = xs
bench/runtime/lapmatrud/bench/candidates.runtime view
@@ -1,1 +1,1 @@-10.0+9.4
bench/runtime/lapmatrud/bench/carry-on.runtime view
@@ -1,1 +1,1 @@-2.6+2.4
bench/runtime/lapmatrud/bench/erroneous.runtime view
@@ -1,1 +1,1 @@-3.1+2.9
bench/runtime/lapmatrud/bench/gps.runtime view
@@ -1,1 +1,1 @@-15.8+14.2
bench/runtime/lapmatrud/bench/gps2.runtime view
@@ -1,1 +1,1 @@-12.7+11.7
bench/runtime/lapmatrud/bench/ill-hit.runtime view
@@ -1,1 +1,1 @@-0.7+0.5
bench/runtime/lapmatrud/bench/lowtests.runtime view
@@ -1,1 +1,1 @@-0.5+0.2
bench/runtime/lapmatrud/bench/p12.runtime view
@@ -1,1 +1,1 @@-1.7+1.6
bench/runtime/lapmatrud/bench/redundants.runtime view
@@ -1,1 +1,1 @@-3.2+3.1
bench/runtime/lapmatrud/bench/strategies.runtime view
@@ -1,1 +1,1 @@-6.0+4.6
bench/runtime/lapmatrud/bench/terpret.runtime view
@@ -1,1 +1,1 @@-7.7+10.2
bench/runtime/lapmatrud/bench/unique.runtime view
@@ -1,1 +1,1 @@-2.5+2.4
bench/runtime/lapmatrud/bench/weird.runtime view
@@ -1,1 +1,1 @@-2.6+3.3
bench/runtime/lapmatrud/eg/bits.runtime view
@@ -1,1 +1,1 @@-3.2+3.1
bench/runtime/lapmatrud/eg/bools.runtime view
@@ -1,1 +1,1 @@-1.9+1.6
bench/runtime/lapmatrud/eg/bst.runtime view
@@ -1,1 +1,1 @@-4.8+4.1
+ bench/runtime/lapmatrud/eg/conditionals.runtime view
@@ -0,0 +1,1 @@+8.7
bench/runtime/lapmatrud/eg/count.runtime view
@@ -1,1 +1,1 @@-0.8+0.5
+ bench/runtime/lapmatrud/eg/digits.runtime view
@@ -0,0 +1,1 @@+5.5
bench/runtime/lapmatrud/eg/dupos.runtime view
@@ -1,1 +1,1 @@-2.2+1.1
bench/runtime/lapmatrud/eg/factorial.runtime view
@@ -1,1 +1,1 @@-1.6+1.4
bench/runtime/lapmatrud/eg/fib01.runtime view
@@ -1,1 +1,1 @@-0.6+0.5
bench/runtime/lapmatrud/eg/fibonacci.runtime view
@@ -1,1 +1,1 @@-3.5+3.2
bench/runtime/lapmatrud/eg/gcd.runtime view
@@ -1,1 +1,1 @@-0.2+0.1
bench/runtime/lapmatrud/eg/higher.runtime view
@@ -1,1 +1,1 @@-1.4+0.9
bench/runtime/lapmatrud/eg/ints.runtime view
@@ -1,1 +1,1 @@-1.2+0.9
bench/runtime/lapmatrud/eg/list.runtime view
@@ -1,1 +1,1 @@-0.6+0.8
bench/runtime/lapmatrud/eg/oddeven.runtime view
@@ -1,1 +1,1 @@-1.6+1.7
bench/runtime/lapmatrud/eg/pow.runtime view
@@ -1,1 +1,1 @@-3.0+1.6
bench/runtime/lapmatrud/eg/setelem.runtime view
@@ -1,1 +1,1 @@-0.8+1.0
bench/runtime/lapmatrud/eg/sort.runtime view
@@ -1,1 +1,1 @@-3.4+1.8
bench/runtime/lapmatrud/eg/subset.runtime view
@@ -1,1 +1,1 @@-0.6+0.5
bench/runtime/lapmatrud/eg/these.runtime view
@@ -1,1 +1,1 @@-1.9+1.1
bench/runtime/lapmatrud/eg/tri.runtime view
@@ -1,1 +1,1 @@-0.3+0.2
bench/runtime/lapmatrud/eg/tuple.runtime view
@@ -1,1 +1,1 @@-0.8+0.7
bench/runtime/zero/bench/candidates.runtime view
@@ -1,1 +1,1 @@-17.4+18.5
bench/runtime/zero/bench/carry-on.runtime view
@@ -1,1 +1,1 @@-4.8+5.4
bench/runtime/zero/bench/erroneous.runtime view
@@ -1,1 +1,1 @@-5.6+6.9
bench/runtime/zero/bench/gps.runtime view
@@ -1,1 +1,1 @@-27.9+34.3
bench/runtime/zero/bench/gps2.runtime view
@@ -1,1 +1,1 @@-22.8+24.9
bench/runtime/zero/bench/ill-hit.runtime view
@@ -1,1 +1,1 @@-1.1+1.2
bench/runtime/zero/bench/lowtests.runtime view
@@ -1,1 +1,1 @@-0.8+0.6
bench/runtime/zero/bench/p12.runtime view
@@ -1,1 +1,1 @@-3.0+3.5
bench/runtime/zero/bench/redundants.runtime view
@@ -1,1 +1,1 @@-6.2+8.1
bench/runtime/zero/bench/strategies.runtime view
@@ -1,1 +1,1 @@-9.1+10.7
bench/runtime/zero/bench/terpret.runtime view
@@ -1,1 +1,1 @@-14.2+22.8
bench/runtime/zero/bench/unique.runtime view
@@ -1,1 +1,1 @@-4.8+5.3
bench/runtime/zero/bench/weird.runtime view
@@ -1,1 +1,1 @@-4.7+7.3
bench/runtime/zero/eg/arith.runtime view
@@ -1,1 +1,1 @@-1.9+2.4
bench/runtime/zero/eg/bits.runtime view
@@ -1,1 +1,1 @@-5.8+6.1
bench/runtime/zero/eg/bools.runtime view
@@ -1,1 +1,1 @@-3.2+3.4
+ bench/runtime/zero/eg/conditionals.runtime view
@@ -0,0 +1,1 @@+16.4
bench/runtime/zero/eg/count.runtime view
@@ -1,1 +1,1 @@-1.1+1.2
+ bench/runtime/zero/eg/digits.runtime view
@@ -0,0 +1,1 @@+10.9
bench/runtime/zero/eg/dupos.runtime view
@@ -1,1 +1,1 @@-3.7+2.5
bench/runtime/zero/eg/either.runtime view
@@ -1,1 +1,1 @@-0.3+0.4
bench/runtime/zero/eg/factorial.runtime view
@@ -1,1 +1,1 @@-2.5+2.8
bench/runtime/zero/eg/fib01.runtime view
@@ -1,1 +1,1 @@-1.1+1.2
bench/runtime/zero/eg/fibonacci.runtime view
@@ -1,1 +1,1 @@-6.2+6.9
bench/runtime/zero/eg/higher.runtime view
@@ -1,1 +1,1 @@-1.8+2.0
bench/runtime/zero/eg/ints.runtime view
@@ -1,1 +1,1 @@-1.9+2.2
bench/runtime/zero/eg/list.runtime view
@@ -1,1 +1,1 @@-1.6+1.8
bench/runtime/zero/eg/oddeven.runtime view
@@ -1,1 +1,1 @@-3.0+3.7
bench/runtime/zero/eg/pow.runtime view
@@ -1,1 +1,1 @@-5.2+3.6
bench/runtime/zero/eg/replicate.runtime view
@@ -1,1 +1,1 @@-0.4+0.5
bench/runtime/zero/eg/setelem.runtime view
@@ -1,1 +1,1 @@-1.9+2.1
bench/runtime/zero/eg/sort.runtime view
@@ -1,1 +1,1 @@-6.0+3.9
bench/runtime/zero/eg/spec.runtime view
@@ -1,1 +1,1 @@-1.5+1.9
bench/runtime/zero/eg/take-drop.runtime view
@@ -1,1 +1,1 @@-0.6+0.7
bench/runtime/zero/eg/tapps.runtime view
@@ -1,1 +1,1 @@-0.8+1.0
bench/runtime/zero/eg/these.runtime view
@@ -1,1 +1,1 @@-3.4+2.3
bench/runtime/zero/eg/tree.runtime view
@@ -1,1 +1,1 @@-2.6+3.2
bench/runtime/zero/proto/u-conjure.runtime view
@@ -1,1 +1,1 @@-0.4+0.5
bench/self.hs view
@@ -13,8 +13,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , maxSize 3
bench/self.txt view
@@ -2,35 +2,35 @@ -- testing 360 combinations of argument values -- pruning with 0/0 rules -- 4 candidates of size 1--- 6 candidates of size 2--- 26 candidates of size 3--- tested 12 candidates+-- 0 candidates of size 2+-- 24 candidates of size 3+-- tested 6 candidates x ? y = x + y (?) :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules -- 4 candidates of size 1--- 4 candidates of size 2--- 31 candidates of size 3--- tested 22 candidates+-- 0 candidates of size 2+-- 24 candidates of size 3+-- tested 18 candidates x ? y = x * y i :: Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules -- 3 candidates of size 1--- 2 candidates of size 2--- 13 candidates of size 3--- tested 8 candidates+-- 0 candidates of size 2+-- 10 candidates of size 3+-- tested 6 candidates i x = x + 1 d :: Int -> Int -- testing 360 combinations of argument values -- pruning with 0/0 rules -- 3 candidates of size 1--- 3 candidates of size 2--- 12 candidates of size 3--- tested 18 candidates+-- 0 candidates of size 2+-- 10 candidates of size 3+-- tested 13 candidates d = undefined -- search exhausted
bench/strategies.hs view
@@ -27,10 +27,10 @@ "default" -> [1,1,1,0] "without reasoning" -> [0,1,1,0] "without descent" -> [1,0,1,0]- "without ad-hoc" -> [1,1,0,0]+ "without assorted" -> [1,1,0,0] "only reasoning" -> [1,0,0,0] "only descent" -> [0,1,0,0]- "only ad-hoc" -> [0,0,1,0]+ "only assorted" -> [0,0,1,0] "only typed" -> [0,0,0,0] _ -> error "unknown strategy" @@ -45,10 +45,10 @@ , "default" , "without reasoning" , "without descent"- , "without ad-hoc"+ , "without assorted" , "only reasoning" , "only descent"- , "only ad-hoc"+ , "only assorted" , "only typed" ] @@ -61,8 +61,8 @@ ingredients :: [Ingredient] ingredients = - [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)
bench/strategies.txt view
@@ -3,13 +3,13 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 18 candidates of size 5+-- 0 candidates of size 6+-- 67 candidates of size 7+-- tested 88 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -18,13 +18,13 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 23 candidates of size 5+-- 0 candidates of size 6+-- 147 candidates of size 7+-- tested 173 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -33,13 +33,13 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 15 candidates of size 3+-- 0 candidates of size 4+-- 270 candidates of size 5+-- 0 candidates of size 6+-- 5572 candidates of size 7+-- tested 5848 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -48,28 +48,28 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 23 candidates of size 5+-- 0 candidates of size 6+-- 232 candidates of size 7+-- tested 226 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) --- strategy: without ad-hoc+-- strategy: without assorted factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 3 candidates of size 1--- 6 candidates of size 2--- 9 candidates of size 3--- 18 candidates of size 4--- 31 candidates of size 5--- 59 candidates of size 6--- 171 candidates of size 7--- tested 137 candidates+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 25 candidates of size 5+-- 1 candidates of size 6+-- 148 candidates of size 7+-- tested 176 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -78,13 +78,13 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 3 candidates of size 1--- 6 candidates of size 2--- 9 candidates of size 3--- 18 candidates of size 4--- 41 candidates of size 5--- 64 candidates of size 6--- 307 candidates of size 7--- tested 251 candidates+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 35 candidates of size 5+-- 6 candidates of size 6+-- 284 candidates of size 7+-- tested 244 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -93,28 +93,28 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 3 candidates of size 1--- 6 candidates of size 2--- 18 candidates of size 3--- 36 candidates of size 4--- 287 candidates of size 5--- 571 candidates of size 6--- 5843 candidates of size 7--- tested 946 candidates+-- 0 candidates of size 2+-- 15 candidates of size 3+-- 0 candidates of size 4+-- 272 candidates of size 5+-- 1 candidates of size 6+-- 5573 candidates of size 7+-- tested 5851 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) --- strategy: only ad-hoc+-- strategy: only assorted factorial :: Int -> Int -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 15 candidates of size 3+-- 0 candidates of size 4+-- 270 candidates of size 5+-- 0 candidates of size 6+-- 6090 candidates of size 7+-- tested 6196 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -123,13 +123,13 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 3 candidates of size 1--- 6 candidates of size 2--- 18 candidates of size 3--- 36 candidates of size 4--- 315 candidates of size 5--- 585 candidates of size 6--- 6915 candidates of size 7--- tested 1876 candidates+-- 0 candidates of size 2+-- 15 candidates of size 3+-- 0 candidates of size 4+-- 300 candidates of size 5+-- 15 candidates of size 6+-- 6645 candidates of size 7+-- tested 6241 candidates factorial 0 = 1 factorial x = x * factorial (x - 1)
bench/terpret.hs view
@@ -33,15 +33,15 @@ -- the same ingredients are used for TerpreT #1, #2 and #3 ingredients123 :: [Ingredient] ingredients123 =- [ unfun False- , unfun True+ [ con False+ , con True , fun "not" not , fun "&&" (&&) , fun "||" (||)- , unfun ([] :: [Bool])+ , con ([] :: [Bool]) , fun ":" ((:) :: Bool -> [Bool] -> [Bool]) --, fun "map" (map :: (Bool -> Bool) -> [Bool] -> [Bool])- , iif (undefined :: [Bool])+ , guard ] @@ -110,13 +110,13 @@ conjure "cshift" t4p1 $ ingredients123 ++ [ fun ",," ((,,) :: Bool -> Bool -> Bool -> (Bool,Bool,Bool))- , iif (undefined :: (Bool,Bool,Bool))+ , guard , target 50400 ] conjure "cshift" t4p2 $ ingredients123 ++ [ fun ",," ((,,) :: Bool -> Bool -> Bool -> (Bool,Bool,Bool))- , iif (undefined :: (Bool,Bool,Bool))+ , guard ] @@ -136,15 +136,12 @@ t5c = do putStrLn "TerpreT benchmark #5: full adder\n" - -- using ingredients123 below works, but increases the runtime to 18 seconds- -- let's leave it commented out so runtime is faster when running automated tests- -- BENCHMARK: uncomment ingredients123- conjure "fadder" t5p $ -- ingredients123 +++ conjure "fadder" t5p $ ingredients123 ++ [ fun "not" not , fun "," ((,) :: Bool -> Bool -> (Bool,Bool)) , fun "==" ((==) :: Bool -> Bool -> Bool) -- , fun "^^" ((/=) :: Bool -> Bool -> Bool) -- poor man's xor- , iif (undefined :: (Bool,Bool))+ , guard ] -- the printed function is weird, but correct -- fadder p q r = if p == q then (p,r) else (r,not r)@@ -165,7 +162,7 @@ [ fun ",," ((,,) :: Bool -> Bool -> Bool -> (Bool,Bool,Bool)) , fun "==" ((==) :: Bool -> Bool -> Bool) , fun "^^" ((/=) :: Bool -> Bool -> Bool) -- poor man's xor- , iif (undefined :: (Bool,Bool,Bool))+ , guard , maxSize 6 ] @@ -192,9 +189,9 @@ ] conjure "`access`" t7p- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun ([] :: [A])+ [ con (0 :: Int)+ , con (1 :: Int)+ , con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) , fun "-" ((-) :: Int -> Int -> Int) , fun "undefined" (undefined :: A)@@ -212,8 +209,8 @@ putStrLn "TerpreT benchmark #8: decrement elements\n" conjure "decrelements" t8p- [ unfun (1 :: Int)- , unfun ([] :: [Int])+ [ con (1 :: Int)+ , con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "-" ((-) :: Int -> Int -> Int) , fun "map" (map :: (Int -> Int) -> [Int] -> [Int])@@ -222,8 +219,8 @@ -- introduce lambdas conjure "decrelements" t8p- [ unfun (1 :: Int)- , unfun ([] :: [Int])+ [ con (1 :: Int)+ , con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "-" ((-) :: Int -> Int -> Int) , fun "map" (map :: (Int -> Int) -> [Int] -> [Int])
bench/terpret.txt view
@@ -7,9 +7,9 @@ -- 0 candidates of size 2 -- 4 candidates of size 3 -- 0 candidates of size 4--- 11 candidates of size 5--- 5 candidates of size 6--- tested 18 candidates+-- 8 candidates of size 5+-- 1 candidates of size 6+-- tested 15 candidates invert [] = [] invert (p:ps) = not p:invert ps @@ -33,40 +33,43 @@ -- 0 candidates of size 2 -- 4 candidates of size 3 -- 0 candidates of size 4--- 11 candidates of size 5--- 5 candidates of size 6--- 31 candidates of size 7--- 52 candidates of size 8--- 128 candidates of size 9--- tested 154 candidates+-- 8 candidates of size 5+-- 1 candidates of size 6+-- 16 candidates of size 7+-- 4 candidates of size 8+-- 35 candidates of size 9+-- 15 candidates of size 10+-- tested 71 candidates decrement [] = []-decrement (p:ps) = not p:(if p then ps else decrement ps)+decrement (p:ps)+ | p = False:ps+ | otherwise = True:decrement ps TerpreT benchmark #4: controlled shift cshift :: (Bool,Bool,Bool) -> (Bool,Bool,Bool) -- testing 4 combinations of argument values--- pruning with 41/51 rules+-- pruning with 37/47 rules -- reasoning produced 2 incorrect properties, please re-run with more tests for faster results -- 1 candidates of size 1 -- 0 candidates of size 2 -- 0 candidates of size 3--- 10 candidates of size 4--- 0 candidates of size 5--- 0 candidates of size 6--- 40 candidates of size 7--- 0 candidates of size 8--- 0 candidates of size 9--- 360 candidates of size 10--- 4 candidates of size 11--- tested 412 candidates-cshift (p,q,r) = if p- then (p,r,q)- else (p,q,r)+-- 12 candidates of size 4+-- 125 candidates of size 5+-- 225 candidates of size 6+-- 665 candidates of size 7+-- 1242 candidates of size 8+-- 3087 candidates of size 9+-- 9281 candidates of size 10+-- 180325 candidates of size 11+-- tested 40096 candidates+cshift (p,q,r)+ | p = (p,r,q)+ | otherwise = (p,q,r) cshift :: Bool -> Bool -> Bool -> (Bool,Bool,Bool) -- testing 4 combinations of argument values--- pruning with 41/51 rules+-- pruning with 37/47 rules -- reasoning produced 2 incorrect properties, please re-run with more tests for faster results -- 0 candidates of size 1 -- 0 candidates of size 2@@ -84,16 +87,16 @@ fadder :: Bool -> Bool -> Bool -> (Bool,Bool) -- testing 8 combinations of argument values--- pruning with 18/22 rules+-- pruning with 72/90 rules -- 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--- 36 candidates of size 6--- 45 candidates of size 7--- 271 candidates of size 8--- tested 406 candidates+-- 25 candidates of size 3+-- 60 candidates of size 4+-- 126 candidates of size 5+-- 348 candidates of size 6+-- 999 candidates of size 7+-- 7009 candidates of size 8+-- tested 8567 candidates fadder False False False = (False,False) fadder False False True = (False,True) fadder False True False = (False,True)@@ -107,15 +110,15 @@ adder2 :: (Bool,Bool) -> (Bool,Bool) -> (Bool,Bool,Bool) -- testing 5 combinations of argument values--- pruning with 74/92 rules+-- pruning with 70/88 rules -- reasoning produced 2 incorrect properties, please re-run with more tests for faster results -- 0 candidates of size 1 -- 0 candidates of size 2 -- 0 candidates of size 3 -- 8 candidates of size 4--- 0 candidates of size 5--- 0 candidates of size 6--- tested 8 candidates+-- 128 candidates of size 5+-- 408 candidates of size 6+-- tested 544 candidates adder2 = undefined -- search exhausted TerpreT benchmark #7: access@@ -153,10 +156,10 @@ -- 0 candidates of size 2 -- 2 candidates of size 3 -- 1 candidates of size 4--- 6 candidates of size 5+-- 4 candidates of size 5 -- 6 candidates of size 6--- 19 candidates of size 7--- tested 19 candidates+-- 10 candidates of size 7+-- tested 25 candidates decrelements [] = [] decrelements (x:xs) = x - 1:decrelements xs
bench/unique.hs view
@@ -64,43 +64,43 @@ let n = 5 printUniqueCandidates (n+2) "foo" (undefined :: Int -> Int)- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ] printUniqueCandidates n "?" (undefined :: Int -> Int -> Int)- [ unfun (0 :: Int)+ [ con (0 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "dec" (subtract 1 :: Int -> Int) ] printUniqueCandidates (n+2) "goo" (undefined :: [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printUniqueCandidates n "??" (undefined :: [Int] -> [Int] -> [Int])- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] printUniqueCandidates (n+2) "ton" (undefined :: Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not ] printUniqueCandidates n "&|" (undefined :: Bool -> Bool -> Bool)- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "not" not
bench/unique.txt view
@@ -142,8 +142,6 @@ foo 1 = 1 foo x = 0 -foo x = x * x - 1- foo x = x + (x + x) foo x = x + (x + 1)@@ -178,6 +176,8 @@ foo x = 1 - x * x +foo x = x * x - 1+ foo 1 = 0 foo x = x + x @@ -206,9 +206,6 @@ foo x = 1 - x foo 0 = 0-foo x = x * x - 1--foo 0 = 0 foo x = x + (x + 1) foo 0 = 0@@ -235,7 +232,7 @@ foo 0 = 0 foo x = 1 - x * x -foo 0 = 1+foo 0 = 0 foo x = x * x - 1 foo 0 = 1@@ -277,6 +274,9 @@ foo 0 = 1 foo x = 0 - (x + 1) +foo 0 = 1+foo x = x * x - 1+ foo 0 = 0 foo 1 = 0 foo x = x + 1@@ -317,63 +317,6 @@ foo 1 = 1 foo x = 0 - x -foo 0 = 0-foo x = x + foo (x - 1)--foo 0 = 0-foo x = foo (x - 1) + 1--foo 0 = 0-foo x = x * foo (x - 1)--foo 0 = 0-foo x = x - foo (x - 1)--foo 0 = 0-foo x = foo (x - 1) - x--foo 0 = 0-foo x = foo (x - 1) - 1--foo 0 = 0-foo x = 1 - foo (x - 1)--foo 0 = 1-foo x = x + foo (x - 1)--foo 0 = 1-foo x = foo (x - 1) + 1--foo 0 = 1-foo x = x * foo (x - 1)--foo 0 = 1-foo x = x - foo (x - 1)--foo 0 = 1-foo x = foo (x - 1) - x--foo 0 = 1-foo x = foo (x - 1) - 1--foo 0 = 1-foo x = 0 - foo (x - 1)--foo 0 = 1-foo x = 1 - foo (x - 1)--foo x = x * (x + x) - 1--foo x = x * (x * x) - 1--foo x = x * (x - 1) - 1--foo x = x * (0 - x) - 1--foo x = x * (1 - x) - 1--foo x = x + (x * x - 1)- foo x = x + (x + (x + x)) foo x = x + (x + (x + 1))@@ -396,6 +339,8 @@ foo x = x + (1 - x * x) +foo x = x + (x * x - 1)+ foo x = 1 + (1 + (x + 1)) foo x = 1 + (1 + x * x)@@ -412,8 +357,6 @@ foo x = 1 + (1 - x * x) -foo x = x * (x * x - 1)- foo x = x * (x + (x + x)) foo x = x * (x + x * x)@@ -438,8 +381,12 @@ foo x = x * (1 - x * x) +foo x = x * (x * x - 1)+ foo x = x - (1 + (x + 1)) +foo x = x - (1 + x * x)+ foo x = x - (1 + (1 - x)) foo x = 0 - (x + (x + x))@@ -448,6 +395,8 @@ foo x = 0 - (1 + (x + 1)) +foo x = 0 - (1 + x * x)+ foo x = 0 - (1 + (1 - x)) foo x = 1 - (x + (x + x))@@ -464,6 +413,12 @@ foo x = x * x - (x + x) +foo x = x * x - (x + 1)++foo x = x * (x + x) - 1++foo x = x * (x * x) - 1+ foo 1 = 0 foo x = x + (x + x) @@ -507,9 +462,6 @@ foo x = 1 - (x + x) foo 1 = 1-foo x = x * x - 1--foo 1 = 1 foo x = x + (x + x) foo 1 = 1@@ -551,7 +503,55 @@ foo 1 = 1 foo x = 1 - x * x +foo 1 = 1+foo x = x * x - 1 +foo 0 = 0+foo x = x + foo (x - 1)++foo 0 = 0+foo x = foo (x - 1) + 1++foo 0 = 0+foo x = x * foo (x - 1)++foo 0 = 0+foo x = x - foo (x - 1)++foo 0 = 0+foo x = foo (x - 1) - x++foo 0 = 0+foo x = foo (x - 1) - 1++foo 0 = 0+foo x = 1 - foo (x - 1)++foo 0 = 1+foo x = x + foo (x - 1)++foo 0 = 1+foo x = foo (x - 1) + 1++foo 0 = 1+foo x = x * foo (x - 1)++foo 0 = 1+foo x = x - foo (x - 1)++foo 0 = 1+foo x = foo (x - 1) - x++foo 0 = 1+foo x = foo (x - 1) - 1++foo 0 = 1+foo x = 0 - foo (x - 1)++foo 0 = 1+foo x = 1 - foo (x - 1)++ Unique candidates for: ? :: Int -> Int -> Int pruning with 13/34 rules [3,8,25,71,205] candidates@@ -624,6 +624,10 @@ 0 ? x = 0 x ? y = y +x ? y = dec (dec x)++x ? y = dec (dec y)+ x ? y = x + x x ? y = x + y@@ -636,10 +640,6 @@ x ? y = y * y -x ? y = dec (dec x)--x ? y = dec (dec y)- x ? 0 = x x ? y = dec x @@ -694,16 +694,16 @@ x ? 0 = x x ? y = y +x ? y = dec (dec (dec x))++x ? y = dec (dec (dec y))+ x ? y = dec (x * x) x ? y = dec (x * y) x ? y = dec (y * y) -x ? y = dec (dec (dec x))--x ? y = dec (dec (dec y))- x ? y = x + dec x x ? y = x + dec y@@ -719,6 +719,12 @@ x ? y = y * dec y x ? 0 = x+x ? y = dec (dec x)++x ? 0 = x+x ? y = dec (dec y)++x ? 0 = x x ? y = x + x x ? 0 = x@@ -733,10 +739,10 @@ x ? 0 = x x ? y = y * y -x ? 0 = x+x ? 0 = 0 x ? y = dec (dec x) -x ? 0 = x+x ? 0 = 0 x ? y = dec (dec y) x ? 0 = 0@@ -748,15 +754,18 @@ x ? 0 = 0 x ? y = x * x -x ? 0 = 0-x ? y = dec (dec x)--x ? 0 = 0-x ? y = dec (dec y)- x ? 0 = dec x x ? y = dec y +x ? 0 = dec (dec x)+x ? y = x++x ? 0 = dec (dec x)+x ? y = y++x ? 0 = dec (dec x)+x ? y = 0+ x ? 0 = x + x x ? y = x @@ -775,14 +784,11 @@ x ? 0 = x * x x ? y = 0 -x ? 0 = dec (dec x)-x ? y = x--x ? 0 = dec (dec x)-x ? y = y+0 ? x = x+x ? y = dec (dec x) -x ? 0 = dec (dec x)-x ? y = 0+0 ? x = x+x ? y = dec (dec y) 0 ? x = x x ? y = x + x@@ -799,10 +805,10 @@ 0 ? x = x x ? y = y * y -0 ? x = x+0 ? x = 0 x ? y = dec (dec x) -0 ? x = x+0 ? x = 0 x ? y = dec (dec y) 0 ? x = 0@@ -814,40 +820,34 @@ 0 ? x = 0 x ? y = y * y -0 ? x = 0-x ? y = dec (dec x)--0 ? x = 0-x ? y = dec (dec y)- 0 ? x = dec x x ? y = dec x -0 ? x = x + x+0 ? x = dec (dec x) x ? y = x -0 ? x = x + x+0 ? x = dec (dec x) x ? y = y -0 ? x = x + x+0 ? x = dec (dec x) x ? y = 0 -0 ? x = x * x+0 ? x = x + x x ? y = x -0 ? x = x * x+0 ? x = x + x x ? y = y -0 ? x = x * x+0 ? x = x + x x ? y = 0 -0 ? x = dec (dec x)+0 ? x = x * x x ? y = x -0 ? x = dec (dec x)+0 ? x = x * x x ? y = y -0 ? x = dec (dec x)+0 ? x = x * x x ? y = 0 0 ? x = x@@ -906,35 +906,9 @@ x ? 0 = 0 x ? y = x -x ? 0 = x-x ? y = y ? dec x--x ? 0 = x-x ? y = y ? dec y--x ? 0 = x-x ? y = dec x ? x--x ? 0 = x-x ? y = dec x ? y--x ? 0 = x-x ? y = dec y ? x--0 ? x = x-x ? y = x ? dec y--0 ? x = x-x ? y = y ? dec x--0 ? x = x-x ? y = y ? dec y--0 ? x = x-x ? y = dec x ? x+x ? y = dec (dec (dec (dec x))) -0 ? x = x-x ? y = dec y ? x+x ? y = dec (dec (dec (dec y))) x ? y = dec (dec (x * x)) @@ -942,10 +916,6 @@ x ? y = dec (dec (y * y)) -x ? y = dec (dec (dec (dec x)))--x ? y = dec (dec (dec (dec y)))- x ? y = dec (x * dec x) x ? y = dec (x * dec y)@@ -954,6 +924,10 @@ x ? y = dec (y * dec y) +x ? y = x + dec (dec x)++x ? y = x + dec (dec y)+ x ? y = x + (x + x) x ? y = x + (x + y)@@ -966,9 +940,7 @@ x ? y = x + y * y -x ? y = x + dec (dec x)--x ? y = x + dec (dec y)+x ? y = y + dec (dec y) x ? y = y + (y + y) @@ -978,8 +950,10 @@ x ? y = y + y * y -x ? y = y + dec (dec y)+x ? y = x * dec (dec x) +x ? y = x * dec (dec y)+ x ? y = x * (x + x) x ? y = x * (x + y)@@ -992,9 +966,9 @@ x ? y = x * (y * y) -x ? y = x * dec (dec x)+x ? y = y * dec (dec x) -x ? y = x * dec (dec y)+x ? y = y * dec (dec y) x ? y = y * (x + y) @@ -1002,10 +976,6 @@ x ? y = y * (y * y) -x ? y = y * dec (dec x)--x ? y = y * dec (dec y)- x ? y = dec x * dec x x ? y = dec x * dec y@@ -1013,19 +983,19 @@ x ? y = dec y * dec y x ? 0 = x-x ? y = dec (x * x)+x ? y = dec (dec (dec x)) x ? 0 = x-x ? y = dec (x * y)+x ? y = dec (dec (dec y)) x ? 0 = x-x ? y = dec (y * y)+x ? y = dec (x * x) x ? 0 = x-x ? y = dec (dec (dec x))+x ? y = dec (x * y) x ? 0 = x-x ? y = dec (dec (dec y))+x ? y = dec (y * y) x ? 0 = x x ? y = x + dec x@@ -1049,19 +1019,19 @@ x ? y = y * dec y x ? 0 = 0-x ? y = dec (x * x)+x ? y = dec (dec (dec x)) x ? 0 = 0-x ? y = dec (x * y)+x ? y = dec (dec (dec y)) x ? 0 = 0-x ? y = dec (y * y)+x ? y = dec (x * x) x ? 0 = 0-x ? y = dec (dec (dec x))+x ? y = dec (x * y) x ? 0 = 0-x ? y = dec (dec (dec y))+x ? y = dec (y * y) x ? 0 = 0 x ? y = x + dec x@@ -1079,6 +1049,12 @@ x ? y = x * dec y x ? 0 = dec x+x ? y = dec (dec x)++x ? 0 = dec x+x ? y = dec (dec y)++x ? 0 = dec x x ? y = x + x x ? 0 = dec x@@ -1096,11 +1072,11 @@ x ? 0 = dec x x ? y = y * y -x ? 0 = dec x-x ? y = dec (dec x)+x ? 0 = dec (dec x)+x ? y = dec x -x ? 0 = dec x-x ? y = dec (dec y)+x ? 0 = dec (dec x)+x ? y = dec y x ? 0 = x + x x ? y = dec x@@ -1114,28 +1090,22 @@ x ? 0 = x * x x ? y = dec y -x ? 0 = dec (dec x)-x ? y = dec x--x ? 0 = dec (dec x)-x ? y = dec y--x ? 0 = dec (x * x)+x ? 0 = dec (dec (dec x)) x ? y = x -x ? 0 = dec (x * x)+x ? 0 = dec (dec (dec x)) x ? y = y -x ? 0 = dec (x * x)+x ? 0 = dec (dec (dec x)) x ? y = 0 -x ? 0 = dec (dec (dec x))+x ? 0 = dec (x * x) x ? y = x -x ? 0 = dec (dec (dec x))+x ? 0 = dec (x * x) x ? y = y -x ? 0 = dec (dec (dec x))+x ? 0 = dec (x * x) x ? y = 0 x ? 0 = x + dec x@@ -1157,19 +1127,19 @@ x ? y = 0 0 ? x = x-x ? y = dec (x * x)+x ? y = dec (dec (dec x)) 0 ? x = x-x ? y = dec (x * y)+x ? y = dec (dec (dec y)) 0 ? x = x-x ? y = dec (y * y)+x ? y = dec (x * x) 0 ? x = x-x ? y = dec (dec (dec x))+x ? y = dec (x * y) 0 ? x = x-x ? y = dec (dec (dec y))+x ? y = dec (y * y) 0 ? x = x x ? y = x + dec x@@ -1193,19 +1163,19 @@ x ? y = y * dec y 0 ? x = 0-x ? y = dec (x * x)+x ? y = dec (dec (dec x)) 0 ? x = 0-x ? y = dec (x * y)+x ? y = dec (dec (dec y)) 0 ? x = 0-x ? y = dec (y * y)+x ? y = dec (x * x) 0 ? x = 0-x ? y = dec (dec (dec x))+x ? y = dec (x * y) 0 ? x = 0-x ? y = dec (dec (dec y))+x ? y = dec (y * y) 0 ? x = 0 x ? y = x + dec x@@ -1223,6 +1193,12 @@ x ? y = y * dec y 0 ? x = dec x+x ? y = dec (dec x)++0 ? x = dec x+x ? y = dec (dec y)++0 ? x = dec x x ? y = x + x 0 ? x = dec x@@ -1240,11 +1216,11 @@ 0 ? x = dec x x ? y = y * y -0 ? x = dec x-x ? y = dec (dec x)+0 ? x = dec (dec x)+x ? y = dec x -0 ? x = dec x-x ? y = dec (dec y)+0 ? x = dec (dec x)+x ? y = dec y 0 ? x = x + x x ? y = dec x@@ -1258,28 +1234,22 @@ 0 ? x = x * x x ? y = dec y -0 ? x = dec (dec x)-x ? y = dec x--0 ? x = dec (dec x)-x ? y = dec y--0 ? x = dec (x * x)+0 ? x = dec (dec (dec x)) x ? y = x -0 ? x = dec (x * x)+0 ? x = dec (dec (dec x)) x ? y = y -0 ? x = dec (x * x)+0 ? x = dec (dec (dec x)) x ? y = 0 -0 ? x = dec (dec (dec x))+0 ? x = dec (x * x) x ? y = x -0 ? x = dec (dec (dec x))+0 ? x = dec (x * x) x ? y = y -0 ? x = dec (dec (dec x))+0 ? x = dec (x * x) x ? y = 0 0 ? x = x + dec x@@ -1302,6 +1272,14 @@ 0 ? x = x x ? 0 = x+x ? y = dec (dec x)++0 ? x = x+x ? 0 = x+x ? y = dec (dec y)++0 ? x = x+x ? 0 = x x ? y = x + x 0 ? x = x@@ -1321,11 +1299,11 @@ x ? y = y * y 0 ? x = x-x ? 0 = x+x ? 0 = 0 x ? y = dec (dec x) 0 ? x = x-x ? 0 = x+x ? 0 = 0 x ? y = dec (dec y) 0 ? x = x@@ -1337,83 +1315,75 @@ x ? y = x * x 0 ? x = x-x ? 0 = 0-x ? y = dec (dec x)--0 ? x = x-x ? 0 = 0-x ? y = dec (dec y)--0 ? x = x x ? 0 = dec x x ? y = dec y 0 ? x = x-x ? 0 = x + x+x ? 0 = dec (dec x) x ? y = x 0 ? x = x-x ? 0 = x + x+x ? 0 = dec (dec x) x ? y = 0 0 ? x = x-x ? 0 = x * x+x ? 0 = x + x x ? y = x 0 ? x = x-x ? 0 = x * x+x ? 0 = x + x x ? y = 0 0 ? x = x-x ? 0 = dec (dec x)+x ? 0 = x * x x ? y = x 0 ? x = x-x ? 0 = dec (dec x)+x ? 0 = x * x x ? y = 0 0 ? x = 0 x ? 0 = x-x ? y = y + y+x ? y = dec (dec x) 0 ? x = 0 x ? 0 = x-x ? y = y * y+x ? y = dec (dec y) 0 ? x = 0 x ? 0 = x-x ? y = dec (dec x)+x ? y = y + y 0 ? x = 0 x ? 0 = x-x ? y = dec (dec y)+x ? y = y * y 0 ? x = 0 x ? 0 = 0-x ? y = x + y+x ? y = dec (dec x) 0 ? x = 0 x ? 0 = 0-x ? y = dec (dec x)+x ? y = dec (dec y) 0 ? x = 0 x ? 0 = 0-x ? y = dec (dec y)+x ? y = x + y 0 ? x = 0 x ? 0 = dec x x ? y = dec y 0 ? x = 0-x ? 0 = x + x+x ? 0 = dec (dec x) x ? y = y 0 ? x = 0-x ? 0 = x * x+x ? 0 = x + x x ? y = y 0 ? x = 0-x ? 0 = dec (dec x)+x ? 0 = x * x x ? y = y 0 ? x = dec x@@ -1436,39 +1406,39 @@ x ? 0 = dec x x ? y = 0 -0 ? x = x + x+0 ? x = dec (dec x) x ? 0 = x x ? y = y -0 ? x = x + x+0 ? x = dec (dec x) x ? 0 = x x ? y = 0 -0 ? x = x + x+0 ? x = dec (dec x) x ? 0 = 0 x ? y = x -0 ? x = x * x+0 ? x = x + x x ? 0 = x x ? y = y -0 ? x = x * x+0 ? x = x + x x ? 0 = x x ? y = 0 -0 ? x = x * x+0 ? x = x + x x ? 0 = 0 x ? y = x -0 ? x = dec (dec x)+0 ? x = x * x x ? 0 = x x ? y = y -0 ? x = dec (dec x)+0 ? x = x * x x ? 0 = x x ? y = 0 -0 ? x = dec (dec x)+0 ? x = x * x x ? 0 = 0 x ? y = x @@ -1476,7 +1446,37 @@ 0 ? x = dec x x ? y = dec x +x ? 0 = x+x ? y = y ? dec x +x ? 0 = x+x ? y = y ? dec y++x ? 0 = x+x ? y = dec x ? x++x ? 0 = x+x ? y = dec x ? y++x ? 0 = x+x ? y = dec y ? x++0 ? x = x+x ? y = x ? dec y++0 ? x = x+x ? y = y ? dec x++0 ? x = x+x ? y = y ? dec y++0 ? x = x+x ? y = dec x ? x++0 ? x = x+x ? y = dec y ? x++ Unique candidates for: goo :: [Int] -> [Int] pruning with 4/4 rules [2,1,1,2,4,7,10] candidates@@ -1505,14 +1505,14 @@ goo [] = [] goo (x:xs) = xs ++ xs +goo xs = xs ++ (xs ++ xs)+ goo [] = [] goo (x:xs) = xs ++ goo xs goo [] = [] goo (x:xs) = goo xs ++ xs -goo xs = xs ++ (xs ++ xs)- goo [] = [] goo (x:xs) = x:x:xs @@ -1531,6 +1531,8 @@ goo [] = [] goo (x:xs) = xs ++ (xs ++ xs) +goo xs = xs ++ (xs ++ (xs ++ xs))+ goo [] = [] goo (x:xs) = x:x:goo xs @@ -1558,9 +1560,7 @@ goo [] = [] goo (x:xs) = goo xs ++ (xs ++ xs) -goo xs = xs ++ (xs ++ (xs ++ xs)) - Unique candidates for: ?? :: [Int] -> [Int] -> [Int] pruning with 4/4 rules [3,8,15,43,122] candidates@@ -1657,12 +1657,6 @@ (x:xs) ?? ys = [] xs ?? [] = xs-xs ?? (x:ys) = ys ?? xs--[] ?? xs = xs-(x:xs) ?? ys = ys ?? xs--xs ?? [] = xs xs ?? (x:ys) = x:xs xs ?? [] = xs@@ -1763,62 +1757,12 @@ (x:xs) ?? [] = xs (x:xs) ?? (y:ys) = [] -[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? []--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? xs = xs-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? []--[] ?? xs = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = xs-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = ys--[] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = xs ?? ys+xs ?? [] = xs+xs ?? (x:ys) = ys ?? xs [] ?? xs = xs-(x:xs) ?? [] = []-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = xs ?? ys--[] ?? xs = []-(x:xs) ?? [] = xs-(x:xs) ?? (y:ys) = ys ?? xs--[] ?? xs = []-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = xs--[] ?? xs = []-(x:xs) ?? [] = xs ?? xs-(x:xs) ?? (y:ys) = ys--[] ?? [] = []-[] ?? (x:xs) = xs (x:xs) ?? ys = ys ?? xs -[] ?? [] = []-[] ?? (x:xs) = xs-(x:xs) ?? ys = [] ?? xs--[] ?? [] = []-[] ?? (x:xs) = xs ?? xs-(x:xs) ?? ys = xs- xs ?? ys = xs ++ (xs ++ xs) xs ?? ys = xs ++ (xs ++ ys)@@ -2102,6 +2046,62 @@ [] ?? [] = [] [] ?? (x:xs) = xs ++ xs (x:xs) ?? ys = []++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? []++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? xs = xs+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? []++[] ?? xs = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = xs+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = xs ?? ys++[] ?? xs = xs+(x:xs) ?? [] = []+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = xs ?? ys++[] ?? xs = []+(x:xs) ?? [] = xs+(x:xs) ?? (y:ys) = ys ?? xs++[] ?? xs = []+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = xs++[] ?? xs = []+(x:xs) ?? [] = xs ?? xs+(x:xs) ?? (y:ys) = ys++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = ys ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs+(x:xs) ?? ys = [] ?? xs++[] ?? [] = []+[] ?? (x:xs) = xs ?? xs+(x:xs) ?? ys = xs Unique candidates for: ton :: Bool -> Bool
bench/weird.hs view
@@ -19,8 +19,19 @@ x ^^^ 0 = x _ ^^^ _ = 0 +-- | inc or square based on boolean argument+-- except for 0 where the answer is swapped+isq :: Bool -> Int -> Int+isq False 0 = 0+isq True 0 = 1+isq False x = x + 1+isq True x = x * x+ main :: IO () main = do+ -- TODO: Conjure should find isq, but doesn't due to overpruning+ conjure "isq" isq ingredients+ conjure "^^^" (^^^) ingredients conjure "^^^" (^^^) $ ingredients ++ [singlePattern] @@ -31,8 +42,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "==" ((==) :: Int -> Int -> Bool)
bench/weird.txt view
@@ -1,10 +1,27 @@+isq :: Bool -> Int -> Int+-- testing 360 combinations of argument values+-- pruning with 56/91 rules+-- 3 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 6 candidates of size 4+-- 8 candidates of size 5+-- 48 candidates of size 6+-- 63 candidates of size 7+-- 301 candidates of size 8+-- tested 432 candidates+isq False 0 = 0+isq False x = x + 1+isq True 0 = 1+isq True x = x * x+ (^^^) :: Int -> Int -> Int -- testing 360 combinations of argument values -- pruning with 56/91 rules -- 4 candidates of size 1--- 6 candidates of size 2--- 10 candidates of size 3--- tested 19 candidates+-- 0 candidates of size 2+-- 9 candidates of size 3+-- tested 13 candidates 0 ^^^ x = x x ^^^ 0 = x x ^^^ y = 0@@ -22,7 +39,7 @@ -- 996 candidates of size 8 -- 1266 candidates of size 9 -- 11700 candidates of size 10--- tested 6683 candidates+-- tested 11507 candidates x ^^^ y = if 0 == x * y then x + y else 0
changelog.md view
@@ -2,6 +2,19 @@ ============================ +v0.7.6 (August 2025)+--------------------++* Flip-flop: `con` replaces `unfun`.+* Allow chains of guards, or multiple guards.+* Replace `omitEarlyTests` by `maxEarlyTests`, defaulting to 12.+* Improve pruning through early tests.+* Fix `requireDescent` switch+* Fix overpruning in early tests.+* Refactor parts of `Engine.candidateDefnsC`.+* Cleanup built-in examples.++ v0.7.4 (May 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.7.4+version: 0.7.6 synopsis: synthesize Haskell functions out of partial definitions description: Conjure is a tool that synthesizes Haskell functions out of partial definitions.@@ -58,7 +58,6 @@ , GHC==9.8 , GHC==9.6 , GHC==9.4- , GHC==9.2 , GHC==9.0 , GHC==8.8 @@ -69,7 +68,7 @@ source-repository this type: git location: https://github.com/rudymatela/conjure- tag: v0.7.4+ tag: v0.7.6 library exposed-modules: Conjure
eg/arith.hs view
@@ -48,8 +48,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) ]
eg/arith.txt view
@@ -2,61 +2,61 @@ -- testing 4 combinations of argument values -- pruning with 14/25 rules -- 3 candidates of size 1--- 1 candidates of size 2--- 6 candidates of size 3--- tested 5 candidates+-- 0 candidates of size 2+-- 3 candidates of size 3+-- tested 4 candidates double x = x + x triple :: Int -> Int -- testing 4 combinations of argument values -- pruning with 14/25 rules -- 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+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 0 candidates of size 4+-- 8 candidates of size 5+-- tested 7 candidates triple x = x + (x + x) add :: Int -> Int -> Int -- testing 4 combinations of argument values -- pruning with 14/25 rules -- 4 candidates of size 1--- 6 candidates of size 2--- 10 candidates of size 3--- tested 12 candidates+-- 0 candidates of size 2+-- 8 candidates of size 3+-- tested 6 candidates add x y = x + y square :: Int -> Int -- testing 3 combinations of argument values -- pruning with 14/25 rules -- 3 candidates of size 1--- 1 candidates of size 2--- 4 candidates of size 3--- tested 7 candidates+-- 0 candidates of size 2+-- 3 candidates of size 3+-- tested 6 candidates square x = x * x cube :: Int -> Int -- testing 3 combinations of argument values -- pruning with 14/25 rules -- 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+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 0 candidates of size 4+-- 8 candidates of size 5+-- tested 14 candidates cube x = x * (x * x) tnpo :: Int -> Int -- testing 3 combinations of argument values -- pruning with 14/25 rules -- 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+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 0 candidates of size 4+-- 8 candidates of size 5+-- 0 candidates of size 6+-- 27 candidates of size 7+-- tested 16 candidates tnpo x = x + (x + (x + 1))
eg/bits.hs view
@@ -19,8 +19,8 @@ main :: IO () main = do conjure "bitsum" bitsum- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "halve" ((`div` 2) :: Int -> Int) , fun "parity" ((`mod` 2) :: Int -> Int) , fun "+" ((+) :: Int -> Int -> Int)@@ -29,9 +29,9 @@ -- bitsum n = parity n + bitsum (halve n) conjure "bitsum" bitsum- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (2 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int)+ , con (2 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "`div`" (div :: Int -> Int -> Int) , fun "`mod`" (mod :: Int -> Int -> Int)
eg/bits.txt view
@@ -2,13 +2,13 @@ -- testing 8 combinations of argument values -- pruning with 21/25 rules -- 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+-- 2 candidates of size 2+-- 4 candidates of size 3+-- 8 candidates of size 4+-- 19 candidates of size 5+-- 56 candidates of size 6+-- 152 candidates of size 7+-- tested 216 candidates bitsum 0 = 0 bitsum x = parity x + bitsum (halve x) @@ -16,15 +16,15 @@ -- testing 8 combinations of argument values -- pruning with 27/32 rules -- 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+-- 0 candidates of size 2+-- 15 candidates of size 3+-- 0 candidates of size 4+-- 233 candidates of size 5+-- 0 candidates of size 6+-- 4297 candidates of size 7+-- 72 candidates of size 8+-- 85204 candidates of size 9+-- tested 88434 candidates bitsum 0 = 0 bitsum x = x `mod` 2 + bitsum (x `div` 2)
eg/bools.hs view
@@ -25,8 +25,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun False- , unfun True+ [ con False+ , con True , fun "not" not , fun "||" (||) , fun "&&" (&&)
eg/bools.txt view
@@ -5,8 +5,8 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 2 candidates of size 4--- 4 candidates of size 5--- tested 8 candidates+-- 2 candidates of size 5+-- tested 6 candidates and [] = True and (p:ps) = p && and ps @@ -17,7 +17,7 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 2 candidates of size 4--- 4 candidates of size 5+-- 2 candidates of size 5 -- tested 5 candidates or [] = False or (p:ps) = p || or ps@@ -29,7 +29,7 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 4 candidates of size 4--- tested 6 candidates+-- tested 4 candidates and = foldr (&&) True or :: [Bool] -> Bool@@ -39,6 +39,6 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 4 candidates of size 4--- tested 5 candidates+-- tested 3 candidates or = foldr (||) False
eg/bst.hs view
@@ -123,7 +123,7 @@ main :: IO () main = do conjure "mem" mem- [ unfun False+ [ con False , fun "||" (||) , fun "==" ((==) :: Int -> Int -> Bool) , fun "<" ((<) :: Int -> Int -> Bool)@@ -131,15 +131,15 @@ ] conjure "mem" mem- [ unfun False- , unfun True+ [ con False+ , con True , fun "`compare`" (compare :: Int -> Int -> Ordering) , ordcase (undefined :: Bool) ] -- simply out of reach performance-wise (reaching 16 but need size 22) conjure "insert" insert- [ unfun Leaf+ [ con Leaf , fun "Node" Node , fun "unit" unit , fun "`compare`" (compare :: Int -> Int -> Ordering)@@ -150,7 +150,7 @@ -- reachable in 15s, candidate #32878 at size 14. -- increase target to 50400 to reach... conjureFromSpec "before" beforeSpec- [ unfun Leaf+ [ con Leaf , fun "Node" Node , fun "==" ((==) :: Int -> Int -> Bool) , fun "<" ((<) :: Int -> Int -> Bool)@@ -161,7 +161,7 @@ -- reachable in 14s, candidate #32747 at size 14. -- increase target to 50400 to reach... conjureFromSpec "beyond" beyondSpec- [ unfun Leaf+ [ con Leaf , fun "Node" Node , fun "==" ((==) :: Int -> Int -> Bool) , fun "<=" ((<) :: Int -> Int -> Bool)@@ -172,7 +172,7 @@ -- with 15, this reaches the solution, using 12 for shorter runtime -- using maxEquationSize = 7 reduces runtime from 13s to 11s conjureFromSpec "before" beforeSpec- [ unfun Leaf+ [ con Leaf , fun "Node" Node , fun "`compare`" (compare :: Int -> Int -> Ordering) , ordcase (undefined :: Tree)@@ -183,7 +183,7 @@ -- with 15, this reaches the solution, using 12 for shorter runtime -- using maxEquationSize = 7 reduces runtime from 13s to 11s conjureFromSpec "beyond" beyondSpec- [ unfun Leaf+ [ con Leaf , fun "Node" Node , fun "`compare`" (compare :: Int -> Int -> Ordering) , ordcase (undefined :: Tree)@@ -193,7 +193,7 @@ -- reachable in 55s, candidate #173109 at size 13. conjure "union" union- [ unfun Leaf+ [ con Leaf , fun "Node" Node , fun "before" before , fun "beyond" beyond
eg/bst.txt view
@@ -9,11 +9,11 @@ -- 0 candidates of size 6 -- 0 candidates of size 7 -- 24 candidates of size 8--- 72 candidates of size 9+-- 48 candidates of size 9 -- 0 candidates of size 10--- 240 candidates of size 11--- 96 candidates of size 12--- tested 362 candidates+-- 180 candidates of size 11+-- 80 candidates of size 12+-- tested 274 candidates mem x Leaf = False mem x (Node t1 y t2) = mem x t1 || (x == y || mem x t2) @@ -29,10 +29,10 @@ -- 6 candidates of size 7 -- 0 candidates of size 8 -- 0 candidates of size 9--- 192 candidates of size 10+-- 32 candidates of size 10 -- 0 candidates of size 11--- 384 candidates of size 12--- tested 346 candidates+-- 160 candidates of size 12+-- tested 106 candidates mem x Leaf = False mem x (Node t1 y t2) = case x `compare` y of LT -> mem x t1@@ -51,10 +51,10 @@ -- 26 candidates of size 7 -- 0 candidates of size 8 -- 0 candidates of size 9--- 200 candidates of size 10+-- 176 candidates of size 10 -- 0 candidates of size 11 -- 32 candidates of size 12--- tested 264 candidates+-- tested 240 candidates insert = undefined -- search exhausted before :: Int -> Tree -> Tree@@ -132,10 +132,10 @@ -- 22 candidates of size 4 -- 0 candidates of size 5 -- 68 candidates of size 6--- 240 candidates of size 7+-- 152 candidates of size 7 -- 82 candidates of size 8--- 3018 candidates of size 9--- 8098 candidates of size 10--- tested 11531 candidates+-- 2438 candidates of size 9+-- 3970 candidates of size 10+-- tested 6735 candidates union = undefined -- search exhausted
eg/colin/IntFuns.hs view
@@ -15,7 +15,7 @@ triIngredients :: [Ingredient] triIngredients = [ fun "==" ((==) :: Int -> Int -> Bool)- , unfun (1::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "dec" ((\x -> x-1) :: Int -> Int) ]@@ -37,8 +37,8 @@ fibIngredients :: [Ingredient] fibIngredients = [ fun "<=" ((<=) :: Int -> Int -> Bool)- , unfun (0::Int)- , unfun (1::Int)+ , con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "dec" ((\x -> x-1) :: Int -> Int) ]@@ -79,7 +79,7 @@ [ fun "==" ((==) :: [Int] -> [Int] -> Bool) , fun "factors" ((\n -> filter (\k -> n `mod` k == 0) [1..n]) :: Int -> [Int]) , fun "list2" ((\i j -> [i,j]) :: Int -> Int -> [Int])- , unfun (1 :: Int)+ , con (1 :: Int) ] -- looking through 38 candidates, 100% match, 7/7 assignments
eg/colin/ListFuns.hs view
@@ -13,7 +13,7 @@ sumBackground :: [Ingredient] sumBackground =- [ unfun (0::Int)+ [ con (0::Int) , fun "+" ((+) :: Int -> Int -> Int) ] @@ -44,7 +44,7 @@ memBackground :: [Ingredient] memBackground =- [ unfun False+ [ con False , fun "==" ((==) :: Int -> Int -> Bool) , fun "&&" ((&&) :: Bool -> Bool -> Bool) , fun "||" ((||) :: Bool -> Bool -> Bool)@@ -69,8 +69,8 @@ subBackground :: [Ingredient] subBackground =- [ unfun True- , unfun False+ [ con True+ , con False , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "==" ((==) :: Int -> Int -> Bool) , iif (undefined :: Bool)@@ -112,9 +112,9 @@ takeBackground :: [Ingredient] takeBackground =- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun ([] :: [A])+ [ con (0 :: Int)+ , con (1 :: Int)+ , con ([] :: [A]) , fun "-" ((-) :: Int -> Int -> Int) , fun ":" ((:) :: A -> [A] -> [A]) ]@@ -134,9 +134,9 @@ dropBackground :: [Ingredient] dropBackground =- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun ([] :: [A])+ [ con (0 :: Int)+ , con (1 :: Int)+ , con ([] :: [A]) , fun "-" ((-) :: Int -> Int -> Int) ] @@ -155,7 +155,7 @@ ordBackground :: [Ingredient] ordBackground =- [ unfun True+ [ con True , fun "null" (null :: [Int] -> Bool) , fun "head" (head :: [Int] -> Int) , fun "<=" ((<=) :: Int -> Int -> Bool)@@ -179,7 +179,7 @@ mergeBackground :: [Ingredient] mergeBackground = [ fun "<=" ((<=) :: Int -> Int -> Bool)- , unfun ([] :: [Int])+ , con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , iif (undefined :: [Int]) ]@@ -197,7 +197,7 @@ zipBackground :: [Ingredient] zipBackground =- [ unfun ([] :: [(A,B)])+ [ con ([] :: [(A,B)]) , fun "(,)" ((,) :: A -> B -> (A,B)) , fun ":" ((:) :: (A,B) -> [(A,B)] -> [(A,B)]) ]@@ -214,7 +214,7 @@ assocsBackground :: [Ingredient] assocsBackground =- [ unfun ([] :: [A])+ [ con ([] :: [A]) , fun "==" ((==) :: Int -> Int -> Bool) , fun ":" ((:) :: A -> [A] -> [A]) , fun "fst" (fst :: (Int,A) -> Int)
+ eg/conditionals.hs view
@@ -0,0 +1,105 @@+-- conditionals.hs: assorted functions involving conditionals+--+-- Copyright (C) 2021-2025 Rudy Matela+-- Distributed under the 3-Clause BSD licence (see the file LICENSE).+import Conjure++negate' :: Int -> Int+negate' 1 = -1+negate' 2 = -2+negate' (-1) = 1+negate' (-2) = 2++abs' :: Int -> Int+abs' 1 = 1+abs' 2 = 2+abs' (-1) = 1+abs' (-2) = 2++signum' :: Int -> Int+signum' 0 = 0+signum' 1 = 1+signum' 2 = 1+signum' 3 = 1+signum' (-1) = -1+signum' (-2) = -1+signum' (-3) = -1++compare' :: Int -> Int -> Ordering+compare' 0 0 = EQ+compare' 1 1 = EQ+compare' 2 2 = EQ+compare' 0 1 = LT+compare' 1 2 = LT+compare' 1 0 = GT+compare' 2 1 = GT+compare' (-1) 0 = LT+compare' 0 (-1) = GT++min' :: Int -> Int -> Int -> Int+min' 0 1 2 = 0+min' 0 2 1 = 0+min' 2 3 1 = 1+min' 1 0 2 = 0+min' 4 3 1 = 1+min' 4 1 3 = 1++max' :: Int -> Int -> Int -> Int+max' 0 1 2 = 2+max' 0 2 1 = 2+max' 2 3 1 = 3+max' 1 0 2 = 2+max' 4 3 1 = 4+max' 4 1 3 = 4++median' :: Int -> Int -> Int -> Int+median' 0 1 2 = 1+median' 0 2 1 = 1+median' 2 3 1 = 2+median' 1 0 2 = 1+median' 4 3 1 = 3+median' 4 1 3 = 3++main :: IO ()+main = do+ conjure "negate" negate' ingredients+ conjure "abs" abs' ingredients+ conjure "signum" signum' ingredients+ conjure "compare" compare' compareIngredients++ conjure "min" min' mmmIngredients+ conjure "max" max' mmmIngredients+ -- median is unreachable performance-wise with ifs+ -- conjure "median" median' mmmIngredients+ -- it is reachale with max and min on the background though...+ -- (cf. bench/gps, #27 Median)++ingredients :: [Ingredient]+ingredients =+ [ con (0::Int)+ , con (1::Int)+ , con (-1::Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "-" ((-) :: Int -> Int -> Int)+ , fun "*" ((*) :: Int -> Int -> Int)+ , fun "<" ((<) :: Int -> Int -> Bool)+ , guard+ ]++compareIngredients :: [Ingredient]+compareIngredients =+ [ con EQ+ , con LT+ , con GT+ , fun "==" ((==) :: Int -> Int -> Bool)+ , fun "<" ((<) :: Int -> Int -> Bool)+--, fun "<=" ((<=) :: Int -> Int -> Bool)+ , guard+ ]++mmmIngredients :: [Ingredient]+mmmIngredients =+ [ fun "<=" ((<=) :: Int -> Int -> Bool)+ , iif (undefined :: Int)+ , target 50400+ ]
+ eg/conditionals.txt view
@@ -0,0 +1,109 @@+negate :: Int -> Int+-- testing 4 combinations of argument values+-- pruning with 64/99 rules+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 5 candidates of size 3+-- tested 8 candidates+negate x = 0 - x++abs :: Int -> Int+-- testing 4 combinations of argument values+-- pruning with 64/99 rules+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 5 candidates of size 3+-- 0 candidates of size 4+-- 19 candidates of size 5+-- 48 candidates of size 6+-- 109 candidates of size 7+-- 253 candidates of size 8+-- tested 249 candidates+abs x+ | 0 < x = x+ | otherwise = 0 - x++signum :: Int -> Int+-- testing 7 combinations of argument values+-- pruning with 64/99 rules+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 5 candidates of size 3+-- 0 candidates of size 4+-- 19 candidates of size 5+-- 48 candidates of size 6+-- 97 candidates of size 7+-- tested 163 candidates+signum 0 = 0+signum x+ | x < 0 = -1+ | otherwise = 1++compare :: Int -> Int -> Ordering+-- testing 9 combinations of argument values+-- pruning with 5/6 rules+-- 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+-- 18 candidates of size 6+-- 0 candidates of size 7+-- 0 candidates of size 8+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 162 candidates of size 11+-- tested 31 candidates+compare x y+ | x == y = EQ+ | x < y = LT+ | otherwise = GT++min :: Int -> Int -> Int -> Int+-- testing 6 combinations of argument values+-- pruning with 4/4 rules+-- 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+-- 0 candidates of size 10+-- 2592 candidates of size 11+-- 0 candidates of size 12+-- 0 candidates of size 13+-- 0 candidates of size 14+-- 0 candidates of size 15+-- 248400 candidates of size 16+-- tested 49553 candidates+min x y z = if x <= y+ then if x <= z then x else z+ else if y <= z then y else z++max :: Int -> Int -> Int -> Int+-- testing 6 combinations of argument values+-- pruning with 4/4 rules+-- 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+-- 0 candidates of size 10+-- 2592 candidates of size 11+-- 0 candidates of size 12+-- 0 candidates of size 13+-- 0 candidates of size 14+-- 0 candidates of size 15+-- 248400 candidates of size 16+-- tested 50103 candidates+max x y z = if x <= y+ then if y <= z then z else y+ else if x <= z then z else x+
eg/count.hs view
@@ -38,8 +38,8 @@ -- count x [] = 0 -- count x (y:xs) = count x xs + (if x == y then 1 else 0) conjure "count" count'- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "==" ((==) :: A -> A -> Bool) , iif (undefined :: Int)@@ -48,8 +48,8 @@ -- a little bit larger, guards are only allowed at the root -- so there is a need to repeat the recursive call twice conjure "count" count'- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "==" ((==) :: A -> A -> Bool) , guard
eg/count.txt view
@@ -23,7 +23,7 @@ -- 16 candidates of size 9 -- 20 candidates of size 10 -- 44 candidates of size 11--- tested 65 candidates+-- tested 57 candidates count x [] = 0 count x (y:xs) = (if x == y then 1 else 0) + count x xs @@ -43,7 +43,7 @@ -- 20 candidates of size 11 -- 44 candidates of size 12 -- 64 candidates of size 13--- tested 127 candidates+-- tested 155 candidates count x [] = 0 count x (y:xs) | x == y = 1 + count x xs
+ eg/digits.hs view
@@ -0,0 +1,68 @@+-- digits.hs: functions over digits+--+-- Copyright (C) 2025 Rudy Matela+-- Distributed under the 3-Clause BSD licence (see the file LICENSE).+import Conjure++-- decimal digit sum+digitSum :: Int -> Int+digitSum 0 = 0+digitSum 12 = 3+digitSum 42 = 6+digitSum 1337 = 14+digitSum 31337 = 17++digitCount :: Int -> Int -> Int+digitCount 2 42 = 2+digitCount 1 111 = 3+digitCount 4 144 = 144+digitCount 0 1080 = 2+digitCount 3 1337 = 2+digitCount 3 31337 = 3++digits :: Int -> [Int]+digits 12 = [1,2]+digits 42 = [4,2]+digits 1337 = [1,3,3,7]+digits 31337 = [3,1,3,3,7]++main :: IO ()+main = do+ conjure "revdigits" (reverse . digits)+ [ con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "`mod`" (mod :: Int -> Int -> Int)+ , con (0 :: Int)+ , con (10 :: Int)+ ]++ conjure "digits" digits+ [ con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "++" ((++) :: [Int] -> [Int] -> [Int])+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "`mod`" (mod :: Int -> Int -> Int)+ , con (0 :: Int)+ , con (10 :: Int)+ ]++ conjure "digitSum" digitSum+ [ con (0 :: Int)+ , con (10 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "`mod`" (mod :: Int -> Int -> Int)+ ]++ -- out-of-reach performance-wise+ conjure "digitCount" digitCount+ [ con (0 :: Int)+ , con (10 :: Int)+ , fun "+" ((+) :: Int -> Int -> Int)+ , fun "`div`" (div :: Int -> Int -> Int)+ , fun "`mod`" (mod :: Int -> Int -> Int)+ , fun "==" ((==) :: Int -> Int -> Bool)+ , guard+ , maxTests 1080+ ]
+ eg/digits.txt view
@@ -0,0 +1,64 @@+revdigits :: Int -> [Int]+-- testing 4 combinations of argument values+-- pruning with 9/9 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 0 candidates of size 4+-- 24 candidates of size 5+-- 0 candidates of size 6+-- 287 candidates of size 7+-- 0 candidates of size 8+-- 4180 candidates of size 9+-- tested 4481 candidates+revdigits 0 = []+revdigits x = x `mod` 10:revdigits (x `div` 10)++digits :: Int -> [Int]+-- testing 4 combinations of argument values+-- pruning with 13/13 rules+-- 1 candidates of size 1+-- 0 candidates of size 2+-- 3 candidates of size 3+-- 0 candidates of size 4+-- 24 candidates of size 5+-- 0 candidates of size 6+-- 287 candidates of size 7+-- 0 candidates of size 8+-- 4186 candidates of size 9+-- 18 candidates of size 10+-- 67104 candidates of size 11+-- tested 71513 candidates+digits 0 = []+digits x = digits (x `div` 10) ++ [x `mod` 10]++digitSum :: Int -> Int+-- testing 5 combinations of argument values+-- pruning with 18/22 rules+-- 3 candidates of size 1+-- 0 candidates of size 2+-- 12 candidates of size 3+-- 0 candidates of size 4+-- 165 candidates of size 5+-- 0 candidates of size 6+-- 2680 candidates of size 7+-- 84 candidates of size 8+-- 46993 candidates of size 9+-- tested 49164 candidates+digitSum 0 = 0+digitSum x = x `mod` 10 + digitSum (x `div` 10)++digitCount :: Int -> Int -> Int+-- testing 3 combinations of argument values+-- pruning with 20/26 rules+-- reasoning produced 15 incorrect properties, please re-run with more tests for faster results+-- 4 candidates of size 1+-- 0 candidates of size 2+-- 29 candidates of size 3+-- 0 candidates of size 4+-- 545 candidates of size 5+-- 156 candidates of size 6+-- 12715 candidates of size 7+-- tested 13449 candidates+digitCount = undefined -- search exhausted+
eg/dupos.hs view
@@ -52,7 +52,7 @@ -- else duplicates xs -- 17 -- within reach performance wise. conjure "duplicates" duplicates'- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun "not" not , fun "&&" (&&) , fun ":" ((:) :: Int -> [Int] -> [Int])@@ -61,7 +61,7 @@ ] conjureFromSpec "duplicates" duplicatesSpec- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun "not" not , fun "&&" (&&) , fun ":" ((:) :: Int -> [Int] -> [Int])@@ -70,8 +70,8 @@ ] conjure "positionsFrom" positionsFrom'- [ unfun ([] :: [Int])- , unfun (1 :: Int)+ [ con ([] :: [Int])+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "==" ((==) :: A -> A -> Bool)
eg/dupos.txt view
@@ -5,20 +5,20 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 0 candidates of size 4--- 1 candidates of size 5+-- 0 candidates of size 5 -- 0 candidates of size 6--- 1 candidates of size 7--- 6 candidates of size 8--- 5 candidates of size 9--- 16 candidates of size 10--- 11 candidates of size 11--- 26 candidates of size 12--- 23 candidates of size 13+-- 0 candidates of size 7+-- 2 candidates of size 8+-- 4 candidates of size 9+-- 8 candidates of size 10+-- 8 candidates of size 11+-- 14 candidates of size 12+-- 22 candidates of size 13 -- 52 candidates of size 14--- 49 candidates of size 15--- 78 candidates of size 16--- 75 candidates of size 17--- tested 271 candidates+-- 74 candidates of size 15+-- 120 candidates of size 16+-- 156 candidates of size 17+-- tested 461 candidates duplicates [] = [] duplicates (x:xs) | elem x xs && not (elem x (duplicates xs)) = x:duplicates xs@@ -37,13 +37,13 @@ -- 13 candidates of size 9 -- 18 candidates of size 10 -- 21 candidates of size 11--- 28 candidates of size 12--- 39 candidates of size 13--- 54 candidates of size 14--- 67 candidates of size 15--- 80 candidates of size 16--- 99 candidates of size 17--- tested 340 candidates+-- 32 candidates of size 12+-- 57 candidates of size 13+-- 102 candidates of size 14+-- 159 candidates of size 15+-- 228 candidates of size 16+-- 331 candidates of size 17+-- tested 979 candidates duplicates [] = [] duplicates (x:xs) | elem x xs && not (elem x (duplicates xs)) = x:duplicates xs@@ -58,13 +58,13 @@ -- 0 candidates of size 4 -- 7 candidates of size 5 -- 0 candidates of size 6--- 34 candidates of size 7+-- 26 candidates of size 7 -- 0 candidates of size 8--- 133 candidates of size 9--- 8 candidates of size 10--- 510 candidates of size 11--- 40 candidates of size 12--- 1943 candidates of size 13--- tested 2678 candidates+-- 97 candidates of size 9+-- 0 candidates of size 10+-- 362 candidates of size 11+-- 0 candidates of size 12+-- 1363 candidates of size 13+-- tested 1858 candidates positionsFrom = undefined -- search exhausted
eg/either.hs view
@@ -59,9 +59,9 @@ [ fun "Left" (Left :: A -> Either A A) , fun "Right" (Right :: A -> Either A A) - , unfun False- , unfun True+ , con False+ , con True - , unfun ([] :: [A])+ , con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) ]
eg/factorial.hs view
@@ -15,8 +15,8 @@ main = do -- explicit recursion conjure "factorial n" factorial- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)@@ -27,8 +27,8 @@ -- using foldr and enumFromTo conjure "factorial n" factorial- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)
eg/factorial.txt view
@@ -2,13 +2,13 @@ -- testing 4 combinations of argument values -- pruning with 27/65 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 23 candidates of size 5+-- 0 candidates of size 6+-- 147 candidates of size 7+-- tested 173 candidates factorial 0 = 1 factorial x = x * factorial (x - 1) @@ -16,11 +16,11 @@ -- testing 4 combinations of argument values -- pruning with 32/72 rules -- 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+-- 0 candidates of size 2+-- 6 candidates of size 3+-- 0 candidates of size 4+-- 23 candidates of size 5+-- 40 candidates of size 6+-- tested 57 candidates factorial x = foldr (*) 1 [1..x]
eg/fib01.hs view
@@ -31,7 +31,7 @@ -- Found! It takes about 12 seconds to run with maxSize=8 -- running with maxSize = 5 for faster runtime conjure "fib01" fib01- [ unfun (0::Int)+ [ con (0::Int) , fun "dec" (subtract 1 :: Int -> Int) , fun "+" ((+) :: Int -> Int -> Int) , maxSize 5@@ -41,7 +41,7 @@ -- It takes about 27 seconds to run with maxSize=12 -- running with maxSize = 9 for faster runtime conjure "fib01" fib01- [ unfun (0::Int)+ [ con (0::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "dec" (subtract 1 :: Int -> Int) , fun "<=" ((<=) :: Int -> Int -> Bool)
eg/fib01.txt view
@@ -2,11 +2,11 @@ -- testing 8 combinations of argument values -- pruning with 6/10 rules -- 4 candidates of size 1--- 14 candidates of size 2--- 38 candidates of size 3--- 111 candidates of size 4--- 255 candidates of size 5--- tested 422 candidates+-- 3 candidates of size 2+-- 9 candidates of size 3+-- 9 candidates of size 4+-- 27 candidates of size 5+-- tested 52 candidates fib01 = undefined -- search exhausted fib01 :: Int -> Int -> Int -> Int
eg/fibonacci.hs view
@@ -16,9 +16,9 @@ main :: IO () main = do conjure "fibonacci n" fibonacci- [ unfun (0::Int)- , unfun (1::Int)- , unfun (2::Int)+ [ con (0::Int)+ , con (1::Int)+ , con (2::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ]
eg/fibonacci.txt view
@@ -2,18 +2,18 @@ -- testing 7 combinations of argument values -- pruning with 21/44 rules -- 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--- 538 candidates of size 10--- 2661 candidates of size 11--- 2661 candidates of size 12--- tested 4133 candidates+-- 0 candidates of size 2+-- 7 candidates of size 3+-- 0 candidates of size 4+-- 18 candidates of size 5+-- 0 candidates of size 6+-- 94 candidates of size 7+-- 20 candidates of size 8+-- 466 candidates of size 9+-- 92 candidates of size 10+-- 2298 candidates of size 11+-- 542 candidates of size 12+-- tested 3531 candidates fibonacci 0 = 1 fibonacci 1 = 1 fibonacci x = fibonacci (x - 1) + fibonacci (x - 2)
eg/gcd.hs view
@@ -19,7 +19,7 @@ main :: IO () main = conjure "gcd a b" gcd'- [ unfun (0::Int)+ [ con (0::Int) , fun "`mod`" (mod :: Int -> Int -> Int) ] -- desired function:
eg/gcd.txt view
@@ -2,12 +2,12 @@ -- testing 11 combinations of argument values -- pruning with 0/0 rules -- 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+-- 0 candidates of size 2+-- 8 candidates of size 3+-- 0 candidates of size 4+-- 48 candidates of size 5+-- 28 candidates of size 6+-- tested 63 candidates gcd x 0 = x gcd x y = gcd y (x `mod` y)
eg/higher.hs view
@@ -59,7 +59,7 @@ ingredients :: [Ingredient] ingredients =- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , guard ]
eg/higher.txt view
@@ -30,7 +30,7 @@ -- 2 candidates of size 5 -- 5 candidates of size 6 -- 7 candidates of size 7--- tested 13 candidates+-- tested 19 candidates map f [] = [] map f (x:xs) = f x:map f xs @@ -43,9 +43,9 @@ -- 4 candidates of size 5 -- 23 candidates of size 6 -- 19 candidates of size 7--- tested 38 candidates+-- tested 43 candidates fold f x [] = x-fold f x (y:xs) = fold f (f x y) xs+fold f x (y:xs) = f x (fold f y xs) filter :: (Int -> Bool) -> [Int] -> [Int] -- pruning with 3/3 rules@@ -58,10 +58,10 @@ -- 0 candidates of size 7 -- 15 candidates of size 8 -- 0 candidates of size 9--- 21 candidates of size 10+-- 25 candidates of size 10 -- 0 candidates of size 11--- 33 candidates of size 12--- tested 47 candidates+-- 63 candidates of size 12+-- tested 113 candidates filter f [] = [] filter f (x:xs) | f x = x:filter f xs
eg/ints.hs view
@@ -39,15 +39,15 @@ ] conjure "sum" sum- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) ] conjure "product" product- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) ]@@ -57,8 +57,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) ]
eg/list.hs view
@@ -56,30 +56,30 @@ main :: IO () main = do conjure "length" length'- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) ] conjure "reverse" reverse'- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] conjure "++" (+++)- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) ] conjure "++" (+++)- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "foldr" (foldr :: (Int -> [Int] -> [Int]) -> [Int] -> [Int] -> [Int]) ] conjure "last" last'- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "null" (null :: [Int] -> Bool) , guard@@ -87,26 +87,26 @@ ] conjure "last" last'- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "undefined" (undefined :: Int) , maxPatternDepth 2 ] conjure "zip" (zip')- [ unfun ([] :: [(Int,Int)])+ [ con ([] :: [(Int,Int)]) , fun ":" ((:) :: (Int,Int) -> [(Int,Int)] -> [(Int,Int)]) , fun "," ((,) :: Int -> Int -> (Int,Int)) ] conjure "\\/" (\/)- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) ] conjure "ordered" ordered'- [ unfun False- , unfun True+ [ con False+ , con True , fun "&&" (&&) , fun "||" (||) , fun "<=" ((<=) :: Int -> Int -> Bool)
eg/list.txt view
@@ -17,10 +17,10 @@ -- 0 candidates of size 2 -- 1 candidates of size 3 -- 0 candidates of size 4--- 4 candidates of size 5+-- 2 candidates of size 5 -- 1 candidates of size 6--- 10 candidates of size 7--- tested 16 candidates+-- 4 candidates of size 7+-- tested 9 candidates reverse [] = [] reverse (x:xs) = reverse xs ++ [x] @@ -32,8 +32,8 @@ -- 0 candidates of size 3 -- 10 candidates of size 4 -- 25 candidates of size 5--- 34 candidates of size 6--- tested 56 candidates+-- 24 candidates of size 6+-- tested 40 candidates [] ++ xs = xs (x:xs) ++ ys = x:(xs ++ ys) @@ -44,7 +44,7 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 14 candidates of size 4--- tested 16 candidates+-- tested 6 candidates xs ++ ys = foldr (:) ys xs last :: [Int] -> Int@@ -72,7 +72,7 @@ -- 1 candidates of size 4 -- 2 candidates of size 5 -- 2 candidates of size 6--- tested 5 candidates+-- tested 6 candidates last [] = undefined last [x] = x last (x:y:xs) = last (y:xs)@@ -87,9 +87,9 @@ -- 0 candidates of size 5 -- 0 candidates of size 6 -- 0 candidates of size 7--- 6 candidates of size 8--- 23 candidates of size 9--- tested 13 candidates+-- 0 candidates of size 8+-- 11 candidates of size 9+-- tested 3 candidates zip [] xs = [] zip (x:xs) [] = [] zip (x:xs) (y:ys) = (x,y):zip xs ys@@ -102,8 +102,8 @@ -- 0 candidates of size 3 -- 10 candidates of size 4 -- 25 candidates of size 5--- 34 candidates of size 6--- tested 58 candidates+-- 24 candidates of size 6+-- tested 42 candidates [] \/ xs = xs (x:xs) \/ ys = x:ys \/ xs @@ -119,9 +119,9 @@ -- 13 candidates of size 7 -- 17 candidates of size 8 -- 25 candidates of size 9--- 65 candidates of size 10--- 115 candidates of size 11--- tested 172 candidates+-- 55 candidates of size 10+-- 103 candidates of size 11+-- tested 168 candidates ordered [] = True ordered (x:xs) = (null xs || x <= head xs) && ordered xs
eg/maybe.hs view
@@ -61,13 +61,13 @@ ingredients :: [Ingredient] ingredients =- [ unfun (Nothing :: Maybe A)+ [ con (Nothing :: Maybe A) , fun "Just" (Just :: A -> Maybe A) - , unfun False- , unfun True+ , con False+ , con True - , unfun ([] :: [A])+ , con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) ]
eg/maybe.txt view
@@ -65,7 +65,7 @@ -- 0 candidates of size 5 -- 1 candidates of size 6 -- 2 candidates of size 7--- tested 3 candidates+-- tested 4 candidates catMaybes [] = [] catMaybes (Nothing:mxs) = catMaybes mxs catMaybes (Just x:mxs) = x:catMaybes mxs
eg/oddeven.hs view
@@ -30,21 +30,21 @@ ingredients1 :: [Ingredient] ingredients1 =- [ unfun (0::Int)- , unfun (1::Int)- , unfun (2::Int)+ [ con (0::Int)+ , con (1::Int)+ , con (2::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)- , unfun False- , unfun True+ , con False+ , con True ] ingredients2 :: [Ingredient] ingredients2 =- [ unfun (0::Int)- , unfun (1::Int)- , unfun (2::Int)+ [ con (0::Int)+ , con (1::Int)+ , con (2::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "`mod`" (mod :: Int -> Int -> Int)
eg/oddeven.txt view
@@ -2,13 +2,13 @@ -- testing 6 combinations of argument values -- pruning with 21/44 rules -- 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 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5 -- 0 candidates of size 6 -- 2 candidates of size 7--- tested 8 candidates+-- tested 4 candidates odd 0 = False odd 1 = True odd x = odd (x - 2)@@ -17,13 +17,13 @@ -- testing 6 combinations of argument values -- pruning with 21/44 rules -- 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 2+-- 0 candidates of size 3+-- 0 candidates of size 4+-- 0 candidates of size 5 -- 0 candidates of size 6 -- 2 candidates of size 7--- tested 8 candidates+-- tested 4 candidates even 0 = True even 1 = False even x = even (x - 2)@@ -34,9 +34,9 @@ -- 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+-- 0 candidates of size 4+-- 44 candidates of size 5+-- tested 30 candidates odd x = 1 == x `mod` 2 even :: Int -> Bool@@ -45,8 +45,8 @@ -- 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+-- 0 candidates of size 4+-- 44 candidates of size 5+-- tested 20 candidates even x = 0 == x `mod` 2
eg/peano.hs view
@@ -27,13 +27,13 @@ main :: IO () main = do conjure "+" plus- [ unfun Z+ [ con Z , fun "S" S ] -- use + to conjure * conjure "*" times- [ unfun Z+ [ con Z , fun "S" S , fun "+" (let p + Z = p p + S q = S p + q
eg/peano.txt view
@@ -6,9 +6,9 @@ -- 3 candidates of size 3 -- 13 candidates of size 4 -- 19 candidates of size 5--- tested 23 candidates+-- tested 26 candidates p + Z = p-p + S q = S p + q+p + S q = S (p + q) (*) :: Peano -> Peano -> Peano -- testing 7 combinations of argument values@@ -17,9 +17,9 @@ -- 3 candidates of size 2 -- 6 candidates of size 3 -- 6 candidates of size 4--- 35 candidates of size 5--- 86 candidates of size 6--- tested 71 candidates+-- 25 candidates of size 5+-- 63 candidates of size 6+-- tested 56 candidates p * Z = Z p * S q = p + p * q
eg/pow.hs view
@@ -16,8 +16,8 @@ -- pow x 0 = 1 -- pow x y = x * pow x (y - 1) conjure "pow" pow- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ]@@ -27,8 +27,8 @@ -- 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 -- out of reach performance wise, OOM at size 9 conjure "pow" pow- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) -- , fun "sq" ((\x -> x*x) :: Int -> Int) -- cheat! OOM still , fun "*" ((*) :: Int -> Int -> Int) , fun "halve" ((`div` 2) :: Int -> Int)
eg/pow.txt view
@@ -2,14 +2,14 @@ -- testing 5 combinations of argument values -- pruning with 14/30 rules -- 4 candidates of size 1--- 11 candidates of size 2--- 31 candidates of size 3--- 92 candidates of size 4--- 244 candidates of size 5--- 730 candidates of size 6--- 2221 candidates of size 7--- 6950 candidates of size 8--- tested 3356 candidates+-- 0 candidates of size 2+-- 11 candidates of size 3+-- 0 candidates of size 4+-- 78 candidates of size 5+-- 9 candidates of size 6+-- 809 candidates of size 7+-- 557 candidates of size 8+-- tested 912 candidates pow x 0 = 1 pow x y = x * pow x (y - 1) @@ -17,11 +17,11 @@ -- testing 5 combinations of argument values -- pruning with 15/19 rules -- 4 candidates of size 1--- 13 candidates of size 2--- 40 candidates of size 3--- 103 candidates of size 4--- 259 candidates of size 5--- 750 candidates of size 6--- tested 1169 candidates+-- 2 candidates of size 2+-- 5 candidates of size 3+-- 9 candidates of size 4+-- 31 candidates of size 5+-- 178 candidates of size 6+-- tested 229 candidates pow = undefined -- search exhausted
eg/replicate.hs view
@@ -26,10 +26,10 @@ main :: IO () main = do conjure "replicate" replicate'- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "-" ((-) :: Int -> Int -> Int)- , unfun ""+ , con "" , fun ":" ((:) :: Char -> String -> String) ] @@ -49,7 +49,7 @@ -- alternative generation using recursion conjure "replicates" replicates'- [ unfun ""+ [ con "" , fun ":" ((:) :: Char -> String -> String) , fun "++" ((++) :: String -> String -> String) , fun "replicate" (replicate :: Int -> Char -> String)
eg/replicate.txt view
@@ -4,12 +4,12 @@ -- 1 candidates of size 1 -- 0 candidates of size 2 -- 1 candidates of size 3--- 1 candidates of size 4--- 2 candidates of size 5--- 1 candidates of size 6+-- 0 candidates of size 4+-- 1 candidates of size 5+-- 0 candidates of size 6 -- 1 candidates of size 7--- 2 candidates of size 8--- tested 8 candidates+-- 1 candidates of size 8+-- tested 5 candidates replicate 0 c = "" replicate x c = c:replicate (x - 1) c @@ -43,10 +43,10 @@ -- 1 candidates of size 3 -- 0 candidates of size 4 -- 1 candidates of size 5--- 3 candidates of size 6+-- 2 candidates of size 6 -- 1 candidates of size 7--- 12 candidates of size 8--- tested 10 candidates+-- 8 candidates of size 8+-- tested 14 candidates replicates "" x = "" replicates (c:cs) x = replicate x c ++ replicates cs x
eg/setelem.hs view
@@ -19,8 +19,8 @@ main :: IO () main = do conjure "elem" (elem')- [ unfun True- , unfun False+ [ con True+ , con False , fun "||" (||) , fun "&&" (&&) , fun "not" not@@ -28,8 +28,8 @@ ] conjure "set" (set')- [ unfun True- , unfun False+ [ con True+ , con False , fun "||" (||) , fun "&&" (&&) , fun "not" not
eg/setelem.txt view
@@ -9,7 +9,7 @@ -- 0 candidates of size 6 -- 0 candidates of size 7 -- 16 candidates of size 8--- tested 19 candidates+-- tested 11 candidates elem x [] = False elem x (y:xs) = x == y || elem x xs
eg/sort.hs view
@@ -3,21 +3,18 @@ -- Copyright (C) 2021-2025 Rudy Matela -- Distributed under the 3-Clause BSD licence (see the file LICENSE). import Conjure-import Data.List (insert, sort)+import Data.List (insert) sort' :: [Int] -> [Int] sort' [] = []-sort' [x] = [x]-sort' [x,y]- | x <= y = [x,y]- | otherwise = [y,x]-sort' [x,y,z]- | x <= y && y <= z = [x,y,z]- | x <= z && z <= y = [x,z,y]- | y <= x && x <= z = [y,x,z]- | y <= z && z <= x = [y,z,x]- | z <= x && x <= y = [z,x,y]- | z <= y && y <= x = [z,y,x]+sort' [0] = [0]+sort' [1] = [1]+sort' [0,2] = [0,2]+sort' [1,0] = [0,1]+sort' [0,1,2] = [0,1,2]+sort' [2,1,0] = [0,1,2]+sort' [1,0,1] = [0,1,1]+sort' [0,1,0,1] = [0,0,1,1] insert' :: Int -> [Int] -> [Int] insert' 0 [] = [0]@@ -25,99 +22,71 @@ insert' 1 [0,2] = [0,1,2] insert' 2 [0,1] = [0,1,2] --- merge' :: [Int] -> [Int] -> [Int]--- merge' xs ys = sort (xs ++ ys)- merge' :: [Int] -> [Int] -> [Int] merge' [] [] = []-merge' xs [] = xs-merge' [] ys = ys-merge' [x] [y] | x <= y = [x,y]- | otherwise = [y,x]+merge' [0] [] = [0]+merge' [] [0] = [0]+merge' [0] [1] = [0,1]+merge' [1] [0] = [0,1]+merge' [1] [0,2] = [0,1,2]+merge' [0,2] [1] = [0,1,2]+merge' [2] [0,1] = [0,1,2] merge' [0,1] [0,1] = [0,0,1,1] merge' [0,1] [2,3] = [0,1,2,3] merge' [0,2] [1,3] = [0,1,2,3] merge' [0,1] [1,2] = [0,1,1,2] merge' [1,2] [0,1] = [0,1,1,2]-merge' [0,2] [1,1] = [0,1,1,2] main :: IO () main = do- -- recursive insertion sort- -- sort [] = []- -- sort (x:xs) = insert x (sort xs)- conjure "sort" sort'- [ unfun ([] :: [Int])- , fun "insert" (insert :: Int -> [Int] -> [Int])- , fun "head" (head :: [Int] -> Int)- , fun "tail" (tail :: [Int] -> [Int])- , fun "null" (null :: [Int] -> Bool)- ]-- -- now through fold- -- sort xs = foldr insert [] xs- conjure "sort" sort'- [ unfun ([] :: [Int])- , fun "insert" (insert :: Int -> [Int] -> [Int])- , fun "foldr" (foldr :: (Int -> [Int] -> [Int]) -> [Int] -> [Int] -> [Int])- ]- -- an insert function conjure "insert" insert' [ fun "[]" ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "<=" ((<=) :: Int -> Int -> Bool) , guard- , target 50400 ] - -- qsort [] = [] -- 1- -- qsort (x:xs) = qsort (filter (x >) xs) -- 6- -- ++ (x:qsort (filter (x <=) xs) -- 14- -- 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.- conjure "qsort" sort'- [ unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "++" ((++) :: [Int] -> [Int] -> [Int])- , fun "<=" ((<=) :: Int -> Int -> Bool)- , fun ">" ((>) :: Int -> Int -> Bool)- , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])+ -- recursive insertion sort+ conjure "sort" sort'+ [ con ([] :: [Int])+ , fun "insert" (insert :: Int -> [Int] -> [Int]) ] - -- if we disable the descent requirement, we get the efficient qsort- -- though with a larger search space- conjure "qsort" sort'- [ unfun ([] :: [Int])- , fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "++" ((++) :: [Int] -> [Int] -> [Int])- , fun "<=" ((<=) :: Int -> Int -> Bool)- , fun ">" ((>) :: Int -> Int -> Bool)- , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])- , dontRequireDescent+ -- folding insertion sort+ conjure "sort" sort'+ [ con ([] :: [Int])+ , fun "insert" (insert :: Int -> [Int] -> [Int])+ , fun "foldr" (foldr :: (Int -> [Int] -> [Int]) -> [Int] -> [Int] -> [Int]) ] - -- found! candidate #1703311 @ size 22+ -- found! candidate #309279 @ size 22 after ~11s -- merge [] xs = xs -- merge (x:xs) [] = x:xs -- merge (x:xs) (y:ys) -- | x <= y = x:merge xs (y:ys)- -- | otherwise = merge (y:x:xs) ys- -- set target to 2 000 000 to reach it+ -- | otherwise = y:merge ys (x:xs)+ -- set target to 360 000 to reach it conjure "merge" merge'- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "<=" ((<=) :: Int -> Int -> Bool) , guard , maxTests 1080- , target 10080 -- set to 2 000 000 to reach solution+ , target 3600 -- set to 360 000 to reach solution ] - -- unreachable: needs about 26, but can only reach 16- conjure "merge" merge'- [ fun ":" ((:) :: Int -> [Int] -> [Int])- , fun "compare" (compare :: Int -> Int -> Ordering)- , ordcase (undefined :: [Int])- , target 1080+ -- Produces a inefficient degenerate version of qsort+ -- where filter is applied _after_ sorting.+ conjure "qsort" sort'+ [ con ([] :: [Int])+ , fun ":" ((:) :: Int -> [Int] -> [Int])+ , fun "++" ((++) :: [Int] -> [Int] -> [Int])+ , fun "<=" ((<=) :: Int -> Int -> Bool)+ , fun ">" ((>) :: Int -> Int -> Bool)+ , fun "filter" (filter :: (Int -> Bool) -> [Int] -> [Int])+ -- if we disable the descent requirement and carry on,+ -- we eventually get the efficient qsort+ -- , dontRequireDescent+ -- , carryOn ]
eg/sort.txt view
@@ -1,25 +1,3 @@-sort :: [Int] -> [Int]--- testing 360 combinations of argument values--- pruning with 6/7 rules--- 2 candidates of size 1--- 2 candidates of size 2--- 2 candidates of size 3--- 7 candidates of size 4--- 14 candidates of size 5--- tested 15 candidates-sort [] = []-sort (x:xs) = insert x (sort xs)--sort :: [Int] -> [Int]--- testing 360 combinations of argument values--- pruning with 1/2 rules--- 2 candidates of size 1--- 0 candidates of size 2--- 0 candidates of size 3--- 2 candidates of size 4--- tested 4 candidates-sort = foldr insert []- insert :: Int -> [Int] -> [Int] -- testing 4 combinations of argument values -- pruning with 4/4 rules@@ -30,101 +8,84 @@ -- 2 candidates of size 5 -- 2 candidates of size 6 -- 2 candidates of size 7--- 4 candidates of size 8+-- 0 candidates of size 8 -- 2 candidates of size 9--- 8 candidates of size 10--- 18 candidates of size 11--- 16 candidates of size 12--- 70 candidates of size 13--- 32 candidates of size 14--- 226 candidates of size 15--- 64 candidates of size 16--- 602 candidates of size 17--- tested 519 candidates+-- 0 candidates of size 10+-- 2 candidates of size 11+-- 0 candidates of size 12+-- 6 candidates of size 13+-- 0 candidates of size 14+-- 22 candidates of size 15+-- 0 candidates of size 16+-- 22 candidates of size 17+-- tested 45 candidates insert x [] = [x] insert x (y:xs)- | x <= y = x:insert y xs- | otherwise = y:insert x xs+ | y <= x = y:insert x xs+ | otherwise = x:y:xs -qsort :: [Int] -> [Int]--- testing 360 combinations of argument values--- pruning with 8/8 rules+sort :: [Int] -> [Int]+-- testing 9 combinations of argument values+-- pruning with 0/0 rules -- 2 candidates of size 1 -- 0 candidates of size 2--- 1 candidates of size 3+-- 0 candidates of size 3 -- 0 candidates of size 4--- 4 candidates of size 5--- 3 candidates of size 6--- 10 candidates of size 7--- 21 candidates of size 8--- 36 candidates of size 9--- 105 candidates of size 10--- 182 candidates of size 11--- 471 candidates of size 12--- 988 candidates of size 13--- 2183 candidates of size 14--- tested 2437 candidates-qsort [] = []-qsort (x:xs) = filter (x >) (qsort xs) ++ (x:filter (x <=) (qsort xs))+-- 1 candidates of size 5+-- tested 3 candidates+sort [] = []+sort (x:xs) = insert x (sort xs) -qsort :: [Int] -> [Int]--- testing 360 combinations of argument values--- pruning with 8/8 rules+sort :: [Int] -> [Int]+-- testing 9 combinations of argument values+-- pruning with 1/2 rules -- 2 candidates of size 1 -- 0 candidates of size 2--- 1 candidates of size 3--- 0 candidates of size 4--- 4 candidates of size 5--- 3 candidates of size 6--- 16 candidates of size 7--- 35 candidates of size 8--- 80 candidates of size 9--- 239 candidates of size 10--- 478 candidates of size 11--- 1325 candidates of size 12--- 2980 candidates of size 13--- 7159 candidates of size 14--- tested 6564 candidates-qsort [] = []-qsort (x:xs) = qsort (filter (x >) xs) ++ (x:qsort (filter (x <=) xs))+-- 0 candidates of size 3+-- 2 candidates of size 4+-- tested 4 candidates+sort = foldr insert [] merge :: [Int] -> [Int] -> [Int]--- testing 1080 combinations of argument values+-- testing 13 combinations of argument values -- pruning with 4/4 rules -- 3 candidates of size 1 -- 0 candidates of size 2 -- 0 candidates of size 3 -- 10 candidates of size 4 -- 0 candidates of size 5--- 16 candidates of size 6--- 13 candidates of size 7--- 22 candidates of size 8--- 114 candidates of size 9--- 36 candidates of size 10--- 472 candidates of size 11--- 568 candidates of size 12--- 1442 candidates of size 13--- 4204 candidates of size 14--- 5426 candidates of size 15--- tested 12326 candidates+-- 6 candidates of size 6+-- 26 candidates of size 7+-- 6 candidates of size 8+-- 67 candidates of size 9+-- 38 candidates of size 10+-- 152 candidates of size 11+-- 158 candidates of size 12+-- 296 candidates of size 13+-- 718 candidates of size 14+-- 560 candidates of size 15+-- 3728 candidates of size 16+-- tested 5768 candidates merge = undefined -- search exhausted -merge :: [Int] -> [Int] -> [Int]--- testing 360 combinations of argument values--- pruning with 1/2 rules+qsort :: [Int] -> [Int]+-- testing 9 combinations of argument values+-- pruning with 8/8 rules -- 2 candidates of size 1 -- 0 candidates of size 2--- 0 candidates of size 3--- 6 candidates of size 4--- 0 candidates of size 5--- 10 candidates of size 6--- 7 candidates of size 7--- 14 candidates of size 8--- 41 candidates of size 9--- 106 candidates of size 10--- 144 candidates of size 11--- 588 candidates of size 12--- 958 candidates of size 13--- tested 1876 candidates-merge = undefined -- search exhausted+-- 1 candidates of size 3+-- 0 candidates of size 4+-- 2 candidates of size 5+-- 3 candidates of size 6+-- 4 candidates of size 7+-- 10 candidates of size 8+-- 18 candidates of size 9+-- 39 candidates of size 10+-- 87 candidates of size 11+-- 165 candidates of size 12+-- 409 candidates of size 13+-- 809 candidates of size 14+-- tested 1377 candidates+qsort [] = []+qsort (x:xs) = filter (x >) (qsort xs) ++ (x:filter (x <=) (qsort xs))
eg/spec.hs view
@@ -15,8 +15,8 @@ squareIngredients :: [Ingredient] squareIngredients =- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) ]@@ -39,7 +39,7 @@ sumIngredients :: [Ingredient] sumIngredients = [ fun "null" (null :: [Int] -> Bool)- , unfun (0::Int)+ , con (0::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "head" (head :: [Int] -> Int) , fun "tail" (tail :: [Int] -> [Int])
eg/spec.txt view
@@ -21,7 +21,7 @@ -- 2 candidates of size 3 -- 3 candidates of size 4 -- 5 candidates of size 5--- tested 9 candidates+-- tested 13 candidates sum [] = 0 sum (x:xs) = x + sum xs @@ -33,7 +33,7 @@ -- 31 candidates of size 4 -- 94 candidates of size 5 -- 225 candidates of size 6--- tested 212 candidates+-- tested 286 candidates [] ++ xs = xs (x:xs) ++ ys = x:(xs ++ ys)
eg/subset.hs view
@@ -44,9 +44,9 @@ -- subset [] ys = True -- subset (x:xs) ys = elem x ys && subset xs ys conjure "subset" (subset')- [ unfun ([] :: [Int])- , unfun True- , unfun False+ [ con ([] :: [Int])+ , con True+ , con False , fun "&&" (&&) , fun "||" (||) , fun "elem" (elem :: Int -> [Int] -> Bool)
eg/subset.txt view
@@ -9,7 +9,7 @@ -- 0 candidates of size 6 -- 6 candidates of size 7 -- 176 candidates of size 8--- tested 176 candidates+-- tested 48 candidates subset [] xs = True subset (x:xs) ys = elem x ys && subset xs ys
eg/take-drop.hs view
@@ -27,9 +27,9 @@ -- drop x [] = [] -- 2 -- drop x (y:xs) = drop (x - 1) xs -- 7 conjure "drop" (drop' :: Int -> [A] -> [A])- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun ([] :: [A])+ [ con (0 :: Int)+ , con (1 :: Int)+ , con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) , fun "-" ((-) :: Int -> Int -> Int) ]@@ -38,9 +38,9 @@ -- take x [] = [] -- 2 -- take x (y:xs) = y:take (x - 1) xs -- 9 conjure "take" (take' :: Int -> [A] -> [A])- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun ([] :: [A])+ [ con (0 :: Int)+ , con (1 :: Int)+ , con ([] :: [A]) , fun "-" ((-) :: Int -> Int -> Int) , fun ":" ((:) :: A -> [A] -> [A]) ]
eg/take-drop.txt view
@@ -2,13 +2,13 @@ -- testing 360 combinations of argument values -- pruning with 4/7 rules -- 2 candidates of size 1--- 1 candidates of size 2+-- 0 candidates of size 2 -- 0 candidates of size 3 -- 0 candidates of size 4 -- 2 candidates of size 5 -- 5 candidates of size 6--- 5 candidates of size 7--- tested 11 candidates+-- 3 candidates of size 7+-- tested 10 candidates drop 0 xs = xs drop x [] = [] drop x (y:xs) = drop (x - 1) xs@@ -17,15 +17,15 @@ -- testing 153 combinations of argument values -- pruning with 4/7 rules -- 2 candidates of size 1--- 1 candidates of size 2+-- 0 candidates of size 2 -- 0 candidates of size 3 -- 0 candidates of size 4 -- 0 candidates of size 5--- 3 candidates of size 6+-- 0 candidates of size 6 -- 2 candidates of size 7--- 6 candidates of size 8--- 5 candidates of size 9--- tested 15 candidates+-- 0 candidates of size 8+-- 3 candidates of size 9+-- tested 5 candidates take 0 xs = [] take x [] = [] take x (y:xs) = y:take (x - 1) xs
eg/tapps.hs view
@@ -27,8 +27,8 @@ ingredients :: [Ingredient] ingredients =- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) #if __GLASGOW_HASKELL__ < 800 , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int)
eg/tapps.txt view
@@ -16,7 +16,7 @@ -- 1 candidates of size 3 -- 2 candidates of size 4 -- 10 candidates of size 5--- tested 12 candidates+-- tested 16 candidates product [] = 1 product (x:xs) = x * product xs @@ -27,6 +27,6 @@ -- 1 candidates of size 2 -- 1 candidates of size 3 -- 5 candidates of size 4--- tested 8 candidates+-- tested 9 candidates product = foldr (*) 1
eg/these.hs view
@@ -78,12 +78,12 @@ ] conjure "listhese" listhese'- [ unfun ([] :: [A])+ [ con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) ] conjure "cathis" cathis'- [ unfun ([] :: [A])+ [ con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) , fun "isThis" (isThis :: These A B -> Bool) , fun "fromThis" (fromThis :: These A B -> A)@@ -91,7 +91,7 @@ ] conjure "cathat" cathat'- [ unfun ([] :: [B])+ [ con ([] :: [B]) , fun ":" ((:) :: B -> [B] -> [B]) , fun "isThat" (isThat :: These A B -> Bool) , fun "fromThat" (fromThat :: These A B -> B)@@ -99,19 +99,19 @@ ] conjure "cathis" cathis'- [ unfun ([] :: [A])+ [ con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) , maxPatternDepth 2 ] conjure "cathat" cathat'- [ unfun ([] :: [B])+ [ con ([] :: [B]) , fun ":" ((:) :: B -> [B] -> [B]) , maxPatternDepth 2 ] conjure "cathese" cathese'- [ unfun ([] :: [A])+ [ con ([] :: [A]) , fun ":" ((:) :: A -> [A] -> [A]) , maxPatternDepth 2 ]
eg/these.txt view
@@ -44,13 +44,13 @@ -- 0 candidates of size 3 -- 0 candidates of size 4 -- 0 candidates of size 5--- 1 candidates of size 6--- 2 candidates of size 7+-- 0 candidates of size 6+-- 0 candidates of size 7 -- 0 candidates of size 8--- 1 candidates of size 9--- 4 candidates of size 10--- 2 candidates of size 11--- tested 10 candidates+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 1 candidates of size 11+-- tested 2 candidates cathis [] = [] cathis (t:ts) | isThis t = fromThis t:cathis ts@@ -64,13 +64,13 @@ -- 0 candidates of size 3 -- 0 candidates of size 4 -- 0 candidates of size 5--- 1 candidates of size 6--- 2 candidates of size 7+-- 0 candidates of size 6+-- 0 candidates of size 7 -- 0 candidates of size 8--- 1 candidates of size 9--- 4 candidates of size 10--- 2 candidates of size 11--- tested 10 candidates+-- 0 candidates of size 9+-- 0 candidates of size 10+-- 1 candidates of size 11+-- tested 2 candidates cathat [] = [] cathat (t:ts) | isThat t = fromThat t:cathat ts@@ -88,9 +88,9 @@ -- 0 candidates of size 7 -- 2 candidates of size 8 -- 6 candidates of size 9--- 7 candidates of size 10--- 13 candidates of size 11--- tested 18 candidates+-- 5 candidates of size 10+-- 9 candidates of size 11+-- tested 23 candidates cathis [] = [] cathis (Neither:ts) = cathis ts cathis (This x:ts) = x:cathis ts@@ -110,8 +110,8 @@ -- 0 candidates of size 8 -- 2 candidates of size 9 -- 4 candidates of size 10--- 3 candidates of size 11--- tested 9 candidates+-- 1 candidates of size 11+-- tested 8 candidates cathat [] = [] cathat (Neither:ts) = cathat ts cathat (This x:ts) = cathat ts@@ -129,14 +129,14 @@ -- 0 candidates of size 6 -- 0 candidates of size 7 -- 0 candidates of size 8--- 4 candidates of size 9--- 8 candidates of size 10--- 11 candidates of size 11--- 38 candidates of size 12--- 26 candidates of size 13--- 140 candidates of size 14--- 57 candidates of size 15--- tested 269 candidates+-- 3 candidates of size 9+-- 7 candidates of size 10+-- 4 candidates of size 11+-- 27 candidates of size 12+-- 3 candidates of size 13+-- 78 candidates of size 14+-- 1 candidates of size 15+-- tested 124 candidates cathese [] = [] cathese (Neither:ts) = cathese ts cathese (That x:ts) = x:cathese ts
eg/tree.hs view
@@ -109,31 +109,31 @@ ] conjure "size" size- [ unfun (0 :: Int)- , unfun (1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "nil" nil ] conjure "height" height- [ unfun (0 :: Int)- , unfun (1 :: Int)- , unfun (-1 :: Int)+ [ con (0 :: Int)+ , con (1 :: Int)+ , con (-1 :: Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "max" (max :: Int -> Int -> Int) , fun "nil" nil ] conjure "mem" mem- [ unfun False+ [ con False , fun "||" (||) , fun "==" ((==) :: Int -> Int -> Bool) ] -- unreachable: needs size 22 but OOMs at 19/20 (v0.5.16) conjure "ordered" ordered- [ unfun True- , unfun False+ [ con True+ , con False , fun "&&" (&&) , fun "||" (||) , fun "<" ((<) :: Int -> Int -> Bool)@@ -149,19 +149,19 @@ ] conjure "preorder" preorder- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] conjure "inorder" inorder- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ] conjure "posorder" posorder- [ unfun ([] :: [Int])+ [ con ([] :: [Int]) , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "++" ((++) :: [Int] -> [Int] -> [Int]) ]
eg/tree.txt view
@@ -75,7 +75,7 @@ -- 0 candidates of size 10 -- 0 candidates of size 11 -- 36 candidates of size 12--- tested 42 candidates+-- tested 18 candidates mem x Leaf = False mem x (Node t1 y t2) = mem x t1 || (x == y || mem x t2) @@ -90,11 +90,11 @@ -- 12 candidates of size 6 -- 0 candidates of size 7 -- 36 candidates of size 8--- 104 candidates of size 9+-- 72 candidates of size 9 -- 0 candidates of size 10--- 418 candidates of size 11--- 1064 candidates of size 12--- tested 1639 candidates+-- 290 candidates of size 11+-- 712 candidates of size 12+-- tested 1127 candidates ordered = undefined -- search exhausted ordered :: Tree -> Bool@@ -115,9 +115,9 @@ -- 0 candidates of size 4 -- 2 candidates of size 5 -- 4 candidates of size 6--- 4 candidates of size 7+-- 2 candidates of size 7 -- 8 candidates of size 8--- tested 13 candidates+-- tested 11 candidates preorder Leaf = [] preorder (Node t1 x t2) = x:(preorder t1 ++ preorder t2) @@ -128,11 +128,11 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 0 candidates of size 4--- 2 candidates of size 5+-- 0 candidates of size 5 -- 4 candidates of size 6--- 4 candidates of size 7--- 8 candidates of size 8--- tested 17 candidates+-- 2 candidates of size 7+-- 4 candidates of size 8+-- tested 9 candidates inorder Leaf = [] inorder (Node t1 x t2) = inorder t1 ++ (x:inorder t2) @@ -143,13 +143,13 @@ -- 0 candidates of size 2 -- 0 candidates of size 3 -- 0 candidates of size 4--- 2 candidates of size 5+-- 0 candidates of size 5 -- 4 candidates of size 6--- 4 candidates of size 7--- 8 candidates of size 8--- 14 candidates of size 9--- 16 candidates of size 10--- tested 47 candidates+-- 2 candidates of size 7+-- 4 candidates of size 8+-- 10 candidates of size 9+-- 8 candidates of size 10+-- tested 27 candidates posorder Leaf = [] posorder (Node t1 x t2) = posorder t1 ++ (posorder t2 ++ [x])
eg/tri.hs view
@@ -12,7 +12,7 @@ main :: IO () main = do conjure "tri" tri- [ unfun (1::Int)+ [ con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int) ]
eg/tri.txt view
@@ -4,11 +4,11 @@ -- 2 candidates of size 1 -- 0 candidates of size 2 -- 5 candidates of size 3--- 5 candidates of size 4+-- 0 candidates of size 4 -- 10 candidates of size 5--- 8 candidates of size 6+-- 0 candidates of size 6 -- 41 candidates of size 7--- tested 31 candidates+-- tested 53 candidates tri 1 = 1 tri x = x + tri (x - 1)
eg/tuple.txt view
@@ -2,7 +2,7 @@ -- testing 4 combinations of argument values -- pruning with 0/0 rules -- 0 candidates of size 1--- 1 candidates of size 2+-- 2 candidates of size 2 -- tested 1 candidates fst (x,y) = x @@ -10,8 +10,8 @@ -- testing 4 combinations of argument values -- pruning with 0/0 rules -- 0 candidates of size 1--- 1 candidates of size 2--- tested 1 candidates+-- 2 candidates of size 2+-- tested 2 candidates snd (x,y) = y swap :: (A,A) -> (A,A)@@ -20,8 +20,8 @@ -- 1 candidates of size 1 -- 0 candidates of size 2 -- 0 candidates of size 3--- 1 candidates of size 4--- tested 2 candidates+-- 4 candidates of size 4+-- tested 4 candidates swap (x,y) = (y,x) curry :: ((A,A) -> A) -> A -> A -> A@@ -51,10 +51,10 @@ -- 0 candidates of size 4 -- 0 candidates of size 5 -- 0 candidates of size 6--- 7 candidates of size 7--- 19 candidates of size 8--- 34 candidates of size 9--- tested 36 candidates+-- 5 candidates of size 7+-- 11 candidates of size 8+-- 17 candidates of size 9+-- tested 32 candidates pairwise [] = [] pairwise (x:xs) = (x,head xs):pairwise (tail xs) @@ -66,11 +66,11 @@ -- 1 candidates of size 3 -- 3 candidates of size 4 -- 5 candidates of size 5--- 11 candidates of size 6--- 22 candidates of size 7--- 46 candidates of size 8--- 106 candidates of size 9--- tested 124 candidates+-- 9 candidates of size 6+-- 17 candidates of size 7+-- 35 candidates of size 8+-- 72 candidates of size 9+-- tested 101 candidates catpairs [] = [] catpairs (xy:xys) = fst xy:snd xy:catpairs xys @@ -83,9 +83,9 @@ -- 0 candidates of size 4 -- 0 candidates of size 5 -- 0 candidates of size 6--- 7 candidates of size 7--- 26 candidates of size 8--- tested 23 candidates+-- 5 candidates of size 7+-- 14 candidates of size 8+-- tested 18 candidates pairwise [] = [] pairwise [x] = [] pairwise (x:y:xs) = (x,y):pairwise xs@@ -98,10 +98,10 @@ -- 1 candidates of size 3 -- 3 candidates of size 4 -- 6 candidates of size 5--- 15 candidates of size 6--- 31 candidates of size 7--- 68 candidates of size 8--- tested 97 candidates+-- 12 candidates of size 6+-- 23 candidates of size 7+-- 48 candidates of size 8+-- tested 82 candidates catpairs [] = [] catpairs ((x,y):xys) = x:y:catpairs xys
mk/depend.mk view
@@ -57,10 +57,10 @@ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \ bench/erroneous.hs-bench/gps2: \- bench/gps2.hs \+bench/gps: \+ bench/gps.hs \ mk/toplibs-bench/gps2.o: \+bench/gps.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -74,11 +74,11 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/gps2.hs-bench/gps: \- bench/gps.hs \+ bench/gps.hs+bench/i12: \+ bench/i12.hs \ mk/toplibs-bench/gps.o: \+bench/i12.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -92,11 +92,11 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/gps.hs-bench/ill-hit: \- bench/ill-hit.hs \+ bench/i12.hs+bench/i30: \+ bench/i30.hs \ mk/toplibs-bench/ill-hit.o: \+bench/i30.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -110,11 +110,11 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/ill-hit.hs-bench/longshot: \- bench/longshot.hs \+ bench/i30.hs+bench/ill-hit: \+ bench/ill-hit.hs \ mk/toplibs-bench/longshot.o: \+bench/ill-hit.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -128,11 +128,11 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/longshot.hs-bench/lowtests: \- bench/lowtests.hs \+ bench/ill-hit.hs+bench/longshot: \+ bench/longshot.hs \ mk/toplibs-bench/lowtests.o: \+bench/longshot.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -146,11 +146,11 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/lowtests.hs-bench/p12: \- bench/p12.hs \+ bench/longshot.hs+bench/lowtests: \+ bench/lowtests.hs \ mk/toplibs-bench/p12.o: \+bench/lowtests.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -164,11 +164,11 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/p12.hs-bench/p30: \- bench/p30.hs \+ bench/lowtests.hs+bench/psb2: \+ bench/psb2.hs \ mk/toplibs-bench/p30.o: \+bench/psb2.o: \ src/Conjure/Utils.hs \ src/Conjure/Settings.hs \ src/Conjure/Red.hs \@@ -182,7 +182,7 @@ src/Conjure/Defn.hs \ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \- bench/p30.hs+ bench/psb2.hs bench/redundants: \ bench/redundants.hs \ mk/toplibs@@ -399,6 +399,24 @@ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \ eg/colin/ListFuns.hs+eg/conditionals: \+ eg/conditionals.hs \+ mk/toplibs+eg/conditionals.o: \+ src/Conjure/Utils.hs \+ src/Conjure/Settings.hs \+ src/Conjure/Red.hs \+ src/Conjure/Reason.hs \+ src/Conjure.hs \+ src/Conjure/Ingredient.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/conditionals.hs eg/count: \ eg/count.hs \ mk/toplibs@@ -417,6 +435,24 @@ src/Conjure/Conjurable.hs \ src/Conjure/Conjurable/Derive.hs \ eg/count.hs+eg/digits: \+ eg/digits.hs \+ mk/toplibs+eg/digits.o: \+ src/Conjure/Utils.hs \+ src/Conjure/Settings.hs \+ src/Conjure/Red.hs \+ src/Conjure/Reason.hs \+ src/Conjure.hs \+ src/Conjure/Ingredient.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/digits.hs eg/dupos: \ eg/dupos.hs \ mk/toplibs
src/Conjure.hs view
@@ -19,8 +19,8 @@ -- -- > ingredients :: [Ingredient] -- > ingredients =--- > [ unfun (0::Int)--- > , unfun (1::Int)+-- > [ con (0::Int)+-- > , con (1::Int) -- > , fun "+" ((+) :: Int -> Int -> Int) -- > , fun "*" ((*) :: Int -> Int -> Int) -- > , fun "-" ((-) :: Int -> Int -> Int)@@ -62,9 +62,9 @@ -- > take' 3 [x,y] = [x,y] -- -- > > conjure "take" (take' :: Int -> [A] -> [A])--- > > [ unfun (0 :: Int)--- > > , unfun (1 :: Int)--- > > , unfun ([] :: [A])+-- > > [ con (0 :: Int)+-- > > , con (1 :: Int)+-- > > , con ([] :: [A]) -- > > , fun ":" ((:) :: A -> [A] -> [A]) -- > > , fun "-" ((-) :: Int -> Int -> Int) -- > > ]@@ -96,7 +96,7 @@ conjure , Ingredient , fun- , unfun+ , con , guard , iif , ordcase@@ -155,7 +155,7 @@ , dontRewrite , dontRequireDescent , omitAssortedPruning- , omitEarlyTests+ , maxEarlyTests , dontCopyBindings , nonAtomicNumbers , uniqueCandidates@@ -164,7 +164,7 @@ , Prim , pr , prim- , con+ , unfun ) where
src/Conjure/Conjurable.hs view
@@ -122,9 +122,16 @@ -- -- (cf. 'reifyTiers', 'reifyEquality', 'conjureType') class (Typeable a, Name a) => Conjurable a where+ -- | Returns a list of holes matching arguments of the given function. conjureArgumentHoles :: a -> [Expr] conjureArgumentHoles _ = [] + -- | Returns a hole with the same type as the given functions final result.+ conjureResultHole :: a -> Expr+ conjureResultHole x = value "_" (err `asTypeOf` x)+ where+ err = error "conjureResultHole: placeholder for recursive call?"+ -- | Returns 'Just' the '==' function encoded as an 'Expr' when available -- or 'Nothing' otherwise. --@@ -610,6 +617,7 @@ instance (Conjurable a, Conjurable b) => Conjurable (a -> b) where conjureArgumentHoles f = hole (argTy f) : conjureArgumentHoles (f undefined)+ conjureResultHole f = conjureResultHole (f undefined) conjureSubTypes f = conjureType (argTy f) . conjureType (resTy f) conjureIf f = conjureIf (f undefined) conjureArgumentCases f = conjureCases (argTy f) : conjureArgumentCases (f undefined)
src/Conjure/Defn.hs view
@@ -74,17 +74,15 @@ where show1 (lhs,rhs) = case rhs of- (Value "|" _ :$ c :$ t :$ e) -> showExpr lhs- ++ "\n | " ++ showExpr c ++ " = " ++ showExpr t- ++ "\n | otherwise = " ++ showExpr e- (Value "if" _ :$ c :$ t :$ e) -> lhseqs ++ "if " ++ showExpr c- ++ "\n" ++ spaces ++ "then " ++ showExpr t- ++ "\n" ++ spaces ++ "else " ++ showExpr e- (Value "case" _ :$ ep :$ ex :$ ey)+ Value "|" _ :$ _ :$ _ :$ _ -> showExpr lhs ++ showCases rhs+ Value "if" _ :$ c :$ t :$ e -> lhseqs ++ "if " ++ showExpr c+ ++ "\n" ++ spaces ++ "then " ++ showExpr t+ ++ "\n" ++ spaces ++ "else " ++ showExpr e+ Value "case" _ :$ ep :$ ex :$ ey | typ ep == boolTy -> lhseqs ++ "case " ++ showExpr ep ++ " of" ++ "\n" ++ spaces ++ "False -> " ++ showExpr ex ++ "\n" ++ spaces ++ "True -> " ++ showExpr ey- (Value "case" _ :$ eo :$ ex :$ ey :$ ez)+ Value "case" _ :$ eo :$ ex :$ ey :$ ez | typ eo == orderingTy -> lhseqs ++ "case " ++ showExpr eo ++ " of" ++ "\n" ++ spaces ++ "LT -> " ++ showExpr ex ++ "\n" ++ spaces ++ "EQ -> " ++ showExpr ey@@ -93,6 +91,11 @@ where lhseqs = showExpr lhs ++ " = " spaces = map (const ' ') lhseqs+ showCases (Value "|" _ :$ c :$ e :$ etc) =+ "\n | " ++ showExpr c ++ " = " ++ showExpr e ++ showCases etc+ showCases e =+ "\n | otherwise = " ++ showExpr e+ -- | Pretty-prints a 'Defn' to the screen. --
src/Conjure/Defn/Redundancy.hs view
@@ -145,11 +145,21 @@ -- are at the root: we have a redundant function. -- (Modulo error functions, which are undesired anyway.) --+-- Here is an example:+-- -- > xs ? [] = [] -- > xs ? (x:ys) = xs ? ys -- -- Above it does not really pays off to follow the recursive calls, -- at the end we always reach an empty list.+--+-- Here is a more complex example:+--+-- > [] ? xs = []+-- > (x:xs) ? [] = []+-- > (x:xs) ? (y:ys) = xs ? ys+--+-- We are bound to reach [] when following the recursion. isRedundantByRootRecursions :: Defn -> Bool isRedundantByRootRecursions d = case partition isGround $ map snd d of ([b], rs@(_:_)) -> all isHole rs
src/Conjure/Engine.hs view
@@ -47,7 +47,7 @@ , dontRewrite , dontRequireDescent , omitAssortedPruning- , omitEarlyTests+ , maxEarlyTests , dontCopyBindings , nonAtomicNumbers , uniqueCandidates@@ -71,7 +71,7 @@ import Test.LeanCheck import Test.LeanCheck.Tiers-import Test.LeanCheck.Error (errorToFalse)+import Test.LeanCheck.Error (errorToFalse, errorToLeft) import Conjure.Expr import Conjure.Conjurable@@ -101,8 +101,8 @@ -- > -- > ingredients :: [Ingredient] -- > ingredients =--- > [ unfun (0::Int)--- > , unfun (1::Int)+-- > [ con (0::Int)+-- > , con (1::Int) -- > , fun "+" ((+) :: Int -> Int -> Int) -- > , fun "*" ((*) :: Int -> Int -> Int) -- > , fun "-" ((-) :: Int -> Int -> Int)@@ -121,7 +121,7 @@ -- > factorial 0 = 1 -- > factorial x = x * factorial (x - 1) ----- The ingredients list is defined with 'unfun' and 'fun'.+-- The ingredients list is defined with 'con' and 'fun'. conjure :: Conjurable f => String -> f -> [Ingredient] -> IO () conjure nm f = conjure0 nm f (const []) @@ -385,7 +385,8 @@ -- using pattern matching. candidateDefnsC :: Conjurable f => String -> f -> [Ingredient] -> ([[Defn]], Thy, [[Defn]], [Expr]) candidateDefnsC nm f is =- ( discardT hasRedundant $ concatMapT fillingsFor fss+ ( discardT hasRedundant $ catconMapT fillingsFor partialDefns+ -- above we catconMapT to prefer smaller recursive calls , thy , mapT (map (,eh)) pats , deconstructions@@ -393,12 +394,12 @@ where pats | maxPatternSize > 0 = take maxPatternSize $ conjurePats maxPatternDepth es nm f | otherwise = conjurePats maxPatternDepth es nm f- fss = concatMapT ps2fss pats+ partialDefns = concatMapT partialDefnsFromPats pats -- replaces the any guard symbol with a guard of the correct type ps = actual is -- extract actual ingredients/primitives from the list es = [if isGuardSymbol e then conjureGuard f else e | (e,_) <- ps] - eh = holeAsTypeOf efxs+ eh = conjureResultHole f efxs = conjureVarApplication nm f (ef:_) = unfoldApp efxs @@ -431,43 +432,57 @@ isNumeric = conjureIsNumeric f (-==-) = conjureMkEquation f+ etests = map (first (mappArgs exprExpr)) tests tests = conjureTestDefn maxTests maxSearchTests nm f exprExpr = conjureExpress f - ps2fss :: [Expr] -> [[Defn]]- ps2fss pats = discardT isRedundant- . products -- alt: use delayedProducts- $ map p2eess pats+ distritests :: [(Expr,Expr)] -> [Expr] -> [([(Expr,Expr)],Expr)]+ distritests _ [] = []+ distritests ts (pat:pats) = (ys, pat) : distritests ns pats+ where+ (ys, ns) = partition (\(lhs,_) -> lhs `isInstanceOf` pat) ts++ partialDefnsFromPats :: [Expr] -> [[Defn]]+ partialDefnsFromPats pats = discardT isRedundant+ . products -- alt: use delayedProducts+ . map (uncurry bindingsForPattern)+ . distritests etests+ $ pats -- delayedProducts makes the number of patterns counts as the size+1. where- p2eess :: Expr -> [[Bndn]]+ bindingsForPattern :: [(Expr,Expr)] -> Expr -> [[Bndn]] -- the following guarded line is an optional optimization -- if the function is defined for the given pattern, -- simply use its return value as the only possible result- p2eess pat | copyBindings && isGroundPat f pat = [[(pat, toValPat f pat)]]- p2eess pat = mapT (pat,)- . filterT keepBase- . appsWith pat- . drop 1 -- this excludes the function name itself- $ vars pat ++ [eh | any (uncurry should) (zip aess aes)]+ bindingsForPattern ts pat+ | copyBindings && isGroundPat f pat = [[(pat, toValPat f pat)]]+ | otherwise = mapT (pat,)+ . filterT keepB+ . appsWith pat+ . drop 1 -- this excludes the function name itself+ $ vars pat ++ [eh | any (uncurry should) (zip aess aes)] where- keepBase- | not earlyTests = const True- | all isVar (unfoldApp pat) = const True- | otherwise = \e -> hasHole e || reallyKeepBase e- reallyKeepBase e = and- [ errorToFalse $ eval False $ (e //- bs) -==- rhs- | (lhs,rhs) <- tests- -- filter test bindings that match the current pattern:- , Just bs <- [lhs `matchArgs` pat]+ keepB+ | maxEarlyTests <= 0 = const True+ | length pats < 2 = const True -- just one pat, test later+ | otherwise = \e -> isNumeric eh && hasHole e || reallyKeepB e+ reallyKeepB e = and+ [ errholeToTrue $ eval False $ (e //- bs) -==- rhs+ | (lhs,rhs) <- take maxEarlyTests ts+ , Just bs <- [lhs `match` pat] -- always should match ]- matchArgs efxs efys = fold (map exprExpr (drop 1 (unfoldApp efxs)))- `match` fold (drop 1 (unfoldApp efys)) - -- computes whether we should include a recurse for this given argument- -- numeric arguments additionally require 0 to be present as a case- -- for recursion- should aes ae = length (nub aes) > 1 && hasVar ae && (isApp ae || isUnbreakable ae)+ -- computes whether we should include a recurse for this given argument:+ -- 1. more than one LHS pattern overall+ -- 2. there should be at least a variable+ -- 3. it should either:+ -- * we do not require descent+ -- * be a breakdown such as _:_ or Tree _ _ _+ -- * or be of an unbreakable/atomic type such as (_ :: Int)+ -- in the presence of deconstructions+ should aes ae = length (nub aes) > 1+ && hasVar ae+ && (not requireDescent || isApp ae || isUnbreakable ae && notNull deconstructions) aes = (tail . unfoldApp . rehole) pat aess = transpose $ map (tail . unfoldApp . rehole) pats @@ -546,7 +561,7 @@ maxPatternDepth = maxPatternDepthI is maxPatternSize = maxPatternSizeI is requireDescent = requireDescentI is- earlyTests = earlyTestsI is+ maxEarlyTests = maxEarlyTestsI is copyBindings = copyBindingsI is adHocRedundancy = assortedPruningI is -- TODO: rename atomicNumbers = atomicNumbersI is@@ -692,3 +707,16 @@ testSpec :: Int -> [Property] -> Bool testSpec maxTests = and . map (and . take maxTests)++-- like errorToFalse, but returns True upon finding a placeholder hole+errholeToTrue :: Bool -> Bool+errholeToTrue p = case errorToLeft p of+ Right q -> q+ Left "conjureResultHole: placeholder for recursive call?" -> True+ Left _ -> False+++catconMapT :: (a -> [[b]]) -> [[a]] -> [[b]]+catconMapT f = foldr (\+:/) [] . map (foldr (\/) []) . mapT f+ where+ xss \+:/ yss = ([]:yss) \/ xss
src/Conjure/Expr.hs view
@@ -40,6 +40,8 @@ , isGuard , hasGuard , mapInnerFirstOuterLast+ , mappArgs+ , mappFun , enumerateAppsFor , enumerateFillings@@ -70,7 +72,7 @@ import Data.Dynamic -- import Control.Applicative ((<$>)) -- for GHC <= 7.8 -import Test.LeanCheck (mapT, filterT, (\/), delay, productWith)+import Test.LeanCheck (mapT, filterT, (\/), delay, productWith, concatMapT) import Test.LeanCheck.Tiers (products) import Test.LeanCheck.Utils.Types (A, B, C, D, E, F) @@ -375,11 +377,15 @@ for h = filter (\e -> typ h == typ e) es : apps where apps = foldr (\/) []- [ filterT keep $ fliproductWith (:$) (ufor hf) (ufor hx)+ [ filterT keep $ concatMapT afor (ufor hf) | hf <- hs , hx <- hs , Just hfx <- [hf $$ hx] , typ h == typ hfx+ -- the following allows chains of guards:+ , let afor ef = mapT (ef :$) $ if isGuard (ef :$ hx)+ then for hx+ else ufor hx ] -- unguarded for ufor | any isGuardSymbol es = filterT (not . isGuard) . for@@ -640,6 +646,20 @@ where m (ef :$ ex) = f (m ef :$ m ex) m e = f e++-- TODO: move mappArgs to Express?+mappArgs :: (Expr -> Expr) -> Expr -> Expr+mappArgs f = m+ where+ m (ef :$ ex) = m ef :$ f ex+ m e = e++-- TODO: move mappFun to Express?+mappFun :: (Expr -> Expr) -> Expr -> Expr+mappFun f = m+ where+ m (ef :$ ex) = m ef :$ ex+ m ef = f ef instance Express A where expr = val instance Express B where expr = val
src/Conjure/Ingredient.hs view
@@ -12,7 +12,7 @@ module Conjure.Ingredient ( Ingredient , fun- , unfun+ , con , iif , ordcase , guard@@ -25,7 +25,7 @@ , prim , prif , primOrdCaseFor- , con+ , unfun ) where @@ -36,12 +36,12 @@ -- | A single functional ingredient in conjuring.--- Specify conjure ingredients with 'unfun' and 'fun':+-- Specify conjure ingredients with 'con' and 'fun': ----- > conjure "foo" foo [ unfun False--- > , unfun True--- > , unfun (0 :: Int)--- > , unfun (1 :: Int)+-- > conjure "foo" foo [ con False+-- > , con True+-- > , con (0 :: Int)+-- > , con (1 :: Int) -- > , ... -- > , fun "&&" (&&) -- > , fun "||" (||)@@ -53,9 +53,9 @@ -- -- Ingredients may include arbitrary -- functional values ('fun')--- and non-functional values ('unfun').+-- and non-functional (constant) values ('con'). -- These may be built-in or user defined.--- Use 'unfun' on 'Show' instances+-- Use 'con' on 'Show' instances -- and 'fun' otherwise. -- -- This is internally@@ -65,26 +65,26 @@ type Ingredient = (Expr, Reification) --- | Provided a 'Show'-able non-functional value to Conjure.+-- | Provides a 'Show'-able non-functional constant value to Conjure. -- (cf. 'fun') ----- > conjure "foo" foo [ unfun False--- > , unfun True--- > , unfun (0 :: Int)--- > , unfun (1 :: Int)+-- > conjure "foo" foo [ con False+-- > , con True+-- > , con (0 :: Int)+-- > , con (1 :: Int) -- > , ... -- > ] -- -- Argument types have to be monomorphized, -- so use type bindings when applicable.-unfun :: (Conjurable a, Show a) => a -> Ingredient-unfun x = (val x, conjureType x)+con :: (Conjurable a, Show a) => a -> Ingredient+con x = (val x, conjureType x) -- | Provides a functional value as an ingredient to Conjure. -- To be used on values that are not 'Show' instances -- such as functions.--- (cf. 'unfun')+-- (cf. 'con') -- -- > conjure "foo" foo [ ... -- > , fun "&&" (&&)@@ -112,7 +112,7 @@ -- > last' [x,y] = y -- > last' [x,y,z] = z ----- > > conjure "last" last' [ unfun ([] :: [Int])+-- > > conjure "last" last' [ con ([] :: [Int]) -- > > , fun ":" ((:) :: Int -> [Int] -> [Int]) -- > > , fun "null" (null :: [Int] -> Bool) -- > > , iif (undefined :: Int)@@ -142,7 +142,7 @@ -- > last' [x,y,z] = z -- -- > > conjure "last" last'--- > > [ unfun ([] :: [Int])+-- > > [ con ([] :: [Int]) -- > > , fun ":" ((:) :: Int -> [Int] -> [Int]) -- > > , fun "null" (null :: [Int] -> Bool) -- > > , guard@@ -174,8 +174,8 @@ -- This should be used when one wants Conjure to consider ord-case expressions: -- -- > > conjure "mem" mem--- > > [ unfun False--- > > , unfun True+-- > > [ con False+-- > > , con True -- > > , fun "`compare`" (compare :: Int -> Int -> Ordering) -- > > , ordcase (undefined :: Bool) -- > > ]@@ -273,7 +273,7 @@ primOrdCaseFor = ordcase {-# DEPRECATED primOrdCaseFor "'primOrdCaseFor' is deprecated, please use 'ordcase' instead" #-} --- | __DEPRECATED__. Please use 'unfun' instead.-con :: (Conjurable a, Show a) => a -> Ingredient-con = unfun-{-# DEPRECATED con "'con' is deprecated, please use 'unfun' instead" #-}+-- | __DEPRECATED__. Please use 'con' instead.+unfun :: (Conjurable a, Show a) => a -> Ingredient+unfun = con+{-# DEPRECATED unfun "'unfun' is deprecated, please use 'con' instead" #-}
src/Conjure/Settings.hs view
@@ -40,7 +40,7 @@ , dontRewrite , dontRequireDescent , omitAssortedPruning- , omitEarlyTests+ , maxEarlyTests , dontCopyBindings , nonAtomicNumbers , uniqueCandidates@@ -74,7 +74,7 @@ , rewriteI , requireDescentI , assortedPruningI- , earlyTestsI+ , maxEarlyTestsI , copyBindingsI , atomicNumbersI , uniqueCandidatesI@@ -117,7 +117,7 @@ | DontRewrite -- ^ turns off unique-modulo-rewriting candidates | DontRequireDescent -- ^ require recursive calls to deconstruct arguments | OmitAssortedPruning -- ^ omit other assorted pruning rules- | OmitEarlyTests -- ^ don't perform tests early-and-independently on each binding+ | MaxEarlyTests Int -- ^ don't perform tests early-and-independently on each binding | DontCopyBindings -- ^ don't copy partial definition bindings in candidates | AtomicNumbers -- ^ restrict constant/ground numeric expressions to atoms | NonAtomicNumbers -- ^ lift constant/ground numetic expression restrictions@@ -379,14 +379,17 @@ assortedPruningI :: [Ingredient] -> Bool assortedPruningI is = null [False | OmitAssortedPruning <- map extract is] --- | Omits early tests+-- | Sets the maximum number of early tests+-- performed independently bindings/equations -- when provided in the ingredient list -- of 'Conjure.conjure' or 'Conjure.conjureFromSpec'.-omitEarlyTests :: Ingredient-omitEarlyTests = setting OmitEarlyTests+--+-- When not set, this defaults to a modest 12.+maxEarlyTests :: Int -> Ingredient+maxEarlyTests = setting . MaxEarlyTests -earlyTestsI :: [Ingredient] -> Bool-earlyTestsI is = null [False | OmitEarlyTests <- map extract is]+maxEarlyTestsI :: [Ingredient] -> Int+maxEarlyTestsI is = headOr 12 [m | MaxEarlyTests m <- map extract is] -- | Disables the copy-bindings rule -- when provided in the ingredient list
src/Conjure/Utils.hs view
@@ -26,7 +26,6 @@ #endif , idIO , mapHead- , sets , headOr , notNull , allEqual@@ -137,15 +136,6 @@ mapHead :: (a -> a) -> [a] -> [a] mapHead f (x:xs) = f x : xs mapHead f [] = error "Conjure.Utils.mapHead: empty list"---- | Return sets of values based on the list.------ The values in the list must me unique.-sets :: [a] -> [[a]]-sets [] = [[]]-sets (x:xs) = map (x:) ss ++ ss- where- ss = sets xs -- | Like 'head' but allows providing a default value. headOr :: a -> [a] -> a
test/factorial.hs view
@@ -13,8 +13,8 @@ main :: IO () main = do conjure "factorial n" factorial- [ unfun (0::Int)- , unfun (1::Int)+ [ con (0::Int)+ , con (1::Int) , fun "+" ((+) :: Int -> Int -> Int) , fun "*" ((*) :: Int -> Int -> Int) , fun "-" ((-) :: Int -> Int -> Int)
test/utils.hs view
@@ -16,11 +16,6 @@ , holds n $ \xs ys -> length xs >= length ys ==> zipWith (<>) xs (ys <> repeat mempty) == mzip xs (ys :: [[Int]]) - , sets [] == [[] :: [Int]]- , sets [1] == [[1], [] :: [Int]]- , sets [1,2] == [[1,2], [1], [2], [] :: [Int]]- , sets [1,2,3] == [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[] :: [Int]]- , prods [ [1], [2], [3] ] == [[1,2,3]] , prods [ [1,2], [3,4], [5] ] == [[1,3,5],[1,4,5],[2,3,5],[2,4,5]] , prods [ [1,2], [3], [4,5] ] == [[1,3,4],[1,3,5],[2,3,4],[2,3,5]]