h*W8      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                        0.5.10 (c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred code-conjure+Checks if all elements of a list are equal. code-conjure+Checks if all elements of a list are equal.Exceptionally this function returns false for an empty or unit list.This returns true when all elements are equal and the list has a length greater than or equal to two. code-conjure+Counts the number of occurrences on a list. code-conjureNubs using a given field. code-conjureEquivalent to  nub . sort but running in  O(n log n). code-conjureZips  values leaving trailing values. '> mzip ["ab","cd"] ["ef"] ["abef","cd"] code-conjure*Group values using a given field selector. code-conjureWARNING: uses ' and should only be used for debugging! > idIO print 10 10 10 code-conjure)Applies a function to the head of a list. code-conjure(Return sets of values based on the list.&The values in the list must me unique. code-conjureLike & but allows providing a default value. code-conjureLists choices of values. code-conjure/Lists choices of values that follow a property. code-conjureA variation of foldr that only uses "zero" when the list is empty code-conjure#Indents a block of text by 4 spaces code-conjure:Indents a block of text with the provided amount of spaces code-conjure0Updates the value in a list at a given position. '> updateAt 2 (*10) [1,2,3,4] [1,2,30,4] code-conjureApplies a function to the first element of a pair. Often known on the wild as mapFst. > first (*10) (1,2) (10,2) code-conjureApplies a function to the second element of a pair. Often known on the wild as mapSnd. > second (*100) (1,2) (1,200)5(c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred3 code-conjureO(n)". Compares the simplicity of two s. An expression e1 is strictly simpler than another expression e2 if the first of the following conditions to distingish between them is: e1 is smaller in size/length than e2 , e.g.: x + y < x + (y + z);or, e1$ has less variable occurrences than e2,or, e1# has fewer distinct constants than e2 , e.g.:  1 + 1 < 0 + 1.9They're otherwise considered of equal complexity, e.g.: x + y and y + z. 9> (xx -+- yy) `compareComplexity` (xx -+- (yy -+- zz)) LT 0> (xx -+- yy) `compareComplexity` (xx -+- xx) EQ 1> (xx -+- xx) `compareComplexity` (one -+- xx) GT 5> (one -+- one) `compareComplexity` (zero -+- one) LT 0> (xx -+- yy) `compareComplexity` (yy -+- zz) EQ 6> (zero -+- one) `compareComplexity` (one -+- zero) EQ code-conjure/Makes the function in an application a variable code-conjure7Given a variable, returns a constant with the same name code-conjureReturns whether the first . has an application instance of the second . code-conjureExpands recursive calls on an expression until the given size limit is reached. )> recursexpr 6 (ff xx) (ff xx) f x :: Int > recursexpr 6 (ff xx) (one -+- ff xx) 1 + (1 + (1 + (1 + f x))) :: Int > recursexpr 6 (ff xx) (if' pp one (xx -*- ff xx)) (if p then 1 else x * (if p then 1 else x * f x)) :: Int > recursexpr 6 (ff xx) (if' pp one (xx -*- ff (gg xx))) (if p then 1 else x * (if p then 1 else g x * f (g (g x)))) :: Int code-conjureChecks if the given recursive call apparently terminates. The first argument indicates the functional variable indicating the recursive call. (> apparentlyTerminates ffE (ff xx) False 5> apparentlyTerminates ffE (if' pp zero (ff xx)) True7This function only allows recursion in the else clause: 6> apparentlyTerminates ffE (if' pp (ff xx) zero) False apparentlyTerminates ffE (if' (odd' (ff xx)) zero zero) False code-conjureChecks if the given functional expression may refrain from evaluating its next argument. +> mayNotEvaluateArgument (plus :$ xx) False *> mayNotEvaluateArgument (andE :$ pp) TrueThis returns false for non-funcional value even if it involves an application which may not evaluate its argument. 1> mayNotEvaluateArgument (andE :$ pp :$ qq) False;This currently works by checking if the function is an if,  or . code-conjureCreates an if  of the type of the given proxy. :> ifFor (undefined :: Int) if :: Bool -> Int -> Int -> Int > ifFor (undefined :: String) if :: Bool -> [Char] -> [Char] -> [Char] code-conjureCreates a case  of the type of the given proxy. > caseForOrd (undefined :: Int) case :: Ordering -> Int -> Int -> Int -> Int > caseForOrd (undefined :: String) case :: Ordering -> [Char] -> [Char] -> [Char] -> [Char] code-conjure#Lists terminal values in BFS order.(cf. (, , ) code-conjureLists holes in BFS order.(cf. C, , ) code-conjureFills holes in BFS order.(cf. I, , ) code-conjureLike  % but always works regardless of type.Warning: just like  ), this may produce ill-typed expressions. 6> zero $$** zero Just (0 0 :: ill-typed # Int $ Int #)Together with , this function is unused but is useful when experiment with the source to see the effect of type-corrected on pruning the search space.(cf.  , ) code-conjureLike  & but relaxed to work on correct kinds. > ordE $$|< zero Just (ord 0 :: ill-typed # Char -> Int $ Int #) > zero $$|< zero NothingWarning: just like  ), this may produce ill-typed expressions.Together with , this function is unused but is useful when experiment with the source to see the effect of type-corrected on pruning the search space.(cf.  , ) code-conjure:Lists all distinct holes that are possible with the given s. > possibleHoles [zero, one, plus] [_ :: Int,_ :: Int -> Int,_ :: Int -> Int -> Int] > possibleHoles [ae, ordE] [_ :: Char,_ :: Int,_ :: Char -> Int] code-conjureEnumerate applications between values of the given list of primitives and of the given expressions's type. Arguments: an  whose type we are interested in a filtering function, returning  for the expressions to keep7a list of primitives to be used in building expression.Result:> a potentially infinite list of list of enumerated expressions>The enumeration here is type-directed for performance reasons. code-conjure$Given an expression whose holes are all of the same type and an enumeration of s of this same type, enumerate all possible fillings of the original expression with the s in the enumeration. code-conjure Evaluates an  to a  value using the given recursive definition and maximum number of recursive calls.(cf.  ) code-conjure Evaluates an  to a regular Haskell value using the given recursive definition and maximum number of recursive calls. If there's a type mismatch, this function returns .(cf. , ) code-conjure Evaluates an  to a regular Haskell value using the given recursive definition and maximum number of recursive calls. If there's a type mismatch, this function returns the given default value.(cf. , ) code-conjurelike 4 but prefers enumerating from the second tiers first code-conjure useMatches [xx,yy] [xx,yy] = [[(xx,xx), (yy,yy)]] useMatches [xx,yy] [yy,xx] = [[(xx,xx), (yy,yy)]] useMatches [yy,xx] [xx,yy] = [[(yy,yy), (xx,xx)]] useMatches [xx,yy] [xx,xx] = [] useMatches [xx,yy] [abs' xx, abs' yy] = [[(xx,abs' xx), (yy, abs' yy)]] useMatches [xx-:-xxs, yy-:-yys] [abs' xx, abs' yy] = [(xx-:-xxs, abs' xx), (yy-:-yys, abs' yy)] code-conjure0Turns all variables of an expression into holes. !> rehole (xx -+- yy) _ + _ :: Int code-conjureTakes two expressions and returns all possible ways in which the first expression can appear once in one of the holes of the second expression. > deholings zero (i_ -+- i_ -+- i_) [ (0 + _) + _ :: Int , (_ + 0) + _ :: Int , (_ + _) + 0 :: Int ] > deholings zero (i_ -+- one -+- ord' c_) [(0 + 1) + ord _ :: Int] code-conjure:Dig a hole in a function application at the given position %> digApp 1 (one -+- two) _ + 2 :: Int %> digApp 2 (one -+- two) 1 + _ :: Int code-conjureExtracts the argument of a function application at the given position. (one -+- two) $!! 11 :: Int (one -+- two) $!! 22 :: Int code-conjureExtracts a value in a function application at the given position 5> extractApp 1 (one -+- two) (_ + 2 :: Int, 1 :: Int) 5> extractApp 2 (one -+- two) (1 + _ :: Int, 2 :: Int) code-conjure'Lists conflicts between two expressions > conflicts (one -+- two) (three -+- four) [(1 :: Int,3 :: Int), (2 :: Int,4 :: Int)] > conflicts (xx -:- nil) (xx -:- yy -:- yys) [(nil, yy -:- yys)] > conflicts (one -:- one -:- nil) (zero -:- zero -:- xx -:- xxs) [(1 :: Int,0 :: Int),([] :: [Int],x:xs :: [Int])] code-conjure-Is the expression encoding a negative number. This function is sort of a hack. code-conjureLists all variables in an expression that are of the same type of the expression itself. > rvars (ff xx) [x :: Int] 8> rvars (xx -:- xxs -++- yys) [xs :: [Int], ys :: [Int]]+They are listed and without repetitions in  order: > rvars (xx -:- yys -++- xxs -++- xxs) [xs :: [Int],ys :: [Int]] (cf. nubVars) code-conjure Is this a strict subexpression? QR=IOPV/ .2v8yS4  !"#$%&'()*+,-0135679:;<>?@ABCDEFGHJKLMNTUWXYZ[\]^_`abcdefghijklmnopqrstuwxz{|}~ QR=IOPV/ .2v8yS4  !"#$%&'()*+,-0135679:;<>?@ABCDEFGHJKLMNTUWXYZ[\]^_`abcdefghijklmnopqrstuwxz{|}~(c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred:X(c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-InferredM> code-conjure"A single binding in a definition (). code-conjure Int) (=-) = (,) infixr 0 =- sumDefn :: Defn sumDefn = [ sum' nil =- zero , sum' (xx -:- xxs) =- xx -+- (sumV :$ xxs) ] where sum' e = sumV :$ e code-conjurePretty-prints a  as a : > putStr $ showDefn sumDefn sum [] = 0 sum (x:xs) = x + sum xs code-conjurePretty-prints a  to the screen. :> printDefn sumDefn sum [] = 0 sum (x:xs) = x + sum xs code-conjure Evaluates an  to a  value using the given 1 as definition when a recursive call is found. Arguments: 4a function that deeply reencodes an expression (cf. R)+the maximum number of recursive evaluationsa & to be used when evaluating the given an  to be evaluatedThis function cannot be used to evaluate a functional value for the given 5 and can only be used when occurrences of the given  are fully applied.%The function the deeply reencodes an 0 can be defined using functionality present in Conjure.Conjurable>. Here's a quick-and-dirty version that is able to reencode s, s and their lists: exprExpr :: Expr -> Expr exprExpr = conjureExpress (undefined :: Bool -> [Bool] -> Int -> [Int] -> ())?The maximum number of recursive evaluations counts in two ways: the maximum number of entries in the recursive-evaluation memo table;the maximum number of terminal values considered (but in this case the limit is multiplied by the _size_ of the given .These could be divided into two separate parameters but then there would be an extra _dial_ to care about...(cf. , , ) code-conjure Evaluates an  expression into $ a regular Haskell value using a  definition when it is found. If there's a type-mismatch, this function returns .This function requires a -deep-reencoding function and a limit to the number of recursive evaluations.(cf. , , ) code-conjure Evaluates an 4 expression into a regular Haskell value using a  definition when it is found in the given expression. If there's a type-mismatch, this function return a default value.This function requires a -deep-reencoding function and a limit to the number of recursive evaluations.(cf. , , devl') code-conjureLike # but only works for when the given & definition has no case breakdowns./In other words, this only works when the given  is a singleton list whose first value of the only element is a simple application without constructors. code-conjure Evaluates an 4 expression into a regular Haskell value using a  definition when it is found in the given expression. If there's a type-mismatch, this raises an error.This function requires a -deep-reencoding function and a limit to the number of recursive evaluations.(cf. ,  , deval') code-conjure%Returns whether the given definition . code-conjureReturns whether the definition is complete, i.e., whether it does not have any holes in the RHS. code-conjureReturns whether the binding is complete, i.e., whether it does not have any holes in the RHS. code-conjureReturns whether a binding has undefined variables, i.e., there are variables in the RHS that are not declared in the LHS. $> hasUnbound (xx -:- xxs, xxs) False #> hasUnbound (xx -:- xxs, yys) TrueFor s, use . code-conjureReturns whether a  has undefined variables, i.e., there are variables in the RHSs that are not declared in the LHSs. 3> isUndefined [(nil, nil), (xx -:- xxs, xxs)] False 2> isUndefined [(nil, xxs), (xx -:- xxs, yys)] True For single s, use . code-conjure)Returns whether a binding is a base case. '> isBaseCase (ff (xx -:- nil), xx) True ,> isBaseCase (ff (xx -:- xxs), ff xxs) False(cf. ) code-conjure)Returns whether a binding is a base case. -> isRecursiveCase (ff (xx -:- nil), xx) False 0> isRecursiveCase (ff (xx -:- xxs), ff xxs) True(cf. ) code-conjure)Returns whether a definition is recursive QR=IOPV/ .2v8yS4  !"#$%&'()*+,-0135679:;<>?@ABCDEFGHJKLMNTUWXYZ[\]^_`abcdefghijklmnopqrstuwxz{|}~(c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred_~  code-conjureReturns whether the given 5 is redundant with regards to repetitions on RHSs."Here is an example of a redundant : /0 ? 0 = 1 0 ? x = 1 x ? 0 = x x ? y = x,It is redundant because it is equivalent to: 0 ? _ = 1 x ? _ = xThis function safely handles holes on the RHSs by being conservative in cases these are found: nothing can be said before their fillings. code-conjureReturns whether the given 5 is redundant with regards to repetitions on RHSs."Here is an example of a redundant : /0 ? 0 = 1 0 ? x = 1 x ? 0 = x x ? y = x,It is redundant because it is equivalent to: 0 ? _ = 1 x ? _ = x1 and x? are repeated in the results for when the first arguments are 0 and x. code-conjureReturns whether the given 1 is redundant with regards to case elimination7The following is redundant according to this criterium: !foo [] = [] foo (x:xs) = x:xsIt is equivalent to:  foo xs = xs The following is also redundant: %[] ?? xs = [] (x:xs) ?? ys = x:xsas it is equivalent to: xs ?? ys == xs4This function is not used as one of the criteria in  because it does not pay-off in terms of runtime vs number of pruned candidates. code-conjureReturns whether the given + is redundant with regards to recursionsThe following is redundant: )xs ?? [] = [] xs ?? (x:ys) = xs ?? []The LHS of a base-case pattern, matches the RHS of a recursive pattern. The second RHS may be replaced by simply [] which makes it redundant. code-conjureReturns whether a given 1 is redundant with regards to root recursions.When there is a single base case and all recursive calls are at the root: we have a redundant function. (Modulo error functions, which are undesired anyway.) &xs ? [] = [] xs ? (x:ys) = xs ? ysAbove it does not really pays off to follow the recursive calls, at the end we always reach an empty list. The same goes for the following: &xs ? [] = xs xs ? (x:ys) = xs ? ys code-conjure5Introduces a hole at a given position in the binding: > introduceVariableAt 1 (xxs -?- (yy -:- yys), (yy -:- yys) -++- (yy -:- yys)) (xs ? (y:ys) :: [Int],(y:ys) ++ (y:ys) :: [Int]) > introduceVariableAt 2 (xxs -?- (yy -:- yys), (yy -:- yys) -++- (yy -:- yys)) (xs ? x :: [Int],x ++ x :: [Int])"Relevant occurrences are replaced. code-conjureReturns whether the given ? is redundant with regards to subsumption by latter patterns"Here is an example of a redundant  by this criterium: foo 0 = 0 foo x = x code-conjureReturns whether the given 2 is redundant modulo subsumption and rewriting.(cf. ) code-conjure6Simplifies a definition by removing redundant patterns)This may be useful in the following case: 70 ^^^ 0 = 0 0 ^^^ x = x x ^^^ 0 = x _ ^^^ _ = 02The first pattern is subsumed by the last pattern. code-conjureReturns whether a binding is subsumed by another modulo rewriting > let normalize = (// [(zero -+- zero, zero)]) > subsumedWith normalize (ff zero, zero) (ff xx, xx -+- xx) True > subsumedWith normalize (ff zero, zero) (ff xx, xx -+- one) False > subsumedWith normalize (zero -?- xx, zero) (xx -?- yy, xx -+- xx) True(cf. )  (c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferredz~# code-conjure Class of  types. Functions are  if all their arguments are ,  and able.For atomic types that are , instances are defined as: >instance Conjurable Atomic where conjureTiers = reifyTiersFor atomic types that are both  and , instances are defined as: instance Conjurable Atomic where conjureTiers = reifyTiers conjureEquality = reifyEquality3For types with subtypes, instances are defined as: instance Conjurable Composite where conjureTiers = reifyTiers conjureEquality = reifyEquality conjureSubTypes x = conjureType y . conjureType z . conjureType w where (Composite ... y ... z ... w ...) = xAbove x, y, z and w are just proxies. The Proxy. type was avoided for backwards compatibility.Please see the source code of Conjure.Conjurable for more examples.(cf. , , ) code-conjureReturns  the  function encoded as an  when available or  otherwise.Use  when defining this. code-conjureReturns   of values encoded as s when possible or  otherwise.Use  when defining this. code-conjure%Returns an if-function encoded as an . code-conjure#Returns a top-level case breakdown. code-conjure0Returns the (recursive) size of the given value. code-conjureReturns a function that deeply reencodes an expression when possible. ( when not available.)Use  when defining this. code-conjure9A primtive expression (paired with instance reification). code-conjure)A reification over a collection of types.4Represented as a transformation of a list to a list. code-conjure4Single reification of some functions over a type as s.This is a sixtuple, in order: a hole encoded as an ;the  function encoded as an  when available;& of enumerated test values encoded as s when available;*infinite list of potential variable names;.boolean indicating whether the type is atomic;the  function encoded as an . code-conjure8Provides a primitive value to Conjure. To be used on  instances. (cf. ) code-conjureProvides a primitive value to Conjure. To be used on values that are not ) instances such as functions. (cf. ) code-conjure$To be used in the implementation of . instance ... => Conjurable where ... conjureSubTypes x = conjureType (field1 x) . conjureType (field2 x) . ... . conjureType (fieldN x) ... code-conjurelike  but without type repetitions code-conjure Conjures a  for a  type.&This is used in the implementation of . code-conjureConjures a list of  for a  type, its subtypes and .'This is used in the implementation of , , , , , , etc. code-conjureReifies equality  in a  type instance.)This is to be used in the definition of  of  typeclass instances: instance ... => Conjurable where ... conjureEquality = reifyEquality ... code-conjure1Reifies equality to be used in a conjurable type.)This is to be used in the definition of  of  typeclass instances: instance ... => Conjurable where ... conjureTiers = reifyTiers ... code-conjure Reifies the R function in a  type instance.)This is to be used in the definition of  of  typeclass instances. instance ... => Conjurable where ... conjureExpress = reifyExpress ... code-conjure$Computes a list of holes encoded as  s from a  functional value.(cf. ) code-conjureComputes a function that makes an equation between two expressions. code-conjureGiven a  functional value, computes a function that checks whether two -s are equal up to a given number of tests. code-conjureCompute  of values encoded as s of the type of the given . code-conjure Compure a  of values encoded as s of the type of the given . code-conjure%Compute variable names for the given  type. code-conjure Conjures an 5-encoded size function for the given expression type. > conjureSizeFor (undefined :: [Int] -> [Bool]) i_ conjureSize :: Int -> Int > conjureSizeFor (undefined :: [Int] -> [Bool]) is_ conjureSize :: [Int] -> Int > conjureSizeFor (undefined :: [Int] -> [Bool]) bs_ conjureSize :: [Bool] -> Int code-conjure Checks if an  is of an unbreakable type. code-conjure Evaluates a + into a regular Haskell value returning  when there's a type mismatch.The integer argument indicates the limit of recursive evaluations. code-conjure Evaluates a  into a regular Haskell value returning the given default value when there's a type mismatch.The integer argument indicates the limit of recursive evaluations. code-conjure Evaluates a  into a regular Haskell value raising an error there's a type mismatch.The integer argument indicates the limit of recursive evaluations. code-conjure7Computes a complete application for the given function. ,> conjureApplication "not" not not p :: Bool > conjureApplication "+" ((+) :: Int -> Int -> Int) x + y :: Int(cf. ) code-conjureComputes a complete application for a variable of the same type of the given function. /> conjureVarApplication "not" not not p :: Bool > conjureVarApplication "+" ((+) :: Int -> Int -> Int) x + y :: Int(cf. ) code-conjureUsed in the implementation of  and . code-conjure:Computes tiers of sets of patterns for the given function. > conjurePats [zero] "f" (undefined :: Int -> Int) [[[f x :: Int]],[[f 0 :: Int,f x :: Int]]] code-conjure?Returns a list of tiers of possible patterns for each argument.The outer list has the same number of elements as the number of arguments of the given function.This function is internal and only used in the implementation of . It may be removed from the API without further notice. It has been temporarily promoted to public to help refactor ./QR/QR(c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred+ code-conjure,Checks if an expression is a deconstruction.There should be a single A in the expression.It should decrease the size of all arguments that have a size greater than 0. code-conjureReturns whether a non-empty subset of arguments descends arguments by deconstruction. 9> descends isDec (xxs -++- yys) (xxs -++- tail' yys) True 4> descends isDec (xxs -++- yys) (xxs -++- yys) False > descends isDec (xxs -++- yys) (head' xxs -:- tail xxs -++- head' yys -:- tail yys) False code-conjure*Compute candidate deconstructions from an .&This is used in the implementation of   followed by . > candidateDeconstructionsFrom (xx `mod'` yy) [ _ `mod` y , x `mod` _ ]To be constrasted with . code-conjure*Compute candidate deconstructions from an .&This is used in the implementation of   followed by .This is similar to y but always leaves a hole of the same return type as the given expression. > candidateDeconstructionsFrom (i_ `mod'` i_) [ _ `mod` x , x `mod` _ ]To be contrasted with (c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred  code-conjure9A primtive expression (paired with instance reification). code-conjure8Provides a primitive value to Conjure. To be used on  instances. (cf. ) code-conjureProvides a primitive value to Conjure. To be used on values that are not ) instances such as functions. (cf. ) code-conjure8Provides an if condition bound to the given return type. code-conjure9Provides a case condition bound to the given return type. code-conjureComputes a list of s from a list of s.'This function mirrors functionality of . code-conjure$Computes a list of holes encoded as s from a list of s.)This function mirrors functionality from . code-conjure%Computes a function that equates two s from a list of s.)This function mirrors functionality from . code-conjureGiven a list of 2s, computes a function that checks whether two -s are equal up to a given number of tests. code-conjureGiven a list of s, computes a grounds function that lists ground expressions of an . code-conjureGiven a list of 's, returns a function that given an  will return tiers of test  values.This is used in .   (c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred! code-conjureFor debugging purposes./This may be taken out of the API at any moment. code-conjureFor debugging purposes, finds a set of arguments that triggers an error in the candidate .Warning: this is an experimental function which may be taken out of the API at any moment. code-conjure%Is the argument value an error value? (c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred%&$ code-conjureArguments to be passed to  or  . See  for the defaults. code-conjure)maximum number of tests to each candidate code-conjure maximum size of candidate bodies code-conjure?maximum number of recursive evaluations when testing candidates code-conjure!maximum size of equation operands code-conjure4maximum number of tests to search for defined values code-conjure'maximum size of deconstructions (e.g.: _ - 1) code-conjure0require recursive calls to deconstruct arguments code-conjure5use pattern matching to create (recursive) candidates code-conjure.copy partial definition bindings in candidates code-conjure5restrict constant/ground numeric expressions to atoms code-conjure3show theory discovered by Speculate used in pruning code-conjure unique-modulo-testing candidates code-conjure;Conjures an implementation of a partially defined function.Takes a  with the name of a function, a partially-defined function from a conjurable type, and a list of building blocks encoded as s.For example, given: square :: Int -> Int square 0 = 0 square 1 = 1 square 2 = 4 primitives :: [Prim] primitives = [ pr (0::Int) , pr (1::Int) , prim "+" ((+) :: Int -> Int -> Int) , prim "*" ((*) :: Int -> Int -> Int) ](The conjure function does the following: > conjure "square" square primitives square :: Int -> Int -- pruning with 14/25 rules -- testing 3 combinations of argument values -- looking through 3 candidates of size 1 -- looking through 3 candidates of size 2 -- looking through 5 candidates of size 3 square x = x * x$The primitives list is defined with  and . code-conjure9Conjures an implementation from a function specification.This function works like  but instead of receiving a partial definition it receives a boolean filter / property about the function.For example, given: squareSpec :: (Int -> Int) -> Bool squareSpec square = square 0 == 0 && square 1 == 1 && square 2 == 4Then: > conjureFromSpec "square" squareSpec primitives square :: Int -> Int -- pruning with 14/25 rules -- looking through 3 candidates of size 1 -- looking through 4 candidates of size 2 -- looking through 9 candidates of size 3 square x = x * xThis allows users to specify QuickCheck-style properties, here is an example using LeanCheck: import Test.LeanCheck (holds, exists) squarePropertySpec :: (Int -> Int) -> Bool squarePropertySpec square = and [ holds n $ \x -> square x >= x , holds n $ \x -> square x >= 0 , exists n $ \x -> square x > x ] where n = 60 code-conjureSynthesizes an implementation from both a partial definition and a function specification.This works like the functions  and  combined. code-conjureLike  but allows setting the maximum size of considered expressions instead of the default value of 12. /conjureWithMaxSize 10 "function" function [...] code-conjureDefault arguments to conjure. 60 testsfunctions of up to 12 symbols9maximum of one recursive call allowed in candidate bodies)maximum evaluation of up to 60 recursions#pruning with equations up to size 5=search for defined applications for up to 100000 combinations0require recursive calls to deconstruct arguments%don't show the theory used in pruning,do not make candidates unique module testing code-conjureLike $ but allows setting options through /. 8conjureWith args{maxSize = 11} "function" function [...] code-conjureLike $ but allows setting options through /. ?@ABCDEFGHJKLMNTUWXYZ[\]^_`abcdefghijklmnopqrstuwxz{|}~ QR=IOPV/ .2v8yS4  !"#$%&'()*+,-0135679:;<>?@ABCDEFGHJKLMNTUWXYZ[\]^_`abcdefghijklmnopqrstuwxz{|}~ (c) 2019-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferred code-conjure Derives an  instance for the given type .This function needs the TemplateHaskell extension.If , , , 7, ... are not in scope, this will derive them as well.&For now, this function only derives ,  and  and does not derive ,  and . These will be added in future versions. If you plan to use features that depend on these functionalities, please define your instances manually. code-conjureSame as 4 but does not warn when instance already exists ( is preferable).&For now, this function only derives ,  and  and does not derive ,  and . These will be added in future versions. If you plan to use features that depend on these functionalities, please define your instances manually. code-conjure Derives a  instance for a given type 3 cascading derivation of type arguments as well.&For now, this function only derives ,  and  and does not derive ,  and . These will be added in future versions. If you plan to use features that depend on these functionalities, please define your instances manually.(c) 2021-2024 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela  Safe-Inferredj6 QR6 QR !"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?!@!A!B!C!D!E!F!G!H!I!J!KLMLNLOLPLQLRSTSUSVSWSXSYSZ[\[][^[_[`[a[b[c[d[e[fghgigjgkglgmgnopoqrsrtruvwvxvyz{z|z}z~zzzzzzzzzzzzzzzzzzzzzz                                             *code-conjure-0.5.10-7A4XuJShfmoJYOa2S7Kq3K Conjure.Utils Conjure.ExprConjure.ConjurableConjure.Reason Conjure.DefnConjure.Defn.Redundancy Conjure.Red Conjure.PrimConjure.Defn.TestConjure.EngineConjure.Conjurable.Derive code-conjuretoDynamicWithDefn devaluatedevalcjHolescandidateDefnsCcandidateExprsConjure%express-1.0.16-2G1rkNymrAw73S4R2rSOItData.Express.Utils.List isSubsetOfData.Express.Utils.StringvariableNamesFromTemplateData.Express.NameNamenamenamesData.Express.Name.Derive deriveNamederiveNameIfNeededderiveNameCascadingData.Express.CoreExprValue:$valueval$$vartypetypmtyp isIllTyped isWellTypedisFunevaluateevalevl toDynamic showOpExpr showPrecExprshowExprcompareComplexitycompareLexicographicallycompareQuickly unfoldApphasVarisGroundisConstisVarisValueisAppsubexprs nubSubexprsvalues nubValuesconsts nubConstsvarsnubVarsaritysizedepthheightData.Express.Matchmatch matchWith isInstanceOf encompasses hasInstanceOf isSubexprOfData.Express.Map mapValuesmapVars mapConsts mapSubexprs//-// renameVarsByData.Express.Hole varAsTypeOf holeAsTypeOfholeisHoleholesnubHoleshasHole isCompletelistVarslistVarsAsTypeOffillData.Express.FoldfoldAppfoldPair unfoldPairfoldTrio unfoldTriofoldunfoldData.Express.ExpressExpressexprData.Express.Express.Derive deriveExpressderiveExpressIfNeededderiveExpressCascadingData.Express.Basic>$$<>$$$$<Data.Express.InstancesreifyEqreifyOrd reifyEqOrd reifyNamemkEqmkOrdmkOrdLessEqualmkName mkNameWithlookupComparisonisEqTisOrdTisEqOrdTisEqisOrdisEqOrd mkComparison mkEquationmkComparisonLTmkComparisonLE lookupName lookupNames listVarsWith validApps findValidApppreludeNameInstancesData.Express.CanoncanonicalizeWithcanonicalizationWithisCanonicalWith canonicalizecanonicalization isCanonicalcanonicalVariationsmostGeneralCanonicalVariationmostSpecificCanonicalVariationfastCanonicalVariationsfastMostGeneralVariationfastMostSpecificVariationData.Express.Fixturesb_ppqqrrpp'falsetruenotEandEorE-==>-impliesnot'-&&--||-i_xxyyzzxx'iijjkkii'llmmnnzeroonetwothreefourfivesixseveneightnineteneleventwelveminusOneminusTwoffffEggggEhhhhEff2ff3ff4-?-questionooooE-+-plus-*-timesminusdiv'divEmod'modEquot'quotErem'remEid'idEidIntidBoolidCharidIntsidBoolsidStringconst'negate'negateEabs'absEsignum'signumEodd'even'c_cs_ccddccsaebeeceedeezedzeespace lineBreakord'ordEis_xxsyyszzsnil emptyStringnilIntnilBoolnilCharconsconsIntconsBoolconsCharunit-:- appendInt-++-head'tail'null'length'init'sort'insert'elem'drop'take'-$--/=--<=--<-if'caseBool caseOrderingcompare'nothing nothingInt nothingBooljustIntjustBooljust-|-paircommatriple quadruple quintuplesixtuplebs_ppsqqsand'or'sum'product'-%-compose-.-mapEmap'foldr'filter' enumFrom'-.. enumFromTo'-..- enumFromThen'--..enumFromThenTo'--..-%leancheck-1.0.2-2kJpCk70X6JLsy5lKOvh3Test.LeanCheck.Statsclassify classifyBy classifyOnTest.LeanCheck.Utils.TypesFEDCBA'speculate-0.4.16-Aj86TLujh535w8QyaeB2eGTest.Speculate.Expr.Groundgrounds groundBindsTest.Speculate.ReasonThyrules equations canReduceTo closureLimitinvalid normalizeprintThy doubleCheckTest.Speculate.EnginetheoryFromAtomsallEqual allEqualOn allEqual2countnubOnnubSortmzipgroupOnidIOmapHeadsetsheadOrchoices choicesThatfoldr0indentindentBynoneupdateAtfirstsecondboth+++compareSimplicityfunToVar varToConsthasAppInstanceOf recursexprapparentlyTerminatesmayNotEvaluateArgumentifFor caseForOrd valuesBFSholesBFSfillBFS$$**$$|< possibleHolesenumerateAppsForenumerateFillings revaluatereval useMatchesrehole deholingsdigApp updateAppAt$!! extractApp conflicts listConflicts isNegativervarsisStrictSubexprOf $fExpressF $fExpressE $fExpressD $fExpressC $fExpressB $fExpressA isRootNormalC isRootNormalE isCommutativecommutativeOperatorsBndnDefnshowDefn printDefn devalFastdevldefnApparentlyTerminatesisCompleteDefnisCompleteBndncanonicalizeBndncanonicalizeBndnLast hasUnbound noUnbound isUndefined isDefined isBaseCaseisRecursiveCaseisRecursiveDefnisRedundantDefnisRedundantByRepetitionisRedundantByIntroductionhasRedundantRecursionintroduceVariableAtisRedundantBySubsumptionisRedundantModuloRewriting simplifyDefn subsumedWith ConjurableconjureArgumentHolesconjureEquality conjureTiersconjureSubTypes conjureIf conjureCasesconjureArgumentCases conjureSizeconjureExpressconjureEvaluate Reification Reification1 conjureTypeconjureReification1conjureReification reifyEquality reifyTiers reifyExpress conjureHolesconjureMkEquationconjureDynamicEqconjureAreEqualconjureTiersForconjureGroundsconjureListForconjureIsNumeric$conjureMostGeneralCanonicalVariationconjureSizeForconjureIsUnbreakable cevaluatecevalcevlconjureApplicationconjureVarApplication conjurePatsconjureArgumentPats$fNameF$fNameE$fNameD$fNameC$fNameB$fNameA$fConjurable(,,,,,,,,,,,)$fConjurable(,,,,,,,,,,)$fConjurable(,,,,,,,,,)$fConjurable(,,,,,,,,)$fConjurable(,,,,,,,)$fConjurable(,,,,,,)$fConjurable(,,,,,)$fConjurable(,,,,)$fConjurable(,,,) $fConjurableF $fConjurableE $fConjurableD $fConjurableC $fConjurableB $fConjurableA$fConjurableComplex$fConjurableRatio$fConjurableWord64$fConjurableWord32$fConjurableWord16$fConjurableWord8$fConjurableWord$fConjurableInt64$fConjurableInt32$fConjurableInt16$fConjurableInt8$fConjurableDouble$fConjurableFloat$fConjurableOrdering$fConjurableFUN$fConjurableEither$fConjurableMaybe$fConjurable(,,)$fConjurable(,)$fConjurableList$fConjurableChar$fConjurableInteger$fConjurableInt$fConjurableBool$fConjurable()conjureIsDeconstructiondescendscandidateDeconstructionsFrom!candidateDeconstructionsFromHoledPrimprprimprifprimOrdCaseFor cjMkEquation cjAreEqual cjTiersForequalModuloTestingerroneousCandidate findDefnErrorArgsmaxTestsmaxSizemaxEvalRecursionsmaxEquationSizemaxSearchTestsmaxDeconstructionSizerequireDescent usePatterns copyBindings atomicNumbers showTheoryuniqueCandidatesconjureconjureFromSpecconjure0conjureWithMaxSizeargs conjureWithconjureFromSpecWith conjure0WithconjpureconjpureFromSpec conjpure0 conjpureWithconjpureFromSpecWith conjpure0With conjureTheoryconjureTheoryWithcandidateDefnscandidateDefns1deriveConjurablederiveConjurableIfNeededderiveConjurableCascadingbaseGHC.BaseMonoid GHC.IO.UnsafeunsafePerformIOGHC.ListheadzipWith Data.OldListsortBy genericLength Data.Foldable maximumBy minimumBygenericReplicate genericTake genericDropgenericSplitAt genericIndexlengthfoldlfoldrnullfoldl'foldl1sumproductfoldr1maximumminimumelemgroupgroupByfilterunfoldr transposesortOncycle++concatzipmapunconstaillastinitfoldl1'scanlscanl1scanl'scanrscanr1iterateiterate'repeat replicate takeWhile dropWhiletakedropsplitAtspanbreakreverseandoranyallnotElemlookup concatMap!!zip3zipWith3unzipunzip3find dropWhileEnd stripPrefix elemIndex elemIndices findIndex findIndices isPrefixOf isSuffixOf isInfixOfnubnubBydeletedeleteBy\\unionunionBy intersect intersectBy intersperse intercalate partitionData.Traversable mapAccumL mapAccumRinsertinsertByzip4zip5zip6zip7zipWith4zipWith5zipWith6zipWith7unzip4unzip5unzip6unzip7deleteFirstsByinitstails subsequences permutationssort singletonlinesunlineswordsunwords Data.ListisSubsequenceOf$idconst.flip Data.Functionfixon& applyWhen GHC.MaybeMaybeNothingJust Data.MaybemaybeisJust isNothingfromJust fromMaybe maybeToList listToMaybe catMaybesmapMaybeData.Semigroup.InternalAnygetAnySumgetSumProduct getProduct Data.MonoidLastgetLastFirstgetFirstmemptymappendmconcatAltgetAltAllgetAllEndoappEndoDualgetDualApgetAp<>ghc-prim GHC.TupleSolo Data.Tuplefstuncurrysndcurryswap GHC.TypesTyConData.Typeable.InternalTypeable Data.TypeableTypeRepData.Type.Equality:~~:HRefl:~:Refl Data.ProxyProxy tyConPackage tyConModule tyConNametyConFingerprintrnfTyContypeRepFingerprint trLiftedRep typeRepTyContypeReptypeOf rnfTypeRep showsTypeRepcasteqTheqTgcastgcast1gcast2 funResultTymkFunTy splitTyConApp typeRepArgstypeOf1typeOf2typeOf3typeOf4typeOf5typeOf6typeOf7 GHC.Classes&&||TruerecursiveToDynamic Data.DynamicDynamicfliproductWithTest.LeanCheck.Core productWithStringBoolIntisRedundantByRootRecursionsListableGHC.ShowShowEq==tiersnubConjureTypeconjureNamesForlistconjureWhatApplication cjReification cjGroundsisError isGroundPat toGroundPattoValPattemplate-haskellLanguage.Haskell.TH.Syntax Test.LeanCheck.Utils.TypeBinding-:->:->>:->>>: