h$[?Ib      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela None  code-conjureThe deconstruction is considered valid if it converges for more than half of the given values. code-conjureWARNING: uses ' and should only be used for debugging! > idIO print 10 10 10(c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela None 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-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]You need to provide this as part of your building blocks on the primitives if you want recursive functions to be considered and produced. code-conjure0Application cross-product between lists of Exprs 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)]  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela NoneR code-conjure Evaluates an  using the given 1 as definition when a recursive call is found.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela None+h 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. code-conjureReturns   of values encoded as s when possible or  otherwise. 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.'A hole, an equality function and tiers. 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 ... 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 ...%%(c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela None. 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.(c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela None#$9 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-conjure0require recursive calls to deconstruct arguments code-conjure5use pattern matching to create (recursive) candidates code-conjure3show theory discovered by Speculate used in pruning code-conjure force tests 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 -- 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-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 code-conjureLike $ but allows setting options through /. 8conjureWith args{maxSize = 11} "function" function [...] code-conjureLike  but in the pure world.Returns a triple with: tiers of implementations&tiers of candidate bodies (right type))tiers of candidate expressions (any type)a list of tests code-conjureLike $ but allows setting options through  and . code-conjure/Return apparently unique candidate definitions. code-conjureReturn apparently unique candidate definitions where there is a single body. code-conjure*Return apparently unique candidate bodies. code-conjureReturn apparently unique candidate definitions using pattern matching.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela NoneG  code-conjure;A partial specification of a function with three arguments.(To be passed as one of the arguments to  code-conjure9A partial specification of a function with two arguments: appSpec :: Spec2 [Int] [Int] [Int] appSpec = [ (,) [] [0,1] -= [0,1] , (,) [2,3] [] -= [2,3] , (,) [4,5,6] [7,8,9] -= [4,5,6,7,8,9] ](To be passed as one of the arguments to . code-conjure8A partial specification of a function with one argument: sumSpec :: Spec1 [Int] Int sumSpec = [ [] -= 0 , [1,2] -= 3 , [3,4,5] -= 12 ](To be passed as one of the arguments to . code-conjure0To be used when constructing specifications: ,  and . code-conjure6Conjures a one argument function from a specification.Given: sumSpec :: Spec1 [Int] Int sumSpec = [ [] -= 0 , [1,2] -= 3 , [3,4,5] -= 12 ] sumPrimitives :: [Prim] sumPrimitives = [ prim "null" (null :: [Int] -> Bool) , pr (0::Int) , prim "+" ((+) :: Int -> Int -> Int) , prim "head" (head :: [Int] -> Int) , prim "tail" (tail :: [Int] -> [Int]) ]Then: > conjure1 "sum" sumSpec sumPrimitives sum :: [Int] -> Int -- testing 3 combinations of argument values -- ... -- looking through 189/465 candidates of size 10 xs ++ ys = if null xs then ys else head xs:(tail xs ++ ys)(cf. , ) code-conjure6Conjures a two argument function from a specification.Given: appSpec :: Spec2 [Int] [Int] [Int] appSpec = [ (,) [] [0,1] -= [0,1] , (,) [2,3] [] -= [2,3] , (,) [4,5,6] [7,8,9] -= [4,5,6,7,8,9] ] appPrimitives :: [Expr] appPrimitives = [ prim "null" (null :: [Int] -> Bool) , prim ":" ((:) :: Int -> [Int] -> [Int]) , prim "head" (head :: [Int] -> Int) , prim "tail" (tail :: [Int] -> [Int]) ]Then: > conjure2 "++" appSpec appPrimitives (++) :: [Int] -> [Int] -> [Int] -- testing 3 combinations of argument values -- ... -- looking through 26166/57090 candidates of size 11 xs ++ ys = if null xs then ys else head xs:(tail xs ++ ys)(cf. , ) code-conjure8Conjures a three argument function from a specification.(cf. , ) code-conjureLike $ but allows setting options through /. code-conjureLike $ but allows setting options through /. code-conjureLike $ but allows setting options through /.  (c) 2021 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela NoneH22                   ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                                             )code-conjure-0.4.2-I1vlzQaZqeTCkaeyxHRx90 Conjure.ExprConjure.EngineConjure.Conjurable Conjure.Utils Conjure.Defn Conjure.Prim Conjure.SpecConjure$express-1.0.4-B8eoEVz0rB7JtfhspEkXsjData.Express.Fixtures-...-enumFromThenTo'-... enumFromThen'-..- enumFromTo'-.. enumFrom'map'mapE-.-compose-%-product'sum'or'and'qqsppsbs_sixtuple quintuple quadrupletriplecommapair-|-justjustBooljustInt nothingBool nothingIntnothingcompare'if'-<--<=--/=--$-elem'insert'sort'length'null'tail'head'-++- appendInt-:-unitconsCharconsBoolconsIntconsnilCharnilBoolnilInt emptyStringnilzzsyysxxsis_ordEord' lineBreakspacezeezeddeeceebeeaeccsddcccs_c_even'odd'signumEsignum'absEabs'negateEnegate'const'idStringidBoolsidIntsidCharidBoolidIntidEid'minustimes-*-plus-+--?-hhEhhggEggffEffminusTwominusOnetwelveeleventennineeightsevensixfivefourthreetwoonezeronnmmllii'kkjjiixx'zzyyxxi_-||--&&-not'implies-==>-orEandEnotEtruefalsepp'rrqqppb_Data.Express.CanonfastMostSpecificVariationfastMostGeneralVariationfastCanonicalVariationsmostSpecificCanonicalVariationmostGeneralCanonicalVariationcanonicalVariations isCanonicalcanonicalization canonicalizeisCanonicalWithcanonicalizationWithcanonicalizeWithData.Express.InstancespreludeNameInstances findValidApp validApps listVarsWith lookupNames lookupNamemkComparisonLEmkComparisonLT mkEquation mkComparisonisEqOrdisOrdisEqisEqOrdTisOrdTisEqTlookupComparison mkNameWithmkNamemkOrdLessEqualmkOrdmkEq reifyName reifyEqOrdreifyOrdreifyEqData.Express.Express.DerivederiveExpressCascadingderiveExpressIfNeeded deriveExpressData.Express.ExpressexprExpressData.Express.Foldunfoldfold unfoldTriofoldTrio unfoldPairfoldPairfoldAppData.Express.HolefilllistVarsAsTypeOflistVars isCompletehasHolenubHolesholesisHolehole holeAsTypeOf varAsTypeOfData.Express.Map renameVarsBy////- mapSubexprs mapConstsmapVars mapValuesData.Express.Match isSubexprOf hasInstanceOf encompasses isInstanceOf matchWithmatchData.Express.CoreheightdepthsizearitynubVarsvars nubConstsconsts nubValuesvalues nubSubexprssubexprsisAppisValueisVarisConstisGroundhasVar unfoldAppcompareQuicklycompareLexicographicallycompareComplexityshowExpr showPrecExpr showOpExpr toDynamicevlevalevaluateisFun isWellTyped isIllTypedmtypetyptypvar$$valvalue:$ValueExprData.Express.Utils.TypeableboolTyData.Express.Name.DerivederiveNameCascadingderiveNameIfNeeded deriveNameData.Express.NamenamesnameNameData.Express.Utils.StringvariableNamesFromTemplate'leancheck-0.9.10-8h9G6xmR1toBCesz0EouenTest.LeanCheck.Utils.TypesABCDEF'speculate-0.4.12-FoDzipEbhPnIj7kkGHbv9FTest.Speculate.EnginetheoryFromAtomsTest.Speculate.ReasonprintThy closureLimit canReduceTo equationsrulesThyTest.Speculate.Expr.Ground groundBindsallEqualcountnubOnnubSort iterateUntilmzipgroupOn takeUntil takeNextWhile takeNextUntildeconstructionsisDeconstructionidIOmapHeadsetsheadOrchoices choicesThat filterAndcompareSimplicityfunToVar recursexprapparentlyTerminatesmayNotEvaluateArgumentapplicationOldifFor>$$<primitiveHolesprimitiveApplications valuesBFSholesBFSfillBFSshowEqlhsrhs$$**$$|< possibleHolesenumerateAppsForenumerateFillingsisDeconstructionE revaluatereval useMatchesrehole $fExpressF $fExpressE $fExpressD $fExpressC $fExpressB $fExpressABndnDefnshowDefntoDynamicWithDefn devaluatedeval devalFastdevldefnApparentlyTerminates ConjurableconjureArgumentHolesconjureEquality conjureTiersconjureSubTypes conjureIf conjureCasesconjureArgumentCases conjureSizeconjureExpressconjureEvaluate Reification Reification1 conjureTypeconjureReification1conjureReification reifyEquality reifyTiers reifyExpress conjureHolesconjureMkEquationconjureAreEqualconjureTiersForconjureIsDeconstructorconjureIsUnbreakable cevaluatecevalcevlconjureApplicationconjureVarApplication conjurePats$fNameF$fNameE$fNameD$fNameC$fNameB$fNameA$fConjurable(,,,,,,)$fConjurable(,,,,,)$fConjurable(,,,,)$fConjurable(,,,) $fConjurableF $fConjurableE $fConjurableD $fConjurableC $fConjurableB $fConjurableA$fConjurableComplex$fConjurableRatio$fConjurableWord64$fConjurableWord32$fConjurableWord16$fConjurableWord8$fConjurableWord$fConjurableInt64$fConjurableInt32$fConjurableInt16$fConjurableInt8$fConjurableDouble$fConjurableFloat$fConjurableOrdering$fConjurable->$fConjurableEither$fConjurableMaybe$fConjurable(,,)$fConjurable(,)$fConjurable[]$fConjurableChar$fConjurableInteger$fConjurableInt$fConjurableBool$fConjurable()PrimprprimprifcjHoles cjMkEquation cjAreEqual cjTiersForArgsmaxTestsmaxSizemaxEvalRecursionsmaxEquationSizemaxSearchTestsrequireDescent usePatterns showTheory forceTestsconjureconjureWithMaxSizeargs conjureWithconjpure conjpureWith conjureTheoryconjureTheoryWithcandidateDefnscandidateDefns1candidateExprscandidateDefnsCSpec3Spec2Spec1-=conjure1conjure2conjure3 conjure1With conjure2With conjure3Withbase GHC.IO.UnsafeunsafePerformIOGHC.Base++GHC.Listfilterzip Data.Tuplefstsndmap$Data.Typeable.InternalTypeable Data.Foldableelemminimummaximumfoldr1productsumfoldl1foldl'nullfoldlfoldrlength<>Monoidmconcatmemptymappend GHC.MaybeMaybeNothingJustghc-prim GHC.TypesTyCon Data.ListisSubsequenceOfData.Traversable mapAccumR mapAccumL Data.TypeabletypeOf7typeOf6typeOf5typeOf4typeOf3typeOf2typeOf1 rnfTypeReptypeRepFingerprint typeRepTyCon typeRepArgs splitTyConAppmkFunTy funResultTygcast2gcast1gcasteqTcast showsTypeReptypeReptypeOfTypeReprnfTyContyConFingerprint tyConName tyConModule tyConPackagefindnotElem minimumBy maximumByallanyorand concatMapconcat Data.MonoidFirstgetFirstLastgetLastApgetApData.Semigroup.InternalDualgetDualEndoappEndoAllgetAllAnygetAnySumgetSumProduct getProductAltgetAlt Data.OldListunwordswordsunlineslinesunfoldrsortOnsortBysort permutations subsequencestailsinitsgroupBygroupdeleteFirstsByunzip7unzip6unzip5unzip4zipWith7zipWith6zipWith5zipWith4zip7zip6zip5zip4genericReplicate genericIndexgenericSplitAt genericDrop genericTake genericLengthinsertByinsert partition transpose intercalate intersperse intersectBy intersectunionByunion\\deleteBydeletenubBynub isInfixOf isSuffixOf isPrefixOf findIndices findIndex elemIndices elemIndex stripPrefix dropWhileEnd Data.ProxyProxyData.Type.Equality:~:Refl:~~:HReflunzip3unzipzipWith3zipWithzip3!!lookupreversebreakspansplitAtdroptake dropWhile takeWhilecycle replicaterepeatiterate'iteratescanr1scanrscanl'scanl1scanlfoldl1'initlasttailunconshead Data.MaybemapMaybe catMaybes listToMaybe maybeToList fromMaybefromJust isNothingisJustmaybe Data.Function&onfixswapuncurrycurryflip.constid GHC.Classes&&||Test.LeanCheck.CoreListableGHC.ShowShowEq==tiersString